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