1251883Speter#! /bin/sh 2251883Speter# Common stub for a few missing GNU programs while installing. 3251883Speter 4289166Speterscriptversion=2012-01-06.13; # UTC 5251883Speter 6289166Speter# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7289166Speter# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. 8251883Speter# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 9251883Speter 10251883Speter# This program is free software; you can redistribute it and/or modify 11251883Speter# it under the terms of the GNU General Public License as published by 12251883Speter# the Free Software Foundation; either version 2, or (at your option) 13251883Speter# any later version. 14251883Speter 15251883Speter# This program is distributed in the hope that it will be useful, 16251883Speter# but WITHOUT ANY WARRANTY; without even the implied warranty of 17251883Speter# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18251883Speter# GNU General Public License for more details. 19251883Speter 20251883Speter# You should have received a copy of the GNU General Public License 21289166Speter# along with this program. If not, see <http://www.gnu.org/licenses/>. 22251883Speter 23251883Speter# As a special exception to the GNU General Public License, if you 24251883Speter# distribute this file as part of a program that contains a 25251883Speter# configuration script generated by Autoconf, you may include it under 26251883Speter# the same distribution terms that you use for the rest of that program. 27251883Speter 28251883Speterif test $# -eq 0; then 29251883Speter echo 1>&2 "Try \`$0 --help' for more information" 30251883Speter exit 1 31251883Speterfi 32251883Speter 33251883Speterrun=: 34289166Spetersed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35289166Spetersed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36251883Speter 37251883Speter# In the cases where this matters, `missing' is being run in the 38251883Speter# srcdir already. 39251883Speterif test -f configure.ac; then 40251883Speter configure_ac=configure.ac 41251883Speterelse 42251883Speter configure_ac=configure.in 43251883Speterfi 44251883Speter 45251883Spetermsg="missing on your system" 46251883Speter 47289166Spetercase $1 in 48251883Speter--run) 49251883Speter # Try to run requested program, and just exit if it succeeds. 50251883Speter run= 51251883Speter shift 52251883Speter "$@" && exit 0 53251883Speter # Exit code 63 means version mismatch. This often happens 54251883Speter # when the user try to use an ancient version of a tool on 55251883Speter # a file that requires a minimum version. In this case we 56251883Speter # we should proceed has if the program had been absent, or 57251883Speter # if --run hadn't been passed. 58251883Speter if test $? = 63; then 59251883Speter run=: 60251883Speter msg="probably too old" 61251883Speter fi 62251883Speter ;; 63251883Speter 64251883Speter -h|--h|--he|--hel|--help) 65251883Speter echo "\ 66251883Speter$0 [OPTION]... PROGRAM [ARGUMENT]... 67251883Speter 68251883SpeterHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69251883Spetererror status if there is no known handling for PROGRAM. 70251883Speter 71251883SpeterOptions: 72251883Speter -h, --help display this help and exit 73251883Speter -v, --version output version information and exit 74251883Speter --run try to run the given command, and emulate it if it fails 75251883Speter 76251883SpeterSupported PROGRAM values: 77251883Speter aclocal touch file \`aclocal.m4' 78251883Speter autoconf touch file \`configure' 79251883Speter autoheader touch file \`config.h.in' 80289166Speter autom4te touch the output file, or create a stub one 81251883Speter automake touch all \`Makefile.in' files 82251883Speter bison create \`y.tab.[ch]', if possible, from existing .[ch] 83251883Speter flex create \`lex.yy.c', if possible, from existing .c 84251883Speter help2man touch the output file 85251883Speter lex create \`lex.yy.c', if possible, from existing .c 86251883Speter makeinfo touch the output file 87251883Speter yacc create \`y.tab.[ch]', if possible, from existing .[ch] 88251883Speter 89289166SpeterVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 90289166Speter\`g' are ignored when checking the name. 91289166Speter 92251883SpeterSend bug reports to <bug-automake@gnu.org>." 93251883Speter exit $? 94251883Speter ;; 95251883Speter 96251883Speter -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 97251883Speter echo "missing $scriptversion (GNU Automake)" 98251883Speter exit $? 99251883Speter ;; 100251883Speter 101251883Speter -*) 102251883Speter echo 1>&2 "$0: Unknown \`$1' option" 103251883Speter echo 1>&2 "Try \`$0 --help' for more information" 104251883Speter exit 1 105251883Speter ;; 106251883Speter 107251883Speteresac 108251883Speter 109289166Speter# normalize program name to check for. 110289166Speterprogram=`echo "$1" | sed ' 111289166Speter s/^gnu-//; t 112289166Speter s/^gnu//; t 113289166Speter s/^g//; t'` 114289166Speter 115251883Speter# Now exit if we have it, but it failed. Also exit now if we 116251883Speter# don't have it and --version was passed (most likely to detect 117289166Speter# the program). This is about non-GNU programs, so use $1 not 118289166Speter# $program. 119289166Spetercase $1 in 120289166Speter lex*|yacc*) 121251883Speter # Not GNU programs, they don't have --version. 122251883Speter ;; 123251883Speter 124251883Speter *) 125251883Speter if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 126251883Speter # We have it, but it failed. 127251883Speter exit 1 128251883Speter elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 129251883Speter # Could not run --version or --help. This is probably someone 130251883Speter # running `$TOOL --version' or `$TOOL --help' to check whether 131251883Speter # $TOOL exists and not knowing $TOOL uses missing. 132251883Speter exit 1 133251883Speter fi 134251883Speter ;; 135251883Speteresac 136251883Speter 137251883Speter# If it does not exist, or fails to run (possibly an outdated version), 138251883Speter# try to emulate it. 139289166Spetercase $program in 140251883Speter aclocal*) 141251883Speter echo 1>&2 "\ 142251883SpeterWARNING: \`$1' is $msg. You should only need it if 143251883Speter you modified \`acinclude.m4' or \`${configure_ac}'. You might want 144251883Speter to install the \`Automake' and \`Perl' packages. Grab them from 145251883Speter any GNU archive site." 146251883Speter touch aclocal.m4 147251883Speter ;; 148251883Speter 149289166Speter autoconf*) 150251883Speter echo 1>&2 "\ 151251883SpeterWARNING: \`$1' is $msg. You should only need it if 152251883Speter you modified \`${configure_ac}'. You might want to install the 153251883Speter \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 154251883Speter archive site." 155251883Speter touch configure 156251883Speter ;; 157251883Speter 158289166Speter autoheader*) 159251883Speter echo 1>&2 "\ 160251883SpeterWARNING: \`$1' is $msg. You should only need it if 161251883Speter you modified \`acconfig.h' or \`${configure_ac}'. You might want 162251883Speter to install the \`Autoconf' and \`GNU m4' packages. Grab them 163251883Speter from any GNU archive site." 164251883Speter files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 165251883Speter test -z "$files" && files="config.h" 166251883Speter touch_files= 167251883Speter for f in $files; do 168289166Speter case $f in 169251883Speter *:*) touch_files="$touch_files "`echo "$f" | 170251883Speter sed -e 's/^[^:]*://' -e 's/:.*//'`;; 171251883Speter *) touch_files="$touch_files $f.in";; 172251883Speter esac 173251883Speter done 174251883Speter touch $touch_files 175251883Speter ;; 176251883Speter 177251883Speter automake*) 178251883Speter echo 1>&2 "\ 179251883SpeterWARNING: \`$1' is $msg. You should only need it if 180251883Speter you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 181251883Speter You might want to install the \`Automake' and \`Perl' packages. 182251883Speter Grab them from any GNU archive site." 183251883Speter find . -type f -name Makefile.am -print | 184251883Speter sed 's/\.am$/.in/' | 185251883Speter while read f; do touch "$f"; done 186251883Speter ;; 187251883Speter 188289166Speter autom4te*) 189251883Speter echo 1>&2 "\ 190251883SpeterWARNING: \`$1' is needed, but is $msg. 191251883Speter You might have modified some files without having the 192251883Speter proper tools for further handling them. 193251883Speter You can get \`$1' as part of \`Autoconf' from any GNU 194251883Speter archive site." 195251883Speter 196289166Speter file=`echo "$*" | sed -n "$sed_output"` 197289166Speter test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 198251883Speter if test -f "$file"; then 199251883Speter touch $file 200251883Speter else 201251883Speter test -z "$file" || exec >$file 202251883Speter echo "#! /bin/sh" 203251883Speter echo "# Created by GNU Automake missing as a replacement of" 204251883Speter echo "# $ $@" 205251883Speter echo "exit 0" 206251883Speter chmod +x $file 207251883Speter exit 1 208251883Speter fi 209251883Speter ;; 210251883Speter 211289166Speter bison*|yacc*) 212251883Speter echo 1>&2 "\ 213251883SpeterWARNING: \`$1' $msg. You should only need it if 214251883Speter you modified a \`.y' file. You may need the \`Bison' package 215251883Speter in order for those modifications to take effect. You can get 216251883Speter \`Bison' from any GNU archive site." 217251883Speter rm -f y.tab.c y.tab.h 218289166Speter if test $# -ne 1; then 219289166Speter eval LASTARG=\${$#} 220289166Speter case $LASTARG in 221251883Speter *.y) 222251883Speter SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 223289166Speter if test -f "$SRCFILE"; then 224251883Speter cp "$SRCFILE" y.tab.c 225251883Speter fi 226251883Speter SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 227289166Speter if test -f "$SRCFILE"; then 228251883Speter cp "$SRCFILE" y.tab.h 229251883Speter fi 230251883Speter ;; 231251883Speter esac 232251883Speter fi 233289166Speter if test ! -f y.tab.h; then 234251883Speter echo >y.tab.h 235251883Speter fi 236289166Speter if test ! -f y.tab.c; then 237251883Speter echo 'main() { return 0; }' >y.tab.c 238251883Speter fi 239251883Speter ;; 240251883Speter 241289166Speter lex*|flex*) 242251883Speter echo 1>&2 "\ 243251883SpeterWARNING: \`$1' is $msg. You should only need it if 244251883Speter you modified a \`.l' file. You may need the \`Flex' package 245251883Speter in order for those modifications to take effect. You can get 246251883Speter \`Flex' from any GNU archive site." 247251883Speter rm -f lex.yy.c 248289166Speter if test $# -ne 1; then 249289166Speter eval LASTARG=\${$#} 250289166Speter case $LASTARG in 251251883Speter *.l) 252251883Speter SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 253289166Speter if test -f "$SRCFILE"; then 254251883Speter cp "$SRCFILE" lex.yy.c 255251883Speter fi 256251883Speter ;; 257251883Speter esac 258251883Speter fi 259289166Speter if test ! -f lex.yy.c; then 260251883Speter echo 'main() { return 0; }' >lex.yy.c 261251883Speter fi 262251883Speter ;; 263251883Speter 264289166Speter help2man*) 265251883Speter echo 1>&2 "\ 266251883SpeterWARNING: \`$1' is $msg. You should only need it if 267251883Speter you modified a dependency of a manual page. You may need the 268251883Speter \`Help2man' package in order for those modifications to take 269251883Speter effect. You can get \`Help2man' from any GNU archive site." 270251883Speter 271289166Speter file=`echo "$*" | sed -n "$sed_output"` 272289166Speter test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 273289166Speter if test -f "$file"; then 274251883Speter touch $file 275251883Speter else 276251883Speter test -z "$file" || exec >$file 277251883Speter echo ".ab help2man is required to generate this page" 278289166Speter exit $? 279251883Speter fi 280251883Speter ;; 281251883Speter 282289166Speter makeinfo*) 283251883Speter echo 1>&2 "\ 284251883SpeterWARNING: \`$1' is $msg. You should only need it if 285251883Speter you modified a \`.texi' or \`.texinfo' file, or any other file 286251883Speter indirectly affecting the aspect of the manual. The spurious 287251883Speter call might also be the consequence of using a buggy \`make' (AIX, 288251883Speter DU, IRIX). You might want to install the \`Texinfo' package or 289251883Speter the \`GNU make' package. Grab either from any GNU archive site." 290251883Speter # The file to touch is that specified with -o ... 291289166Speter file=`echo "$*" | sed -n "$sed_output"` 292289166Speter test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 293251883Speter if test -z "$file"; then 294251883Speter # ... or it is the one specified with @setfilename ... 295251883Speter infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 296289166Speter file=`sed -n ' 297289166Speter /^@setfilename/{ 298289166Speter s/.* \([^ ]*\) *$/\1/ 299289166Speter p 300289166Speter q 301289166Speter }' $infile` 302251883Speter # ... or it is derived from the source name (dir/f.texi becomes f.info) 303251883Speter test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 304251883Speter fi 305251883Speter # If the file does not exist, the user really needs makeinfo; 306251883Speter # let's fail without touching anything. 307251883Speter test -f $file || exit 1 308251883Speter touch $file 309251883Speter ;; 310251883Speter 311251883Speter *) 312251883Speter echo 1>&2 "\ 313251883SpeterWARNING: \`$1' is needed, and is $msg. 314251883Speter You might have modified some files without having the 315251883Speter proper tools for further handling them. Check the \`README' file, 316251883Speter it often tells you about the needed prerequisites for installing 317251883Speter this package. You may also peek at any GNU archive site, in case 318251883Speter some other package would contain this missing \`$1' program." 319251883Speter exit 1 320251883Speter ;; 321251883Speteresac 322251883Speter 323251883Speterexit 0 324251883Speter 325251883Speter# Local variables: 326251883Speter# eval: (add-hook 'write-file-hooks 'time-stamp) 327251883Speter# time-stamp-start: "scriptversion=" 328251883Speter# time-stamp-format: "%:y-%02m-%02d.%02H" 329289166Speter# time-stamp-time-zone: "UTC" 330289166Speter# time-stamp-end: "; # UTC" 331251883Speter# End: 332