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