You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

330 lines
9.9 KiB

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