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