missing revision 7ce7e03c
1f7ec340bSmacallan#! /bin/sh 2f7ec340bSmacallan# Common stub for a few missing GNU programs while installing. 3f7ec340bSmacallan 47ce7e03cSmrgscriptversion=2006-05-10.23 5f7ec340bSmacallan 67ce7e03cSmrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 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=: 367ce7e03cSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 377ce7e03cSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 38f7ec340bSmacallan 39f7ec340bSmacallan# In the cases where this matters, `missing' is being run in the 40f7ec340bSmacallan# srcdir already. 41f7ec340bSmacallanif test -f configure.ac; then 42f7ec340bSmacallan configure_ac=configure.ac 43f7ec340bSmacallanelse 44f7ec340bSmacallan configure_ac=configure.in 45f7ec340bSmacallanfi 46f7ec340bSmacallan 47f7ec340bSmacallanmsg="missing on your system" 48f7ec340bSmacallan 497ce7e03cSmrgcase $1 in 50f7ec340bSmacallan--run) 51f7ec340bSmacallan # Try to run requested program, and just exit if it succeeds. 52f7ec340bSmacallan run= 53f7ec340bSmacallan shift 54f7ec340bSmacallan "$@" && exit 0 55f7ec340bSmacallan # Exit code 63 means version mismatch. This often happens 56f7ec340bSmacallan # when the user try to use an ancient version of a tool on 57f7ec340bSmacallan # a file that requires a minimum version. In this case we 58f7ec340bSmacallan # we should proceed has if the program had been absent, or 59f7ec340bSmacallan # if --run hadn't been passed. 60f7ec340bSmacallan if test $? = 63; then 61f7ec340bSmacallan run=: 62f7ec340bSmacallan msg="probably too old" 63f7ec340bSmacallan fi 64f7ec340bSmacallan ;; 65f7ec340bSmacallan 66f7ec340bSmacallan -h|--h|--he|--hel|--help) 67f7ec340bSmacallan echo "\ 68f7ec340bSmacallan$0 [OPTION]... PROGRAM [ARGUMENT]... 69f7ec340bSmacallan 70f7ec340bSmacallanHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 71f7ec340bSmacallanerror status if there is no known handling for PROGRAM. 72f7ec340bSmacallan 73f7ec340bSmacallanOptions: 74f7ec340bSmacallan -h, --help display this help and exit 75f7ec340bSmacallan -v, --version output version information and exit 76f7ec340bSmacallan --run try to run the given command, and emulate it if it fails 77f7ec340bSmacallan 78f7ec340bSmacallanSupported PROGRAM values: 79f7ec340bSmacallan aclocal touch file \`aclocal.m4' 80f7ec340bSmacallan autoconf touch file \`configure' 81f7ec340bSmacallan autoheader touch file \`config.h.in' 827ce7e03cSmrg autom4te touch the output file, or create a stub one 83f7ec340bSmacallan automake touch all \`Makefile.in' files 84f7ec340bSmacallan bison create \`y.tab.[ch]', if possible, from existing .[ch] 85f7ec340bSmacallan flex create \`lex.yy.c', if possible, from existing .c 86f7ec340bSmacallan help2man touch the output file 87f7ec340bSmacallan lex create \`lex.yy.c', if possible, from existing .c 88f7ec340bSmacallan makeinfo touch the output file 89f7ec340bSmacallan tar try tar, gnutar, gtar, then tar without non-portable flags 90f7ec340bSmacallan yacc create \`y.tab.[ch]', if possible, from existing .[ch] 91f7ec340bSmacallan 92f7ec340bSmacallanSend bug reports to <bug-automake@gnu.org>." 93f7ec340bSmacallan exit $? 94f7ec340bSmacallan ;; 95f7ec340bSmacallan 96f7ec340bSmacallan -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97f7ec340bSmacallan echo "missing $scriptversion (GNU Automake)" 98f7ec340bSmacallan exit $? 99f7ec340bSmacallan ;; 100f7ec340bSmacallan 101f7ec340bSmacallan -*) 102f7ec340bSmacallan echo 1>&2 "$0: Unknown \`$1' option" 103f7ec340bSmacallan echo 1>&2 "Try \`$0 --help' for more information" 104f7ec340bSmacallan exit 1 105f7ec340bSmacallan ;; 106f7ec340bSmacallan 107f7ec340bSmacallanesac 108f7ec340bSmacallan 109f7ec340bSmacallan# Now exit if we have it, but it failed. Also exit now if we 110f7ec340bSmacallan# don't have it and --version was passed (most likely to detect 111f7ec340bSmacallan# the program). 1127ce7e03cSmrgcase $1 in 113f7ec340bSmacallan lex|yacc) 114f7ec340bSmacallan # Not GNU programs, they don't have --version. 115f7ec340bSmacallan ;; 116f7ec340bSmacallan 117f7ec340bSmacallan tar) 118f7ec340bSmacallan if test -n "$run"; then 119f7ec340bSmacallan echo 1>&2 "ERROR: \`tar' requires --run" 120f7ec340bSmacallan exit 1 121f7ec340bSmacallan elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 122f7ec340bSmacallan exit 1 123f7ec340bSmacallan fi 124f7ec340bSmacallan ;; 125f7ec340bSmacallan 126f7ec340bSmacallan *) 127f7ec340bSmacallan if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 128f7ec340bSmacallan # We have it, but it failed. 129f7ec340bSmacallan exit 1 130f7ec340bSmacallan elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 131f7ec340bSmacallan # Could not run --version or --help. This is probably someone 132f7ec340bSmacallan # running `$TOOL --version' or `$TOOL --help' to check whether 133f7ec340bSmacallan # $TOOL exists and not knowing $TOOL uses missing. 134f7ec340bSmacallan exit 1 135f7ec340bSmacallan fi 136f7ec340bSmacallan ;; 137f7ec340bSmacallanesac 138f7ec340bSmacallan 139f7ec340bSmacallan# If it does not exist, or fails to run (possibly an outdated version), 140f7ec340bSmacallan# try to emulate it. 1417ce7e03cSmrgcase $1 in 142f7ec340bSmacallan aclocal*) 143f7ec340bSmacallan echo 1>&2 "\ 144f7ec340bSmacallanWARNING: \`$1' is $msg. You should only need it if 145f7ec340bSmacallan you modified \`acinclude.m4' or \`${configure_ac}'. You might want 146f7ec340bSmacallan to install the \`Automake' and \`Perl' packages. Grab them from 147f7ec340bSmacallan any GNU archive site." 148f7ec340bSmacallan touch aclocal.m4 149f7ec340bSmacallan ;; 150f7ec340bSmacallan 151f7ec340bSmacallan autoconf) 152f7ec340bSmacallan echo 1>&2 "\ 153f7ec340bSmacallanWARNING: \`$1' is $msg. You should only need it if 154f7ec340bSmacallan you modified \`${configure_ac}'. You might want to install the 155f7ec340bSmacallan \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 156f7ec340bSmacallan archive site." 157f7ec340bSmacallan touch configure 158f7ec340bSmacallan ;; 159f7ec340bSmacallan 160f7ec340bSmacallan autoheader) 161f7ec340bSmacallan echo 1>&2 "\ 162f7ec340bSmacallanWARNING: \`$1' is $msg. You should only need it if 163f7ec340bSmacallan you modified \`acconfig.h' or \`${configure_ac}'. You might want 164f7ec340bSmacallan to install the \`Autoconf' and \`GNU m4' packages. Grab them 165f7ec340bSmacallan from any GNU archive site." 166f7ec340bSmacallan files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 167f7ec340bSmacallan test -z "$files" && files="config.h" 168f7ec340bSmacallan touch_files= 169f7ec340bSmacallan for f in $files; do 1707ce7e03cSmrg case $f in 171f7ec340bSmacallan *:*) touch_files="$touch_files "`echo "$f" | 172f7ec340bSmacallan sed -e 's/^[^:]*://' -e 's/:.*//'`;; 173f7ec340bSmacallan *) touch_files="$touch_files $f.in";; 174f7ec340bSmacallan esac 175f7ec340bSmacallan done 176f7ec340bSmacallan touch $touch_files 177f7ec340bSmacallan ;; 178f7ec340bSmacallan 179f7ec340bSmacallan automake*) 180f7ec340bSmacallan echo 1>&2 "\ 181f7ec340bSmacallanWARNING: \`$1' is $msg. You should only need it if 182f7ec340bSmacallan you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 183f7ec340bSmacallan You might want to install the \`Automake' and \`Perl' packages. 184f7ec340bSmacallan Grab them from any GNU archive site." 185f7ec340bSmacallan find . -type f -name Makefile.am -print | 186f7ec340bSmacallan sed 's/\.am$/.in/' | 187f7ec340bSmacallan while read f; do touch "$f"; done 188f7ec340bSmacallan ;; 189f7ec340bSmacallan 190f7ec340bSmacallan autom4te) 191f7ec340bSmacallan echo 1>&2 "\ 192f7ec340bSmacallanWARNING: \`$1' is needed, but is $msg. 193f7ec340bSmacallan You might have modified some files without having the 194f7ec340bSmacallan proper tools for further handling them. 195f7ec340bSmacallan You can get \`$1' as part of \`Autoconf' from any GNU 196f7ec340bSmacallan archive site." 197f7ec340bSmacallan 1987ce7e03cSmrg file=`echo "$*" | sed -n "$sed_output"` 1997ce7e03cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 200f7ec340bSmacallan if test -f "$file"; then 201f7ec340bSmacallan touch $file 202f7ec340bSmacallan else 203f7ec340bSmacallan test -z "$file" || exec >$file 204f7ec340bSmacallan echo "#! /bin/sh" 205f7ec340bSmacallan echo "# Created by GNU Automake missing as a replacement of" 206f7ec340bSmacallan echo "# $ $@" 207f7ec340bSmacallan echo "exit 0" 208f7ec340bSmacallan chmod +x $file 209f7ec340bSmacallan exit 1 210f7ec340bSmacallan fi 211f7ec340bSmacallan ;; 212f7ec340bSmacallan 213f7ec340bSmacallan bison|yacc) 214f7ec340bSmacallan echo 1>&2 "\ 215f7ec340bSmacallanWARNING: \`$1' $msg. You should only need it if 216f7ec340bSmacallan you modified a \`.y' file. You may need the \`Bison' package 217f7ec340bSmacallan in order for those modifications to take effect. You can get 218f7ec340bSmacallan \`Bison' from any GNU archive site." 219f7ec340bSmacallan rm -f y.tab.c y.tab.h 2207ce7e03cSmrg if test $# -ne 1; then 221f7ec340bSmacallan eval LASTARG="\${$#}" 2227ce7e03cSmrg case $LASTARG in 223f7ec340bSmacallan *.y) 224f7ec340bSmacallan SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2257ce7e03cSmrg if test -f "$SRCFILE"; then 226f7ec340bSmacallan cp "$SRCFILE" y.tab.c 227f7ec340bSmacallan fi 228f7ec340bSmacallan SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2297ce7e03cSmrg if test -f "$SRCFILE"; then 230f7ec340bSmacallan cp "$SRCFILE" y.tab.h 231f7ec340bSmacallan fi 232f7ec340bSmacallan ;; 233f7ec340bSmacallan esac 234f7ec340bSmacallan fi 2357ce7e03cSmrg if test ! -f y.tab.h; then 236f7ec340bSmacallan echo >y.tab.h 237f7ec340bSmacallan fi 2387ce7e03cSmrg if test ! -f y.tab.c; then 239f7ec340bSmacallan echo 'main() { return 0; }' >y.tab.c 240f7ec340bSmacallan fi 241f7ec340bSmacallan ;; 242f7ec340bSmacallan 243f7ec340bSmacallan lex|flex) 244f7ec340bSmacallan echo 1>&2 "\ 245f7ec340bSmacallanWARNING: \`$1' is $msg. You should only need it if 246f7ec340bSmacallan you modified a \`.l' file. You may need the \`Flex' package 247f7ec340bSmacallan in order for those modifications to take effect. You can get 248f7ec340bSmacallan \`Flex' from any GNU archive site." 249f7ec340bSmacallan rm -f lex.yy.c 2507ce7e03cSmrg if test $# -ne 1; then 251f7ec340bSmacallan eval LASTARG="\${$#}" 2527ce7e03cSmrg case $LASTARG in 253f7ec340bSmacallan *.l) 254f7ec340bSmacallan SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2557ce7e03cSmrg if test -f "$SRCFILE"; then 256f7ec340bSmacallan cp "$SRCFILE" lex.yy.c 257f7ec340bSmacallan fi 258f7ec340bSmacallan ;; 259f7ec340bSmacallan esac 260f7ec340bSmacallan fi 2617ce7e03cSmrg if test ! -f lex.yy.c; then 262f7ec340bSmacallan echo 'main() { return 0; }' >lex.yy.c 263f7ec340bSmacallan fi 264f7ec340bSmacallan ;; 265f7ec340bSmacallan 266f7ec340bSmacallan help2man) 267f7ec340bSmacallan echo 1>&2 "\ 268f7ec340bSmacallanWARNING: \`$1' is $msg. You should only need it if 269f7ec340bSmacallan you modified a dependency of a manual page. You may need the 270f7ec340bSmacallan \`Help2man' package in order for those modifications to take 271f7ec340bSmacallan effect. You can get \`Help2man' from any GNU archive site." 272f7ec340bSmacallan 2737ce7e03cSmrg file=`echo "$*" | sed -n "$sed_output"` 2747ce7e03cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2757ce7e03cSmrg if test -f "$file"; then 276f7ec340bSmacallan touch $file 277f7ec340bSmacallan else 278f7ec340bSmacallan test -z "$file" || exec >$file 279f7ec340bSmacallan echo ".ab help2man is required to generate this page" 280f7ec340bSmacallan exit 1 281f7ec340bSmacallan fi 282f7ec340bSmacallan ;; 283f7ec340bSmacallan 284f7ec340bSmacallan makeinfo) 285f7ec340bSmacallan echo 1>&2 "\ 286f7ec340bSmacallanWARNING: \`$1' is $msg. You should only need it if 287f7ec340bSmacallan you modified a \`.texi' or \`.texinfo' file, or any other file 288f7ec340bSmacallan indirectly affecting the aspect of the manual. The spurious 289f7ec340bSmacallan call might also be the consequence of using a buggy \`make' (AIX, 290f7ec340bSmacallan DU, IRIX). You might want to install the \`Texinfo' package or 291f7ec340bSmacallan the \`GNU make' package. Grab either from any GNU archive site." 292f7ec340bSmacallan # The file to touch is that specified with -o ... 2937ce7e03cSmrg file=`echo "$*" | sed -n "$sed_output"` 2947ce7e03cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 295f7ec340bSmacallan if test -z "$file"; then 296f7ec340bSmacallan # ... or it is the one specified with @setfilename ... 297f7ec340bSmacallan infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2987ce7e03cSmrg file=`sed -n ' 2997ce7e03cSmrg /^@setfilename/{ 3007ce7e03cSmrg s/.* \([^ ]*\) *$/\1/ 3017ce7e03cSmrg p 3027ce7e03cSmrg q 3037ce7e03cSmrg }' $infile` 304f7ec340bSmacallan # ... or it is derived from the source name (dir/f.texi becomes f.info) 305f7ec340bSmacallan test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 306f7ec340bSmacallan fi 307f7ec340bSmacallan # If the file does not exist, the user really needs makeinfo; 308f7ec340bSmacallan # let's fail without touching anything. 309f7ec340bSmacallan test -f $file || exit 1 310f7ec340bSmacallan touch $file 311f7ec340bSmacallan ;; 312f7ec340bSmacallan 313f7ec340bSmacallan tar) 314f7ec340bSmacallan shift 315f7ec340bSmacallan 316f7ec340bSmacallan # We have already tried tar in the generic part. 317f7ec340bSmacallan # Look for gnutar/gtar before invocation to avoid ugly error 318f7ec340bSmacallan # messages. 319f7ec340bSmacallan if (gnutar --version > /dev/null 2>&1); then 320f7ec340bSmacallan gnutar "$@" && exit 0 321f7ec340bSmacallan fi 322f7ec340bSmacallan if (gtar --version > /dev/null 2>&1); then 323f7ec340bSmacallan gtar "$@" && exit 0 324f7ec340bSmacallan fi 325f7ec340bSmacallan firstarg="$1" 326f7ec340bSmacallan if shift; then 3277ce7e03cSmrg case $firstarg in 328f7ec340bSmacallan *o*) 329f7ec340bSmacallan firstarg=`echo "$firstarg" | sed s/o//` 330f7ec340bSmacallan tar "$firstarg" "$@" && exit 0 331f7ec340bSmacallan ;; 332f7ec340bSmacallan esac 3337ce7e03cSmrg case $firstarg in 334f7ec340bSmacallan *h*) 335f7ec340bSmacallan firstarg=`echo "$firstarg" | sed s/h//` 336f7ec340bSmacallan tar "$firstarg" "$@" && exit 0 337f7ec340bSmacallan ;; 338f7ec340bSmacallan esac 339f7ec340bSmacallan fi 340f7ec340bSmacallan 341f7ec340bSmacallan echo 1>&2 "\ 342f7ec340bSmacallanWARNING: I can't seem to be able to run \`tar' with the given arguments. 343f7ec340bSmacallan You may want to install GNU tar or Free paxutils, or check the 344f7ec340bSmacallan command line arguments." 345f7ec340bSmacallan exit 1 346f7ec340bSmacallan ;; 347f7ec340bSmacallan 348f7ec340bSmacallan *) 349f7ec340bSmacallan echo 1>&2 "\ 350f7ec340bSmacallanWARNING: \`$1' is needed, and is $msg. 351f7ec340bSmacallan You might have modified some files without having the 352f7ec340bSmacallan proper tools for further handling them. Check the \`README' file, 353f7ec340bSmacallan it often tells you about the needed prerequisites for installing 354f7ec340bSmacallan this package. You may also peek at any GNU archive site, in case 355f7ec340bSmacallan some other package would contain this missing \`$1' program." 356f7ec340bSmacallan exit 1 357f7ec340bSmacallan ;; 358f7ec340bSmacallanesac 359f7ec340bSmacallan 360f7ec340bSmacallanexit 0 361f7ec340bSmacallan 362f7ec340bSmacallan# Local variables: 363f7ec340bSmacallan# eval: (add-hook 'write-file-hooks 'time-stamp) 364f7ec340bSmacallan# time-stamp-start: "scriptversion=" 365f7ec340bSmacallan# time-stamp-format: "%:y-%02m-%02d.%02H" 366f7ec340bSmacallan# time-stamp-end: "$" 367f7ec340bSmacallan# End: 368