missing revision 168023fe
16ea72052Smrg#! /bin/sh 26ea72052Smrg# Common stub for a few missing GNU programs while installing. 3168023feSmrg 4168023feSmrgscriptversion=2009-04-28.21; # UTC 5168023feSmrg 6168023feSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7168023feSmrg# 2008, 2009 Free Software Foundation, Inc. 86ea72052Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 96ea72052Smrg 106ea72052Smrg# This program is free software; you can redistribute it and/or modify 116ea72052Smrg# it under the terms of the GNU General Public License as published by 126ea72052Smrg# the Free Software Foundation; either version 2, or (at your option) 136ea72052Smrg# any later version. 146ea72052Smrg 156ea72052Smrg# This program is distributed in the hope that it will be useful, 166ea72052Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 176ea72052Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 186ea72052Smrg# GNU General Public License for more details. 196ea72052Smrg 206ea72052Smrg# You should have received a copy of the GNU General Public License 21168023feSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 226ea72052Smrg 236ea72052Smrg# As a special exception to the GNU General Public License, if you 246ea72052Smrg# distribute this file as part of a program that contains a 256ea72052Smrg# configuration script generated by Autoconf, you may include it under 266ea72052Smrg# the same distribution terms that you use for the rest of that program. 276ea72052Smrg 286ea72052Smrgif test $# -eq 0; then 296ea72052Smrg echo 1>&2 "Try \`$0 --help' for more information" 306ea72052Smrg exit 1 316ea72052Smrgfi 326ea72052Smrg 336ea72052Smrgrun=: 34168023feSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35168023feSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 366ea72052Smrg 376ea72052Smrg# In the cases where this matters, `missing' is being run in the 386ea72052Smrg# srcdir already. 396ea72052Smrgif test -f configure.ac; then 406ea72052Smrg configure_ac=configure.ac 416ea72052Smrgelse 426ea72052Smrg configure_ac=configure.in 436ea72052Smrgfi 446ea72052Smrg 45168023feSmrgmsg="missing on your system" 46168023feSmrg 47168023feSmrgcase $1 in 486ea72052Smrg--run) 496ea72052Smrg # Try to run requested program, and just exit if it succeeds. 506ea72052Smrg run= 516ea72052Smrg shift 526ea72052Smrg "$@" && exit 0 53168023feSmrg # Exit code 63 means version mismatch. This often happens 54168023feSmrg # when the user try to use an ancient version of a tool on 55168023feSmrg # a file that requires a minimum version. In this case we 56168023feSmrg # we should proceed has if the program had been absent, or 57168023feSmrg # if --run hadn't been passed. 58168023feSmrg if test $? = 63; then 59168023feSmrg run=: 60168023feSmrg msg="probably too old" 61168023feSmrg fi 626ea72052Smrg ;; 636ea72052Smrg 646ea72052Smrg -h|--h|--he|--hel|--help) 656ea72052Smrg echo "\ 666ea72052Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 676ea72052Smrg 686ea72052SmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 696ea72052Smrgerror status if there is no known handling for PROGRAM. 706ea72052Smrg 716ea72052SmrgOptions: 726ea72052Smrg -h, --help display this help and exit 736ea72052Smrg -v, --version output version information and exit 746ea72052Smrg --run try to run the given command, and emulate it if it fails 756ea72052Smrg 766ea72052SmrgSupported PROGRAM values: 776ea72052Smrg aclocal touch file \`aclocal.m4' 786ea72052Smrg autoconf touch file \`configure' 796ea72052Smrg autoheader touch file \`config.h.in' 80168023feSmrg autom4te touch the output file, or create a stub one 816ea72052Smrg automake touch all \`Makefile.in' files 826ea72052Smrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 836ea72052Smrg flex create \`lex.yy.c', if possible, from existing .c 846ea72052Smrg help2man touch the output file 856ea72052Smrg lex create \`lex.yy.c', if possible, from existing .c 866ea72052Smrg makeinfo touch the output file 876ea72052Smrg tar try tar, gnutar, gtar, then tar without non-portable flags 88168023feSmrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89168023feSmrg 90168023feSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91168023feSmrg\`g' are ignored when checking the name. 92168023feSmrg 93168023feSmrgSend bug reports to <bug-automake@gnu.org>." 94168023feSmrg exit $? 956ea72052Smrg ;; 966ea72052Smrg 976ea72052Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98168023feSmrg echo "missing $scriptversion (GNU Automake)" 99168023feSmrg exit $? 1006ea72052Smrg ;; 1016ea72052Smrg 1026ea72052Smrg -*) 1036ea72052Smrg echo 1>&2 "$0: Unknown \`$1' option" 1046ea72052Smrg echo 1>&2 "Try \`$0 --help' for more information" 1056ea72052Smrg exit 1 1066ea72052Smrg ;; 1076ea72052Smrg 108168023feSmrgesac 109168023feSmrg 110168023feSmrg# normalize program name to check for. 111168023feSmrgprogram=`echo "$1" | sed ' 112168023feSmrg s/^gnu-//; t 113168023feSmrg s/^gnu//; t 114168023feSmrg s/^g//; t'` 115168023feSmrg 116168023feSmrg# Now exit if we have it, but it failed. Also exit now if we 117168023feSmrg# don't have it and --version was passed (most likely to detect 118168023feSmrg# the program). This is about non-GNU programs, so use $1 not 119168023feSmrg# $program. 120168023feSmrgcase $1 in 121168023feSmrg lex*|yacc*) 122168023feSmrg # Not GNU programs, they don't have --version. 123168023feSmrg ;; 124168023feSmrg 125168023feSmrg tar*) 126168023feSmrg if test -n "$run"; then 127168023feSmrg echo 1>&2 "ERROR: \`tar' requires --run" 128168023feSmrg exit 1 129168023feSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130168023feSmrg exit 1 131168023feSmrg fi 132168023feSmrg ;; 133168023feSmrg 134168023feSmrg *) 1356ea72052Smrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1366ea72052Smrg # We have it, but it failed. 1376ea72052Smrg exit 1 138168023feSmrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139168023feSmrg # Could not run --version or --help. This is probably someone 140168023feSmrg # running `$TOOL --version' or `$TOOL --help' to check whether 141168023feSmrg # $TOOL exists and not knowing $TOOL uses missing. 142168023feSmrg exit 1 1436ea72052Smrg fi 144168023feSmrg ;; 145168023feSmrgesac 1466ea72052Smrg 147168023feSmrg# If it does not exist, or fails to run (possibly an outdated version), 148168023feSmrg# try to emulate it. 149168023feSmrgcase $program in 150168023feSmrg aclocal*) 1516ea72052Smrg echo 1>&2 "\ 152168023feSmrgWARNING: \`$1' is $msg. You should only need it if 1536ea72052Smrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 1546ea72052Smrg to install the \`Automake' and \`Perl' packages. Grab them from 1556ea72052Smrg any GNU archive site." 1566ea72052Smrg touch aclocal.m4 1576ea72052Smrg ;; 1586ea72052Smrg 159168023feSmrg autoconf*) 1606ea72052Smrg echo 1>&2 "\ 161168023feSmrgWARNING: \`$1' is $msg. You should only need it if 1626ea72052Smrg you modified \`${configure_ac}'. You might want to install the 1636ea72052Smrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1646ea72052Smrg archive site." 1656ea72052Smrg touch configure 1666ea72052Smrg ;; 1676ea72052Smrg 168168023feSmrg autoheader*) 1696ea72052Smrg echo 1>&2 "\ 170168023feSmrgWARNING: \`$1' is $msg. You should only need it if 1716ea72052Smrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 1726ea72052Smrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 1736ea72052Smrg from any GNU archive site." 1746ea72052Smrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1756ea72052Smrg test -z "$files" && files="config.h" 1766ea72052Smrg touch_files= 1776ea72052Smrg for f in $files; do 178168023feSmrg case $f in 1796ea72052Smrg *:*) touch_files="$touch_files "`echo "$f" | 1806ea72052Smrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1816ea72052Smrg *) touch_files="$touch_files $f.in";; 1826ea72052Smrg esac 1836ea72052Smrg done 1846ea72052Smrg touch $touch_files 1856ea72052Smrg ;; 1866ea72052Smrg 1876ea72052Smrg automake*) 1886ea72052Smrg echo 1>&2 "\ 189168023feSmrgWARNING: \`$1' is $msg. You should only need it if 1906ea72052Smrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1916ea72052Smrg You might want to install the \`Automake' and \`Perl' packages. 1926ea72052Smrg Grab them from any GNU archive site." 1936ea72052Smrg find . -type f -name Makefile.am -print | 1946ea72052Smrg sed 's/\.am$/.in/' | 1956ea72052Smrg while read f; do touch "$f"; done 1966ea72052Smrg ;; 1976ea72052Smrg 198168023feSmrg autom4te*) 1996ea72052Smrg echo 1>&2 "\ 200168023feSmrgWARNING: \`$1' is needed, but is $msg. 201168023feSmrg You might have modified some files without having the 2026ea72052Smrg proper tools for further handling them. 2036ea72052Smrg You can get \`$1' as part of \`Autoconf' from any GNU 2046ea72052Smrg archive site." 2056ea72052Smrg 206168023feSmrg file=`echo "$*" | sed -n "$sed_output"` 207168023feSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2086ea72052Smrg if test -f "$file"; then 2096ea72052Smrg touch $file 2106ea72052Smrg else 2116ea72052Smrg test -z "$file" || exec >$file 2126ea72052Smrg echo "#! /bin/sh" 2136ea72052Smrg echo "# Created by GNU Automake missing as a replacement of" 2146ea72052Smrg echo "# $ $@" 2156ea72052Smrg echo "exit 0" 2166ea72052Smrg chmod +x $file 2176ea72052Smrg exit 1 2186ea72052Smrg fi 2196ea72052Smrg ;; 2206ea72052Smrg 221168023feSmrg bison*|yacc*) 2226ea72052Smrg echo 1>&2 "\ 223168023feSmrgWARNING: \`$1' $msg. You should only need it if 2246ea72052Smrg you modified a \`.y' file. You may need the \`Bison' package 2256ea72052Smrg in order for those modifications to take effect. You can get 2266ea72052Smrg \`Bison' from any GNU archive site." 2276ea72052Smrg rm -f y.tab.c y.tab.h 228168023feSmrg if test $# -ne 1; then 2296ea72052Smrg eval LASTARG="\${$#}" 230168023feSmrg case $LASTARG in 2316ea72052Smrg *.y) 2326ea72052Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233168023feSmrg if test -f "$SRCFILE"; then 2346ea72052Smrg cp "$SRCFILE" y.tab.c 2356ea72052Smrg fi 2366ea72052Smrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237168023feSmrg if test -f "$SRCFILE"; then 2386ea72052Smrg cp "$SRCFILE" y.tab.h 2396ea72052Smrg fi 2406ea72052Smrg ;; 2416ea72052Smrg esac 2426ea72052Smrg fi 243168023feSmrg if test ! -f y.tab.h; then 2446ea72052Smrg echo >y.tab.h 2456ea72052Smrg fi 246168023feSmrg if test ! -f y.tab.c; then 2476ea72052Smrg echo 'main() { return 0; }' >y.tab.c 2486ea72052Smrg fi 2496ea72052Smrg ;; 2506ea72052Smrg 251168023feSmrg lex*|flex*) 2526ea72052Smrg echo 1>&2 "\ 253168023feSmrgWARNING: \`$1' is $msg. You should only need it if 2546ea72052Smrg you modified a \`.l' file. You may need the \`Flex' package 2556ea72052Smrg in order for those modifications to take effect. You can get 2566ea72052Smrg \`Flex' from any GNU archive site." 2576ea72052Smrg rm -f lex.yy.c 258168023feSmrg if test $# -ne 1; then 2596ea72052Smrg eval LASTARG="\${$#}" 260168023feSmrg case $LASTARG in 2616ea72052Smrg *.l) 2626ea72052Smrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263168023feSmrg if test -f "$SRCFILE"; then 2646ea72052Smrg cp "$SRCFILE" lex.yy.c 2656ea72052Smrg fi 2666ea72052Smrg ;; 2676ea72052Smrg esac 2686ea72052Smrg fi 269168023feSmrg if test ! -f lex.yy.c; then 2706ea72052Smrg echo 'main() { return 0; }' >lex.yy.c 2716ea72052Smrg fi 2726ea72052Smrg ;; 2736ea72052Smrg 274168023feSmrg help2man*) 2756ea72052Smrg echo 1>&2 "\ 276168023feSmrgWARNING: \`$1' is $msg. You should only need it if 2776ea72052Smrg you modified a dependency of a manual page. You may need the 2786ea72052Smrg \`Help2man' package in order for those modifications to take 2796ea72052Smrg effect. You can get \`Help2man' from any GNU archive site." 2806ea72052Smrg 281168023feSmrg file=`echo "$*" | sed -n "$sed_output"` 282168023feSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283168023feSmrg if test -f "$file"; then 2846ea72052Smrg touch $file 2856ea72052Smrg else 2866ea72052Smrg test -z "$file" || exec >$file 2876ea72052Smrg echo ".ab help2man is required to generate this page" 288168023feSmrg exit $? 2896ea72052Smrg fi 2906ea72052Smrg ;; 2916ea72052Smrg 292168023feSmrg makeinfo*) 2936ea72052Smrg echo 1>&2 "\ 294168023feSmrgWARNING: \`$1' is $msg. You should only need it if 2956ea72052Smrg you modified a \`.texi' or \`.texinfo' file, or any other file 2966ea72052Smrg indirectly affecting the aspect of the manual. The spurious 2976ea72052Smrg call might also be the consequence of using a buggy \`make' (AIX, 2986ea72052Smrg DU, IRIX). You might want to install the \`Texinfo' package or 2996ea72052Smrg the \`GNU make' package. Grab either from any GNU archive site." 300168023feSmrg # The file to touch is that specified with -o ... 301168023feSmrg file=`echo "$*" | sed -n "$sed_output"` 302168023feSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 3036ea72052Smrg if test -z "$file"; then 304168023feSmrg # ... or it is the one specified with @setfilename ... 305168023feSmrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306168023feSmrg file=`sed -n ' 307168023feSmrg /^@setfilename/{ 308168023feSmrg s/.* \([^ ]*\) *$/\1/ 309168023feSmrg p 310168023feSmrg q 311168023feSmrg }' $infile` 312168023feSmrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313168023feSmrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 3146ea72052Smrg fi 315168023feSmrg # If the file does not exist, the user really needs makeinfo; 316168023feSmrg # let's fail without touching anything. 317168023feSmrg test -f $file || exit 1 3186ea72052Smrg touch $file 3196ea72052Smrg ;; 3206ea72052Smrg 321168023feSmrg tar*) 3226ea72052Smrg shift 3236ea72052Smrg 3246ea72052Smrg # We have already tried tar in the generic part. 3256ea72052Smrg # Look for gnutar/gtar before invocation to avoid ugly error 3266ea72052Smrg # messages. 3276ea72052Smrg if (gnutar --version > /dev/null 2>&1); then 3286ea72052Smrg gnutar "$@" && exit 0 3296ea72052Smrg fi 3306ea72052Smrg if (gtar --version > /dev/null 2>&1); then 3316ea72052Smrg gtar "$@" && exit 0 3326ea72052Smrg fi 3336ea72052Smrg firstarg="$1" 3346ea72052Smrg if shift; then 335168023feSmrg case $firstarg in 3366ea72052Smrg *o*) 3376ea72052Smrg firstarg=`echo "$firstarg" | sed s/o//` 3386ea72052Smrg tar "$firstarg" "$@" && exit 0 3396ea72052Smrg ;; 3406ea72052Smrg esac 341168023feSmrg case $firstarg in 3426ea72052Smrg *h*) 3436ea72052Smrg firstarg=`echo "$firstarg" | sed s/h//` 3446ea72052Smrg tar "$firstarg" "$@" && exit 0 3456ea72052Smrg ;; 3466ea72052Smrg esac 3476ea72052Smrg fi 3486ea72052Smrg 3496ea72052Smrg echo 1>&2 "\ 3506ea72052SmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 3516ea72052Smrg You may want to install GNU tar or Free paxutils, or check the 3526ea72052Smrg command line arguments." 3536ea72052Smrg exit 1 3546ea72052Smrg ;; 3556ea72052Smrg 3566ea72052Smrg *) 3576ea72052Smrg echo 1>&2 "\ 358168023feSmrgWARNING: \`$1' is needed, and is $msg. 359168023feSmrg You might have modified some files without having the 3606ea72052Smrg proper tools for further handling them. Check the \`README' file, 3616ea72052Smrg it often tells you about the needed prerequisites for installing 3626ea72052Smrg this package. You may also peek at any GNU archive site, in case 3636ea72052Smrg some other package would contain this missing \`$1' program." 3646ea72052Smrg exit 1 3656ea72052Smrg ;; 3666ea72052Smrgesac 3676ea72052Smrg 3686ea72052Smrgexit 0 369168023feSmrg 370168023feSmrg# Local variables: 371168023feSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372168023feSmrg# time-stamp-start: "scriptversion=" 373168023feSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374168023feSmrg# time-stamp-time-zone: "UTC" 375168023feSmrg# time-stamp-end: "; # UTC" 376168023feSmrg# End: 377