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