missing 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. #! /bin/sh
  2. # Common wrapper for a few potentially missing GNU programs.
  3. scriptversion=2012-06-26.16; # UTC
  4. # Copyright (C) 1996-2013 Free Software Foundation, Inc.
  5. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # As a special exception to the GNU General Public License, if you
  17. # distribute this file as part of a program that contains a
  18. # configuration script generated by Autoconf, you may include it under
  19. # the same distribution terms that you use for the rest of that program.
  20. if test $# -eq 0; then
  21. echo 1>&2 "Try '$0 --help' for more information"
  22. exit 1
  23. fi
  24. case $1 in
  25. --is-lightweight)
  26. # Used by our autoconf macros to check whether the available missing
  27. # script is modern enough.
  28. exit 0
  29. ;;
  30. --run)
  31. # Back-compat with the calling convention used by older automake.
  32. shift
  33. ;;
  34. -h|--h|--he|--hel|--help)
  35. echo "\
  36. $0 [OPTION]... PROGRAM [ARGUMENT]...
  37. Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
  38. to PROGRAM being missing or too old.
  39. Options:
  40. -h, --help display this help and exit
  41. -v, --version output version information and exit
  42. Supported PROGRAM values:
  43. aclocal autoconf autoheader autom4te automake makeinfo
  44. bison yacc flex lex help2man
  45. Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
  46. 'g' are ignored when checking the name.
  47. Send bug reports to <bug-automake@gnu.org>."
  48. exit $?
  49. ;;
  50. -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
  51. echo "missing $scriptversion (GNU Automake)"
  52. exit $?
  53. ;;
  54. -*)
  55. echo 1>&2 "$0: unknown '$1' option"
  56. echo 1>&2 "Try '$0 --help' for more information"
  57. exit 1
  58. ;;
  59. esac
  60. # Run the given program, remember its exit status.
  61. "$@"; st=$?
  62. # If it succeeded, we are done.
  63. test $st -eq 0 && exit 0
  64. # Also exit now if we it failed (or wasn't found), and '--version' was
  65. # passed; such an option is passed most likely to detect whether the
  66. # program is present and works.
  67. case $2 in --version|--help) exit $st;; esac
  68. # Exit code 63 means version mismatch. This often happens when the user
  69. # tries to use an ancient version of a tool on a file that requires a
  70. # minimum version.
  71. if test $st -eq 63; then
  72. msg="probably too old"
  73. elif test $st -eq 127; then
  74. # Program was missing.
  75. msg="missing on your system"
  76. else
  77. # Program was found and executed, but failed. Give up.
  78. exit $st
  79. fi
  80. perl_URL=http://www.perl.org/
  81. flex_URL=http://flex.sourceforge.net/
  82. gnu_software_URL=http://www.gnu.org/software
  83. program_details ()
  84. {
  85. case $1 in
  86. aclocal|automake)
  87. echo "The '$1' program is part of the GNU Automake package:"
  88. echo "<$gnu_software_URL/automake>"
  89. echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
  90. echo "<$gnu_software_URL/autoconf>"
  91. echo "<$gnu_software_URL/m4/>"
  92. echo "<$perl_URL>"
  93. ;;
  94. autoconf|autom4te|autoheader)
  95. echo "The '$1' program is part of the GNU Autoconf package:"
  96. echo "<$gnu_software_URL/autoconf/>"
  97. echo "It also requires GNU m4 and Perl in order to run:"
  98. echo "<$gnu_software_URL/m4/>"
  99. echo "<$perl_URL>"
  100. ;;
  101. esac
  102. }
  103. give_advice ()
  104. {
  105. # Normalize program name to check for.
  106. normalized_program=`echo "$1" | sed '
  107. s/^gnu-//; t
  108. s/^gnu//; t
  109. s/^g//; t'`
  110. printf '%s\n' "'$1' is $msg."
  111. configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
  112. case $normalized_program in
  113. autoconf*)
  114. echo "You should only need it if you modified 'configure.ac',"
  115. echo "or m4 files included by it."
  116. program_details 'autoconf'
  117. ;;
  118. autoheader*)
  119. echo "You should only need it if you modified 'acconfig.h' or"
  120. echo "$configure_deps."
  121. program_details 'autoheader'
  122. ;;
  123. automake*)
  124. echo "You should only need it if you modified 'Makefile.am' or"
  125. echo "$configure_deps."
  126. program_details 'automake'
  127. ;;
  128. aclocal*)
  129. echo "You should only need it if you modified 'acinclude.m4' or"
  130. echo "$configure_deps."
  131. program_details 'aclocal'
  132. ;;
  133. autom4te*)
  134. echo "You might have modified some maintainer files that require"
  135. echo "the 'automa4te' program to be rebuilt."
  136. program_details 'autom4te'
  137. ;;
  138. bison*|yacc*)
  139. echo "You should only need it if you modified a '.y' file."
  140. echo "You may want to install the GNU Bison package:"
  141. echo "<$gnu_software_URL/bison/>"
  142. ;;
  143. lex*|flex*)
  144. echo "You should only need it if you modified a '.l' file."
  145. echo "You may want to install the Fast Lexical Analyzer package:"
  146. echo "<$flex_URL>"
  147. ;;
  148. help2man*)
  149. echo "You should only need it if you modified a dependency" \
  150. "of a man page."
  151. echo "You may want to install the GNU Help2man package:"
  152. echo "<$gnu_software_URL/help2man/>"
  153. ;;
  154. makeinfo*)
  155. echo "You should only need it if you modified a '.texi' file, or"
  156. echo "any other file indirectly affecting the aspect of the manual."
  157. echo "You might want to install the Texinfo package:"
  158. echo "<$gnu_software_URL/texinfo/>"
  159. echo "The spurious makeinfo call might also be the consequence of"
  160. echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
  161. echo "want to install GNU make:"
  162. echo "<$gnu_software_URL/make/>"
  163. ;;
  164. *)
  165. echo "You might have modified some files without having the proper"
  166. echo "tools for further handling them. Check the 'README' file, it"
  167. echo "often tells you about the needed prerequisites for installing"
  168. echo "this package. You may also peek at any GNU archive site, in"
  169. echo "case some other package contains this missing '$1' program."
  170. ;;
  171. esac
  172. }
  173. give_advice "$1" | sed -e '1s/^/WARNING: /' \
  174. -e '2,$s/^/ /' >&2
  175. # Propagate the correct exit status (expected to be 127 for a program
  176. # not found, 63 for a program that failed due to version mismatch).
  177. exit $st
  178. # Local variables:
  179. # eval: (add-hook 'write-file-hooks 'time-stamp)
  180. # time-stamp-start: "scriptversion="
  181. # time-stamp-format: "%:y-%02m-%02d.%02H"
  182. # time-stamp-time-zone: "UTC"
  183. # time-stamp-end: "; # UTC"
  184. # End: