missing revision 7a84e134
17a84e134Smrg#! /bin/sh 27a84e134Smrg# Common stub for a few missing GNU programs while installing. 37a84e134Smrg 47a84e134Smrgscriptversion=2006-05-10.23 57a84e134Smrg 67a84e134Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 77a84e134Smrg# Free Software Foundation, Inc. 87a84e134Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 97a84e134Smrg 107a84e134Smrg# This program is free software; you can redistribute it and/or modify 117a84e134Smrg# it under the terms of the GNU General Public License as published by 127a84e134Smrg# the Free Software Foundation; either version 2, or (at your option) 137a84e134Smrg# any later version. 147a84e134Smrg 157a84e134Smrg# This program is distributed in the hope that it will be useful, 167a84e134Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 177a84e134Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 187a84e134Smrg# GNU General Public License for more details. 197a84e134Smrg 207a84e134Smrg# You should have received a copy of the GNU General Public License 217a84e134Smrg# along with this program; if not, write to the Free Software 227a84e134Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 237a84e134Smrg# 02110-1301, USA. 247a84e134Smrg 257a84e134Smrg# As a special exception to the GNU General Public License, if you 267a84e134Smrg# distribute this file as part of a program that contains a 277a84e134Smrg# configuration script generated by Autoconf, you may include it under 287a84e134Smrg# the same distribution terms that you use for the rest of that program. 297a84e134Smrg 307a84e134Smrgif test $# -eq 0; then 317a84e134Smrg echo 1>&2 "Try \`$0 --help' for more information" 327a84e134Smrg exit 1 337a84e134Smrgfi 347a84e134Smrg 357a84e134Smrgrun=: 367a84e134Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 377a84e134Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 387a84e134Smrg 397a84e134Smrg# In the cases where this matters, `missing' is being run in the 407a84e134Smrg# srcdir already. 417a84e134Smrgif test -f configure.ac; then 427a84e134Smrg configure_ac=configure.ac 437a84e134Smrgelse 447a84e134Smrg configure_ac=configure.in 457a84e134Smrgfi 467a84e134Smrg 477a84e134Smrgmsg="missing on your system" 487a84e134Smrg 497a84e134Smrgcase $1 in 507a84e134Smrg--run) 517a84e134Smrg # Try to run requested program, and just exit if it succeeds. 527a84e134Smrg run= 537a84e134Smrg shift 547a84e134Smrg "$@" && exit 0 557a84e134Smrg # Exit code 63 means version mismatch. This often happens 567a84e134Smrg # when the user try to use an ancient version of a tool on 577a84e134Smrg # a file that requires a minimum version. In this case we 587a84e134Smrg # we should proceed has if the program had been absent, or 597a84e134Smrg # if --run hadn't been passed. 607a84e134Smrg if test $? = 63; then 617a84e134Smrg run=: 627a84e134Smrg msg="probably too old" 637a84e134Smrg fi 647a84e134Smrg ;; 657a84e134Smrg 667a84e134Smrg -h|--h|--he|--hel|--help) 677a84e134Smrg echo "\ 687a84e134Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 697a84e134Smrg 707a84e134SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 717a84e134Smrgerror status if there is no known handling for PROGRAM. 727a84e134Smrg 737a84e134SmrgOptions: 747a84e134Smrg -h, --help display this help and exit 757a84e134Smrg -v, --version output version information and exit 767a84e134Smrg --run try to run the given command, and emulate it if it fails 777a84e134Smrg 787a84e134SmrgSupported PROGRAM values: 797a84e134Smrg aclocal touch file \`aclocal.m4' 807a84e134Smrg autoconf touch file \`configure' 817a84e134Smrg autoheader touch file \`config.h.in' 827a84e134Smrg autom4te touch the output file, or create a stub one 837a84e134Smrg automake touch all \`Makefile.in' files 847a84e134Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 857a84e134Smrg flex create \`lex.yy.c', if possible, from existing .c 867a84e134Smrg help2man touch the output file 877a84e134Smrg lex create \`lex.yy.c', if possible, from existing .c 887a84e134Smrg makeinfo touch the output file 897a84e134Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 907a84e134Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 917a84e134Smrg 927a84e134SmrgSend bug reports to <bug-automake@gnu.org>." 937a84e134Smrg exit $? 947a84e134Smrg ;; 957a84e134Smrg 967a84e134Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 977a84e134Smrg echo "missing $scriptversion (GNU Automake)" 987a84e134Smrg exit $? 997a84e134Smrg ;; 1007a84e134Smrg 1017a84e134Smrg -*) 1027a84e134Smrg echo 1>&2 "$0: Unknown \`$1' option" 1037a84e134Smrg echo 1>&2 "Try \`$0 --help' for more information" 1047a84e134Smrg exit 1 1057a84e134Smrg ;; 1067a84e134Smrg 1077a84e134Smrgesac 1087a84e134Smrg 1097a84e134Smrg# Now exit if we have it, but it failed. Also exit now if we 1107a84e134Smrg# don't have it and --version was passed (most likely to detect 1117a84e134Smrg# the program). 1127a84e134Smrgcase $1 in 1137a84e134Smrg lex|yacc) 1147a84e134Smrg # Not GNU programs, they don't have --version. 1157a84e134Smrg ;; 1167a84e134Smrg 1177a84e134Smrg tar) 1187a84e134Smrg if test -n "$run"; then 1197a84e134Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1207a84e134Smrg exit 1 1217a84e134Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1227a84e134Smrg exit 1 1237a84e134Smrg fi 1247a84e134Smrg ;; 1257a84e134Smrg 1267a84e134Smrg *) 1277a84e134Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1287a84e134Smrg # We have it, but it failed. 1297a84e134Smrg exit 1 1307a84e134Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1317a84e134Smrg # Could not run --version or --help. This is probably someone 1327a84e134Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1337a84e134Smrg # $TOOL exists and not knowing $TOOL uses missing. 1347a84e134Smrg exit 1 1357a84e134Smrg fi 1367a84e134Smrg ;; 1377a84e134Smrgesac 1387a84e134Smrg 1397a84e134Smrg# If it does not exist, or fails to run (possibly an outdated version), 1407a84e134Smrg# try to emulate it. 1417a84e134Smrgcase $1 in 1427a84e134Smrg aclocal*) 1437a84e134Smrg echo 1>&2 "\ 1447a84e134SmrgWARNING: \`$1' is $msg. You should only need it if 1457a84e134Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1467a84e134Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1477a84e134Smrg any GNU archive site." 1487a84e134Smrg touch aclocal.m4 1497a84e134Smrg ;; 1507a84e134Smrg 1517a84e134Smrg autoconf) 1527a84e134Smrg echo 1>&2 "\ 1537a84e134SmrgWARNING: \`$1' is $msg. You should only need it if 1547a84e134Smrg you modified \`${configure_ac}'. You might want to install the 1557a84e134Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1567a84e134Smrg archive site." 1577a84e134Smrg touch configure 1587a84e134Smrg ;; 1597a84e134Smrg 1607a84e134Smrg autoheader) 1617a84e134Smrg echo 1>&2 "\ 1627a84e134SmrgWARNING: \`$1' is $msg. You should only need it if 1637a84e134Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1647a84e134Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1657a84e134Smrg from any GNU archive site." 1667a84e134Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1677a84e134Smrg test -z "$files" && files="config.h" 1687a84e134Smrg touch_files= 1697a84e134Smrg for f in $files; do 1707a84e134Smrg case $f in 1717a84e134Smrg *:*) touch_files="$touch_files "`echo "$f" | 1727a84e134Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1737a84e134Smrg *) touch_files="$touch_files $f.in";; 1747a84e134Smrg esac 1757a84e134Smrg done 1767a84e134Smrg touch $touch_files 1777a84e134Smrg ;; 1787a84e134Smrg 1797a84e134Smrg automake*) 1807a84e134Smrg echo 1>&2 "\ 1817a84e134SmrgWARNING: \`$1' is $msg. You should only need it if 1827a84e134Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1837a84e134Smrg You might want to install the \`Automake' and \`Perl' packages. 1847a84e134Smrg Grab them from any GNU archive site." 1857a84e134Smrg find . -type f -name Makefile.am -print | 1867a84e134Smrg sed 's/\.am$/.in/' | 1877a84e134Smrg while read f; do touch "$f"; done 1887a84e134Smrg ;; 1897a84e134Smrg 1907a84e134Smrg autom4te) 1917a84e134Smrg echo 1>&2 "\ 1927a84e134SmrgWARNING: \`$1' is needed, but is $msg. 1937a84e134Smrg You might have modified some files without having the 1947a84e134Smrg proper tools for further handling them. 1957a84e134Smrg You can get \`$1' as part of \`Autoconf' from any GNU 1967a84e134Smrg archive site." 1977a84e134Smrg 1987a84e134Smrg file=`echo "$*" | sed -n "$sed_output"` 1997a84e134Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2007a84e134Smrg if test -f "$file"; then 2017a84e134Smrg touch $file 2027a84e134Smrg else 2037a84e134Smrg test -z "$file" || exec >$file 2047a84e134Smrg echo "#! /bin/sh" 2057a84e134Smrg echo "# Created by GNU Automake missing as a replacement of" 2067a84e134Smrg echo "# $ $@" 2077a84e134Smrg echo "exit 0" 2087a84e134Smrg chmod +x $file 2097a84e134Smrg exit 1 2107a84e134Smrg fi 2117a84e134Smrg ;; 2127a84e134Smrg 2137a84e134Smrg bison|yacc) 2147a84e134Smrg echo 1>&2 "\ 2157a84e134SmrgWARNING: \`$1' $msg. You should only need it if 2167a84e134Smrg you modified a \`.y' file. You may need the \`Bison' package 2177a84e134Smrg in order for those modifications to take effect. You can get 2187a84e134Smrg \`Bison' from any GNU archive site." 2197a84e134Smrg rm -f y.tab.c y.tab.h 2207a84e134Smrg if test $# -ne 1; then 2217a84e134Smrg eval LASTARG="\${$#}" 2227a84e134Smrg case $LASTARG in 2237a84e134Smrg *.y) 2247a84e134Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2257a84e134Smrg if test -f "$SRCFILE"; then 2267a84e134Smrg cp "$SRCFILE" y.tab.c 2277a84e134Smrg fi 2287a84e134Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2297a84e134Smrg if test -f "$SRCFILE"; then 2307a84e134Smrg cp "$SRCFILE" y.tab.h 2317a84e134Smrg fi 2327a84e134Smrg ;; 2337a84e134Smrg esac 2347a84e134Smrg fi 2357a84e134Smrg if test ! -f y.tab.h; then 2367a84e134Smrg echo >y.tab.h 2377a84e134Smrg fi 2387a84e134Smrg if test ! -f y.tab.c; then 2397a84e134Smrg echo 'main() { return 0; }' >y.tab.c 2407a84e134Smrg fi 2417a84e134Smrg ;; 2427a84e134Smrg 2437a84e134Smrg lex|flex) 2447a84e134Smrg echo 1>&2 "\ 2457a84e134SmrgWARNING: \`$1' is $msg. You should only need it if 2467a84e134Smrg you modified a \`.l' file. You may need the \`Flex' package 2477a84e134Smrg in order for those modifications to take effect. You can get 2487a84e134Smrg \`Flex' from any GNU archive site." 2497a84e134Smrg rm -f lex.yy.c 2507a84e134Smrg if test $# -ne 1; then 2517a84e134Smrg eval LASTARG="\${$#}" 2527a84e134Smrg case $LASTARG in 2537a84e134Smrg *.l) 2547a84e134Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2557a84e134Smrg if test -f "$SRCFILE"; then 2567a84e134Smrg cp "$SRCFILE" lex.yy.c 2577a84e134Smrg fi 2587a84e134Smrg ;; 2597a84e134Smrg esac 2607a84e134Smrg fi 2617a84e134Smrg if test ! -f lex.yy.c; then 2627a84e134Smrg echo 'main() { return 0; }' >lex.yy.c 2637a84e134Smrg fi 2647a84e134Smrg ;; 2657a84e134Smrg 2667a84e134Smrg help2man) 2677a84e134Smrg echo 1>&2 "\ 2687a84e134SmrgWARNING: \`$1' is $msg. You should only need it if 2697a84e134Smrg you modified a dependency of a manual page. You may need the 2707a84e134Smrg \`Help2man' package in order for those modifications to take 2717a84e134Smrg effect. You can get \`Help2man' from any GNU archive site." 2727a84e134Smrg 2737a84e134Smrg file=`echo "$*" | sed -n "$sed_output"` 2747a84e134Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2757a84e134Smrg if test -f "$file"; then 2767a84e134Smrg touch $file 2777a84e134Smrg else 2787a84e134Smrg test -z "$file" || exec >$file 2797a84e134Smrg echo ".ab help2man is required to generate this page" 2807a84e134Smrg exit 1 2817a84e134Smrg fi 2827a84e134Smrg ;; 2837a84e134Smrg 2847a84e134Smrg makeinfo) 2857a84e134Smrg echo 1>&2 "\ 2867a84e134SmrgWARNING: \`$1' is $msg. You should only need it if 2877a84e134Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2887a84e134Smrg indirectly affecting the aspect of the manual. The spurious 2897a84e134Smrg call might also be the consequence of using a buggy \`make' (AIX, 2907a84e134Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2917a84e134Smrg the \`GNU make' package. Grab either from any GNU archive site." 2927a84e134Smrg # The file to touch is that specified with -o ... 2937a84e134Smrg file=`echo "$*" | sed -n "$sed_output"` 2947a84e134Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2957a84e134Smrg if test -z "$file"; then 2967a84e134Smrg # ... or it is the one specified with @setfilename ... 2977a84e134Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2987a84e134Smrg file=`sed -n ' 2997a84e134Smrg /^@setfilename/{ 3007a84e134Smrg s/.* \([^ ]*\) *$/\1/ 3017a84e134Smrg p 3027a84e134Smrg q 3037a84e134Smrg }' $infile` 3047a84e134Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3057a84e134Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3067a84e134Smrg fi 3077a84e134Smrg # If the file does not exist, the user really needs makeinfo; 3087a84e134Smrg # let's fail without touching anything. 3097a84e134Smrg test -f $file || exit 1 3107a84e134Smrg touch $file 3117a84e134Smrg ;; 3127a84e134Smrg 3137a84e134Smrg tar) 3147a84e134Smrg shift 3157a84e134Smrg 3167a84e134Smrg # We have already tried tar in the generic part. 3177a84e134Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3187a84e134Smrg # messages. 3197a84e134Smrg if (gnutar --version > /dev/null 2>&1); then 3207a84e134Smrg gnutar "$@" && exit 0 3217a84e134Smrg fi 3227a84e134Smrg if (gtar --version > /dev/null 2>&1); then 3237a84e134Smrg gtar "$@" && exit 0 3247a84e134Smrg fi 3257a84e134Smrg firstarg="$1" 3267a84e134Smrg if shift; then 3277a84e134Smrg case $firstarg in 3287a84e134Smrg *o*) 3297a84e134Smrg firstarg=`echo "$firstarg" | sed s/o//` 3307a84e134Smrg tar "$firstarg" "$@" && exit 0 3317a84e134Smrg ;; 3327a84e134Smrg esac 3337a84e134Smrg case $firstarg in 3347a84e134Smrg *h*) 3357a84e134Smrg firstarg=`echo "$firstarg" | sed s/h//` 3367a84e134Smrg tar "$firstarg" "$@" && exit 0 3377a84e134Smrg ;; 3387a84e134Smrg esac 3397a84e134Smrg fi 3407a84e134Smrg 3417a84e134Smrg echo 1>&2 "\ 3427a84e134SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3437a84e134Smrg You may want to install GNU tar or Free paxutils, or check the 3447a84e134Smrg command line arguments." 3457a84e134Smrg exit 1 3467a84e134Smrg ;; 3477a84e134Smrg 3487a84e134Smrg *) 3497a84e134Smrg echo 1>&2 "\ 3507a84e134SmrgWARNING: \`$1' is needed, and is $msg. 3517a84e134Smrg You might have modified some files without having the 3527a84e134Smrg proper tools for further handling them. Check the \`README' file, 3537a84e134Smrg it often tells you about the needed prerequisites for installing 3547a84e134Smrg this package. You may also peek at any GNU archive site, in case 3557a84e134Smrg some other package would contain this missing \`$1' program." 3567a84e134Smrg exit 1 3577a84e134Smrg ;; 3587a84e134Smrgesac 3597a84e134Smrg 3607a84e134Smrgexit 0 3617a84e134Smrg 3627a84e134Smrg# Local variables: 3637a84e134Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3647a84e134Smrg# time-stamp-start: "scriptversion=" 3657a84e134Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3667a84e134Smrg# time-stamp-end: "$" 3677a84e134Smrg# End: 368