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