1b528cefcSMark Murray#! /bin/sh 25e9cd1aeSAssar Westerlund# Common stub for a few missing GNU programs while installing. 31c43270aSJacques Vidrine# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. 45e9cd1aeSAssar Westerlund# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 55e9cd1aeSAssar Westerlund 65e9cd1aeSAssar Westerlund# This program is free software; you can redistribute it and/or modify 75e9cd1aeSAssar Westerlund# it under the terms of the GNU General Public License as published by 85e9cd1aeSAssar Westerlund# the Free Software Foundation; either version 2, or (at your option) 95e9cd1aeSAssar Westerlund# any later version. 105e9cd1aeSAssar Westerlund 115e9cd1aeSAssar Westerlund# This program is distributed in the hope that it will be useful, 125e9cd1aeSAssar Westerlund# but WITHOUT ANY WARRANTY; without even the implied warranty of 135e9cd1aeSAssar Westerlund# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 145e9cd1aeSAssar Westerlund# GNU General Public License for more details. 155e9cd1aeSAssar Westerlund 165e9cd1aeSAssar Westerlund# You should have received a copy of the GNU General Public License 175e9cd1aeSAssar Westerlund# along with this program; if not, write to the Free Software 185e9cd1aeSAssar Westerlund# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 195e9cd1aeSAssar Westerlund# 02111-1307, USA. 205e9cd1aeSAssar Westerlund 218373020dSJacques Vidrine# As a special exception to the GNU General Public License, if you 228373020dSJacques Vidrine# distribute this file as part of a program that contains a 238373020dSJacques Vidrine# configuration script generated by Autoconf, you may include it under 248373020dSJacques Vidrine# the same distribution terms that you use for the rest of that program. 258373020dSJacques Vidrine 265e9cd1aeSAssar Westerlundif test $# -eq 0; then 275e9cd1aeSAssar Westerlund echo 1>&2 "Try \`$0 --help' for more information" 285e9cd1aeSAssar Westerlund exit 1 295e9cd1aeSAssar Westerlundfi 305e9cd1aeSAssar Westerlund 315e9cd1aeSAssar Westerlundrun=: 325e9cd1aeSAssar Westerlund 338373020dSJacques Vidrine# In the cases where this matters, `missing' is being run in the 348373020dSJacques Vidrine# srcdir already. 358373020dSJacques Vidrineif test -f configure.ac; then 368373020dSJacques Vidrine configure_ac=configure.ac 378373020dSJacques Vidrineelse 388373020dSJacques Vidrine configure_ac=configure.in 398373020dSJacques Vidrinefi 408373020dSJacques Vidrine 415e9cd1aeSAssar Westerlundcase "$1" in 425e9cd1aeSAssar Westerlund--run) 435e9cd1aeSAssar Westerlund # Try to run requested program, and just exit if it succeeds. 445e9cd1aeSAssar Westerlund run= 455e9cd1aeSAssar Westerlund shift 465e9cd1aeSAssar Westerlund "$@" && exit 0 475e9cd1aeSAssar Westerlund ;; 485e9cd1aeSAssar Westerlundesac 495e9cd1aeSAssar Westerlund 505e9cd1aeSAssar Westerlund# If it does not exist, or fails to run (possibly an outdated version), 515e9cd1aeSAssar Westerlund# try to emulate it. 525e9cd1aeSAssar Westerlundcase "$1" in 535e9cd1aeSAssar Westerlund 545e9cd1aeSAssar Westerlund -h|--h|--he|--hel|--help) 555e9cd1aeSAssar Westerlund echo "\ 565e9cd1aeSAssar Westerlund$0 [OPTION]... PROGRAM [ARGUMENT]... 575e9cd1aeSAssar Westerlund 585e9cd1aeSAssar WesterlundHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 595e9cd1aeSAssar Westerlunderror status if there is no known handling for PROGRAM. 605e9cd1aeSAssar Westerlund 615e9cd1aeSAssar WesterlundOptions: 625e9cd1aeSAssar Westerlund -h, --help display this help and exit 635e9cd1aeSAssar Westerlund -v, --version output version information and exit 645e9cd1aeSAssar Westerlund --run try to run the given command, and emulate it if it fails 655e9cd1aeSAssar Westerlund 665e9cd1aeSAssar WesterlundSupported PROGRAM values: 675e9cd1aeSAssar Westerlund aclocal touch file \`aclocal.m4' 685e9cd1aeSAssar Westerlund autoconf touch file \`configure' 695e9cd1aeSAssar Westerlund autoheader touch file \`config.h.in' 705e9cd1aeSAssar Westerlund automake touch all \`Makefile.in' files 715e9cd1aeSAssar Westerlund bison create \`y.tab.[ch]', if possible, from existing .[ch] 725e9cd1aeSAssar Westerlund flex create \`lex.yy.c', if possible, from existing .c 735e9cd1aeSAssar Westerlund help2man touch the output file 745e9cd1aeSAssar Westerlund lex create \`lex.yy.c', if possible, from existing .c 755e9cd1aeSAssar Westerlund makeinfo touch the output file 765e9cd1aeSAssar Westerlund tar try tar, gnutar, gtar, then tar without non-portable flags 775e9cd1aeSAssar Westerlund yacc create \`y.tab.[ch]', if possible, from existing .[ch]" 785e9cd1aeSAssar Westerlund ;; 795e9cd1aeSAssar Westerlund 805e9cd1aeSAssar Westerlund -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 818373020dSJacques Vidrine echo "missing 0.4 - GNU automake" 825e9cd1aeSAssar Westerlund ;; 835e9cd1aeSAssar Westerlund 845e9cd1aeSAssar Westerlund -*) 855e9cd1aeSAssar Westerlund echo 1>&2 "$0: Unknown \`$1' option" 865e9cd1aeSAssar Westerlund echo 1>&2 "Try \`$0 --help' for more information" 875e9cd1aeSAssar Westerlund exit 1 885e9cd1aeSAssar Westerlund ;; 895e9cd1aeSAssar Westerlund 908373020dSJacques Vidrine aclocal*) 918373020dSJacques Vidrine if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 928373020dSJacques Vidrine # We have it, but it failed. 938373020dSJacques Vidrine exit 1 948373020dSJacques Vidrine fi 958373020dSJacques Vidrine 965e9cd1aeSAssar Westerlund echo 1>&2 "\ 975e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 988373020dSJacques Vidrine you modified \`acinclude.m4' or \`${configure_ac}'. You might want 995e9cd1aeSAssar Westerlund to install the \`Automake' and \`Perl' packages. Grab them from 1005e9cd1aeSAssar Westerlund any GNU archive site." 1015e9cd1aeSAssar Westerlund touch aclocal.m4 1025e9cd1aeSAssar Westerlund ;; 1035e9cd1aeSAssar Westerlund 1045e9cd1aeSAssar Westerlund autoconf) 1058373020dSJacques Vidrine if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1068373020dSJacques Vidrine # We have it, but it failed. 1078373020dSJacques Vidrine exit 1 1088373020dSJacques Vidrine fi 1098373020dSJacques Vidrine 1105e9cd1aeSAssar Westerlund echo 1>&2 "\ 1115e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 1128373020dSJacques Vidrine you modified \`${configure_ac}'. You might want to install the 1135e9cd1aeSAssar Westerlund \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 1145e9cd1aeSAssar Westerlund archive site." 1155e9cd1aeSAssar Westerlund touch configure 1165e9cd1aeSAssar Westerlund ;; 1175e9cd1aeSAssar Westerlund 1185e9cd1aeSAssar Westerlund autoheader) 1198373020dSJacques Vidrine if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1208373020dSJacques Vidrine # We have it, but it failed. 1218373020dSJacques Vidrine exit 1 1228373020dSJacques Vidrine fi 1238373020dSJacques Vidrine 1245e9cd1aeSAssar Westerlund echo 1>&2 "\ 1255e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 1268373020dSJacques Vidrine you modified \`acconfig.h' or \`${configure_ac}'. You might want 1275e9cd1aeSAssar Westerlund to install the \`Autoconf' and \`GNU m4' packages. Grab them 1285e9cd1aeSAssar Westerlund from any GNU archive site." 1298373020dSJacques Vidrine files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 1305e9cd1aeSAssar Westerlund test -z "$files" && files="config.h" 1315e9cd1aeSAssar Westerlund touch_files= 1325e9cd1aeSAssar Westerlund for f in $files; do 1335e9cd1aeSAssar Westerlund case "$f" in 1345e9cd1aeSAssar Westerlund *:*) touch_files="$touch_files "`echo "$f" | 1355e9cd1aeSAssar Westerlund sed -e 's/^[^:]*://' -e 's/:.*//'`;; 1365e9cd1aeSAssar Westerlund *) touch_files="$touch_files $f.in";; 1375e9cd1aeSAssar Westerlund esac 1385e9cd1aeSAssar Westerlund done 1395e9cd1aeSAssar Westerlund touch $touch_files 1405e9cd1aeSAssar Westerlund ;; 1415e9cd1aeSAssar Westerlund 1428373020dSJacques Vidrine automake*) 1438373020dSJacques Vidrine if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1448373020dSJacques Vidrine # We have it, but it failed. 1458373020dSJacques Vidrine exit 1 1468373020dSJacques Vidrine fi 1478373020dSJacques Vidrine 1485e9cd1aeSAssar Westerlund echo 1>&2 "\ 1495e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 1508373020dSJacques Vidrine you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 1515e9cd1aeSAssar Westerlund You might want to install the \`Automake' and \`Perl' packages. 1525e9cd1aeSAssar Westerlund Grab them from any GNU archive site." 1535e9cd1aeSAssar Westerlund find . -type f -name Makefile.am -print | 1545e9cd1aeSAssar Westerlund sed 's/\.am$/.in/' | 1555e9cd1aeSAssar Westerlund while read f; do touch "$f"; done 1565e9cd1aeSAssar Westerlund ;; 1575e9cd1aeSAssar Westerlund 1588373020dSJacques Vidrine autom4te) 1598373020dSJacques Vidrine if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 1608373020dSJacques Vidrine # We have it, but it failed. 1618373020dSJacques Vidrine exit 1 1628373020dSJacques Vidrine fi 1638373020dSJacques Vidrine 1648373020dSJacques Vidrine echo 1>&2 "\ 1658373020dSJacques VidrineWARNING: \`$1' is needed, and you do not seem to have it handy on your 1668373020dSJacques Vidrine system. You might have modified some files without having the 1678373020dSJacques Vidrine proper tools for further handling them. 1681c43270aSJacques Vidrine You can get \`$1' as part of \`Autoconf' from any GNU 1698373020dSJacques Vidrine archive site." 1708373020dSJacques Vidrine 1718373020dSJacques Vidrine file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` 1728373020dSJacques Vidrine test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` 1738373020dSJacques Vidrine if test -f "$file"; then 1748373020dSJacques Vidrine touch $file 1758373020dSJacques Vidrine else 1768373020dSJacques Vidrine test -z "$file" || exec >$file 1778373020dSJacques Vidrine echo "#! /bin/sh" 1788373020dSJacques Vidrine echo "# Created by GNU Automake missing as a replacement of" 1798373020dSJacques Vidrine echo "# $ $@" 1808373020dSJacques Vidrine echo "exit 0" 1818373020dSJacques Vidrine chmod +x $file 1828373020dSJacques Vidrine exit 1 1838373020dSJacques Vidrine fi 1848373020dSJacques Vidrine ;; 1858373020dSJacques Vidrine 1865e9cd1aeSAssar Westerlund bison|yacc) 1875e9cd1aeSAssar Westerlund echo 1>&2 "\ 1885e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 1895e9cd1aeSAssar Westerlund you modified a \`.y' file. You may need the \`Bison' package 1905e9cd1aeSAssar Westerlund in order for those modifications to take effect. You can get 1915e9cd1aeSAssar Westerlund \`Bison' from any GNU archive site." 1925e9cd1aeSAssar Westerlund rm -f y.tab.c y.tab.h 1935e9cd1aeSAssar Westerlund if [ $# -ne 1 ]; then 1945e9cd1aeSAssar Westerlund eval LASTARG="\${$#}" 1955e9cd1aeSAssar Westerlund case "$LASTARG" in 1965e9cd1aeSAssar Westerlund *.y) 1975e9cd1aeSAssar Westerlund SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 1985e9cd1aeSAssar Westerlund if [ -f "$SRCFILE" ]; then 1995e9cd1aeSAssar Westerlund cp "$SRCFILE" y.tab.c 2005e9cd1aeSAssar Westerlund fi 2015e9cd1aeSAssar Westerlund SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 2025e9cd1aeSAssar Westerlund if [ -f "$SRCFILE" ]; then 2035e9cd1aeSAssar Westerlund cp "$SRCFILE" y.tab.h 2045e9cd1aeSAssar Westerlund fi 2055e9cd1aeSAssar Westerlund ;; 2065e9cd1aeSAssar Westerlund esac 2075e9cd1aeSAssar Westerlund fi 2085e9cd1aeSAssar Westerlund if [ ! -f y.tab.h ]; then 2095e9cd1aeSAssar Westerlund echo >y.tab.h 2105e9cd1aeSAssar Westerlund fi 2115e9cd1aeSAssar Westerlund if [ ! -f y.tab.c ]; then 2125e9cd1aeSAssar Westerlund echo 'main() { return 0; }' >y.tab.c 2135e9cd1aeSAssar Westerlund fi 2145e9cd1aeSAssar Westerlund ;; 2155e9cd1aeSAssar Westerlund 2165e9cd1aeSAssar Westerlund lex|flex) 2175e9cd1aeSAssar Westerlund echo 1>&2 "\ 2185e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 2195e9cd1aeSAssar Westerlund you modified a \`.l' file. You may need the \`Flex' package 2205e9cd1aeSAssar Westerlund in order for those modifications to take effect. You can get 2215e9cd1aeSAssar Westerlund \`Flex' from any GNU archive site." 2225e9cd1aeSAssar Westerlund rm -f lex.yy.c 2235e9cd1aeSAssar Westerlund if [ $# -ne 1 ]; then 2245e9cd1aeSAssar Westerlund eval LASTARG="\${$#}" 2255e9cd1aeSAssar Westerlund case "$LASTARG" in 2265e9cd1aeSAssar Westerlund *.l) 2275e9cd1aeSAssar Westerlund SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 2285e9cd1aeSAssar Westerlund if [ -f "$SRCFILE" ]; then 2295e9cd1aeSAssar Westerlund cp "$SRCFILE" lex.yy.c 2305e9cd1aeSAssar Westerlund fi 2315e9cd1aeSAssar Westerlund ;; 2325e9cd1aeSAssar Westerlund esac 2335e9cd1aeSAssar Westerlund fi 2345e9cd1aeSAssar Westerlund if [ ! -f lex.yy.c ]; then 2355e9cd1aeSAssar Westerlund echo 'main() { return 0; }' >lex.yy.c 2365e9cd1aeSAssar Westerlund fi 2375e9cd1aeSAssar Westerlund ;; 2385e9cd1aeSAssar Westerlund 2395e9cd1aeSAssar Westerlund help2man) 2408373020dSJacques Vidrine if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 2418373020dSJacques Vidrine # We have it, but it failed. 2428373020dSJacques Vidrine exit 1 2438373020dSJacques Vidrine fi 2448373020dSJacques Vidrine 2455e9cd1aeSAssar Westerlund echo 1>&2 "\ 2465e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 2475e9cd1aeSAssar Westerlund you modified a dependency of a manual page. You may need the 2485e9cd1aeSAssar Westerlund \`Help2man' package in order for those modifications to take 2495e9cd1aeSAssar Westerlund effect. You can get \`Help2man' from any GNU archive site." 2505e9cd1aeSAssar Westerlund 2515e9cd1aeSAssar Westerlund file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2525e9cd1aeSAssar Westerlund if test -z "$file"; then 2535e9cd1aeSAssar Westerlund file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` 2545e9cd1aeSAssar Westerlund fi 2555e9cd1aeSAssar Westerlund if [ -f "$file" ]; then 2565e9cd1aeSAssar Westerlund touch $file 2575e9cd1aeSAssar Westerlund else 2585e9cd1aeSAssar Westerlund test -z "$file" || exec >$file 2595e9cd1aeSAssar Westerlund echo ".ab help2man is required to generate this page" 2605e9cd1aeSAssar Westerlund exit 1 2615e9cd1aeSAssar Westerlund fi 2625e9cd1aeSAssar Westerlund ;; 2635e9cd1aeSAssar Westerlund 2645e9cd1aeSAssar Westerlund makeinfo) 2658373020dSJacques Vidrine if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then 2668373020dSJacques Vidrine # We have makeinfo, but it failed. 2678373020dSJacques Vidrine exit 1 2688373020dSJacques Vidrine fi 2698373020dSJacques Vidrine 2705e9cd1aeSAssar Westerlund echo 1>&2 "\ 2715e9cd1aeSAssar WesterlundWARNING: \`$1' is missing on your system. You should only need it if 2725e9cd1aeSAssar Westerlund you modified a \`.texi' or \`.texinfo' file, or any other file 2735e9cd1aeSAssar Westerlund indirectly affecting the aspect of the manual. The spurious 2745e9cd1aeSAssar Westerlund call might also be the consequence of using a buggy \`make' (AIX, 2755e9cd1aeSAssar Westerlund DU, IRIX). You might want to install the \`Texinfo' package or 2765e9cd1aeSAssar Westerlund the \`GNU make' package. Grab either from any GNU archive site." 2775e9cd1aeSAssar Westerlund file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` 2785e9cd1aeSAssar Westerlund if test -z "$file"; then 2795e9cd1aeSAssar Westerlund file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 2805e9cd1aeSAssar Westerlund file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` 2815e9cd1aeSAssar Westerlund fi 2825e9cd1aeSAssar Westerlund touch $file 2835e9cd1aeSAssar Westerlund ;; 2845e9cd1aeSAssar Westerlund 2855e9cd1aeSAssar Westerlund tar) 2865e9cd1aeSAssar Westerlund shift 2875e9cd1aeSAssar Westerlund if test -n "$run"; then 2885e9cd1aeSAssar Westerlund echo 1>&2 "ERROR: \`tar' requires --run" 2895e9cd1aeSAssar Westerlund exit 1 2905e9cd1aeSAssar Westerlund fi 2915e9cd1aeSAssar Westerlund 2925e9cd1aeSAssar Westerlund # We have already tried tar in the generic part. 2935e9cd1aeSAssar Westerlund # Look for gnutar/gtar before invocation to avoid ugly error 2945e9cd1aeSAssar Westerlund # messages. 2955e9cd1aeSAssar Westerlund if (gnutar --version > /dev/null 2>&1); then 2961c43270aSJacques Vidrine gnutar "$@" && exit 0 2975e9cd1aeSAssar Westerlund fi 2985e9cd1aeSAssar Westerlund if (gtar --version > /dev/null 2>&1); then 2991c43270aSJacques Vidrine gtar "$@" && exit 0 3005e9cd1aeSAssar Westerlund fi 3015e9cd1aeSAssar Westerlund firstarg="$1" 3025e9cd1aeSAssar Westerlund if shift; then 3035e9cd1aeSAssar Westerlund case "$firstarg" in 3045e9cd1aeSAssar Westerlund *o*) 3055e9cd1aeSAssar Westerlund firstarg=`echo "$firstarg" | sed s/o//` 3061c43270aSJacques Vidrine tar "$firstarg" "$@" && exit 0 3075e9cd1aeSAssar Westerlund ;; 3085e9cd1aeSAssar Westerlund esac 3095e9cd1aeSAssar Westerlund case "$firstarg" in 3105e9cd1aeSAssar Westerlund *h*) 3115e9cd1aeSAssar Westerlund firstarg=`echo "$firstarg" | sed s/h//` 3121c43270aSJacques Vidrine tar "$firstarg" "$@" && exit 0 3135e9cd1aeSAssar Westerlund ;; 3145e9cd1aeSAssar Westerlund esac 3155e9cd1aeSAssar Westerlund fi 3165e9cd1aeSAssar Westerlund 3175e9cd1aeSAssar Westerlund echo 1>&2 "\ 3185e9cd1aeSAssar WesterlundWARNING: I can't seem to be able to run \`tar' with the given arguments. 3195e9cd1aeSAssar Westerlund You may want to install GNU tar or Free paxutils, or check the 3205e9cd1aeSAssar Westerlund command line arguments." 3215e9cd1aeSAssar Westerlund exit 1 3225e9cd1aeSAssar Westerlund ;; 3235e9cd1aeSAssar Westerlund 3245e9cd1aeSAssar Westerlund *) 3255e9cd1aeSAssar Westerlund echo 1>&2 "\ 3265e9cd1aeSAssar WesterlundWARNING: \`$1' is needed, and you do not seem to have it handy on your 3275e9cd1aeSAssar Westerlund system. You might have modified some files without having the 3285e9cd1aeSAssar Westerlund proper tools for further handling them. Check the \`README' file, 3291c43270aSJacques Vidrine it often tells you about the needed prerequisites for installing 3305e9cd1aeSAssar Westerlund this package. You may also peek at any GNU archive site, in case 3315e9cd1aeSAssar Westerlund some other package would contain this missing \`$1' program." 3325e9cd1aeSAssar Westerlund exit 1 3335e9cd1aeSAssar Westerlund ;; 3345e9cd1aeSAssar Westerlundesac 3355e9cd1aeSAssar Westerlund 3365e9cd1aeSAssar Westerlundexit 0 337