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