missing revision 2a75d1c4
1f7ec340bSmacallan#! /bin/sh 2f7ec340bSmacallan# Common stub for a few missing GNU programs while installing. 3f7ec340bSmacallan 42a75d1c4Smrgscriptversion=2012-01-06.18; # UTC 5f7ec340bSmacallan 62a75d1c4Smrg# Copyright (C) 1996-2012 Free Software Foundation, Inc. 7f7ec340bSmacallan# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8f7ec340bSmacallan 9f7ec340bSmacallan# This program is free software; you can redistribute it and/or modify 10f7ec340bSmacallan# it under the terms of the GNU General Public License as published by 11f7ec340bSmacallan# the Free Software Foundation; either version 2, or (at your option) 12f7ec340bSmacallan# any later version. 13f7ec340bSmacallan 14f7ec340bSmacallan# This program is distributed in the hope that it will be useful, 15f7ec340bSmacallan# but WITHOUT ANY WARRANTY; without even the implied warranty of 16f7ec340bSmacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17f7ec340bSmacallan# GNU General Public License for more details. 18f7ec340bSmacallan 19f7ec340bSmacallan# You should have received a copy of the GNU General Public License 202a75d1c4Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21f7ec340bSmacallan 22f7ec340bSmacallan# As a special exception to the GNU General Public License, if you 23f7ec340bSmacallan# distribute this file as part of a program that contains a 24f7ec340bSmacallan# configuration script generated by Autoconf, you may include it under 25f7ec340bSmacallan# the same distribution terms that you use for the rest of that program. 26f7ec340bSmacallan 27f7ec340bSmacallanif test $# -eq 0; then 282a75d1c4Smrg echo 1>&2 "Try '$0 --help' for more information" 29f7ec340bSmacallan exit 1 30f7ec340bSmacallanfi 31f7ec340bSmacallan 32f7ec340bSmacallanrun=: 337ce7e03cSmrgsed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 347ce7e03cSmrgsed_minuso='s/.* -o \([^ ]*\).*/\1/p' 35f7ec340bSmacallan 362a75d1c4Smrg# In the cases where this matters, 'missing' is being run in the 37f7ec340bSmacallan# srcdir already. 38f7ec340bSmacallanif test -f configure.ac; then 39f7ec340bSmacallan configure_ac=configure.ac 40f7ec340bSmacallanelse 41f7ec340bSmacallan configure_ac=configure.in 42f7ec340bSmacallanfi 43f7ec340bSmacallan 44f7ec340bSmacallanmsg="missing on your system" 45f7ec340bSmacallan 467ce7e03cSmrgcase $1 in 47f7ec340bSmacallan--run) 48f7ec340bSmacallan # Try to run requested program, and just exit if it succeeds. 49f7ec340bSmacallan run= 50f7ec340bSmacallan shift 51f7ec340bSmacallan "$@" && exit 0 52f7ec340bSmacallan # Exit code 63 means version mismatch. This often happens 53f7ec340bSmacallan # when the user try to use an ancient version of a tool on 54f7ec340bSmacallan # a file that requires a minimum version. In this case we 55f7ec340bSmacallan # we should proceed has if the program had been absent, or 56f7ec340bSmacallan # if --run hadn't been passed. 57f7ec340bSmacallan if test $? = 63; then 58f7ec340bSmacallan run=: 59f7ec340bSmacallan msg="probably too old" 60f7ec340bSmacallan fi 61f7ec340bSmacallan ;; 62f7ec340bSmacallan 63f7ec340bSmacallan -h|--h|--he|--hel|--help) 64f7ec340bSmacallan echo "\ 65f7ec340bSmacallan$0 [OPTION]... PROGRAM [ARGUMENT]... 66f7ec340bSmacallan 672a75d1c4SmrgHandle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 68f7ec340bSmacallanerror status if there is no known handling for PROGRAM. 69f7ec340bSmacallan 70f7ec340bSmacallanOptions: 71f7ec340bSmacallan -h, --help display this help and exit 72f7ec340bSmacallan -v, --version output version information and exit 73f7ec340bSmacallan --run try to run the given command, and emulate it if it fails 74f7ec340bSmacallan 75f7ec340bSmacallanSupported PROGRAM values: 762a75d1c4Smrg aclocal touch file 'aclocal.m4' 772a75d1c4Smrg autoconf touch file 'configure' 782a75d1c4Smrg autoheader touch file 'config.h.in' 797ce7e03cSmrg autom4te touch the output file, or create a stub one 802a75d1c4Smrg automake touch all 'Makefile.in' files 812a75d1c4Smrg bison create 'y.tab.[ch]', if possible, from existing .[ch] 822a75d1c4Smrg flex create 'lex.yy.c', if possible, from existing .c 83f7ec340bSmacallan help2man touch the output file 842a75d1c4Smrg lex create 'lex.yy.c', if possible, from existing .c 85f7ec340bSmacallan makeinfo touch the output file 862a75d1c4Smrg yacc create 'y.tab.[ch]', if possible, from existing .[ch] 872a75d1c4Smrg 882a75d1c4SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 892a75d1c4Smrg'g' are ignored when checking the name. 90f7ec340bSmacallan 91f7ec340bSmacallanSend bug reports to <bug-automake@gnu.org>." 92f7ec340bSmacallan exit $? 93f7ec340bSmacallan ;; 94f7ec340bSmacallan 95f7ec340bSmacallan -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 96f7ec340bSmacallan echo "missing $scriptversion (GNU Automake)" 97f7ec340bSmacallan exit $? 98f7ec340bSmacallan ;; 99f7ec340bSmacallan 100f7ec340bSmacallan -*) 1012a75d1c4Smrg echo 1>&2 "$0: Unknown '$1' option" 1022a75d1c4Smrg echo 1>&2 "Try '$0 --help' for more information" 103f7ec340bSmacallan exit 1 104f7ec340bSmacallan ;; 105f7ec340bSmacallan 106f7ec340bSmacallanesac 107f7ec340bSmacallan 1082a75d1c4Smrg# normalize program name to check for. 1092a75d1c4Smrgprogram=`echo "$1" | sed ' 1102a75d1c4Smrg s/^gnu-//; t 1112a75d1c4Smrg s/^gnu//; t 1122a75d1c4Smrg s/^g//; t'` 1132a75d1c4Smrg 114f7ec340bSmacallan# Now exit if we have it, but it failed. Also exit now if we 115f7ec340bSmacallan# don't have it and --version was passed (most likely to detect 1162a75d1c4Smrg# the program). This is about non-GNU programs, so use $1 not 1172a75d1c4Smrg# $program. 1187ce7e03cSmrgcase $1 in 1192a75d1c4Smrg lex*|yacc*) 120f7ec340bSmacallan # Not GNU programs, they don't have --version. 121f7ec340bSmacallan ;; 122f7ec340bSmacallan 123f7ec340bSmacallan *) 124f7ec340bSmacallan if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 125f7ec340bSmacallan # We have it, but it failed. 126f7ec340bSmacallan exit 1 127f7ec340bSmacallan elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 128f7ec340bSmacallan # Could not run --version or --help. This is probably someone 1292a75d1c4Smrg # running '$TOOL --version' or '$TOOL --help' to check whether 130f7ec340bSmacallan # $TOOL exists and not knowing $TOOL uses missing. 131f7ec340bSmacallan exit 1 132f7ec340bSmacallan fi 133f7ec340bSmacallan ;; 134f7ec340bSmacallanesac 135f7ec340bSmacallan 136f7ec340bSmacallan# If it does not exist, or fails to run (possibly an outdated version), 137f7ec340bSmacallan# try to emulate it. 1382a75d1c4Smrgcase $program in 139f7ec340bSmacallan aclocal*) 140f7ec340bSmacallan echo 1>&2 "\ 1412a75d1c4SmrgWARNING: '$1' is $msg. You should only need it if 1422a75d1c4Smrg you modified 'acinclude.m4' or '${configure_ac}'. You might want 1432a75d1c4Smrg to install the Automake and Perl packages. Grab them from 144f7ec340bSmacallan any GNU archive site." 145f7ec340bSmacallan touch aclocal.m4 146f7ec340bSmacallan ;; 147f7ec340bSmacallan 1482a75d1c4Smrg autoconf*) 149f7ec340bSmacallan echo 1>&2 "\ 1502a75d1c4SmrgWARNING: '$1' is $msg. You should only need it if 1512a75d1c4Smrg you modified '${configure_ac}'. You might want to install the 1522a75d1c4Smrg Autoconf and GNU m4 packages. Grab them from any GNU 153f7ec340bSmacallan archive site." 154f7ec340bSmacallan touch configure 155f7ec340bSmacallan ;; 156f7ec340bSmacallan 1572a75d1c4Smrg autoheader*) 158f7ec340bSmacallan echo 1>&2 "\ 1592a75d1c4SmrgWARNING: '$1' is $msg. You should only need it if 1602a75d1c4Smrg you modified 'acconfig.h' or '${configure_ac}'. You might want 1612a75d1c4Smrg to install the Autoconf and GNU m4 packages. Grab them 162f7ec340bSmacallan from any GNU archive site." 163f7ec340bSmacallan files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 164f7ec340bSmacallan test -z "$files" && files="config.h" 165f7ec340bSmacallan touch_files= 166f7ec340bSmacallan for f in $files; do 1677ce7e03cSmrg case $f in 168f7ec340bSmacallan *:*) touch_files="$touch_files "`echo "$f" | 169f7ec340bSmacallan sed -e 's/^[^:]*://' -e 's/:.*//'`;; 170f7ec340bSmacallan *) touch_files="$touch_files $f.in";; 171f7ec340bSmacallan esac 172f7ec340bSmacallan done 173f7ec340bSmacallan touch $touch_files 174f7ec340bSmacallan ;; 175f7ec340bSmacallan 176f7ec340bSmacallan automake*) 177f7ec340bSmacallan echo 1>&2 "\ 1782a75d1c4SmrgWARNING: '$1' is $msg. You should only need it if 1792a75d1c4Smrg you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'. 1802a75d1c4Smrg You might want to install the Automake and Perl packages. 181f7ec340bSmacallan Grab them from any GNU archive site." 182f7ec340bSmacallan find . -type f -name Makefile.am -print | 183f7ec340bSmacallan sed 's/\.am$/.in/' | 184f7ec340bSmacallan while read f; do touch "$f"; done 185f7ec340bSmacallan ;; 186f7ec340bSmacallan 1872a75d1c4Smrg autom4te*) 188f7ec340bSmacallan echo 1>&2 "\ 1892a75d1c4SmrgWARNING: '$1' is needed, but is $msg. 190f7ec340bSmacallan You might have modified some files without having the 191f7ec340bSmacallan proper tools for further handling them. 1922a75d1c4Smrg You can get '$1' as part of Autoconf from any GNU 193f7ec340bSmacallan archive site." 194f7ec340bSmacallan 1957ce7e03cSmrg file=`echo "$*" | sed -n "$sed_output"` 1967ce7e03cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 197f7ec340bSmacallan if test -f "$file"; then 198f7ec340bSmacallan touch $file 199f7ec340bSmacallan else 200f7ec340bSmacallan test -z "$file" || exec >$file 201f7ec340bSmacallan echo "#! /bin/sh" 202f7ec340bSmacallan echo "# Created by GNU Automake missing as a replacement of" 203f7ec340bSmacallan echo "# $ $@" 204f7ec340bSmacallan echo "exit 0" 205f7ec340bSmacallan chmod +x $file 206f7ec340bSmacallan exit 1 207f7ec340bSmacallan fi 208f7ec340bSmacallan ;; 209f7ec340bSmacallan 2102a75d1c4Smrg bison*|yacc*) 211f7ec340bSmacallan echo 1>&2 "\ 2122a75d1c4SmrgWARNING: '$1' $msg. You should only need it if 2132a75d1c4Smrg you modified a '.y' file. You may need the Bison package 214f7ec340bSmacallan in order for those modifications to take effect. You can get 2152a75d1c4Smrg Bison from any GNU archive site." 216f7ec340bSmacallan rm -f y.tab.c y.tab.h 2177ce7e03cSmrg if test $# -ne 1; then 2182a75d1c4Smrg eval LASTARG=\${$#} 2197ce7e03cSmrg case $LASTARG in 220f7ec340bSmacallan *.y) 221f7ec340bSmacallan SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 2227ce7e03cSmrg if test -f "$SRCFILE"; then 223f7ec340bSmacallan cp "$SRCFILE" y.tab.c 224f7ec340bSmacallan fi 225f7ec340bSmacallan SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2267ce7e03cSmrg if test -f "$SRCFILE"; then 227f7ec340bSmacallan cp "$SRCFILE" y.tab.h 228f7ec340bSmacallan fi 229f7ec340bSmacallan ;; 230f7ec340bSmacallan esac 231f7ec340bSmacallan fi 2327ce7e03cSmrg if test ! -f y.tab.h; then 233f7ec340bSmacallan echo >y.tab.h 234f7ec340bSmacallan fi 2357ce7e03cSmrg if test ! -f y.tab.c; then 236f7ec340bSmacallan echo 'main() { return 0; }' >y.tab.c 237f7ec340bSmacallan fi 238f7ec340bSmacallan ;; 239f7ec340bSmacallan 2402a75d1c4Smrg lex*|flex*) 241f7ec340bSmacallan echo 1>&2 "\ 2422a75d1c4SmrgWARNING: '$1' is $msg. You should only need it if 2432a75d1c4Smrg you modified a '.l' file. You may need the Flex package 244f7ec340bSmacallan in order for those modifications to take effect. You can get 2452a75d1c4Smrg Flex from any GNU archive site." 246f7ec340bSmacallan rm -f lex.yy.c 2477ce7e03cSmrg if test $# -ne 1; then 2482a75d1c4Smrg eval LASTARG=\${$#} 2497ce7e03cSmrg case $LASTARG in 250f7ec340bSmacallan *.l) 251f7ec340bSmacallan SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2527ce7e03cSmrg if test -f "$SRCFILE"; then 253f7ec340bSmacallan cp "$SRCFILE" lex.yy.c 254f7ec340bSmacallan fi 255f7ec340bSmacallan ;; 256f7ec340bSmacallan esac 257f7ec340bSmacallan fi 2587ce7e03cSmrg if test ! -f lex.yy.c; then 259f7ec340bSmacallan echo 'main() { return 0; }' >lex.yy.c 260f7ec340bSmacallan fi 261f7ec340bSmacallan ;; 262f7ec340bSmacallan 2632a75d1c4Smrg help2man*) 264f7ec340bSmacallan echo 1>&2 "\ 2652a75d1c4SmrgWARNING: '$1' is $msg. You should only need it if 266f7ec340bSmacallan you modified a dependency of a manual page. You may need the 2672a75d1c4Smrg Help2man package in order for those modifications to take 2682a75d1c4Smrg effect. You can get Help2man from any GNU archive site." 269f7ec340bSmacallan 2707ce7e03cSmrg file=`echo "$*" | sed -n "$sed_output"` 2717ce7e03cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 2727ce7e03cSmrg if test -f "$file"; then 273f7ec340bSmacallan touch $file 274f7ec340bSmacallan else 275f7ec340bSmacallan test -z "$file" || exec >$file 276f7ec340bSmacallan echo ".ab help2man is required to generate this page" 2772a75d1c4Smrg exit $? 278f7ec340bSmacallan fi 279f7ec340bSmacallan ;; 280f7ec340bSmacallan 2812a75d1c4Smrg makeinfo*) 282f7ec340bSmacallan echo 1>&2 "\ 2832a75d1c4SmrgWARNING: '$1' is $msg. You should only need it if 2842a75d1c4Smrg you modified a '.texi' or '.texinfo' file, or any other file 285f7ec340bSmacallan indirectly affecting the aspect of the manual. The spurious 2862a75d1c4Smrg call might also be the consequence of using a buggy 'make' (AIX, 2872a75d1c4Smrg DU, IRIX). You might want to install the Texinfo package or 2882a75d1c4Smrg the GNU make package. Grab either from any GNU archive site." 289f7ec340bSmacallan # The file to touch is that specified with -o ... 2907ce7e03cSmrg file=`echo "$*" | sed -n "$sed_output"` 2917ce7e03cSmrg test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 292f7ec340bSmacallan if test -z "$file"; then 293f7ec340bSmacallan # ... or it is the one specified with @setfilename ... 294f7ec340bSmacallan infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2957ce7e03cSmrg file=`sed -n ' 2967ce7e03cSmrg /^@setfilename/{ 2977ce7e03cSmrg s/.* \([^ ]*\) *$/\1/ 2987ce7e03cSmrg p 2997ce7e03cSmrg q 3007ce7e03cSmrg }' $infile` 301f7ec340bSmacallan # ... or it is derived from the source name (dir/f.texi becomes f.info) 302f7ec340bSmacallan test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 303f7ec340bSmacallan fi 304f7ec340bSmacallan # If the file does not exist, the user really needs makeinfo; 305f7ec340bSmacallan # let's fail without touching anything. 306f7ec340bSmacallan test -f $file || exit 1 307f7ec340bSmacallan touch $file 308f7ec340bSmacallan ;; 309f7ec340bSmacallan 310f7ec340bSmacallan *) 311f7ec340bSmacallan echo 1>&2 "\ 3122a75d1c4SmrgWARNING: '$1' is needed, and is $msg. 313f7ec340bSmacallan You might have modified some files without having the 3142a75d1c4Smrg proper tools for further handling them. Check the 'README' file, 315f7ec340bSmacallan it often tells you about the needed prerequisites for installing 316f7ec340bSmacallan this package. You may also peek at any GNU archive site, in case 3172a75d1c4Smrg some other package would contain this missing '$1' program." 318f7ec340bSmacallan exit 1 319f7ec340bSmacallan ;; 320f7ec340bSmacallanesac 321f7ec340bSmacallan 322f7ec340bSmacallanexit 0 323f7ec340bSmacallan 324f7ec340bSmacallan# Local variables: 325f7ec340bSmacallan# eval: (add-hook 'write-file-hooks 'time-stamp) 326f7ec340bSmacallan# time-stamp-start: "scriptversion=" 327f7ec340bSmacallan# time-stamp-format: "%:y-%02m-%02d.%02H" 3282a75d1c4Smrg# time-stamp-time-zone: "UTC" 3292a75d1c4Smrg# time-stamp-end: "; # UTC" 330f7ec340bSmacallan# End: 331