1357bfbb2Smrg#! /bin/sh 2357bfbb2Smrg# Common stub for a few missing GNU programs while installing. 3357bfbb2Smrg 483e03a40Smrgscriptversion=2009-04-28.21; # UTC 5357bfbb2Smrg 683e03a40Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 783e03a40Smrg# 2008, 2009 Free Software Foundation, Inc. 8357bfbb2Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9357bfbb2Smrg 10357bfbb2Smrg# This program is free software; you can redistribute it and/or modify 11357bfbb2Smrg# it under the terms of the GNU General Public License as published by 12357bfbb2Smrg# the Free Software Foundation; either version 2, or (at your option) 13357bfbb2Smrg# any later version. 14357bfbb2Smrg 15357bfbb2Smrg# This program is distributed in the hope that it will be useful, 16357bfbb2Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17357bfbb2Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18357bfbb2Smrg# GNU General Public License for more details. 19357bfbb2Smrg 20357bfbb2Smrg# You should have received a copy of the GNU General Public License 2183e03a40Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22357bfbb2Smrg 23357bfbb2Smrg# As a special exception to the GNU General Public License, if you 24357bfbb2Smrg# distribute this file as part of a program that contains a 25357bfbb2Smrg# configuration script generated by Autoconf, you may include it under 26357bfbb2Smrg# the same distribution terms that you use for the rest of that program. 27357bfbb2Smrg 28357bfbb2Smrgif test $# -eq 0; then 29357bfbb2Smrg echo 1>&2 "Try \`$0 --help' for more information" 30357bfbb2Smrg exit 1 31357bfbb2Smrgfi 32357bfbb2Smrg 33357bfbb2Smrgrun=: 3483e03a40Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 3583e03a40Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36357bfbb2Smrg 37357bfbb2Smrg# In the cases where this matters, `missing' is being run in the 38357bfbb2Smrg# srcdir already. 39357bfbb2Smrgif test -f configure.ac; then 40357bfbb2Smrg configure_ac=configure.ac 41357bfbb2Smrgelse 42357bfbb2Smrg configure_ac=configure.in 43357bfbb2Smrgfi 44357bfbb2Smrg 45357bfbb2Smrgmsg="missing on your system" 46357bfbb2Smrg 4783e03a40Smrgcase $1 in 48357bfbb2Smrg--run) 49357bfbb2Smrg # Try to run requested program, and just exit if it succeeds. 50357bfbb2Smrg run= 51357bfbb2Smrg shift 52357bfbb2Smrg "$@" && exit 0 53357bfbb2Smrg # Exit code 63 means version mismatch. This often happens 54357bfbb2Smrg # when the user try to use an ancient version of a tool on 55357bfbb2Smrg # a file that requires a minimum version. In this case we 56357bfbb2Smrg # we should proceed has if the program had been absent, or 57357bfbb2Smrg # if --run hadn't been passed. 58357bfbb2Smrg if test $? = 63; then 59357bfbb2Smrg run=: 60357bfbb2Smrg msg="probably too old" 61357bfbb2Smrg fi 62357bfbb2Smrg ;; 63357bfbb2Smrg 64357bfbb2Smrg -h|--h|--he|--hel|--help) 65357bfbb2Smrg echo "\ 66357bfbb2Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67357bfbb2Smrg 68357bfbb2SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69357bfbb2Smrgerror status if there is no known handling for PROGRAM. 70357bfbb2Smrg 71357bfbb2SmrgOptions: 72357bfbb2Smrg -h, --help display this help and exit 73357bfbb2Smrg -v, --version output version information and exit 74357bfbb2Smrg --run try to run the given command, and emulate it if it fails 75357bfbb2Smrg 76357bfbb2SmrgSupported PROGRAM values: 77357bfbb2Smrg aclocal touch file \`aclocal.m4' 78357bfbb2Smrg autoconf touch file \`configure' 79357bfbb2Smrg autoheader touch file \`config.h.in' 8083e03a40Smrg autom4te touch the output file, or create a stub one 81357bfbb2Smrg automake touch all \`Makefile.in' files 82357bfbb2Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83357bfbb2Smrg flex create \`lex.yy.c', if possible, from existing .c 84357bfbb2Smrg help2man touch the output file 85357bfbb2Smrg lex create \`lex.yy.c', if possible, from existing .c 86357bfbb2Smrg makeinfo touch the output file 87357bfbb2Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88357bfbb2Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89357bfbb2Smrg 9083e03a40SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 9183e03a40Smrg\`g' are ignored when checking the name. 9283e03a40Smrg 93357bfbb2SmrgSend bug reports to <bug-automake@gnu.org>." 94357bfbb2Smrg exit $? 95357bfbb2Smrg ;; 96357bfbb2Smrg 97357bfbb2Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98357bfbb2Smrg echo "missing $scriptversion (GNU Automake)" 99357bfbb2Smrg exit $? 100357bfbb2Smrg ;; 101357bfbb2Smrg 102357bfbb2Smrg -*) 103357bfbb2Smrg echo 1>&2 "$0: Unknown \`$1' option" 104357bfbb2Smrg echo 1>&2 "Try \`$0 --help' for more information" 105357bfbb2Smrg exit 1 106357bfbb2Smrg ;; 107357bfbb2Smrg 108357bfbb2Smrgesac 109357bfbb2Smrg 11083e03a40Smrg# normalize program name to check for. 11183e03a40Smrgprogram=`echo "$1" | sed ' 11283e03a40Smrg s/^gnu-//; t 11383e03a40Smrg s/^gnu//; t 11483e03a40Smrg s/^g//; t'` 11583e03a40Smrg 116357bfbb2Smrg# Now exit if we have it, but it failed. Also exit now if we 117357bfbb2Smrg# don't have it and --version was passed (most likely to detect 11883e03a40Smrg# the program). This is about non-GNU programs, so use $1 not 11983e03a40Smrg# $program. 12083e03a40Smrgcase $1 in 12183e03a40Smrg lex*|yacc*) 122357bfbb2Smrg # Not GNU programs, they don't have --version. 123357bfbb2Smrg ;; 124357bfbb2Smrg 12583e03a40Smrg tar*) 126357bfbb2Smrg if test -n "$run"; then 127357bfbb2Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128357bfbb2Smrg exit 1 129357bfbb2Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130357bfbb2Smrg exit 1 131357bfbb2Smrg fi 132357bfbb2Smrg ;; 133357bfbb2Smrg 134357bfbb2Smrg *) 135357bfbb2Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136357bfbb2Smrg # We have it, but it failed. 137357bfbb2Smrg exit 1 138357bfbb2Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139357bfbb2Smrg # Could not run --version or --help. This is probably someone 140357bfbb2Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141357bfbb2Smrg # $TOOL exists and not knowing $TOOL uses missing. 142357bfbb2Smrg exit 1 143357bfbb2Smrg fi 144357bfbb2Smrg ;; 145357bfbb2Smrgesac 146357bfbb2Smrg 147357bfbb2Smrg# If it does not exist, or fails to run (possibly an outdated version), 148357bfbb2Smrg# try to emulate it. 14983e03a40Smrgcase $program in 150357bfbb2Smrg aclocal*) 151357bfbb2Smrg echo 1>&2 "\ 152357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 153357bfbb2Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154357bfbb2Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155357bfbb2Smrg any GNU archive site." 156357bfbb2Smrg touch aclocal.m4 157357bfbb2Smrg ;; 158357bfbb2Smrg 15983e03a40Smrg autoconf*) 160357bfbb2Smrg echo 1>&2 "\ 161357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 162357bfbb2Smrg you modified \`${configure_ac}'. You might want to install the 163357bfbb2Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164357bfbb2Smrg archive site." 165357bfbb2Smrg touch configure 166357bfbb2Smrg ;; 167357bfbb2Smrg 16883e03a40Smrg autoheader*) 169357bfbb2Smrg echo 1>&2 "\ 170357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 171357bfbb2Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172357bfbb2Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173357bfbb2Smrg from any GNU archive site." 174357bfbb2Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175357bfbb2Smrg test -z "$files" && files="config.h" 176357bfbb2Smrg touch_files= 177357bfbb2Smrg for f in $files; do 17883e03a40Smrg case $f in 179357bfbb2Smrg *:*) touch_files="$touch_files "`echo "$f" | 180357bfbb2Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181357bfbb2Smrg *) touch_files="$touch_files $f.in";; 182357bfbb2Smrg esac 183357bfbb2Smrg done 184357bfbb2Smrg touch $touch_files 185357bfbb2Smrg ;; 186357bfbb2Smrg 187357bfbb2Smrg automake*) 188357bfbb2Smrg echo 1>&2 "\ 189357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 190357bfbb2Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191357bfbb2Smrg You might want to install the \`Automake' and \`Perl' packages. 192357bfbb2Smrg Grab them from any GNU archive site." 193357bfbb2Smrg find . -type f -name Makefile.am -print | 194357bfbb2Smrg sed 's/\.am$/.in/' | 195357bfbb2Smrg while read f; do touch "$f"; done 196357bfbb2Smrg ;; 197357bfbb2Smrg 19883e03a40Smrg autom4te*) 199357bfbb2Smrg echo 1>&2 "\ 200357bfbb2SmrgWARNING: \`$1' is needed, but is $msg. 201357bfbb2Smrg You might have modified some files without having the 202357bfbb2Smrg proper tools for further handling them. 203357bfbb2Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204357bfbb2Smrg archive site." 205357bfbb2Smrg 20683e03a40Smrg file=`echo "$*" | sed -n "$sed_output"` 20783e03a40Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208357bfbb2Smrg if test -f "$file"; then 209357bfbb2Smrg touch $file 210357bfbb2Smrg else 211357bfbb2Smrg test -z "$file" || exec >$file 212357bfbb2Smrg echo "#! /bin/sh" 213357bfbb2Smrg echo "# Created by GNU Automake missing as a replacement of" 214357bfbb2Smrg echo "# $ $@" 215357bfbb2Smrg echo "exit 0" 216357bfbb2Smrg chmod +x $file 217357bfbb2Smrg exit 1 218357bfbb2Smrg fi 219357bfbb2Smrg ;; 220357bfbb2Smrg 22183e03a40Smrg bison*|yacc*) 222357bfbb2Smrg echo 1>&2 "\ 223357bfbb2SmrgWARNING: \`$1' $msg. You should only need it if 224357bfbb2Smrg you modified a \`.y' file. You may need the \`Bison' package 225357bfbb2Smrg in order for those modifications to take effect. You can get 226357bfbb2Smrg \`Bison' from any GNU archive site." 227357bfbb2Smrg rm -f y.tab.c y.tab.h 22883e03a40Smrg if test $# -ne 1; then 229357bfbb2Smrg eval LASTARG="\${$#}" 23083e03a40Smrg case $LASTARG in 231357bfbb2Smrg *.y) 232357bfbb2Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 23383e03a40Smrg if test -f "$SRCFILE"; then 234357bfbb2Smrg cp "$SRCFILE" y.tab.c 235357bfbb2Smrg fi 236357bfbb2Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 23783e03a40Smrg if test -f "$SRCFILE"; then 238357bfbb2Smrg cp "$SRCFILE" y.tab.h 239357bfbb2Smrg fi 240357bfbb2Smrg ;; 241357bfbb2Smrg esac 242357bfbb2Smrg fi 24383e03a40Smrg if test ! -f y.tab.h; then 244357bfbb2Smrg echo >y.tab.h 245357bfbb2Smrg fi 24683e03a40Smrg if test ! -f y.tab.c; then 247357bfbb2Smrg echo 'main() { return 0; }' >y.tab.c 248357bfbb2Smrg fi 249357bfbb2Smrg ;; 250357bfbb2Smrg 25183e03a40Smrg lex*|flex*) 252357bfbb2Smrg echo 1>&2 "\ 253357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 254357bfbb2Smrg you modified a \`.l' file. You may need the \`Flex' package 255357bfbb2Smrg in order for those modifications to take effect. You can get 256357bfbb2Smrg \`Flex' from any GNU archive site." 257357bfbb2Smrg rm -f lex.yy.c 25883e03a40Smrg if test $# -ne 1; then 259357bfbb2Smrg eval LASTARG="\${$#}" 26083e03a40Smrg case $LASTARG in 261357bfbb2Smrg *.l) 262357bfbb2Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 26383e03a40Smrg if test -f "$SRCFILE"; then 264357bfbb2Smrg cp "$SRCFILE" lex.yy.c 265357bfbb2Smrg fi 266357bfbb2Smrg ;; 267357bfbb2Smrg esac 268357bfbb2Smrg fi 26983e03a40Smrg if test ! -f lex.yy.c; then 270357bfbb2Smrg echo 'main() { return 0; }' >lex.yy.c 271357bfbb2Smrg fi 272357bfbb2Smrg ;; 273357bfbb2Smrg 27483e03a40Smrg help2man*) 275357bfbb2Smrg echo 1>&2 "\ 276357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 277357bfbb2Smrg you modified a dependency of a manual page. You may need the 278357bfbb2Smrg \`Help2man' package in order for those modifications to take 279357bfbb2Smrg effect. You can get \`Help2man' from any GNU archive site." 280357bfbb2Smrg 28183e03a40Smrg file=`echo "$*" | sed -n "$sed_output"` 28283e03a40Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 28383e03a40Smrg if test -f "$file"; then 284357bfbb2Smrg touch $file 285357bfbb2Smrg else 286357bfbb2Smrg test -z "$file" || exec >$file 287357bfbb2Smrg echo ".ab help2man is required to generate this page" 28883e03a40Smrg exit $? 289357bfbb2Smrg fi 290357bfbb2Smrg ;; 291357bfbb2Smrg 29283e03a40Smrg makeinfo*) 293357bfbb2Smrg echo 1>&2 "\ 294357bfbb2SmrgWARNING: \`$1' is $msg. You should only need it if 295357bfbb2Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296357bfbb2Smrg indirectly affecting the aspect of the manual. The spurious 297357bfbb2Smrg call might also be the consequence of using a buggy \`make' (AIX, 298357bfbb2Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299357bfbb2Smrg the \`GNU make' package. Grab either from any GNU archive site." 300357bfbb2Smrg # The file to touch is that specified with -o ... 30183e03a40Smrg file=`echo "$*" | sed -n "$sed_output"` 30283e03a40Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303357bfbb2Smrg if test -z "$file"; then 304357bfbb2Smrg # ... or it is the one specified with @setfilename ... 305357bfbb2Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 30683e03a40Smrg file=`sed -n ' 30783e03a40Smrg /^@setfilename/{ 30883e03a40Smrg s/.* \([^ ]*\) *$/\1/ 30983e03a40Smrg p 31083e03a40Smrg q 31183e03a40Smrg }' $infile` 312357bfbb2Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313357bfbb2Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314357bfbb2Smrg fi 315357bfbb2Smrg # If the file does not exist, the user really needs makeinfo; 316357bfbb2Smrg # let's fail without touching anything. 317357bfbb2Smrg test -f $file || exit 1 318357bfbb2Smrg touch $file 319357bfbb2Smrg ;; 320357bfbb2Smrg 32183e03a40Smrg tar*) 322357bfbb2Smrg shift 323357bfbb2Smrg 324357bfbb2Smrg # We have already tried tar in the generic part. 325357bfbb2Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326357bfbb2Smrg # messages. 327357bfbb2Smrg if (gnutar --version > /dev/null 2>&1); then 328357bfbb2Smrg gnutar "$@" && exit 0 329357bfbb2Smrg fi 330357bfbb2Smrg if (gtar --version > /dev/null 2>&1); then 331357bfbb2Smrg gtar "$@" && exit 0 332357bfbb2Smrg fi 333357bfbb2Smrg firstarg="$1" 334357bfbb2Smrg if shift; then 33583e03a40Smrg case $firstarg in 336357bfbb2Smrg *o*) 337357bfbb2Smrg firstarg=`echo "$firstarg" | sed s/o//` 338357bfbb2Smrg tar "$firstarg" "$@" && exit 0 339357bfbb2Smrg ;; 340357bfbb2Smrg esac 34183e03a40Smrg case $firstarg in 342357bfbb2Smrg *h*) 343357bfbb2Smrg firstarg=`echo "$firstarg" | sed s/h//` 344357bfbb2Smrg tar "$firstarg" "$@" && exit 0 345357bfbb2Smrg ;; 346357bfbb2Smrg esac 347357bfbb2Smrg fi 348357bfbb2Smrg 349357bfbb2Smrg echo 1>&2 "\ 350357bfbb2SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351357bfbb2Smrg You may want to install GNU tar or Free paxutils, or check the 352357bfbb2Smrg command line arguments." 353357bfbb2Smrg exit 1 354357bfbb2Smrg ;; 355357bfbb2Smrg 356357bfbb2Smrg *) 357357bfbb2Smrg echo 1>&2 "\ 358357bfbb2SmrgWARNING: \`$1' is needed, and is $msg. 359357bfbb2Smrg You might have modified some files without having the 360357bfbb2Smrg proper tools for further handling them. Check the \`README' file, 361357bfbb2Smrg it often tells you about the needed prerequisites for installing 362357bfbb2Smrg this package. You may also peek at any GNU archive site, in case 363357bfbb2Smrg some other package would contain this missing \`$1' program." 364357bfbb2Smrg exit 1 365357bfbb2Smrg ;; 366357bfbb2Smrgesac 367357bfbb2Smrg 368357bfbb2Smrgexit 0 369357bfbb2Smrg 370357bfbb2Smrg# Local variables: 371357bfbb2Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372357bfbb2Smrg# time-stamp-start: "scriptversion=" 373357bfbb2Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 37483e03a40Smrg# time-stamp-time-zone: "UTC" 37583e03a40Smrg# time-stamp-end: "; # UTC" 376357bfbb2Smrg# End: 377