17706df26Smrg#! /bin/sh 27706df26Smrg# Common stub for a few missing GNU programs while installing. 37706df26Smrg 4b92e825aSmrgscriptversion=2012-01-06.13; # UTC 57706df26Smrg 67ae0a258Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7b92e825aSmrg# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. 87706df26Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 97706df26Smrg 107706df26Smrg# This program is free software; you can redistribute it and/or modify 117706df26Smrg# it under the terms of the GNU General Public License as published by 127706df26Smrg# the Free Software Foundation; either version 2, or (at your option) 137706df26Smrg# any later version. 147706df26Smrg 157706df26Smrg# This program is distributed in the hope that it will be useful, 167706df26Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 177706df26Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 187706df26Smrg# GNU General Public License for more details. 197706df26Smrg 207706df26Smrg# You should have received a copy of the GNU General Public License 217ae0a258Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 227706df26Smrg 237706df26Smrg# As a special exception to the GNU General Public License, if you 247706df26Smrg# distribute this file as part of a program that contains a 257706df26Smrg# configuration script generated by Autoconf, you may include it under 267706df26Smrg# the same distribution terms that you use for the rest of that program. 277706df26Smrg 287706df26Smrgif test $# -eq 0; then 297706df26Smrg echo 1>&2 "Try \`$0 --help' for more information" 307706df26Smrg exit 1 317706df26Smrgfi 327706df26Smrg 337706df26Smrgrun=: 34047944f3Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35047944f3Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 367706df26Smrg 377706df26Smrg# In the cases where this matters, `missing' is being run in the 387706df26Smrg# srcdir already. 397706df26Smrgif test -f configure.ac; then 407706df26Smrg configure_ac=configure.ac 417706df26Smrgelse 427706df26Smrg configure_ac=configure.in 437706df26Smrgfi 447706df26Smrg 457706df26Smrgmsg="missing on your system" 467706df26Smrg 47047944f3Smrgcase $1 in 487706df26Smrg--run) 497706df26Smrg # Try to run requested program, and just exit if it succeeds. 507706df26Smrg run= 517706df26Smrg shift 527706df26Smrg "$@" && exit 0 537706df26Smrg # Exit code 63 means version mismatch. This often happens 547706df26Smrg # when the user try to use an ancient version of a tool on 557706df26Smrg # a file that requires a minimum version. In this case we 567706df26Smrg # we should proceed has if the program had been absent, or 577706df26Smrg # if --run hadn't been passed. 587706df26Smrg if test $? = 63; then 597706df26Smrg run=: 607706df26Smrg msg="probably too old" 617706df26Smrg fi 627706df26Smrg ;; 637706df26Smrg 647706df26Smrg -h|--h|--he|--hel|--help) 657706df26Smrg echo "\ 667706df26Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 677706df26Smrg 687706df26SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 697706df26Smrgerror status if there is no known handling for PROGRAM. 707706df26Smrg 717706df26SmrgOptions: 727706df26Smrg -h, --help display this help and exit 737706df26Smrg -v, --version output version information and exit 747706df26Smrg --run try to run the given command, and emulate it if it fails 757706df26Smrg 767706df26SmrgSupported PROGRAM values: 777706df26Smrg aclocal touch file \`aclocal.m4' 787706df26Smrg autoconf touch file \`configure' 797706df26Smrg autoheader touch file \`config.h.in' 80047944f3Smrg autom4te touch the output file, or create a stub one 817706df26Smrg automake touch all \`Makefile.in' files 827706df26Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 837706df26Smrg flex create \`lex.yy.c', if possible, from existing .c 847706df26Smrg help2man touch the output file 857706df26Smrg lex create \`lex.yy.c', if possible, from existing .c 867706df26Smrg makeinfo touch the output file 877706df26Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 887706df26Smrg 897ae0a258SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 907ae0a258Smrg\`g' are ignored when checking the name. 917ae0a258Smrg 927706df26SmrgSend bug reports to <bug-automake@gnu.org>." 937706df26Smrg exit $? 947706df26Smrg ;; 957706df26Smrg 967706df26Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 977706df26Smrg echo "missing $scriptversion (GNU Automake)" 987706df26Smrg exit $? 997706df26Smrg ;; 1007706df26Smrg 1017706df26Smrg -*) 1027706df26Smrg echo 1>&2 "$0: Unknown \`$1' option" 1037706df26Smrg echo 1>&2 "Try \`$0 --help' for more information" 1047706df26Smrg exit 1 1057706df26Smrg ;; 1067706df26Smrg 1077706df26Smrgesac 1087706df26Smrg 1097ae0a258Smrg# normalize program name to check for. 1107ae0a258Smrgprogram=`echo "$1" | sed ' 1117ae0a258Smrg s/^gnu-//; t 1127ae0a258Smrg s/^gnu//; t 1137ae0a258Smrg s/^g//; t'` 1147ae0a258Smrg 1157706df26Smrg# Now exit if we have it, but it failed. Also exit now if we 1167706df26Smrg# don't have it and --version was passed (most likely to detect 1177ae0a258Smrg# the program). This is about non-GNU programs, so use $1 not 1187ae0a258Smrg# $program. 119047944f3Smrgcase $1 in 1207ae0a258Smrg lex*|yacc*) 1217706df26Smrg # Not GNU programs, they don't have --version. 1227706df26Smrg ;; 1237706df26Smrg 1247706df26Smrg *) 1257706df26Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1267706df26Smrg # We have it, but it failed. 1277706df26Smrg exit 1 1287706df26Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 1297706df26Smrg # Could not run --version or --help. This is probably someone 1307706df26Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 1317706df26Smrg # $TOOL exists and not knowing $TOOL uses missing. 1327706df26Smrg exit 1 1337706df26Smrg fi 1347706df26Smrg ;; 1357706df26Smrgesac 1367706df26Smrg 1377706df26Smrg# If it does not exist, or fails to run (possibly an outdated version), 1387706df26Smrg# try to emulate it. 1397ae0a258Smrgcase $program in 1407706df26Smrg aclocal*) 1417706df26Smrg echo 1>&2 "\ 1427706df26SmrgWARNING: \`$1' is $msg. You should only need it if 1437706df26Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1447706df26Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1457706df26Smrg any GNU archive site." 1467706df26Smrg touch aclocal.m4 1477706df26Smrg ;; 1487706df26Smrg 1497ae0a258Smrg autoconf*) 1507706df26Smrg echo 1>&2 "\ 1517706df26SmrgWARNING: \`$1' is $msg. You should only need it if 1527706df26Smrg you modified \`${configure_ac}'. You might want to install the 1537706df26Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1547706df26Smrg archive site." 1557706df26Smrg touch configure 1567706df26Smrg ;; 1577706df26Smrg 1587ae0a258Smrg autoheader*) 1597706df26Smrg echo 1>&2 "\ 1607706df26SmrgWARNING: \`$1' is $msg. You should only need it if 1617706df26Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1627706df26Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1637706df26Smrg from any GNU archive site." 1647706df26Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1657706df26Smrg test -z "$files" && files="config.h" 1667706df26Smrg touch_files= 1677706df26Smrg for f in $files; do 168047944f3Smrg case $f in 1697706df26Smrg *:*) touch_files="$touch_files "`echo "$f" | 1707706df26Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1717706df26Smrg *) touch_files="$touch_files $f.in";; 1727706df26Smrg esac 1737706df26Smrg done 1747706df26Smrg touch $touch_files 1757706df26Smrg ;; 1767706df26Smrg 1777706df26Smrg automake*) 1787706df26Smrg echo 1>&2 "\ 1797706df26SmrgWARNING: \`$1' is $msg. You should only need it if 1807706df26Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1817706df26Smrg You might want to install the \`Automake' and \`Perl' packages. 1827706df26Smrg Grab them from any GNU archive site." 1837706df26Smrg find . -type f -name Makefile.am -print | 1847706df26Smrg sed 's/\.am$/.in/' | 1857706df26Smrg while read f; do touch "$f"; done 1867706df26Smrg ;; 1877706df26Smrg 1887ae0a258Smrg autom4te*) 1897706df26Smrg echo 1>&2 "\ 1907706df26SmrgWARNING: \`$1' is needed, but is $msg. 1917706df26Smrg You might have modified some files without having the 1927706df26Smrg proper tools for further handling them. 1937706df26Smrg You can get \`$1' as part of \`Autoconf' from any GNU 1947706df26Smrg archive site." 1957706df26Smrg 196047944f3Smrg file=`echo "$*" | sed -n "$sed_output"` 197047944f3Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 1987706df26Smrg if test -f "$file"; then 1997706df26Smrg touch $file 2007706df26Smrg else 2017706df26Smrg test -z "$file" || exec >$file 2027706df26Smrg echo "#! /bin/sh" 2037706df26Smrg echo "# Created by GNU Automake missing as a replacement of" 2047706df26Smrg echo "# $ $@" 2057706df26Smrg echo "exit 0" 2067706df26Smrg chmod +x $file 2077706df26Smrg exit 1 2087706df26Smrg fi 2097706df26Smrg ;; 2107706df26Smrg 2117ae0a258Smrg bison*|yacc*) 2127706df26Smrg echo 1>&2 "\ 2137706df26SmrgWARNING: \`$1' $msg. You should only need it if 2147706df26Smrg you modified a \`.y' file. You may need the \`Bison' package 2157706df26Smrg in order for those modifications to take effect. You can get 2167706df26Smrg \`Bison' from any GNU archive site." 2177706df26Smrg rm -f y.tab.c y.tab.h 218047944f3Smrg if test $# -ne 1; then 219b92e825aSmrg eval LASTARG=\${$#} 220047944f3Smrg case $LASTARG in 2217706df26Smrg *.y) 2227706df26Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 223047944f3Smrg if test -f "$SRCFILE"; then 2247706df26Smrg cp "$SRCFILE" y.tab.c 2257706df26Smrg fi 2267706df26Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 227047944f3Smrg if test -f "$SRCFILE"; then 2287706df26Smrg cp "$SRCFILE" y.tab.h 2297706df26Smrg fi 2307706df26Smrg ;; 2317706df26Smrg esac 2327706df26Smrg fi 233047944f3Smrg if test ! -f y.tab.h; then 2347706df26Smrg echo >y.tab.h 2357706df26Smrg fi 236047944f3Smrg if test ! -f y.tab.c; then 2377706df26Smrg echo 'main() { return 0; }' >y.tab.c 2387706df26Smrg fi 2397706df26Smrg ;; 2407706df26Smrg 2417ae0a258Smrg lex*|flex*) 2427706df26Smrg echo 1>&2 "\ 2437706df26SmrgWARNING: \`$1' is $msg. You should only need it if 2447706df26Smrg you modified a \`.l' file. You may need the \`Flex' package 2457706df26Smrg in order for those modifications to take effect. You can get 2467706df26Smrg \`Flex' from any GNU archive site." 2477706df26Smrg rm -f lex.yy.c 248047944f3Smrg if test $# -ne 1; then 249b92e825aSmrg eval LASTARG=\${$#} 250047944f3Smrg case $LASTARG in 2517706df26Smrg *.l) 2527706df26Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 253047944f3Smrg if test -f "$SRCFILE"; then 2547706df26Smrg cp "$SRCFILE" lex.yy.c 2557706df26Smrg fi 2567706df26Smrg ;; 2577706df26Smrg esac 2587706df26Smrg fi 259047944f3Smrg if test ! -f lex.yy.c; then 2607706df26Smrg echo 'main() { return 0; }' >lex.yy.c 2617706df26Smrg fi 2627706df26Smrg ;; 2637706df26Smrg 2647ae0a258Smrg help2man*) 2657706df26Smrg echo 1>&2 "\ 2667706df26SmrgWARNING: \`$1' is $msg. You should only need it if 2677706df26Smrg you modified a dependency of a manual page. You may need the 2687706df26Smrg \`Help2man' package in order for those modifications to take 2697706df26Smrg effect. You can get \`Help2man' from any GNU archive site." 2707706df26Smrg 271047944f3Smrg file=`echo "$*" | sed -n "$sed_output"` 272047944f3Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 273047944f3Smrg if test -f "$file"; then 2747706df26Smrg touch $file 2757706df26Smrg else 2767706df26Smrg test -z "$file" || exec >$file 2777706df26Smrg echo ".ab help2man is required to generate this page" 2787ae0a258Smrg exit $? 2797706df26Smrg fi 2807706df26Smrg ;; 2817706df26Smrg 2827ae0a258Smrg makeinfo*) 2837706df26Smrg echo 1>&2 "\ 2847706df26SmrgWARNING: \`$1' is $msg. You should only need it if 2857706df26Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2867706df26Smrg indirectly affecting the aspect of the manual. The spurious 2877706df26Smrg call might also be the consequence of using a buggy \`make' (AIX, 2887706df26Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2897706df26Smrg the \`GNU make' package. Grab either from any GNU archive site." 2907706df26Smrg # The file to touch is that specified with -o ... 291047944f3Smrg file=`echo "$*" | sed -n "$sed_output"` 292047944f3Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2937706df26Smrg if test -z "$file"; then 2947706df26Smrg # ... or it is the one specified with @setfilename ... 2957706df26Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296047944f3Smrg file=`sed -n ' 297047944f3Smrg /^@setfilename/{ 298047944f3Smrg s/.* \([^ ]*\) *$/\1/ 299047944f3Smrg p 300047944f3Smrg q 301047944f3Smrg }' $infile` 3027706df26Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 3037706df26Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3047706df26Smrg fi 3057706df26Smrg # If the file does not exist, the user really needs makeinfo; 3067706df26Smrg # let's fail without touching anything. 3077706df26Smrg test -f $file || exit 1 3087706df26Smrg touch $file 3097706df26Smrg ;; 3107706df26Smrg 3117706df26Smrg *) 3127706df26Smrg echo 1>&2 "\ 3137706df26SmrgWARNING: \`$1' is needed, and is $msg. 3147706df26Smrg You might have modified some files without having the 3157706df26Smrg proper tools for further handling them. Check the \`README' file, 3167706df26Smrg it often tells you about the needed prerequisites for installing 3177706df26Smrg this package. You may also peek at any GNU archive site, in case 3187706df26Smrg some other package would contain this missing \`$1' program." 3197706df26Smrg exit 1 3207706df26Smrg ;; 3217706df26Smrgesac 3227706df26Smrg 3237706df26Smrgexit 0 3247706df26Smrg 3257706df26Smrg# Local variables: 3267706df26Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 3277706df26Smrg# time-stamp-start: "scriptversion=" 3287706df26Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3297ae0a258Smrg# time-stamp-time-zone: "UTC" 3307ae0a258Smrg# time-stamp-end: "; # UTC" 3317706df26Smrg# End: 332