Home | History | Annotate | Line # | Download | only in dist
missing revision 1.1
      1  1.1  mrg #! /bin/sh
      2  1.1  mrg # Common stub for a few missing GNU programs while installing.
      3  1.1  mrg # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
      4  1.1  mrg # Originally by Fran,cois Pinard <pinard (at] iro.umontreal.ca>, 1996.
      5  1.1  mrg 
      6  1.1  mrg # This program is free software; you can redistribute it and/or modify
      7  1.1  mrg # it under the terms of the GNU General Public License as published by
      8  1.1  mrg # the Free Software Foundation; either version 2, or (at your option)
      9  1.1  mrg # any later version.
     10  1.1  mrg 
     11  1.1  mrg # This program is distributed in the hope that it will be useful,
     12  1.1  mrg # but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  1.1  mrg # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14  1.1  mrg # GNU General Public License for more details.
     15  1.1  mrg 
     16  1.1  mrg # You should have received a copy of the GNU General Public License
     17  1.1  mrg # along with this program; if not, write to the Free Software
     18  1.1  mrg # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     19  1.1  mrg # 02111-1307, USA.
     20  1.1  mrg 
     21  1.1  mrg # As a special exception to the GNU General Public License, if you
     22  1.1  mrg # distribute this file as part of a program that contains a
     23  1.1  mrg # configuration script generated by Autoconf, you may include it under
     24  1.1  mrg # the same distribution terms that you use for the rest of that program.
     25  1.1  mrg 
     26  1.1  mrg if test $# -eq 0; then
     27  1.1  mrg   echo 1>&2 "Try \`$0 --help' for more information"
     28  1.1  mrg   exit 1
     29  1.1  mrg fi
     30  1.1  mrg 
     31  1.1  mrg run=:
     32  1.1  mrg 
     33  1.1  mrg # In the cases where this matters, `missing' is being run in the
     34  1.1  mrg # srcdir already.
     35  1.1  mrg if test -f configure.ac; then
     36  1.1  mrg   configure_ac=configure.ac
     37  1.1  mrg else
     38  1.1  mrg   configure_ac=configure.in
     39  1.1  mrg fi
     40  1.1  mrg 
     41  1.1  mrg case "$1" in
     42  1.1  mrg --run)
     43  1.1  mrg   # Try to run requested program, and just exit if it succeeds.
     44  1.1  mrg   run=
     45  1.1  mrg   shift
     46  1.1  mrg   "$@" && exit 0
     47  1.1  mrg   ;;
     48  1.1  mrg esac
     49  1.1  mrg 
     50  1.1  mrg # If it does not exist, or fails to run (possibly an outdated version),
     51  1.1  mrg # try to emulate it.
     52  1.1  mrg case "$1" in
     53  1.1  mrg 
     54  1.1  mrg   -h|--h|--he|--hel|--help)
     55  1.1  mrg     echo "\
     56  1.1  mrg $0 [OPTION]... PROGRAM [ARGUMENT]...
     57  1.1  mrg 
     58  1.1  mrg Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
     59  1.1  mrg error status if there is no known handling for PROGRAM.
     60  1.1  mrg 
     61  1.1  mrg Options:
     62  1.1  mrg   -h, --help      display this help and exit
     63  1.1  mrg   -v, --version   output version information and exit
     64  1.1  mrg   --run           try to run the given command, and emulate it if it fails
     65  1.1  mrg 
     66  1.1  mrg Supported PROGRAM values:
     67  1.1  mrg   aclocal      touch file \`aclocal.m4'
     68  1.1  mrg   autoconf     touch file \`configure'
     69  1.1  mrg   autoheader   touch file \`config.h.in'
     70  1.1  mrg   automake     touch all \`Makefile.in' files
     71  1.1  mrg   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
     72  1.1  mrg   flex         create \`lex.yy.c', if possible, from existing .c
     73  1.1  mrg   help2man     touch the output file
     74  1.1  mrg   lex          create \`lex.yy.c', if possible, from existing .c
     75  1.1  mrg   makeinfo     touch the output file
     76  1.1  mrg   tar          try tar, gnutar, gtar, then tar without non-portable flags
     77  1.1  mrg   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
     78  1.1  mrg     ;;
     79  1.1  mrg 
     80  1.1  mrg   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
     81  1.1  mrg     echo "missing 0.4 - GNU automake"
     82  1.1  mrg     ;;
     83  1.1  mrg 
     84  1.1  mrg   -*)
     85  1.1  mrg     echo 1>&2 "$0: Unknown \`$1' option"
     86  1.1  mrg     echo 1>&2 "Try \`$0 --help' for more information"
     87  1.1  mrg     exit 1
     88  1.1  mrg     ;;
     89  1.1  mrg 
     90  1.1  mrg   aclocal*)
     91  1.1  mrg     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
     92  1.1  mrg        # We have it, but it failed.
     93  1.1  mrg        exit 1
     94  1.1  mrg     fi
     95  1.1  mrg 
     96  1.1  mrg     echo 1>&2 "\
     97  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
     98  1.1  mrg          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
     99  1.1  mrg          to install the \`Automake' and \`Perl' packages.  Grab them from
    100  1.1  mrg          any GNU archive site."
    101  1.1  mrg     touch aclocal.m4
    102  1.1  mrg     ;;
    103  1.1  mrg 
    104  1.1  mrg   autoconf)
    105  1.1  mrg     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
    106  1.1  mrg        # We have it, but it failed.
    107  1.1  mrg        exit 1
    108  1.1  mrg     fi
    109  1.1  mrg 
    110  1.1  mrg     echo 1>&2 "\
    111  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
    112  1.1  mrg          you modified \`${configure_ac}'.  You might want to install the
    113  1.1  mrg          \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
    114  1.1  mrg          archive site."
    115  1.1  mrg     touch configure
    116  1.1  mrg     ;;
    117  1.1  mrg 
    118  1.1  mrg   autoheader)
    119  1.1  mrg     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
    120  1.1  mrg        # We have it, but it failed.
    121  1.1  mrg        exit 1
    122  1.1  mrg     fi
    123  1.1  mrg 
    124  1.1  mrg     echo 1>&2 "\
    125  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
    126  1.1  mrg          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
    127  1.1  mrg          to install the \`Autoconf' and \`GNU m4' packages.  Grab them
    128  1.1  mrg          from any GNU archive site."
    129  1.1  mrg     files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
    130  1.1  mrg     test -z "$files" && files="config.h"
    131  1.1  mrg     touch_files=
    132  1.1  mrg     for f in $files; do
    133  1.1  mrg       case "$f" in
    134  1.1  mrg       *:*) touch_files="$touch_files "`echo "$f" |
    135  1.1  mrg 				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
    136  1.1  mrg       *) touch_files="$touch_files $f.in";;
    137  1.1  mrg       esac
    138  1.1  mrg     done
    139  1.1  mrg     touch $touch_files
    140  1.1  mrg     ;;
    141  1.1  mrg 
    142  1.1  mrg   automake*)
    143  1.1  mrg     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
    144  1.1  mrg        # We have it, but it failed.
    145  1.1  mrg        exit 1
    146  1.1  mrg     fi
    147  1.1  mrg 
    148  1.1  mrg     echo 1>&2 "\
    149  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
    150  1.1  mrg          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
    151  1.1  mrg          You might want to install the \`Automake' and \`Perl' packages.
    152  1.1  mrg          Grab them from any GNU archive site."
    153  1.1  mrg     find . -type f -name Makefile.am -print |
    154  1.1  mrg 	   sed 's/\.am$/.in/' |
    155  1.1  mrg 	   while read f; do touch "$f"; done
    156  1.1  mrg     ;;
    157  1.1  mrg 
    158  1.1  mrg   autom4te)
    159  1.1  mrg     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
    160  1.1  mrg        # We have it, but it failed.
    161  1.1  mrg        exit 1
    162  1.1  mrg     fi
    163  1.1  mrg 
    164  1.1  mrg     echo 1>&2 "\
    165  1.1  mrg WARNING: \`$1' is needed, and you do not seem to have it handy on your
    166  1.1  mrg          system.  You might have modified some files without having the
    167  1.1  mrg          proper tools for further handling them.
    168  1.1  mrg          You can get \`$1' as part of \`Autoconf' from any GNU
    169  1.1  mrg          archive site."
    170  1.1  mrg 
    171  1.1  mrg     file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
    172  1.1  mrg     test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
    173  1.1  mrg     if test -f "$file"; then
    174  1.1  mrg 	touch $file
    175  1.1  mrg     else
    176  1.1  mrg 	test -z "$file" || exec >$file
    177  1.1  mrg 	echo "#! /bin/sh"
    178  1.1  mrg 	echo "# Created by GNU Automake missing as a replacement of"
    179  1.1  mrg 	echo "#  $ $@"
    180  1.1  mrg 	echo "exit 0"
    181  1.1  mrg 	chmod +x $file
    182  1.1  mrg 	exit 1
    183  1.1  mrg     fi
    184  1.1  mrg     ;;
    185  1.1  mrg 
    186  1.1  mrg   bison|yacc)
    187  1.1  mrg     echo 1>&2 "\
    188  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
    189  1.1  mrg          you modified a \`.y' file.  You may need the \`Bison' package
    190  1.1  mrg          in order for those modifications to take effect.  You can get
    191  1.1  mrg          \`Bison' from any GNU archive site."
    192  1.1  mrg     rm -f y.tab.c y.tab.h
    193  1.1  mrg     if [ $# -ne 1 ]; then
    194  1.1  mrg         eval LASTARG="\${$#}"
    195  1.1  mrg 	case "$LASTARG" in
    196  1.1  mrg 	*.y)
    197  1.1  mrg 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
    198  1.1  mrg 	    if [ -f "$SRCFILE" ]; then
    199  1.1  mrg 	         cp "$SRCFILE" y.tab.c
    200  1.1  mrg 	    fi
    201  1.1  mrg 	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
    202  1.1  mrg 	    if [ -f "$SRCFILE" ]; then
    203  1.1  mrg 	         cp "$SRCFILE" y.tab.h
    204  1.1  mrg 	    fi
    205  1.1  mrg 	  ;;
    206  1.1  mrg 	esac
    207  1.1  mrg     fi
    208  1.1  mrg     if [ ! -f y.tab.h ]; then
    209  1.1  mrg 	echo >y.tab.h
    210  1.1  mrg     fi
    211  1.1  mrg     if [ ! -f y.tab.c ]; then
    212  1.1  mrg 	echo 'main() { return 0; }' >y.tab.c
    213  1.1  mrg     fi
    214  1.1  mrg     ;;
    215  1.1  mrg 
    216  1.1  mrg   lex|flex)
    217  1.1  mrg     echo 1>&2 "\
    218  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
    219  1.1  mrg          you modified a \`.l' file.  You may need the \`Flex' package
    220  1.1  mrg          in order for those modifications to take effect.  You can get
    221  1.1  mrg          \`Flex' from any GNU archive site."
    222  1.1  mrg     rm -f lex.yy.c
    223  1.1  mrg     if [ $# -ne 1 ]; then
    224  1.1  mrg         eval LASTARG="\${$#}"
    225  1.1  mrg 	case "$LASTARG" in
    226  1.1  mrg 	*.l)
    227  1.1  mrg 	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
    228  1.1  mrg 	    if [ -f "$SRCFILE" ]; then
    229  1.1  mrg 	         cp "$SRCFILE" lex.yy.c
    230  1.1  mrg 	    fi
    231  1.1  mrg 	  ;;
    232  1.1  mrg 	esac
    233  1.1  mrg     fi
    234  1.1  mrg     if [ ! -f lex.yy.c ]; then
    235  1.1  mrg 	echo 'main() { return 0; }' >lex.yy.c
    236  1.1  mrg     fi
    237  1.1  mrg     ;;
    238  1.1  mrg 
    239  1.1  mrg   help2man)
    240  1.1  mrg     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
    241  1.1  mrg        # We have it, but it failed.
    242  1.1  mrg        exit 1
    243  1.1  mrg     fi
    244  1.1  mrg 
    245  1.1  mrg     echo 1>&2 "\
    246  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
    247  1.1  mrg 	 you modified a dependency of a manual page.  You may need the
    248  1.1  mrg 	 \`Help2man' package in order for those modifications to take
    249  1.1  mrg 	 effect.  You can get \`Help2man' from any GNU archive site."
    250  1.1  mrg 
    251  1.1  mrg     file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
    252  1.1  mrg     if test -z "$file"; then
    253  1.1  mrg 	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
    254  1.1  mrg     fi
    255  1.1  mrg     if [ -f "$file" ]; then
    256  1.1  mrg 	touch $file
    257  1.1  mrg     else
    258  1.1  mrg 	test -z "$file" || exec >$file
    259  1.1  mrg 	echo ".ab help2man is required to generate this page"
    260  1.1  mrg 	exit 1
    261  1.1  mrg     fi
    262  1.1  mrg     ;;
    263  1.1  mrg 
    264  1.1  mrg   makeinfo)
    265  1.1  mrg     if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
    266  1.1  mrg        # We have makeinfo, but it failed.
    267  1.1  mrg        exit 1
    268  1.1  mrg     fi
    269  1.1  mrg 
    270  1.1  mrg     echo 1>&2 "\
    271  1.1  mrg WARNING: \`$1' is missing on your system.  You should only need it if
    272  1.1  mrg          you modified a \`.texi' or \`.texinfo' file, or any other file
    273  1.1  mrg          indirectly affecting the aspect of the manual.  The spurious
    274  1.1  mrg          call might also be the consequence of using a buggy \`make' (AIX,
    275  1.1  mrg          DU, IRIX).  You might want to install the \`Texinfo' package or
    276  1.1  mrg          the \`GNU make' package.  Grab either from any GNU archive site."
    277  1.1  mrg     file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
    278  1.1  mrg     if test -z "$file"; then
    279  1.1  mrg       file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
    280  1.1  mrg       file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
    281  1.1  mrg     fi
    282  1.1  mrg     touch $file
    283  1.1  mrg     ;;
    284  1.1  mrg 
    285  1.1  mrg   tar)
    286  1.1  mrg     shift
    287  1.1  mrg     if test -n "$run"; then
    288  1.1  mrg       echo 1>&2 "ERROR: \`tar' requires --run"
    289  1.1  mrg       exit 1
    290  1.1  mrg     fi
    291  1.1  mrg 
    292  1.1  mrg     # We have already tried tar in the generic part.
    293  1.1  mrg     # Look for gnutar/gtar before invocation to avoid ugly error
    294  1.1  mrg     # messages.
    295  1.1  mrg     if (gnutar --version > /dev/null 2>&1); then
    296  1.1  mrg        gnutar "$@" && exit 0
    297  1.1  mrg     fi
    298  1.1  mrg     if (gtar --version > /dev/null 2>&1); then
    299  1.1  mrg        gtar "$@" && exit 0
    300  1.1  mrg     fi
    301  1.1  mrg     firstarg="$1"
    302  1.1  mrg     if shift; then
    303  1.1  mrg 	case "$firstarg" in
    304  1.1  mrg 	*o*)
    305  1.1  mrg 	    firstarg=`echo "$firstarg" | sed s/o//`
    306  1.1  mrg 	    tar "$firstarg" "$@" && exit 0
    307  1.1  mrg 	    ;;
    308  1.1  mrg 	esac
    309  1.1  mrg 	case "$firstarg" in
    310  1.1  mrg 	*h*)
    311  1.1  mrg 	    firstarg=`echo "$firstarg" | sed s/h//`
    312  1.1  mrg 	    tar "$firstarg" "$@" && exit 0
    313  1.1  mrg 	    ;;
    314  1.1  mrg 	esac
    315  1.1  mrg     fi
    316  1.1  mrg 
    317  1.1  mrg     echo 1>&2 "\
    318  1.1  mrg WARNING: I can't seem to be able to run \`tar' with the given arguments.
    319  1.1  mrg          You may want to install GNU tar or Free paxutils, or check the
    320  1.1  mrg          command line arguments."
    321  1.1  mrg     exit 1
    322  1.1  mrg     ;;
    323  1.1  mrg 
    324  1.1  mrg   *)
    325  1.1  mrg     echo 1>&2 "\
    326  1.1  mrg WARNING: \`$1' is needed, and you do not seem to have it handy on your
    327  1.1  mrg          system.  You might have modified some files without having the
    328  1.1  mrg          proper tools for further handling them.  Check the \`README' file,
    329  1.1  mrg          it often tells you about the needed prerequisites for installing
    330  1.1  mrg          this package.  You may also peek at any GNU archive site, in case
    331  1.1  mrg          some other package would contain this missing \`$1' program."
    332  1.1  mrg     exit 1
    333  1.1  mrg     ;;
    334  1.1  mrg esac
    335  1.1  mrg 
    336  1.1  mrg exit 0
    337