missing revision b66d1acb
14fb28925Smrg#! /bin/sh 24fb28925Smrg# Common stub for a few missing GNU programs while installing. 3b66d1acbSmrg 4b66d1acbSmrgscriptversion=2009-04-28.21; # UTC 5b66d1acbSmrg 6b66d1acbSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7b66d1acbSmrg# 2008, 2009 Free Software Foundation, Inc. 84fb28925Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 94fb28925Smrg 104fb28925Smrg# This program is free software; you can redistribute it and/or modify 114fb28925Smrg# it under the terms of the GNU General Public License as published by 124fb28925Smrg# the Free Software Foundation; either version 2, or (at your option) 134fb28925Smrg# any later version. 144fb28925Smrg 154fb28925Smrg# This program is distributed in the hope that it will be useful, 164fb28925Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 174fb28925Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 184fb28925Smrg# GNU General Public License for more details. 194fb28925Smrg 204fb28925Smrg# You should have received a copy of the GNU General Public License 21b66d1acbSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 224fb28925Smrg 234fb28925Smrg# As a special exception to the GNU General Public License, if you 244fb28925Smrg# distribute this file as part of a program that contains a 254fb28925Smrg# configuration script generated by Autoconf, you may include it under 264fb28925Smrg# the same distribution terms that you use for the rest of that program. 274fb28925Smrg 284fb28925Smrgif test $# -eq 0; then 294fb28925Smrg echo 1>&2 "Try \`$0 --help' for more information" 304fb28925Smrg exit 1 314fb28925Smrgfi 324fb28925Smrg 334fb28925Smrgrun=: 34b66d1acbSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35b66d1acbSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 364fb28925Smrg 374fb28925Smrg# In the cases where this matters, `missing' is being run in the 384fb28925Smrg# srcdir already. 394fb28925Smrgif test -f configure.ac; then 404fb28925Smrg configure_ac=configure.ac 414fb28925Smrgelse 424fb28925Smrg configure_ac=configure.in 434fb28925Smrgfi 444fb28925Smrg 45b66d1acbSmrgmsg="missing on your system" 46b66d1acbSmrg 47b66d1acbSmrgcase $1 in 484fb28925Smrg--run) 494fb28925Smrg # Try to run requested program, and just exit if it succeeds. 504fb28925Smrg run= 514fb28925Smrg shift 524fb28925Smrg "$@" && exit 0 53b66d1acbSmrg # Exit code 63 means version mismatch. This often happens 54b66d1acbSmrg # when the user try to use an ancient version of a tool on 55b66d1acbSmrg # a file that requires a minimum version. In this case we 56b66d1acbSmrg # we should proceed has if the program had been absent, or 57b66d1acbSmrg # if --run hadn't been passed. 58b66d1acbSmrg if test $? = 63; then 59b66d1acbSmrg run=: 60b66d1acbSmrg msg="probably too old" 61b66d1acbSmrg fi 624fb28925Smrg ;; 634fb28925Smrg 644fb28925Smrg -h|--h|--he|--hel|--help) 654fb28925Smrg echo "\ 664fb28925Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 674fb28925Smrg 684fb28925SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 694fb28925Smrgerror status if there is no known handling for PROGRAM. 704fb28925Smrg 714fb28925SmrgOptions: 724fb28925Smrg -h, --help display this help and exit 734fb28925Smrg -v, --version output version information and exit 744fb28925Smrg --run try to run the given command, and emulate it if it fails 754fb28925Smrg 764fb28925SmrgSupported PROGRAM values: 774fb28925Smrg aclocal touch file \`aclocal.m4' 784fb28925Smrg autoconf touch file \`configure' 794fb28925Smrg autoheader touch file \`config.h.in' 80b66d1acbSmrg autom4te touch the output file, or create a stub one 814fb28925Smrg automake touch all \`Makefile.in' files 824fb28925Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 834fb28925Smrg flex create \`lex.yy.c', if possible, from existing .c 844fb28925Smrg help2man touch the output file 854fb28925Smrg lex create \`lex.yy.c', if possible, from existing .c 864fb28925Smrg makeinfo touch the output file 874fb28925Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88b66d1acbSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89b66d1acbSmrg 90b66d1acbSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91b66d1acbSmrg\`g' are ignored when checking the name. 92b66d1acbSmrg 93b66d1acbSmrgSend bug reports to <bug-automake@gnu.org>." 94b66d1acbSmrg exit $? 954fb28925Smrg ;; 964fb28925Smrg 974fb28925Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98b66d1acbSmrg echo "missing $scriptversion (GNU Automake)" 99b66d1acbSmrg exit $? 1004fb28925Smrg ;; 1014fb28925Smrg 1024fb28925Smrg -*) 1034fb28925Smrg echo 1>&2 "$0: Unknown \`$1' option" 1044fb28925Smrg echo 1>&2 "Try \`$0 --help' for more information" 1054fb28925Smrg exit 1 1064fb28925Smrg ;; 1074fb28925Smrg 108b66d1acbSmrgesac 109b66d1acbSmrg 110b66d1acbSmrg# normalize program name to check for. 111b66d1acbSmrgprogram=`echo "$1" | sed ' 112b66d1acbSmrg s/^gnu-//; t 113b66d1acbSmrg s/^gnu//; t 114b66d1acbSmrg s/^g//; t'` 115b66d1acbSmrg 116b66d1acbSmrg# Now exit if we have it, but it failed. Also exit now if we 117b66d1acbSmrg# don't have it and --version was passed (most likely to detect 118b66d1acbSmrg# the program). This is about non-GNU programs, so use $1 not 119b66d1acbSmrg# $program. 120b66d1acbSmrgcase $1 in 121b66d1acbSmrg lex*|yacc*) 122b66d1acbSmrg # Not GNU programs, they don't have --version. 123b66d1acbSmrg ;; 124b66d1acbSmrg 125b66d1acbSmrg tar*) 126b66d1acbSmrg if test -n "$run"; then 127b66d1acbSmrg echo 1>&2 "ERROR: \`tar' requires --run" 128b66d1acbSmrg exit 1 129b66d1acbSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130b66d1acbSmrg exit 1 131b66d1acbSmrg fi 132b66d1acbSmrg ;; 133b66d1acbSmrg 134b66d1acbSmrg *) 1354fb28925Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1364fb28925Smrg # We have it, but it failed. 1374fb28925Smrg exit 1 138b66d1acbSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139b66d1acbSmrg # Could not run --version or --help. This is probably someone 140b66d1acbSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 141b66d1acbSmrg # $TOOL exists and not knowing $TOOL uses missing. 142b66d1acbSmrg exit 1 1434fb28925Smrg fi 144b66d1acbSmrg ;; 145b66d1acbSmrgesac 1464fb28925Smrg 147b66d1acbSmrg# If it does not exist, or fails to run (possibly an outdated version), 148b66d1acbSmrg# try to emulate it. 149b66d1acbSmrgcase $program in 150b66d1acbSmrg aclocal*) 1514fb28925Smrg echo 1>&2 "\ 152b66d1acbSmrgWARNING: \`$1' is $msg. You should only need it if 1534fb28925Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1544fb28925Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1554fb28925Smrg any GNU archive site." 1564fb28925Smrg touch aclocal.m4 1574fb28925Smrg ;; 1584fb28925Smrg 159b66d1acbSmrg autoconf*) 1604fb28925Smrg echo 1>&2 "\ 161b66d1acbSmrgWARNING: \`$1' is $msg. You should only need it if 1624fb28925Smrg you modified \`${configure_ac}'. You might want to install the 1634fb28925Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1644fb28925Smrg archive site." 1654fb28925Smrg touch configure 1664fb28925Smrg ;; 1674fb28925Smrg 168b66d1acbSmrg autoheader*) 1694fb28925Smrg echo 1>&2 "\ 170b66d1acbSmrgWARNING: \`$1' is $msg. You should only need it if 1714fb28925Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1724fb28925Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1734fb28925Smrg from any GNU archive site." 1744fb28925Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1754fb28925Smrg test -z "$files" && files="config.h" 1764fb28925Smrg touch_files= 1774fb28925Smrg for f in $files; do 178b66d1acbSmrg case $f in 1794fb28925Smrg *:*) touch_files="$touch_files "`echo "$f" | 1804fb28925Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1814fb28925Smrg *) touch_files="$touch_files $f.in";; 1824fb28925Smrg esac 1834fb28925Smrg done 1844fb28925Smrg touch $touch_files 1854fb28925Smrg ;; 1864fb28925Smrg 1874fb28925Smrg automake*) 1884fb28925Smrg echo 1>&2 "\ 189b66d1acbSmrgWARNING: \`$1' is $msg. You should only need it if 1904fb28925Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1914fb28925Smrg You might want to install the \`Automake' and \`Perl' packages. 1924fb28925Smrg Grab them from any GNU archive site." 1934fb28925Smrg find . -type f -name Makefile.am -print | 1944fb28925Smrg sed 's/\.am$/.in/' | 1954fb28925Smrg while read f; do touch "$f"; done 1964fb28925Smrg ;; 1974fb28925Smrg 198b66d1acbSmrg autom4te*) 1994fb28925Smrg echo 1>&2 "\ 200b66d1acbSmrgWARNING: \`$1' is needed, but is $msg. 201b66d1acbSmrg You might have modified some files without having the 2024fb28925Smrg proper tools for further handling them. 2034fb28925Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2044fb28925Smrg archive site." 2054fb28925Smrg 206b66d1acbSmrg file=`echo "$*" | sed -n "$sed_output"` 207b66d1acbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2084fb28925Smrg if test -f "$file"; then 2094fb28925Smrg touch $file 2104fb28925Smrg else 2114fb28925Smrg test -z "$file" || exec >$file 2124fb28925Smrg echo "#! /bin/sh" 2134fb28925Smrg echo "# Created by GNU Automake missing as a replacement of" 2144fb28925Smrg echo "# $ $@" 2154fb28925Smrg echo "exit 0" 2164fb28925Smrg chmod +x $file 2174fb28925Smrg exit 1 2184fb28925Smrg fi 2194fb28925Smrg ;; 2204fb28925Smrg 221b66d1acbSmrg bison*|yacc*) 2224fb28925Smrg echo 1>&2 "\ 223b66d1acbSmrgWARNING: \`$1' $msg. You should only need it if 2244fb28925Smrg you modified a \`.y' file. You may need the \`Bison' package 2254fb28925Smrg in order for those modifications to take effect. You can get 2264fb28925Smrg \`Bison' from any GNU archive site." 2274fb28925Smrg rm -f y.tab.c y.tab.h 228b66d1acbSmrg if test $# -ne 1; then 2294fb28925Smrg eval LASTARG="\${$#}" 230b66d1acbSmrg case $LASTARG in 2314fb28925Smrg *.y) 2324fb28925Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233b66d1acbSmrg if test -f "$SRCFILE"; then 2344fb28925Smrg cp "$SRCFILE" y.tab.c 2354fb28925Smrg fi 2364fb28925Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237b66d1acbSmrg if test -f "$SRCFILE"; then 2384fb28925Smrg cp "$SRCFILE" y.tab.h 2394fb28925Smrg fi 2404fb28925Smrg ;; 2414fb28925Smrg esac 2424fb28925Smrg fi 243b66d1acbSmrg if test ! -f y.tab.h; then 2444fb28925Smrg echo >y.tab.h 2454fb28925Smrg fi 246b66d1acbSmrg if test ! -f y.tab.c; then 2474fb28925Smrg echo 'main() { return 0; }' >y.tab.c 2484fb28925Smrg fi 2494fb28925Smrg ;; 2504fb28925Smrg 251b66d1acbSmrg lex*|flex*) 2524fb28925Smrg echo 1>&2 "\ 253b66d1acbSmrgWARNING: \`$1' is $msg. You should only need it if 2544fb28925Smrg you modified a \`.l' file. You may need the \`Flex' package 2554fb28925Smrg in order for those modifications to take effect. You can get 2564fb28925Smrg \`Flex' from any GNU archive site." 2574fb28925Smrg rm -f lex.yy.c 258b66d1acbSmrg if test $# -ne 1; then 2594fb28925Smrg eval LASTARG="\${$#}" 260b66d1acbSmrg case $LASTARG in 2614fb28925Smrg *.l) 2624fb28925Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263b66d1acbSmrg if test -f "$SRCFILE"; then 2644fb28925Smrg cp "$SRCFILE" lex.yy.c 2654fb28925Smrg fi 2664fb28925Smrg ;; 2674fb28925Smrg esac 2684fb28925Smrg fi 269b66d1acbSmrg if test ! -f lex.yy.c; then 2704fb28925Smrg echo 'main() { return 0; }' >lex.yy.c 2714fb28925Smrg fi 2724fb28925Smrg ;; 2734fb28925Smrg 274b66d1acbSmrg help2man*) 2754fb28925Smrg echo 1>&2 "\ 276b66d1acbSmrgWARNING: \`$1' is $msg. You should only need it if 2774fb28925Smrg you modified a dependency of a manual page. You may need the 2784fb28925Smrg \`Help2man' package in order for those modifications to take 2794fb28925Smrg effect. You can get \`Help2man' from any GNU archive site." 2804fb28925Smrg 281b66d1acbSmrg file=`echo "$*" | sed -n "$sed_output"` 282b66d1acbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283b66d1acbSmrg if test -f "$file"; then 2844fb28925Smrg touch $file 2854fb28925Smrg else 2864fb28925Smrg test -z "$file" || exec >$file 2874fb28925Smrg echo ".ab help2man is required to generate this page" 288b66d1acbSmrg exit $? 2894fb28925Smrg fi 2904fb28925Smrg ;; 2914fb28925Smrg 292b66d1acbSmrg makeinfo*) 2934fb28925Smrg echo 1>&2 "\ 294b66d1acbSmrgWARNING: \`$1' is $msg. You should only need it if 2954fb28925Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2964fb28925Smrg indirectly affecting the aspect of the manual. The spurious 2974fb28925Smrg call might also be the consequence of using a buggy \`make' (AIX, 2984fb28925Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2994fb28925Smrg the \`GNU make' package. Grab either from any GNU archive site." 300b66d1acbSmrg # The file to touch is that specified with -o ... 301b66d1acbSmrg file=`echo "$*" | sed -n "$sed_output"` 302b66d1acbSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3034fb28925Smrg if test -z "$file"; then 304b66d1acbSmrg # ... or it is the one specified with @setfilename ... 305b66d1acbSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306b66d1acbSmrg file=`sed -n ' 307b66d1acbSmrg /^@setfilename/{ 308b66d1acbSmrg s/.* \([^ ]*\) *$/\1/ 309b66d1acbSmrg p 310b66d1acbSmrg q 311b66d1acbSmrg }' $infile` 312b66d1acbSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313b66d1acbSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3144fb28925Smrg fi 315b66d1acbSmrg # If the file does not exist, the user really needs makeinfo; 316b66d1acbSmrg # let's fail without touching anything. 317b66d1acbSmrg test -f $file || exit 1 3184fb28925Smrg touch $file 3194fb28925Smrg ;; 3204fb28925Smrg 321b66d1acbSmrg tar*) 3224fb28925Smrg shift 3234fb28925Smrg 3244fb28925Smrg # We have already tried tar in the generic part. 3254fb28925Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3264fb28925Smrg # messages. 3274fb28925Smrg if (gnutar --version > /dev/null 2>&1); then 3284fb28925Smrg gnutar "$@" && exit 0 3294fb28925Smrg fi 3304fb28925Smrg if (gtar --version > /dev/null 2>&1); then 3314fb28925Smrg gtar "$@" && exit 0 3324fb28925Smrg fi 3334fb28925Smrg firstarg="$1" 3344fb28925Smrg if shift; then 335b66d1acbSmrg case $firstarg in 3364fb28925Smrg *o*) 3374fb28925Smrg firstarg=`echo "$firstarg" | sed s/o//` 3384fb28925Smrg tar "$firstarg" "$@" && exit 0 3394fb28925Smrg ;; 3404fb28925Smrg esac 341b66d1acbSmrg case $firstarg in 3424fb28925Smrg *h*) 3434fb28925Smrg firstarg=`echo "$firstarg" | sed s/h//` 3444fb28925Smrg tar "$firstarg" "$@" && exit 0 3454fb28925Smrg ;; 3464fb28925Smrg esac 3474fb28925Smrg fi 3484fb28925Smrg 3494fb28925Smrg echo 1>&2 "\ 3504fb28925SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3514fb28925Smrg You may want to install GNU tar or Free paxutils, or check the 3524fb28925Smrg command line arguments." 3534fb28925Smrg exit 1 3544fb28925Smrg ;; 3554fb28925Smrg 3564fb28925Smrg *) 3574fb28925Smrg echo 1>&2 "\ 358b66d1acbSmrgWARNING: \`$1' is needed, and is $msg. 359b66d1acbSmrg You might have modified some files without having the 3604fb28925Smrg proper tools for further handling them. Check the \`README' file, 3614fb28925Smrg it often tells you about the needed prerequisites for installing 3624fb28925Smrg this package. You may also peek at any GNU archive site, in case 3634fb28925Smrg some other package would contain this missing \`$1' program." 3644fb28925Smrg exit 1 3654fb28925Smrg ;; 3664fb28925Smrgesac 3674fb28925Smrg 3684fb28925Smrgexit 0 369b66d1acbSmrg 370b66d1acbSmrg# Local variables: 371b66d1acbSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372b66d1acbSmrg# time-stamp-start: "scriptversion=" 373b66d1acbSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374b66d1acbSmrg# time-stamp-time-zone: "UTC" 375b66d1acbSmrg# time-stamp-end: "; # UTC" 376b66d1acbSmrg# End: 377