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