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