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