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