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