missing revision fffe5102
167f05d30Smrg#! /bin/sh 267f05d30Smrg# Common stub for a few missing GNU programs while installing. 3fffe5102Smrg 4fffe5102Smrgscriptversion=2009-04-28.21; # UTC 5fffe5102Smrg 6fffe5102Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7fffe5102Smrg# 2008, 2009 Free Software Foundation, Inc. 867f05d30Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 967f05d30Smrg 1067f05d30Smrg# This program is free software; you can redistribute it and/or modify 1167f05d30Smrg# it under the terms of the GNU General Public License as published by 1267f05d30Smrg# the Free Software Foundation; either version 2, or (at your option) 1367f05d30Smrg# any later version. 1467f05d30Smrg 1567f05d30Smrg# This program is distributed in the hope that it will be useful, 1667f05d30Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1767f05d30Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1867f05d30Smrg# GNU General Public License for more details. 1967f05d30Smrg 2067f05d30Smrg# You should have received a copy of the GNU General Public License 21fffe5102Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2267f05d30Smrg 2367f05d30Smrg# As a special exception to the GNU General Public License, if you 2467f05d30Smrg# distribute this file as part of a program that contains a 2567f05d30Smrg# configuration script generated by Autoconf, you may include it under 2667f05d30Smrg# the same distribution terms that you use for the rest of that program. 2767f05d30Smrg 2867f05d30Smrgif test $# -eq 0; then 2967f05d30Smrg echo 1>&2 "Try \`$0 --help' for more information" 3067f05d30Smrg exit 1 3167f05d30Smrgfi 3267f05d30Smrg 3367f05d30Smrgrun=: 34fffe5102Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35fffe5102Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 3667f05d30Smrg 3767f05d30Smrg# In the cases where this matters, `missing' is being run in the 3867f05d30Smrg# srcdir already. 3967f05d30Smrgif test -f configure.ac; then 4067f05d30Smrg configure_ac=configure.ac 4167f05d30Smrgelse 4267f05d30Smrg configure_ac=configure.in 4367f05d30Smrgfi 4467f05d30Smrg 45fffe5102Smrgmsg="missing on your system" 46fffe5102Smrg 47fffe5102Smrgcase $1 in 4867f05d30Smrg--run) 4967f05d30Smrg # Try to run requested program, and just exit if it succeeds. 5067f05d30Smrg run= 5167f05d30Smrg shift 5267f05d30Smrg "$@" && exit 0 53fffe5102Smrg # Exit code 63 means version mismatch. This often happens 54fffe5102Smrg # when the user try to use an ancient version of a tool on 55fffe5102Smrg # a file that requires a minimum version. In this case we 56fffe5102Smrg # we should proceed has if the program had been absent, or 57fffe5102Smrg # if --run hadn't been passed. 58fffe5102Smrg if test $? = 63; then 59fffe5102Smrg run=: 60fffe5102Smrg msg="probably too old" 61fffe5102Smrg fi 6267f05d30Smrg ;; 6367f05d30Smrg 6467f05d30Smrg -h|--h|--he|--hel|--help) 6567f05d30Smrg echo "\ 6667f05d30Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 6767f05d30Smrg 6867f05d30SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 6967f05d30Smrgerror status if there is no known handling for PROGRAM. 7067f05d30Smrg 7167f05d30SmrgOptions: 7267f05d30Smrg -h, --help display this help and exit 7367f05d30Smrg -v, --version output version information and exit 7467f05d30Smrg --run try to run the given command, and emulate it if it fails 7567f05d30Smrg 7667f05d30SmrgSupported PROGRAM values: 7767f05d30Smrg aclocal touch file \`aclocal.m4' 7867f05d30Smrg autoconf touch file \`configure' 7967f05d30Smrg autoheader touch file \`config.h.in' 80fffe5102Smrg autom4te touch the output file, or create a stub one 8167f05d30Smrg automake touch all \`Makefile.in' files 8267f05d30Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 8367f05d30Smrg flex create \`lex.yy.c', if possible, from existing .c 8467f05d30Smrg help2man touch the output file 8567f05d30Smrg lex create \`lex.yy.c', if possible, from existing .c 8667f05d30Smrg makeinfo touch the output file 8767f05d30Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88fffe5102Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89fffe5102Smrg 90fffe5102SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91fffe5102Smrg\`g' are ignored when checking the name. 92fffe5102Smrg 93fffe5102SmrgSend bug reports to <bug-automake@gnu.org>." 94fffe5102Smrg exit $? 9567f05d30Smrg ;; 9667f05d30Smrg 9767f05d30Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98fffe5102Smrg echo "missing $scriptversion (GNU Automake)" 99fffe5102Smrg exit $? 10067f05d30Smrg ;; 10167f05d30Smrg 10267f05d30Smrg -*) 10367f05d30Smrg echo 1>&2 "$0: Unknown \`$1' option" 10467f05d30Smrg echo 1>&2 "Try \`$0 --help' for more information" 10567f05d30Smrg exit 1 10667f05d30Smrg ;; 10767f05d30Smrg 108fffe5102Smrgesac 109fffe5102Smrg 110fffe5102Smrg# normalize program name to check for. 111fffe5102Smrgprogram=`echo "$1" | sed ' 112fffe5102Smrg s/^gnu-//; t 113fffe5102Smrg s/^gnu//; t 114fffe5102Smrg s/^g//; t'` 115fffe5102Smrg 116fffe5102Smrg# Now exit if we have it, but it failed. Also exit now if we 117fffe5102Smrg# don't have it and --version was passed (most likely to detect 118fffe5102Smrg# the program). This is about non-GNU programs, so use $1 not 119fffe5102Smrg# $program. 120fffe5102Smrgcase $1 in 121fffe5102Smrg lex*|yacc*) 122fffe5102Smrg # Not GNU programs, they don't have --version. 123fffe5102Smrg ;; 124fffe5102Smrg 125fffe5102Smrg tar*) 126fffe5102Smrg if test -n "$run"; then 127fffe5102Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128fffe5102Smrg exit 1 129fffe5102Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130fffe5102Smrg exit 1 131fffe5102Smrg fi 132fffe5102Smrg ;; 133fffe5102Smrg 134fffe5102Smrg *) 13567f05d30Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 13667f05d30Smrg # We have it, but it failed. 13767f05d30Smrg exit 1 138fffe5102Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139fffe5102Smrg # Could not run --version or --help. This is probably someone 140fffe5102Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141fffe5102Smrg # $TOOL exists and not knowing $TOOL uses missing. 142fffe5102Smrg exit 1 14367f05d30Smrg fi 144fffe5102Smrg ;; 145fffe5102Smrgesac 14667f05d30Smrg 147fffe5102Smrg# If it does not exist, or fails to run (possibly an outdated version), 148fffe5102Smrg# try to emulate it. 149fffe5102Smrgcase $program in 150fffe5102Smrg aclocal*) 15167f05d30Smrg echo 1>&2 "\ 152fffe5102SmrgWARNING: \`$1' is $msg. You should only need it if 15367f05d30Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 15467f05d30Smrg to install the \`Automake' and \`Perl' packages. Grab them from 15567f05d30Smrg any GNU archive site." 15667f05d30Smrg touch aclocal.m4 15767f05d30Smrg ;; 15867f05d30Smrg 159fffe5102Smrg autoconf*) 16067f05d30Smrg echo 1>&2 "\ 161fffe5102SmrgWARNING: \`$1' is $msg. You should only need it if 16267f05d30Smrg you modified \`${configure_ac}'. You might want to install the 16367f05d30Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 16467f05d30Smrg archive site." 16567f05d30Smrg touch configure 16667f05d30Smrg ;; 16767f05d30Smrg 168fffe5102Smrg autoheader*) 16967f05d30Smrg echo 1>&2 "\ 170fffe5102SmrgWARNING: \`$1' is $msg. You should only need it if 17167f05d30Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 17267f05d30Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 17367f05d30Smrg from any GNU archive site." 17467f05d30Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 17567f05d30Smrg test -z "$files" && files="config.h" 17667f05d30Smrg touch_files= 17767f05d30Smrg for f in $files; do 178fffe5102Smrg case $f in 17967f05d30Smrg *:*) touch_files="$touch_files "`echo "$f" | 18067f05d30Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 18167f05d30Smrg *) touch_files="$touch_files $f.in";; 18267f05d30Smrg esac 18367f05d30Smrg done 18467f05d30Smrg touch $touch_files 18567f05d30Smrg ;; 18667f05d30Smrg 18767f05d30Smrg automake*) 18867f05d30Smrg echo 1>&2 "\ 189fffe5102SmrgWARNING: \`$1' is $msg. You should only need it if 19067f05d30Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 19167f05d30Smrg You might want to install the \`Automake' and \`Perl' packages. 19267f05d30Smrg Grab them from any GNU archive site." 19367f05d30Smrg find . -type f -name Makefile.am -print | 19467f05d30Smrg sed 's/\.am$/.in/' | 19567f05d30Smrg while read f; do touch "$f"; done 19667f05d30Smrg ;; 19767f05d30Smrg 198fffe5102Smrg autom4te*) 19967f05d30Smrg echo 1>&2 "\ 200fffe5102SmrgWARNING: \`$1' is needed, but is $msg. 201fffe5102Smrg You might have modified some files without having the 20267f05d30Smrg proper tools for further handling them. 20367f05d30Smrg You can get \`$1' as part of \`Autoconf' from any GNU 20467f05d30Smrg archive site." 20567f05d30Smrg 206fffe5102Smrg file=`echo "$*" | sed -n "$sed_output"` 207fffe5102Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 20867f05d30Smrg if test -f "$file"; then 20967f05d30Smrg touch $file 21067f05d30Smrg else 21167f05d30Smrg test -z "$file" || exec >$file 21267f05d30Smrg echo "#! /bin/sh" 21367f05d30Smrg echo "# Created by GNU Automake missing as a replacement of" 21467f05d30Smrg echo "# $ $@" 21567f05d30Smrg echo "exit 0" 21667f05d30Smrg chmod +x $file 21767f05d30Smrg exit 1 21867f05d30Smrg fi 21967f05d30Smrg ;; 22067f05d30Smrg 221fffe5102Smrg bison*|yacc*) 22267f05d30Smrg echo 1>&2 "\ 223fffe5102SmrgWARNING: \`$1' $msg. You should only need it if 22467f05d30Smrg you modified a \`.y' file. You may need the \`Bison' package 22567f05d30Smrg in order for those modifications to take effect. You can get 22667f05d30Smrg \`Bison' from any GNU archive site." 22767f05d30Smrg rm -f y.tab.c y.tab.h 228fffe5102Smrg if test $# -ne 1; then 22967f05d30Smrg eval LASTARG="\${$#}" 230fffe5102Smrg case $LASTARG in 23167f05d30Smrg *.y) 23267f05d30Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233fffe5102Smrg if test -f "$SRCFILE"; then 23467f05d30Smrg cp "$SRCFILE" y.tab.c 23567f05d30Smrg fi 23667f05d30Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237fffe5102Smrg if test -f "$SRCFILE"; then 23867f05d30Smrg cp "$SRCFILE" y.tab.h 23967f05d30Smrg fi 24067f05d30Smrg ;; 24167f05d30Smrg esac 24267f05d30Smrg fi 243fffe5102Smrg if test ! -f y.tab.h; then 24467f05d30Smrg echo >y.tab.h 24567f05d30Smrg fi 246fffe5102Smrg if test ! -f y.tab.c; then 24767f05d30Smrg echo 'main() { return 0; }' >y.tab.c 24867f05d30Smrg fi 24967f05d30Smrg ;; 25067f05d30Smrg 251fffe5102Smrg lex*|flex*) 25267f05d30Smrg echo 1>&2 "\ 253fffe5102SmrgWARNING: \`$1' is $msg. You should only need it if 25467f05d30Smrg you modified a \`.l' file. You may need the \`Flex' package 25567f05d30Smrg in order for those modifications to take effect. You can get 25667f05d30Smrg \`Flex' from any GNU archive site." 25767f05d30Smrg rm -f lex.yy.c 258fffe5102Smrg if test $# -ne 1; then 25967f05d30Smrg eval LASTARG="\${$#}" 260fffe5102Smrg case $LASTARG in 26167f05d30Smrg *.l) 26267f05d30Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263fffe5102Smrg if test -f "$SRCFILE"; then 26467f05d30Smrg cp "$SRCFILE" lex.yy.c 26567f05d30Smrg fi 26667f05d30Smrg ;; 26767f05d30Smrg esac 26867f05d30Smrg fi 269fffe5102Smrg if test ! -f lex.yy.c; then 27067f05d30Smrg echo 'main() { return 0; }' >lex.yy.c 27167f05d30Smrg fi 27267f05d30Smrg ;; 27367f05d30Smrg 274fffe5102Smrg help2man*) 27567f05d30Smrg echo 1>&2 "\ 276fffe5102SmrgWARNING: \`$1' is $msg. You should only need it if 27767f05d30Smrg you modified a dependency of a manual page. You may need the 27867f05d30Smrg \`Help2man' package in order for those modifications to take 27967f05d30Smrg effect. You can get \`Help2man' from any GNU archive site." 28067f05d30Smrg 281fffe5102Smrg file=`echo "$*" | sed -n "$sed_output"` 282fffe5102Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283fffe5102Smrg if test -f "$file"; then 28467f05d30Smrg touch $file 28567f05d30Smrg else 28667f05d30Smrg test -z "$file" || exec >$file 28767f05d30Smrg echo ".ab help2man is required to generate this page" 288fffe5102Smrg exit $? 28967f05d30Smrg fi 29067f05d30Smrg ;; 29167f05d30Smrg 292fffe5102Smrg makeinfo*) 29367f05d30Smrg echo 1>&2 "\ 294fffe5102SmrgWARNING: \`$1' is $msg. You should only need it if 29567f05d30Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 29667f05d30Smrg indirectly affecting the aspect of the manual. The spurious 29767f05d30Smrg call might also be the consequence of using a buggy \`make' (AIX, 29867f05d30Smrg DU, IRIX). You might want to install the \`Texinfo' package or 29967f05d30Smrg the \`GNU make' package. Grab either from any GNU archive site." 300fffe5102Smrg # The file to touch is that specified with -o ... 301fffe5102Smrg file=`echo "$*" | sed -n "$sed_output"` 302fffe5102Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 30367f05d30Smrg if test -z "$file"; then 304fffe5102Smrg # ... or it is the one specified with @setfilename ... 305fffe5102Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306fffe5102Smrg file=`sed -n ' 307fffe5102Smrg /^@setfilename/{ 308fffe5102Smrg s/.* \([^ ]*\) *$/\1/ 309fffe5102Smrg p 310fffe5102Smrg q 311fffe5102Smrg }' $infile` 312fffe5102Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313fffe5102Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 31467f05d30Smrg fi 315fffe5102Smrg # If the file does not exist, the user really needs makeinfo; 316fffe5102Smrg # let's fail without touching anything. 317fffe5102Smrg test -f $file || exit 1 31867f05d30Smrg touch $file 31967f05d30Smrg ;; 32067f05d30Smrg 321fffe5102Smrg tar*) 32267f05d30Smrg shift 32367f05d30Smrg 32467f05d30Smrg # We have already tried tar in the generic part. 32567f05d30Smrg # Look for gnutar/gtar before invocation to avoid ugly error 32667f05d30Smrg # messages. 32767f05d30Smrg if (gnutar --version > /dev/null 2>&1); then 32867f05d30Smrg gnutar "$@" && exit 0 32967f05d30Smrg fi 33067f05d30Smrg if (gtar --version > /dev/null 2>&1); then 33167f05d30Smrg gtar "$@" && exit 0 33267f05d30Smrg fi 33367f05d30Smrg firstarg="$1" 33467f05d30Smrg if shift; then 335fffe5102Smrg case $firstarg in 33667f05d30Smrg *o*) 33767f05d30Smrg firstarg=`echo "$firstarg" | sed s/o//` 33867f05d30Smrg tar "$firstarg" "$@" && exit 0 33967f05d30Smrg ;; 34067f05d30Smrg esac 341fffe5102Smrg case $firstarg in 34267f05d30Smrg *h*) 34367f05d30Smrg firstarg=`echo "$firstarg" | sed s/h//` 34467f05d30Smrg tar "$firstarg" "$@" && exit 0 34567f05d30Smrg ;; 34667f05d30Smrg esac 34767f05d30Smrg fi 34867f05d30Smrg 34967f05d30Smrg echo 1>&2 "\ 35067f05d30SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 35167f05d30Smrg You may want to install GNU tar or Free paxutils, or check the 35267f05d30Smrg command line arguments." 35367f05d30Smrg exit 1 35467f05d30Smrg ;; 35567f05d30Smrg 35667f05d30Smrg *) 35767f05d30Smrg echo 1>&2 "\ 358fffe5102SmrgWARNING: \`$1' is needed, and is $msg. 359fffe5102Smrg You might have modified some files without having the 36067f05d30Smrg proper tools for further handling them. Check the \`README' file, 36167f05d30Smrg it often tells you about the needed prerequisites for installing 36267f05d30Smrg this package. You may also peek at any GNU archive site, in case 36367f05d30Smrg some other package would contain this missing \`$1' program." 36467f05d30Smrg exit 1 36567f05d30Smrg ;; 36667f05d30Smrgesac 36767f05d30Smrg 36867f05d30Smrgexit 0 369fffe5102Smrg 370fffe5102Smrg# Local variables: 371fffe5102Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372fffe5102Smrg# time-stamp-start: "scriptversion=" 373fffe5102Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374fffe5102Smrg# time-stamp-time-zone: "UTC" 375fffe5102Smrg# time-stamp-end: "; # UTC" 376fffe5102Smrg# End: 377