missing revision f4959950
1335e815aSmrg#! /bin/sh 2335e815aSmrg# Common stub for a few missing GNU programs while installing. 3f4959950Smrg 4f4959950Smrgscriptversion=2009-04-28.21; # UTC 5f4959950Smrg 6f4959950Smrg# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7f4959950Smrg# 2008, 2009 Free Software Foundation, Inc. 8335e815aSmrg# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9335e815aSmrg 10335e815aSmrg# This program is free software; you can redistribute it and/or modify 11335e815aSmrg# it under the terms of the GNU General Public License as published by 12335e815aSmrg# the Free Software Foundation; either version 2, or (at your option) 13335e815aSmrg# any later version. 14335e815aSmrg 15335e815aSmrg# This program is distributed in the hope that it will be useful, 16335e815aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 17335e815aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18335e815aSmrg# GNU General Public License for more details. 19335e815aSmrg 20335e815aSmrg# You should have received a copy of the GNU General Public License 21f4959950Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 22335e815aSmrg 23335e815aSmrg# As a special exception to the GNU General Public License, if you 24335e815aSmrg# distribute this file as part of a program that contains a 25335e815aSmrg# configuration script generated by Autoconf, you may include it under 26335e815aSmrg# the same distribution terms that you use for the rest of that program. 27335e815aSmrg 28335e815aSmrgif test $# -eq 0; then 29335e815aSmrg echo 1>&2 "Try \`$0 --help' for more information" 30335e815aSmrg exit 1 31335e815aSmrgfi 32335e815aSmrg 33335e815aSmrgrun=: 34f4959950Smrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35f4959950Smrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36335e815aSmrg 37335e815aSmrg# In the cases where this matters, `missing' is being run in the 38335e815aSmrg# srcdir already. 39335e815aSmrgif test -f configure.ac; then 40335e815aSmrg configure_ac=configure.ac 41335e815aSmrgelse 42335e815aSmrg configure_ac=configure.in 43335e815aSmrgfi 44335e815aSmrg 45f4959950Smrgmsg="missing on your system" 46f4959950Smrg 47f4959950Smrgcase $1 in 48335e815aSmrg--run) 49335e815aSmrg # Try to run requested program, and just exit if it succeeds. 50335e815aSmrg run= 51335e815aSmrg shift 52335e815aSmrg "$@" && exit 0 53f4959950Smrg # Exit code 63 means version mismatch. This often happens 54f4959950Smrg # when the user try to use an ancient version of a tool on 55f4959950Smrg # a file that requires a minimum version. In this case we 56f4959950Smrg # we should proceed has if the program had been absent, or 57f4959950Smrg # if --run hadn't been passed. 58f4959950Smrg if test $? = 63; then 59f4959950Smrg run=: 60f4959950Smrg msg="probably too old" 61f4959950Smrg fi 62335e815aSmrg ;; 63335e815aSmrg 64335e815aSmrg -h|--h|--he|--hel|--help) 65335e815aSmrg echo "\ 66335e815aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 67335e815aSmrg 68335e815aSmrgHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69335e815aSmrgerror status if there is no known handling for PROGRAM. 70335e815aSmrg 71335e815aSmrgOptions: 72335e815aSmrg -h, --help display this help and exit 73335e815aSmrg -v, --version output version information and exit 74335e815aSmrg --run try to run the given command, and emulate it if it fails 75335e815aSmrg 76335e815aSmrgSupported PROGRAM values: 77335e815aSmrg aclocal touch file \`aclocal.m4' 78335e815aSmrg autoconf touch file \`configure' 79335e815aSmrg autoheader touch file \`config.h.in' 80f4959950Smrg autom4te touch the output file, or create a stub one 81335e815aSmrg automake touch all \`Makefile.in' files 82335e815aSmrg bison create \`y.tab.[ch]', if possible, from existing .[ch] 83335e815aSmrg flex create \`lex.yy.c', if possible, from existing .c 84335e815aSmrg help2man touch the output file 85335e815aSmrg lex create \`lex.yy.c', if possible, from existing .c 86335e815aSmrg makeinfo touch the output file 87335e815aSmrg tar try tar, gnutar, gtar, then tar without non-portable flags 88f4959950Smrg yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89f4959950Smrg 90f4959950SmrgVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91f4959950Smrg\`g' are ignored when checking the name. 92f4959950Smrg 93f4959950SmrgSend bug reports to <bug-automake@gnu.org>." 94f4959950Smrg exit $? 95335e815aSmrg ;; 96335e815aSmrg 97335e815aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98f4959950Smrg echo "missing $scriptversion (GNU Automake)" 99f4959950Smrg exit $? 100335e815aSmrg ;; 101335e815aSmrg 102335e815aSmrg -*) 103335e815aSmrg echo 1>&2 "$0: Unknown \`$1' option" 104335e815aSmrg echo 1>&2 "Try \`$0 --help' for more information" 105335e815aSmrg exit 1 106335e815aSmrg ;; 107335e815aSmrg 108f4959950Smrgesac 109f4959950Smrg 110f4959950Smrg# normalize program name to check for. 111f4959950Smrgprogram=`echo "$1" | sed ' 112f4959950Smrg s/^gnu-//; t 113f4959950Smrg s/^gnu//; t 114f4959950Smrg s/^g//; t'` 115f4959950Smrg 116f4959950Smrg# Now exit if we have it, but it failed. Also exit now if we 117f4959950Smrg# don't have it and --version was passed (most likely to detect 118f4959950Smrg# the program). This is about non-GNU programs, so use $1 not 119f4959950Smrg# $program. 120f4959950Smrgcase $1 in 121f4959950Smrg lex*|yacc*) 122f4959950Smrg # Not GNU programs, they don't have --version. 123f4959950Smrg ;; 124f4959950Smrg 125f4959950Smrg tar*) 126f4959950Smrg if test -n "$run"; then 127f4959950Smrg echo 1>&2 "ERROR: \`tar' requires --run" 128f4959950Smrg exit 1 129f4959950Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130f4959950Smrg exit 1 131f4959950Smrg fi 132f4959950Smrg ;; 133f4959950Smrg 134f4959950Smrg *) 135335e815aSmrg if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136335e815aSmrg # We have it, but it failed. 137335e815aSmrg exit 1 138f4959950Smrg elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139f4959950Smrg # Could not run --version or --help. This is probably someone 140f4959950Smrg # running `$TOOL --version' or `$TOOL --help' to check whether 141f4959950Smrg # $TOOL exists and not knowing $TOOL uses missing. 142f4959950Smrg exit 1 143335e815aSmrg fi 144f4959950Smrg ;; 145f4959950Smrgesac 146335e815aSmrg 147f4959950Smrg# If it does not exist, or fails to run (possibly an outdated version), 148f4959950Smrg# try to emulate it. 149f4959950Smrgcase $program in 150f4959950Smrg aclocal*) 151335e815aSmrg echo 1>&2 "\ 152f4959950SmrgWARNING: \`$1' is $msg. You should only need it if 153335e815aSmrg you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154335e815aSmrg to install the \`Automake' and \`Perl' packages. Grab them from 155335e815aSmrg any GNU archive site." 156335e815aSmrg touch aclocal.m4 157335e815aSmrg ;; 158335e815aSmrg 159f4959950Smrg autoconf*) 160335e815aSmrg echo 1>&2 "\ 161f4959950SmrgWARNING: \`$1' is $msg. You should only need it if 162335e815aSmrg you modified \`${configure_ac}'. You might want to install the 163335e815aSmrg \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164335e815aSmrg archive site." 165335e815aSmrg touch configure 166335e815aSmrg ;; 167335e815aSmrg 168f4959950Smrg autoheader*) 169335e815aSmrg echo 1>&2 "\ 170f4959950SmrgWARNING: \`$1' is $msg. You should only need it if 171335e815aSmrg you modified \`acconfig.h' or \`${configure_ac}'. You might want 172335e815aSmrg to install the \`Autoconf' and \`GNU m4' packages. Grab them 173335e815aSmrg from any GNU archive site." 174335e815aSmrg files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175335e815aSmrg test -z "$files" && files="config.h" 176335e815aSmrg touch_files= 177335e815aSmrg for f in $files; do 178f4959950Smrg case $f in 179335e815aSmrg *:*) touch_files="$touch_files "`echo "$f" | 180335e815aSmrg sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181335e815aSmrg *) touch_files="$touch_files $f.in";; 182335e815aSmrg esac 183335e815aSmrg done 184335e815aSmrg touch $touch_files 185335e815aSmrg ;; 186335e815aSmrg 187335e815aSmrg automake*) 188335e815aSmrg echo 1>&2 "\ 189f4959950SmrgWARNING: \`$1' is $msg. You should only need it if 190335e815aSmrg you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191335e815aSmrg You might want to install the \`Automake' and \`Perl' packages. 192335e815aSmrg Grab them from any GNU archive site." 193335e815aSmrg find . -type f -name Makefile.am -print | 194335e815aSmrg sed 's/\.am$/.in/' | 195335e815aSmrg while read f; do touch "$f"; done 196335e815aSmrg ;; 197335e815aSmrg 198f4959950Smrg autom4te*) 199335e815aSmrg echo 1>&2 "\ 200f4959950SmrgWARNING: \`$1' is needed, but is $msg. 201f4959950Smrg You might have modified some files without having the 202335e815aSmrg proper tools for further handling them. 203335e815aSmrg You can get \`$1' as part of \`Autoconf' from any GNU 204335e815aSmrg archive site." 205335e815aSmrg 206f4959950Smrg file=`echo "$*" | sed -n "$sed_output"` 207f4959950Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208335e815aSmrg if test -f "$file"; then 209335e815aSmrg touch $file 210335e815aSmrg else 211335e815aSmrg test -z "$file" || exec >$file 212335e815aSmrg echo "#! /bin/sh" 213335e815aSmrg echo "# Created by GNU Automake missing as a replacement of" 214335e815aSmrg echo "# $ $@" 215335e815aSmrg echo "exit 0" 216335e815aSmrg chmod +x $file 217335e815aSmrg exit 1 218335e815aSmrg fi 219335e815aSmrg ;; 220335e815aSmrg 221f4959950Smrg bison*|yacc*) 222335e815aSmrg echo 1>&2 "\ 223f4959950SmrgWARNING: \`$1' $msg. You should only need it if 224335e815aSmrg you modified a \`.y' file. You may need the \`Bison' package 225335e815aSmrg in order for those modifications to take effect. You can get 226335e815aSmrg \`Bison' from any GNU archive site." 227335e815aSmrg rm -f y.tab.c y.tab.h 228f4959950Smrg if test $# -ne 1; then 229335e815aSmrg eval LASTARG="\${$#}" 230f4959950Smrg case $LASTARG in 231335e815aSmrg *.y) 232335e815aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233f4959950Smrg if test -f "$SRCFILE"; then 234335e815aSmrg cp "$SRCFILE" y.tab.c 235335e815aSmrg fi 236335e815aSmrg SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237f4959950Smrg if test -f "$SRCFILE"; then 238335e815aSmrg cp "$SRCFILE" y.tab.h 239335e815aSmrg fi 240335e815aSmrg ;; 241335e815aSmrg esac 242335e815aSmrg fi 243f4959950Smrg if test ! -f y.tab.h; then 244335e815aSmrg echo >y.tab.h 245335e815aSmrg fi 246f4959950Smrg if test ! -f y.tab.c; then 247335e815aSmrg echo 'main() { return 0; }' >y.tab.c 248335e815aSmrg fi 249335e815aSmrg ;; 250335e815aSmrg 251f4959950Smrg lex*|flex*) 252335e815aSmrg echo 1>&2 "\ 253f4959950SmrgWARNING: \`$1' is $msg. You should only need it if 254335e815aSmrg you modified a \`.l' file. You may need the \`Flex' package 255335e815aSmrg in order for those modifications to take effect. You can get 256335e815aSmrg \`Flex' from any GNU archive site." 257335e815aSmrg rm -f lex.yy.c 258f4959950Smrg if test $# -ne 1; then 259335e815aSmrg eval LASTARG="\${$#}" 260f4959950Smrg case $LASTARG in 261335e815aSmrg *.l) 262335e815aSmrg SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263f4959950Smrg if test -f "$SRCFILE"; then 264335e815aSmrg cp "$SRCFILE" lex.yy.c 265335e815aSmrg fi 266335e815aSmrg ;; 267335e815aSmrg esac 268335e815aSmrg fi 269f4959950Smrg if test ! -f lex.yy.c; then 270335e815aSmrg echo 'main() { return 0; }' >lex.yy.c 271335e815aSmrg fi 272335e815aSmrg ;; 273335e815aSmrg 274f4959950Smrg help2man*) 275335e815aSmrg echo 1>&2 "\ 276f4959950SmrgWARNING: \`$1' is $msg. You should only need it if 277335e815aSmrg you modified a dependency of a manual page. You may need the 278335e815aSmrg \`Help2man' package in order for those modifications to take 279335e815aSmrg effect. You can get \`Help2man' from any GNU archive site." 280335e815aSmrg 281f4959950Smrg file=`echo "$*" | sed -n "$sed_output"` 282f4959950Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283f4959950Smrg if test -f "$file"; then 284335e815aSmrg touch $file 285335e815aSmrg else 286335e815aSmrg test -z "$file" || exec >$file 287335e815aSmrg echo ".ab help2man is required to generate this page" 288f4959950Smrg exit $? 289335e815aSmrg fi 290335e815aSmrg ;; 291335e815aSmrg 292f4959950Smrg makeinfo*) 293335e815aSmrg echo 1>&2 "\ 294f4959950SmrgWARNING: \`$1' is $msg. You should only need it if 295335e815aSmrg you modified a \`.texi' or \`.texinfo' file, or any other file 296335e815aSmrg indirectly affecting the aspect of the manual. The spurious 297335e815aSmrg call might also be the consequence of using a buggy \`make' (AIX, 298335e815aSmrg DU, IRIX). You might want to install the \`Texinfo' package or 299335e815aSmrg the \`GNU make' package. Grab either from any GNU archive site." 300f4959950Smrg # The file to touch is that specified with -o ... 301f4959950Smrg file=`echo "$*" | sed -n "$sed_output"` 302f4959950Smrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303335e815aSmrg if test -z "$file"; then 304f4959950Smrg # ... or it is the one specified with @setfilename ... 305f4959950Smrg infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306f4959950Smrg file=`sed -n ' 307f4959950Smrg /^@setfilename/{ 308f4959950Smrg s/.* \([^ ]*\) *$/\1/ 309f4959950Smrg p 310f4959950Smrg q 311f4959950Smrg }' $infile` 312f4959950Smrg # ... or it is derived from the source name (dir/f.texi becomes f.info) 313f4959950Smrg test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314335e815aSmrg fi 315f4959950Smrg # If the file does not exist, the user really needs makeinfo; 316f4959950Smrg # let's fail without touching anything. 317f4959950Smrg test -f $file || exit 1 318335e815aSmrg touch $file 319335e815aSmrg ;; 320335e815aSmrg 321f4959950Smrg tar*) 322335e815aSmrg shift 323335e815aSmrg 324335e815aSmrg # We have already tried tar in the generic part. 325335e815aSmrg # Look for gnutar/gtar before invocation to avoid ugly error 326335e815aSmrg # messages. 327335e815aSmrg if (gnutar --version > /dev/null 2>&1); then 328335e815aSmrg gnutar "$@" && exit 0 329335e815aSmrg fi 330335e815aSmrg if (gtar --version > /dev/null 2>&1); then 331335e815aSmrg gtar "$@" && exit 0 332335e815aSmrg fi 333335e815aSmrg firstarg="$1" 334335e815aSmrg if shift; then 335f4959950Smrg case $firstarg in 336335e815aSmrg *o*) 337335e815aSmrg firstarg=`echo "$firstarg" | sed s/o//` 338335e815aSmrg tar "$firstarg" "$@" && exit 0 339335e815aSmrg ;; 340335e815aSmrg esac 341f4959950Smrg case $firstarg in 342335e815aSmrg *h*) 343335e815aSmrg firstarg=`echo "$firstarg" | sed s/h//` 344335e815aSmrg tar "$firstarg" "$@" && exit 0 345335e815aSmrg ;; 346335e815aSmrg esac 347335e815aSmrg fi 348335e815aSmrg 349335e815aSmrg echo 1>&2 "\ 350335e815aSmrgWARNING: I can't seem to be able to run \`tar' with the given arguments. 351335e815aSmrg You may want to install GNU tar or Free paxutils, or check the 352335e815aSmrg command line arguments." 353335e815aSmrg exit 1 354335e815aSmrg ;; 355335e815aSmrg 356335e815aSmrg *) 357335e815aSmrg echo 1>&2 "\ 358f4959950SmrgWARNING: \`$1' is needed, and is $msg. 359f4959950Smrg You might have modified some files without having the 360335e815aSmrg proper tools for further handling them. Check the \`README' file, 361335e815aSmrg it often tells you about the needed prerequisites for installing 362335e815aSmrg this package. You may also peek at any GNU archive site, in case 363335e815aSmrg some other package would contain this missing \`$1' program." 364335e815aSmrg exit 1 365335e815aSmrg ;; 366335e815aSmrgesac 367335e815aSmrg 368335e815aSmrgexit 0 369f4959950Smrg 370f4959950Smrg# Local variables: 371f4959950Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 372f4959950Smrg# time-stamp-start: "scriptversion=" 373f4959950Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 374f4959950Smrg# time-stamp-time-zone: "UTC" 375f4959950Smrg# time-stamp-end: "; # UTC" 376f4959950Smrg# End: 377