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