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