missing revision 266e564d
1266e564dSmrg#! /bin/sh 2266e564dSmrg# Common stub for a few missing GNU programs while installing. 3266e564dSmrg 4266e564dSmrgscriptversion=2006-05-10.23 5266e564dSmrg 6266e564dSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 7266e564dSmrg# Free Software Foundation, Inc. 8266e564dSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9266e564dSmrg 10266e564dSmrg# This program is free software; you can redistribute it and/or modify 11266e564dSmrg# it under the terms of the GNU General Public License as published by 12266e564dSmrg# the Free Software Foundation; either version 2, or (at your option) 13266e564dSmrg# any later version. 14266e564dSmrg 15266e564dSmrg# This program is distributed in the hope that it will be useful, 16266e564dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17266e564dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18266e564dSmrg# GNU General Public License for more details. 19266e564dSmrg 20266e564dSmrg# You should have received a copy of the GNU General Public License 21266e564dSmrg# along with this program; if not, write to the Free Software 22266e564dSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23266e564dSmrg# 02110-1301, USA. 24266e564dSmrg 25266e564dSmrg# As a special exception to the GNU General Public License, if you 26266e564dSmrg# distribute this file as part of a program that contains a 27266e564dSmrg# configuration script generated by Autoconf, you may include it under 28266e564dSmrg# the same distribution terms that you use for the rest of that program. 29266e564dSmrg 30266e564dSmrgif test $# -eq 0; then 31266e564dSmrg echo 1>&2 "Try \`$0 --help' for more information" 32266e564dSmrg exit 1 33266e564dSmrgfi 34266e564dSmrg 35266e564dSmrgrun=: 36266e564dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 37266e564dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 38266e564dSmrg 39266e564dSmrg# In the cases where this matters, `missing' is being run in the 40266e564dSmrg# srcdir already. 41266e564dSmrgif test -f configure.ac; then 42266e564dSmrg configure_ac=configure.ac 43266e564dSmrgelse 44266e564dSmrg configure_ac=configure.in 45266e564dSmrgfi 46266e564dSmrg 47266e564dSmrgmsg="missing on your system" 48266e564dSmrg 49266e564dSmrgcase $1 in 50266e564dSmrg--run) 51266e564dSmrg # Try to run requested program, and just exit if it succeeds. 52266e564dSmrg run= 53266e564dSmrg shift 54266e564dSmrg "$@" && exit 0 55266e564dSmrg # Exit code 63 means version mismatch. This often happens 56266e564dSmrg # when the user try to use an ancient version of a tool on 57266e564dSmrg # a file that requires a minimum version. In this case we 58266e564dSmrg # we should proceed has if the program had been absent, or 59266e564dSmrg # if --run hadn't been passed. 60266e564dSmrg if test $? = 63; then 61266e564dSmrg run=: 62266e564dSmrg msg="probably too old" 63266e564dSmrg fi 64266e564dSmrg ;; 65266e564dSmrg 66266e564dSmrg -h|--h|--he|--hel|--help) 67266e564dSmrg echo "\ 68266e564dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 69266e564dSmrg 70266e564dSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 71266e564dSmrgerror status if there is no known handling for PROGRAM. 72266e564dSmrg 73266e564dSmrgOptions: 74266e564dSmrg -h, --help display this help and exit 75266e564dSmrg -v, --version output version information and exit 76266e564dSmrg --run try to run the given command, and emulate it if it fails 77266e564dSmrg 78266e564dSmrgSupported PROGRAM values: 79266e564dSmrg aclocal touch file \`aclocal.m4' 80266e564dSmrg autoconf touch file \`configure' 81266e564dSmrg autoheader touch file \`config.h.in' 82266e564dSmrg autom4te touch the output file, or create a stub one 83266e564dSmrg automake touch all \`Makefile.in' files 84266e564dSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 85266e564dSmrg flex create \`lex.yy.c', if possible, from existing .c 86266e564dSmrg help2man touch the output file 87266e564dSmrg lex create \`lex.yy.c', if possible, from existing .c 88266e564dSmrg makeinfo touch the output file 89266e564dSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 90266e564dSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 91266e564dSmrg 92266e564dSmrgSend bug reports to <bug-automake@gnu.org>." 93266e564dSmrg exit $? 94266e564dSmrg ;; 95266e564dSmrg 96266e564dSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97266e564dSmrg echo "missing $scriptversion (GNU Automake)" 98266e564dSmrg exit $? 99266e564dSmrg ;; 100266e564dSmrg 101266e564dSmrg -*) 102266e564dSmrg echo 1>&2 "$0: Unknown \`$1' option" 103266e564dSmrg echo 1>&2 "Try \`$0 --help' for more information" 104266e564dSmrg exit 1 105266e564dSmrg ;; 106266e564dSmrg 107266e564dSmrgesac 108266e564dSmrg 109266e564dSmrg# Now exit if we have it, but it failed. Also exit now if we 110266e564dSmrg# don't have it and --version was passed (most likely to detect 111266e564dSmrg# the program). 112266e564dSmrgcase $1 in 113266e564dSmrg lex|yacc) 114266e564dSmrg # Not GNU programs, they don't have --version. 115266e564dSmrg ;; 116266e564dSmrg 117266e564dSmrg tar) 118266e564dSmrg if test -n "$run"; then 119266e564dSmrg echo 1>&2 "ERROR: \`tar' requires --run" 120266e564dSmrg exit 1 121266e564dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 122266e564dSmrg exit 1 123266e564dSmrg fi 124266e564dSmrg ;; 125266e564dSmrg 126266e564dSmrg *) 127266e564dSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 128266e564dSmrg # We have it, but it failed. 129266e564dSmrg exit 1 130266e564dSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 131266e564dSmrg # Could not run --version or --help. This is probably someone 132266e564dSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 133266e564dSmrg # $TOOL exists and not knowing $TOOL uses missing. 134266e564dSmrg exit 1 135266e564dSmrg fi 136266e564dSmrg ;; 137266e564dSmrgesac 138266e564dSmrg 139266e564dSmrg# If it does not exist, or fails to run (possibly an outdated version), 140266e564dSmrg# try to emulate it. 141266e564dSmrgcase $1 in 142266e564dSmrg aclocal*) 143266e564dSmrg echo 1>&2 "\ 144266e564dSmrgWARNING: \`$1' is $msg. You should only need it if 145266e564dSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 146266e564dSmrg to install the \`Automake' and \`Perl' packages. Grab them from 147266e564dSmrg any GNU archive site." 148266e564dSmrg touch aclocal.m4 149266e564dSmrg ;; 150266e564dSmrg 151266e564dSmrg autoconf) 152266e564dSmrg echo 1>&2 "\ 153266e564dSmrgWARNING: \`$1' is $msg. You should only need it if 154266e564dSmrg you modified \`${configure_ac}'. You might want to install the 155266e564dSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 156266e564dSmrg archive site." 157266e564dSmrg touch configure 158266e564dSmrg ;; 159266e564dSmrg 160266e564dSmrg autoheader) 161266e564dSmrg echo 1>&2 "\ 162266e564dSmrgWARNING: \`$1' is $msg. You should only need it if 163266e564dSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 164266e564dSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 165266e564dSmrg from any GNU archive site." 166266e564dSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 167266e564dSmrg test -z "$files" && files="config.h" 168266e564dSmrg touch_files= 169266e564dSmrg for f in $files; do 170266e564dSmrg case $f in 171266e564dSmrg *:*) touch_files="$touch_files "`echo "$f" | 172266e564dSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 173266e564dSmrg *) touch_files="$touch_files $f.in";; 174266e564dSmrg esac 175266e564dSmrg done 176266e564dSmrg touch $touch_files 177266e564dSmrg ;; 178266e564dSmrg 179266e564dSmrg automake*) 180266e564dSmrg echo 1>&2 "\ 181266e564dSmrgWARNING: \`$1' is $msg. You should only need it if 182266e564dSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 183266e564dSmrg You might want to install the \`Automake' and \`Perl' packages. 184266e564dSmrg Grab them from any GNU archive site." 185266e564dSmrg find . -type f -name Makefile.am -print | 186266e564dSmrg sed 's/\.am$/.in/' | 187266e564dSmrg while read f; do touch "$f"; done 188266e564dSmrg ;; 189266e564dSmrg 190266e564dSmrg autom4te) 191266e564dSmrg echo 1>&2 "\ 192266e564dSmrgWARNING: \`$1' is needed, but is $msg. 193266e564dSmrg You might have modified some files without having the 194266e564dSmrg proper tools for further handling them. 195266e564dSmrg You can get \`$1' as part of \`Autoconf' from any GNU 196266e564dSmrg archive site." 197266e564dSmrg 198266e564dSmrg file=`echo "$*" | sed -n "$sed_output"` 199266e564dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 200266e564dSmrg if test -f "$file"; then 201266e564dSmrg touch $file 202266e564dSmrg else 203266e564dSmrg test -z "$file" || exec >$file 204266e564dSmrg echo "#! /bin/sh" 205266e564dSmrg echo "# Created by GNU Automake missing as a replacement of" 206266e564dSmrg echo "# $ $@" 207266e564dSmrg echo "exit 0" 208266e564dSmrg chmod +x $file 209266e564dSmrg exit 1 210266e564dSmrg fi 211266e564dSmrg ;; 212266e564dSmrg 213266e564dSmrg bison|yacc) 214266e564dSmrg echo 1>&2 "\ 215266e564dSmrgWARNING: \`$1' $msg. You should only need it if 216266e564dSmrg you modified a \`.y' file. You may need the \`Bison' package 217266e564dSmrg in order for those modifications to take effect. You can get 218266e564dSmrg \`Bison' from any GNU archive site." 219266e564dSmrg rm -f y.tab.c y.tab.h 220266e564dSmrg if test $# -ne 1; then 221266e564dSmrg eval LASTARG="\${$#}" 222266e564dSmrg case $LASTARG in 223266e564dSmrg *.y) 224266e564dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 225266e564dSmrg if test -f "$SRCFILE"; then 226266e564dSmrg cp "$SRCFILE" y.tab.c 227266e564dSmrg fi 228266e564dSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 229266e564dSmrg if test -f "$SRCFILE"; then 230266e564dSmrg cp "$SRCFILE" y.tab.h 231266e564dSmrg fi 232266e564dSmrg ;; 233266e564dSmrg esac 234266e564dSmrg fi 235266e564dSmrg if test ! -f y.tab.h; then 236266e564dSmrg echo >y.tab.h 237266e564dSmrg fi 238266e564dSmrg if test ! -f y.tab.c; then 239266e564dSmrg echo 'main() { return 0; }' >y.tab.c 240266e564dSmrg fi 241266e564dSmrg ;; 242266e564dSmrg 243266e564dSmrg lex|flex) 244266e564dSmrg echo 1>&2 "\ 245266e564dSmrgWARNING: \`$1' is $msg. You should only need it if 246266e564dSmrg you modified a \`.l' file. You may need the \`Flex' package 247266e564dSmrg in order for those modifications to take effect. You can get 248266e564dSmrg \`Flex' from any GNU archive site." 249266e564dSmrg rm -f lex.yy.c 250266e564dSmrg if test $# -ne 1; then 251266e564dSmrg eval LASTARG="\${$#}" 252266e564dSmrg case $LASTARG in 253266e564dSmrg *.l) 254266e564dSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 255266e564dSmrg if test -f "$SRCFILE"; then 256266e564dSmrg cp "$SRCFILE" lex.yy.c 257266e564dSmrg fi 258266e564dSmrg ;; 259266e564dSmrg esac 260266e564dSmrg fi 261266e564dSmrg if test ! -f lex.yy.c; then 262266e564dSmrg echo 'main() { return 0; }' >lex.yy.c 263266e564dSmrg fi 264266e564dSmrg ;; 265266e564dSmrg 266266e564dSmrg help2man) 267266e564dSmrg echo 1>&2 "\ 268266e564dSmrgWARNING: \`$1' is $msg. You should only need it if 269266e564dSmrg you modified a dependency of a manual page. You may need the 270266e564dSmrg \`Help2man' package in order for those modifications to take 271266e564dSmrg effect. You can get \`Help2man' from any GNU archive site." 272266e564dSmrg 273266e564dSmrg file=`echo "$*" | sed -n "$sed_output"` 274266e564dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 275266e564dSmrg if test -f "$file"; then 276266e564dSmrg touch $file 277266e564dSmrg else 278266e564dSmrg test -z "$file" || exec >$file 279266e564dSmrg echo ".ab help2man is required to generate this page" 280266e564dSmrg exit 1 281266e564dSmrg fi 282266e564dSmrg ;; 283266e564dSmrg 284266e564dSmrg makeinfo) 285266e564dSmrg echo 1>&2 "\ 286266e564dSmrgWARNING: \`$1' is $msg. You should only need it if 287266e564dSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 288266e564dSmrg indirectly affecting the aspect of the manual. The spurious 289266e564dSmrg call might also be the consequence of using a buggy \`make' (AIX, 290266e564dSmrg DU, IRIX). You might want to install the \`Texinfo' package or 291266e564dSmrg the \`GNU make' package. Grab either from any GNU archive site." 292266e564dSmrg # The file to touch is that specified with -o ... 293266e564dSmrg file=`echo "$*" | sed -n "$sed_output"` 294266e564dSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 295266e564dSmrg if test -z "$file"; then 296266e564dSmrg # ... or it is the one specified with @setfilename ... 297266e564dSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 298266e564dSmrg file=`sed -n ' 299266e564dSmrg /^@setfilename/{ 300266e564dSmrg s/.* \([^ ]*\) *$/\1/ 301266e564dSmrg p 302266e564dSmrg q 303266e564dSmrg }' $infile` 304266e564dSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 305266e564dSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 306266e564dSmrg fi 307266e564dSmrg # If the file does not exist, the user really needs makeinfo; 308266e564dSmrg # let's fail without touching anything. 309266e564dSmrg test -f $file || exit 1 310266e564dSmrg touch $file 311266e564dSmrg ;; 312266e564dSmrg 313266e564dSmrg tar) 314266e564dSmrg shift 315266e564dSmrg 316266e564dSmrg # We have already tried tar in the generic part. 317266e564dSmrg # Look for gnutar/gtar before invocation to avoid ugly error 318266e564dSmrg # messages. 319266e564dSmrg if (gnutar --version > /dev/null 2>&1); then 320266e564dSmrg gnutar "$@" && exit 0 321266e564dSmrg fi 322266e564dSmrg if (gtar --version > /dev/null 2>&1); then 323266e564dSmrg gtar "$@" && exit 0 324266e564dSmrg fi 325266e564dSmrg firstarg="$1" 326266e564dSmrg if shift; then 327266e564dSmrg case $firstarg in 328266e564dSmrg *o*) 329266e564dSmrg firstarg=`echo "$firstarg" | sed s/o//` 330266e564dSmrg tar "$firstarg" "$@" && exit 0 331266e564dSmrg ;; 332266e564dSmrg esac 333266e564dSmrg case $firstarg in 334266e564dSmrg *h*) 335266e564dSmrg firstarg=`echo "$firstarg" | sed s/h//` 336266e564dSmrg tar "$firstarg" "$@" && exit 0 337266e564dSmrg ;; 338266e564dSmrg esac 339266e564dSmrg fi 340266e564dSmrg 341266e564dSmrg echo 1>&2 "\ 342266e564dSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 343266e564dSmrg You may want to install GNU tar or Free paxutils, or check the 344266e564dSmrg command line arguments." 345266e564dSmrg exit 1 346266e564dSmrg ;; 347266e564dSmrg 348266e564dSmrg *) 349266e564dSmrg echo 1>&2 "\ 350266e564dSmrgWARNING: \`$1' is needed, and is $msg. 351266e564dSmrg You might have modified some files without having the 352266e564dSmrg proper tools for further handling them. Check the \`README' file, 353266e564dSmrg it often tells you about the needed prerequisites for installing 354266e564dSmrg this package. You may also peek at any GNU archive site, in case 355266e564dSmrg some other package would contain this missing \`$1' program." 356266e564dSmrg exit 1 357266e564dSmrg ;; 358266e564dSmrgesac 359266e564dSmrg 360266e564dSmrgexit 0 361266e564dSmrg 362266e564dSmrg# Local variables: 363266e564dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 364266e564dSmrg# time-stamp-start: "scriptversion=" 365266e564dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 366266e564dSmrg# time-stamp-end: "$" 367266e564dSmrg# End: 368