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