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