missing revision ef981d24
1ef981d24Smrg#! /bin/sh 2ef981d24Smrg# Common stub for a few missing GNU programs while installing. 3ef981d24Smrg 4ef981d24Smrgscriptversion=2006-05-10.23 5ef981d24Smrg 6ef981d24Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 7ef981d24Smrg# Free Software Foundation, Inc. 8ef981d24Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9ef981d24Smrg 10ef981d24Smrg# This program is free software; you can redistribute it and/or modify 11ef981d24Smrg# it under the terms of the GNU General Public License as published by 12ef981d24Smrg# the Free Software Foundation; either version 2, or (at your option) 13ef981d24Smrg# any later version. 14ef981d24Smrg 15ef981d24Smrg# This program is distributed in the hope that it will be useful, 16ef981d24Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17ef981d24Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18ef981d24Smrg# GNU General Public License for more details. 19ef981d24Smrg 20ef981d24Smrg# You should have received a copy of the GNU General Public License 21ef981d24Smrg# along with this program; if not, write to the Free Software 22ef981d24Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23ef981d24Smrg# 02110-1301, USA. 24ef981d24Smrg 25ef981d24Smrg# As a special exception to the GNU General Public License, if you 26ef981d24Smrg# distribute this file as part of a program that contains a 27ef981d24Smrg# configuration script generated by Autoconf, you may include it under 28ef981d24Smrg# the same distribution terms that you use for the rest of that program. 29ef981d24Smrg 30ef981d24Smrgif test $# -eq 0; then 31ef981d24Smrg echo 1>&2 "Try \`$0 --help' for more information" 32ef981d24Smrg exit 1 33ef981d24Smrgfi 34ef981d24Smrg 35ef981d24Smrgrun=: 36ef981d24Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 37ef981d24Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 38ef981d24Smrg 39ef981d24Smrg# In the cases where this matters, `missing' is being run in the 40ef981d24Smrg# srcdir already. 41ef981d24Smrgif test -f configure.ac; then 42ef981d24Smrg configure_ac=configure.ac 43ef981d24Smrgelse 44ef981d24Smrg configure_ac=configure.in 45ef981d24Smrgfi 46ef981d24Smrg 47ef981d24Smrgmsg="missing on your system" 48ef981d24Smrg 49ef981d24Smrgcase $1 in 50ef981d24Smrg--run) 51ef981d24Smrg # Try to run requested program, and just exit if it succeeds. 52ef981d24Smrg run= 53ef981d24Smrg shift 54ef981d24Smrg "$@" && exit 0 55ef981d24Smrg # Exit code 63 means version mismatch. This often happens 56ef981d24Smrg # when the user try to use an ancient version of a tool on 57ef981d24Smrg # a file that requires a minimum version. In this case we 58ef981d24Smrg # we should proceed has if the program had been absent, or 59ef981d24Smrg # if --run hadn't been passed. 60ef981d24Smrg if test $? = 63; then 61ef981d24Smrg run=: 62ef981d24Smrg msg="probably too old" 63ef981d24Smrg fi 64ef981d24Smrg ;; 65ef981d24Smrg 66ef981d24Smrg -h|--h|--he|--hel|--help) 67ef981d24Smrg echo "\ 68ef981d24Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 69ef981d24Smrg 70ef981d24SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 71ef981d24Smrgerror status if there is no known handling for PROGRAM. 72ef981d24Smrg 73ef981d24SmrgOptions: 74ef981d24Smrg -h, --help display this help and exit 75ef981d24Smrg -v, --version output version information and exit 76ef981d24Smrg --run try to run the given command, and emulate it if it fails 77ef981d24Smrg 78ef981d24SmrgSupported PROGRAM values: 79ef981d24Smrg aclocal touch file \`aclocal.m4' 80ef981d24Smrg autoconf touch file \`configure' 81ef981d24Smrg autoheader touch file \`config.h.in' 82ef981d24Smrg autom4te touch the output file, or create a stub one 83ef981d24Smrg automake touch all \`Makefile.in' files 84ef981d24Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 85ef981d24Smrg flex create \`lex.yy.c', if possible, from existing .c 86ef981d24Smrg help2man touch the output file 87ef981d24Smrg lex create \`lex.yy.c', if possible, from existing .c 88ef981d24Smrg makeinfo touch the output file 89ef981d24Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 90ef981d24Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 91ef981d24Smrg 92ef981d24SmrgSend bug reports to <bug-automake@gnu.org>." 93ef981d24Smrg exit $? 94ef981d24Smrg ;; 95ef981d24Smrg 96ef981d24Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97ef981d24Smrg echo "missing $scriptversion (GNU Automake)" 98ef981d24Smrg exit $? 99ef981d24Smrg ;; 100ef981d24Smrg 101ef981d24Smrg -*) 102ef981d24Smrg echo 1>&2 "$0: Unknown \`$1' option" 103ef981d24Smrg echo 1>&2 "Try \`$0 --help' for more information" 104ef981d24Smrg exit 1 105ef981d24Smrg ;; 106ef981d24Smrg 107ef981d24Smrgesac 108ef981d24Smrg 109ef981d24Smrg# Now exit if we have it, but it failed. Also exit now if we 110ef981d24Smrg# don't have it and --version was passed (most likely to detect 111ef981d24Smrg# the program). 112ef981d24Smrgcase $1 in 113ef981d24Smrg lex|yacc) 114ef981d24Smrg # Not GNU programs, they don't have --version. 115ef981d24Smrg ;; 116ef981d24Smrg 117ef981d24Smrg tar) 118ef981d24Smrg if test -n "$run"; then 119ef981d24Smrg echo 1>&2 "ERROR: \`tar' requires --run" 120ef981d24Smrg exit 1 121ef981d24Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 122ef981d24Smrg exit 1 123ef981d24Smrg fi 124ef981d24Smrg ;; 125ef981d24Smrg 126ef981d24Smrg *) 127ef981d24Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 128ef981d24Smrg # We have it, but it failed. 129ef981d24Smrg exit 1 130ef981d24Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 131ef981d24Smrg # Could not run --version or --help. This is probably someone 132ef981d24Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 133ef981d24Smrg # $TOOL exists and not knowing $TOOL uses missing. 134ef981d24Smrg exit 1 135ef981d24Smrg fi 136ef981d24Smrg ;; 137ef981d24Smrgesac 138ef981d24Smrg 139ef981d24Smrg# If it does not exist, or fails to run (possibly an outdated version), 140ef981d24Smrg# try to emulate it. 141ef981d24Smrgcase $1 in 142ef981d24Smrg aclocal*) 143ef981d24Smrg echo 1>&2 "\ 144ef981d24SmrgWARNING: \`$1' is $msg. You should only need it if 145ef981d24Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 146ef981d24Smrg to install the \`Automake' and \`Perl' packages. Grab them from 147ef981d24Smrg any GNU archive site." 148ef981d24Smrg touch aclocal.m4 149ef981d24Smrg ;; 150ef981d24Smrg 151ef981d24Smrg autoconf) 152ef981d24Smrg echo 1>&2 "\ 153ef981d24SmrgWARNING: \`$1' is $msg. You should only need it if 154ef981d24Smrg you modified \`${configure_ac}'. You might want to install the 155ef981d24Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 156ef981d24Smrg archive site." 157ef981d24Smrg touch configure 158ef981d24Smrg ;; 159ef981d24Smrg 160ef981d24Smrg autoheader) 161ef981d24Smrg echo 1>&2 "\ 162ef981d24SmrgWARNING: \`$1' is $msg. You should only need it if 163ef981d24Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 164ef981d24Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 165ef981d24Smrg from any GNU archive site." 166ef981d24Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 167ef981d24Smrg test -z "$files" && files="config.h" 168ef981d24Smrg touch_files= 169ef981d24Smrg for f in $files; do 170ef981d24Smrg case $f in 171ef981d24Smrg *:*) touch_files="$touch_files "`echo "$f" | 172ef981d24Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 173ef981d24Smrg *) touch_files="$touch_files $f.in";; 174ef981d24Smrg esac 175ef981d24Smrg done 176ef981d24Smrg touch $touch_files 177ef981d24Smrg ;; 178ef981d24Smrg 179ef981d24Smrg automake*) 180ef981d24Smrg echo 1>&2 "\ 181ef981d24SmrgWARNING: \`$1' is $msg. You should only need it if 182ef981d24Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 183ef981d24Smrg You might want to install the \`Automake' and \`Perl' packages. 184ef981d24Smrg Grab them from any GNU archive site." 185ef981d24Smrg find . -type f -name Makefile.am -print | 186ef981d24Smrg sed 's/\.am$/.in/' | 187ef981d24Smrg while read f; do touch "$f"; done 188ef981d24Smrg ;; 189ef981d24Smrg 190ef981d24Smrg autom4te) 191ef981d24Smrg echo 1>&2 "\ 192ef981d24SmrgWARNING: \`$1' is needed, but is $msg. 193ef981d24Smrg You might have modified some files without having the 194ef981d24Smrg proper tools for further handling them. 195ef981d24Smrg You can get \`$1' as part of \`Autoconf' from any GNU 196ef981d24Smrg archive site." 197ef981d24Smrg 198ef981d24Smrg file=`echo "$*" | sed -n "$sed_output"` 199ef981d24Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 200ef981d24Smrg if test -f "$file"; then 201ef981d24Smrg touch $file 202ef981d24Smrg else 203ef981d24Smrg test -z "$file" || exec >$file 204ef981d24Smrg echo "#! /bin/sh" 205ef981d24Smrg echo "# Created by GNU Automake missing as a replacement of" 206ef981d24Smrg echo "# $ $@" 207ef981d24Smrg echo "exit 0" 208ef981d24Smrg chmod +x $file 209ef981d24Smrg exit 1 210ef981d24Smrg fi 211ef981d24Smrg ;; 212ef981d24Smrg 213ef981d24Smrg bison|yacc) 214ef981d24Smrg echo 1>&2 "\ 215ef981d24SmrgWARNING: \`$1' $msg. You should only need it if 216ef981d24Smrg you modified a \`.y' file. You may need the \`Bison' package 217ef981d24Smrg in order for those modifications to take effect. You can get 218ef981d24Smrg \`Bison' from any GNU archive site." 219ef981d24Smrg rm -f y.tab.c y.tab.h 220ef981d24Smrg if test $# -ne 1; then 221ef981d24Smrg eval LASTARG="\${$#}" 222ef981d24Smrg case $LASTARG in 223ef981d24Smrg *.y) 224ef981d24Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 225ef981d24Smrg if test -f "$SRCFILE"; then 226ef981d24Smrg cp "$SRCFILE" y.tab.c 227ef981d24Smrg fi 228ef981d24Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 229ef981d24Smrg if test -f "$SRCFILE"; then 230ef981d24Smrg cp "$SRCFILE" y.tab.h 231ef981d24Smrg fi 232ef981d24Smrg ;; 233ef981d24Smrg esac 234ef981d24Smrg fi 235ef981d24Smrg if test ! -f y.tab.h; then 236ef981d24Smrg echo >y.tab.h 237ef981d24Smrg fi 238ef981d24Smrg if test ! -f y.tab.c; then 239ef981d24Smrg echo 'main() { return 0; }' >y.tab.c 240ef981d24Smrg fi 241ef981d24Smrg ;; 242ef981d24Smrg 243ef981d24Smrg lex|flex) 244ef981d24Smrg echo 1>&2 "\ 245ef981d24SmrgWARNING: \`$1' is $msg. You should only need it if 246ef981d24Smrg you modified a \`.l' file. You may need the \`Flex' package 247ef981d24Smrg in order for those modifications to take effect. You can get 248ef981d24Smrg \`Flex' from any GNU archive site." 249ef981d24Smrg rm -f lex.yy.c 250ef981d24Smrg if test $# -ne 1; then 251ef981d24Smrg eval LASTARG="\${$#}" 252ef981d24Smrg case $LASTARG in 253ef981d24Smrg *.l) 254ef981d24Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 255ef981d24Smrg if test -f "$SRCFILE"; then 256ef981d24Smrg cp "$SRCFILE" lex.yy.c 257ef981d24Smrg fi 258ef981d24Smrg ;; 259ef981d24Smrg esac 260ef981d24Smrg fi 261ef981d24Smrg if test ! -f lex.yy.c; then 262ef981d24Smrg echo 'main() { return 0; }' >lex.yy.c 263ef981d24Smrg fi 264ef981d24Smrg ;; 265ef981d24Smrg 266ef981d24Smrg help2man) 267ef981d24Smrg echo 1>&2 "\ 268ef981d24SmrgWARNING: \`$1' is $msg. You should only need it if 269ef981d24Smrg you modified a dependency of a manual page. You may need the 270ef981d24Smrg \`Help2man' package in order for those modifications to take 271ef981d24Smrg effect. You can get \`Help2man' from any GNU archive site." 272ef981d24Smrg 273ef981d24Smrg file=`echo "$*" | sed -n "$sed_output"` 274ef981d24Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 275ef981d24Smrg if test -f "$file"; then 276ef981d24Smrg touch $file 277ef981d24Smrg else 278ef981d24Smrg test -z "$file" || exec >$file 279ef981d24Smrg echo ".ab help2man is required to generate this page" 280ef981d24Smrg exit 1 281ef981d24Smrg fi 282ef981d24Smrg ;; 283ef981d24Smrg 284ef981d24Smrg makeinfo) 285ef981d24Smrg echo 1>&2 "\ 286ef981d24SmrgWARNING: \`$1' is $msg. You should only need it if 287ef981d24Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 288ef981d24Smrg indirectly affecting the aspect of the manual. The spurious 289ef981d24Smrg call might also be the consequence of using a buggy \`make' (AIX, 290ef981d24Smrg DU, IRIX). You might want to install the \`Texinfo' package or 291ef981d24Smrg the \`GNU make' package. Grab either from any GNU archive site." 292ef981d24Smrg # The file to touch is that specified with -o ... 293ef981d24Smrg file=`echo "$*" | sed -n "$sed_output"` 294ef981d24Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 295ef981d24Smrg if test -z "$file"; then 296ef981d24Smrg # ... or it is the one specified with @setfilename ... 297ef981d24Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 298ef981d24Smrg file=`sed -n ' 299ef981d24Smrg /^@setfilename/{ 300ef981d24Smrg s/.* \([^ ]*\) *$/\1/ 301ef981d24Smrg p 302ef981d24Smrg q 303ef981d24Smrg }' $infile` 304ef981d24Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 305ef981d24Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 306ef981d24Smrg fi 307ef981d24Smrg # If the file does not exist, the user really needs makeinfo; 308ef981d24Smrg # let's fail without touching anything. 309ef981d24Smrg test -f $file || exit 1 310ef981d24Smrg touch $file 311ef981d24Smrg ;; 312ef981d24Smrg 313ef981d24Smrg tar) 314ef981d24Smrg shift 315ef981d24Smrg 316ef981d24Smrg # We have already tried tar in the generic part. 317ef981d24Smrg # Look for gnutar/gtar before invocation to avoid ugly error 318ef981d24Smrg # messages. 319ef981d24Smrg if (gnutar --version > /dev/null 2>&1); then 320ef981d24Smrg gnutar "$@" && exit 0 321ef981d24Smrg fi 322ef981d24Smrg if (gtar --version > /dev/null 2>&1); then 323ef981d24Smrg gtar "$@" && exit 0 324ef981d24Smrg fi 325ef981d24Smrg firstarg="$1" 326ef981d24Smrg if shift; then 327ef981d24Smrg case $firstarg in 328ef981d24Smrg *o*) 329ef981d24Smrg firstarg=`echo "$firstarg" | sed s/o//` 330ef981d24Smrg tar "$firstarg" "$@" && exit 0 331ef981d24Smrg ;; 332ef981d24Smrg esac 333ef981d24Smrg case $firstarg in 334ef981d24Smrg *h*) 335ef981d24Smrg firstarg=`echo "$firstarg" | sed s/h//` 336ef981d24Smrg tar "$firstarg" "$@" && exit 0 337ef981d24Smrg ;; 338ef981d24Smrg esac 339ef981d24Smrg fi 340ef981d24Smrg 341ef981d24Smrg echo 1>&2 "\ 342ef981d24SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 343ef981d24Smrg You may want to install GNU tar or Free paxutils, or check the 344ef981d24Smrg command line arguments." 345ef981d24Smrg exit 1 346ef981d24Smrg ;; 347ef981d24Smrg 348ef981d24Smrg *) 349ef981d24Smrg echo 1>&2 "\ 350ef981d24SmrgWARNING: \`$1' is needed, and is $msg. 351ef981d24Smrg You might have modified some files without having the 352ef981d24Smrg proper tools for further handling them. Check the \`README' file, 353ef981d24Smrg it often tells you about the needed prerequisites for installing 354ef981d24Smrg this package. You may also peek at any GNU archive site, in case 355ef981d24Smrg some other package would contain this missing \`$1' program." 356ef981d24Smrg exit 1 357ef981d24Smrg ;; 358ef981d24Smrgesac 359ef981d24Smrg 360ef981d24Smrgexit 0 361ef981d24Smrg 362ef981d24Smrg# Local variables: 363ef981d24Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 364ef981d24Smrg# time-stamp-start: "scriptversion=" 365ef981d24Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 366ef981d24Smrg# time-stamp-end: "$" 367ef981d24Smrg# End: 368