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