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