1439fab64Smrg#! /bin/sh 2439fab64Smrg# Common stub for a few missing GNU programs while installing. 3bc5f02f5Smrg 4bc5f02f5Smrgscriptversion=2009-04-28.21; # UTC 5bc5f02f5Smrg 6bc5f02f5Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7bc5f02f5Smrg# 2008, 2009 Free Software Foundation, Inc. 8439fab64Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9439fab64Smrg 10439fab64Smrg# This program is free software; you can redistribute it and/or modify 11439fab64Smrg# it under the terms of the GNU General Public License as published by 12439fab64Smrg# the Free Software Foundation; either version 2, or (at your option) 13439fab64Smrg# any later version. 14439fab64Smrg 15439fab64Smrg# This program is distributed in the hope that it will be useful, 16439fab64Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17439fab64Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18439fab64Smrg# GNU General Public License for more details. 19439fab64Smrg 20439fab64Smrg# You should have received a copy of the GNU General Public License 21bc5f02f5Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22439fab64Smrg 23439fab64Smrg# As a special exception to the GNU General Public License, if you 24439fab64Smrg# distribute this file as part of a program that contains a 25439fab64Smrg# configuration script generated by Autoconf, you may include it under 26439fab64Smrg# the same distribution terms that you use for the rest of that program. 27439fab64Smrg 28439fab64Smrgif test $# -eq 0; then 29439fab64Smrg echo 1>&2 "Try \`$0 --help' for more information" 30439fab64Smrg exit 1 31439fab64Smrgfi 32439fab64Smrg 33439fab64Smrgrun=: 34bc5f02f5Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35bc5f02f5Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36439fab64Smrg 37439fab64Smrg# In the cases where this matters, `missing' is being run in the 38439fab64Smrg# srcdir already. 39439fab64Smrgif test -f configure.ac; then 40439fab64Smrg configure_ac=configure.ac 41439fab64Smrgelse 42439fab64Smrg configure_ac=configure.in 43439fab64Smrgfi 44439fab64Smrg 45bc5f02f5Smrgmsg="missing on your system" 46bc5f02f5Smrg 47bc5f02f5Smrgcase $1 in 48439fab64Smrg--run) 49439fab64Smrg # Try to run requested program, and just exit if it succeeds. 50439fab64Smrg run= 51439fab64Smrg shift 52439fab64Smrg "$@" && exit 0 53bc5f02f5Smrg # Exit code 63 means version mismatch. This often happens 54bc5f02f5Smrg # when the user try to use an ancient version of a tool on 55bc5f02f5Smrg # a file that requires a minimum version. In this case we 56bc5f02f5Smrg # we should proceed has if the program had been absent, or 57bc5f02f5Smrg # if --run hadn't been passed. 58bc5f02f5Smrg if test $? = 63; then 59bc5f02f5Smrg run=: 60bc5f02f5Smrg msg="probably too old" 61bc5f02f5Smrg fi 62439fab64Smrg ;; 63439fab64Smrg 64439fab64Smrg -h|--h|--he|--hel|--help) 65439fab64Smrg echo "\ 66439fab64Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67439fab64Smrg 68439fab64SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69439fab64Smrgerror status if there is no known handling for PROGRAM. 70439fab64Smrg 71439fab64SmrgOptions: 72439fab64Smrg -h, --help display this help and exit 73439fab64Smrg -v, --version output version information and exit 74439fab64Smrg --run try to run the given command, and emulate it if it fails 75439fab64Smrg 76439fab64SmrgSupported PROGRAM values: 77439fab64Smrg aclocal touch file \`aclocal.m4' 78439fab64Smrg autoconf touch file \`configure' 79439fab64Smrg autoheader touch file \`config.h.in' 80bc5f02f5Smrg autom4te touch the output file, or create a stub one 81439fab64Smrg automake touch all \`Makefile.in' files 82439fab64Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83439fab64Smrg flex create \`lex.yy.c', if possible, from existing .c 84439fab64Smrg help2man touch the output file 85439fab64Smrg lex create \`lex.yy.c', if possible, from existing .c 86439fab64Smrg makeinfo touch the output file 87439fab64Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88bc5f02f5Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89bc5f02f5Smrg 90bc5f02f5SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91bc5f02f5Smrg\`g' are ignored when checking the name. 92bc5f02f5Smrg 93bc5f02f5SmrgSend bug reports to <bug-automake@gnu.org>." 94bc5f02f5Smrg exit $? 95439fab64Smrg ;; 96439fab64Smrg 97439fab64Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98bc5f02f5Smrg echo "missing $scriptversion (GNU Automake)" 99bc5f02f5Smrg exit $? 100439fab64Smrg ;; 101439fab64Smrg 102439fab64Smrg -*) 103439fab64Smrg echo 1>&2 "$0: Unknown \`$1' option" 104439fab64Smrg echo 1>&2 "Try \`$0 --help' for more information" 105439fab64Smrg exit 1 106439fab64Smrg ;; 107439fab64Smrg 108bc5f02f5Smrgesac 109bc5f02f5Smrg 110bc5f02f5Smrg# normalize program name to check for. 111bc5f02f5Smrgprogram=`echo "$1" | sed ' 112bc5f02f5Smrg s/^gnu-//; t 113bc5f02f5Smrg s/^gnu//; t 114bc5f02f5Smrg s/^g//; t'` 115bc5f02f5Smrg 116bc5f02f5Smrg# Now exit if we have it, but it failed. Also exit now if we 117bc5f02f5Smrg# don't have it and --version was passed (most likely to detect 118bc5f02f5Smrg# the program). This is about non-GNU programs, so use $1 not 119bc5f02f5Smrg# $program. 120bc5f02f5Smrgcase $1 in 121bc5f02f5Smrg lex*|yacc*) 122bc5f02f5Smrg # Not GNU programs, they don't have --version. 123bc5f02f5Smrg ;; 124bc5f02f5Smrg 125bc5f02f5Smrg tar*) 126bc5f02f5Smrg if test -n "$run"; then 127bc5f02f5Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128bc5f02f5Smrg exit 1 129bc5f02f5Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130bc5f02f5Smrg exit 1 131bc5f02f5Smrg fi 132bc5f02f5Smrg ;; 133bc5f02f5Smrg 134bc5f02f5Smrg *) 135439fab64Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136439fab64Smrg # We have it, but it failed. 137439fab64Smrg exit 1 138bc5f02f5Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139bc5f02f5Smrg # Could not run --version or --help. This is probably someone 140bc5f02f5Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141bc5f02f5Smrg # $TOOL exists and not knowing $TOOL uses missing. 142bc5f02f5Smrg exit 1 143439fab64Smrg fi 144bc5f02f5Smrg ;; 145bc5f02f5Smrgesac 146439fab64Smrg 147bc5f02f5Smrg# If it does not exist, or fails to run (possibly an outdated version), 148bc5f02f5Smrg# try to emulate it. 149bc5f02f5Smrgcase $program in 150bc5f02f5Smrg aclocal*) 151439fab64Smrg echo 1>&2 "\ 152bc5f02f5SmrgWARNING: \`$1' is $msg. You should only need it if 153439fab64Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154439fab64Smrg to install the \`Automake' and \`Perl' packages. Grab them from 155439fab64Smrg any GNU archive site." 156439fab64Smrg touch aclocal.m4 157439fab64Smrg ;; 158439fab64Smrg 159bc5f02f5Smrg autoconf*) 160439fab64Smrg echo 1>&2 "\ 161bc5f02f5SmrgWARNING: \`$1' is $msg. You should only need it if 162439fab64Smrg you modified \`${configure_ac}'. You might want to install the 163439fab64Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164439fab64Smrg archive site." 165439fab64Smrg touch configure 166439fab64Smrg ;; 167439fab64Smrg 168bc5f02f5Smrg autoheader*) 169439fab64Smrg echo 1>&2 "\ 170bc5f02f5SmrgWARNING: \`$1' is $msg. You should only need it if 171439fab64Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172439fab64Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173439fab64Smrg from any GNU archive site." 174439fab64Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175439fab64Smrg test -z "$files" && files="config.h" 176439fab64Smrg touch_files= 177439fab64Smrg for f in $files; do 178bc5f02f5Smrg case $f in 179439fab64Smrg *:*) touch_files="$touch_files "`echo "$f" | 180439fab64Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181439fab64Smrg *) touch_files="$touch_files $f.in";; 182439fab64Smrg esac 183439fab64Smrg done 184439fab64Smrg touch $touch_files 185439fab64Smrg ;; 186439fab64Smrg 187439fab64Smrg automake*) 188439fab64Smrg echo 1>&2 "\ 189bc5f02f5SmrgWARNING: \`$1' is $msg. You should only need it if 190439fab64Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191439fab64Smrg You might want to install the \`Automake' and \`Perl' packages. 192439fab64Smrg Grab them from any GNU archive site." 193439fab64Smrg find . -type f -name Makefile.am -print | 194439fab64Smrg sed 's/\.am$/.in/' | 195439fab64Smrg while read f; do touch "$f"; done 196439fab64Smrg ;; 197439fab64Smrg 198bc5f02f5Smrg autom4te*) 199439fab64Smrg echo 1>&2 "\ 200bc5f02f5SmrgWARNING: \`$1' is needed, but is $msg. 201bc5f02f5Smrg You might have modified some files without having the 202439fab64Smrg proper tools for further handling them. 203439fab64Smrg You can get \`$1' as part of \`Autoconf' from any GNU 204439fab64Smrg archive site." 205439fab64Smrg 206bc5f02f5Smrg file=`echo "$*" | sed -n "$sed_output"` 207bc5f02f5Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208439fab64Smrg if test -f "$file"; then 209439fab64Smrg touch $file 210439fab64Smrg else 211439fab64Smrg test -z "$file" || exec >$file 212439fab64Smrg echo "#! /bin/sh" 213439fab64Smrg echo "# Created by GNU Automake missing as a replacement of" 214439fab64Smrg echo "# $ $@" 215439fab64Smrg echo "exit 0" 216439fab64Smrg chmod +x $file 217439fab64Smrg exit 1 218439fab64Smrg fi 219439fab64Smrg ;; 220439fab64Smrg 221bc5f02f5Smrg bison*|yacc*) 222439fab64Smrg echo 1>&2 "\ 223bc5f02f5SmrgWARNING: \`$1' $msg. You should only need it if 224439fab64Smrg you modified a \`.y' file. You may need the \`Bison' package 225439fab64Smrg in order for those modifications to take effect. You can get 226439fab64Smrg \`Bison' from any GNU archive site." 227439fab64Smrg rm -f y.tab.c y.tab.h 228bc5f02f5Smrg if test $# -ne 1; then 229439fab64Smrg eval LASTARG="\${$#}" 230bc5f02f5Smrg case $LASTARG in 231439fab64Smrg *.y) 232439fab64Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233bc5f02f5Smrg if test -f "$SRCFILE"; then 234439fab64Smrg cp "$SRCFILE" y.tab.c 235439fab64Smrg fi 236439fab64Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237bc5f02f5Smrg if test -f "$SRCFILE"; then 238439fab64Smrg cp "$SRCFILE" y.tab.h 239439fab64Smrg fi 240439fab64Smrg ;; 241439fab64Smrg esac 242439fab64Smrg fi 243bc5f02f5Smrg if test ! -f y.tab.h; then 244439fab64Smrg echo >y.tab.h 245439fab64Smrg fi 246bc5f02f5Smrg if test ! -f y.tab.c; then 247439fab64Smrg echo 'main() { return 0; }' >y.tab.c 248439fab64Smrg fi 249439fab64Smrg ;; 250439fab64Smrg 251bc5f02f5Smrg lex*|flex*) 252439fab64Smrg echo 1>&2 "\ 253bc5f02f5SmrgWARNING: \`$1' is $msg. You should only need it if 254439fab64Smrg you modified a \`.l' file. You may need the \`Flex' package 255439fab64Smrg in order for those modifications to take effect. You can get 256439fab64Smrg \`Flex' from any GNU archive site." 257439fab64Smrg rm -f lex.yy.c 258bc5f02f5Smrg if test $# -ne 1; then 259439fab64Smrg eval LASTARG="\${$#}" 260bc5f02f5Smrg case $LASTARG in 261439fab64Smrg *.l) 262439fab64Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263bc5f02f5Smrg if test -f "$SRCFILE"; then 264439fab64Smrg cp "$SRCFILE" lex.yy.c 265439fab64Smrg fi 266439fab64Smrg ;; 267439fab64Smrg esac 268439fab64Smrg fi 269bc5f02f5Smrg if test ! -f lex.yy.c; then 270439fab64Smrg echo 'main() { return 0; }' >lex.yy.c 271439fab64Smrg fi 272439fab64Smrg ;; 273439fab64Smrg 274bc5f02f5Smrg help2man*) 275439fab64Smrg echo 1>&2 "\ 276bc5f02f5SmrgWARNING: \`$1' is $msg. You should only need it if 277439fab64Smrg you modified a dependency of a manual page. You may need the 278439fab64Smrg \`Help2man' package in order for those modifications to take 279439fab64Smrg effect. You can get \`Help2man' from any GNU archive site." 280439fab64Smrg 281bc5f02f5Smrg file=`echo "$*" | sed -n "$sed_output"` 282bc5f02f5Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283bc5f02f5Smrg if test -f "$file"; then 284439fab64Smrg touch $file 285439fab64Smrg else 286439fab64Smrg test -z "$file" || exec >$file 287439fab64Smrg echo ".ab help2man is required to generate this page" 288bc5f02f5Smrg exit $? 289439fab64Smrg fi 290439fab64Smrg ;; 291439fab64Smrg 292bc5f02f5Smrg makeinfo*) 293439fab64Smrg echo 1>&2 "\ 294bc5f02f5SmrgWARNING: \`$1' is $msg. You should only need it if 295439fab64Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 296439fab64Smrg indirectly affecting the aspect of the manual. The spurious 297439fab64Smrg call might also be the consequence of using a buggy \`make' (AIX, 298439fab64Smrg DU, IRIX). You might want to install the \`Texinfo' package or 299439fab64Smrg the \`GNU make' package. Grab either from any GNU archive site." 300bc5f02f5Smrg # The file to touch is that specified with -o ... 301bc5f02f5Smrg file=`echo "$*" | sed -n "$sed_output"` 302bc5f02f5Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303439fab64Smrg if test -z "$file"; then 304bc5f02f5Smrg # ... or it is the one specified with @setfilename ... 305bc5f02f5Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306bc5f02f5Smrg file=`sed -n ' 307bc5f02f5Smrg /^@setfilename/{ 308bc5f02f5Smrg s/.* \([^ ]*\) *$/\1/ 309bc5f02f5Smrg p 310bc5f02f5Smrg q 311bc5f02f5Smrg }' $infile` 312bc5f02f5Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313bc5f02f5Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314439fab64Smrg fi 315bc5f02f5Smrg # If the file does not exist, the user really needs makeinfo; 316bc5f02f5Smrg # let's fail without touching anything. 317bc5f02f5Smrg test -f $file || exit 1 318439fab64Smrg touch $file 319439fab64Smrg ;; 320439fab64Smrg 321bc5f02f5Smrg tar*) 322439fab64Smrg shift 323439fab64Smrg 324439fab64Smrg # We have already tried tar in the generic part. 325439fab64Smrg # Look for gnutar/gtar before invocation to avoid ugly error 326439fab64Smrg # messages. 327439fab64Smrg if (gnutar --version > /dev/null 2>&1); then 328439fab64Smrg gnutar "$@" && exit 0 329439fab64Smrg fi 330439fab64Smrg if (gtar --version > /dev/null 2>&1); then 331439fab64Smrg gtar "$@" && exit 0 332439fab64Smrg fi 333439fab64Smrg firstarg="$1" 334439fab64Smrg if shift; then 335bc5f02f5Smrg case $firstarg in 336439fab64Smrg *o*) 337439fab64Smrg firstarg=`echo "$firstarg" | sed s/o//` 338439fab64Smrg tar "$firstarg" "$@" && exit 0 339439fab64Smrg ;; 340439fab64Smrg esac 341bc5f02f5Smrg case $firstarg in 342439fab64Smrg *h*) 343439fab64Smrg firstarg=`echo "$firstarg" | sed s/h//` 344439fab64Smrg tar "$firstarg" "$@" && exit 0 345439fab64Smrg ;; 346439fab64Smrg esac 347439fab64Smrg fi 348439fab64Smrg 349439fab64Smrg echo 1>&2 "\ 350439fab64SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351439fab64Smrg You may want to install GNU tar or Free paxutils, or check the 352439fab64Smrg command line arguments." 353439fab64Smrg exit 1 354439fab64Smrg ;; 355439fab64Smrg 356439fab64Smrg *) 357439fab64Smrg echo 1>&2 "\ 358bc5f02f5SmrgWARNING: \`$1' is needed, and is $msg. 359bc5f02f5Smrg You might have modified some files without having the 360439fab64Smrg proper tools for further handling them. Check the \`README' file, 361439fab64Smrg it often tells you about the needed prerequisites for installing 362439fab64Smrg this package. You may also peek at any GNU archive site, in case 363439fab64Smrg some other package would contain this missing \`$1' program." 364439fab64Smrg exit 1 365439fab64Smrg ;; 366439fab64Smrgesac 367439fab64Smrg 368439fab64Smrgexit 0 369bc5f02f5Smrg 370bc5f02f5Smrg# Local variables: 371bc5f02f5Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372bc5f02f5Smrg# time-stamp-start: "scriptversion=" 373bc5f02f5Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374bc5f02f5Smrg# time-stamp-time-zone: "UTC" 375bc5f02f5Smrg# time-stamp-end: "; # UTC" 376bc5f02f5Smrg# End: 377