missing 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. #! /bin/sh
  2. # Common stub for a few missing GNU programs while installing.
  3. scriptversion=2004-09-07.08
  4. # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
  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., 59 Temple Place - Suite 330, Boston, MA
  18. # 02111-1307, 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. # 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. 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. tar try tar, gnutar, gtar, then tar without non-portable flags
  72. yacc create \`y.tab.[ch]', if possible, from existing .[ch]
  73. Send bug reports to <bug-automake@gnu.org>."
  74. exit 0
  75. ;;
  76. -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
  77. echo "missing $scriptversion (GNU Automake)"
  78. exit 0
  79. ;;
  80. -*)
  81. echo 1>&2 "$0: Unknown \`$1' option"
  82. echo 1>&2 "Try \`$0 --help' for more information"
  83. exit 1
  84. ;;
  85. esac
  86. # Now exit if we have it, but it failed. Also exit now if we
  87. # don't have it and --version was passed (most likely to detect
  88. # the program).
  89. case "$1" in
  90. lex|yacc)
  91. # Not GNU programs, they don't have --version.
  92. ;;
  93. tar)
  94. if test -n "$run"; then
  95. echo 1>&2 "ERROR: \`tar' requires --run"
  96. exit 1
  97. elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
  98. exit 1
  99. fi
  100. ;;
  101. *)
  102. if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
  103. # We have it, but it failed.
  104. exit 1
  105. elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
  106. # Could not run --version or --help. This is probably someone
  107. # running `$TOOL --version' or `$TOOL --help' to check whether
  108. # $TOOL exists and not knowing $TOOL uses missing.
  109. exit 1
  110. fi
  111. ;;
  112. esac
  113. # If it does not exist, or fails to run (possibly an outdated version),
  114. # try to emulate it.
  115. case "$1" in
  116. aclocal*)
  117. echo 1>&2 "\
  118. WARNING: \`$1' is $msg. You should only need it if
  119. you modified \`acinclude.m4' or \`${configure_ac}'. You might want
  120. to install the \`Automake' and \`Perl' packages. Grab them from
  121. any GNU archive site."
  122. touch aclocal.m4
  123. ;;
  124. autoconf)
  125. echo 1>&2 "\
  126. WARNING: \`$1' is $msg. You should only need it if
  127. you modified \`${configure_ac}'. You might want to install the
  128. \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
  129. archive site."
  130. touch configure
  131. ;;
  132. autoheader)
  133. echo 1>&2 "\
  134. WARNING: \`$1' is $msg. You should only need it if
  135. you modified \`acconfig.h' or \`${configure_ac}'. You might want
  136. to install the \`Autoconf' and \`GNU m4' packages. Grab them
  137. from any GNU archive site."
  138. files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
  139. test -z "$files" && files="config.h"
  140. touch_files=
  141. for f in $files; do
  142. case "$f" in
  143. *:*) touch_files="$touch_files "`echo "$f" |
  144. sed -e 's/^[^:]*://' -e 's/:.*//'`;;
  145. *) touch_files="$touch_files $f.in";;
  146. esac
  147. done
  148. touch $touch_files
  149. ;;
  150. automake*)
  151. echo 1>&2 "\
  152. WARNING: \`$1' is $msg. You should only need it if
  153. you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
  154. You might want to install the \`Automake' and \`Perl' packages.
  155. Grab them from any GNU archive site."
  156. find . -type f -name Makefile.am -print |
  157. sed 's/\.am$/.in/' |
  158. while read f; do touch "$f"; done
  159. ;;
  160. autom4te)
  161. echo 1>&2 "\
  162. WARNING: \`$1' is needed, but is $msg.
  163. You might have modified some files without having the
  164. proper tools for further handling them.
  165. You can get \`$1' as part of \`Autoconf' from any GNU
  166. archive site."
  167. file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
  168. test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
  169. if test -f "$file"; then
  170. touch $file
  171. else
  172. test -z "$file" || exec >$file
  173. echo "#! /bin/sh"
  174. echo "# Created by GNU Automake missing as a replacement of"
  175. echo "# $ $@"
  176. echo "exit 0"
  177. chmod +x $file
  178. exit 1
  179. fi
  180. ;;
  181. bison|yacc)
  182. echo 1>&2 "\
  183. WARNING: \`$1' $msg. You should only need it if
  184. you modified a \`.y' file. You may need the \`Bison' package
  185. in order for those modifications to take effect. You can get
  186. \`Bison' from any GNU archive site."
  187. rm -f y.tab.c y.tab.h
  188. if [ $# -ne 1 ]; then
  189. eval LASTARG="\${$#}"
  190. case "$LASTARG" in
  191. *.y)
  192. SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
  193. if [ -f "$SRCFILE" ]; then
  194. cp "$SRCFILE" y.tab.c
  195. fi
  196. SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
  197. if [ -f "$SRCFILE" ]; then
  198. cp "$SRCFILE" y.tab.h
  199. fi
  200. ;;
  201. esac
  202. fi
  203. if [ ! -f y.tab.h ]; then
  204. echo >y.tab.h
  205. fi
  206. if [ ! -f y.tab.c ]; then
  207. echo 'main() { return 0; }' >y.tab.c
  208. fi
  209. ;;
  210. lex|flex)
  211. echo 1>&2 "\
  212. WARNING: \`$1' is $msg. You should only need it if
  213. you modified a \`.l' file. You may need the \`Flex' package
  214. in order for those modifications to take effect. You can get
  215. \`Flex' from any GNU archive site."
  216. rm -f lex.yy.c
  217. if [ $# -ne 1 ]; then
  218. eval LASTARG="\${$#}"
  219. case "$LASTARG" in
  220. *.l)
  221. SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
  222. if [ -f "$SRCFILE" ]; then
  223. cp "$SRCFILE" lex.yy.c
  224. fi
  225. ;;
  226. esac
  227. fi
  228. if [ ! -f lex.yy.c ]; then
  229. echo 'main() { return 0; }' >lex.yy.c
  230. fi
  231. ;;
  232. help2man)
  233. echo 1>&2 "\
  234. WARNING: \`$1' is $msg. You should only need it if
  235. you modified a dependency of a manual page. You may need the
  236. \`Help2man' package in order for those modifications to take
  237. effect. You can get \`Help2man' from any GNU archive site."
  238. file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
  239. if test -z "$file"; then
  240. file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
  241. fi
  242. if [ -f "$file" ]; then
  243. touch $file
  244. else
  245. test -z "$file" || exec >$file
  246. echo ".ab help2man is required to generate this page"
  247. exit 1
  248. fi
  249. ;;
  250. makeinfo)
  251. echo 1>&2 "\
  252. WARNING: \`$1' is $msg. You should only need it if
  253. you modified a \`.texi' or \`.texinfo' file, or any other file
  254. indirectly affecting the aspect of the manual. The spurious
  255. call might also be the consequence of using a buggy \`make' (AIX,
  256. DU, IRIX). You might want to install the \`Texinfo' package or
  257. the \`GNU make' package. Grab either from any GNU archive site."
  258. file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
  259. if test -z "$file"; then
  260. file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
  261. file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
  262. fi
  263. touch $file
  264. ;;
  265. tar)
  266. shift
  267. # We have already tried tar in the generic part.
  268. # Look for gnutar/gtar before invocation to avoid ugly error
  269. # messages.
  270. if (gnutar --version > /dev/null 2>&1); then
  271. gnutar "$@" && exit 0
  272. fi
  273. if (gtar --version > /dev/null 2>&1); then
  274. gtar "$@" && exit 0
  275. fi
  276. firstarg="$1"
  277. if shift; then
  278. case "$firstarg" in
  279. *o*)
  280. firstarg=`echo "$firstarg" | sed s/o//`
  281. tar "$firstarg" "$@" && exit 0
  282. ;;
  283. esac
  284. case "$firstarg" in
  285. *h*)
  286. firstarg=`echo "$firstarg" | sed s/h//`
  287. tar "$firstarg" "$@" && exit 0
  288. ;;
  289. esac
  290. fi
  291. echo 1>&2 "\
  292. WARNING: I can't seem to be able to run \`tar' with the given arguments.
  293. You may want to install GNU tar or Free paxutils, or check the
  294. command line arguments."
  295. exit 1
  296. ;;
  297. *)
  298. echo 1>&2 "\
  299. WARNING: \`$1' is needed, and is $msg.
  300. You might have modified some files without having the
  301. proper tools for further handling them. Check the \`README' file,
  302. it often tells you about the needed prerequisites for installing
  303. this package. You may also peek at any GNU archive site, in case
  304. some other package would contain this missing \`$1' program."
  305. exit 1
  306. ;;
  307. esac
  308. exit 0
  309. # Local variables:
  310. # eval: (add-hook 'write-file-hooks 'time-stamp)
  311. # time-stamp-start: "scriptversion="
  312. # time-stamp-format: "%:y-%02m-%02d.%02H"
  313. # time-stamp-end: "$"
  314. # End: