missing revision d1c293ac
18440cca4Smrg#! /bin/sh 28440cca4Smrg# Common stub for a few missing GNU programs while installing. 3d1c293acSmrg 4d1c293acSmrgscriptversion=2009-04-28.21; # UTC 5d1c293acSmrg 6d1c293acSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7d1c293acSmrg# 2008, 2009 Free Software Foundation, Inc. 88440cca4Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 98440cca4Smrg 108440cca4Smrg# This program is free software; you can redistribute it and/or modify 118440cca4Smrg# it under the terms of the GNU General Public License as published by 128440cca4Smrg# the Free Software Foundation; either version 2, or (at your option) 138440cca4Smrg# any later version. 148440cca4Smrg 158440cca4Smrg# This program is distributed in the hope that it will be useful, 168440cca4Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 178440cca4Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 188440cca4Smrg# GNU General Public License for more details. 198440cca4Smrg 208440cca4Smrg# You should have received a copy of the GNU General Public License 21d1c293acSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 228440cca4Smrg 238440cca4Smrg# As a special exception to the GNU General Public License, if you 248440cca4Smrg# distribute this file as part of a program that contains a 258440cca4Smrg# configuration script generated by Autoconf, you may include it under 268440cca4Smrg# the same distribution terms that you use for the rest of that program. 278440cca4Smrg 288440cca4Smrgif test $# -eq 0; then 298440cca4Smrg echo 1>&2 "Try \`$0 --help' for more information" 308440cca4Smrg exit 1 318440cca4Smrgfi 328440cca4Smrg 338440cca4Smrgrun=: 34d1c293acSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35d1c293acSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 368440cca4Smrg 378440cca4Smrg# In the cases where this matters, `missing' is being run in the 388440cca4Smrg# srcdir already. 398440cca4Smrgif test -f configure.ac; then 408440cca4Smrg configure_ac=configure.ac 418440cca4Smrgelse 428440cca4Smrg configure_ac=configure.in 438440cca4Smrgfi 448440cca4Smrg 45d1c293acSmrgmsg="missing on your system" 46d1c293acSmrg 47d1c293acSmrgcase $1 in 488440cca4Smrg--run) 498440cca4Smrg # Try to run requested program, and just exit if it succeeds. 508440cca4Smrg run= 518440cca4Smrg shift 528440cca4Smrg "$@" && exit 0 53d1c293acSmrg # Exit code 63 means version mismatch. This often happens 54d1c293acSmrg # when the user try to use an ancient version of a tool on 55d1c293acSmrg # a file that requires a minimum version. In this case we 56d1c293acSmrg # we should proceed has if the program had been absent, or 57d1c293acSmrg # if --run hadn't been passed. 58d1c293acSmrg if test $? = 63; then 59d1c293acSmrg run=: 60d1c293acSmrg msg="probably too old" 61d1c293acSmrg fi 628440cca4Smrg ;; 638440cca4Smrg 648440cca4Smrg -h|--h|--he|--hel|--help) 658440cca4Smrg echo "\ 668440cca4Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 678440cca4Smrg 688440cca4SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 698440cca4Smrgerror status if there is no known handling for PROGRAM. 708440cca4Smrg 718440cca4SmrgOptions: 728440cca4Smrg -h, --help display this help and exit 738440cca4Smrg -v, --version output version information and exit 748440cca4Smrg --run try to run the given command, and emulate it if it fails 758440cca4Smrg 768440cca4SmrgSupported PROGRAM values: 778440cca4Smrg aclocal touch file \`aclocal.m4' 788440cca4Smrg autoconf touch file \`configure' 798440cca4Smrg autoheader touch file \`config.h.in' 80d1c293acSmrg autom4te touch the output file, or create a stub one 818440cca4Smrg automake touch all \`Makefile.in' files 828440cca4Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 838440cca4Smrg flex create \`lex.yy.c', if possible, from existing .c 848440cca4Smrg help2man touch the output file 858440cca4Smrg lex create \`lex.yy.c', if possible, from existing .c 868440cca4Smrg makeinfo touch the output file 878440cca4Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88d1c293acSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89d1c293acSmrg 90d1c293acSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91d1c293acSmrg\`g' are ignored when checking the name. 92d1c293acSmrg 93d1c293acSmrgSend bug reports to <bug-automake@gnu.org>." 94d1c293acSmrg exit $? 958440cca4Smrg ;; 968440cca4Smrg 978440cca4Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98d1c293acSmrg echo "missing $scriptversion (GNU Automake)" 99d1c293acSmrg exit $? 1008440cca4Smrg ;; 1018440cca4Smrg 1028440cca4Smrg -*) 1038440cca4Smrg echo 1>&2 "$0: Unknown \`$1' option" 1048440cca4Smrg echo 1>&2 "Try \`$0 --help' for more information" 1058440cca4Smrg exit 1 1068440cca4Smrg ;; 1078440cca4Smrg 108d1c293acSmrgesac 109d1c293acSmrg 110d1c293acSmrg# normalize program name to check for. 111d1c293acSmrgprogram=`echo "$1" | sed ' 112d1c293acSmrg s/^gnu-//; t 113d1c293acSmrg s/^gnu//; t 114d1c293acSmrg s/^g//; t'` 115d1c293acSmrg 116d1c293acSmrg# Now exit if we have it, but it failed. Also exit now if we 117d1c293acSmrg# don't have it and --version was passed (most likely to detect 118d1c293acSmrg# the program). This is about non-GNU programs, so use $1 not 119d1c293acSmrg# $program. 120d1c293acSmrgcase $1 in 121d1c293acSmrg lex*|yacc*) 122d1c293acSmrg # Not GNU programs, they don't have --version. 123d1c293acSmrg ;; 124d1c293acSmrg 125d1c293acSmrg tar*) 126d1c293acSmrg if test -n "$run"; then 127d1c293acSmrg echo 1>&2 "ERROR: \`tar' requires --run" 128d1c293acSmrg exit 1 129d1c293acSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130d1c293acSmrg exit 1 131d1c293acSmrg fi 132d1c293acSmrg ;; 133d1c293acSmrg 134d1c293acSmrg *) 1358440cca4Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1368440cca4Smrg # We have it, but it failed. 1378440cca4Smrg exit 1 138d1c293acSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139d1c293acSmrg # Could not run --version or --help. This is probably someone 140d1c293acSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 141d1c293acSmrg # $TOOL exists and not knowing $TOOL uses missing. 142d1c293acSmrg exit 1 1438440cca4Smrg fi 144d1c293acSmrg ;; 145d1c293acSmrgesac 1468440cca4Smrg 147d1c293acSmrg# If it does not exist, or fails to run (possibly an outdated version), 148d1c293acSmrg# try to emulate it. 149d1c293acSmrgcase $program in 150d1c293acSmrg aclocal*) 1518440cca4Smrg echo 1>&2 "\ 152d1c293acSmrgWARNING: \`$1' is $msg. You should only need it if 1538440cca4Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1548440cca4Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1558440cca4Smrg any GNU archive site." 1568440cca4Smrg touch aclocal.m4 1578440cca4Smrg ;; 1588440cca4Smrg 159d1c293acSmrg autoconf*) 1608440cca4Smrg echo 1>&2 "\ 161d1c293acSmrgWARNING: \`$1' is $msg. You should only need it if 1628440cca4Smrg you modified \`${configure_ac}'. You might want to install the 1638440cca4Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1648440cca4Smrg archive site." 1658440cca4Smrg touch configure 1668440cca4Smrg ;; 1678440cca4Smrg 168d1c293acSmrg autoheader*) 1698440cca4Smrg echo 1>&2 "\ 170d1c293acSmrgWARNING: \`$1' is $msg. You should only need it if 1718440cca4Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1728440cca4Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1738440cca4Smrg from any GNU archive site." 1748440cca4Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1758440cca4Smrg test -z "$files" && files="config.h" 1768440cca4Smrg touch_files= 1778440cca4Smrg for f in $files; do 178d1c293acSmrg case $f in 1798440cca4Smrg *:*) touch_files="$touch_files "`echo "$f" | 1808440cca4Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1818440cca4Smrg *) touch_files="$touch_files $f.in";; 1828440cca4Smrg esac 1838440cca4Smrg done 1848440cca4Smrg touch $touch_files 1858440cca4Smrg ;; 1868440cca4Smrg 1878440cca4Smrg automake*) 1888440cca4Smrg echo 1>&2 "\ 189d1c293acSmrgWARNING: \`$1' is $msg. You should only need it if 1908440cca4Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1918440cca4Smrg You might want to install the \`Automake' and \`Perl' packages. 1928440cca4Smrg Grab them from any GNU archive site." 1938440cca4Smrg find . -type f -name Makefile.am -print | 1948440cca4Smrg sed 's/\.am$/.in/' | 1958440cca4Smrg while read f; do touch "$f"; done 1968440cca4Smrg ;; 1978440cca4Smrg 198d1c293acSmrg autom4te*) 1998440cca4Smrg echo 1>&2 "\ 200d1c293acSmrgWARNING: \`$1' is needed, but is $msg. 201d1c293acSmrg You might have modified some files without having the 2028440cca4Smrg proper tools for further handling them. 2038440cca4Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2048440cca4Smrg archive site." 2058440cca4Smrg 206d1c293acSmrg file=`echo "$*" | sed -n "$sed_output"` 207d1c293acSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2088440cca4Smrg if test -f "$file"; then 2098440cca4Smrg touch $file 2108440cca4Smrg else 2118440cca4Smrg test -z "$file" || exec >$file 2128440cca4Smrg echo "#! /bin/sh" 2138440cca4Smrg echo "# Created by GNU Automake missing as a replacement of" 2148440cca4Smrg echo "# $ $@" 2158440cca4Smrg echo "exit 0" 2168440cca4Smrg chmod +x $file 2178440cca4Smrg exit 1 2188440cca4Smrg fi 2198440cca4Smrg ;; 2208440cca4Smrg 221d1c293acSmrg bison*|yacc*) 2228440cca4Smrg echo 1>&2 "\ 223d1c293acSmrgWARNING: \`$1' $msg. You should only need it if 2248440cca4Smrg you modified a \`.y' file. You may need the \`Bison' package 2258440cca4Smrg in order for those modifications to take effect. You can get 2268440cca4Smrg \`Bison' from any GNU archive site." 2278440cca4Smrg rm -f y.tab.c y.tab.h 228d1c293acSmrg if test $# -ne 1; then 2298440cca4Smrg eval LASTARG="\${$#}" 230d1c293acSmrg case $LASTARG in 2318440cca4Smrg *.y) 2328440cca4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233d1c293acSmrg if test -f "$SRCFILE"; then 2348440cca4Smrg cp "$SRCFILE" y.tab.c 2358440cca4Smrg fi 2368440cca4Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237d1c293acSmrg if test -f "$SRCFILE"; then 2388440cca4Smrg cp "$SRCFILE" y.tab.h 2398440cca4Smrg fi 2408440cca4Smrg ;; 2418440cca4Smrg esac 2428440cca4Smrg fi 243d1c293acSmrg if test ! -f y.tab.h; then 2448440cca4Smrg echo >y.tab.h 2458440cca4Smrg fi 246d1c293acSmrg if test ! -f y.tab.c; then 2478440cca4Smrg echo 'main() { return 0; }' >y.tab.c 2488440cca4Smrg fi 2498440cca4Smrg ;; 2508440cca4Smrg 251d1c293acSmrg lex*|flex*) 2528440cca4Smrg echo 1>&2 "\ 253d1c293acSmrgWARNING: \`$1' is $msg. You should only need it if 2548440cca4Smrg you modified a \`.l' file. You may need the \`Flex' package 2558440cca4Smrg in order for those modifications to take effect. You can get 2568440cca4Smrg \`Flex' from any GNU archive site." 2578440cca4Smrg rm -f lex.yy.c 258d1c293acSmrg if test $# -ne 1; then 2598440cca4Smrg eval LASTARG="\${$#}" 260d1c293acSmrg case $LASTARG in 2618440cca4Smrg *.l) 2628440cca4Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263d1c293acSmrg if test -f "$SRCFILE"; then 2648440cca4Smrg cp "$SRCFILE" lex.yy.c 2658440cca4Smrg fi 2668440cca4Smrg ;; 2678440cca4Smrg esac 2688440cca4Smrg fi 269d1c293acSmrg if test ! -f lex.yy.c; then 2708440cca4Smrg echo 'main() { return 0; }' >lex.yy.c 2718440cca4Smrg fi 2728440cca4Smrg ;; 2738440cca4Smrg 274d1c293acSmrg help2man*) 2758440cca4Smrg echo 1>&2 "\ 276d1c293acSmrgWARNING: \`$1' is $msg. You should only need it if 2778440cca4Smrg you modified a dependency of a manual page. You may need the 2788440cca4Smrg \`Help2man' package in order for those modifications to take 2798440cca4Smrg effect. You can get \`Help2man' from any GNU archive site." 2808440cca4Smrg 281d1c293acSmrg file=`echo "$*" | sed -n "$sed_output"` 282d1c293acSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283d1c293acSmrg if test -f "$file"; then 2848440cca4Smrg touch $file 2858440cca4Smrg else 2868440cca4Smrg test -z "$file" || exec >$file 2878440cca4Smrg echo ".ab help2man is required to generate this page" 288d1c293acSmrg exit $? 2898440cca4Smrg fi 2908440cca4Smrg ;; 2918440cca4Smrg 292d1c293acSmrg makeinfo*) 2938440cca4Smrg echo 1>&2 "\ 294d1c293acSmrgWARNING: \`$1' is $msg. You should only need it if 2958440cca4Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2968440cca4Smrg indirectly affecting the aspect of the manual. The spurious 2978440cca4Smrg call might also be the consequence of using a buggy \`make' (AIX, 2988440cca4Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2998440cca4Smrg the \`GNU make' package. Grab either from any GNU archive site." 300d1c293acSmrg # The file to touch is that specified with -o ... 301d1c293acSmrg file=`echo "$*" | sed -n "$sed_output"` 302d1c293acSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3038440cca4Smrg if test -z "$file"; then 304d1c293acSmrg # ... or it is the one specified with @setfilename ... 305d1c293acSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306d1c293acSmrg file=`sed -n ' 307d1c293acSmrg /^@setfilename/{ 308d1c293acSmrg s/.* \([^ ]*\) *$/\1/ 309d1c293acSmrg p 310d1c293acSmrg q 311d1c293acSmrg }' $infile` 312d1c293acSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313d1c293acSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3148440cca4Smrg fi 315d1c293acSmrg # If the file does not exist, the user really needs makeinfo; 316d1c293acSmrg # let's fail without touching anything. 317d1c293acSmrg test -f $file || exit 1 3188440cca4Smrg touch $file 3198440cca4Smrg ;; 3208440cca4Smrg 321d1c293acSmrg tar*) 3228440cca4Smrg shift 3238440cca4Smrg 3248440cca4Smrg # We have already tried tar in the generic part. 3258440cca4Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3268440cca4Smrg # messages. 3278440cca4Smrg if (gnutar --version > /dev/null 2>&1); then 3288440cca4Smrg gnutar "$@" && exit 0 3298440cca4Smrg fi 3308440cca4Smrg if (gtar --version > /dev/null 2>&1); then 3318440cca4Smrg gtar "$@" && exit 0 3328440cca4Smrg fi 3338440cca4Smrg firstarg="$1" 3348440cca4Smrg if shift; then 335d1c293acSmrg case $firstarg in 3368440cca4Smrg *o*) 3378440cca4Smrg firstarg=`echo "$firstarg" | sed s/o//` 3388440cca4Smrg tar "$firstarg" "$@" && exit 0 3398440cca4Smrg ;; 3408440cca4Smrg esac 341d1c293acSmrg case $firstarg in 3428440cca4Smrg *h*) 3438440cca4Smrg firstarg=`echo "$firstarg" | sed s/h//` 3448440cca4Smrg tar "$firstarg" "$@" && exit 0 3458440cca4Smrg ;; 3468440cca4Smrg esac 3478440cca4Smrg fi 3488440cca4Smrg 3498440cca4Smrg echo 1>&2 "\ 3508440cca4SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3518440cca4Smrg You may want to install GNU tar or Free paxutils, or check the 3528440cca4Smrg command line arguments." 3538440cca4Smrg exit 1 3548440cca4Smrg ;; 3558440cca4Smrg 3568440cca4Smrg *) 3578440cca4Smrg echo 1>&2 "\ 358d1c293acSmrgWARNING: \`$1' is needed, and is $msg. 359d1c293acSmrg You might have modified some files without having the 3608440cca4Smrg proper tools for further handling them. Check the \`README' file, 3618440cca4Smrg it often tells you about the needed prerequisites for installing 3628440cca4Smrg this package. You may also peek at any GNU archive site, in case 3638440cca4Smrg some other package would contain this missing \`$1' program." 3648440cca4Smrg exit 1 3658440cca4Smrg ;; 3668440cca4Smrgesac 3678440cca4Smrg 3688440cca4Smrgexit 0 369d1c293acSmrg 370d1c293acSmrg# Local variables: 371d1c293acSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372d1c293acSmrg# time-stamp-start: "scriptversion=" 373d1c293acSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374d1c293acSmrg# time-stamp-time-zone: "UTC" 375d1c293acSmrg# time-stamp-end: "; # UTC" 376d1c293acSmrg# End: 377