167332fb9Smrg#! /bin/sh 267332fb9Smrg# Common stub for a few missing GNU programs while installing. 3eed6fe1cSmrg 4eed6fe1cSmrgscriptversion=2009-04-28.21; # UTC 5eed6fe1cSmrg 6eed6fe1cSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7eed6fe1cSmrg# 2008, 2009 Free Software Foundation, Inc. 867332fb9Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 967332fb9Smrg 1067332fb9Smrg# This program is free software; you can redistribute it and/or modify 1167332fb9Smrg# it under the terms of the GNU General Public License as published by 1267332fb9Smrg# the Free Software Foundation; either version 2, or (at your option) 1367332fb9Smrg# any later version. 1467332fb9Smrg 1567332fb9Smrg# This program is distributed in the hope that it will be useful, 1667332fb9Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1767332fb9Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1867332fb9Smrg# GNU General Public License for more details. 1967332fb9Smrg 2067332fb9Smrg# You should have received a copy of the GNU General Public License 21eed6fe1cSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2267332fb9Smrg 2367332fb9Smrg# As a special exception to the GNU General Public License, if you 2467332fb9Smrg# distribute this file as part of a program that contains a 2567332fb9Smrg# configuration script generated by Autoconf, you may include it under 2667332fb9Smrg# the same distribution terms that you use for the rest of that program. 2767332fb9Smrg 2867332fb9Smrgif test $# -eq 0; then 2967332fb9Smrg echo 1>&2 "Try \`$0 --help' for more information" 3067332fb9Smrg exit 1 3167332fb9Smrgfi 3267332fb9Smrg 3367332fb9Smrgrun=: 34eed6fe1cSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35eed6fe1cSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3667332fb9Smrg 3767332fb9Smrg# In the cases where this matters, `missing' is being run in the 3867332fb9Smrg# srcdir already. 3967332fb9Smrgif test -f configure.ac; then 4067332fb9Smrg configure_ac=configure.ac 4167332fb9Smrgelse 4267332fb9Smrg configure_ac=configure.in 4367332fb9Smrgfi 4467332fb9Smrg 45eed6fe1cSmrgmsg="missing on your system" 46eed6fe1cSmrg 47eed6fe1cSmrgcase $1 in 4867332fb9Smrg--run) 4967332fb9Smrg # Try to run requested program, and just exit if it succeeds. 5067332fb9Smrg run= 5167332fb9Smrg shift 5267332fb9Smrg "$@" && exit 0 53eed6fe1cSmrg # Exit code 63 means version mismatch. This often happens 54eed6fe1cSmrg # when the user try to use an ancient version of a tool on 55eed6fe1cSmrg # a file that requires a minimum version. In this case we 56eed6fe1cSmrg # we should proceed has if the program had been absent, or 57eed6fe1cSmrg # if --run hadn't been passed. 58eed6fe1cSmrg if test $? = 63; then 59eed6fe1cSmrg run=: 60eed6fe1cSmrg msg="probably too old" 61eed6fe1cSmrg fi 6267332fb9Smrg ;; 6367332fb9Smrg 6467332fb9Smrg -h|--h|--he|--hel|--help) 6567332fb9Smrg echo "\ 6667332fb9Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6767332fb9Smrg 6867332fb9SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6967332fb9Smrgerror status if there is no known handling for PROGRAM. 7067332fb9Smrg 7167332fb9SmrgOptions: 7267332fb9Smrg -h, --help display this help and exit 7367332fb9Smrg -v, --version output version information and exit 7467332fb9Smrg --run try to run the given command, and emulate it if it fails 7567332fb9Smrg 7667332fb9SmrgSupported PROGRAM values: 7767332fb9Smrg aclocal touch file \`aclocal.m4' 7867332fb9Smrg autoconf touch file \`configure' 7967332fb9Smrg autoheader touch file \`config.h.in' 80eed6fe1cSmrg autom4te touch the output file, or create a stub one 8167332fb9Smrg automake touch all \`Makefile.in' files 8267332fb9Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8367332fb9Smrg flex create \`lex.yy.c', if possible, from existing .c 8467332fb9Smrg help2man touch the output file 8567332fb9Smrg lex create \`lex.yy.c', if possible, from existing .c 8667332fb9Smrg makeinfo touch the output file 8767332fb9Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88eed6fe1cSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89eed6fe1cSmrg 90eed6fe1cSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91eed6fe1cSmrg\`g' are ignored when checking the name. 92eed6fe1cSmrg 93eed6fe1cSmrgSend bug reports to <bug-automake@gnu.org>." 94eed6fe1cSmrg exit $? 9567332fb9Smrg ;; 9667332fb9Smrg 9767332fb9Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98eed6fe1cSmrg echo "missing $scriptversion (GNU Automake)" 99eed6fe1cSmrg exit $? 10067332fb9Smrg ;; 10167332fb9Smrg 10267332fb9Smrg -*) 10367332fb9Smrg echo 1>&2 "$0: Unknown \`$1' option" 10467332fb9Smrg echo 1>&2 "Try \`$0 --help' for more information" 10567332fb9Smrg exit 1 10667332fb9Smrg ;; 10767332fb9Smrg 108eed6fe1cSmrgesac 109eed6fe1cSmrg 110eed6fe1cSmrg# normalize program name to check for. 111eed6fe1cSmrgprogram=`echo "$1" | sed ' 112eed6fe1cSmrg s/^gnu-//; t 113eed6fe1cSmrg s/^gnu//; t 114eed6fe1cSmrg s/^g//; t'` 115eed6fe1cSmrg 116eed6fe1cSmrg# Now exit if we have it, but it failed. Also exit now if we 117eed6fe1cSmrg# don't have it and --version was passed (most likely to detect 118eed6fe1cSmrg# the program). This is about non-GNU programs, so use $1 not 119eed6fe1cSmrg# $program. 120eed6fe1cSmrgcase $1 in 121eed6fe1cSmrg lex*|yacc*) 122eed6fe1cSmrg # Not GNU programs, they don't have --version. 123eed6fe1cSmrg ;; 124eed6fe1cSmrg 125eed6fe1cSmrg tar*) 126eed6fe1cSmrg if test -n "$run"; then 127eed6fe1cSmrg echo 1>&2 "ERROR: \`tar' requires --run" 128eed6fe1cSmrg exit 1 129eed6fe1cSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130eed6fe1cSmrg exit 1 131eed6fe1cSmrg fi 132eed6fe1cSmrg ;; 133eed6fe1cSmrg 134eed6fe1cSmrg *) 13567332fb9Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13667332fb9Smrg # We have it, but it failed. 13767332fb9Smrg exit 1 138eed6fe1cSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139eed6fe1cSmrg # Could not run --version or --help. This is probably someone 140eed6fe1cSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 141eed6fe1cSmrg # $TOOL exists and not knowing $TOOL uses missing. 142eed6fe1cSmrg exit 1 14367332fb9Smrg fi 144eed6fe1cSmrg ;; 145eed6fe1cSmrgesac 14667332fb9Smrg 147eed6fe1cSmrg# If it does not exist, or fails to run (possibly an outdated version), 148eed6fe1cSmrg# try to emulate it. 149eed6fe1cSmrgcase $program in 150eed6fe1cSmrg aclocal*) 15167332fb9Smrg echo 1>&2 "\ 152eed6fe1cSmrgWARNING: \`$1' is $msg. You should only need it if 15367332fb9Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15467332fb9Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15567332fb9Smrg any GNU archive site." 15667332fb9Smrg touch aclocal.m4 15767332fb9Smrg ;; 15867332fb9Smrg 159eed6fe1cSmrg autoconf*) 16067332fb9Smrg echo 1>&2 "\ 161eed6fe1cSmrgWARNING: \`$1' is $msg. You should only need it if 16267332fb9Smrg you modified \`${configure_ac}'. You might want to install the 16367332fb9Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16467332fb9Smrg archive site." 16567332fb9Smrg touch configure 16667332fb9Smrg ;; 16767332fb9Smrg 168eed6fe1cSmrg autoheader*) 16967332fb9Smrg echo 1>&2 "\ 170eed6fe1cSmrgWARNING: \`$1' is $msg. You should only need it if 17167332fb9Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17267332fb9Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17367332fb9Smrg from any GNU archive site." 17467332fb9Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17567332fb9Smrg test -z "$files" && files="config.h" 17667332fb9Smrg touch_files= 17767332fb9Smrg for f in $files; do 178eed6fe1cSmrg case $f in 17967332fb9Smrg *:*) touch_files="$touch_files "`echo "$f" | 18067332fb9Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18167332fb9Smrg *) touch_files="$touch_files $f.in";; 18267332fb9Smrg esac 18367332fb9Smrg done 18467332fb9Smrg touch $touch_files 18567332fb9Smrg ;; 18667332fb9Smrg 18767332fb9Smrg automake*) 18867332fb9Smrg echo 1>&2 "\ 189eed6fe1cSmrgWARNING: \`$1' is $msg. You should only need it if 19067332fb9Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19167332fb9Smrg You might want to install the \`Automake' and \`Perl' packages. 19267332fb9Smrg Grab them from any GNU archive site." 19367332fb9Smrg find . -type f -name Makefile.am -print | 19467332fb9Smrg sed 's/\.am$/.in/' | 19567332fb9Smrg while read f; do touch "$f"; done 19667332fb9Smrg ;; 19767332fb9Smrg 198eed6fe1cSmrg autom4te*) 19967332fb9Smrg echo 1>&2 "\ 200eed6fe1cSmrgWARNING: \`$1' is needed, but is $msg. 201eed6fe1cSmrg You might have modified some files without having the 20267332fb9Smrg proper tools for further handling them. 20367332fb9Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20467332fb9Smrg archive site." 20567332fb9Smrg 206eed6fe1cSmrg file=`echo "$*" | sed -n "$sed_output"` 207eed6fe1cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20867332fb9Smrg if test -f "$file"; then 20967332fb9Smrg touch $file 21067332fb9Smrg else 21167332fb9Smrg test -z "$file" || exec >$file 21267332fb9Smrg echo "#! /bin/sh" 21367332fb9Smrg echo "# Created by GNU Automake missing as a replacement of" 21467332fb9Smrg echo "# $ $@" 21567332fb9Smrg echo "exit 0" 21667332fb9Smrg chmod +x $file 21767332fb9Smrg exit 1 21867332fb9Smrg fi 21967332fb9Smrg ;; 22067332fb9Smrg 221eed6fe1cSmrg bison*|yacc*) 22267332fb9Smrg echo 1>&2 "\ 223eed6fe1cSmrgWARNING: \`$1' $msg. You should only need it if 22467332fb9Smrg you modified a \`.y' file. You may need the \`Bison' package 22567332fb9Smrg in order for those modifications to take effect. You can get 22667332fb9Smrg \`Bison' from any GNU archive site." 22767332fb9Smrg rm -f y.tab.c y.tab.h 228eed6fe1cSmrg if test $# -ne 1; then 22967332fb9Smrg eval LASTARG="\${$#}" 230eed6fe1cSmrg case $LASTARG in 23167332fb9Smrg *.y) 23267332fb9Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233eed6fe1cSmrg if test -f "$SRCFILE"; then 23467332fb9Smrg cp "$SRCFILE" y.tab.c 23567332fb9Smrg fi 23667332fb9Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237eed6fe1cSmrg if test -f "$SRCFILE"; then 23867332fb9Smrg cp "$SRCFILE" y.tab.h 23967332fb9Smrg fi 24067332fb9Smrg ;; 24167332fb9Smrg esac 24267332fb9Smrg fi 243eed6fe1cSmrg if test ! -f y.tab.h; then 24467332fb9Smrg echo >y.tab.h 24567332fb9Smrg fi 246eed6fe1cSmrg if test ! -f y.tab.c; then 24767332fb9Smrg echo 'main() { return 0; }' >y.tab.c 24867332fb9Smrg fi 24967332fb9Smrg ;; 25067332fb9Smrg 251eed6fe1cSmrg lex*|flex*) 25267332fb9Smrg echo 1>&2 "\ 253eed6fe1cSmrgWARNING: \`$1' is $msg. You should only need it if 25467332fb9Smrg you modified a \`.l' file. You may need the \`Flex' package 25567332fb9Smrg in order for those modifications to take effect. You can get 25667332fb9Smrg \`Flex' from any GNU archive site." 25767332fb9Smrg rm -f lex.yy.c 258eed6fe1cSmrg if test $# -ne 1; then 25967332fb9Smrg eval LASTARG="\${$#}" 260eed6fe1cSmrg case $LASTARG in 26167332fb9Smrg *.l) 26267332fb9Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263eed6fe1cSmrg if test -f "$SRCFILE"; then 26467332fb9Smrg cp "$SRCFILE" lex.yy.c 26567332fb9Smrg fi 26667332fb9Smrg ;; 26767332fb9Smrg esac 26867332fb9Smrg fi 269eed6fe1cSmrg if test ! -f lex.yy.c; then 27067332fb9Smrg echo 'main() { return 0; }' >lex.yy.c 27167332fb9Smrg fi 27267332fb9Smrg ;; 27367332fb9Smrg 274eed6fe1cSmrg help2man*) 27567332fb9Smrg echo 1>&2 "\ 276eed6fe1cSmrgWARNING: \`$1' is $msg. You should only need it if 27767332fb9Smrg you modified a dependency of a manual page. You may need the 27867332fb9Smrg \`Help2man' package in order for those modifications to take 27967332fb9Smrg effect. You can get \`Help2man' from any GNU archive site." 28067332fb9Smrg 281eed6fe1cSmrg file=`echo "$*" | sed -n "$sed_output"` 282eed6fe1cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283eed6fe1cSmrg if test -f "$file"; then 28467332fb9Smrg touch $file 28567332fb9Smrg else 28667332fb9Smrg test -z "$file" || exec >$file 28767332fb9Smrg echo ".ab help2man is required to generate this page" 288eed6fe1cSmrg exit $? 28967332fb9Smrg fi 29067332fb9Smrg ;; 29167332fb9Smrg 292eed6fe1cSmrg makeinfo*) 29367332fb9Smrg echo 1>&2 "\ 294eed6fe1cSmrgWARNING: \`$1' is $msg. You should only need it if 29567332fb9Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29667332fb9Smrg indirectly affecting the aspect of the manual. The spurious 29767332fb9Smrg call might also be the consequence of using a buggy \`make' (AIX, 29867332fb9Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29967332fb9Smrg the \`GNU make' package. Grab either from any GNU archive site." 300eed6fe1cSmrg # The file to touch is that specified with -o ... 301eed6fe1cSmrg file=`echo "$*" | sed -n "$sed_output"` 302eed6fe1cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30367332fb9Smrg if test -z "$file"; then 304eed6fe1cSmrg # ... or it is the one specified with @setfilename ... 305eed6fe1cSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306eed6fe1cSmrg file=`sed -n ' 307eed6fe1cSmrg /^@setfilename/{ 308eed6fe1cSmrg s/.* \([^ ]*\) *$/\1/ 309eed6fe1cSmrg p 310eed6fe1cSmrg q 311eed6fe1cSmrg }' $infile` 312eed6fe1cSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313eed6fe1cSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31467332fb9Smrg fi 315eed6fe1cSmrg # If the file does not exist, the user really needs makeinfo; 316eed6fe1cSmrg # let's fail without touching anything. 317eed6fe1cSmrg test -f $file || exit 1 31867332fb9Smrg touch $file 31967332fb9Smrg ;; 32067332fb9Smrg 321eed6fe1cSmrg tar*) 32267332fb9Smrg shift 32367332fb9Smrg 32467332fb9Smrg # We have already tried tar in the generic part. 32567332fb9Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32667332fb9Smrg # messages. 32767332fb9Smrg if (gnutar --version > /dev/null 2>&1); then 32867332fb9Smrg gnutar "$@" && exit 0 32967332fb9Smrg fi 33067332fb9Smrg if (gtar --version > /dev/null 2>&1); then 33167332fb9Smrg gtar "$@" && exit 0 33267332fb9Smrg fi 33367332fb9Smrg firstarg="$1" 33467332fb9Smrg if shift; then 335eed6fe1cSmrg case $firstarg in 33667332fb9Smrg *o*) 33767332fb9Smrg firstarg=`echo "$firstarg" | sed s/o//` 33867332fb9Smrg tar "$firstarg" "$@" && exit 0 33967332fb9Smrg ;; 34067332fb9Smrg esac 341eed6fe1cSmrg case $firstarg in 34267332fb9Smrg *h*) 34367332fb9Smrg firstarg=`echo "$firstarg" | sed s/h//` 34467332fb9Smrg tar "$firstarg" "$@" && exit 0 34567332fb9Smrg ;; 34667332fb9Smrg esac 34767332fb9Smrg fi 34867332fb9Smrg 34967332fb9Smrg echo 1>&2 "\ 35067332fb9SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35167332fb9Smrg You may want to install GNU tar or Free paxutils, or check the 35267332fb9Smrg command line arguments." 35367332fb9Smrg exit 1 35467332fb9Smrg ;; 35567332fb9Smrg 35667332fb9Smrg *) 35767332fb9Smrg echo 1>&2 "\ 358eed6fe1cSmrgWARNING: \`$1' is needed, and is $msg. 359eed6fe1cSmrg You might have modified some files without having the 36067332fb9Smrg proper tools for further handling them. Check the \`README' file, 36167332fb9Smrg it often tells you about the needed prerequisites for installing 36267332fb9Smrg this package. You may also peek at any GNU archive site, in case 36367332fb9Smrg some other package would contain this missing \`$1' program." 36467332fb9Smrg exit 1 36567332fb9Smrg ;; 36667332fb9Smrgesac 36767332fb9Smrg 36867332fb9Smrgexit 0 369eed6fe1cSmrg 370eed6fe1cSmrg# Local variables: 371eed6fe1cSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372eed6fe1cSmrg# time-stamp-start: "scriptversion=" 373eed6fe1cSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374eed6fe1cSmrg# time-stamp-time-zone: "UTC" 375eed6fe1cSmrg# time-stamp-end: "; # UTC" 376eed6fe1cSmrg# End: 377