missing revision 7914d74b
17914d74bSmrg#! /bin/sh 27914d74bSmrg# Common stub for a few missing GNU programs while installing. 37914d74bSmrg 47914d74bSmrgscriptversion=2006-05-10.23 57914d74bSmrg 67914d74bSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 77914d74bSmrg# Free Software Foundation, Inc. 87914d74bSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 97914d74bSmrg 107914d74bSmrg# This program is free software; you can redistribute it and/or modify 117914d74bSmrg# it under the terms of the GNU General Public License as published by 127914d74bSmrg# the Free Software Foundation; either version 2, or (at your option) 137914d74bSmrg# any later version. 147914d74bSmrg 157914d74bSmrg# This program is distributed in the hope that it will be useful, 167914d74bSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 177914d74bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 187914d74bSmrg# GNU General Public License for more details. 197914d74bSmrg 207914d74bSmrg# You should have received a copy of the GNU General Public License 217914d74bSmrg# along with this program; if not, write to the Free Software 227914d74bSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 237914d74bSmrg# 02110-1301, USA. 247914d74bSmrg 257914d74bSmrg# As a special exception to the GNU General Public License, if you 267914d74bSmrg# distribute this file as part of a program that contains a 277914d74bSmrg# configuration script generated by Autoconf, you may include it under 287914d74bSmrg# the same distribution terms that you use for the rest of that program. 297914d74bSmrg 307914d74bSmrgif test $# -eq 0; then 317914d74bSmrg echo 1>&2 "Try \`$0 --help' for more information" 327914d74bSmrg exit 1 337914d74bSmrgfi 347914d74bSmrg 357914d74bSmrgrun=: 367914d74bSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 377914d74bSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 387914d74bSmrg 397914d74bSmrg# In the cases where this matters, `missing' is being run in the 407914d74bSmrg# srcdir already. 417914d74bSmrgif test -f configure.ac; then 427914d74bSmrg configure_ac=configure.ac 437914d74bSmrgelse 447914d74bSmrg configure_ac=configure.in 457914d74bSmrgfi 467914d74bSmrg 477914d74bSmrgmsg="missing on your system" 487914d74bSmrg 497914d74bSmrgcase $1 in 507914d74bSmrg--run) 517914d74bSmrg # Try to run requested program, and just exit if it succeeds. 527914d74bSmrg run= 537914d74bSmrg shift 547914d74bSmrg "$@" && exit 0 557914d74bSmrg # Exit code 63 means version mismatch. This often happens 567914d74bSmrg # when the user try to use an ancient version of a tool on 577914d74bSmrg # a file that requires a minimum version. In this case we 587914d74bSmrg # we should proceed has if the program had been absent, or 597914d74bSmrg # if --run hadn't been passed. 607914d74bSmrg if test $? = 63; then 617914d74bSmrg run=: 627914d74bSmrg msg="probably too old" 637914d74bSmrg fi 647914d74bSmrg ;; 657914d74bSmrg 667914d74bSmrg -h|--h|--he|--hel|--help) 677914d74bSmrg echo "\ 687914d74bSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 697914d74bSmrg 707914d74bSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 717914d74bSmrgerror status if there is no known handling for PROGRAM. 727914d74bSmrg 737914d74bSmrgOptions: 747914d74bSmrg -h, --help display this help and exit 757914d74bSmrg -v, --version output version information and exit 767914d74bSmrg --run try to run the given command, and emulate it if it fails 777914d74bSmrg 787914d74bSmrgSupported PROGRAM values: 797914d74bSmrg aclocal touch file \`aclocal.m4' 807914d74bSmrg autoconf touch file \`configure' 817914d74bSmrg autoheader touch file \`config.h.in' 827914d74bSmrg autom4te touch the output file, or create a stub one 837914d74bSmrg automake touch all \`Makefile.in' files 847914d74bSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 857914d74bSmrg flex create \`lex.yy.c', if possible, from existing .c 867914d74bSmrg help2man touch the output file 877914d74bSmrg lex create \`lex.yy.c', if possible, from existing .c 887914d74bSmrg makeinfo touch the output file 897914d74bSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 907914d74bSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 917914d74bSmrg 927914d74bSmrgSend bug reports to <bug-automake@gnu.org>." 937914d74bSmrg exit $? 947914d74bSmrg ;; 957914d74bSmrg 967914d74bSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 977914d74bSmrg echo "missing $scriptversion (GNU Automake)" 987914d74bSmrg exit $? 997914d74bSmrg ;; 1007914d74bSmrg 1017914d74bSmrg -*) 1027914d74bSmrg echo 1>&2 "$0: Unknown \`$1' option" 1037914d74bSmrg echo 1>&2 "Try \`$0 --help' for more information" 1047914d74bSmrg exit 1 1057914d74bSmrg ;; 1067914d74bSmrg 1077914d74bSmrgesac 1087914d74bSmrg 1097914d74bSmrg# Now exit if we have it, but it failed. Also exit now if we 1107914d74bSmrg# don't have it and --version was passed (most likely to detect 1117914d74bSmrg# the program). 1127914d74bSmrgcase $1 in 1137914d74bSmrg lex|yacc) 1147914d74bSmrg # Not GNU programs, they don't have --version. 1157914d74bSmrg ;; 1167914d74bSmrg 1177914d74bSmrg tar) 1187914d74bSmrg if test -n "$run"; then 1197914d74bSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1207914d74bSmrg exit 1 1217914d74bSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1227914d74bSmrg exit 1 1237914d74bSmrg fi 1247914d74bSmrg ;; 1257914d74bSmrg 1267914d74bSmrg *) 1277914d74bSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1287914d74bSmrg # We have it, but it failed. 1297914d74bSmrg exit 1 1307914d74bSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1317914d74bSmrg # Could not run --version or --help. This is probably someone 1327914d74bSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1337914d74bSmrg # $TOOL exists and not knowing $TOOL uses missing. 1347914d74bSmrg exit 1 1357914d74bSmrg fi 1367914d74bSmrg ;; 1377914d74bSmrgesac 1387914d74bSmrg 1397914d74bSmrg# If it does not exist, or fails to run (possibly an outdated version), 1407914d74bSmrg# try to emulate it. 1417914d74bSmrgcase $1 in 1427914d74bSmrg aclocal*) 1437914d74bSmrg echo 1>&2 "\ 1447914d74bSmrgWARNING: \`$1' is $msg. You should only need it if 1457914d74bSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1467914d74bSmrg to install the \`Automake' and \`Perl' packages. Grab them from 1477914d74bSmrg any GNU archive site." 1487914d74bSmrg touch aclocal.m4 1497914d74bSmrg ;; 1507914d74bSmrg 1517914d74bSmrg autoconf) 1527914d74bSmrg echo 1>&2 "\ 1537914d74bSmrgWARNING: \`$1' is $msg. You should only need it if 1547914d74bSmrg you modified \`${configure_ac}'. You might want to install the 1557914d74bSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1567914d74bSmrg archive site." 1577914d74bSmrg touch configure 1587914d74bSmrg ;; 1597914d74bSmrg 1607914d74bSmrg autoheader) 1617914d74bSmrg echo 1>&2 "\ 1627914d74bSmrgWARNING: \`$1' is $msg. You should only need it if 1637914d74bSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1647914d74bSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1657914d74bSmrg from any GNU archive site." 1667914d74bSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1677914d74bSmrg test -z "$files" && files="config.h" 1687914d74bSmrg touch_files= 1697914d74bSmrg for f in $files; do 1707914d74bSmrg case $f in 1717914d74bSmrg *:*) touch_files="$touch_files "`echo "$f" | 1727914d74bSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1737914d74bSmrg *) touch_files="$touch_files $f.in";; 1747914d74bSmrg esac 1757914d74bSmrg done 1767914d74bSmrg touch $touch_files 1777914d74bSmrg ;; 1787914d74bSmrg 1797914d74bSmrg automake*) 1807914d74bSmrg echo 1>&2 "\ 1817914d74bSmrgWARNING: \`$1' is $msg. You should only need it if 1827914d74bSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1837914d74bSmrg You might want to install the \`Automake' and \`Perl' packages. 1847914d74bSmrg Grab them from any GNU archive site." 1857914d74bSmrg find . -type f -name Makefile.am -print | 1867914d74bSmrg sed 's/\.am$/.in/' | 1877914d74bSmrg while read f; do touch "$f"; done 1887914d74bSmrg ;; 1897914d74bSmrg 1907914d74bSmrg autom4te) 1917914d74bSmrg echo 1>&2 "\ 1927914d74bSmrgWARNING: \`$1' is needed, but is $msg. 1937914d74bSmrg You might have modified some files without having the 1947914d74bSmrg proper tools for further handling them. 1957914d74bSmrg You can get \`$1' as part of \`Autoconf' from any GNU 1967914d74bSmrg archive site." 1977914d74bSmrg 1987914d74bSmrg file=`echo "$*" | sed -n "$sed_output"` 1997914d74bSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2007914d74bSmrg if test -f "$file"; then 2017914d74bSmrg touch $file 2027914d74bSmrg else 2037914d74bSmrg test -z "$file" || exec >$file 2047914d74bSmrg echo "#! /bin/sh" 2057914d74bSmrg echo "# Created by GNU Automake missing as a replacement of" 2067914d74bSmrg echo "# $ $@" 2077914d74bSmrg echo "exit 0" 2087914d74bSmrg chmod +x $file 2097914d74bSmrg exit 1 2107914d74bSmrg fi 2117914d74bSmrg ;; 2127914d74bSmrg 2137914d74bSmrg bison|yacc) 2147914d74bSmrg echo 1>&2 "\ 2157914d74bSmrgWARNING: \`$1' $msg. You should only need it if 2167914d74bSmrg you modified a \`.y' file. You may need the \`Bison' package 2177914d74bSmrg in order for those modifications to take effect. You can get 2187914d74bSmrg \`Bison' from any GNU archive site." 2197914d74bSmrg rm -f y.tab.c y.tab.h 2207914d74bSmrg if test $# -ne 1; then 2217914d74bSmrg eval LASTARG="\${$#}" 2227914d74bSmrg case $LASTARG in 2237914d74bSmrg *.y) 2247914d74bSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2257914d74bSmrg if test -f "$SRCFILE"; then 2267914d74bSmrg cp "$SRCFILE" y.tab.c 2277914d74bSmrg fi 2287914d74bSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2297914d74bSmrg if test -f "$SRCFILE"; then 2307914d74bSmrg cp "$SRCFILE" y.tab.h 2317914d74bSmrg fi 2327914d74bSmrg ;; 2337914d74bSmrg esac 2347914d74bSmrg fi 2357914d74bSmrg if test ! -f y.tab.h; then 2367914d74bSmrg echo >y.tab.h 2377914d74bSmrg fi 2387914d74bSmrg if test ! -f y.tab.c; then 2397914d74bSmrg echo 'main() { return 0; }' >y.tab.c 2407914d74bSmrg fi 2417914d74bSmrg ;; 2427914d74bSmrg 2437914d74bSmrg lex|flex) 2447914d74bSmrg echo 1>&2 "\ 2457914d74bSmrgWARNING: \`$1' is $msg. You should only need it if 2467914d74bSmrg you modified a \`.l' file. You may need the \`Flex' package 2477914d74bSmrg in order for those modifications to take effect. You can get 2487914d74bSmrg \`Flex' from any GNU archive site." 2497914d74bSmrg rm -f lex.yy.c 2507914d74bSmrg if test $# -ne 1; then 2517914d74bSmrg eval LASTARG="\${$#}" 2527914d74bSmrg case $LASTARG in 2537914d74bSmrg *.l) 2547914d74bSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2557914d74bSmrg if test -f "$SRCFILE"; then 2567914d74bSmrg cp "$SRCFILE" lex.yy.c 2577914d74bSmrg fi 2587914d74bSmrg ;; 2597914d74bSmrg esac 2607914d74bSmrg fi 2617914d74bSmrg if test ! -f lex.yy.c; then 2627914d74bSmrg echo 'main() { return 0; }' >lex.yy.c 2637914d74bSmrg fi 2647914d74bSmrg ;; 2657914d74bSmrg 2667914d74bSmrg help2man) 2677914d74bSmrg echo 1>&2 "\ 2687914d74bSmrgWARNING: \`$1' is $msg. You should only need it if 2697914d74bSmrg you modified a dependency of a manual page. You may need the 2707914d74bSmrg \`Help2man' package in order for those modifications to take 2717914d74bSmrg effect. You can get \`Help2man' from any GNU archive site." 2727914d74bSmrg 2737914d74bSmrg file=`echo "$*" | sed -n "$sed_output"` 2747914d74bSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2757914d74bSmrg if test -f "$file"; then 2767914d74bSmrg touch $file 2777914d74bSmrg else 2787914d74bSmrg test -z "$file" || exec >$file 2797914d74bSmrg echo ".ab help2man is required to generate this page" 2807914d74bSmrg exit 1 2817914d74bSmrg fi 2827914d74bSmrg ;; 2837914d74bSmrg 2847914d74bSmrg makeinfo) 2857914d74bSmrg echo 1>&2 "\ 2867914d74bSmrgWARNING: \`$1' is $msg. You should only need it if 2877914d74bSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 2887914d74bSmrg indirectly affecting the aspect of the manual. The spurious 2897914d74bSmrg call might also be the consequence of using a buggy \`make' (AIX, 2907914d74bSmrg DU, IRIX). You might want to install the \`Texinfo' package or 2917914d74bSmrg the \`GNU make' package. Grab either from any GNU archive site." 2927914d74bSmrg # The file to touch is that specified with -o ... 2937914d74bSmrg file=`echo "$*" | sed -n "$sed_output"` 2947914d74bSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2957914d74bSmrg if test -z "$file"; then 2967914d74bSmrg # ... or it is the one specified with @setfilename ... 2977914d74bSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2987914d74bSmrg file=`sed -n ' 2997914d74bSmrg /^@setfilename/{ 3007914d74bSmrg s/.* \([^ ]*\) *$/\1/ 3017914d74bSmrg p 3027914d74bSmrg q 3037914d74bSmrg }' $infile` 3047914d74bSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3057914d74bSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3067914d74bSmrg fi 3077914d74bSmrg # If the file does not exist, the user really needs makeinfo; 3087914d74bSmrg # let's fail without touching anything. 3097914d74bSmrg test -f $file || exit 1 3107914d74bSmrg touch $file 3117914d74bSmrg ;; 3127914d74bSmrg 3137914d74bSmrg tar) 3147914d74bSmrg shift 3157914d74bSmrg 3167914d74bSmrg # We have already tried tar in the generic part. 3177914d74bSmrg # Look for gnutar/gtar before invocation to avoid ugly error 3187914d74bSmrg # messages. 3197914d74bSmrg if (gnutar --version > /dev/null 2>&1); then 3207914d74bSmrg gnutar "$@" && exit 0 3217914d74bSmrg fi 3227914d74bSmrg if (gtar --version > /dev/null 2>&1); then 3237914d74bSmrg gtar "$@" && exit 0 3247914d74bSmrg fi 3257914d74bSmrg firstarg="$1" 3267914d74bSmrg if shift; then 3277914d74bSmrg case $firstarg in 3287914d74bSmrg *o*) 3297914d74bSmrg firstarg=`echo "$firstarg" | sed s/o//` 3307914d74bSmrg tar "$firstarg" "$@" && exit 0 3317914d74bSmrg ;; 3327914d74bSmrg esac 3337914d74bSmrg case $firstarg in 3347914d74bSmrg *h*) 3357914d74bSmrg firstarg=`echo "$firstarg" | sed s/h//` 3367914d74bSmrg tar "$firstarg" "$@" && exit 0 3377914d74bSmrg ;; 3387914d74bSmrg esac 3397914d74bSmrg fi 3407914d74bSmrg 3417914d74bSmrg echo 1>&2 "\ 3427914d74bSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3437914d74bSmrg You may want to install GNU tar or Free paxutils, or check the 3447914d74bSmrg command line arguments." 3457914d74bSmrg exit 1 3467914d74bSmrg ;; 3477914d74bSmrg 3487914d74bSmrg *) 3497914d74bSmrg echo 1>&2 "\ 3507914d74bSmrgWARNING: \`$1' is needed, and is $msg. 3517914d74bSmrg You might have modified some files without having the 3527914d74bSmrg proper tools for further handling them. Check the \`README' file, 3537914d74bSmrg it often tells you about the needed prerequisites for installing 3547914d74bSmrg this package. You may also peek at any GNU archive site, in case 3557914d74bSmrg some other package would contain this missing \`$1' program." 3567914d74bSmrg exit 1 3577914d74bSmrg ;; 3587914d74bSmrgesac 3597914d74bSmrg 3607914d74bSmrgexit 0 3617914d74bSmrg 3627914d74bSmrg# Local variables: 3637914d74bSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3647914d74bSmrg# time-stamp-start: "scriptversion=" 3657914d74bSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3667914d74bSmrg# time-stamp-end: "$" 3677914d74bSmrg# End: 368