missing revision 1a650d1e
18108eb18Smrg#! /bin/sh 28108eb18Smrg# Common stub for a few missing GNU programs while installing. 31a650d1eSmrg 41a650d1eSmrgscriptversion=2009-04-28.21; # UTC 51a650d1eSmrg 61a650d1eSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 71a650d1eSmrg# 2008, 2009 Free Software Foundation, Inc. 88108eb18Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 98108eb18Smrg 108108eb18Smrg# This program is free software; you can redistribute it and/or modify 118108eb18Smrg# it under the terms of the GNU General Public License as published by 128108eb18Smrg# the Free Software Foundation; either version 2, or (at your option) 138108eb18Smrg# any later version. 148108eb18Smrg 158108eb18Smrg# This program is distributed in the hope that it will be useful, 168108eb18Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 178108eb18Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 188108eb18Smrg# GNU General Public License for more details. 198108eb18Smrg 208108eb18Smrg# You should have received a copy of the GNU General Public License 211a650d1eSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 228108eb18Smrg 238108eb18Smrg# As a special exception to the GNU General Public License, if you 248108eb18Smrg# distribute this file as part of a program that contains a 258108eb18Smrg# configuration script generated by Autoconf, you may include it under 268108eb18Smrg# the same distribution terms that you use for the rest of that program. 278108eb18Smrg 288108eb18Smrgif test $# -eq 0; then 298108eb18Smrg echo 1>&2 "Try \`$0 --help' for more information" 308108eb18Smrg exit 1 318108eb18Smrgfi 328108eb18Smrg 338108eb18Smrgrun=: 341a650d1eSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 351a650d1eSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 368108eb18Smrg 378108eb18Smrg# In the cases where this matters, `missing' is being run in the 388108eb18Smrg# srcdir already. 398108eb18Smrgif test -f configure.ac; then 408108eb18Smrg configure_ac=configure.ac 418108eb18Smrgelse 428108eb18Smrg configure_ac=configure.in 438108eb18Smrgfi 448108eb18Smrg 451a650d1eSmrgmsg="missing on your system" 461a650d1eSmrg 471a650d1eSmrgcase $1 in 488108eb18Smrg--run) 498108eb18Smrg # Try to run requested program, and just exit if it succeeds. 508108eb18Smrg run= 518108eb18Smrg shift 528108eb18Smrg "$@" && exit 0 531a650d1eSmrg # Exit code 63 means version mismatch. This often happens 541a650d1eSmrg # when the user try to use an ancient version of a tool on 551a650d1eSmrg # a file that requires a minimum version. In this case we 561a650d1eSmrg # we should proceed has if the program had been absent, or 571a650d1eSmrg # if --run hadn't been passed. 581a650d1eSmrg if test $? = 63; then 591a650d1eSmrg run=: 601a650d1eSmrg msg="probably too old" 611a650d1eSmrg fi 628108eb18Smrg ;; 638108eb18Smrg 648108eb18Smrg -h|--h|--he|--hel|--help) 658108eb18Smrg echo "\ 668108eb18Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 678108eb18Smrg 688108eb18SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 698108eb18Smrgerror status if there is no known handling for PROGRAM. 708108eb18Smrg 718108eb18SmrgOptions: 728108eb18Smrg -h, --help display this help and exit 738108eb18Smrg -v, --version output version information and exit 748108eb18Smrg --run try to run the given command, and emulate it if it fails 758108eb18Smrg 768108eb18SmrgSupported PROGRAM values: 778108eb18Smrg aclocal touch file \`aclocal.m4' 788108eb18Smrg autoconf touch file \`configure' 798108eb18Smrg autoheader touch file \`config.h.in' 801a650d1eSmrg autom4te touch the output file, or create a stub one 818108eb18Smrg automake touch all \`Makefile.in' files 828108eb18Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 838108eb18Smrg flex create \`lex.yy.c', if possible, from existing .c 848108eb18Smrg help2man touch the output file 858108eb18Smrg lex create \`lex.yy.c', if possible, from existing .c 868108eb18Smrg makeinfo touch the output file 878108eb18Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 881a650d1eSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 891a650d1eSmrg 901a650d1eSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 911a650d1eSmrg\`g' are ignored when checking the name. 921a650d1eSmrg 931a650d1eSmrgSend bug reports to <bug-automake@gnu.org>." 941a650d1eSmrg exit $? 958108eb18Smrg ;; 968108eb18Smrg 978108eb18Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 981a650d1eSmrg echo "missing $scriptversion (GNU Automake)" 991a650d1eSmrg exit $? 1008108eb18Smrg ;; 1018108eb18Smrg 1028108eb18Smrg -*) 1038108eb18Smrg echo 1>&2 "$0: Unknown \`$1' option" 1048108eb18Smrg echo 1>&2 "Try \`$0 --help' for more information" 1058108eb18Smrg exit 1 1068108eb18Smrg ;; 1078108eb18Smrg 1081a650d1eSmrgesac 1091a650d1eSmrg 1101a650d1eSmrg# normalize program name to check for. 1111a650d1eSmrgprogram=`echo "$1" | sed ' 1121a650d1eSmrg s/^gnu-//; t 1131a650d1eSmrg s/^gnu//; t 1141a650d1eSmrg s/^g//; t'` 1151a650d1eSmrg 1161a650d1eSmrg# Now exit if we have it, but it failed. Also exit now if we 1171a650d1eSmrg# don't have it and --version was passed (most likely to detect 1181a650d1eSmrg# the program). This is about non-GNU programs, so use $1 not 1191a650d1eSmrg# $program. 1201a650d1eSmrgcase $1 in 1211a650d1eSmrg lex*|yacc*) 1221a650d1eSmrg # Not GNU programs, they don't have --version. 1231a650d1eSmrg ;; 1241a650d1eSmrg 1251a650d1eSmrg tar*) 1261a650d1eSmrg if test -n "$run"; then 1271a650d1eSmrg echo 1>&2 "ERROR: \`tar' requires --run" 1281a650d1eSmrg exit 1 1291a650d1eSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1301a650d1eSmrg exit 1 1311a650d1eSmrg fi 1321a650d1eSmrg ;; 1331a650d1eSmrg 1341a650d1eSmrg *) 1358108eb18Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1368108eb18Smrg # We have it, but it failed. 1378108eb18Smrg exit 1 1381a650d1eSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1391a650d1eSmrg # Could not run --version or --help. This is probably someone 1401a650d1eSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 1411a650d1eSmrg # $TOOL exists and not knowing $TOOL uses missing. 1421a650d1eSmrg exit 1 1438108eb18Smrg fi 1441a650d1eSmrg ;; 1451a650d1eSmrgesac 1468108eb18Smrg 1471a650d1eSmrg# If it does not exist, or fails to run (possibly an outdated version), 1481a650d1eSmrg# try to emulate it. 1491a650d1eSmrgcase $program in 1501a650d1eSmrg aclocal*) 1518108eb18Smrg echo 1>&2 "\ 1521a650d1eSmrgWARNING: \`$1' is $msg. You should only need it if 1538108eb18Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1548108eb18Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1558108eb18Smrg any GNU archive site." 1568108eb18Smrg touch aclocal.m4 1578108eb18Smrg ;; 1588108eb18Smrg 1591a650d1eSmrg autoconf*) 1608108eb18Smrg echo 1>&2 "\ 1611a650d1eSmrgWARNING: \`$1' is $msg. You should only need it if 1628108eb18Smrg you modified \`${configure_ac}'. You might want to install the 1638108eb18Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1648108eb18Smrg archive site." 1658108eb18Smrg touch configure 1668108eb18Smrg ;; 1678108eb18Smrg 1681a650d1eSmrg autoheader*) 1698108eb18Smrg echo 1>&2 "\ 1701a650d1eSmrgWARNING: \`$1' is $msg. You should only need it if 1718108eb18Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1728108eb18Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1738108eb18Smrg from any GNU archive site." 1748108eb18Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1758108eb18Smrg test -z "$files" && files="config.h" 1768108eb18Smrg touch_files= 1778108eb18Smrg for f in $files; do 1781a650d1eSmrg case $f in 1798108eb18Smrg *:*) touch_files="$touch_files "`echo "$f" | 1808108eb18Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1818108eb18Smrg *) touch_files="$touch_files $f.in";; 1828108eb18Smrg esac 1838108eb18Smrg done 1848108eb18Smrg touch $touch_files 1858108eb18Smrg ;; 1868108eb18Smrg 1878108eb18Smrg automake*) 1888108eb18Smrg echo 1>&2 "\ 1891a650d1eSmrgWARNING: \`$1' is $msg. You should only need it if 1908108eb18Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1918108eb18Smrg You might want to install the \`Automake' and \`Perl' packages. 1928108eb18Smrg Grab them from any GNU archive site." 1938108eb18Smrg find . -type f -name Makefile.am -print | 1948108eb18Smrg sed 's/\.am$/.in/' | 1958108eb18Smrg while read f; do touch "$f"; done 1968108eb18Smrg ;; 1978108eb18Smrg 1981a650d1eSmrg autom4te*) 1998108eb18Smrg echo 1>&2 "\ 2001a650d1eSmrgWARNING: \`$1' is needed, but is $msg. 2011a650d1eSmrg You might have modified some files without having the 2028108eb18Smrg proper tools for further handling them. 2038108eb18Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2048108eb18Smrg archive site." 2058108eb18Smrg 2061a650d1eSmrg file=`echo "$*" | sed -n "$sed_output"` 2071a650d1eSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2088108eb18Smrg if test -f "$file"; then 2098108eb18Smrg touch $file 2108108eb18Smrg else 2118108eb18Smrg test -z "$file" || exec >$file 2128108eb18Smrg echo "#! /bin/sh" 2138108eb18Smrg echo "# Created by GNU Automake missing as a replacement of" 2148108eb18Smrg echo "# $ $@" 2158108eb18Smrg echo "exit 0" 2168108eb18Smrg chmod +x $file 2178108eb18Smrg exit 1 2188108eb18Smrg fi 2198108eb18Smrg ;; 2208108eb18Smrg 2211a650d1eSmrg bison*|yacc*) 2228108eb18Smrg echo 1>&2 "\ 2231a650d1eSmrgWARNING: \`$1' $msg. You should only need it if 2248108eb18Smrg you modified a \`.y' file. You may need the \`Bison' package 2258108eb18Smrg in order for those modifications to take effect. You can get 2268108eb18Smrg \`Bison' from any GNU archive site." 2278108eb18Smrg rm -f y.tab.c y.tab.h 2281a650d1eSmrg if test $# -ne 1; then 2298108eb18Smrg eval LASTARG="\${$#}" 2301a650d1eSmrg case $LASTARG in 2318108eb18Smrg *.y) 2328108eb18Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2331a650d1eSmrg if test -f "$SRCFILE"; then 2348108eb18Smrg cp "$SRCFILE" y.tab.c 2358108eb18Smrg fi 2368108eb18Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2371a650d1eSmrg if test -f "$SRCFILE"; then 2388108eb18Smrg cp "$SRCFILE" y.tab.h 2398108eb18Smrg fi 2408108eb18Smrg ;; 2418108eb18Smrg esac 2428108eb18Smrg fi 2431a650d1eSmrg if test ! -f y.tab.h; then 2448108eb18Smrg echo >y.tab.h 2458108eb18Smrg fi 2461a650d1eSmrg if test ! -f y.tab.c; then 2478108eb18Smrg echo 'main() { return 0; }' >y.tab.c 2488108eb18Smrg fi 2498108eb18Smrg ;; 2508108eb18Smrg 2511a650d1eSmrg lex*|flex*) 2528108eb18Smrg echo 1>&2 "\ 2531a650d1eSmrgWARNING: \`$1' is $msg. You should only need it if 2548108eb18Smrg you modified a \`.l' file. You may need the \`Flex' package 2558108eb18Smrg in order for those modifications to take effect. You can get 2568108eb18Smrg \`Flex' from any GNU archive site." 2578108eb18Smrg rm -f lex.yy.c 2581a650d1eSmrg if test $# -ne 1; then 2598108eb18Smrg eval LASTARG="\${$#}" 2601a650d1eSmrg case $LASTARG in 2618108eb18Smrg *.l) 2628108eb18Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2631a650d1eSmrg if test -f "$SRCFILE"; then 2648108eb18Smrg cp "$SRCFILE" lex.yy.c 2658108eb18Smrg fi 2668108eb18Smrg ;; 2678108eb18Smrg esac 2688108eb18Smrg fi 2691a650d1eSmrg if test ! -f lex.yy.c; then 2708108eb18Smrg echo 'main() { return 0; }' >lex.yy.c 2718108eb18Smrg fi 2728108eb18Smrg ;; 2738108eb18Smrg 2741a650d1eSmrg help2man*) 2758108eb18Smrg echo 1>&2 "\ 2761a650d1eSmrgWARNING: \`$1' is $msg. You should only need it if 2778108eb18Smrg you modified a dependency of a manual page. You may need the 2788108eb18Smrg \`Help2man' package in order for those modifications to take 2798108eb18Smrg effect. You can get \`Help2man' from any GNU archive site." 2808108eb18Smrg 2811a650d1eSmrg file=`echo "$*" | sed -n "$sed_output"` 2821a650d1eSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2831a650d1eSmrg if test -f "$file"; then 2848108eb18Smrg touch $file 2858108eb18Smrg else 2868108eb18Smrg test -z "$file" || exec >$file 2878108eb18Smrg echo ".ab help2man is required to generate this page" 2881a650d1eSmrg exit $? 2898108eb18Smrg fi 2908108eb18Smrg ;; 2918108eb18Smrg 2921a650d1eSmrg makeinfo*) 2938108eb18Smrg echo 1>&2 "\ 2941a650d1eSmrgWARNING: \`$1' is $msg. You should only need it if 2958108eb18Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2968108eb18Smrg indirectly affecting the aspect of the manual. The spurious 2978108eb18Smrg call might also be the consequence of using a buggy \`make' (AIX, 2988108eb18Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2998108eb18Smrg the \`GNU make' package. Grab either from any GNU archive site." 3001a650d1eSmrg # The file to touch is that specified with -o ... 3011a650d1eSmrg file=`echo "$*" | sed -n "$sed_output"` 3021a650d1eSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3038108eb18Smrg if test -z "$file"; then 3041a650d1eSmrg # ... or it is the one specified with @setfilename ... 3051a650d1eSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3061a650d1eSmrg file=`sed -n ' 3071a650d1eSmrg /^@setfilename/{ 3081a650d1eSmrg s/.* \([^ ]*\) *$/\1/ 3091a650d1eSmrg p 3101a650d1eSmrg q 3111a650d1eSmrg }' $infile` 3121a650d1eSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3131a650d1eSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3148108eb18Smrg fi 3151a650d1eSmrg # If the file does not exist, the user really needs makeinfo; 3161a650d1eSmrg # let's fail without touching anything. 3171a650d1eSmrg test -f $file || exit 1 3188108eb18Smrg touch $file 3198108eb18Smrg ;; 3208108eb18Smrg 3211a650d1eSmrg tar*) 3228108eb18Smrg shift 3238108eb18Smrg 3248108eb18Smrg # We have already tried tar in the generic part. 3258108eb18Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3268108eb18Smrg # messages. 3278108eb18Smrg if (gnutar --version > /dev/null 2>&1); then 3288108eb18Smrg gnutar "$@" && exit 0 3298108eb18Smrg fi 3308108eb18Smrg if (gtar --version > /dev/null 2>&1); then 3318108eb18Smrg gtar "$@" && exit 0 3328108eb18Smrg fi 3338108eb18Smrg firstarg="$1" 3348108eb18Smrg if shift; then 3351a650d1eSmrg case $firstarg in 3368108eb18Smrg *o*) 3378108eb18Smrg firstarg=`echo "$firstarg" | sed s/o//` 3388108eb18Smrg tar "$firstarg" "$@" && exit 0 3398108eb18Smrg ;; 3408108eb18Smrg esac 3411a650d1eSmrg case $firstarg in 3428108eb18Smrg *h*) 3438108eb18Smrg firstarg=`echo "$firstarg" | sed s/h//` 3448108eb18Smrg tar "$firstarg" "$@" && exit 0 3458108eb18Smrg ;; 3468108eb18Smrg esac 3478108eb18Smrg fi 3488108eb18Smrg 3498108eb18Smrg echo 1>&2 "\ 3508108eb18SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3518108eb18Smrg You may want to install GNU tar or Free paxutils, or check the 3528108eb18Smrg command line arguments." 3538108eb18Smrg exit 1 3548108eb18Smrg ;; 3558108eb18Smrg 3568108eb18Smrg *) 3578108eb18Smrg echo 1>&2 "\ 3581a650d1eSmrgWARNING: \`$1' is needed, and is $msg. 3591a650d1eSmrg You might have modified some files without having the 3608108eb18Smrg proper tools for further handling them. Check the \`README' file, 3618108eb18Smrg it often tells you about the needed prerequisites for installing 3628108eb18Smrg this package. You may also peek at any GNU archive site, in case 3638108eb18Smrg some other package would contain this missing \`$1' program." 3648108eb18Smrg exit 1 3658108eb18Smrg ;; 3668108eb18Smrgesac 3678108eb18Smrg 3688108eb18Smrgexit 0 3691a650d1eSmrg 3701a650d1eSmrg# Local variables: 3711a650d1eSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3721a650d1eSmrg# time-stamp-start: "scriptversion=" 3731a650d1eSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3741a650d1eSmrg# time-stamp-time-zone: "UTC" 3751a650d1eSmrg# time-stamp-end: "; # UTC" 3761a650d1eSmrg# End: 377