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