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