missing revision 93493779
16c321187Smrg#! /bin/sh 26c321187Smrg# Common stub for a few missing GNU programs while installing. 36c321187Smrg 493493779Smrgscriptversion=2009-04-28.21; # UTC 56c321187Smrg 693493779Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 793493779Smrg# 2008, 2009 Free Software Foundation, Inc. 86c321187Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 96c321187Smrg 106c321187Smrg# This program is free software; you can redistribute it and/or modify 116c321187Smrg# it under the terms of the GNU General Public License as published by 126c321187Smrg# the Free Software Foundation; either version 2, or (at your option) 136c321187Smrg# any later version. 146c321187Smrg 156c321187Smrg# This program is distributed in the hope that it will be useful, 166c321187Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 176c321187Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 186c321187Smrg# GNU General Public License for more details. 196c321187Smrg 206c321187Smrg# You should have received a copy of the GNU General Public License 2193493779Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 226c321187Smrg 236c321187Smrg# As a special exception to the GNU General Public License, if you 246c321187Smrg# distribute this file as part of a program that contains a 256c321187Smrg# configuration script generated by Autoconf, you may include it under 266c321187Smrg# the same distribution terms that you use for the rest of that program. 276c321187Smrg 286c321187Smrgif test $# -eq 0; then 296c321187Smrg echo 1>&2 "Try \`$0 --help' for more information" 306c321187Smrg exit 1 316c321187Smrgfi 326c321187Smrg 336c321187Smrgrun=: 346c321187Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 356c321187Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 366c321187Smrg 376c321187Smrg# In the cases where this matters, `missing' is being run in the 386c321187Smrg# srcdir already. 396c321187Smrgif test -f configure.ac; then 406c321187Smrg configure_ac=configure.ac 416c321187Smrgelse 426c321187Smrg configure_ac=configure.in 436c321187Smrgfi 446c321187Smrg 456c321187Smrgmsg="missing on your system" 466c321187Smrg 476c321187Smrgcase $1 in 486c321187Smrg--run) 496c321187Smrg # Try to run requested program, and just exit if it succeeds. 506c321187Smrg run= 516c321187Smrg shift 526c321187Smrg "$@" && exit 0 536c321187Smrg # Exit code 63 means version mismatch. This often happens 546c321187Smrg # when the user try to use an ancient version of a tool on 556c321187Smrg # a file that requires a minimum version. In this case we 566c321187Smrg # we should proceed has if the program had been absent, or 576c321187Smrg # if --run hadn't been passed. 586c321187Smrg if test $? = 63; then 596c321187Smrg run=: 606c321187Smrg msg="probably too old" 616c321187Smrg fi 626c321187Smrg ;; 636c321187Smrg 646c321187Smrg -h|--h|--he|--hel|--help) 656c321187Smrg echo "\ 666c321187Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 676c321187Smrg 686c321187SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 696c321187Smrgerror status if there is no known handling for PROGRAM. 706c321187Smrg 716c321187SmrgOptions: 726c321187Smrg -h, --help display this help and exit 736c321187Smrg -v, --version output version information and exit 746c321187Smrg --run try to run the given command, and emulate it if it fails 756c321187Smrg 766c321187SmrgSupported PROGRAM values: 776c321187Smrg aclocal touch file \`aclocal.m4' 786c321187Smrg autoconf touch file \`configure' 796c321187Smrg autoheader touch file \`config.h.in' 806c321187Smrg autom4te touch the output file, or create a stub one 816c321187Smrg automake touch all \`Makefile.in' files 826c321187Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 836c321187Smrg flex create \`lex.yy.c', if possible, from existing .c 846c321187Smrg help2man touch the output file 856c321187Smrg lex create \`lex.yy.c', if possible, from existing .c 866c321187Smrg makeinfo touch the output file 876c321187Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 886c321187Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 896c321187Smrg 9093493779SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9193493779Smrg\`g' are ignored when checking the name. 9293493779Smrg 936c321187SmrgSend bug reports to <bug-automake@gnu.org>." 946c321187Smrg exit $? 956c321187Smrg ;; 966c321187Smrg 976c321187Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 986c321187Smrg echo "missing $scriptversion (GNU Automake)" 996c321187Smrg exit $? 1006c321187Smrg ;; 1016c321187Smrg 1026c321187Smrg -*) 1036c321187Smrg echo 1>&2 "$0: Unknown \`$1' option" 1046c321187Smrg echo 1>&2 "Try \`$0 --help' for more information" 1056c321187Smrg exit 1 1066c321187Smrg ;; 1076c321187Smrg 1086c321187Smrgesac 1096c321187Smrg 11093493779Smrg# normalize program name to check for. 11193493779Smrgprogram=`echo "$1" | sed ' 11293493779Smrg s/^gnu-//; t 11393493779Smrg s/^gnu//; t 11493493779Smrg s/^g//; t'` 11593493779Smrg 1166c321187Smrg# Now exit if we have it, but it failed. Also exit now if we 1176c321187Smrg# don't have it and --version was passed (most likely to detect 11893493779Smrg# the program). This is about non-GNU programs, so use $1 not 11993493779Smrg# $program. 1206c321187Smrgcase $1 in 12193493779Smrg lex*|yacc*) 1226c321187Smrg # Not GNU programs, they don't have --version. 1236c321187Smrg ;; 1246c321187Smrg 12593493779Smrg tar*) 1266c321187Smrg if test -n "$run"; then 1276c321187Smrg echo 1>&2 "ERROR: \`tar' requires --run" 1286c321187Smrg exit 1 1296c321187Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1306c321187Smrg exit 1 1316c321187Smrg fi 1326c321187Smrg ;; 1336c321187Smrg 1346c321187Smrg *) 1356c321187Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1366c321187Smrg # We have it, but it failed. 1376c321187Smrg exit 1 1386c321187Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1396c321187Smrg # Could not run --version or --help. This is probably someone 1406c321187Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1416c321187Smrg # $TOOL exists and not knowing $TOOL uses missing. 1426c321187Smrg exit 1 1436c321187Smrg fi 1446c321187Smrg ;; 1456c321187Smrgesac 1466c321187Smrg 1476c321187Smrg# If it does not exist, or fails to run (possibly an outdated version), 1486c321187Smrg# try to emulate it. 14993493779Smrgcase $program in 1506c321187Smrg aclocal*) 1516c321187Smrg echo 1>&2 "\ 1526c321187SmrgWARNING: \`$1' is $msg. You should only need it if 1536c321187Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1546c321187Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1556c321187Smrg any GNU archive site." 1566c321187Smrg touch aclocal.m4 1576c321187Smrg ;; 1586c321187Smrg 15993493779Smrg autoconf*) 1606c321187Smrg echo 1>&2 "\ 1616c321187SmrgWARNING: \`$1' is $msg. You should only need it if 1626c321187Smrg you modified \`${configure_ac}'. You might want to install the 1636c321187Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1646c321187Smrg archive site." 1656c321187Smrg touch configure 1666c321187Smrg ;; 1676c321187Smrg 16893493779Smrg autoheader*) 1696c321187Smrg echo 1>&2 "\ 1706c321187SmrgWARNING: \`$1' is $msg. You should only need it if 1716c321187Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1726c321187Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1736c321187Smrg from any GNU archive site." 1746c321187Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1756c321187Smrg test -z "$files" && files="config.h" 1766c321187Smrg touch_files= 1776c321187Smrg for f in $files; do 1786c321187Smrg case $f in 1796c321187Smrg *:*) touch_files="$touch_files "`echo "$f" | 1806c321187Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1816c321187Smrg *) touch_files="$touch_files $f.in";; 1826c321187Smrg esac 1836c321187Smrg done 1846c321187Smrg touch $touch_files 1856c321187Smrg ;; 1866c321187Smrg 1876c321187Smrg automake*) 1886c321187Smrg echo 1>&2 "\ 1896c321187SmrgWARNING: \`$1' is $msg. You should only need it if 1906c321187Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1916c321187Smrg You might want to install the \`Automake' and \`Perl' packages. 1926c321187Smrg Grab them from any GNU archive site." 1936c321187Smrg find . -type f -name Makefile.am -print | 1946c321187Smrg sed 's/\.am$/.in/' | 1956c321187Smrg while read f; do touch "$f"; done 1966c321187Smrg ;; 1976c321187Smrg 19893493779Smrg autom4te*) 1996c321187Smrg echo 1>&2 "\ 2006c321187SmrgWARNING: \`$1' is needed, but is $msg. 2016c321187Smrg You might have modified some files without having the 2026c321187Smrg proper tools for further handling them. 2036c321187Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2046c321187Smrg archive site." 2056c321187Smrg 2066c321187Smrg file=`echo "$*" | sed -n "$sed_output"` 2076c321187Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2086c321187Smrg if test -f "$file"; then 2096c321187Smrg touch $file 2106c321187Smrg else 2116c321187Smrg test -z "$file" || exec >$file 2126c321187Smrg echo "#! /bin/sh" 2136c321187Smrg echo "# Created by GNU Automake missing as a replacement of" 2146c321187Smrg echo "# $ $@" 2156c321187Smrg echo "exit 0" 2166c321187Smrg chmod +x $file 2176c321187Smrg exit 1 2186c321187Smrg fi 2196c321187Smrg ;; 2206c321187Smrg 22193493779Smrg bison*|yacc*) 2226c321187Smrg echo 1>&2 "\ 2236c321187SmrgWARNING: \`$1' $msg. You should only need it if 2246c321187Smrg you modified a \`.y' file. You may need the \`Bison' package 2256c321187Smrg in order for those modifications to take effect. You can get 2266c321187Smrg \`Bison' from any GNU archive site." 2276c321187Smrg rm -f y.tab.c y.tab.h 2286c321187Smrg if test $# -ne 1; then 2296c321187Smrg eval LASTARG="\${$#}" 2306c321187Smrg case $LASTARG in 2316c321187Smrg *.y) 2326c321187Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2336c321187Smrg if test -f "$SRCFILE"; then 2346c321187Smrg cp "$SRCFILE" y.tab.c 2356c321187Smrg fi 2366c321187Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2376c321187Smrg if test -f "$SRCFILE"; then 2386c321187Smrg cp "$SRCFILE" y.tab.h 2396c321187Smrg fi 2406c321187Smrg ;; 2416c321187Smrg esac 2426c321187Smrg fi 2436c321187Smrg if test ! -f y.tab.h; then 2446c321187Smrg echo >y.tab.h 2456c321187Smrg fi 2466c321187Smrg if test ! -f y.tab.c; then 2476c321187Smrg echo 'main() { return 0; }' >y.tab.c 2486c321187Smrg fi 2496c321187Smrg ;; 2506c321187Smrg 25193493779Smrg lex*|flex*) 2526c321187Smrg echo 1>&2 "\ 2536c321187SmrgWARNING: \`$1' is $msg. You should only need it if 2546c321187Smrg you modified a \`.l' file. You may need the \`Flex' package 2556c321187Smrg in order for those modifications to take effect. You can get 2566c321187Smrg \`Flex' from any GNU archive site." 2576c321187Smrg rm -f lex.yy.c 2586c321187Smrg if test $# -ne 1; then 2596c321187Smrg eval LASTARG="\${$#}" 2606c321187Smrg case $LASTARG in 2616c321187Smrg *.l) 2626c321187Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2636c321187Smrg if test -f "$SRCFILE"; then 2646c321187Smrg cp "$SRCFILE" lex.yy.c 2656c321187Smrg fi 2666c321187Smrg ;; 2676c321187Smrg esac 2686c321187Smrg fi 2696c321187Smrg if test ! -f lex.yy.c; then 2706c321187Smrg echo 'main() { return 0; }' >lex.yy.c 2716c321187Smrg fi 2726c321187Smrg ;; 2736c321187Smrg 27493493779Smrg help2man*) 2756c321187Smrg echo 1>&2 "\ 2766c321187SmrgWARNING: \`$1' is $msg. You should only need it if 2776c321187Smrg you modified a dependency of a manual page. You may need the 2786c321187Smrg \`Help2man' package in order for those modifications to take 2796c321187Smrg effect. You can get \`Help2man' from any GNU archive site." 2806c321187Smrg 2816c321187Smrg file=`echo "$*" | sed -n "$sed_output"` 2826c321187Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2836c321187Smrg if test -f "$file"; then 2846c321187Smrg touch $file 2856c321187Smrg else 2866c321187Smrg test -z "$file" || exec >$file 2876c321187Smrg echo ".ab help2man is required to generate this page" 28893493779Smrg exit $? 2896c321187Smrg fi 2906c321187Smrg ;; 2916c321187Smrg 29293493779Smrg makeinfo*) 2936c321187Smrg echo 1>&2 "\ 2946c321187SmrgWARNING: \`$1' is $msg. You should only need it if 2956c321187Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2966c321187Smrg indirectly affecting the aspect of the manual. The spurious 2976c321187Smrg call might also be the consequence of using a buggy \`make' (AIX, 2986c321187Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2996c321187Smrg the \`GNU make' package. Grab either from any GNU archive site." 3006c321187Smrg # The file to touch is that specified with -o ... 3016c321187Smrg file=`echo "$*" | sed -n "$sed_output"` 3026c321187Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3036c321187Smrg if test -z "$file"; then 3046c321187Smrg # ... or it is the one specified with @setfilename ... 3056c321187Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3066c321187Smrg file=`sed -n ' 3076c321187Smrg /^@setfilename/{ 3086c321187Smrg s/.* \([^ ]*\) *$/\1/ 3096c321187Smrg p 3106c321187Smrg q 3116c321187Smrg }' $infile` 3126c321187Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3136c321187Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3146c321187Smrg fi 3156c321187Smrg # If the file does not exist, the user really needs makeinfo; 3166c321187Smrg # let's fail without touching anything. 3176c321187Smrg test -f $file || exit 1 3186c321187Smrg touch $file 3196c321187Smrg ;; 3206c321187Smrg 32193493779Smrg tar*) 3226c321187Smrg shift 3236c321187Smrg 3246c321187Smrg # We have already tried tar in the generic part. 3256c321187Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3266c321187Smrg # messages. 3276c321187Smrg if (gnutar --version > /dev/null 2>&1); then 3286c321187Smrg gnutar "$@" && exit 0 3296c321187Smrg fi 3306c321187Smrg if (gtar --version > /dev/null 2>&1); then 3316c321187Smrg gtar "$@" && exit 0 3326c321187Smrg fi 3336c321187Smrg firstarg="$1" 3346c321187Smrg if shift; then 3356c321187Smrg case $firstarg in 3366c321187Smrg *o*) 3376c321187Smrg firstarg=`echo "$firstarg" | sed s/o//` 3386c321187Smrg tar "$firstarg" "$@" && exit 0 3396c321187Smrg ;; 3406c321187Smrg esac 3416c321187Smrg case $firstarg in 3426c321187Smrg *h*) 3436c321187Smrg firstarg=`echo "$firstarg" | sed s/h//` 3446c321187Smrg tar "$firstarg" "$@" && exit 0 3456c321187Smrg ;; 3466c321187Smrg esac 3476c321187Smrg fi 3486c321187Smrg 3496c321187Smrg echo 1>&2 "\ 3506c321187SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3516c321187Smrg You may want to install GNU tar or Free paxutils, or check the 3526c321187Smrg command line arguments." 3536c321187Smrg exit 1 3546c321187Smrg ;; 3556c321187Smrg 3566c321187Smrg *) 3576c321187Smrg echo 1>&2 "\ 3586c321187SmrgWARNING: \`$1' is needed, and is $msg. 3596c321187Smrg You might have modified some files without having the 3606c321187Smrg proper tools for further handling them. Check the \`README' file, 3616c321187Smrg it often tells you about the needed prerequisites for installing 3626c321187Smrg this package. You may also peek at any GNU archive site, in case 3636c321187Smrg some other package would contain this missing \`$1' program." 3646c321187Smrg exit 1 3656c321187Smrg ;; 3666c321187Smrgesac 3676c321187Smrg 3686c321187Smrgexit 0 3696c321187Smrg 3706c321187Smrg# Local variables: 3716c321187Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3726c321187Smrg# time-stamp-start: "scriptversion=" 3736c321187Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37493493779Smrg# time-stamp-time-zone: "UTC" 37593493779Smrg# time-stamp-end: "; # UTC" 3766c321187Smrg# End: 377