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