missing revision 8abc0ccf
17a0395d0Smrg#! /bin/sh
27a0395d0Smrg# Common stub for a few missing GNU programs while installing.
37a0395d0Smrg
48abc0ccfSmrgscriptversion=2012-01-06.18; # UTC
57a0395d0Smrg
68abc0ccfSmrg# Copyright (C) 1996-2012 Free Software Foundation, Inc.
77a0395d0Smrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
87a0395d0Smrg
97a0395d0Smrg# This program is free software; you can redistribute it and/or modify
107a0395d0Smrg# it under the terms of the GNU General Public License as published by
117a0395d0Smrg# the Free Software Foundation; either version 2, or (at your option)
127a0395d0Smrg# any later version.
137a0395d0Smrg
147a0395d0Smrg# This program is distributed in the hope that it will be useful,
157a0395d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
167a0395d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
177a0395d0Smrg# GNU General Public License for more details.
187a0395d0Smrg
197a0395d0Smrg# You should have received a copy of the GNU General Public License
207366012aSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
217a0395d0Smrg
227a0395d0Smrg# As a special exception to the GNU General Public License, if you
237a0395d0Smrg# distribute this file as part of a program that contains a
247a0395d0Smrg# configuration script generated by Autoconf, you may include it under
257a0395d0Smrg# the same distribution terms that you use for the rest of that program.
267a0395d0Smrg
277a0395d0Smrgif test $# -eq 0; then
288abc0ccfSmrg  echo 1>&2 "Try '$0 --help' for more information"
297a0395d0Smrg  exit 1
307a0395d0Smrgfi
317a0395d0Smrg
327a0395d0Smrgrun=:
337a0395d0Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
347a0395d0Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
357a0395d0Smrg
368abc0ccfSmrg# In the cases where this matters, 'missing' is being run in the
377a0395d0Smrg# srcdir already.
387a0395d0Smrgif test -f configure.ac; then
397a0395d0Smrg  configure_ac=configure.ac
407a0395d0Smrgelse
417a0395d0Smrg  configure_ac=configure.in
427a0395d0Smrgfi
437a0395d0Smrg
447a0395d0Smrgmsg="missing on your system"
457a0395d0Smrg
467a0395d0Smrgcase $1 in
477a0395d0Smrg--run)
487a0395d0Smrg  # Try to run requested program, and just exit if it succeeds.
497a0395d0Smrg  run=
507a0395d0Smrg  shift
517a0395d0Smrg  "$@" && exit 0
527a0395d0Smrg  # Exit code 63 means version mismatch.  This often happens
537a0395d0Smrg  # when the user try to use an ancient version of a tool on
547a0395d0Smrg  # a file that requires a minimum version.  In this case we
557a0395d0Smrg  # we should proceed has if the program had been absent, or
567a0395d0Smrg  # if --run hadn't been passed.
577a0395d0Smrg  if test $? = 63; then
587a0395d0Smrg    run=:
597a0395d0Smrg    msg="probably too old"
607a0395d0Smrg  fi
617a0395d0Smrg  ;;
627a0395d0Smrg
637a0395d0Smrg  -h|--h|--he|--hel|--help)
647a0395d0Smrg    echo "\
657a0395d0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]...
667a0395d0Smrg
678abc0ccfSmrgHandle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
687a0395d0Smrgerror status if there is no known handling for PROGRAM.
697a0395d0Smrg
707a0395d0SmrgOptions:
717a0395d0Smrg  -h, --help      display this help and exit
727a0395d0Smrg  -v, --version   output version information and exit
737a0395d0Smrg  --run           try to run the given command, and emulate it if it fails
747a0395d0Smrg
757a0395d0SmrgSupported PROGRAM values:
768abc0ccfSmrg  aclocal      touch file 'aclocal.m4'
778abc0ccfSmrg  autoconf     touch file 'configure'
788abc0ccfSmrg  autoheader   touch file 'config.h.in'
797a0395d0Smrg  autom4te     touch the output file, or create a stub one
808abc0ccfSmrg  automake     touch all 'Makefile.in' files
818abc0ccfSmrg  bison        create 'y.tab.[ch]', if possible, from existing .[ch]
828abc0ccfSmrg  flex         create 'lex.yy.c', if possible, from existing .c
837a0395d0Smrg  help2man     touch the output file
848abc0ccfSmrg  lex          create 'lex.yy.c', if possible, from existing .c
857a0395d0Smrg  makeinfo     touch the output file
868abc0ccfSmrg  yacc         create 'y.tab.[ch]', if possible, from existing .[ch]
877a0395d0Smrg
888abc0ccfSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
898abc0ccfSmrg'g' are ignored when checking the name.
907366012aSmrg
917a0395d0SmrgSend bug reports to <bug-automake@gnu.org>."
927a0395d0Smrg    exit $?
937a0395d0Smrg    ;;
947a0395d0Smrg
957a0395d0Smrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
967a0395d0Smrg    echo "missing $scriptversion (GNU Automake)"
977a0395d0Smrg    exit $?
987a0395d0Smrg    ;;
997a0395d0Smrg
1007a0395d0Smrg  -*)
1018abc0ccfSmrg    echo 1>&2 "$0: Unknown '$1' option"
1028abc0ccfSmrg    echo 1>&2 "Try '$0 --help' for more information"
1037a0395d0Smrg    exit 1
1047a0395d0Smrg    ;;
1057a0395d0Smrg
1067a0395d0Smrgesac
1077a0395d0Smrg
1087366012aSmrg# normalize program name to check for.
1097366012aSmrgprogram=`echo "$1" | sed '
1107366012aSmrg  s/^gnu-//; t
1117366012aSmrg  s/^gnu//; t
1127366012aSmrg  s/^g//; t'`
1137366012aSmrg
1147a0395d0Smrg# Now exit if we have it, but it failed.  Also exit now if we
1157a0395d0Smrg# don't have it and --version was passed (most likely to detect
1167366012aSmrg# the program).  This is about non-GNU programs, so use $1 not
1177366012aSmrg# $program.
1187a0395d0Smrgcase $1 in
1197366012aSmrg  lex*|yacc*)
1207a0395d0Smrg    # Not GNU programs, they don't have --version.
1217a0395d0Smrg    ;;
1227a0395d0Smrg
1237a0395d0Smrg  *)
1247a0395d0Smrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1257a0395d0Smrg       # We have it, but it failed.
1267a0395d0Smrg       exit 1
1277a0395d0Smrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1287a0395d0Smrg       # Could not run --version or --help.  This is probably someone
1298abc0ccfSmrg       # running '$TOOL --version' or '$TOOL --help' to check whether
1307a0395d0Smrg       # $TOOL exists and not knowing $TOOL uses missing.
1317a0395d0Smrg       exit 1
1327a0395d0Smrg    fi
1337a0395d0Smrg    ;;
1347a0395d0Smrgesac
1357a0395d0Smrg
1367a0395d0Smrg# If it does not exist, or fails to run (possibly an outdated version),
1377a0395d0Smrg# try to emulate it.
1387366012aSmrgcase $program in
1397a0395d0Smrg  aclocal*)
1407a0395d0Smrg    echo 1>&2 "\
1418abc0ccfSmrgWARNING: '$1' is $msg.  You should only need it if
1428abc0ccfSmrg         you modified 'acinclude.m4' or '${configure_ac}'.  You might want
1438abc0ccfSmrg         to install the Automake and Perl packages.  Grab them from
1447a0395d0Smrg         any GNU archive site."
1457a0395d0Smrg    touch aclocal.m4
1467a0395d0Smrg    ;;
1477a0395d0Smrg
1487366012aSmrg  autoconf*)
1497a0395d0Smrg    echo 1>&2 "\
1508abc0ccfSmrgWARNING: '$1' is $msg.  You should only need it if
1518abc0ccfSmrg         you modified '${configure_ac}'.  You might want to install the
1528abc0ccfSmrg         Autoconf and GNU m4 packages.  Grab them from any GNU
1537a0395d0Smrg         archive site."
1547a0395d0Smrg    touch configure
1557a0395d0Smrg    ;;
1567a0395d0Smrg
1577366012aSmrg  autoheader*)
1587a0395d0Smrg    echo 1>&2 "\
1598abc0ccfSmrgWARNING: '$1' is $msg.  You should only need it if
1608abc0ccfSmrg         you modified 'acconfig.h' or '${configure_ac}'.  You might want
1618abc0ccfSmrg         to install the Autoconf and GNU m4 packages.  Grab them
1627a0395d0Smrg         from any GNU archive site."
1637a0395d0Smrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1647a0395d0Smrg    test -z "$files" && files="config.h"
1657a0395d0Smrg    touch_files=
1667a0395d0Smrg    for f in $files; do
1677a0395d0Smrg      case $f in
1687a0395d0Smrg      *:*) touch_files="$touch_files "`echo "$f" |
1697a0395d0Smrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1707a0395d0Smrg      *) touch_files="$touch_files $f.in";;
1717a0395d0Smrg      esac
1727a0395d0Smrg    done
1737a0395d0Smrg    touch $touch_files
1747a0395d0Smrg    ;;
1757a0395d0Smrg
1767a0395d0Smrg  automake*)
1777a0395d0Smrg    echo 1>&2 "\
1788abc0ccfSmrgWARNING: '$1' is $msg.  You should only need it if
1798abc0ccfSmrg         you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
1808abc0ccfSmrg         You might want to install the Automake and Perl packages.
1817a0395d0Smrg         Grab them from any GNU archive site."
1827a0395d0Smrg    find . -type f -name Makefile.am -print |
1837a0395d0Smrg	   sed 's/\.am$/.in/' |
1847a0395d0Smrg	   while read f; do touch "$f"; done
1857a0395d0Smrg    ;;
1867a0395d0Smrg
1877366012aSmrg  autom4te*)
1887a0395d0Smrg    echo 1>&2 "\
1898abc0ccfSmrgWARNING: '$1' is needed, but is $msg.
1907a0395d0Smrg         You might have modified some files without having the
1917a0395d0Smrg         proper tools for further handling them.
1928abc0ccfSmrg         You can get '$1' as part of Autoconf from any GNU
1937a0395d0Smrg         archive site."
1947a0395d0Smrg
1957a0395d0Smrg    file=`echo "$*" | sed -n "$sed_output"`
1967a0395d0Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
1977a0395d0Smrg    if test -f "$file"; then
1987a0395d0Smrg	touch $file
1997a0395d0Smrg    else
2007a0395d0Smrg	test -z "$file" || exec >$file
2017a0395d0Smrg	echo "#! /bin/sh"
2027a0395d0Smrg	echo "# Created by GNU Automake missing as a replacement of"
2037a0395d0Smrg	echo "#  $ $@"
2047a0395d0Smrg	echo "exit 0"
2057a0395d0Smrg	chmod +x $file
2067a0395d0Smrg	exit 1
2077a0395d0Smrg    fi
2087a0395d0Smrg    ;;
2097a0395d0Smrg
2107366012aSmrg  bison*|yacc*)
2117a0395d0Smrg    echo 1>&2 "\
2128abc0ccfSmrgWARNING: '$1' $msg.  You should only need it if
2138abc0ccfSmrg         you modified a '.y' file.  You may need the Bison package
2147a0395d0Smrg         in order for those modifications to take effect.  You can get
2158abc0ccfSmrg         Bison from any GNU archive site."
2167a0395d0Smrg    rm -f y.tab.c y.tab.h
2177a0395d0Smrg    if test $# -ne 1; then
2188abc0ccfSmrg        eval LASTARG=\${$#}
2197a0395d0Smrg	case $LASTARG in
2207a0395d0Smrg	*.y)
2217a0395d0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2227a0395d0Smrg	    if test -f "$SRCFILE"; then
2237a0395d0Smrg	         cp "$SRCFILE" y.tab.c
2247a0395d0Smrg	    fi
2257a0395d0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2267a0395d0Smrg	    if test -f "$SRCFILE"; then
2277a0395d0Smrg	         cp "$SRCFILE" y.tab.h
2287a0395d0Smrg	    fi
2297a0395d0Smrg	  ;;
2307a0395d0Smrg	esac
2317a0395d0Smrg    fi
2327a0395d0Smrg    if test ! -f y.tab.h; then
2337a0395d0Smrg	echo >y.tab.h
2347a0395d0Smrg    fi
2357a0395d0Smrg    if test ! -f y.tab.c; then
2367a0395d0Smrg	echo 'main() { return 0; }' >y.tab.c
2377a0395d0Smrg    fi
2387a0395d0Smrg    ;;
2397a0395d0Smrg
2407366012aSmrg  lex*|flex*)
2417a0395d0Smrg    echo 1>&2 "\
2428abc0ccfSmrgWARNING: '$1' is $msg.  You should only need it if
2438abc0ccfSmrg         you modified a '.l' file.  You may need the Flex package
2447a0395d0Smrg         in order for those modifications to take effect.  You can get
2458abc0ccfSmrg         Flex from any GNU archive site."
2467a0395d0Smrg    rm -f lex.yy.c
2477a0395d0Smrg    if test $# -ne 1; then
2488abc0ccfSmrg        eval LASTARG=\${$#}
2497a0395d0Smrg	case $LASTARG in
2507a0395d0Smrg	*.l)
2517a0395d0Smrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2527a0395d0Smrg	    if test -f "$SRCFILE"; then
2537a0395d0Smrg	         cp "$SRCFILE" lex.yy.c
2547a0395d0Smrg	    fi
2557a0395d0Smrg	  ;;
2567a0395d0Smrg	esac
2577a0395d0Smrg    fi
2587a0395d0Smrg    if test ! -f lex.yy.c; then
2597a0395d0Smrg	echo 'main() { return 0; }' >lex.yy.c
2607a0395d0Smrg    fi
2617a0395d0Smrg    ;;
2627a0395d0Smrg
2637366012aSmrg  help2man*)
2647a0395d0Smrg    echo 1>&2 "\
2658abc0ccfSmrgWARNING: '$1' is $msg.  You should only need it if
2667a0395d0Smrg	 you modified a dependency of a manual page.  You may need the
2678abc0ccfSmrg	 Help2man package in order for those modifications to take
2688abc0ccfSmrg	 effect.  You can get Help2man from any GNU archive site."
2697a0395d0Smrg
2707a0395d0Smrg    file=`echo "$*" | sed -n "$sed_output"`
2717a0395d0Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2727a0395d0Smrg    if test -f "$file"; then
2737a0395d0Smrg	touch $file
2747a0395d0Smrg    else
2757a0395d0Smrg	test -z "$file" || exec >$file
2767a0395d0Smrg	echo ".ab help2man is required to generate this page"
2777366012aSmrg	exit $?
2787a0395d0Smrg    fi
2797a0395d0Smrg    ;;
2807a0395d0Smrg
2817366012aSmrg  makeinfo*)
2827a0395d0Smrg    echo 1>&2 "\
2838abc0ccfSmrgWARNING: '$1' is $msg.  You should only need it if
2848abc0ccfSmrg         you modified a '.texi' or '.texinfo' file, or any other file
2857a0395d0Smrg         indirectly affecting the aspect of the manual.  The spurious
2868abc0ccfSmrg         call might also be the consequence of using a buggy 'make' (AIX,
2878abc0ccfSmrg         DU, IRIX).  You might want to install the Texinfo package or
2888abc0ccfSmrg         the GNU make package.  Grab either from any GNU archive site."
2897a0395d0Smrg    # The file to touch is that specified with -o ...
2907a0395d0Smrg    file=`echo "$*" | sed -n "$sed_output"`
2917a0395d0Smrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2927a0395d0Smrg    if test -z "$file"; then
2937a0395d0Smrg      # ... or it is the one specified with @setfilename ...
2947a0395d0Smrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2957a0395d0Smrg      file=`sed -n '
2967a0395d0Smrg	/^@setfilename/{
2977a0395d0Smrg	  s/.* \([^ ]*\) *$/\1/
2987a0395d0Smrg	  p
2997a0395d0Smrg	  q
3007a0395d0Smrg	}' $infile`
3017a0395d0Smrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3027a0395d0Smrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3037a0395d0Smrg    fi
3047a0395d0Smrg    # If the file does not exist, the user really needs makeinfo;
3057a0395d0Smrg    # let's fail without touching anything.
3067a0395d0Smrg    test -f $file || exit 1
3077a0395d0Smrg    touch $file
3087a0395d0Smrg    ;;
3097a0395d0Smrg
3107a0395d0Smrg  *)
3117a0395d0Smrg    echo 1>&2 "\
3128abc0ccfSmrgWARNING: '$1' is needed, and is $msg.
3137a0395d0Smrg         You might have modified some files without having the
3148abc0ccfSmrg         proper tools for further handling them.  Check the 'README' file,
3157a0395d0Smrg         it often tells you about the needed prerequisites for installing
3167a0395d0Smrg         this package.  You may also peek at any GNU archive site, in case
3178abc0ccfSmrg         some other package would contain this missing '$1' program."
3187a0395d0Smrg    exit 1
3197a0395d0Smrg    ;;
3207a0395d0Smrgesac
3217a0395d0Smrg
3227a0395d0Smrgexit 0
3237a0395d0Smrg
3247a0395d0Smrg# Local variables:
3257a0395d0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3267a0395d0Smrg# time-stamp-start: "scriptversion="
3277a0395d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3287366012aSmrg# time-stamp-time-zone: "UTC"
3297366012aSmrg# time-stamp-end: "; # UTC"
3307a0395d0Smrg# End:
331