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