missing revision 8fff3f40
1e6232409Smrg#! /bin/sh 2e6232409Smrg# Common stub for a few missing GNU programs while installing. 3e6232409Smrg 48fff3f40Smrgscriptversion=2009-04-28.21; # UTC 5e6232409Smrg 68fff3f40Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 78fff3f40Smrg# 2008, 2009 Free Software Foundation, Inc. 8e6232409Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9e6232409Smrg 10e6232409Smrg# This program is free software; you can redistribute it and/or modify 11e6232409Smrg# it under the terms of the GNU General Public License as published by 12e6232409Smrg# the Free Software Foundation; either version 2, or (at your option) 13e6232409Smrg# any later version. 14e6232409Smrg 15e6232409Smrg# This program is distributed in the hope that it will be useful, 16e6232409Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17e6232409Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18e6232409Smrg# GNU General Public License for more details. 19e6232409Smrg 20e6232409Smrg# You should have received a copy of the GNU General Public License 218fff3f40Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22e6232409Smrg 23e6232409Smrg# As a special exception to the GNU General Public License, if you 24e6232409Smrg# distribute this file as part of a program that contains a 25e6232409Smrg# configuration script generated by Autoconf, you may include it under 26e6232409Smrg# the same distribution terms that you use for the rest of that program. 27e6232409Smrg 28e6232409Smrgif test $# -eq 0; then 29e6232409Smrg echo 1>&2 "Try \`$0 --help' for more information" 30e6232409Smrg exit 1 31e6232409Smrgfi 32e6232409Smrg 33e6232409Smrgrun=: 348fff3f40Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 358fff3f40Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36e6232409Smrg 37e6232409Smrg# In the cases where this matters, `missing' is being run in the 38e6232409Smrg# srcdir already. 39e6232409Smrgif test -f configure.ac; then 40e6232409Smrg configure_ac=configure.ac 41e6232409Smrgelse 42e6232409Smrg configure_ac=configure.in 43e6232409Smrgfi 44e6232409Smrg 45e6232409Smrgmsg="missing on your system" 46e6232409Smrg 478fff3f40Smrgcase $1 in 48e6232409Smrg--run) 49e6232409Smrg # Try to run requested program, and just exit if it succeeds. 50e6232409Smrg run= 51e6232409Smrg shift 52e6232409Smrg "$@" && exit 0 53e6232409Smrg # Exit code 63 means version mismatch. This often happens 54e6232409Smrg # when the user try to use an ancient version of a tool on 55e6232409Smrg # a file that requires a minimum version. In this case we 56e6232409Smrg # we should proceed has if the program had been absent, or 57e6232409Smrg # if --run hadn't been passed. 58e6232409Smrg if test $? = 63; then 59e6232409Smrg run=: 60e6232409Smrg msg="probably too old" 61e6232409Smrg fi 62e6232409Smrg ;; 63e6232409Smrg 64e6232409Smrg -h|--h|--he|--hel|--help) 65e6232409Smrg echo "\ 66e6232409Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67e6232409Smrg 68e6232409SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69e6232409Smrgerror status if there is no known handling for PROGRAM. 70e6232409Smrg 71e6232409SmrgOptions: 72e6232409Smrg -h, --help display this help and exit 73e6232409Smrg -v, --version output version information and exit 74e6232409Smrg --run try to run the given command, and emulate it if it fails 75e6232409Smrg 76e6232409SmrgSupported PROGRAM values: 77e6232409Smrg aclocal touch file \`aclocal.m4' 78e6232409Smrg autoconf touch file \`configure' 79e6232409Smrg autoheader touch file \`config.h.in' 808fff3f40Smrg autom4te touch the output file, or create a stub one 81e6232409Smrg automake touch all \`Makefile.in' files 82e6232409Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83e6232409Smrg flex create \`lex.yy.c', if possible, from existing .c 84e6232409Smrg help2man touch the output file 85e6232409Smrg lex create \`lex.yy.c', if possible, from existing .c 86e6232409Smrg makeinfo touch the output file 87e6232409Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88e6232409Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89e6232409Smrg 908fff3f40SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 918fff3f40Smrg\`g' are ignored when checking the name. 928fff3f40Smrg 93e6232409SmrgSend bug reports to <bug-automake@gnu.org>." 94e6232409Smrg exit $? 95e6232409Smrg ;; 96e6232409Smrg 97e6232409Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98e6232409Smrg echo "missing $scriptversion (GNU Automake)" 99e6232409Smrg exit $? 100e6232409Smrg ;; 101e6232409Smrg 102e6232409Smrg -*) 103e6232409Smrg echo 1>&2 "$0: Unknown \`$1' option" 104e6232409Smrg echo 1>&2 "Try \`$0 --help' for more information" 105e6232409Smrg exit 1 106e6232409Smrg ;; 107e6232409Smrg 108e6232409Smrgesac 109e6232409Smrg 1108fff3f40Smrg# normalize program name to check for. 1118fff3f40Smrgprogram=`echo "$1" | sed ' 1128fff3f40Smrg s/^gnu-//; t 1138fff3f40Smrg s/^gnu//; t 1148fff3f40Smrg s/^g//; t'` 1158fff3f40Smrg 116e6232409Smrg# Now exit if we have it, but it failed. Also exit now if we 117e6232409Smrg# don't have it and --version was passed (most likely to detect 1188fff3f40Smrg# the program). This is about non-GNU programs, so use $1 not 1198fff3f40Smrg# $program. 1208fff3f40Smrgcase $1 in 1218fff3f40Smrg lex*|yacc*) 122e6232409Smrg # Not GNU programs, they don't have --version. 123e6232409Smrg ;; 124e6232409Smrg 1258fff3f40Smrg tar*) 126e6232409Smrg if test -n "$run"; then 127e6232409Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128e6232409Smrg exit 1 129e6232409Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130e6232409Smrg exit 1 131e6232409Smrg fi 132e6232409Smrg ;; 133e6232409Smrg 134e6232409Smrg *) 135e6232409Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136e6232409Smrg # We have it, but it failed. 137e6232409Smrg exit 1 138e6232409Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139e6232409Smrg # Could not run --version or --help. This is probably someone 140e6232409Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141e6232409Smrg # $TOOL exists and not knowing $TOOL uses missing. 142e6232409Smrg exit 1 143e6232409Smrg fi 144e6232409Smrg ;; 145e6232409Smrgesac 146e6232409Smrg 147e6232409Smrg# If it does not exist, or fails to run (possibly an outdated version), 148e6232409Smrg# try to emulate it. 1498fff3f40Smrgcase $program in 150e6232409Smrg aclocal*) 151e6232409Smrg echo 1>&2 "\ 152e6232409SmrgWARNING: \`$1' is $msg. You should only need it if 153e6232409Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154e6232409Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155e6232409Smrg any GNU archive site." 156e6232409Smrg touch aclocal.m4 157e6232409Smrg ;; 158e6232409Smrg 1598fff3f40Smrg autoconf*) 160e6232409Smrg echo 1>&2 "\ 161e6232409SmrgWARNING: \`$1' is $msg. You should only need it if 162e6232409Smrg you modified \`${configure_ac}'. You might want to install the 163e6232409Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164e6232409Smrg archive site." 165e6232409Smrg touch configure 166e6232409Smrg ;; 167e6232409Smrg 1688fff3f40Smrg autoheader*) 169e6232409Smrg echo 1>&2 "\ 170e6232409SmrgWARNING: \`$1' is $msg. You should only need it if 171e6232409Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172e6232409Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173e6232409Smrg from any GNU archive site." 174e6232409Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175e6232409Smrg test -z "$files" && files="config.h" 176e6232409Smrg touch_files= 177e6232409Smrg for f in $files; do 1788fff3f40Smrg case $f in 179e6232409Smrg *:*) touch_files="$touch_files "`echo "$f" | 180e6232409Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181e6232409Smrg *) touch_files="$touch_files $f.in";; 182e6232409Smrg esac 183e6232409Smrg done 184e6232409Smrg touch $touch_files 185e6232409Smrg ;; 186e6232409Smrg 187e6232409Smrg automake*) 188e6232409Smrg echo 1>&2 "\ 189e6232409SmrgWARNING: \`$1' is $msg. You should only need it if 190e6232409Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191e6232409Smrg You might want to install the \`Automake' and \`Perl' packages. 192e6232409Smrg Grab them from any GNU archive site." 193e6232409Smrg find . -type f -name Makefile.am -print | 194e6232409Smrg sed 's/\.am$/.in/' | 195e6232409Smrg while read f; do touch "$f"; done 196e6232409Smrg ;; 197e6232409Smrg 1988fff3f40Smrg autom4te*) 199e6232409Smrg echo 1>&2 "\ 200e6232409SmrgWARNING: \`$1' is needed, but is $msg. 201e6232409Smrg You might have modified some files without having the 202e6232409Smrg proper tools for further handling them. 203e6232409Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204e6232409Smrg archive site." 205e6232409Smrg 2068fff3f40Smrg file=`echo "$*" | sed -n "$sed_output"` 2078fff3f40Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208e6232409Smrg if test -f "$file"; then 209e6232409Smrg touch $file 210e6232409Smrg else 211e6232409Smrg test -z "$file" || exec >$file 212e6232409Smrg echo "#! /bin/sh" 213e6232409Smrg echo "# Created by GNU Automake missing as a replacement of" 214e6232409Smrg echo "# $ $@" 215e6232409Smrg echo "exit 0" 216e6232409Smrg chmod +x $file 217e6232409Smrg exit 1 218e6232409Smrg fi 219e6232409Smrg ;; 220e6232409Smrg 2218fff3f40Smrg bison*|yacc*) 222e6232409Smrg echo 1>&2 "\ 223e6232409SmrgWARNING: \`$1' $msg. You should only need it if 224e6232409Smrg you modified a \`.y' file. You may need the \`Bison' package 225e6232409Smrg in order for those modifications to take effect. You can get 226e6232409Smrg \`Bison' from any GNU archive site." 227e6232409Smrg rm -f y.tab.c y.tab.h 2288fff3f40Smrg if test $# -ne 1; then 229e6232409Smrg eval LASTARG="\${$#}" 2308fff3f40Smrg case $LASTARG in 231e6232409Smrg *.y) 232e6232409Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2338fff3f40Smrg if test -f "$SRCFILE"; then 234e6232409Smrg cp "$SRCFILE" y.tab.c 235e6232409Smrg fi 236e6232409Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2378fff3f40Smrg if test -f "$SRCFILE"; then 238e6232409Smrg cp "$SRCFILE" y.tab.h 239e6232409Smrg fi 240e6232409Smrg ;; 241e6232409Smrg esac 242e6232409Smrg fi 2438fff3f40Smrg if test ! -f y.tab.h; then 244e6232409Smrg echo >y.tab.h 245e6232409Smrg fi 2468fff3f40Smrg if test ! -f y.tab.c; then 247e6232409Smrg echo 'main() { return 0; }' >y.tab.c 248e6232409Smrg fi 249e6232409Smrg ;; 250e6232409Smrg 2518fff3f40Smrg lex*|flex*) 252e6232409Smrg echo 1>&2 "\ 253e6232409SmrgWARNING: \`$1' is $msg. You should only need it if 254e6232409Smrg you modified a \`.l' file. You may need the \`Flex' package 255e6232409Smrg in order for those modifications to take effect. You can get 256e6232409Smrg \`Flex' from any GNU archive site." 257e6232409Smrg rm -f lex.yy.c 2588fff3f40Smrg if test $# -ne 1; then 259e6232409Smrg eval LASTARG="\${$#}" 2608fff3f40Smrg case $LASTARG in 261e6232409Smrg *.l) 262e6232409Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2638fff3f40Smrg if test -f "$SRCFILE"; then 264e6232409Smrg cp "$SRCFILE" lex.yy.c 265e6232409Smrg fi 266e6232409Smrg ;; 267e6232409Smrg esac 268e6232409Smrg fi 2698fff3f40Smrg if test ! -f lex.yy.c; then 270e6232409Smrg echo 'main() { return 0; }' >lex.yy.c 271e6232409Smrg fi 272e6232409Smrg ;; 273e6232409Smrg 2748fff3f40Smrg help2man*) 275e6232409Smrg echo 1>&2 "\ 276e6232409SmrgWARNING: \`$1' is $msg. You should only need it if 277e6232409Smrg you modified a dependency of a manual page. You may need the 278e6232409Smrg \`Help2man' package in order for those modifications to take 279e6232409Smrg effect. You can get \`Help2man' from any GNU archive site." 280e6232409Smrg 2818fff3f40Smrg file=`echo "$*" | sed -n "$sed_output"` 2828fff3f40Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2838fff3f40Smrg if test -f "$file"; then 284e6232409Smrg touch $file 285e6232409Smrg else 286e6232409Smrg test -z "$file" || exec >$file 287e6232409Smrg echo ".ab help2man is required to generate this page" 2888fff3f40Smrg exit $? 289e6232409Smrg fi 290e6232409Smrg ;; 291e6232409Smrg 2928fff3f40Smrg makeinfo*) 293e6232409Smrg echo 1>&2 "\ 294e6232409SmrgWARNING: \`$1' is $msg. You should only need it if 295e6232409Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296e6232409Smrg indirectly affecting the aspect of the manual. The spurious 297e6232409Smrg call might also be the consequence of using a buggy \`make' (AIX, 298e6232409Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299e6232409Smrg the \`GNU make' package. Grab either from any GNU archive site." 300e6232409Smrg # The file to touch is that specified with -o ... 3018fff3f40Smrg file=`echo "$*" | sed -n "$sed_output"` 3028fff3f40Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303e6232409Smrg if test -z "$file"; then 304e6232409Smrg # ... or it is the one specified with @setfilename ... 305e6232409Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3068fff3f40Smrg file=`sed -n ' 3078fff3f40Smrg /^@setfilename/{ 3088fff3f40Smrg s/.* \([^ ]*\) *$/\1/ 3098fff3f40Smrg p 3108fff3f40Smrg q 3118fff3f40Smrg }' $infile` 312e6232409Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313e6232409Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314e6232409Smrg fi 315e6232409Smrg # If the file does not exist, the user really needs makeinfo; 316e6232409Smrg # let's fail without touching anything. 317e6232409Smrg test -f $file || exit 1 318e6232409Smrg touch $file 319e6232409Smrg ;; 320e6232409Smrg 3218fff3f40Smrg tar*) 322e6232409Smrg shift 323e6232409Smrg 324e6232409Smrg # We have already tried tar in the generic part. 325e6232409Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326e6232409Smrg # messages. 327e6232409Smrg if (gnutar --version > /dev/null 2>&1); then 328e6232409Smrg gnutar "$@" && exit 0 329e6232409Smrg fi 330e6232409Smrg if (gtar --version > /dev/null 2>&1); then 331e6232409Smrg gtar "$@" && exit 0 332e6232409Smrg fi 333e6232409Smrg firstarg="$1" 334e6232409Smrg if shift; then 3358fff3f40Smrg case $firstarg in 336e6232409Smrg *o*) 337e6232409Smrg firstarg=`echo "$firstarg" | sed s/o//` 338e6232409Smrg tar "$firstarg" "$@" && exit 0 339e6232409Smrg ;; 340e6232409Smrg esac 3418fff3f40Smrg case $firstarg in 342e6232409Smrg *h*) 343e6232409Smrg firstarg=`echo "$firstarg" | sed s/h//` 344e6232409Smrg tar "$firstarg" "$@" && exit 0 345e6232409Smrg ;; 346e6232409Smrg esac 347e6232409Smrg fi 348e6232409Smrg 349e6232409Smrg echo 1>&2 "\ 350e6232409SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351e6232409Smrg You may want to install GNU tar or Free paxutils, or check the 352e6232409Smrg command line arguments." 353e6232409Smrg exit 1 354e6232409Smrg ;; 355e6232409Smrg 356e6232409Smrg *) 357e6232409Smrg echo 1>&2 "\ 358e6232409SmrgWARNING: \`$1' is needed, and is $msg. 359e6232409Smrg You might have modified some files without having the 360e6232409Smrg proper tools for further handling them. Check the \`README' file, 361e6232409Smrg it often tells you about the needed prerequisites for installing 362e6232409Smrg this package. You may also peek at any GNU archive site, in case 363e6232409Smrg some other package would contain this missing \`$1' program." 364e6232409Smrg exit 1 365e6232409Smrg ;; 366e6232409Smrgesac 367e6232409Smrg 368e6232409Smrgexit 0 369e6232409Smrg 370e6232409Smrg# Local variables: 371e6232409Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372e6232409Smrg# time-stamp-start: "scriptversion=" 373e6232409Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 3748fff3f40Smrg# time-stamp-time-zone: "UTC" 3758fff3f40Smrg# time-stamp-end: "; # UTC" 376e6232409Smrg# End: 377