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