1706f2543Smrg#! /bin/sh 2706f2543Smrg# Common stub for a few missing GNU programs while installing. 3706f2543Smrg 4706f2543Smrgscriptversion=2006-05-10.23 5706f2543Smrg 6706f2543Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 7706f2543Smrg# Free Software Foundation, Inc. 8706f2543Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9706f2543Smrg 10706f2543Smrg# This program is free software; you can redistribute it and/or modify 11706f2543Smrg# it under the terms of the GNU General Public License as published by 12706f2543Smrg# the Free Software Foundation; either version 2, or (at your option) 13706f2543Smrg# any later version. 14706f2543Smrg 15706f2543Smrg# This program is distributed in the hope that it will be useful, 16706f2543Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17706f2543Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18706f2543Smrg# GNU General Public License for more details. 19706f2543Smrg 20706f2543Smrg# You should have received a copy of the GNU General Public License 21706f2543Smrg# along with this program; if not, write to the Free Software 22706f2543Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23706f2543Smrg# 02110-1301, USA. 24706f2543Smrg 25706f2543Smrg# As a special exception to the GNU General Public License, if you 26706f2543Smrg# distribute this file as part of a program that contains a 27706f2543Smrg# configuration script generated by Autoconf, you may include it under 28706f2543Smrg# the same distribution terms that you use for the rest of that program. 29706f2543Smrg 30706f2543Smrgif test $# -eq 0; then 31706f2543Smrg echo 1>&2 "Try \`$0 --help' for more information" 32706f2543Smrg exit 1 33706f2543Smrgfi 34706f2543Smrg 35706f2543Smrgrun=: 36706f2543Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 37706f2543Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 38706f2543Smrg 39706f2543Smrg# In the cases where this matters, `missing' is being run in the 40706f2543Smrg# srcdir already. 41706f2543Smrgif test -f configure.ac; then 42706f2543Smrg configure_ac=configure.ac 43706f2543Smrgelse 44706f2543Smrg configure_ac=configure.in 45706f2543Smrgfi 46706f2543Smrg 47706f2543Smrgmsg="missing on your system" 48706f2543Smrg 49706f2543Smrgcase $1 in 50706f2543Smrg--run) 51706f2543Smrg # Try to run requested program, and just exit if it succeeds. 52706f2543Smrg run= 53706f2543Smrg shift 54706f2543Smrg "$@" && exit 0 55706f2543Smrg # Exit code 63 means version mismatch. This often happens 56706f2543Smrg # when the user try to use an ancient version of a tool on 57706f2543Smrg # a file that requires a minimum version. In this case we 58706f2543Smrg # we should proceed has if the program had been absent, or 59706f2543Smrg # if --run hadn't been passed. 60706f2543Smrg if test $? = 63; then 61706f2543Smrg run=: 62706f2543Smrg msg="probably too old" 63706f2543Smrg fi 64706f2543Smrg ;; 65706f2543Smrg 66706f2543Smrg -h|--h|--he|--hel|--help) 67706f2543Smrg echo "\ 68706f2543Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 69706f2543Smrg 70706f2543SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 71706f2543Smrgerror status if there is no known handling for PROGRAM. 72706f2543Smrg 73706f2543SmrgOptions: 74706f2543Smrg -h, --help display this help and exit 75706f2543Smrg -v, --version output version information and exit 76706f2543Smrg --run try to run the given command, and emulate it if it fails 77706f2543Smrg 78706f2543SmrgSupported PROGRAM values: 79706f2543Smrg aclocal touch file \`aclocal.m4' 80706f2543Smrg autoconf touch file \`configure' 81706f2543Smrg autoheader touch file \`config.h.in' 82706f2543Smrg autom4te touch the output file, or create a stub one 83706f2543Smrg automake touch all \`Makefile.in' files 84706f2543Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 85706f2543Smrg flex create \`lex.yy.c', if possible, from existing .c 86706f2543Smrg help2man touch the output file 87706f2543Smrg lex create \`lex.yy.c', if possible, from existing .c 88706f2543Smrg makeinfo touch the output file 89706f2543Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 90706f2543Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 91706f2543Smrg 92706f2543SmrgSend bug reports to <bug-automake@gnu.org>." 93706f2543Smrg exit $? 94706f2543Smrg ;; 95706f2543Smrg 96706f2543Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97706f2543Smrg echo "missing $scriptversion (GNU Automake)" 98706f2543Smrg exit $? 99706f2543Smrg ;; 100706f2543Smrg 101706f2543Smrg -*) 102706f2543Smrg echo 1>&2 "$0: Unknown \`$1' option" 103706f2543Smrg echo 1>&2 "Try \`$0 --help' for more information" 104706f2543Smrg exit 1 105706f2543Smrg ;; 106706f2543Smrg 107706f2543Smrgesac 108706f2543Smrg 109706f2543Smrg# Now exit if we have it, but it failed. Also exit now if we 110706f2543Smrg# don't have it and --version was passed (most likely to detect 111706f2543Smrg# the program). 112706f2543Smrgcase $1 in 113706f2543Smrg lex|yacc) 114706f2543Smrg # Not GNU programs, they don't have --version. 115706f2543Smrg ;; 116706f2543Smrg 117706f2543Smrg tar) 118706f2543Smrg if test -n "$run"; then 119706f2543Smrg echo 1>&2 "ERROR: \`tar' requires --run" 120706f2543Smrg exit 1 121706f2543Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 122706f2543Smrg exit 1 123706f2543Smrg fi 124706f2543Smrg ;; 125706f2543Smrg 126706f2543Smrg *) 127706f2543Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 128706f2543Smrg # We have it, but it failed. 129706f2543Smrg exit 1 130706f2543Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 131706f2543Smrg # Could not run --version or --help. This is probably someone 132706f2543Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 133706f2543Smrg # $TOOL exists and not knowing $TOOL uses missing. 134706f2543Smrg exit 1 135706f2543Smrg fi 136706f2543Smrg ;; 137706f2543Smrgesac 138706f2543Smrg 139706f2543Smrg# If it does not exist, or fails to run (possibly an outdated version), 140706f2543Smrg# try to emulate it. 141706f2543Smrgcase $1 in 142706f2543Smrg aclocal*) 143706f2543Smrg echo 1>&2 "\ 144706f2543SmrgWARNING: \`$1' is $msg. You should only need it if 145706f2543Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 146706f2543Smrg to install the \`Automake' and \`Perl' packages. Grab them from 147706f2543Smrg any GNU archive site." 148706f2543Smrg touch aclocal.m4 149706f2543Smrg ;; 150706f2543Smrg 151706f2543Smrg autoconf) 152706f2543Smrg echo 1>&2 "\ 153706f2543SmrgWARNING: \`$1' is $msg. You should only need it if 154706f2543Smrg you modified \`${configure_ac}'. You might want to install the 155706f2543Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 156706f2543Smrg archive site." 157706f2543Smrg touch configure 158706f2543Smrg ;; 159706f2543Smrg 160706f2543Smrg autoheader) 161706f2543Smrg echo 1>&2 "\ 162706f2543SmrgWARNING: \`$1' is $msg. You should only need it if 163706f2543Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 164706f2543Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 165706f2543Smrg from any GNU archive site." 166706f2543Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 167706f2543Smrg test -z "$files" && files="config.h" 168706f2543Smrg touch_files= 169706f2543Smrg for f in $files; do 170706f2543Smrg case $f in 171706f2543Smrg *:*) touch_files="$touch_files "`echo "$f" | 172706f2543Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 173706f2543Smrg *) touch_files="$touch_files $f.in";; 174706f2543Smrg esac 175706f2543Smrg done 176706f2543Smrg touch $touch_files 177706f2543Smrg ;; 178706f2543Smrg 179706f2543Smrg automake*) 180706f2543Smrg echo 1>&2 "\ 181706f2543SmrgWARNING: \`$1' is $msg. You should only need it if 182706f2543Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 183706f2543Smrg You might want to install the \`Automake' and \`Perl' packages. 184706f2543Smrg Grab them from any GNU archive site." 185706f2543Smrg find . -type f -name Makefile.am -print | 186706f2543Smrg sed 's/\.am$/.in/' | 187706f2543Smrg while read f; do touch "$f"; done 188706f2543Smrg ;; 189706f2543Smrg 190706f2543Smrg autom4te) 191706f2543Smrg echo 1>&2 "\ 192706f2543SmrgWARNING: \`$1' is needed, but is $msg. 193706f2543Smrg You might have modified some files without having the 194706f2543Smrg proper tools for further handling them. 195706f2543Smrg You can get \`$1' as part of \`Autoconf' from any GNU 196706f2543Smrg archive site." 197706f2543Smrg 198706f2543Smrg file=`echo "$*" | sed -n "$sed_output"` 199706f2543Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 200706f2543Smrg if test -f "$file"; then 201706f2543Smrg touch $file 202706f2543Smrg else 203706f2543Smrg test -z "$file" || exec >$file 204706f2543Smrg echo "#! /bin/sh" 205706f2543Smrg echo "# Created by GNU Automake missing as a replacement of" 206706f2543Smrg echo "# $ $@" 207706f2543Smrg echo "exit 0" 208706f2543Smrg chmod +x $file 209706f2543Smrg exit 1 210706f2543Smrg fi 211706f2543Smrg ;; 212706f2543Smrg 213706f2543Smrg bison|yacc) 214706f2543Smrg echo 1>&2 "\ 215706f2543SmrgWARNING: \`$1' $msg. You should only need it if 216706f2543Smrg you modified a \`.y' file. You may need the \`Bison' package 217706f2543Smrg in order for those modifications to take effect. You can get 218706f2543Smrg \`Bison' from any GNU archive site." 219706f2543Smrg rm -f y.tab.c y.tab.h 220706f2543Smrg if test $# -ne 1; then 221706f2543Smrg eval LASTARG="\${$#}" 222706f2543Smrg case $LASTARG in 223706f2543Smrg *.y) 224706f2543Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 225706f2543Smrg if test -f "$SRCFILE"; then 226706f2543Smrg cp "$SRCFILE" y.tab.c 227706f2543Smrg fi 228706f2543Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 229706f2543Smrg if test -f "$SRCFILE"; then 230706f2543Smrg cp "$SRCFILE" y.tab.h 231706f2543Smrg fi 232706f2543Smrg ;; 233706f2543Smrg esac 234706f2543Smrg fi 235706f2543Smrg if test ! -f y.tab.h; then 236706f2543Smrg echo >y.tab.h 237706f2543Smrg fi 238706f2543Smrg if test ! -f y.tab.c; then 239706f2543Smrg echo 'main() { return 0; }' >y.tab.c 240706f2543Smrg fi 241706f2543Smrg ;; 242706f2543Smrg 243706f2543Smrg lex|flex) 244706f2543Smrg echo 1>&2 "\ 245706f2543SmrgWARNING: \`$1' is $msg. You should only need it if 246706f2543Smrg you modified a \`.l' file. You may need the \`Flex' package 247706f2543Smrg in order for those modifications to take effect. You can get 248706f2543Smrg \`Flex' from any GNU archive site." 249706f2543Smrg rm -f lex.yy.c 250706f2543Smrg if test $# -ne 1; then 251706f2543Smrg eval LASTARG="\${$#}" 252706f2543Smrg case $LASTARG in 253706f2543Smrg *.l) 254706f2543Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 255706f2543Smrg if test -f "$SRCFILE"; then 256706f2543Smrg cp "$SRCFILE" lex.yy.c 257706f2543Smrg fi 258706f2543Smrg ;; 259706f2543Smrg esac 260706f2543Smrg fi 261706f2543Smrg if test ! -f lex.yy.c; then 262706f2543Smrg echo 'main() { return 0; }' >lex.yy.c 263706f2543Smrg fi 264706f2543Smrg ;; 265706f2543Smrg 266706f2543Smrg help2man) 267706f2543Smrg echo 1>&2 "\ 268706f2543SmrgWARNING: \`$1' is $msg. You should only need it if 269706f2543Smrg you modified a dependency of a manual page. You may need the 270706f2543Smrg \`Help2man' package in order for those modifications to take 271706f2543Smrg effect. You can get \`Help2man' from any GNU archive site." 272706f2543Smrg 273706f2543Smrg file=`echo "$*" | sed -n "$sed_output"` 274706f2543Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 275706f2543Smrg if test -f "$file"; then 276706f2543Smrg touch $file 277706f2543Smrg else 278706f2543Smrg test -z "$file" || exec >$file 279706f2543Smrg echo ".ab help2man is required to generate this page" 280706f2543Smrg exit 1 281706f2543Smrg fi 282706f2543Smrg ;; 283706f2543Smrg 284706f2543Smrg makeinfo) 285706f2543Smrg echo 1>&2 "\ 286706f2543SmrgWARNING: \`$1' is $msg. You should only need it if 287706f2543Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 288706f2543Smrg indirectly affecting the aspect of the manual. The spurious 289706f2543Smrg call might also be the consequence of using a buggy \`make' (AIX, 290706f2543Smrg DU, IRIX). You might want to install the \`Texinfo' package or 291706f2543Smrg the \`GNU make' package. Grab either from any GNU archive site." 292706f2543Smrg # The file to touch is that specified with -o ... 293706f2543Smrg file=`echo "$*" | sed -n "$sed_output"` 294706f2543Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 295706f2543Smrg if test -z "$file"; then 296706f2543Smrg # ... or it is the one specified with @setfilename ... 297706f2543Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 298706f2543Smrg file=`sed -n ' 299706f2543Smrg /^@setfilename/{ 300706f2543Smrg s/.* \([^ ]*\) *$/\1/ 301706f2543Smrg p 302706f2543Smrg q 303706f2543Smrg }' $infile` 304706f2543Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 305706f2543Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 306706f2543Smrg fi 307706f2543Smrg # If the file does not exist, the user really needs makeinfo; 308706f2543Smrg # let's fail without touching anything. 309706f2543Smrg test -f $file || exit 1 310706f2543Smrg touch $file 311706f2543Smrg ;; 312706f2543Smrg 313706f2543Smrg tar) 314706f2543Smrg shift 315706f2543Smrg 316706f2543Smrg # We have already tried tar in the generic part. 317706f2543Smrg # Look for gnutar/gtar before invocation to avoid ugly error 318706f2543Smrg # messages. 319706f2543Smrg if (gnutar --version > /dev/null 2>&1); then 320706f2543Smrg gnutar "$@" && exit 0 321706f2543Smrg fi 322706f2543Smrg if (gtar --version > /dev/null 2>&1); then 323706f2543Smrg gtar "$@" && exit 0 324706f2543Smrg fi 325706f2543Smrg firstarg="$1" 326706f2543Smrg if shift; then 327706f2543Smrg case $firstarg in 328706f2543Smrg *o*) 329706f2543Smrg firstarg=`echo "$firstarg" | sed s/o//` 330706f2543Smrg tar "$firstarg" "$@" && exit 0 331706f2543Smrg ;; 332706f2543Smrg esac 333706f2543Smrg case $firstarg in 334706f2543Smrg *h*) 335706f2543Smrg firstarg=`echo "$firstarg" | sed s/h//` 336706f2543Smrg tar "$firstarg" "$@" && exit 0 337706f2543Smrg ;; 338706f2543Smrg esac 339706f2543Smrg fi 340706f2543Smrg 341706f2543Smrg echo 1>&2 "\ 342706f2543SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 343706f2543Smrg You may want to install GNU tar or Free paxutils, or check the 344706f2543Smrg command line arguments." 345706f2543Smrg exit 1 346706f2543Smrg ;; 347706f2543Smrg 348706f2543Smrg *) 349706f2543Smrg echo 1>&2 "\ 350706f2543SmrgWARNING: \`$1' is needed, and is $msg. 351706f2543Smrg You might have modified some files without having the 352706f2543Smrg proper tools for further handling them. Check the \`README' file, 353706f2543Smrg it often tells you about the needed prerequisites for installing 354706f2543Smrg this package. You may also peek at any GNU archive site, in case 355706f2543Smrg some other package would contain this missing \`$1' program." 356706f2543Smrg exit 1 357706f2543Smrg ;; 358706f2543Smrgesac 359706f2543Smrg 360706f2543Smrgexit 0 361706f2543Smrg 362706f2543Smrg# Local variables: 363706f2543Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 364706f2543Smrg# time-stamp-start: "scriptversion=" 365706f2543Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 366706f2543Smrg# time-stamp-end: "$" 367706f2543Smrg# End: 368