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.

336 lines
10 KiB

11 years ago
  1. #! /bin/sh
  2. # Common stub for a few missing GNU programs while installing.
  3. # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
  4. # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software
  15. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  16. # 02111-1307, USA.
  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. # In the cases where this matters, `missing' is being run in the
  27. # srcdir already.
  28. if test -f configure.ac; then
  29. configure_ac=configure.ac
  30. else
  31. configure_ac=configure.in
  32. fi
  33. case "$1" in
  34. --run)
  35. # Try to run requested program, and just exit if it succeeds.
  36. run=
  37. shift
  38. "$@" && exit 0
  39. ;;
  40. esac
  41. # If it does not exist, or fails to run (possibly an outdated version),
  42. # try to emulate it.
  43. case "$1" in
  44. -h|--h|--he|--hel|--help)
  45. echo "\
  46. $0 [OPTION]... PROGRAM [ARGUMENT]...
  47. Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
  48. error status if there is no known handling for PROGRAM.
  49. Options:
  50. -h, --help display this help and exit
  51. -v, --version output version information and exit
  52. --run try to run the given command, and emulate it if it fails
  53. Supported PROGRAM values:
  54. aclocal touch file \`aclocal.m4'
  55. autoconf touch file \`configure'
  56. autoheader touch file \`config.h.in'
  57. automake touch all \`Makefile.in' files
  58. bison create \`y.tab.[ch]', if possible, from existing .[ch]
  59. flex create \`lex.yy.c', if possible, from existing .c
  60. help2man touch the output file
  61. lex create \`lex.yy.c', if possible, from existing .c
  62. makeinfo touch the output file
  63. tar try tar, gnutar, gtar, then tar without non-portable flags
  64. yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
  65. ;;
  66. -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
  67. echo "missing 0.4 - GNU automake"
  68. ;;
  69. -*)
  70. echo 1>&2 "$0: Unknown \`$1' option"
  71. echo 1>&2 "Try \`$0 --help' for more information"
  72. exit 1
  73. ;;
  74. aclocal*)
  75. if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
  76. # We have it, but it failed.
  77. exit 1
  78. fi
  79. echo 1>&2 "\
  80. WARNING: \`$1' is missing on your system. You should only need it if
  81. you modified \`acinclude.m4' or \`${configure_ac}'. You might want
  82. to install the \`Automake' and \`Perl' packages. Grab them from
  83. any GNU archive site."
  84. touch aclocal.m4
  85. ;;
  86. autoconf)
  87. if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
  88. # We have it, but it failed.
  89. exit 1
  90. fi
  91. echo 1>&2 "\
  92. WARNING: \`$1' is missing on your system. You should only need it if
  93. you modified \`${configure_ac}'. You might want to install the
  94. \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
  95. archive site."
  96. touch configure
  97. ;;
  98. autoheader)
  99. if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
  100. # We have it, but it failed.
  101. exit 1
  102. fi
  103. echo 1>&2 "\
  104. WARNING: \`$1' is missing on your system. You should only need it if
  105. you modified \`acconfig.h' or \`${configure_ac}'. You might want
  106. to install the \`Autoconf' and \`GNU m4' packages. Grab them
  107. from any GNU archive site."
  108. files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
  109. test -z "$files" && files="config.h"
  110. touch_files=
  111. for f in $files; do
  112. case "$f" in
  113. *:*) touch_files="$touch_files "`echo "$f" |
  114. sed -e 's/^[^:]*://' -e 's/:.*//'`;;
  115. *) touch_files="$touch_files $f.in";;
  116. esac
  117. done
  118. touch $touch_files
  119. ;;
  120. automake*)
  121. if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
  122. # We have it, but it failed.
  123. exit 1
  124. fi
  125. echo 1>&2 "\
  126. WARNING: \`$1' is missing on your system. You should only need it if
  127. you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
  128. You might want to install the \`Automake' and \`Perl' packages.
  129. Grab them from any GNU archive site."
  130. find . -type f -name Makefile.am -print |
  131. sed 's/\.am$/.in/' |
  132. while read f; do touch "$f"; done
  133. ;;
  134. autom4te)
  135. if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
  136. # We have it, but it failed.
  137. exit 1
  138. fi
  139. echo 1>&2 "\
  140. WARNING: \`$1' is needed, and you do not seem to have it handy on your
  141. system. You might have modified some files without having the
  142. proper tools for further handling them.
  143. You can get \`$1' as part of \`Autoconf' from any GNU
  144. archive site."
  145. file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
  146. test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
  147. if test -f "$file"; then
  148. touch $file
  149. else
  150. test -z "$file" || exec >$file
  151. echo "#! /bin/sh"
  152. echo "# Created by GNU Automake missing as a replacement of"
  153. echo "# $ $@"
  154. echo "exit 0"
  155. chmod +x $file
  156. exit 1
  157. fi
  158. ;;
  159. bison|yacc)
  160. echo 1>&2 "\
  161. WARNING: \`$1' is missing on your system. You should only need it if
  162. you modified a \`.y' file. You may need the \`Bison' package
  163. in order for those modifications to take effect. You can get
  164. \`Bison' from any GNU archive site."
  165. rm -f y.tab.c y.tab.h
  166. if [ $# -ne 1 ]; then
  167. eval LASTARG="\${$#}"
  168. case "$LASTARG" in
  169. *.y)
  170. SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
  171. if [ -f "$SRCFILE" ]; then
  172. cp "$SRCFILE" y.tab.c
  173. fi
  174. SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
  175. if [ -f "$SRCFILE" ]; then
  176. cp "$SRCFILE" y.tab.h
  177. fi
  178. ;;
  179. esac
  180. fi
  181. if [ ! -f y.tab.h ]; then
  182. echo >y.tab.h
  183. fi
  184. if [ ! -f y.tab.c ]; then
  185. echo 'main() { return 0; }' >y.tab.c
  186. fi
  187. ;;
  188. lex|flex)
  189. echo 1>&2 "\
  190. WARNING: \`$1' is missing on your system. You should only need it if
  191. you modified a \`.l' file. You may need the \`Flex' package
  192. in order for those modifications to take effect. You can get
  193. \`Flex' from any GNU archive site."
  194. rm -f lex.yy.c
  195. if [ $# -ne 1 ]; then
  196. eval LASTARG="\${$#}"
  197. case "$LASTARG" in
  198. *.l)
  199. SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
  200. if [ -f "$SRCFILE" ]; then
  201. cp "$SRCFILE" lex.yy.c
  202. fi
  203. ;;
  204. esac
  205. fi
  206. if [ ! -f lex.yy.c ]; then
  207. echo 'main() { return 0; }' >lex.yy.c
  208. fi
  209. ;;
  210. help2man)
  211. if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
  212. # We have it, but it failed.
  213. exit 1
  214. fi
  215. echo 1>&2 "\
  216. WARNING: \`$1' is missing on your system. You should only need it if
  217. you modified a dependency of a manual page. You may need the
  218. \`Help2man' package in order for those modifications to take
  219. effect. You can get \`Help2man' from any GNU archive site."
  220. file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
  221. if test -z "$file"; then
  222. file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
  223. fi
  224. if [ -f "$file" ]; then
  225. touch $file
  226. else
  227. test -z "$file" || exec >$file
  228. echo ".ab help2man is required to generate this page"
  229. exit 1
  230. fi
  231. ;;
  232. makeinfo)
  233. if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
  234. # We have makeinfo, but it failed.
  235. exit 1
  236. fi
  237. echo 1>&2 "\
  238. WARNING: \`$1' is missing on your system. You should only need it if
  239. you modified a \`.texi' or \`.texinfo' file, or any other file
  240. indirectly affecting the aspect of the manual. The spurious
  241. call might also be the consequence of using a buggy \`make' (AIX,
  242. DU, IRIX). You might want to install the \`Texinfo' package or
  243. the \`GNU make' package. Grab either from any GNU archive site."
  244. file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
  245. if test -z "$file"; then
  246. file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
  247. file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
  248. fi
  249. touch $file
  250. ;;
  251. tar)
  252. shift
  253. if test -n "$run"; then
  254. echo 1>&2 "ERROR: \`tar' requires --run"
  255. exit 1
  256. fi
  257. # We have already tried tar in the generic part.
  258. # Look for gnutar/gtar before invocation to avoid ugly error
  259. # messages.
  260. if (gnutar --version > /dev/null 2>&1); then
  261. gnutar "$@" && exit 0
  262. fi
  263. if (gtar --version > /dev/null 2>&1); then
  264. gtar "$@" && exit 0
  265. fi
  266. firstarg="$1"
  267. if shift; then
  268. case "$firstarg" in
  269. *o*)
  270. firstarg=`echo "$firstarg" | sed s/o//`
  271. tar "$firstarg" "$@" && exit 0
  272. ;;
  273. esac
  274. case "$firstarg" in
  275. *h*)
  276. firstarg=`echo "$firstarg" | sed s/h//`
  277. tar "$firstarg" "$@" && exit 0
  278. ;;
  279. esac
  280. fi
  281. echo 1>&2 "\
  282. WARNING: I can't seem to be able to run \`tar' with the given arguments.
  283. You may want to install GNU tar or Free paxutils, or check the
  284. command line arguments."
  285. exit 1
  286. ;;
  287. *)
  288. echo 1>&2 "\
  289. WARNING: \`$1' is needed, and you do not seem to have it handy on your
  290. system. You might have modified some files without having the
  291. proper tools for further handling them. Check the \`README' file,
  292. it often tells you about the needed prerequisites for installing
  293. this package. You may also peek at any GNU archive site, in case
  294. some other package would contain this missing \`$1' program."
  295. exit 1
  296. ;;
  297. esac
  298. exit 0