missing 11 KB

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