missing 11 KB

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