Imported from ../bash-4.0-rc1.tar.gz.
[platform/upstream/bash.git] / support / missing
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 3 of the License, or
9 #   (at your option) 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, see <http://www.gnu.org/licenses/>.
18 #
19
20 if test $# -eq 0; then
21   echo 1>&2 "Try \`$0 --help' for more information"
22   exit 1
23 fi
24
25 case "$1" in
26
27   -h|--h|--he|--hel|--help)
28     echo "\
29 $0 [OPTION]... PROGRAM [ARGUMENT]...
30
31 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
32 error status if there is no known handling for PROGRAM.
33
34 Options:
35   -h, --help      display this help and exit
36   -v, --version   output version information and exit
37
38 Supported PROGRAM values:
39   aclocal      touch file \`aclocal.m4'
40   autoconf     touch file \`configure'
41   autoheader   touch file \`config.h.in'
42   automake     touch all \`Makefile.in' files
43   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
44   flex         create \`lex.yy.c', if possible, from existing .c
45   lex          create \`lex.yy.c', if possible, from existing .c
46   makeinfo     touch the output file
47   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
48     ;;
49
50   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
51     echo "missing - GNU libit 0.0"
52     ;;
53
54   -*)
55     echo 1>&2 "$0: Unknown \`$1' option"
56     echo 1>&2 "Try \`$0 --help' for more information"
57     exit 1
58     ;;
59
60   aclocal)
61     echo 1>&2 "\
62 WARNING: \`$1' is missing on your system.  You should only need it if
63          you modified \`acinclude.m4' or \`configure.in'.  You might want
64          to install the \`Automake' and \`Perl' packages.  Grab them from
65          any GNU archive site."
66     touch aclocal.m4
67     ;;
68
69   autoconf)
70     echo 1>&2 "\
71 WARNING: \`$1' is missing on your system.  You should only need it if
72          you modified \`configure.in'.  You might want to install the
73          \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
74          archive site."
75     touch configure
76     ;;
77
78   autoheader)
79     echo 1>&2 "\
80 WARNING: \`$1' is missing on your system.  You should only need it if
81          you modified \`acconfig.h' or \`configure.in'.  You might want
82          to install the \`Autoconf' and \`GNU m4' packages.  Grab them
83          from any GNU archive site."
84     files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in`
85     if test -z "$files"; then
86       files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in`
87       test -z "$files" || files="$files.in"
88     else
89       files=`echo "$files" | sed -e 's/:/ /g'`
90     fi
91     test -z "$files" && files="config.h.in"
92     touch $files
93     ;;
94
95   automake)
96     echo 1>&2 "\
97 WARNING: \`$1' is missing on your system.  You should only need it if
98          you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
99          You might want to install the \`Automake' and \`Perl' packages.
100          Grab them from any GNU archive site."
101     find . -type f -name Makefile.am -print \
102       | sed 's/^\(.*\).am$/touch \1.in/' \
103       | sh
104     ;;
105
106   bison|yacc)
107     echo 1>&2 "\
108 WARNING: \`$1' is missing on your system.  You should only need it if
109          you modified a \`.y' file.  You may need the \`Bison' package
110          in order for those modifications to take effect.  You can get
111          \`Bison' from any GNU archive site."
112     rm -f y.tab.c y.tab.h
113     if [ $# -ne 1 ]; then
114         eval LASTARG="\${$#}"
115         case "$LASTARG" in
116         *.y)
117             SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
118             if [ -f "$SRCFILE" ]; then
119                  cp "$SRCFILE" y.tab.c
120             fi
121             SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
122             if [ -f "$SRCFILE" ]; then
123                  cp "$SRCFILE" y.tab.h
124             fi
125           ;;
126         esac
127     fi
128     if [ ! -f y.tab.h ]; then
129         echo >y.tab.h
130     fi
131     if [ ! -f y.tab.c ]; then
132         echo 'main() { return 0; }' >y.tab.c
133     fi
134     ;;
135
136   lex|flex)
137     echo 1>&2 "\
138 WARNING: \`$1' is missing on your system.  You should only need it if
139          you modified a \`.l' file.  You may need the \`Flex' package
140          in order for those modifications to take effect.  You can get
141          \`Flex' from any GNU archive site."
142     rm -f lex.yy.c
143     if [ $# -ne 1 ]; then
144         eval LASTARG="\${$#}"
145         case "$LASTARG" in
146         *.l)
147             SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
148             if [ -f "$SRCFILE" ]; then
149                  cp "$SRCFILE" lex.yy.c
150             fi
151           ;;
152         esac
153     fi
154     if [ ! -f lex.yy.c ]; then
155         echo 'main() { return 0; }' >lex.yy.c
156     fi
157     ;;
158
159   makeinfo)
160     echo 1>&2 "\
161 WARNING: \`$1' is missing on your system.  You should only need it if
162          you modified a \`.texi' or \`.texinfo' file, or any other file
163          indirectly affecting the aspect of the manual.  The spurious
164          call might also be the consequence of using a buggy \`make' (AIX,
165          DU, IRIX).  You might want to install the \`Texinfo' package or
166          the \`GNU make' package.  Grab either from any GNU archive site."
167     file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
168     if test -z "$file"; then
169       file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
170       file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
171     fi
172     touch $file
173     ;;
174
175   *)
176     echo 1>&2 "\
177 WARNING: \`$1' is needed, and you do not seem to have it handy on your
178          system.  You might have modified some files without having the
179          proper tools for further handling them.  Check the \`README' file,
180          it often tells you about the needed prerequirements for installing
181          this package.  You may also peek at any GNU archive site, in case
182          some other package would contain this missing \`$1' program."
183     exit 1
184     ;;
185 esac
186
187 exit 0