missing revision 0da4cdcc
19bd41f2cSmrg#! /bin/sh
29bd41f2cSmrg# Common stub for a few missing GNU programs while installing.
39bd41f2cSmrg
40da4cdccSmrgscriptversion=2012-01-06.13; # UTC
59bd41f2cSmrg
60da4cdccSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
70da4cdccSmrg# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
89bd41f2cSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
99bd41f2cSmrg
109bd41f2cSmrg# This program is free software; you can redistribute it and/or modify
119bd41f2cSmrg# it under the terms of the GNU General Public License as published by
129bd41f2cSmrg# the Free Software Foundation; either version 2, or (at your option)
139bd41f2cSmrg# any later version.
149bd41f2cSmrg
159bd41f2cSmrg# This program is distributed in the hope that it will be useful,
169bd41f2cSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of
179bd41f2cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
189bd41f2cSmrg# GNU General Public License for more details.
199bd41f2cSmrg
209bd41f2cSmrg# You should have received a copy of the GNU General Public License
210da4cdccSmrg# along with this program.  If not, see <http://www.gnu.org/licenses/>.
229bd41f2cSmrg
239bd41f2cSmrg# As a special exception to the GNU General Public License, if you
249bd41f2cSmrg# distribute this file as part of a program that contains a
259bd41f2cSmrg# configuration script generated by Autoconf, you may include it under
269bd41f2cSmrg# the same distribution terms that you use for the rest of that program.
279bd41f2cSmrg
289bd41f2cSmrgif test $# -eq 0; then
299bd41f2cSmrg  echo 1>&2 "Try \`$0 --help' for more information"
309bd41f2cSmrg  exit 1
319bd41f2cSmrgfi
329bd41f2cSmrg
339bd41f2cSmrgrun=:
349418810dSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
359418810dSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p'
369bd41f2cSmrg
379bd41f2cSmrg# In the cases where this matters, `missing' is being run in the
389bd41f2cSmrg# srcdir already.
399bd41f2cSmrgif test -f configure.ac; then
409bd41f2cSmrg  configure_ac=configure.ac
419bd41f2cSmrgelse
429bd41f2cSmrg  configure_ac=configure.in
439bd41f2cSmrgfi
449bd41f2cSmrg
459bd41f2cSmrgmsg="missing on your system"
469bd41f2cSmrg
479418810dSmrgcase $1 in
489bd41f2cSmrg--run)
499bd41f2cSmrg  # Try to run requested program, and just exit if it succeeds.
509bd41f2cSmrg  run=
519bd41f2cSmrg  shift
529bd41f2cSmrg  "$@" && exit 0
539bd41f2cSmrg  # Exit code 63 means version mismatch.  This often happens
549bd41f2cSmrg  # when the user try to use an ancient version of a tool on
559bd41f2cSmrg  # a file that requires a minimum version.  In this case we
569bd41f2cSmrg  # we should proceed has if the program had been absent, or
579bd41f2cSmrg  # if --run hadn't been passed.
589bd41f2cSmrg  if test $? = 63; then
599bd41f2cSmrg    run=:
609bd41f2cSmrg    msg="probably too old"
619bd41f2cSmrg  fi
629bd41f2cSmrg  ;;
639bd41f2cSmrg
649bd41f2cSmrg  -h|--h|--he|--hel|--help)
659bd41f2cSmrg    echo "\
669bd41f2cSmrg$0 [OPTION]... PROGRAM [ARGUMENT]...
679bd41f2cSmrg
689bd41f2cSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
699bd41f2cSmrgerror status if there is no known handling for PROGRAM.
709bd41f2cSmrg
719bd41f2cSmrgOptions:
729bd41f2cSmrg  -h, --help      display this help and exit
739bd41f2cSmrg  -v, --version   output version information and exit
749bd41f2cSmrg  --run           try to run the given command, and emulate it if it fails
759bd41f2cSmrg
769bd41f2cSmrgSupported PROGRAM values:
779bd41f2cSmrg  aclocal      touch file \`aclocal.m4'
789bd41f2cSmrg  autoconf     touch file \`configure'
799bd41f2cSmrg  autoheader   touch file \`config.h.in'
809418810dSmrg  autom4te     touch the output file, or create a stub one
819bd41f2cSmrg  automake     touch all \`Makefile.in' files
829bd41f2cSmrg  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
839bd41f2cSmrg  flex         create \`lex.yy.c', if possible, from existing .c
849bd41f2cSmrg  help2man     touch the output file
859bd41f2cSmrg  lex          create \`lex.yy.c', if possible, from existing .c
869bd41f2cSmrg  makeinfo     touch the output file
879bd41f2cSmrg  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
889bd41f2cSmrg
890da4cdccSmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
900da4cdccSmrg\`g' are ignored when checking the name.
910da4cdccSmrg
929bd41f2cSmrgSend bug reports to <bug-automake@gnu.org>."
939bd41f2cSmrg    exit $?
949bd41f2cSmrg    ;;
959bd41f2cSmrg
969bd41f2cSmrg  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
979bd41f2cSmrg    echo "missing $scriptversion (GNU Automake)"
989bd41f2cSmrg    exit $?
999bd41f2cSmrg    ;;
1009bd41f2cSmrg
1019bd41f2cSmrg  -*)
1029bd41f2cSmrg    echo 1>&2 "$0: Unknown \`$1' option"
1039bd41f2cSmrg    echo 1>&2 "Try \`$0 --help' for more information"
1049bd41f2cSmrg    exit 1
1059bd41f2cSmrg    ;;
1069bd41f2cSmrg
1079bd41f2cSmrgesac
1089bd41f2cSmrg
1090da4cdccSmrg# normalize program name to check for.
1100da4cdccSmrgprogram=`echo "$1" | sed '
1110da4cdccSmrg  s/^gnu-//; t
1120da4cdccSmrg  s/^gnu//; t
1130da4cdccSmrg  s/^g//; t'`
1140da4cdccSmrg
1159bd41f2cSmrg# Now exit if we have it, but it failed.  Also exit now if we
1169bd41f2cSmrg# don't have it and --version was passed (most likely to detect
1170da4cdccSmrg# the program).  This is about non-GNU programs, so use $1 not
1180da4cdccSmrg# $program.
1199418810dSmrgcase $1 in
1200da4cdccSmrg  lex*|yacc*)
1219bd41f2cSmrg    # Not GNU programs, they don't have --version.
1229bd41f2cSmrg    ;;
1239bd41f2cSmrg
1249bd41f2cSmrg  *)
1259bd41f2cSmrg    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
1269bd41f2cSmrg       # We have it, but it failed.
1279bd41f2cSmrg       exit 1
1289bd41f2cSmrg    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
1299bd41f2cSmrg       # Could not run --version or --help.  This is probably someone
1309bd41f2cSmrg       # running `$TOOL --version' or `$TOOL --help' to check whether
1319bd41f2cSmrg       # $TOOL exists and not knowing $TOOL uses missing.
1329bd41f2cSmrg       exit 1
1339bd41f2cSmrg    fi
1349bd41f2cSmrg    ;;
1359bd41f2cSmrgesac
1369bd41f2cSmrg
1379bd41f2cSmrg# If it does not exist, or fails to run (possibly an outdated version),
1389bd41f2cSmrg# try to emulate it.
1390da4cdccSmrgcase $program in
1409bd41f2cSmrg  aclocal*)
1419bd41f2cSmrg    echo 1>&2 "\
1429bd41f2cSmrgWARNING: \`$1' is $msg.  You should only need it if
1439bd41f2cSmrg         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
1449bd41f2cSmrg         to install the \`Automake' and \`Perl' packages.  Grab them from
1459bd41f2cSmrg         any GNU archive site."
1469bd41f2cSmrg    touch aclocal.m4
1479bd41f2cSmrg    ;;
1489bd41f2cSmrg
1490da4cdccSmrg  autoconf*)
1509bd41f2cSmrg    echo 1>&2 "\
1519bd41f2cSmrgWARNING: \`$1' is $msg.  You should only need it if
1529bd41f2cSmrg         you modified \`${configure_ac}'.  You might want to install the
1539bd41f2cSmrg         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
1549bd41f2cSmrg         archive site."
1559bd41f2cSmrg    touch configure
1569bd41f2cSmrg    ;;
1579bd41f2cSmrg
1580da4cdccSmrg  autoheader*)
1599bd41f2cSmrg    echo 1>&2 "\
1609bd41f2cSmrgWARNING: \`$1' is $msg.  You should only need it if
1619bd41f2cSmrg         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
1629bd41f2cSmrg         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
1639bd41f2cSmrg         from any GNU archive site."
1649bd41f2cSmrg    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
1659bd41f2cSmrg    test -z "$files" && files="config.h"
1669bd41f2cSmrg    touch_files=
1679bd41f2cSmrg    for f in $files; do
1689418810dSmrg      case $f in
1699bd41f2cSmrg      *:*) touch_files="$touch_files "`echo "$f" |
1709bd41f2cSmrg				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
1719bd41f2cSmrg      *) touch_files="$touch_files $f.in";;
1729bd41f2cSmrg      esac
1739bd41f2cSmrg    done
1749bd41f2cSmrg    touch $touch_files
1759bd41f2cSmrg    ;;
1769bd41f2cSmrg
1779bd41f2cSmrg  automake*)
1789bd41f2cSmrg    echo 1>&2 "\
1799bd41f2cSmrgWARNING: \`$1' is $msg.  You should only need it if
1809bd41f2cSmrg         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
1819bd41f2cSmrg         You might want to install the \`Automake' and \`Perl' packages.
1829bd41f2cSmrg         Grab them from any GNU archive site."
1839bd41f2cSmrg    find . -type f -name Makefile.am -print |
1849bd41f2cSmrg	   sed 's/\.am$/.in/' |
1859bd41f2cSmrg	   while read f; do touch "$f"; done
1869bd41f2cSmrg    ;;
1879bd41f2cSmrg
1880da4cdccSmrg  autom4te*)
1899bd41f2cSmrg    echo 1>&2 "\
1909bd41f2cSmrgWARNING: \`$1' is needed, but is $msg.
1919bd41f2cSmrg         You might have modified some files without having the
1929bd41f2cSmrg         proper tools for further handling them.
1939bd41f2cSmrg         You can get \`$1' as part of \`Autoconf' from any GNU
1949bd41f2cSmrg         archive site."
1959bd41f2cSmrg
1969418810dSmrg    file=`echo "$*" | sed -n "$sed_output"`
1979418810dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
1989bd41f2cSmrg    if test -f "$file"; then
1999bd41f2cSmrg	touch $file
2009bd41f2cSmrg    else
2019bd41f2cSmrg	test -z "$file" || exec >$file
2029bd41f2cSmrg	echo "#! /bin/sh"
2039bd41f2cSmrg	echo "# Created by GNU Automake missing as a replacement of"
2049bd41f2cSmrg	echo "#  $ $@"
2059bd41f2cSmrg	echo "exit 0"
2069bd41f2cSmrg	chmod +x $file
2079bd41f2cSmrg	exit 1
2089bd41f2cSmrg    fi
2099bd41f2cSmrg    ;;
2109bd41f2cSmrg
2110da4cdccSmrg  bison*|yacc*)
2129bd41f2cSmrg    echo 1>&2 "\
2139bd41f2cSmrgWARNING: \`$1' $msg.  You should only need it if
2149bd41f2cSmrg         you modified a \`.y' file.  You may need the \`Bison' package
2159bd41f2cSmrg         in order for those modifications to take effect.  You can get
2169bd41f2cSmrg         \`Bison' from any GNU archive site."
2179bd41f2cSmrg    rm -f y.tab.c y.tab.h
2189418810dSmrg    if test $# -ne 1; then
2190da4cdccSmrg        eval LASTARG=\${$#}
2209418810dSmrg	case $LASTARG in
2219bd41f2cSmrg	*.y)
2229bd41f2cSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
2239418810dSmrg	    if test -f "$SRCFILE"; then
2249bd41f2cSmrg	         cp "$SRCFILE" y.tab.c
2259bd41f2cSmrg	    fi
2269bd41f2cSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
2279418810dSmrg	    if test -f "$SRCFILE"; then
2289bd41f2cSmrg	         cp "$SRCFILE" y.tab.h
2299bd41f2cSmrg	    fi
2309bd41f2cSmrg	  ;;
2319bd41f2cSmrg	esac
2329bd41f2cSmrg    fi
2339418810dSmrg    if test ! -f y.tab.h; then
2349bd41f2cSmrg	echo >y.tab.h
2359bd41f2cSmrg    fi
2369418810dSmrg    if test ! -f y.tab.c; then
2379bd41f2cSmrg	echo 'main() { return 0; }' >y.tab.c
2389bd41f2cSmrg    fi
2399bd41f2cSmrg    ;;
2409bd41f2cSmrg
2410da4cdccSmrg  lex*|flex*)
2429bd41f2cSmrg    echo 1>&2 "\
2439bd41f2cSmrgWARNING: \`$1' is $msg.  You should only need it if
2449bd41f2cSmrg         you modified a \`.l' file.  You may need the \`Flex' package
2459bd41f2cSmrg         in order for those modifications to take effect.  You can get
2469bd41f2cSmrg         \`Flex' from any GNU archive site."
2479bd41f2cSmrg    rm -f lex.yy.c
2489418810dSmrg    if test $# -ne 1; then
2490da4cdccSmrg        eval LASTARG=\${$#}
2509418810dSmrg	case $LASTARG in
2519bd41f2cSmrg	*.l)
2529bd41f2cSmrg	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
2539418810dSmrg	    if test -f "$SRCFILE"; then
2549bd41f2cSmrg	         cp "$SRCFILE" lex.yy.c
2559bd41f2cSmrg	    fi
2569bd41f2cSmrg	  ;;
2579bd41f2cSmrg	esac
2589bd41f2cSmrg    fi
2599418810dSmrg    if test ! -f lex.yy.c; then
2609bd41f2cSmrg	echo 'main() { return 0; }' >lex.yy.c
2619bd41f2cSmrg    fi
2629bd41f2cSmrg    ;;
2639bd41f2cSmrg
2640da4cdccSmrg  help2man*)
2659bd41f2cSmrg    echo 1>&2 "\
2669bd41f2cSmrgWARNING: \`$1' is $msg.  You should only need it if
2679bd41f2cSmrg	 you modified a dependency of a manual page.  You may need the
2689bd41f2cSmrg	 \`Help2man' package in order for those modifications to take
2699bd41f2cSmrg	 effect.  You can get \`Help2man' from any GNU archive site."
2709bd41f2cSmrg
2719418810dSmrg    file=`echo "$*" | sed -n "$sed_output"`
2729418810dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2739418810dSmrg    if test -f "$file"; then
2749bd41f2cSmrg	touch $file
2759bd41f2cSmrg    else
2769bd41f2cSmrg	test -z "$file" || exec >$file
2779bd41f2cSmrg	echo ".ab help2man is required to generate this page"
2780da4cdccSmrg	exit $?
2799bd41f2cSmrg    fi
2809bd41f2cSmrg    ;;
2819bd41f2cSmrg
2820da4cdccSmrg  makeinfo*)
2839bd41f2cSmrg    echo 1>&2 "\
2849bd41f2cSmrgWARNING: \`$1' is $msg.  You should only need it if
2859bd41f2cSmrg         you modified a \`.texi' or \`.texinfo' file, or any other file
2869bd41f2cSmrg         indirectly affecting the aspect of the manual.  The spurious
2879bd41f2cSmrg         call might also be the consequence of using a buggy \`make' (AIX,
2889bd41f2cSmrg         DU, IRIX).  You might want to install the \`Texinfo' package or
2899bd41f2cSmrg         the \`GNU make' package.  Grab either from any GNU archive site."
2909bd41f2cSmrg    # The file to touch is that specified with -o ...
2919418810dSmrg    file=`echo "$*" | sed -n "$sed_output"`
2929418810dSmrg    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
2939bd41f2cSmrg    if test -z "$file"; then
2949bd41f2cSmrg      # ... or it is the one specified with @setfilename ...
2959bd41f2cSmrg      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
2969418810dSmrg      file=`sed -n '
2979418810dSmrg	/^@setfilename/{
2989418810dSmrg	  s/.* \([^ ]*\) *$/\1/
2999418810dSmrg	  p
3009418810dSmrg	  q
3019418810dSmrg	}' $infile`
3029bd41f2cSmrg      # ... or it is derived from the source name (dir/f.texi becomes f.info)
3039bd41f2cSmrg      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
3049bd41f2cSmrg    fi
3059bd41f2cSmrg    # If the file does not exist, the user really needs makeinfo;
3069bd41f2cSmrg    # let's fail without touching anything.
3079bd41f2cSmrg    test -f $file || exit 1
3089bd41f2cSmrg    touch $file
3099bd41f2cSmrg    ;;
3109bd41f2cSmrg
3119bd41f2cSmrg  *)
3129bd41f2cSmrg    echo 1>&2 "\
3139bd41f2cSmrgWARNING: \`$1' is needed, and is $msg.
3149bd41f2cSmrg         You might have modified some files without having the
3159bd41f2cSmrg         proper tools for further handling them.  Check the \`README' file,
3169bd41f2cSmrg         it often tells you about the needed prerequisites for installing
3179bd41f2cSmrg         this package.  You may also peek at any GNU archive site, in case
3189bd41f2cSmrg         some other package would contain this missing \`$1' program."
3199bd41f2cSmrg    exit 1
3209bd41f2cSmrg    ;;
3219bd41f2cSmrgesac
3229bd41f2cSmrg
3239bd41f2cSmrgexit 0
3249bd41f2cSmrg
3259bd41f2cSmrg# Local variables:
3269bd41f2cSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
3279bd41f2cSmrg# time-stamp-start: "scriptversion="
3289bd41f2cSmrg# time-stamp-format: "%:y-%02m-%02d.%02H"
3290da4cdccSmrg# time-stamp-time-zone: "UTC"
3300da4cdccSmrg# time-stamp-end: "; # UTC"
3319bd41f2cSmrg# End:
332