missing

changeset 48
0d2c13c24fd0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/missing	Wed May 31 12:20:04 2017 +0200
     1.3 @@ -0,0 +1,215 @@
     1.4 +#! /bin/sh
     1.5 +# Common wrapper for a few potentially missing GNU programs.
     1.6 +
     1.7 +scriptversion=2012-06-26.16; # UTC
     1.8 +
     1.9 +# Copyright (C) 1996-2013 Free Software Foundation, Inc.
    1.10 +# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
    1.11 +
    1.12 +# This program is free software; you can redistribute it and/or modify
    1.13 +# it under the terms of the GNU General Public License as published by
    1.14 +# the Free Software Foundation; either version 2, or (at your option)
    1.15 +# any later version.
    1.16 +
    1.17 +# This program is distributed in the hope that it will be useful,
    1.18 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.19 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.20 +# GNU General Public License for more details.
    1.21 +
    1.22 +# You should have received a copy of the GNU General Public License
    1.23 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.24 +
    1.25 +# As a special exception to the GNU General Public License, if you
    1.26 +# distribute this file as part of a program that contains a
    1.27 +# configuration script generated by Autoconf, you may include it under
    1.28 +# the same distribution terms that you use for the rest of that program.
    1.29 +
    1.30 +if test $# -eq 0; then
    1.31 +  echo 1>&2 "Try '$0 --help' for more information"
    1.32 +  exit 1
    1.33 +fi
    1.34 +
    1.35 +case $1 in
    1.36 +
    1.37 +  --is-lightweight)
    1.38 +    # Used by our autoconf macros to check whether the available missing
    1.39 +    # script is modern enough.
    1.40 +    exit 0
    1.41 +    ;;
    1.42 +
    1.43 +  --run)
    1.44 +    # Back-compat with the calling convention used by older automake.
    1.45 +    shift
    1.46 +    ;;
    1.47 +
    1.48 +  -h|--h|--he|--hel|--help)
    1.49 +    echo "\
    1.50 +$0 [OPTION]... PROGRAM [ARGUMENT]...
    1.51 +
    1.52 +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
    1.53 +to PROGRAM being missing or too old.
    1.54 +
    1.55 +Options:
    1.56 +  -h, --help      display this help and exit
    1.57 +  -v, --version   output version information and exit
    1.58 +
    1.59 +Supported PROGRAM values:
    1.60 +  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
    1.61 +  bison     yacc      flex         lex       help2man
    1.62 +
    1.63 +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
    1.64 +'g' are ignored when checking the name.
    1.65 +
    1.66 +Send bug reports to <bug-automake@gnu.org>."
    1.67 +    exit $?
    1.68 +    ;;
    1.69 +
    1.70 +  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
    1.71 +    echo "missing $scriptversion (GNU Automake)"
    1.72 +    exit $?
    1.73 +    ;;
    1.74 +
    1.75 +  -*)
    1.76 +    echo 1>&2 "$0: unknown '$1' option"
    1.77 +    echo 1>&2 "Try '$0 --help' for more information"
    1.78 +    exit 1
    1.79 +    ;;
    1.80 +
    1.81 +esac
    1.82 +
    1.83 +# Run the given program, remember its exit status.
    1.84 +"$@"; st=$?
    1.85 +
    1.86 +# If it succeeded, we are done.
    1.87 +test $st -eq 0 && exit 0
    1.88 +
    1.89 +# Also exit now if we it failed (or wasn't found), and '--version' was
    1.90 +# passed; such an option is passed most likely to detect whether the
    1.91 +# program is present and works.
    1.92 +case $2 in --version|--help) exit $st;; esac
    1.93 +
    1.94 +# Exit code 63 means version mismatch.  This often happens when the user
    1.95 +# tries to use an ancient version of a tool on a file that requires a
    1.96 +# minimum version.
    1.97 +if test $st -eq 63; then
    1.98 +  msg="probably too old"
    1.99 +elif test $st -eq 127; then
   1.100 +  # Program was missing.
   1.101 +  msg="missing on your system"
   1.102 +else
   1.103 +  # Program was found and executed, but failed.  Give up.
   1.104 +  exit $st
   1.105 +fi
   1.106 +
   1.107 +perl_URL=http://www.perl.org/
   1.108 +flex_URL=http://flex.sourceforge.net/
   1.109 +gnu_software_URL=http://www.gnu.org/software
   1.110 +
   1.111 +program_details ()
   1.112 +{
   1.113 +  case $1 in
   1.114 +    aclocal|automake)
   1.115 +      echo "The '$1' program is part of the GNU Automake package:"
   1.116 +      echo "<$gnu_software_URL/automake>"
   1.117 +      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
   1.118 +      echo "<$gnu_software_URL/autoconf>"
   1.119 +      echo "<$gnu_software_URL/m4/>"
   1.120 +      echo "<$perl_URL>"
   1.121 +      ;;
   1.122 +    autoconf|autom4te|autoheader)
   1.123 +      echo "The '$1' program is part of the GNU Autoconf package:"
   1.124 +      echo "<$gnu_software_URL/autoconf/>"
   1.125 +      echo "It also requires GNU m4 and Perl in order to run:"
   1.126 +      echo "<$gnu_software_URL/m4/>"
   1.127 +      echo "<$perl_URL>"
   1.128 +      ;;
   1.129 +  esac
   1.130 +}
   1.131 +
   1.132 +give_advice ()
   1.133 +{
   1.134 +  # Normalize program name to check for.
   1.135 +  normalized_program=`echo "$1" | sed '
   1.136 +    s/^gnu-//; t
   1.137 +    s/^gnu//; t
   1.138 +    s/^g//; t'`
   1.139 +
   1.140 +  printf '%s\n' "'$1' is $msg."
   1.141 +
   1.142 +  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
   1.143 +  case $normalized_program in
   1.144 +    autoconf*)
   1.145 +      echo "You should only need it if you modified 'configure.ac',"
   1.146 +      echo "or m4 files included by it."
   1.147 +      program_details 'autoconf'
   1.148 +      ;;
   1.149 +    autoheader*)
   1.150 +      echo "You should only need it if you modified 'acconfig.h' or"
   1.151 +      echo "$configure_deps."
   1.152 +      program_details 'autoheader'
   1.153 +      ;;
   1.154 +    automake*)
   1.155 +      echo "You should only need it if you modified 'Makefile.am' or"
   1.156 +      echo "$configure_deps."
   1.157 +      program_details 'automake'
   1.158 +      ;;
   1.159 +    aclocal*)
   1.160 +      echo "You should only need it if you modified 'acinclude.m4' or"
   1.161 +      echo "$configure_deps."
   1.162 +      program_details 'aclocal'
   1.163 +      ;;
   1.164 +   autom4te*)
   1.165 +      echo "You might have modified some maintainer files that require"
   1.166 +      echo "the 'automa4te' program to be rebuilt."
   1.167 +      program_details 'autom4te'
   1.168 +      ;;
   1.169 +    bison*|yacc*)
   1.170 +      echo "You should only need it if you modified a '.y' file."
   1.171 +      echo "You may want to install the GNU Bison package:"
   1.172 +      echo "<$gnu_software_URL/bison/>"
   1.173 +      ;;
   1.174 +    lex*|flex*)
   1.175 +      echo "You should only need it if you modified a '.l' file."
   1.176 +      echo "You may want to install the Fast Lexical Analyzer package:"
   1.177 +      echo "<$flex_URL>"
   1.178 +      ;;
   1.179 +    help2man*)
   1.180 +      echo "You should only need it if you modified a dependency" \
   1.181 +           "of a man page."
   1.182 +      echo "You may want to install the GNU Help2man package:"
   1.183 +      echo "<$gnu_software_URL/help2man/>"
   1.184 +    ;;
   1.185 +    makeinfo*)
   1.186 +      echo "You should only need it if you modified a '.texi' file, or"
   1.187 +      echo "any other file indirectly affecting the aspect of the manual."
   1.188 +      echo "You might want to install the Texinfo package:"
   1.189 +      echo "<$gnu_software_URL/texinfo/>"
   1.190 +      echo "The spurious makeinfo call might also be the consequence of"
   1.191 +      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
   1.192 +      echo "want to install GNU make:"
   1.193 +      echo "<$gnu_software_URL/make/>"
   1.194 +      ;;
   1.195 +    *)
   1.196 +      echo "You might have modified some files without having the proper"
   1.197 +      echo "tools for further handling them.  Check the 'README' file, it"
   1.198 +      echo "often tells you about the needed prerequisites for installing"
   1.199 +      echo "this package.  You may also peek at any GNU archive site, in"
   1.200 +      echo "case some other package contains this missing '$1' program."
   1.201 +      ;;
   1.202 +  esac
   1.203 +}
   1.204 +
   1.205 +give_advice "$1" | sed -e '1s/^/WARNING: /' \
   1.206 +                       -e '2,$s/^/         /' >&2
   1.207 +
   1.208 +# Propagate the correct exit status (expected to be 127 for a program
   1.209 +# not found, 63 for a program that failed due to version mismatch).
   1.210 +exit $st
   1.211 +
   1.212 +# Local variables:
   1.213 +# eval: (add-hook 'write-file-hooks 'time-stamp)
   1.214 +# time-stamp-start: "scriptversion="
   1.215 +# time-stamp-format: "%:y-%02m-%02d.%02H"
   1.216 +# time-stamp-time-zone: "UTC"
   1.217 +# time-stamp-end: "; # UTC"
   1.218 +# End:

mercurial