missing revision d8556812
176888252Smrg#! /bin/sh 276888252Smrg# Common stub for a few missing GNU programs while installing. 376888252Smrg 4d8556812Smrgscriptversion=2009-04-28.21; # UTC 576888252Smrg 6d8556812Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7d8556812Smrg# 2008, 2009 Free Software Foundation, Inc. 876888252Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 976888252Smrg 1076888252Smrg# This program is free software; you can redistribute it and/or modify 1176888252Smrg# it under the terms of the GNU General Public License as published by 1276888252Smrg# the Free Software Foundation; either version 2, or (at your option) 1376888252Smrg# any later version. 1476888252Smrg 1576888252Smrg# This program is distributed in the hope that it will be useful, 1676888252Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1776888252Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1876888252Smrg# GNU General Public License for more details. 1976888252Smrg 2076888252Smrg# You should have received a copy of the GNU General Public License 21d8556812Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2276888252Smrg 2376888252Smrg# As a special exception to the GNU General Public License, if you 2476888252Smrg# distribute this file as part of a program that contains a 2576888252Smrg# configuration script generated by Autoconf, you may include it under 2676888252Smrg# the same distribution terms that you use for the rest of that program. 2776888252Smrg 2876888252Smrgif test $# -eq 0; then 2976888252Smrg echo 1>&2 "Try \`$0 --help' for more information" 3076888252Smrg exit 1 3176888252Smrgfi 3276888252Smrg 3376888252Smrgrun=: 341ae1b5e8Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 351ae1b5e8Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3676888252Smrg 3776888252Smrg# In the cases where this matters, `missing' is being run in the 3876888252Smrg# srcdir already. 3976888252Smrgif test -f configure.ac; then 4076888252Smrg configure_ac=configure.ac 4176888252Smrgelse 4276888252Smrg configure_ac=configure.in 4376888252Smrgfi 4476888252Smrg 4576888252Smrgmsg="missing on your system" 4676888252Smrg 471ae1b5e8Smrgcase $1 in 4876888252Smrg--run) 4976888252Smrg # Try to run requested program, and just exit if it succeeds. 5076888252Smrg run= 5176888252Smrg shift 5276888252Smrg "$@" && exit 0 5376888252Smrg # Exit code 63 means version mismatch. This often happens 5476888252Smrg # when the user try to use an ancient version of a tool on 5576888252Smrg # a file that requires a minimum version. In this case we 5676888252Smrg # we should proceed has if the program had been absent, or 5776888252Smrg # if --run hadn't been passed. 5876888252Smrg if test $? = 63; then 5976888252Smrg run=: 6076888252Smrg msg="probably too old" 6176888252Smrg fi 6276888252Smrg ;; 6376888252Smrg 6476888252Smrg -h|--h|--he|--hel|--help) 6576888252Smrg echo "\ 6676888252Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6776888252Smrg 6876888252SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6976888252Smrgerror status if there is no known handling for PROGRAM. 7076888252Smrg 7176888252SmrgOptions: 7276888252Smrg -h, --help display this help and exit 7376888252Smrg -v, --version output version information and exit 7476888252Smrg --run try to run the given command, and emulate it if it fails 7576888252Smrg 7676888252SmrgSupported PROGRAM values: 7776888252Smrg aclocal touch file \`aclocal.m4' 7876888252Smrg autoconf touch file \`configure' 7976888252Smrg autoheader touch file \`config.h.in' 801ae1b5e8Smrg autom4te touch the output file, or create a stub one 8176888252Smrg automake touch all \`Makefile.in' files 8276888252Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8376888252Smrg flex create \`lex.yy.c', if possible, from existing .c 8476888252Smrg help2man touch the output file 8576888252Smrg lex create \`lex.yy.c', if possible, from existing .c 8676888252Smrg makeinfo touch the output file 8776888252Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 8876888252Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 8976888252Smrg 90d8556812SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91d8556812Smrg\`g' are ignored when checking the name. 92d8556812Smrg 9376888252SmrgSend bug reports to <bug-automake@gnu.org>." 9476888252Smrg exit $? 9576888252Smrg ;; 9676888252Smrg 9776888252Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 9876888252Smrg echo "missing $scriptversion (GNU Automake)" 9976888252Smrg exit $? 10076888252Smrg ;; 10176888252Smrg 10276888252Smrg -*) 10376888252Smrg echo 1>&2 "$0: Unknown \`$1' option" 10476888252Smrg echo 1>&2 "Try \`$0 --help' for more information" 10576888252Smrg exit 1 10676888252Smrg ;; 10776888252Smrg 10876888252Smrgesac 10976888252Smrg 110d8556812Smrg# normalize program name to check for. 111d8556812Smrgprogram=`echo "$1" | sed ' 112d8556812Smrg s/^gnu-//; t 113d8556812Smrg s/^gnu//; t 114d8556812Smrg s/^g//; t'` 115d8556812Smrg 11676888252Smrg# Now exit if we have it, but it failed. Also exit now if we 11776888252Smrg# don't have it and --version was passed (most likely to detect 118d8556812Smrg# the program). This is about non-GNU programs, so use $1 not 119d8556812Smrg# $program. 1201ae1b5e8Smrgcase $1 in 121d8556812Smrg lex*|yacc*) 12276888252Smrg # Not GNU programs, they don't have --version. 12376888252Smrg ;; 12476888252Smrg 125d8556812Smrg tar*) 12676888252Smrg if test -n "$run"; then 12776888252Smrg echo 1>&2 "ERROR: \`tar' requires --run" 12876888252Smrg exit 1 12976888252Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13076888252Smrg exit 1 13176888252Smrg fi 13276888252Smrg ;; 13376888252Smrg 13476888252Smrg *) 13576888252Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13676888252Smrg # We have it, but it failed. 13776888252Smrg exit 1 13876888252Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 13976888252Smrg # Could not run --version or --help. This is probably someone 14076888252Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 14176888252Smrg # $TOOL exists and not knowing $TOOL uses missing. 14276888252Smrg exit 1 14376888252Smrg fi 14476888252Smrg ;; 14576888252Smrgesac 14676888252Smrg 14776888252Smrg# If it does not exist, or fails to run (possibly an outdated version), 14876888252Smrg# try to emulate it. 149d8556812Smrgcase $program in 15076888252Smrg aclocal*) 15176888252Smrg echo 1>&2 "\ 15276888252SmrgWARNING: \`$1' is $msg. You should only need it if 15376888252Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15476888252Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15576888252Smrg any GNU archive site." 15676888252Smrg touch aclocal.m4 15776888252Smrg ;; 15876888252Smrg 159d8556812Smrg autoconf*) 16076888252Smrg echo 1>&2 "\ 16176888252SmrgWARNING: \`$1' is $msg. You should only need it if 16276888252Smrg you modified \`${configure_ac}'. You might want to install the 16376888252Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16476888252Smrg archive site." 16576888252Smrg touch configure 16676888252Smrg ;; 16776888252Smrg 168d8556812Smrg autoheader*) 16976888252Smrg echo 1>&2 "\ 17076888252SmrgWARNING: \`$1' is $msg. You should only need it if 17176888252Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17276888252Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17376888252Smrg from any GNU archive site." 17476888252Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17576888252Smrg test -z "$files" && files="config.h" 17676888252Smrg touch_files= 17776888252Smrg for f in $files; do 1781ae1b5e8Smrg case $f in 17976888252Smrg *:*) touch_files="$touch_files "`echo "$f" | 18076888252Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18176888252Smrg *) touch_files="$touch_files $f.in";; 18276888252Smrg esac 18376888252Smrg done 18476888252Smrg touch $touch_files 18576888252Smrg ;; 18676888252Smrg 18776888252Smrg automake*) 18876888252Smrg echo 1>&2 "\ 18976888252SmrgWARNING: \`$1' is $msg. You should only need it if 19076888252Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19176888252Smrg You might want to install the \`Automake' and \`Perl' packages. 19276888252Smrg Grab them from any GNU archive site." 19376888252Smrg find . -type f -name Makefile.am -print | 19476888252Smrg sed 's/\.am$/.in/' | 19576888252Smrg while read f; do touch "$f"; done 19676888252Smrg ;; 19776888252Smrg 198d8556812Smrg autom4te*) 19976888252Smrg echo 1>&2 "\ 20076888252SmrgWARNING: \`$1' is needed, but is $msg. 20176888252Smrg You might have modified some files without having the 20276888252Smrg proper tools for further handling them. 20376888252Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20476888252Smrg archive site." 20576888252Smrg 2061ae1b5e8Smrg file=`echo "$*" | sed -n "$sed_output"` 2071ae1b5e8Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20876888252Smrg if test -f "$file"; then 20976888252Smrg touch $file 21076888252Smrg else 21176888252Smrg test -z "$file" || exec >$file 21276888252Smrg echo "#! /bin/sh" 21376888252Smrg echo "# Created by GNU Automake missing as a replacement of" 21476888252Smrg echo "# $ $@" 21576888252Smrg echo "exit 0" 21676888252Smrg chmod +x $file 21776888252Smrg exit 1 21876888252Smrg fi 21976888252Smrg ;; 22076888252Smrg 221d8556812Smrg bison*|yacc*) 22276888252Smrg echo 1>&2 "\ 22376888252SmrgWARNING: \`$1' $msg. You should only need it if 22476888252Smrg you modified a \`.y' file. You may need the \`Bison' package 22576888252Smrg in order for those modifications to take effect. You can get 22676888252Smrg \`Bison' from any GNU archive site." 22776888252Smrg rm -f y.tab.c y.tab.h 2281ae1b5e8Smrg if test $# -ne 1; then 22976888252Smrg eval LASTARG="\${$#}" 2301ae1b5e8Smrg case $LASTARG in 23176888252Smrg *.y) 23276888252Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2331ae1b5e8Smrg if test -f "$SRCFILE"; then 23476888252Smrg cp "$SRCFILE" y.tab.c 23576888252Smrg fi 23676888252Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2371ae1b5e8Smrg if test -f "$SRCFILE"; then 23876888252Smrg cp "$SRCFILE" y.tab.h 23976888252Smrg fi 24076888252Smrg ;; 24176888252Smrg esac 24276888252Smrg fi 2431ae1b5e8Smrg if test ! -f y.tab.h; then 24476888252Smrg echo >y.tab.h 24576888252Smrg fi 2461ae1b5e8Smrg if test ! -f y.tab.c; then 24776888252Smrg echo 'main() { return 0; }' >y.tab.c 24876888252Smrg fi 24976888252Smrg ;; 25076888252Smrg 251d8556812Smrg lex*|flex*) 25276888252Smrg echo 1>&2 "\ 25376888252SmrgWARNING: \`$1' is $msg. You should only need it if 25476888252Smrg you modified a \`.l' file. You may need the \`Flex' package 25576888252Smrg in order for those modifications to take effect. You can get 25676888252Smrg \`Flex' from any GNU archive site." 25776888252Smrg rm -f lex.yy.c 2581ae1b5e8Smrg if test $# -ne 1; then 25976888252Smrg eval LASTARG="\${$#}" 2601ae1b5e8Smrg case $LASTARG in 26176888252Smrg *.l) 26276888252Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2631ae1b5e8Smrg if test -f "$SRCFILE"; then 26476888252Smrg cp "$SRCFILE" lex.yy.c 26576888252Smrg fi 26676888252Smrg ;; 26776888252Smrg esac 26876888252Smrg fi 2691ae1b5e8Smrg if test ! -f lex.yy.c; then 27076888252Smrg echo 'main() { return 0; }' >lex.yy.c 27176888252Smrg fi 27276888252Smrg ;; 27376888252Smrg 274d8556812Smrg help2man*) 27576888252Smrg echo 1>&2 "\ 27676888252SmrgWARNING: \`$1' is $msg. You should only need it if 27776888252Smrg you modified a dependency of a manual page. You may need the 27876888252Smrg \`Help2man' package in order for those modifications to take 27976888252Smrg effect. You can get \`Help2man' from any GNU archive site." 28076888252Smrg 2811ae1b5e8Smrg file=`echo "$*" | sed -n "$sed_output"` 2821ae1b5e8Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2831ae1b5e8Smrg if test -f "$file"; then 28476888252Smrg touch $file 28576888252Smrg else 28676888252Smrg test -z "$file" || exec >$file 28776888252Smrg echo ".ab help2man is required to generate this page" 288d8556812Smrg exit $? 28976888252Smrg fi 29076888252Smrg ;; 29176888252Smrg 292d8556812Smrg makeinfo*) 29376888252Smrg echo 1>&2 "\ 29476888252SmrgWARNING: \`$1' is $msg. You should only need it if 29576888252Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29676888252Smrg indirectly affecting the aspect of the manual. The spurious 29776888252Smrg call might also be the consequence of using a buggy \`make' (AIX, 29876888252Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29976888252Smrg the \`GNU make' package. Grab either from any GNU archive site." 30076888252Smrg # The file to touch is that specified with -o ... 3011ae1b5e8Smrg file=`echo "$*" | sed -n "$sed_output"` 3021ae1b5e8Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30376888252Smrg if test -z "$file"; then 30476888252Smrg # ... or it is the one specified with @setfilename ... 30576888252Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 3061ae1b5e8Smrg file=`sed -n ' 3071ae1b5e8Smrg /^@setfilename/{ 3081ae1b5e8Smrg s/.* \([^ ]*\) *$/\1/ 3091ae1b5e8Smrg p 3101ae1b5e8Smrg q 3111ae1b5e8Smrg }' $infile` 31276888252Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 31376888252Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31476888252Smrg fi 31576888252Smrg # If the file does not exist, the user really needs makeinfo; 31676888252Smrg # let's fail without touching anything. 31776888252Smrg test -f $file || exit 1 31876888252Smrg touch $file 31976888252Smrg ;; 32076888252Smrg 321d8556812Smrg tar*) 32276888252Smrg shift 32376888252Smrg 32476888252Smrg # We have already tried tar in the generic part. 32576888252Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32676888252Smrg # messages. 32776888252Smrg if (gnutar --version > /dev/null 2>&1); then 32876888252Smrg gnutar "$@" && exit 0 32976888252Smrg fi 33076888252Smrg if (gtar --version > /dev/null 2>&1); then 33176888252Smrg gtar "$@" && exit 0 33276888252Smrg fi 33376888252Smrg firstarg="$1" 33476888252Smrg if shift; then 3351ae1b5e8Smrg case $firstarg in 33676888252Smrg *o*) 33776888252Smrg firstarg=`echo "$firstarg" | sed s/o//` 33876888252Smrg tar "$firstarg" "$@" && exit 0 33976888252Smrg ;; 34076888252Smrg esac 3411ae1b5e8Smrg case $firstarg in 34276888252Smrg *h*) 34376888252Smrg firstarg=`echo "$firstarg" | sed s/h//` 34476888252Smrg tar "$firstarg" "$@" && exit 0 34576888252Smrg ;; 34676888252Smrg esac 34776888252Smrg fi 34876888252Smrg 34976888252Smrg echo 1>&2 "\ 35076888252SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35176888252Smrg You may want to install GNU tar or Free paxutils, or check the 35276888252Smrg command line arguments." 35376888252Smrg exit 1 35476888252Smrg ;; 35576888252Smrg 35676888252Smrg *) 35776888252Smrg echo 1>&2 "\ 35876888252SmrgWARNING: \`$1' is needed, and is $msg. 35976888252Smrg You might have modified some files without having the 36076888252Smrg proper tools for further handling them. Check the \`README' file, 36176888252Smrg it often tells you about the needed prerequisites for installing 36276888252Smrg this package. You may also peek at any GNU archive site, in case 36376888252Smrg some other package would contain this missing \`$1' program." 36476888252Smrg exit 1 36576888252Smrg ;; 36676888252Smrgesac 36776888252Smrg 36876888252Smrgexit 0 36976888252Smrg 37076888252Smrg# Local variables: 37176888252Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 37276888252Smrg# time-stamp-start: "scriptversion=" 37376888252Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374d8556812Smrg# time-stamp-time-zone: "UTC" 375d8556812Smrg# time-stamp-end: "; # UTC" 37676888252Smrg# End: 377