missing revision 0cc67336
11.1Sjruoho#! /bin/sh
21.1Sjruoho# Common stub for a few missing GNU programs while installing.
31.1Sjruoho
41.1Sjruohoscriptversion=2006-05-10.23
51.1.1.14Schristos
61.1.1.14Schristos# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
71.1Sjruoho#   Free Software Foundation, Inc.
81.1Sjruoho# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
91.1Sjruoho
101.1Sjruoho# This program is free software; you can redistribute it and/or modify
111.1Sjruoho# it under the terms of the GNU General Public License as published by
121.1.1.2Sjruoho# the Free Software Foundation; either version 2, or (at your option)
131.1.1.2Sjruoho# any later version.
141.1.1.2Sjruoho
151.1.1.2Sjruoho# This program is distributed in the hope that it will be useful,
161.1.1.2Sjruoho# but WITHOUT ANY WARRANTY; without even the implied warranty of
171.1.1.2Sjruoho# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
181.1.1.2Sjruoho# GNU General Public License for more details.
191.1.1.2Sjruoho
201.1.1.2Sjruoho# You should have received a copy of the GNU General Public License
211.1Sjruoho# along with this program; if not, write to the Free Software
221.1.1.3Schristos# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
231.1.1.3Schristos# 02110-1301, USA.
241.1.1.3Schristos
251.1.1.3Schristos# As a special exception to the GNU General Public License, if you
261.1.1.2Sjruoho# distribute this file as part of a program that contains a
271.1.1.2Sjruoho# configuration script generated by Autoconf, you may include it under
281.1.1.3Schristos# the same distribution terms that you use for the rest of that program.
291.1.1.13Schristos
301.1.1.3Schristosif test $# -eq 0; then
311.1.1.13Schristos  echo 1>&2 "Try \`$0 --help' for more information"
321.1.1.3Schristos  exit 1
331.1.1.3Schristosfi
341.1.1.3Schristos
351.1.1.3Schristosrun=:
361.1.1.14Schristossed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
371.1.1.13Schristossed_minuso='s/.* -o \([^ ]*\).*/\1/p'
381.1.1.11Schristos
391.1Sjruoho# In the cases where this matters, `missing' is being run in the
401.1Sjruoho# srcdir already.
411.1Sjruohoif test -f configure.ac; then
421.1Sjruoho  configure_ac=configure.ac
431.1.1.3Schristoselse
441.1.1.3Schristos  configure_ac=configure.in
451.1.1.3Schristosfi
461.1.1.10Schristos
471.1.1.3Schristosmsg="missing on your system"
481.1.1.3Schristos
491.1.1.4Schristoscase $1 in
501.1.1.4Schristos--run)
511.1.1.4Schristos  # Try to run requested program, and just exit if it succeeds.
521.1.1.4Schristos  run=
531.1.1.4Schristos  shift
541.1.1.4Schristos  "$@" && exit 0
551.1.1.13Schristos  # Exit code 63 means version mismatch.  This often happens
561.1.1.4Schristos  # when the user try to use an ancient version of a tool on
571.1.1.4Schristos  # a file that requires a minimum version.  In this case we
581.1.1.6Schristos  # we should proceed has if the program had been absent, or
591.1.1.13Schristos  # if --run hadn't been passed.
601.1.1.6Schristos  if test $? = 63; then
611.1.1.6Schristos    run=:
621.1.1.4Schristos    msg="probably too old"
631.1.1.13Schristos  fi
641.1.1.4Schristos  ;;
651.1.1.3Schristos
661.1.1.5Schristos  -h|--h|--he|--hel|--help)
671.1.1.13Schristos    echo "\
681.1.1.5Schristos$0 [OPTION]... PROGRAM [ARGUMENT]...
691.1.1.5Schristos
701.1.1.8SchristosHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
711.1.1.13Schristoserror status if there is no known handling for PROGRAM.
721.1.1.8Schristos
731.1.1.8SchristosOptions:
741.1.1.16Schristos  -h, --help      display this help and exit
751.1.1.16Schristos  -v, --version   output version information and exit
761.1.1.16Schristos  --run           try to run the given command, and emulate it if it fails
771.1.1.16Schristos
781.1.1.13SchristosSupported PROGRAM values:
791.1.1.3Schristos  aclocal      touch file \`aclocal.m4'
801.1.1.3Schristos  autoconf     touch file \`configure'
811.1.1.3Schristos  autoheader   touch file \`config.h.in'
821.1.1.3Schristos  autom4te     touch the output file, or create a stub one
831.1.1.16Schristos  automake     touch all \`Makefile.in' files
841.1.1.16Schristos  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
851.1.1.16Schristos  flex         create \`lex.yy.c', if possible, from existing .c
861.1.1.16Schristos  help2man     touch the output file
871.1.1.16Schristos  lex          create \`lex.yy.c', if possible, from existing .c
881.1.1.3Schristos  makeinfo     touch the output file
891.1.1.3Schristos  tar          try tar, gnutar, gtar, then tar without non-portable flags
901.1.1.3Schristos  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
911.1.1.16Schristos
921.1.1.16SchristosSend bug reports to <bug-automake@gnu.org>."
931.1.1.3Schristos    exit $?
941.1.1.3Schristos    ;;
951.1.1.3Schristos
961.1.1.3Schristos  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
971.1.1.3Schristos    echo "missing $scriptversion (GNU Automake)"
981.1.1.3Schristos    exit $?
991.1.1.3Schristos    ;;
1001.1.1.3Schristos
1011.1.1.3Schristos  -*)
1021.1.1.3Schristos    echo 1>&2 "$0: Unknown \`$1' option"
1031.1.1.10Schristos    echo 1>&2 "Try \`$0 --help' for more information"
1041.1.1.3Schristos    exit 1
1051.1.1.3Schristos    ;;
1061.1.1.3Schristos
1071.1.1.3Schristosesac
1081.1.1.3Schristos
1091.1.1.3Schristos# Now exit if we have it, but it failed.  Also exit now if we
1101.1.1.3Schristos# don't have it and --version was passed (most likely to detect
1111.1.1.3Schristos# the program).
1121.1.1.10Schristoscase $1 in
1131.1.1.3Schristos  lex|yacc)
1141.1.1.3Schristos    # Not GNU programs, they don't have --version.
1151.1.1.3Schristos    ;;
1161.1.1.3Schristos
1171.1.1.3Schristos  tar)
1181.1.1.3Schristos    if test -n "$run"; then
1191.1.1.3Schristos       echo 1>&2 "ERROR: \`tar' requires --run"
1201.1.1.3Schristos       exit 1
1211.1.1.3Schristos    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1221.1.1.3Schristos       exit 1
1231.1.1.3Schristos    fi
1241.1.1.3Schristos    ;;
1251.1.1.3Schristos
1261.1.1.3Schristos  *)
1271.1.1.3Schristos    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1281.1.1.3Schristos       # We have it, but it failed.
1291.1.1.3Schristos       exit 1
1301.1.1.3Schristos    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1311.1.1.3Schristos       # Could not run --version or --help.  This is probably someone
1321.1.1.3Schristos       # running `$TOOL --version' or `$TOOL --help' to check whether
1331.1.1.3Schristos       # $TOOL exists and not knowing $TOOL uses missing.
1341.1.1.3Schristos       exit 1
1351.1.1.3Schristos    fi
1361.1.1.3Schristos    ;;
1371.1.1.3Schristosesac
1381.1.1.3Schristos
1391.1.1.3Schristos# If it does not exist, or fails to run (possibly an outdated version),
1401.1.1.3Schristos# try to emulate it.
1411.1.1.3Schristoscase $1 in
1421.1.1.3Schristos  aclocal*)
1431.1.1.3Schristos    echo 1>&2 "\
1441.1.1.3SchristosWARNING: \`$1' is $msg.  You should only need it if
1451.1.1.3Schristos         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1461.1.1.3Schristos         to install the \`Automake' and \`Perl' packages.  Grab them from
1471.1.1.3Schristos         any GNU archive site."
1481.1.1.3Schristos    touch aclocal.m4
1491.1.1.3Schristos    ;;
1501.1.1.3Schristos
1511.1.1.3Schristos  autoconf)
1521.1.1.3Schristos    echo 1>&2 "\
1531.1.1.3SchristosWARNING: \`$1' is $msg.  You should only need it if
1541.1Sjruoho         you modified \`${configure_ac}'.  You might want to install the
1551.1.1.3Schristos         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1561.1.1.3Schristos         archive site."
1571.1Sjruoho    touch configure
1581.1.1.3Schristos    ;;
1591.1.1.3Schristos
1601.1.1.3Schristos  autoheader)
1611.1.1.12Schristos    echo 1>&2 "\
1621.1.1.12SchristosWARNING: \`$1' is $msg.  You should only need it if
1631.1.1.12Schristos         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1641.1.1.12Schristos         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1651.1.1.12Schristos         from any GNU archive site."
1661.1.1.12Schristos    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1671.1.1.12Schristos    test -z "$files" && files="config.h"
1681.1.1.12Schristos    touch_files=
1691.1.1.9Schristos    for f in $files; do
1701.1.1.9Schristos      case $f in
1711.1.1.9Schristos      *:*) touch_files="$touch_files "`echo "$f" |
1721.1.1.9Schristos				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1731.1.1.9Schristos      *) touch_files="$touch_files $f.in";;
1741.1.1.9Schristos      esac
1751.1.1.9Schristos    done
1761.1.1.9Schristos    touch $touch_files
1771.1.1.9Schristos    ;;
1781.1.1.3Schristos
1791.1.1.3Schristos  automake*)
1801.1.1.3Schristos    echo 1>&2 "\
1811.1.1.3SchristosWARNING: \`$1' is $msg.  You should only need it if
1821.1.1.5Schristos         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1831.1.1.10Schristos         You might want to install the \`Automake' and \`Perl' packages.
1841.1.1.10Schristos         Grab them from any GNU archive site."
1851.1.1.5Schristos    find . -type f -name Makefile.am -print |
1861.1.1.5Schristos	   sed 's/\.am$/.in/' |
1871.1.1.5Schristos	   while read f; do touch "$f"; done
1881.1.1.5Schristos    ;;
1891.1.1.5Schristos
1901.1.1.5Schristos  autom4te)
1911.1.1.5Schristos    echo 1>&2 "\
1921.1.1.5SchristosWARNING: \`$1' is needed, but is $msg.
1931.1.1.3Schristos         You might have modified some files without having the
1941.1.1.3Schristos         proper tools for further handling them.
1951.1.1.2Sjruoho         You can get \`$1' as part of \`Autoconf' from any GNU
1961.1.1.13Schristos         archive site."
1971.1.1.3Schristos
1981.1.1.3Schristos    file=`echo "$*" | sed -n "$sed_output"`
1991.1.1.10Schristos    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2001.1.1.8Schristos    if test -f "$file"; then
2011.1.1.8Schristos	touch $file
2021.1.1.8Schristos    else
2031.1.1.8Schristos	test -z "$file" || exec >$file
2041.1.1.13Schristos	echo "#! /bin/sh"
2051.1.1.8Schristos	echo "# Created by GNU Automake missing as a replacement of"
2061.1.1.10Schristos	echo "#  $ $@"
2071.1.1.2Sjruoho	echo "exit 0"
2081.1.1.3Schristos	chmod +x $file
2091.1.1.3Schristos	exit 1
2101.1.1.3Schristos    fi
2111.1.1.3Schristos    ;;
2121.1Sjruoho
2131.1.1.5Schristos  bison|yacc)
2141.1.1.3Schristos    echo 1>&2 "\
2151.1.1.3SchristosWARNING: \`$1' $msg.  You should only need it if
2161.1.1.3Schristos         you modified a \`.y' file.  You may need the \`Bison' package
2171.1.1.3Schristos         in order for those modifications to take effect.  You can get
2181.1.1.3Schristos         \`Bison' from any GNU archive site."
2191.1.1.3Schristos    rm -f y.tab.c y.tab.h
2201.1.1.3Schristos    if test $# -ne 1; then
2211.1.1.3Schristos        eval LASTARG="\${$#}"
2221.1.1.3Schristos	case $LASTARG in
2231.1.1.3Schristos	*.y)
2241.1.1.2Sjruoho	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2251.1Sjruoho	    if test -f "$SRCFILE"; then
2261.1.1.15Schristos	         cp "$SRCFILE" y.tab.c
2271.1.1.15Schristos	    fi
2281.1.1.15Schristos	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2291.1.1.15Schristos	    if test -f "$SRCFILE"; then
2301.1Sjruoho	         cp "$SRCFILE" y.tab.h
2311.1.1.3Schristos	    fi
2321.1Sjruoho	  ;;
2331.1.1.2Sjruoho	esac
2341.1.1.3Schristos    fi
2351.1.1.3Schristos    if test ! -f y.tab.h; then
2361.1.1.4Schristos	echo >y.tab.h
2371.1.1.4Schristos    fi
2381.1.1.3Schristos    if test ! -f y.tab.c; then
2391.1.1.3Schristos	echo 'main() { return 0; }' >y.tab.c
2401.1.1.3Schristos    fi
2411.1.1.3Schristos    ;;
2421.1.1.3Schristos
2431.1.1.3Schristos  lex|flex)
2441.1.1.3Schristos    echo 1>&2 "\
2451.1.1.3SchristosWARNING: \`$1' is $msg.  You should only need it if
2461.1.1.3Schristos         you modified a \`.l' file.  You may need the \`Flex' package
2471.1.1.13Schristos         in order for those modifications to take effect.  You can get
2481.1.1.3Schristos         \`Flex' from any GNU archive site."
2491.1.1.3Schristos    rm -f lex.yy.c
2501.1.1.3Schristos    if test $# -ne 1; then
2511.1.1.13Schristos        eval LASTARG="\${$#}"
2521.1.1.3Schristos	case $LASTARG in
2531.1.1.7Schristos	*.l)
2541.1.1.7Schristos	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2551.1.1.7Schristos	    if test -f "$SRCFILE"; then
2561.1.1.7Schristos	         cp "$SRCFILE" lex.yy.c
2571.1.1.7Schristos	    fi
2581.1.1.3Schristos	  ;;
2591.1.1.3Schristos	esac
2601.1Sjruoho    fi
2611.1Sjruoho    if test ! -f lex.yy.c; then
2621.1.1.3Schristos	echo 'main() { return 0; }' >lex.yy.c
2631.1Sjruoho    fi
2641.1.1.2Sjruoho    ;;
2651.1.1.3Schristos
2661.1.1.3Schristos  help2man)
2671.1.1.3Schristos    echo 1>&2 "\
2681.1SjruohoWARNING: \`$1' is $msg.  You should only need it if
2691.1Sjruoho	 you modified a dependency of a manual page.  You may need the
2701.1.1.4Schristos	 \`Help2man' package in order for those modifications to take
2711.1.1.4Schristos	 effect.  You can get \`Help2man' from any GNU archive site."
2721.1Sjruoho
2731.1Sjruoho    file=`echo "$*" | sed -n "$sed_output"`
2741.1.1.2Sjruoho    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2751.1.1.2Sjruoho    if test -f "$file"; then
2761.1.1.2Sjruoho	touch $file
2771.1.1.2Sjruoho    else
2781.1.1.2Sjruoho	test -z "$file" || exec >$file
2791.1.1.3Schristos	echo ".ab help2man is required to generate this page"
2801.1.1.3Schristos	exit 1
2811.1.1.3Schristos    fi
2821.1.1.3Schristos    ;;
2831.1.1.2Sjruoho
2841.1.1.2Sjruoho  makeinfo)
2851.1.1.2Sjruoho    echo 1>&2 "\
2861.1.1.3SchristosWARNING: \`$1' is $msg.  You should only need it if
2871.1.1.2Sjruoho         you modified a \`.texi' or \`.texinfo' file, or any other file
2881.1.1.2Sjruoho         indirectly affecting the aspect of the manual.  The spurious
2891.1.1.3Schristos         call might also be the consequence of using a buggy \`make' (AIX,
2901.1Sjruoho         DU, IRIX).  You might want to install the \`Texinfo' package or
2911.1.1.4Schristos         the \`GNU make' package.  Grab either from any GNU archive site."
2921.1.1.4Schristos    # The file to touch is that specified with -o ...
2931.1.1.4Schristos    file=`echo "$*" | sed -n "$sed_output"`
2941.1.1.2Sjruoho    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2951.1.1.2Sjruoho    if test -z "$file"; then
2961.1.1.12Schristos      # ... or it is the one specified with @setfilename ...
297      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
298      file=`sed -n '
299	/^@setfilename/{
300	  s/.* \([^ ]*\) *$/\1/
301	  p
302	  q
303	}' $infile`
304      # ... or it is derived from the source name (dir/f.texi becomes f.info)
305      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
306    fi
307    # If the file does not exist, the user really needs makeinfo;
308    # let's fail without touching anything.
309    test -f $file || exit 1
310    touch $file
311    ;;
312
313  tar)
314    shift
315
316    # We have already tried tar in the generic part.
317    # Look for gnutar/gtar before invocation to avoid ugly error
318    # messages.
319    if (gnutar --version > /dev/null 2>&1); then
320       gnutar "$@" && exit 0
321    fi
322    if (gtar --version > /dev/null 2>&1); then
323       gtar "$@" && exit 0
324    fi
325    firstarg="$1"
326    if shift; then
327	case $firstarg in
328	*o*)
329	    firstarg=`echo "$firstarg" | sed s/o//`
330	    tar "$firstarg" "$@" && exit 0
331	    ;;
332	esac
333	case $firstarg in
334	*h*)
335	    firstarg=`echo "$firstarg" | sed s/h//`
336	    tar "$firstarg" "$@" && exit 0
337	    ;;
338	esac
339    fi
340
341    echo 1>&2 "\
342WARNING: I can't seem to be able to run \`tar' with the given arguments.
343         You may want to install GNU tar or Free paxutils, or check the
344         command line arguments."
345    exit 1
346    ;;
347
348  *)
349    echo 1>&2 "\
350WARNING: \`$1' is needed, and is $msg.
351         You might have modified some files without having the
352         proper tools for further handling them.  Check the \`README' file,
353         it often tells you about the needed prerequisites for installing
354         this package.  You may also peek at any GNU archive site, in case
355         some other package would contain this missing \`$1' program."
356    exit 1
357    ;;
358esac
359
360exit 0
361
362# Local variables:
363# eval: (add-hook 'write-file-hooks 'time-stamp)
364# time-stamp-start: "scriptversion="
365# time-stamp-format: "%:y-%02m-%02d.%02H"
366# time-stamp-end: "$"
367# End:
368