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