acinclude.m4 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. dnl Used by aclocal to generate configure
  2. dnl -----------------------------------------------------------
  3. AC_DEFUN([CLASSPATH_WITH_JAVAH],
  4. [
  5. AC_ARG_WITH([javah],
  6. [AS_HELP_STRING(--with-javah,specify path or name of a javah-like program)],
  7. [
  8. if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
  9. CLASSPATH_CHECK_JAVAH(${withval})
  10. else
  11. CLASSPATH_CHECK_JAVAH
  12. fi
  13. ],
  14. [
  15. CLASSPATH_CHECK_JAVAH
  16. ])
  17. AC_SUBST(USER_JAVAH)
  18. ])
  19. dnl -----------------------------------------------------------
  20. dnl Checking for a javah like program
  21. dnl -----------------------------------------------------------
  22. AC_DEFUN([CLASSPATH_CHECK_JAVAH],
  23. [
  24. if test "x$1" != x; then
  25. if test -f "$1"; then
  26. USER_JAVAH="$1"
  27. else
  28. AC_PATH_PROG(USER_JAVAH, "$1")
  29. fi
  30. else
  31. AC_PATH_PROGS([USER_JAVAH],[gjavah gjavah-4.3 gjavah-4.2 gjavah-4.1 gcjh-wrapper-4.1 gcjh-4.1 javah])
  32. fi
  33. if test "x${USER_JAVAH}" = x; then
  34. AC_MSG_ERROR([can not find javah])
  35. fi
  36. ])
  37. dnl -----------------------------------------------------------
  38. dnl CLASSPATH_WITH_CLASSLIB - checks for user specified classpath additions
  39. dnl -----------------------------------------------------------
  40. AC_DEFUN([CLASSPATH_WITH_CLASSLIB],
  41. [
  42. AC_ARG_WITH([vm-classes],
  43. [AS_HELP_STRING(--with-vm-classes,specify path to VM override source files)], [vm_classes="$with_vm_classes"],
  44. [vm_classes='${top_srcdir}/vm/reference'])
  45. AC_SUBST(vm_classes)
  46. ])
  47. dnl -----------------------------------------------------------
  48. dnl CLASSPATH_WITH_GLIBJ - specify what to install
  49. dnl -----------------------------------------------------------
  50. AC_DEFUN([CLASSPATH_WITH_GLIBJ],
  51. [
  52. AC_PATH_PROG(ZIP, zip)
  53. AC_MSG_CHECKING(for a jar-like tool)
  54. AC_ARG_WITH([jar],
  55. [AS_HELP_STRING([--with-jar=PATH], [define to use a jar style tool])],
  56. [
  57. case "${withval}" in
  58. yes)
  59. JAR=yes
  60. ;;
  61. no)
  62. JAR=no
  63. AC_MSG_RESULT(${JAR})
  64. ;;
  65. *)
  66. if test -f "${withval}"; then
  67. JAR="${withval}"
  68. AC_MSG_RESULT(${JAR})
  69. else
  70. AC_MSG_RESULT([not found])
  71. AC_MSG_ERROR([The jar tool ${withval} was not found.])
  72. fi
  73. ;;
  74. esac
  75. ],
  76. [
  77. JAR=yes
  78. ])
  79. if test x"${JAR}" = "xyes"; then
  80. AC_MSG_RESULT([trying fastjar, gjar and jar])
  81. AC_PATH_PROGS([JAR], [fastjar gjar jar])
  82. if test x"${RHINO_JAR}" = "xyes"; then
  83. AC_MSG_RESULT([not found])
  84. fi
  85. fi
  86. if test x"${JAR}" = "xno" && test x"${ZIP}" = ""; then
  87. AC_MSG_ERROR([No zip or jar tool found.])
  88. fi
  89. AM_CONDITIONAL(WITH_JAR, test x"${JAR}" != "xno" && test x"${JAR}" != "xyes")
  90. AC_SUBST(JAR)
  91. AC_ARG_WITH([glibj],
  92. [AS_HELP_STRING([--with-glibj],[define what to install (zip|flat|both|none|build) [default=zip]])],
  93. [
  94. if test "x${withval}" = xyes || test "x${withval}" = xzip; then
  95. install_class_files=no
  96. build_class_files=yes
  97. use_zip=yes
  98. elif test "x${withval}" = xboth; then
  99. install_class_files=yes
  100. build_class_files=yes
  101. use_zip=yes
  102. elif test "x${withval}" = xflat; then
  103. install_class_files=yes
  104. build_class_files=yes
  105. use_zip=no
  106. elif test "x${withval}" = xno || test "x${withval}" = xnone; then
  107. install_class_files=no
  108. build_class_files=no
  109. use_zip=no
  110. elif test "x${withval}" = xbuild; then
  111. install_class_files=no
  112. build_class_files=yes
  113. use_zip=no
  114. else
  115. AC_MSG_ERROR([unknown value given to --with-glibj])
  116. fi
  117. ],
  118. [
  119. install_class_files=no
  120. use_zip=yes
  121. ])
  122. AM_CONDITIONAL(INSTALL_GLIBJ_ZIP, test "x${use_zip}" = xyes)
  123. AM_CONDITIONAL(INSTALL_CLASS_FILES, test "x${install_class_files}" = xyes)
  124. AM_CONDITIONAL(BUILD_CLASS_FILES, test "x${build_class_files}" = xyes)
  125. AC_ARG_ENABLE([examples],
  126. [AS_HELP_STRING(--enable-examples,enable build of the examples [default=yes])],
  127. [case "${enableval}" in
  128. yes) EXAMPLESDIR="examples" ;;
  129. no) EXAMPLESDIR="" ;;
  130. *) AC_MSG_ERROR(bad value ${enableval} for --enable-examples) ;;
  131. esac],
  132. [EXAMPLESDIR="examples"])
  133. if test "x${build_class_files}" = xno; then
  134. EXAMPLESDIR=""
  135. fi
  136. AC_SUBST(EXAMPLESDIR)
  137. AC_ARG_ENABLE([tools],
  138. [AS_HELP_STRING(--enable-tools,enable build of the tools [default=yes])],
  139. [case "${enableval}" in
  140. yes) TOOLSDIR="tools" ;;
  141. no) TOOLSDIR="" ;;
  142. *) AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;;
  143. esac],
  144. [TOOLSDIR="tools"])
  145. if test "x${build_class_files}" = xno; then
  146. TOOLSDIR=""
  147. fi
  148. AC_SUBST(TOOLSDIR)
  149. ])
  150. dnl -----------------------------------------------------------
  151. dnl Enable generation of API documentation, with gjdoc if it
  152. dnl has been compiled to an executable (or a suitable script
  153. dnl is in your PATH) or using the argument as gjdoc executable.
  154. dnl -----------------------------------------------------------
  155. AC_DEFUN([CLASSPATH_WITH_GJDOC],
  156. [
  157. AC_ARG_WITH([gjdoc],
  158. AS_HELP_STRING([--with-gjdoc],
  159. [generate documentation using gjdoc (default is NO)]),
  160. [if test "x${withval}" = xno; then
  161. WITH_GJDOC=no;
  162. elif test "x${withval}" = xyes -o "x{withval}" = x; then
  163. WITH_GJDOC=yes;
  164. AC_PATH_PROG(GJDOC, gjdoc, "no")
  165. if test "x${GJDOC}" = xno; then
  166. AC_MSG_ERROR("gjdoc executable not found");
  167. fi
  168. else
  169. WITH_GJDOC=yes
  170. GJDOC="${withval}"
  171. AC_CHECK_FILE(${GJDOC}, AC_SUBST(GJDOC),
  172. AC_MSG_ERROR("Cannot use ${withval} as gjdoc executable since it doesn't exist"))
  173. fi],
  174. [WITH_GJDOC=no])
  175. AM_CONDITIONAL(CREATE_API_DOCS, test "x${WITH_GJDOC}" = xyes)
  176. if test "x${WITH_GJDOC}" = xyes; then
  177. AC_MSG_CHECKING([version of GJDoc])
  178. gjdoc_version=$(${GJDOC} --version|cut -d ' ' -f2)
  179. AC_MSG_RESULT(${gjdoc_version})
  180. case ${gjdoc_version} in
  181. 0.7.9) ;;
  182. 0.8*) ;;
  183. 0.9*) ;;
  184. 1*) ;;
  185. *) AC_MSG_ERROR([Building documentation requires GJDoc >= 0.7.9, ${gjdoc_version} found.]) ;;
  186. esac
  187. fi
  188. ])
  189. dnl -----------------------------------------------------------
  190. dnl Enable regeneration of parsers using jay
  191. dnl http://www.informatik.uni-osnabrueck.de/alumni/bernd/jay/
  192. dnl -----------------------------------------------------------
  193. AC_DEFUN([REGEN_WITH_JAY],
  194. [
  195. AC_ARG_WITH([jay],
  196. [AS_HELP_STRING(--with-jay[=DIR|PATH],Regenerate the parsers with jay)],
  197. [
  198. AC_MSG_CHECKING([whether to regenerate parsers with jay])
  199. JAY_FOUND=no
  200. JAY_DIR_PATH=
  201. if test "x${withval}" = xno; then
  202. AC_MSG_RESULT(no)
  203. elif test "x${withval}" = xyes; then
  204. AC_MSG_RESULT(yes)
  205. JAY_DIR_PATH="/usr/share/jay"
  206. elif test -d "${withval}"; then
  207. AC_MSG_RESULT(yes)
  208. JAY_DIR_PATH="${withval}"
  209. elif test -f "${withval}"; then
  210. AC_MSG_RESULT(yes)
  211. JAY_DIR_PATH=`dirname "${withval}"`
  212. JAY="${withval}"
  213. else
  214. AC_MSG_ERROR(jay not found at ${withval})
  215. fi
  216. if test "x${JAY_DIR_PATH}" != x; then
  217. AC_PATH_PROG(JAY, jay, "no", ${JAY_DIR_PATH}:${PATH})
  218. if test "x${JAY}" = xno; then
  219. AC_MSG_ERROR(jay executable not found);
  220. fi
  221. JAY_SKELETON="${JAY_DIR_PATH}/skeleton"
  222. AC_CHECK_FILE(${JAY_SKELETON}, AC_SUBST(JAY_SKELETON),
  223. AC_MSG_ERROR(Expected skeleton file in ${JAY_DIR_PATH}))
  224. JAY_FOUND=yes
  225. fi
  226. ],
  227. [
  228. AC_MSG_CHECKING([whether to regenerate parsers with jay])
  229. AC_MSG_RESULT(no)
  230. JAY_FOUND=no
  231. ])
  232. AM_CONDITIONAL(REGEN_PARSERS, test "x${JAY_FOUND}" = xyes)
  233. ])
  234. dnl -----------------------------------------------------------
  235. dnl GCJ LOCAL: Calculate toolexeclibdir
  236. dnl -----------------------------------------------------------
  237. AC_DEFUN([CLASSPATH_TOOLEXECLIBDIR],
  238. [
  239. case ${version_specific_libs} in
  240. yes)
  241. # Need the gcc compiler version to know where to install libraries
  242. # and header files if --enable-version-specific-runtime-libs option
  243. # is selected.
  244. includedir='$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include/'
  245. toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
  246. toolexecmainlibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
  247. toolexeclibdir=$toolexecmainlibdir
  248. ;;
  249. no)
  250. if test -n "$with_cross_host" &&
  251. test x"$with_cross_host" != x"no"; then
  252. # Install a library built with a cross compiler in tooldir, not libdir.
  253. toolexecdir='$(exec_prefix)/$(target_noncanonical)'
  254. toolexecmainlibdir='$(toolexecdir)/lib'
  255. else
  256. toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
  257. toolexecmainlibdir='$(libdir)'
  258. fi
  259. multi_os_directory=`$CC -print-multi-os-directory`
  260. case $multi_os_directory in
  261. .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /.
  262. *) toolexeclibdir=$toolexecmainlibdir/$multi_os_directory ;;
  263. esac
  264. ;;
  265. esac
  266. AC_SUBST(toolexecdir)
  267. AC_SUBST(toolexecmainlibdir)
  268. AC_SUBST(toolexeclibdir)
  269. ])
  270. dnl -----------------------------------------------------------
  271. AC_DEFUN([CLASSPATH_JAVAC_MEM_CHECK],
  272. [
  273. JAVA_TEST=Test.java
  274. CLASS_TEST=Test.class
  275. cat << \EOF > $JAVA_TEST
  276. /* [#]line __oline__ "configure" */
  277. public class Test
  278. {
  279. public static void main(String[] args)
  280. {
  281. System.out.println("Hello World");
  282. }
  283. }
  284. EOF
  285. if test x$JAVAC_IS_GCJ != xyes; then
  286. AC_MSG_CHECKING([whether javac supports -J])
  287. $JAVAC $JAVACFLAGS -J-Xmx768M -sourcepath '' $JAVA_TEST
  288. javac_result=$?
  289. if test "x$javac_result" = "x0"; then
  290. AC_MSG_RESULT([yes])
  291. JAVAC_MEM_OPT="-J-Xmx768M"
  292. else
  293. AC_MSG_RESULT([no])
  294. fi
  295. fi
  296. rm -f $JAVA_TEST $CLASS_TEST
  297. AC_SUBST(JAVAC_MEM_OPT)
  298. ])
  299. dnl ---------------------------------------------------------------
  300. dnl CLASSPATH_COND_IF(COND, SHELL-CONDITION, [IF-TRUE], [IF-FALSE])
  301. dnl ---------------------------------------------------------------
  302. dnl Automake 1.11 can emit conditional rules for AC_CONFIG_FILES,
  303. dnl using AM_COND_IF. This wrapper uses it if it is available,
  304. dnl otherwise falls back to code compatible with Automake 1.9.6.
  305. AC_DEFUN([CLASSPATH_COND_IF],
  306. [m4_ifdef([AM_COND_IF],
  307. [AM_COND_IF([$1], [$3], [$4])],
  308. [if $2; then
  309. m4_default([$3], [:])
  310. else
  311. m4_default([$4], [:])
  312. fi
  313. ])])