1#! /bin/sh
2# Common stub for a few missing GNU programs while installing.
3# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
4# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19# 02111-1307, USA.
20
21if test $# -eq 0; then
22  echo 1>&2 "Try \`$0 --help' for more information"
23  exit 1
24fi
25
26case "$1" in
27
28  -h|--h|--he|--hel|--help)
29    echo "\
30$0 [OPTION]... PROGRAM [ARGUMENT]...
31
32Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
33error status if there is no known handling for PROGRAM.
34
35Options:
36  -h, --help      display this help and exit
37  -v, --version   output version information and exit
38
39Supported PROGRAM values:
40  aclocal      touch file \`aclocal.m4'
41  autoconf     touch file \`configure'
42  autoheader   touch file \`config.h.in'
43  automake     touch all \`Makefile.in' files
44  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
45  flex         create \`lex.yy.c', if possible, from existing .c
46  lex          create \`lex.yy.c', if possible, from existing .c
47  makeinfo     touch the output file
48  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
49    ;;
50
51  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
52    echo "missing - GNU libit 0.0"
53    ;;
54
55  -*)
56    echo 1>&2 "$0: Unknown \`$1' option"
57    echo 1>&2 "Try \`$0 --help' for more information"
58    exit 1
59    ;;
60
61  aclocal)
62    echo 1>&2 "\
63WARNING: \`$1' is missing on your system.  You should only need it if
64         you modified \`acinclude.m4' or \`configure.in'.  You might want
65         to install the \`Automake' and \`Perl' packages.  Grab them from
66         any GNU archive site."
67    touch aclocal.m4
68    ;;
69
70  autoconf)
71    echo 1>&2 "\
72WARNING: \`$1' is missing on your system.  You should only need it if
73         you modified \`configure.in'.  You might want to install the
74         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
75         archive site."
76    touch configure
77    ;;
78
79  autoheader)
80    echo 1>&2 "\
81WARNING: \`$1' is missing on your system.  You should only need it if
82         you modified \`acconfig.h' or \`configure.in'.  You might want
83         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
84         from any GNU archive site."
85    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
86    test -z "$files" && files="config.h"
87    touch_files=
88    for f in $files; do
89      case "$f" in
90      *:*) touch_files="$touch_files "`echo "$f" |
91				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
92      *) touch_files="$touch_files $f.in";;
93      esac
94    done
95    touch $touch_files
96    ;;
97
98  automake)
99    echo 1>&2 "\
100WARNING: \`$1' is missing on your system.  You should only need it if
101         you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
102         You might want to install the \`Automake' and \`Perl' packages.
103         Grab them from any GNU archive site."
104    find . -type f -name Makefile.am -print |
105	   sed 's/\.am$/.in/' |
106	   while read f; do touch "$f"; done
107    ;;
108
109  bison|yacc)
110    echo 1>&2 "\
111WARNING: \`$1' is missing on your system.  You should only need it if
112         you modified a \`.y' file.  You may need the \`Bison' package
113         in order for those modifications to take effect.  You can get
114         \`Bison' from any GNU archive site."
115    rm -f y.tab.c y.tab.h
116    if [ $# -ne 1 ]; then
117        eval LASTARG="\${$#}"
118	case "$LASTARG" in
119	*.y)
120	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
121	    if [ -f "$SRCFILE" ]; then
122	         cp "$SRCFILE" y.tab.c
123	    fi
124	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
125	    if [ -f "$SRCFILE" ]; then
126	         cp "$SRCFILE" y.tab.h
127	    fi
128	  ;;
129	esac
130    fi
131    if [ ! -f y.tab.h ]; then
132	echo >y.tab.h
133    fi
134    if [ ! -f y.tab.c ]; then
135	echo 'main() { return 0; }' >y.tab.c
136    fi
137    ;;
138
139  lex|flex)
140    echo 1>&2 "\
141WARNING: \`$1' is missing on your system.  You should only need it if
142         you modified a \`.l' file.  You may need the \`Flex' package
143         in order for those modifications to take effect.  You can get
144         \`Flex' from any GNU archive site."
145    rm -f lex.yy.c
146    if [ $# -ne 1 ]; then
147        eval LASTARG="\${$#}"
148	case "$LASTARG" in
149	*.l)
150	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
151	    if [ -f "$SRCFILE" ]; then
152	         cp "$SRCFILE" lex.yy.c
153	    fi
154	  ;;
155	esac
156    fi
157    if [ ! -f lex.yy.c ]; then
158	echo 'main() { return 0; }' >lex.yy.c
159    fi
160    ;;
161
162  makeinfo)
163    echo 1>&2 "\
164WARNING: \`$1' is missing on your system.  You should only need it if
165         you modified a \`.texi' or \`.texinfo' file, or any other file
166         indirectly affecting the aspect of the manual.  The spurious
167         call might also be the consequence of using a buggy \`make' (AIX,
168         DU, IRIX).  You might want to install the \`Texinfo' package or
169         the \`GNU make' package.  Grab either from any GNU archive site."
170    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
171    if test -z "$file"; then
172      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
173      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
174    fi
175    touch $file
176    ;;
177
178  *)
179    echo 1>&2 "\
180WARNING: \`$1' is needed, and you do not seem to have it handy on your
181         system.  You might have modified some files without having the
182         proper tools for further handling them.  Check the \`README' file,
183         it often tells you about the needed prerequirements for installing
184         this package.  You may also peek at any GNU archive site, in case
185         some other package would contain this missing \`$1' program."
186    exit 1
187    ;;
188esac
189
190exit 0
191