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