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