configure.ac 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070
  1. dnl # Process this with autoconf to create configure
  2. AC_PREREQ(2.64)
  3. # Still use "libjava" here to placate dejagnu.
  4. AC_INIT([libjava], [version-unused],, [libjava])
  5. AC_CONFIG_SRCDIR(java/lang/System.java)
  6. GCC_TOPLEV_SUBDIRS
  7. # We use these options to decide which functions to include.
  8. AC_ARG_WITH(target-subdir,
  9. AS_HELP_STRING([--with-target-subdir=SUBDIR],
  10. [configure in a subdirectory]))
  11. # We may get other options which we don't document:
  12. # --with-target-subdir, --with-multisrctop, --with-multisubdir
  13. # Find the rest of the source tree framework.
  14. AM_ENABLE_MULTILIB(, ..)
  15. AC_CANONICAL_SYSTEM
  16. _GCC_TOPLEV_NONCANONICAL_BUILD
  17. _GCC_TOPLEV_NONCANONICAL_TARGET
  18. AC_SUBST(target_noncanonical)
  19. GCC_LIBSTDCXX_RAW_CXX_FLAGS
  20. # This works around the fact that libtool configuration may change LD
  21. # for this particular configuration, but some shells, instead of
  22. # keeping the changes in LD private, export them just because LD is
  23. # exported.
  24. ORIGINAL_LD_FOR_MULTILIBS=$LD
  25. AC_PROG_LN_S
  26. # This works around an automake problem.
  27. mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
  28. AC_SUBST(mkinstalldirs)
  29. AC_ARG_WITH(cross-host,
  30. AS_HELP_STRING([--with-cross-host=HOST],
  31. [configure with a cross compiler from HOST]))
  32. AC_ARG_WITH(newlib,
  33. AS_HELP_STRING([--with-newlib],
  34. [configure with newlib]))
  35. AC_ARG_ENABLE(version-specific-runtime-libs,
  36. AS_HELP_STRING([--enable-version-specific-runtime-libs],
  37. [specify that runtime libraries should be installed in a compiler-specific directory]),
  38. [case "$enableval" in
  39. yes) version_specific_libs=yes ;;
  40. no) version_specific_libs=no ;;
  41. *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
  42. esac],
  43. [version_specific_libs=no]
  44. )
  45. AC_ARG_ENABLE(browser-plugin,
  46. AS_HELP_STRING([--enable-browser-plugin],
  47. [build gcjwebplugin web browser plugin]),
  48. [case "$enableval" in
  49. yes) browser_plugin_enabled=yes ;;
  50. no) browser_plugin_enabled=no ;;
  51. *) AC_MSG_ERROR([Unknown argument to enable/disable browser plugin]);;
  52. esac],
  53. [browser_plugin_enabled=no]
  54. )
  55. AC_ARG_ENABLE(gconf-peer,
  56. AS_HELP_STRING([--enable-gconf-peer],
  57. [compile GConf native peers for util.preferences]),
  58. [case "$enableval" in
  59. yes) gconf_enabled=yes ;;
  60. no) gconf_enabled=no ;;
  61. *) AC_MSG_ERROR([Unknown argument to enable/disable gconf-peer]);;
  62. esac],
  63. [gconf_enabled=no]
  64. )
  65. AC_ARG_WITH([antlr-jar],
  66. [AS_HELP_STRING([--with-antlr-jar=file],[Use ANTLR from the specified jar file])],
  67. [
  68. ANTLR_JAR=$withval
  69. ],
  70. [
  71. ANTLR_JAR=
  72. ])
  73. AC_MSG_CHECKING([for antlr.jar])
  74. if test "x$ANTLR_JAR" = x; then
  75. for antlr_lib_home in `ls -d /usr/local/share/antlr* 2> /dev/null` \
  76. /usr/share/antlr/lib /usr/share/java /usr/lib;
  77. do
  78. if test -f "$antlr_lib_home/antlr.jar"; then
  79. # FIXME: version check for antlr needed without using a VM
  80. ANTLR_JAR="$antlr_lib_home/antlr.jar"
  81. break
  82. fi
  83. done
  84. if test "x$ANTLR_JAR" = x; then
  85. AC_MSG_RESULT([not found])
  86. else
  87. AC_MSG_RESULT($ANTLR_JAR)
  88. fi
  89. else
  90. if test -f "${ANTLR_JAR}"; then
  91. AC_MSG_RESULT($ANTLR_JAR)
  92. else
  93. AC_MSG_ERROR([antlr jar file not found: $ANTLR_JAR])
  94. fi
  95. fi
  96. AC_SUBST(ANTLR_JAR)
  97. AC_ARG_ENABLE([gjdoc],
  98. [AS_HELP_STRING(--disable-gjdoc,compile GJDoc (disabled by --disable-gjdoc) [default=yes])],
  99. [case "${enableval}" in
  100. yes) BUILD_GJDOC=yes ;;
  101. no) BUILD_GJDOC=no ;;
  102. *) BUILD_GJDOC=yes ;;
  103. esac],
  104. [BUILD_GJDOC=maybe])
  105. AC_MSG_CHECKING([whether to build gjdoc])
  106. if test "x$BUILD_GJDOC" = xmaybe; then
  107. if test -f "${ANTLR_JAR}"; then
  108. BUILD_GJDOC=yes
  109. AC_MSG_RESULT(yes)
  110. else
  111. BUILD_GJDOC=no
  112. AC_MSG_RESULT([no, antlr.jar not found])
  113. fi
  114. else
  115. AC_MSG_RESULT($BUILD_GJDOC)
  116. fi
  117. AM_CONDITIONAL(CREATE_GJDOC, test "x${BUILD_GJDOC}" = xyes)
  118. AC_ARG_ENABLE(java-maintainer-mode,
  119. AS_HELP_STRING([--enable-java-maintainer-mode],
  120. [allow rebuilding of .class and .h files]))
  121. AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
  122. # It may not be safe to run linking tests in AC_PROG_CC/AC_PROG_CXX.
  123. GCC_NO_EXECUTABLES
  124. # For libstdc++-v3, -fno-builtin must be present here so that a
  125. # non-conflicting form of std::exit can be guessed by AC_PROG_CXX, and
  126. # used in later tests. This may not be necessary in libjava; I don't know.
  127. save_CXXFLAGS="$CXXFLAGS"
  128. CXXFLAGS="$CXXFLAGS -fno-builtin"
  129. AC_PROG_CC
  130. AC_PROG_CXX
  131. CXXFLAGS="$save_CXXFLAGS"
  132. AM_INIT_AUTOMAKE([no-dist 1.9.0])
  133. AC_CHECK_TOOL(AS, as)
  134. AC_CHECK_TOOL(LD, ld)
  135. AC_CHECK_TOOL(AR, ar)
  136. AC_CHECK_TOOL(RANLIB, ranlib, :)
  137. AC_CHECK_TOOL(DLLTOOL, dlltool, :)
  138. AC_PROG_AWK
  139. AC_CHECK_PROGS([JAR], [jar fastjar gjar], no)
  140. AC_PATH_PROG([ZIP], [zip], no)
  141. AC_PATH_PROG([UNZIP], [unzip], unzip)
  142. # We need a jar that supports -@. This is a GNU extension.
  143. if test "$JAR" != no; then
  144. rm -f config-test.jar
  145. echo $srcdir/configure.ac | $JAR -cf@ config-test.jar >/dev/null 2>&1
  146. if test -f config-test.jar; then
  147. rm -f config-test.jar
  148. else
  149. JAR=no
  150. fi
  151. fi
  152. # Prefer the jar we found, but fall back to our jar script.
  153. if test "$JAR" = no; then
  154. if test "$ZIP" = no; then
  155. AC_MSG_ERROR([cannot find neither zip nor jar, cannot continue])
  156. else
  157. # InfoZIP available, use the 'guaranteed' Bourne-shell JAR to build libjava
  158. JAR=`pwd`/scripts/jar
  159. fi
  160. fi
  161. AC_PROG_INSTALL
  162. AM_MAINTAINER_MODE
  163. AC_EXEEXT
  164. # configure.host sets the following important variables
  165. # libgcj_cflags - host specific C compiler flags
  166. # libgcj_cxxflags - host specific C++ compiler flags
  167. # libgcj_javaflags - host specific Java compiler flags
  168. # libgcj_sublib_ltflags - host specific Libtool flags
  169. # libgcj_sublib_core_extra_deps - host specific extra
  170. # dependencies for core sublib
  171. # (these last two only used when building sublibs)
  172. # and a number of others; see the list at the start of the file.
  173. libgcj_cflags=
  174. libgcj_cxxflags=
  175. libgcj_javaflags=
  176. libgcj_sublib_ltflags=
  177. libgcj_sublib_core_extra_deps=
  178. . ${srcdir}/configure.host
  179. ACX_PROG_LD_GNU_SYMBOLIC
  180. libgcj_ld_symbolic_functions=$SYMBOLIC_LDFLAGS
  181. if test -z "$libgcj_ld_symbolic"; then
  182. libgcj_ld_symbolic=$SYMBOLIC_LDFLAGS
  183. fi
  184. # for windows native targets enforce export of all symbols for shared libgcj.
  185. libgcj_ld_export_all=
  186. case "$host" in
  187. *mingw*)
  188. libgcj_ld_export_all=-Wl,--export-all-symbols
  189. ;;
  190. *)
  191. ;;
  192. esac
  193. LIBGCJ_CFLAGS="${libgcj_cflags}"
  194. LIBGCJ_CXXFLAGS="${libgcj_cxxflags}"
  195. LIBGCJ_JAVAFLAGS="${libgcj_javaflags}"
  196. LIBGCJ_SUBLIB_LTFLAGS="${libgcj_sublib_ltflags}"
  197. LIBGCJ_SUBLIB_CORE_EXTRA_DEPS="${libgcj_sublib_core_extra_deps}"
  198. LIBGCJ_LD_SYMBOLIC="${libgcj_ld_symbolic}"
  199. LIBGCJ_LD_SYMBOLIC_FUNCTIONS="${libgcj_ld_symbolic_functions}"
  200. LIBGCJ_LD_EXPORT_ALL="${libgcj_ld_export_all}"
  201. AC_SUBST(LIBGCJ_CFLAGS)
  202. AC_SUBST(LIBGCJ_CXXFLAGS)
  203. AC_SUBST(LIBGCJ_JAVAFLAGS)
  204. AC_SUBST(LIBGCJ_SUBLIB_LTFLAGS)
  205. AC_SUBST(LIBGCJ_SUBLIB_CORE_EXTRA_DEPS)
  206. AC_SUBST(LIBGCJ_LD_SYMBOLIC)
  207. AC_SUBST(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
  208. AC_SUBST(LIBGCJ_LD_EXPORT_ALL)
  209. # Only use libltdl for non-newlib builds.
  210. if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
  211. AC_LTDL_SHLIBPATH
  212. fi
  213. AC_CONFIG_HEADERS([include/config.h gcj/libgcj-config.h])
  214. # Possibly build libgcj as many sub-libraries.
  215. AC_ARG_ENABLE(libgcj-sublibs,
  216. AS_HELP_STRING([--enable-libgcj-sublibs],
  217. [build libgcj as many sub-libraries]))
  218. if test -z "$enable_libgcj_sublibs"; then
  219. enable_libgcj_sublibs=$enable_libgcj_sublibs_default
  220. fi
  221. AM_CONDITIONAL(BUILD_SUBLIBS, test "$enable_libgcj_sublibs" = yes)
  222. if test "$enable_libgcj_sublibs" = yes ; then
  223. # In theory we could make do with only one override and simply
  224. # tag "_bc" onto the end of it when we use it to generate the
  225. # spec, but that's an ugly thing to do when there are multiple
  226. # words in the string and you're relying on the ordering to
  227. # append the correct one.
  228. libgcj_spec_lgcj_override="-lgcj-noncore -lgcj"
  229. libgcj_spec_lgcj_bc_override="-lgcj-noncore -lgcj_bc"
  230. fi
  231. # See if the user has requested runtime debugging.
  232. LIBGCJDEBUG="disable"
  233. AC_SUBST(LIBGCJDEBUG)
  234. AC_ARG_ENABLE(libgcj-debug,
  235. AS_HELP_STRING([--enable-libgcj-debug],
  236. [enable runtime debugging code]),
  237. [if test "$enable_libgcj_debug" = yes; then
  238. AC_DEFINE(__GCJ_DEBUG, 1, [Define this if you want runtime debugging enabled.])
  239. LIBGCJDEBUG="enable"
  240. fi])
  241. AC_ARG_WITH([escher],
  242. AS_HELP_STRING([--with-escher=ABS.PATH],
  243. [specify path to escher dir or JAR for X peers]))
  244. case "$with_escher" in
  245. "")
  246. use_escher=false
  247. ;;
  248. "no")
  249. use_escher=false
  250. ;;
  251. "yes")
  252. AC_MSG_ERROR([Please supply an absolute path to Escher library])
  253. ;;
  254. *)
  255. use_escher=true
  256. ;;
  257. esac
  258. # Determine which AWT peer libraries to build
  259. AC_ARG_ENABLE(java-awt,
  260. AS_HELP_STRING([--enable-java-awt],
  261. [list of AWT peer implementations to be built]))
  262. peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
  263. use_xlib_awt=""
  264. use_gtk_awt=""
  265. use_qt_awt=""
  266. use_x_awt=""
  267. # The default toolkit to use is the first one specified.
  268. TOOLKIT=
  269. AC_SUBST(TOOLKIT)
  270. for peer in $peerlibs ; do
  271. case $peer in
  272. xlib)
  273. if test "$no_x" = yes; then
  274. echo "*** xlib peers requested but no X library available" 1>&2
  275. exit 1
  276. else
  277. use_xlib_awt="yes"
  278. if test -z "$TOOLKIT"; then
  279. TOOLKIT=gnu.awt.xlib.XToolkit
  280. fi
  281. fi
  282. ;;
  283. gtk)
  284. if test "$no_x" = yes; then
  285. echo "*** gtk peers requested but no X library available" 1>&2
  286. exit 1
  287. else
  288. use_gtk_awt=yes
  289. if test -z "$TOOLKIT"; then
  290. TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
  291. fi
  292. fi
  293. ;;
  294. qt)
  295. if test "$no_x" = yes; then
  296. # Perhaps we should admit the possibility of embedded Qt.
  297. echo "*** Qt peers requested but no X library available" 1>&2
  298. exit 1
  299. else
  300. use_qt_awt=yes
  301. if test -z "$TOOLKIT"; then
  302. TOOLKIT=gnu.java.awt.peer.qt.QtToolkit
  303. fi
  304. fi
  305. ;;
  306. x)
  307. use_x_awt=yes
  308. if test -z "$TOOLKIT"; then
  309. TOOLKIT=gnu.java.awt.peer.x.XToolkit
  310. fi
  311. ;;
  312. no)
  313. use_xlib_awt=
  314. use_gtk_awt=
  315. use_qt_awt=
  316. use_x_awt=
  317. break
  318. ;;
  319. *)
  320. echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
  321. exit 1
  322. esac
  323. done
  324. AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
  325. AM_CONDITIONAL(X_AWT, test "$use_x_awt" = yes)
  326. AC_DEFINE_UNQUOTED(AWT_TOOLKIT, "$TOOLKIT", [Name of default AWT toolkit])
  327. expanded_prefix=$prefix
  328. if test "X$prefix" = XNONE; then
  329. expanded_prefix=${ac_default_prefix}
  330. fi
  331. AC_DEFINE_UNQUOTED(LIBGCJ_PREFIX, "$expanded_prefix", [Installation prefix])
  332. # Create standard.omit based on decisions we just made.
  333. cp $srcdir/standard.omit.in standard.omit
  334. if test "$use_xlib_awt" != yes; then
  335. echo gnu/awt/xlib >> standard.omit
  336. echo gnu/gcj/xlib >> standard.omit
  337. fi
  338. if test "$use_x_awt" != yes; then
  339. echo gnu/java/awt/peer/x >> standard.omit
  340. fi
  341. # Tools that need to be compiled against classpath's tools classes
  342. : > vm-tools-packages
  343. for package in gnu/gcj/tools/gc_analyze ; do
  344. echo $package >> standard.omit
  345. echo $package >> vm-tools-packages
  346. done
  347. if test -z "${with_multisubdir}"; then
  348. builddotdot=.
  349. else
  350. builddotdot=`echo ${with_multisubdir} | sed -e 's:[[^/]][[^/]]*:..:g'`
  351. fi
  352. NATIVE=yes
  353. # Which gcj and host gcj (for ecjx) do we use?
  354. which_gcj=default
  355. host_exeext=${ac_exeext}
  356. GCJ_FOR_ECJX='$(GCJ)'
  357. GCC_FOR_ECJX='$(CXX)'
  358. built_gcc_dir="`cd ${builddotdot}/../../${host_subdir}/gcc && ${PWDCMD-pwd}`"
  359. if test -n "${with_cross_host}"; then
  360. # We are being configured with a cross compiler. We can't
  361. # use ac_exeext, because that is for the target platform.
  362. NATIVE=no
  363. cross_host_exeext=
  364. GCJ_FOR_ECJX="${with_cross_host}-gcj"
  365. GCC_FOR_ECJX="${with_cross_host}-gcc"
  366. case "${with_cross_host}" in
  367. *mingw* | *cygwin*)
  368. cross_host_exeext=.exe
  369. ;;
  370. esac
  371. host_exeext=${cross_host_exeext}
  372. if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
  373. if test x"$build_noncanonical" = x"$with_cross_host"; then
  374. # Ordinary cross (host!=target and host=build)
  375. which_gcj=built
  376. else
  377. # Canadian cross (host!=target and host!=build)
  378. which_gcj=cross
  379. fi
  380. else
  381. which_gcj=cross
  382. fi
  383. else
  384. # We are being configured with a native or crossed-native compiler
  385. if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
  386. if test x"$build" = x"$host"; then
  387. # True native build (host=target and host=build)
  388. which_gcj=built
  389. else
  390. # Crossed-native build (host=target and host!=build)
  391. which_gcj=cross
  392. fi
  393. else
  394. which_gcj=path
  395. fi
  396. fi
  397. libgcjdir=`${PWDCMD-pwd}`
  398. case $GCJ in
  399. *" -B"*)
  400. # Just in case there is a comma in the build dir, quote it for the
  401. # sed command below.
  402. case $libgcjdir in
  403. *[[,\\]]*) qlibgcjdir=`echo "$libgcjdir" | sed 's:[[,\\]]:\\&:g'`;;
  404. *) qlibgcjdir=$libgcjdir;;
  405. esac
  406. GCJ=`echo "$GCJ" | sed "s, -B, -B$qlibgcjdir/&,"`
  407. ;;
  408. *)
  409. GCJ=$GCJ" -B$libgcjdir/"
  410. ;;
  411. esac
  412. case "${which_gcj}" in
  413. built)
  414. GCJH='$(top_builddir)/$(MULTIBUILDTOP)../../$(host_subdir)/gcc/gcjh'
  415. ;;
  416. cross)
  417. if test "x${with_newlib}" = "xyes"; then
  418. # FIXME (comment): Why is this needed?
  419. LIBGCC_UNWIND_INCLUDE=
  420. fi
  421. GCJH='$(target_noncanonical)-gcjh'
  422. ;;
  423. path)
  424. GCJH=gcjh
  425. ;;
  426. esac
  427. JAVAC="$GCJ -C"
  428. export JAVAC
  429. AC_SUBST(GCJ_FOR_ECJX)
  430. AC_SUBST(GCC_FOR_ECJX)
  431. AC_SUBST(GCJH)
  432. AC_SUBST(host_exeext)
  433. # Create it, so that compile/link tests don't fail
  434. test -f libgcj.spec || touch libgcj.spec
  435. # Set up to configure Classpath.
  436. # FIXME: no supported way to pass args in autoconf.
  437. # Disable tool wrappers to avoid ltdl.h configure check.
  438. ac_configure_args="$ac_configure_args --disable-tool-wrappers"
  439. ac_configure_args="$ac_configure_args --disable-load-library"
  440. ac_configure_args="$ac_configure_args --${LIBGCJDEBUG}-debug"
  441. ac_configure_args="$ac_configure_args --enable-default-toolkit=$TOOLKIT"
  442. dir1=`cd $srcdir && pwd`
  443. dir2=`pwd`
  444. ac_configure_args="$ac_configure_args --with-vm-classes=$dir1:$dir2"
  445. ac_configure_args="$ac_configure_args --disable-core-jni"
  446. dnl FIXME?
  447. ac_configure_args="$ac_configure_args --disable-examples"
  448. ac_configure_args="$ac_configure_args --with-glibj=build"
  449. if test "$browser_plugin_enabled" != yes; then
  450. ac_configure_args="$ac_configure_args --disable-plugin"
  451. else
  452. ac_configure_args="$ac_configure_args --enable-plugin"
  453. fi
  454. if test "$gconf_enabled" != yes; then
  455. ac_configure_args="$ac_configure_args --disable-gconf-peer"
  456. ac_configure_args="$ac_configure_args --enable-default-preferences-peer=gnu.java.util.prefs.FileBasedFactory"
  457. fi
  458. if test "$use_gtk_awt" != yes; then
  459. ac_configure_args="$ac_configure_args --disable-gtk-peer --disable-plugin"
  460. fi
  461. if test "$use_qt_awt" != yes; then
  462. ac_configure_args="$ac_configure_args --disable-qt-peer"
  463. else
  464. # We need this as qt is disabled by default in classpath.
  465. ac_configure_args="$ac_configure_args --enable-qt-peer"
  466. fi
  467. if test "$use_x_awt" != yes; then
  468. ac_configure_args="$ac_configure_args --without-escher"
  469. else
  470. # We need this as escher is disabled by default in classpath.
  471. if test "$use_escher" != true; then
  472. AC_MSG_ERROR([Please supply an absolute path to the Escher library])
  473. else
  474. ac_configure_args="$ac_configure_args --with-escher=$with_escher"
  475. fi
  476. fi
  477. if test "x$BUILD_GJDOC" = xno; then
  478. ac_configure_args="$ac_configure_args --disable-gjdoc"
  479. fi
  480. # -Werror causes unavoidable problems in code using alsa.
  481. ac_configure_args="$ac_configure_args --disable-regen-headers"
  482. ac_configure_args="$ac_configure_args --disable-Werror"
  483. dnl --with-gcj=$GCJ
  484. dnl --with-javah=$GCJH
  485. dnl gtk-cairo -- just export here...
  486. dnl --enable-regen-headers?
  487. # Only use libltdl for non-newlib builds.
  488. if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
  489. AC_LIBLTDL_CONVENIENCE
  490. AC_LIBTOOL_DLOPEN
  491. DIRLTDL=libltdl
  492. AC_DEFINE(USE_LTDL, 1, [Define if libltdl is in use.])
  493. # Sigh. Libtool's macro doesn't do the right thing.
  494. INCLTDL="-I\$(top_srcdir)/libltdl $INCLTDL"
  495. # FIXME: this is a hack.
  496. sub_auxdir="`cd $ac_aux_dir && ${PWDCMD-pwd}`"
  497. ac_configure_args="$ac_configure_args --with-auxdir=$sub_auxdir"
  498. fi
  499. AC_SUBST(INCLTDL)
  500. AC_SUBST(LIBLTDL)
  501. AC_SUBST(DIRLTDL)
  502. AC_PROG_LIBTOOL
  503. ACX_LT_HOST_FLAGS
  504. AM_PROG_GCJ
  505. AM_PROG_CC_C_O
  506. AC_CONFIG_SUBDIRS(classpath libltdl)
  507. # The -no-testsuite modules omit the test subdir.
  508. AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
  509. # Should the runtime set system properties by examining the
  510. # environment variable GCJ_PROPERTIES?
  511. AC_ARG_ENABLE(getenv-properties,
  512. AS_HELP_STRING([--disable-getenv-properties],
  513. [don't set system properties from GCJ_PROPERTIES]))
  514. # Whether GCJ_PROPERTIES is used depends on the target.
  515. if test -z "$enable_getenv_properties"; then
  516. enable_getenv_properties=${enable_getenv_properties_default-yes}
  517. fi
  518. if test "$enable_getenv_properties" = no; then
  519. AC_DEFINE(DISABLE_GETENV_PROPERTIES, 1,
  520. [Define if system properties shouldn't be read from getenv("GCJ_PROPERTIES").])
  521. fi
  522. # Whether we should use arguments to main()
  523. if test -z "$enable_main_args"; then
  524. enable_main_args=${enable_main_args_default-yes}
  525. fi
  526. if test "$enable_main_args" = no; then
  527. AC_DEFINE(DISABLE_MAIN_ARGS, 1, [Define if we should ignore arguments to main().])
  528. fi
  529. # Should we use hashtable-based synchronization?
  530. # Currently works only for Linux X86/ia64
  531. # Typically faster and more space-efficient
  532. AC_ARG_ENABLE(hash-synchronization,
  533. AS_HELP_STRING([--enable-hash-synchronization],
  534. [use global hash table for monitor locks]))
  535. if test -z "$enable_hash_synchronization"; then
  536. enable_hash_synchronization=$enable_hash_synchronization_default
  537. fi
  538. install_ecj_jar=no
  539. ECJ_BUILD_JAR=
  540. ECJ_JAR=
  541. AC_ARG_WITH(ecj-jar,
  542. AS_HELP_STRING([--with-ecj-jar=FILE], [use preinstalled ecj jar]),
  543. [ECJ_JAR=$withval],
  544. [if test -f $multi_basedir/ecj.jar; then
  545. ECJ_BUILD_JAR=$multi_basedir/ecj.jar
  546. ECJ_JAR='$(jardir)/ecj.jar'
  547. install_ecj_jar=yes
  548. fi])
  549. AC_SUBST(ECJ_BUILD_JAR)
  550. AC_SUBST(ECJ_JAR)
  551. AM_CONDITIONAL(BUILD_ECJ1, test "$ECJ_JAR" != "")
  552. AM_CONDITIONAL(INSTALL_ECJ_JAR, test $install_ecj_jar = yes)
  553. AC_ARG_WITH(java-home,
  554. AS_HELP_STRING([--with-java-home=DIRECTORY],
  555. [value of java.home system property]),
  556. [JAVA_HOME="${withval}"], [JAVA_HOME=""])
  557. AM_CONDITIONAL(JAVA_HOME_SET, test ! -z "$JAVA_HOME")
  558. AC_SUBST(JAVA_HOME)
  559. suppress_libgcj_bc=no
  560. AC_ARG_ENABLE(libgcj-bc,
  561. AS_HELP_STRING([--enable-libgcj-bc],
  562. [enable(default) or disable BC ABI for portions of libgcj]),
  563. [if test "$enable_libgcj_bc" = "no"; then
  564. suppress_libgcj_bc=yes
  565. fi])
  566. AM_CONDITIONAL(SUPPRESS_LIBGCJ_BC, test "$suppress_libgcj_bc" = "yes")
  567. build_libgcj_reduced_reflection=no
  568. AC_ARG_ENABLE(reduced-reflection,
  569. AS_HELP_STRING([--enable-reduced-reflection],
  570. [enable or disable(default) -freduced-reflection when building portions of libgcj]),
  571. [if test "$enable_reduced_reflection" = "yes"; then
  572. build_libgcj_reduced_reflection=yes
  573. fi])
  574. AM_CONDITIONAL(BUILD_LIBGCJ_REDUCED_REFLECTION, test "$build_libgcj_reduced_reflection" = "yes")
  575. # What is the native OS API for MinGW?
  576. AC_ARG_WITH(win32-nlsapi,
  577. AS_HELP_STRING([--with-win32-nlsapi=ansi or unicows or unicode],
  578. [native MinGW libgcj Win32 OS API (default is ansi)]),
  579. [case "${withval}" in
  580. ansi) with_win32_nlsapi=ansi ;;
  581. unicows) with_win32_nlsapi=unicows ;;
  582. unicode) with_win32_nlsapi=unicode ;;
  583. *) AC_MSG_ERROR(Bad value ${withval} for --with-win32-nlsapi.) ;;
  584. esac],[with_win32_nlsapi=ansi])
  585. case "${with_win32_nlsapi}" in
  586. unicows | unicode)
  587. AC_DEFINE(MINGW_LIBGCJ_UNICODE, 1,
  588. [Define if MinGW libgcj uses the Windows UNICODE OS API.])
  589. ;;
  590. esac
  591. # configure.host sets slow_pthread_self if the synchronization code should
  592. # try to avoid pthread_self calls by caching thread IDs in a hashtable.
  593. if test "${slow_pthread_self}" = "yes"; then
  594. AC_DEFINE(SLOW_PTHREAD_SELF, 1,
  595. [Define if if the synchronization code should try to avoid pthread_self calls by caching thread IDs in a hashtable.])
  596. fi
  597. # Check for gc debugging. This option is handled both here and in the GC.
  598. AC_ARG_ENABLE(gc-debug,
  599. AS_HELP_STRING([--enable-gc-debug],
  600. [include full support for pointer backtracing etc.]),
  601. [ if test "$enable_gc_debug" = "yes"; then
  602. AC_DEFINE(LIBGCJ_GC_DEBUG, 1,
  603. [Define if we want to use debug calls into the garbage collector.])
  604. fi])
  605. # See if the user has the interpreter included.
  606. AC_ARG_ENABLE(interpreter,
  607. AS_HELP_STRING([--enable-interpreter],
  608. [enable interpreter]),
  609. [if test "$enable_interpreter" = yes; then
  610. # This can also be set in configure.host.
  611. libgcj_interpreter=yes
  612. elif test "$enable_interpreter" = no; then
  613. libgcj_interpreter=no
  614. fi])
  615. if test "$libgcj_interpreter" = yes; then
  616. AC_DEFINE(INTERPRETER, 1, [Define if you want a bytecode interpreter.])
  617. fi
  618. INTERPRETER="$libgcj_interpreter"
  619. AC_SUBST(INTERPRETER)
  620. AM_CONDITIONAL(INTERPRETER, test "$libgcj_interpreter" = yes)
  621. AC_MSG_CHECKING([for exception model to use])
  622. AC_LANG_PUSH(C++)
  623. AC_ARG_ENABLE(sjlj-exceptions,
  624. AS_HELP_STRING([--enable-sjlj-exceptions],
  625. [force use of builtin_setjmp for exceptions]),
  626. [:],
  627. [dnl Botheration. Now we've got to detect the exception model.
  628. dnl Link tests against libgcc.a are problematic since -- at least
  629. dnl as of this writing -- we've not been given proper -L bits for
  630. dnl single-tree newlib and libgloss.
  631. dnl
  632. dnl This is what AC_TRY_COMPILE would do if it didn't delete the
  633. dnl conftest files before we got a change to grep them first.
  634. cat > conftest.$ac_ext << EOF
  635. [#]line __oline__ "configure"
  636. struct S { ~S(); };
  637. void bar();
  638. void foo()
  639. {
  640. S s;
  641. bar();
  642. }
  643. EOF
  644. old_CXXFLAGS="$CXXFLAGS"
  645. CXXFLAGS=-S
  646. if AC_TRY_EVAL(ac_compile); then
  647. if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
  648. enable_sjlj_exceptions=yes
  649. elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
  650. enable_sjlj_exceptions=no
  651. elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
  652. # ARM EH ABI.
  653. enable_sjlj_exceptions=no
  654. fi
  655. fi
  656. CXXFLAGS="$old_CXXFLAGS"
  657. rm -f conftest*])
  658. if test x$enable_sjlj_exceptions = xyes; then
  659. AC_DEFINE(SJLJ_EXCEPTIONS, 1,
  660. [Define if the compiler is configured for setjmp/longjmp exceptions.])
  661. ac_exception_model_name=sjlj
  662. elif test x$enable_sjlj_exceptions = xno; then
  663. ac_exception_model_name="call frame"
  664. else
  665. AC_MSG_ERROR([unable to detect exception model])
  666. fi
  667. AC_LANG_POP(C++)
  668. AC_MSG_RESULT($ac_exception_model_name)
  669. # If we are non using SJLJ exceptions, and this host does not have support
  670. # for unwinding from a signal handler, enable checked dereferences and divides.
  671. if test $can_unwind_signal = no && test $enable_sjlj_exceptions = no; then
  672. CHECKREFSPEC=-fcheck-references
  673. DIVIDESPEC=-fuse-divide-subroutine
  674. EXCEPTIONSPEC=
  675. fi
  676. # See if the user wants to disable java.net. This is the mildly
  677. # ugly way that we admit that target-side configuration sucks.
  678. AC_ARG_ENABLE(java-net,
  679. AS_HELP_STRING([--disable-java-net],
  680. [disable java.net]))
  681. # Whether java.net is built by default can depend on the target.
  682. if test -z "$enable_java_net"; then
  683. enable_java_net=${enable_java_net_default-yes}
  684. fi
  685. if test "$enable_java_net" = no; then
  686. AC_DEFINE(DISABLE_JAVA_NET, 1, [Define if java.net native functions should be stubbed out.])
  687. fi
  688. # See if the user wants to configure without libffi. Some
  689. # architectures don't support it, and default values are set in
  690. # configure.host.
  691. AC_ARG_WITH(libffi,
  692. AS_HELP_STRING([--without-libffi],
  693. [don't use libffi]),
  694. [:],
  695. [with_libffi=${with_libffi_default-yes}])
  696. LIBFFI=
  697. LIBFFIINCS=
  698. if test "$with_libffi" != no; then
  699. AC_DEFINE(USE_LIBFFI, 1, [Define if we're to use libffi.])
  700. LIBFFI=../libffi/libffi_convenience.la
  701. LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include'
  702. fi
  703. AC_SUBST(LIBFFI)
  704. AC_SUBST(LIBFFIINCS)
  705. # See if the user wants to disable JVMPI support.
  706. AC_ARG_ENABLE(jvmpi,
  707. AS_HELP_STRING([--disable-jvmpi],
  708. [disable JVMPI support]))
  709. if test "$enable_jvmpi" != no; then
  710. AC_DEFINE(ENABLE_JVMPI, 1, [Define if you are using JVMPI.])
  711. fi
  712. # If the target is an eCos system, use the appropriate eCos
  713. # I/O routines.
  714. # FIXME: this should not be a local option but a global target
  715. # system; at present there is no eCos target.
  716. TARGET_ECOS=${PROCESS-"no"}
  717. AC_ARG_WITH(ecos,
  718. [ --with-ecos enable runtime eCos target support],
  719. TARGET_ECOS="$with_ecos"
  720. )
  721. case "$TARGET_ECOS" in
  722. no) case "$host" in
  723. *mingw*)
  724. PLATFORM=Win32
  725. PLATFORMNET=Win32
  726. PLATFORMH=win32.h
  727. CHECK_FOR_BROKEN_MINGW_LD
  728. ;;
  729. *)
  730. PLATFORM=Posix
  731. PLATFORMNET=Posix
  732. PLATFORMH=posix.h
  733. ;;
  734. esac
  735. ;;
  736. *)
  737. PLATFORM=Ecos
  738. PLATFORMNET=NoNet
  739. AC_DEFINE(ECOS, 1, [Define if you're running eCos.])
  740. PLATFORMH=posix.h
  741. ;;
  742. esac
  743. AC_SUBST(PLATFORM)
  744. AC_CONFIG_LINKS(include/platform.h:include/$PLATFORMH)
  745. AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
  746. [Define if you have int32_t and uint32_t.]))
  747. AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
  748. [Define if you have int32_t and uint32_t.]))
  749. AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
  750. [Define if you have u_int32_t]))
  751. AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
  752. [Define if you have u_int32_t]))
  753. AM_CONDITIONAL(USING_WIN32_PLATFORM, test "$PLATFORM" = Win32)
  754. AM_CONDITIONAL(USING_POSIX_PLATFORM, test "$PLATFORM" = Posix || test "$PLATFORM" = Ecos)
  755. case "$host" in
  756. *-darwin*) DARWIN_CRT=true ;;
  757. *) DARWIN_CRT=false ;;
  758. esac
  759. AM_CONDITIONAL(USING_DARWIN_CRT, $DARWIN_CRT)
  760. # This may not be defined in a non-ANS conformant embedded system.
  761. # FIXME: Should these case a runtime exception in that case?
  762. AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME, 1,
  763. [Define is you have 'localtime' in <time.h>]))
  764. # Create the subdirectory for natFile.cc, or the attempt
  765. # to create the link will fail.
  766. test -d java || mkdir java
  767. test -d java/io || mkdir java/io
  768. test -d gnu || mkdir gnu
  769. AC_CONFIG_LINKS(java/io/natFile.cc:java/io/natFile${FILE-${PLATFORM}}.cc)
  770. # Likewise for natConcreteProcess.cc.
  771. test -d java/lang || mkdir java/lang
  772. AC_CONFIG_LINKS(java/lang/natConcreteProcess.cc:java/lang/nat${PLATFORM}Process.cc)
  773. # Likewise for natVMInetAddress.cc and natVMNetworkInterface.cc.
  774. test -d java/net || mkdir java/net
  775. AC_CONFIG_LINKS(java/net/natVMInetAddress.cc:java/net/natVMInetAddress${PLATFORMNET}.cc)
  776. AC_CONFIG_LINKS(java/net/natVMNetworkInterface.cc:java/net/natVMNetworkInterface${PLATFORMNET}.cc)
  777. # Likewise for natPlainSocketImpl.cc and natPlainDatagramSocketImpl.cc.
  778. test -d gnu/java || mkdir gnu/java
  779. test -d gnu/java/net || mkdir gnu/java/net
  780. AC_CONFIG_LINKS(gnu/java/net/natPlainSocketImpl.cc:gnu/java/net/natPlainSocketImpl${PLATFORMNET}.cc)
  781. AC_CONFIG_LINKS(gnu/java/net/natPlainDatagramSocketImpl.cc:gnu/java/net/natPlainDatagramSocketImpl${PLATFORMNET}.cc)
  782. # Likewise for natVMPipe.cc and natVMSelector.cc.
  783. test -d gnu/java/nio || mkdir gnu/java/nio
  784. AC_CONFIG_LINKS(gnu/java/nio/natVMPipe.cc:gnu/java/nio/natVMPipe${PLATFORM}.cc)
  785. AC_CONFIG_LINKS(gnu/java/nio/natVMSelector.cc:gnu/java/nio/natVMSelector${PLATFORM}.cc)
  786. # Likewise for natFileChannelImpl.cc
  787. test -d gnu/java/nio/channels || mkdir gnu/java/nio/channels
  788. AC_CONFIG_LINKS(gnu/java/nio/channels/natFileChannelImpl.cc:gnu/java/nio/channels/natFileChannel${FILE-${PLATFORM}}.cc)
  789. # Likewise for natVMSecureRandom.cc
  790. test -d gnu/java/security || mkdir gnu/java/security
  791. test -d gnu/java/security/jce || mkdir gnu/java/security/jce
  792. test -d gnu/java/security/jce/prng || mkdir gnu/java/security/jce/prng
  793. AC_CONFIG_LINKS(gnu/java/security/jce/prng/natVMSecureRandom.cc:gnu/java/security/jce/prng/natVMSecureRandom${FILE-${PLATFORM}}.cc)
  794. case "${host}" in
  795. *mingw*)
  796. SYSTEMSPEC="-lgdi32 -lws2_32"
  797. if test "${with_win32_nlsapi}" = "unicows"; then
  798. SYSTEMSPEC="-lunicows $SYSTEMSPEC"
  799. fi
  800. ;;
  801. *-*-darwin[[912]]*)
  802. SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}"
  803. ;;
  804. *)
  805. SYSTEMSPEC=
  806. ;;
  807. esac
  808. AC_SUBST(SYSTEMSPEC)
  809. AC_ARG_WITH(system-zlib,
  810. AS_HELP_STRING([--with-system-zlib],
  811. [use installed libz]))
  812. ZLIBSPEC=
  813. AC_SUBST(ZLIBSPEC)
  814. ZLIBTESTSPEC=
  815. AC_SUBST(ZLIBTESTSPEC)
  816. AC_PATH_XTRA
  817. # FIXME: this should be _libs on some hosts.
  818. libsubdir=.libs
  819. LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -rpath `${PWDCMD-pwd}`/.libs"
  820. LIBSTDCXXSPEC=
  821. # extra LD Flags which are required for targets
  822. case "${host}" in
  823. *-*-darwin[[0-7]].*)
  824. # For now we have to disable it on darwin[8-9] because it slows down
  825. # the linking phase. A possible bug in ld?
  826. # on Darwin -single_module speeds up loading of the dynamic libraries.
  827. extra_ldflags_libjava=-Wl,-single_module
  828. ;;
  829. arm*-*-linux-*)
  830. # Some of the ARM unwinder code is actually in libstdc++. We
  831. # could in principle replicate it in libgcj, but it's better to
  832. # have a dependency on libstdc++.
  833. extra_ldflags='-L$(here)/../libstdc++-v3/src/.libs -lstdc++'
  834. LIBSTDCXXSPEC=-lstdc++
  835. LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -L`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -rpath `${PWDCMD-pwd}`/.libs:`${PWDCMD-pwd}`/../libstdc++-v3/src/.libs -lstdc++"
  836. ;;
  837. *-*-cygwin)
  838. extra_ldflags_libjava=-liconv
  839. ;;
  840. *-*-mingw*)
  841. extra_ldflags_libjava=-lws2_32
  842. ;;
  843. esac
  844. LIBMATHSPEC=
  845. # extra LD Flags which are required for targets
  846. case "${host}" in
  847. *-*-darwin*)
  848. ;;
  849. *)
  850. LIBMATHSPEC=-lm
  851. ;;
  852. esac
  853. # Check for --no-merge-exidx-entries, an ARM-specific linker option.
  854. AC_CACHE_CHECK([for --no-merge-exidx-entries], [libgcj_cv_exidx],
  855. [saved_ldflags="$LDFLAGS"
  856. LDFLAGS="${LDFLAGS} -Wl,--no-merge-exidx-entries"
  857. AC_LINK_IFELSE([int main(void){ return 0;} ],
  858. [eval "libgcj_cv_exidx=yes"],
  859. [eval "libgcj_cv_exidx=no"])
  860. LDFLAGS="${saved_ldflags}"]
  861. )
  862. if test "${libgcj_cv_exidx}" = "yes"; then
  863. SYSTEMSPEC="${SYSTEMSPEC} --no-merge-exidx-entries"
  864. extra_ldflags="${extra_ldflags} -Wl,--no-merge-exidx-entries"
  865. fi
  866. AC_SUBST(extra_ldflags_libjava)
  867. AC_SUBST(extra_ldflags)
  868. AC_SUBST(LIBSTDCXXSPEC)
  869. AC_SUBST(LIBMATHSPEC)
  870. AC_SUBST(LIBGCJTESTSPEC)
  871. # Allow the GC to be disabled. Can be useful when debugging.
  872. AC_MSG_CHECKING([for garbage collector to use])
  873. AC_ARG_ENABLE(java-gc,
  874. AS_HELP_STRING([--enable-java-gc=TYPE],
  875. [choose garbage collector (default is boehm)]),
  876. [GC=$enableval],
  877. [GC=boehm])
  878. GCLIBS=
  879. GCINCS=
  880. GCDEPS=
  881. GCSPEC=
  882. JC1GCSPEC=
  883. GCTESTSPEC=
  884. case "$GC" in
  885. boehm)
  886. AC_MSG_RESULT(boehm)
  887. GCLIBS=../boehm-gc/libgcjgc_convenience.la
  888. JC1GCSPEC='-fuse-boehm-gc'
  889. GCTESTSPEC="-L`${PWDCMD-pwd}`/../boehm-gc/.libs -rpath `${PWDCMD-pwd}`/../boehm-gc/.libs"
  890. GCINCS='-I$(top_srcdir)/../boehm-gc/include -I../boehm-gc/include'
  891. GCOBJS=boehm.lo
  892. GCHDR=boehm-gc.h
  893. # The POSIX thread support needs to know this.
  894. AC_DEFINE(HAVE_BOEHM_GC, 1, [Define if Boehm GC in use.])
  895. ;;
  896. no)
  897. AC_MSG_RESULT(none)
  898. GCHDR=no-gc.h
  899. ;;
  900. *)
  901. AC_MSG_ERROR([unrecognized collector "$GC"])
  902. ;;
  903. esac
  904. AC_SUBST(GCLIBS)
  905. AC_SUBST(GCINCS)
  906. AC_SUBST(GCDEPS)
  907. AC_SUBST(GCSPEC)
  908. AC_SUBST(JC1GCSPEC)
  909. AC_SUBST(GCTESTSPEC)
  910. AC_CONFIG_LINKS(include/java-gc.h:include/$GCHDR)
  911. AM_CONDITIONAL(USING_BOEHMGC, test "$GC" = boehm)
  912. AM_CONDITIONAL(USING_NOGC, test "$GC" = no)
  913. AC_MSG_CHECKING([for thread model used by GCC])
  914. THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
  915. AC_MSG_RESULT([$THREADS])
  916. case "$THREADS" in
  917. no | none | single)
  918. THREADS=none
  919. ;;
  920. aix | posix | pthreads)
  921. THREADS=posix
  922. case "$host" in
  923. *-*-linux*)
  924. AC_DEFINE(LINUX_THREADS, 1, [Define if using POSIX threads on Linux.])
  925. ;;
  926. esac
  927. ;;
  928. win32)
  929. ;;
  930. dce | vxworks)
  931. AC_MSG_ERROR(thread package $THREADS not yet supported)
  932. ;;
  933. *)
  934. AC_MSG_ERROR($THREADS is an unknown thread package)
  935. ;;
  936. esac
  937. THREADCXXFLAGS=
  938. THREADLDFLAGS=
  939. THREADLIBS=
  940. THREADINCS=
  941. THREADDEPS=
  942. THREADH=
  943. THREADSPEC=
  944. THREADSTARTFILESPEC=
  945. case "$THREADS" in
  946. posix)
  947. case "$host" in
  948. *-*-cygwin*)
  949. # Don't set THREADLIBS here. Cygwin doesn't have -lpthread.
  950. ;;
  951. *-*-freebsd[[34]].*)
  952. # Before FreeBSD 5, it didn't have -lpthread (or any library which
  953. # merely adds pthread_* functions) but it does have a -pthread switch
  954. # which is required at link-time to select -lc_r *instead* of -lc.
  955. THREADLDFLAGS=-pthread
  956. # Don't set THREADSPEC here as might be expected since -pthread is
  957. # not processed when found within a spec file, it must come from
  958. # the command line. For now, the user must provide the -pthread
  959. # switch to link code compiled with gcj. In future, consider adding
  960. # support for weak references to pthread_* functions ala gthr.h API.
  961. THREADSPEC='%{!pthread: %{!shared: %eUnder this configuration, the user must provide -pthread when linking.}}'
  962. ;;
  963. *-*-freebsd*)
  964. # FreeBSD >=5.3 implements a model much closer to other modern UNIX
  965. # systems which support threads and -lpthread.
  966. THREADLDFLAGS=-pthread
  967. THREADSPEC=-lpthread
  968. ;;
  969. hppa*-hp-hpux*)
  970. THREADCXXFLAGS=-pthread
  971. # boehm-gc needs some functions from librt, so link that too.
  972. THREADLIBS='-lpthread -lrt'
  973. THREADSPEC='-lpthread -lrt'
  974. ;;
  975. *-*-darwin*)
  976. # Don't set THREADLIBS or THREADSPEC as Darwin already
  977. # provides pthread via libSystem.
  978. ;;
  979. *)
  980. THREADLIBS=-lpthread
  981. THREADSPEC=-lpthread
  982. ;;
  983. esac
  984. THREADH=posix-threads.h
  985. # MIT pthreads doesn't seem to have the mutexattr functions.
  986. # But for now we don't check for it. We just assume you aren't
  987. # using MIT pthreads.
  988. AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
  989. # If we're using the Boehm GC, then we happen to know that it
  990. # defines _REENTRANT, so we don't bother. Eww.
  991. if test "$GC" != boehm; then
  992. AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
  993. fi
  994. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Required define if using POSIX threads])
  995. ;;
  996. win32)
  997. THREADH=win32-threads.h
  998. THREADCXXFLAGS=-mthreads
  999. # We need thread-safe exception handling so _CRT_MT should be set to 1.
  1000. # But we do not want the executables created to be dependent on
  1001. # mingwm10.dll which provides a __mingwthr_key_dtor() that cleans up
  1002. # exception handling contexts. The following kludge achieves this effect
  1003. # and causes a dummy __mingwthr_key_dtor() to be linked in from
  1004. # libmingw32.a. This causes a memory leak of about 24 bytes per thread.
  1005. # A workaround is to explicitly use -mthreads while linking Java programs.
  1006. # See PR libgcj/28263.
  1007. #
  1008. # FIXME: In Java we are able to detect thread death at the end of
  1009. # Thread.run() so we should be able to clean up the exception handling
  1010. # contexts ourselves.
  1011. case "$host" in
  1012. *-w64-mingw*)
  1013. ;;
  1014. *)
  1015. THREADSTARTFILESPEC='crtmt%O%s'
  1016. ;;
  1017. esac
  1018. ;;
  1019. none)
  1020. THREADH=no-threads.h
  1021. ;;
  1022. esac
  1023. AC_CONFIG_LINKS(include/java-threads.h:include/$THREADH)
  1024. AC_SUBST(THREADLIBS)
  1025. AC_SUBST(THREADINCS)
  1026. AC_SUBST(THREADDEPS)
  1027. AC_SUBST(THREADSPEC)
  1028. AC_SUBST(THREADSTARTFILESPEC)
  1029. AC_SUBST(THREADLDFLAGS)
  1030. AC_SUBST(THREADCXXFLAGS)
  1031. AM_CONDITIONAL(USING_POSIX_THREADS, test "$THREADS" = posix)
  1032. AM_CONDITIONAL(USING_WIN32_THREADS, test "$THREADS" = win32)
  1033. AM_CONDITIONAL(USING_NO_THREADS, test "$THREADS" = none)
  1034. if test "$enable_shared" != yes; then
  1035. use_libgcj_bc=no
  1036. fi
  1037. AM_CONDITIONAL(USE_LIBGCJ_BC, test "$use_libgcj_bc" = yes)
  1038. if test -d sysdep; then true; else mkdir sysdep; fi
  1039. AC_CONFIG_LINKS(sysdep/locks.h:sysdep/$sysdeps_dir/locks.h)
  1040. AC_CONFIG_LINKS(sysdep/backtrace.h:$fallback_backtrace_h)
  1041. AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
  1042. LIBGCJ_SPEC_LGCJ=-lgcj
  1043. LIBGCJ_SPEC_LGCJ_BC=-lgcj_bc
  1044. if test x"$libgcj_spec_lgcj_override" != x ; then
  1045. LIBGCJ_SPEC_LGCJ=$libgcj_spec_lgcj_override
  1046. fi
  1047. if test x"$libgcj_spec_lgcj_bc_override" != x ; then
  1048. LIBGCJ_SPEC_LGCJ_BC=$libgcj_spec_lgcj_bc_override
  1049. fi
  1050. LIBGCJ_SPEC="%{s-bc-abi:} $LIBGCJ_SPEC_LGCJ"
  1051. if test "$use_libgcj_bc" = yes; then
  1052. LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:$LIBGCJ_SPEC_LGCJ;:$LIBGCJ_SPEC_LGCJ_BC}"
  1053. LIBGCJ_BC_SPEC="%{findirect-dispatch:-fPIC}"
  1054. fi
  1055. AC_SUBST(LIBGCJ_SPEC)
  1056. AC_SUBST(LIBGCJ_BC_SPEC)
  1057. HASH_SYNC_SPEC=
  1058. # Hash synchronization is only useful with posix threads right now.
  1059. if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
  1060. HASH_SYNC_SPEC=-fhash-synchronization
  1061. AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
  1062. fi
  1063. AC_SUBST(HASH_SYNC_SPEC)
  1064. AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
  1065. # We're in the tree with libgcc, and need to include some of its headers.
  1066. LIBGCC_UNWIND_INCLUDE='-I$(multi_basedir)/./libjava/../libgcc'
  1067. if test "x${with_newlib}" = "xyes"; then
  1068. # We are being configured with a cross compiler. AC_REPLACE_FUNCS
  1069. # may not work correctly, because the compiler may not be able to
  1070. # link executables.
  1071. # We assume newlib. This lets us hard-code the functions we know
  1072. # we'll have.
  1073. AC_DEFINE(HAVE_MEMMOVE, 1, [Define if you have memmove.])
  1074. AC_DEFINE(HAVE_MEMCPY, 1, [Define if you have memcpy.])
  1075. AC_DEFINE(HAVE_TIME, 1, [Define if you have time.])
  1076. AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have the 'gmtime_r' function])
  1077. AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have the 'localtime_r' function.])
  1078. AC_DEFINE(HAVE_USLEEP_DECL, 1, [Define if usleep is declared in <unistd.h>.])
  1079. # This is only for POSIX threads.
  1080. AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
  1081. # Assume we do not have getuid and friends.
  1082. AC_DEFINE(NO_GETUID, 1, [Define if getuid() and friends are missing.])
  1083. PLATFORMNET=NoNet
  1084. else
  1085. AC_CHECK_FUNCS([strerror_r select fstat open fsync sleep opendir \
  1086. localtime_r getpwuid_r getcwd \
  1087. access stat lstat mkdir rename rmdir unlink utime chmod readlink \
  1088. nl_langinfo setlocale \
  1089. inet_pton uname inet_ntoa \
  1090. getrlimit sigaction ftruncate mmap \
  1091. getifaddrs])
  1092. AC_CHECK_FUNCS(inet_aton inet_addr, break)
  1093. AC_CHECK_HEADERS(unistd.h dlfcn.h sys/resource.h)
  1094. # Do an additional check on dld, HP-UX for example has dladdr in libdld.sl
  1095. AC_CHECK_LIB(dl, dladdr, [
  1096. AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])], [
  1097. AC_CHECK_LIB(dld, dladdr, [
  1098. AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])])
  1099. if test x"$cross_compiling" = x"no"; then
  1100. AC_CHECK_FILES(/proc/self/exe, [
  1101. AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])])
  1102. AC_CHECK_FILES(/proc/self/maps, [
  1103. AC_DEFINE(HAVE_PROC_SELF_MAPS, 1,
  1104. [Define if you have /proc/self/maps])])
  1105. else
  1106. case $host in
  1107. *-linux*)
  1108. AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])
  1109. AC_DEFINE(HAVE_PROC_SELF_MAPS, 1, [Define if you have /proc/self/maps])
  1110. ;;
  1111. esac
  1112. fi
  1113. AM_ICONV
  1114. AM_LC_MESSAGES
  1115. AC_STRUCT_TIMEZONE
  1116. LDLIBICONV=`echo " $LIBICONV " | sed "s/${acl_cv_wl--Wl,}/ /g; s/,/ /g"`
  1117. AC_SUBST([LDLIBICONV])
  1118. AC_CHECK_FUNCS(gethostbyname_r, [
  1119. AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
  1120. [Define if you have the 'gethostbyname_r' function.])
  1121. # There are two different kinds of gethostbyname_r.
  1122. # We look for the one that returns `int'.
  1123. # Hopefully this check is robust enough.
  1124. AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
  1125. AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT, 1, [Define if gethostbyname_r returns 'int'.])])
  1126. case " $GCINCS " in
  1127. *" -D_REENTRANT "*) ;;
  1128. *)
  1129. dnl On DU4.0, gethostbyname_r is only declared with -D_REENTRANT
  1130. AC_CACHE_CHECK([whether gethostbyname_r declaration requires -D_REENTRANT],
  1131. [libjava_cv_gethostbyname_r_needs_reentrant],
  1132. [ AC_LANG_PUSH(C++)
  1133. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]],
  1134. [[gethostbyname_r("", 0, 0);]])],
  1135. [libjava_cv_gethostbyname_r_needs_reentrant=no], [dnl
  1136. CPPFLAGS_SAVE="$CPPFLAGS"
  1137. CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  1138. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[gethostbyname_r("", 0, 0);]])],
  1139. [libjava_cv_gethostbyname_r_needs_reentrant=yes],
  1140. [libjava_cv_gethostbyname_r_needs_reentrant=fail])
  1141. CPPFLAGS="$CPPFLAGS_SAVE"
  1142. ])
  1143. AC_LANG_POP(C++)
  1144. ])
  1145. if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
  1146. AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
  1147. fi
  1148. ;;
  1149. esac
  1150. AC_CACHE_CHECK([for struct hostent_data],
  1151. [libjava_cv_struct_hostent_data], [dnl
  1152. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1153. #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
  1154. # define _REENTRANT 1
  1155. #endif
  1156. #include <netdb.h>]], [[struct hostent_data data;]])],
  1157. [libjava_cv_struct_hostent_data=yes],
  1158. [libjava_cv_struct_hostent_data=no])])
  1159. if test "x$libjava_cv_struct_hostent_data" = xyes; then
  1160. AC_DEFINE(HAVE_STRUCT_HOSTENT_DATA, 1,
  1161. [Define if struct hostent_data is defined in netdb.h])
  1162. fi
  1163. ])
  1164. # FIXME: libjava source code expects to find a prototype for
  1165. # gethostbyaddr_r in netdb.h. The outer check ensures that
  1166. # HAVE_GETHOSTBYADDR_R will not be defined if the prototype fails
  1167. # to exist where expected. (The root issue: AC_CHECK_FUNCS assumes C
  1168. # linkage check is enough, yet C++ code requires proper prototypes.)
  1169. AC_EGREP_HEADER(gethostbyaddr_r, netdb.h, [
  1170. AC_CHECK_FUNCS(gethostbyaddr_r, [
  1171. AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
  1172. [Define if you have the 'gethostbyaddr_r' function.])
  1173. # There are two different kinds of gethostbyaddr_r.
  1174. # We look for the one that returns `int'.
  1175. # Hopefully this check is robust enough.
  1176. AC_EGREP_HEADER(int.*gethostbyaddr_r, netdb.h, [
  1177. AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT, 1,
  1178. [Define if gethostbyaddr_r returns 'int'.])])])])
  1179. AC_CHECK_FUNCS(gethostname, [
  1180. AC_DEFINE(HAVE_GETHOSTNAME, 1,
  1181. [Define if you have the 'gethostname' function.])
  1182. AC_EGREP_HEADER(gethostname, unistd.h, [
  1183. AC_DEFINE(HAVE_GETHOSTNAME_DECL, 1,
  1184. [Define if gethostname is declared in <unistd.h>.])])])
  1185. AC_CHECK_FUNCS(usleep, [
  1186. AC_EGREP_HEADER(usleep, unistd.h, [
  1187. AC_DEFINE(HAVE_USLEEP_DECL, 1,
  1188. [Define if usleep is declared in <unistd.h>.])])])
  1189. # Look for these functions in the thread library, but only bother
  1190. # if using POSIX threads.
  1191. if test "$THREADS" = posix; then
  1192. save_LIBS="$LIBS"
  1193. LIBS="$LIBS $THREADLIBS"
  1194. # Look for sched_yield. Up to Solaris 2.6, it is in libposix4, since
  1195. # Solaris 7 the name librt is preferred.
  1196. AC_CHECK_FUNCS(sched_yield, , [
  1197. AC_CHECK_LIB(rt, sched_yield, [
  1198. AC_DEFINE(HAVE_SCHED_YIELD)
  1199. THREADLIBS="$THREADLIBS -lrt"
  1200. THREADSPEC="$THREADSPEC -lrt"], [
  1201. AC_CHECK_LIB(posix4, sched_yield, [
  1202. AC_DEFINE(HAVE_SCHED_YIELD)
  1203. THREADLIBS="$THREADLIBS -lposix4"
  1204. THREADSPEC="$THREADSPEC -lposix4"])])])
  1205. AC_CHECK_LIB(rt, clock_gettime, [
  1206. AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])
  1207. case "$THREADSPEC" in
  1208. *-lrt*) ;;
  1209. *)
  1210. THREADSPEC="$THREADSPEC -lrt"
  1211. THREADLIBS="$THREADLIBS -lrt"
  1212. ;;
  1213. esac])
  1214. LIBS="$save_LIBS"
  1215. # We can save a little space at runtime if the mutex has m_count
  1216. # or __m_count. This is a nice hack for Linux.
  1217. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[
  1218. extern pthread_mutex_t *mutex; int q = mutex->m_count;
  1219. ]])], AC_DEFINE(PTHREAD_MUTEX_HAVE_M_COUNT, 1,
  1220. [Define if pthread_mutex_t has m_count member.]), [
  1221. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[
  1222. extern pthread_mutex_t *mutex; int q = mutex->__m_count;
  1223. ]])], AC_DEFINE(PTHREAD_MUTEX_HAVE___M_COUNT, 1,
  1224. [Define if pthread_mutex_t has __m_count member.]))])
  1225. fi
  1226. # We require a way to get the time.
  1227. time_found=no
  1228. AC_CHECK_FUNCS(gettimeofday time ftime, time_found=yes)
  1229. if test "$time_found" = no; then
  1230. AC_MSG_ERROR([no function found to get the time])
  1231. fi
  1232. AC_CHECK_FUNCS(memmove)
  1233. # We require memcpy.
  1234. memcpy_found=no
  1235. AC_CHECK_FUNCS(memcpy, memcpy_found=yes)
  1236. if test "$memcpy_found" = no; then
  1237. AC_MSG_ERROR([memcpy is required])
  1238. fi
  1239. # Do an additional check on dld, HP-UX for example has dlopen in libdld.sl
  1240. AC_CHECK_LIB(dl, dlopen, [
  1241. AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])], [
  1242. AC_CHECK_LIB(dld, dlopen, [
  1243. AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])])])
  1244. # Some library-finding code we stole from Tcl.
  1245. #--------------------------------------------------------------------
  1246. # Check for the existence of the -lsocket and -lnsl libraries.
  1247. # The order here is important, so that they end up in the right
  1248. # order in the command line generated by make. Here are some
  1249. # special considerations:
  1250. # 1. Use "connect" and "accept" to check for -lsocket, and
  1251. # "gethostbyname" to check for -lnsl.
  1252. # 2. Use each function name only once: can't redo a check because
  1253. # autoconf caches the results of the last check and won't redo it.
  1254. # 3. Use -lnsl and -lsocket only if they supply procedures that
  1255. # aren't already present in the normal libraries. This is because
  1256. # IRIX 5.2 has libraries, but they aren't needed and they're
  1257. # bogus: they goof up name resolution if used.
  1258. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  1259. # To get around this problem, check for both libraries together
  1260. # if -lsocket doesn't work by itself.
  1261. #--------------------------------------------------------------------
  1262. AC_CACHE_CHECK([for socket libraries], gcj_cv_lib_sockets,
  1263. [gcj_cv_lib_sockets=
  1264. gcj_checkBoth=0
  1265. unset ac_cv_func_connect
  1266. AC_CHECK_FUNC(connect, gcj_checkSocket=0, gcj_checkSocket=1)
  1267. if test "$gcj_checkSocket" = 1; then
  1268. unset ac_cv_func_connect
  1269. AC_CHECK_LIB(socket, main, gcj_cv_lib_sockets="-lsocket",
  1270. gcj_checkBoth=1)
  1271. fi
  1272. if test "$gcj_checkBoth" = 1; then
  1273. gcj_oldLibs=$LIBS
  1274. LIBS="$LIBS -lsocket -lnsl"
  1275. unset ac_cv_func_accept
  1276. AC_CHECK_FUNC(accept,
  1277. [gcj_checkNsl=0
  1278. gcj_cv_lib_sockets="-lsocket -lnsl"])
  1279. unset ac_cv_func_accept
  1280. LIBS=$gcj_oldLibs
  1281. fi
  1282. unset ac_cv_func_gethostbyname
  1283. gcj_oldLibs=$LIBS
  1284. LIBS="$LIBS $gcj_cv_lib_sockets"
  1285. AC_CHECK_FUNC(gethostbyname, ,
  1286. [AC_CHECK_LIB(nsl, main,
  1287. [gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"])])
  1288. unset ac_cv_func_gethostbyname
  1289. LIBS=$gcj_oldLIBS
  1290. ])
  1291. SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets"
  1292. if test "$with_system_zlib" = yes; then
  1293. AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=)
  1294. fi
  1295. # Test for Gtk stuff, if asked for.
  1296. if test "$use_gtk_awt" = yes; then
  1297. PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4)
  1298. AC_SUBST(GTK_CFLAGS)
  1299. AC_SUBST(GTK_LIBS)
  1300. PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4 gthread-2.0 >= 2.4)
  1301. AC_SUBST(GLIB_CFLAGS)
  1302. AC_SUBST(GLIB_LIBS)
  1303. PKG_CHECK_MODULES(LIBART, libart-2.0 >= 2.1)
  1304. AC_SUBST(LIBART_CFLAGS)
  1305. AC_SUBST(LIBART_LIBS)
  1306. # We require the XTest Extension to support java.awt.Robot.
  1307. AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
  1308. [AC_MSG_ERROR([libXtst not found, required by java.awt.Robot])],
  1309. [${X_LIBS}])
  1310. fi
  1311. # On Solaris, and maybe other architectures, the Boehm collector
  1312. # requires -ldl.
  1313. if test "$GC" = boehm; then
  1314. case "${host}" in
  1315. *-*-darwin*)
  1316. ;;
  1317. *)
  1318. AC_CHECK_LIB(dl, main, SYSTEMSPEC="$SYSTEMSPEC -ldl")
  1319. ;;
  1320. esac
  1321. fi
  1322. fi
  1323. # Use a semicolon as CLASSPATH separator for MinGW, otherwise a colon.
  1324. case $build in
  1325. *-mingw32) CLASSPATH_SEPARATOR=';' ;;
  1326. *) CLASSPATH_SEPARATOR=':' ;;
  1327. esac
  1328. AC_SUBST(CLASSPATH_SEPARATOR)
  1329. # We must search the source tree for java.lang, since we still don't
  1330. # have libgcj.jar nor java/lang/*.class
  1331. GCJ_SAVE_CPPFLAGS=$CPPFLAGS
  1332. CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
  1333. # Since some classes depend on this one, we need its source available
  1334. # before we can do any GCJ compilation test :-(
  1335. if test ! -f gnu/classpath/Configuration.java; then
  1336. test -d gnu || mkdir gnu
  1337. test -d gnu/classpath || mkdir gnu/classpath
  1338. # Note that it is not crucial that all the values here be correct.
  1339. sed -e "s,@prefix@,$expanded_prefix," \
  1340. -e "s,@VERSION@,$VERSION," \
  1341. -e "s,@LIBDEBUG@,false," \
  1342. -e "s,@INIT_LOAD_LIBRARY@,false," \
  1343. -e "s,@@,$LIBGCJDEBUG," \
  1344. -e "s,@default_toolkit@,$TOOLKIT," \
  1345. -e "s,@JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@,false," \
  1346. -e "s,@GTK_CAIRO_ENABLED@,false," \
  1347. -e "s,@ECJ_JAR@,," \
  1348. -e "s,@WANT_NATIVE_BIG_INTEGER@,false," \
  1349. < $srcdir/classpath/gnu/classpath/Configuration.java.in \
  1350. > gnu/classpath/Configuration.java
  1351. # We do not want to redirect the output of the grep below to /dev/null,
  1352. # but we add /dev/null to the input list so that grep will print the
  1353. # filename of Configuration.java in case it finds any matches.
  1354. if grep '@.*@' gnu/classpath/Configuration.java /dev/null; then
  1355. AC_MSG_ERROR([configure.ac is missing the substitutions above])
  1356. fi
  1357. fi
  1358. LT_AC_PROG_GCJ
  1359. # Now remove it.
  1360. rm -f gnu/classpath/Configuration.java
  1361. CPPFLAGS=$GCJ_SAVE_CPPFLAGS
  1362. AC_CHECK_SIZEOF(void *)
  1363. AC_C_BIGENDIAN
  1364. ZLIBS=
  1365. SYS_ZLIBS=
  1366. ZINCS=
  1367. if test -z "$ZLIBSPEC"; then
  1368. # Use zlib from the GCC tree.
  1369. ZINCS='-I$(top_srcdir)/../zlib'
  1370. ZLIBS=../zlib/libzgcj_convenience.la
  1371. else
  1372. # System's zlib.
  1373. SYS_ZLIBS="$ZLIBSPEC"
  1374. fi
  1375. AC_SUBST(ZLIBS)
  1376. AC_SUBST(SYS_ZLIBS)
  1377. AC_SUBST(ZINCS)
  1378. AC_SUBST(DIVIDESPEC)
  1379. AC_SUBST(CHECKREFSPEC)
  1380. AC_SUBST(EXCEPTIONSPEC)
  1381. AC_SUBST(BACKTRACESPEC)
  1382. AC_SUBST(IEEESPEC)
  1383. AC_SUBST(ATOMICSPEC)
  1384. AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes)
  1385. AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = yes)
  1386. AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
  1387. AM_CONDITIONAL(INSTALL_BINARIES, test -z "${with_multisubdir}")
  1388. AC_SUBST(LIBGCC_UNWIND_INCLUDE)
  1389. # Process the option "--enable-version-specific-runtime-libs"
  1390. # Calculate toolexeclibdir
  1391. case ${version_specific_libs} in
  1392. yes)
  1393. # Need the gcc compiler version to know where to install libraries
  1394. # and header files if --enable-version-specific-runtime-libs option
  1395. # is selected.
  1396. includedir='$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include/'
  1397. toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
  1398. toolexecmainlibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
  1399. toolexeclibdir=$toolexecmainlibdir
  1400. ;;
  1401. no)
  1402. if test -n "$with_cross_host" &&
  1403. test x"$with_cross_host" != x"no"; then
  1404. # Install a library built with a cross compiler in tooldir, not libdir.
  1405. toolexecdir='$(exec_prefix)/$(target_noncanonical)'
  1406. toolexecmainlibdir='$(toolexecdir)/lib'
  1407. else
  1408. toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
  1409. toolexecmainlibdir='$(libdir)'
  1410. fi
  1411. multi_os_directory=`$CC -print-multi-os-directory`
  1412. case $multi_os_directory in
  1413. .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /.
  1414. *) toolexeclibdir=$toolexecmainlibdir/$multi_os_directory ;;
  1415. esac
  1416. ;;
  1417. esac
  1418. AC_SUBST(toolexecdir)
  1419. AC_SUBST(toolexecmainlibdir)
  1420. AC_SUBST(toolexeclibdir)
  1421. # Determine gcj and libgcj version number.
  1422. gcjversion=`cat "$srcdir/../gcc/BASE-VER"`
  1423. libgcj_soversion=`awk -F: '/^[[^#]].*:/ { print $1 }' $srcdir/libtool-version`
  1424. GCJVERSION=$gcjversion
  1425. AC_SUBST(GCJVERSION)
  1426. AC_DEFINE_UNQUOTED(GCJVERSION, "$GCJVERSION", [Short GCJ version ID])
  1427. # Determine where the standard .db file and GNU Classpath JNI
  1428. # libraries are found.
  1429. gcjsubdir=gcj-$gcjversion-$libgcj_soversion
  1430. dbexecdir='$(toolexeclibdir)/'$gcjsubdir
  1431. AC_SUBST(dbexecdir)
  1432. AC_SUBST(gcjsubdir)
  1433. AC_DEFINE(JV_VERSION, "1.5.0", [Compatibility version string])
  1434. AC_DEFINE(JV_API_VERSION, "1.5", [API compatibility version string])
  1435. TL_AC_GXX_INCLUDE_DIR
  1436. # We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
  1437. # On that system, sys/ioctl.h will not include sys/filio.h unless
  1438. # BSD_COMP is defined; just including sys/filio.h is simpler.
  1439. # We avoid AC_HEADER_DIRENT since we really only care about dirent.h
  1440. # for now. If you change this, you also must update natFile.cc.
  1441. AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h fcntl.h \
  1442. sys/ioctl.h sys/filio.h sys/stat.h sys/select.h \
  1443. sys/socket.h netinet/in.h arpa/inet.h netdb.h \
  1444. pwd.h sys/config.h stdint.h langinfo.h locale.h \
  1445. dirent.h sys/rw_lock.h magic.h ifaddrs.h])
  1446. # sys/socket.h is a prerequisite for net/if.h on Solaris.
  1447. AC_CHECK_HEADERS(net/if.h, [], [], [
  1448. #ifdef HAVE_SYS_SOCKET_H
  1449. #include <sys/socket.h>
  1450. #endif
  1451. ])
  1452. AC_CHECK_HEADERS(inttypes.h, [
  1453. AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
  1454. AC_DEFINE(JV_HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
  1455. ])
  1456. AC_CHECK_TYPE([ssize_t], [int])
  1457. AC_CHECK_TYPE([magic_t], [
  1458. AC_DEFINE(HAVE_MAGIC_T, 1, [Define if magic.h declares magic_t])], [], [
  1459. #ifdef HAVE_MAGIC_H
  1460. #include <magic.h>
  1461. #endif])
  1462. AC_MSG_CHECKING([for in_addr_t])
  1463. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  1464. #if STDC_HEADERS
  1465. #include <stdlib.h>
  1466. #include <stddef.h>
  1467. #endif
  1468. #if HAVE_NETINET_IN_H
  1469. #include <netinet/in.h>
  1470. #endif]], [[in_addr_t foo;]])],
  1471. [AC_DEFINE(HAVE_IN_ADDR_T, 1,
  1472. [Define to 1 if 'in_addr_t' is defined in sys/types.h or netinet/in.h.])
  1473. AC_MSG_RESULT(yes)],
  1474. [AC_MSG_RESULT(no)])
  1475. AC_MSG_CHECKING([whether struct ip_mreq is in netinet/in.h])
  1476. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct ip_mreq mreq;]])],
  1477. [AC_DEFINE(HAVE_STRUCT_IP_MREQ, 1,
  1478. [Define if struct ip_mreq is defined in netinet/in.h.])
  1479. AC_MSG_RESULT(yes)],
  1480. [AC_MSG_RESULT(no)])
  1481. AC_MSG_CHECKING([whether struct ipv6_mreq is in netinet/in.h])
  1482. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct ipv6_mreq mreq6;]])],
  1483. [AC_DEFINE(HAVE_STRUCT_IPV6_MREQ, 1,
  1484. [Define if struct ipv6_mreq is defined in netinet/in.h.])
  1485. AC_MSG_RESULT(yes)],
  1486. [AC_MSG_RESULT(no)])
  1487. AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
  1488. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct sockaddr_in6 addr6;]])],
  1489. [AC_DEFINE(HAVE_INET6, 1,
  1490. [Define if inet6 structures are defined in netinet/in.h.])
  1491. AC_MSG_RESULT(yes)],
  1492. [AC_MSG_RESULT(no)])
  1493. AC_MSG_CHECKING([for socklen_t in sys/socket.h])
  1494. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_PII_SOCKET
  1495. #include <sys/types.h>
  1496. #include <sys/socket.h>]], [[socklen_t x = 5;]])],
  1497. [AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define it socklen_t typedef is in sys/socket.h.])
  1498. AC_MSG_RESULT(yes)],
  1499. [AC_MSG_RESULT(no)])
  1500. AC_MSG_CHECKING([for tm_gmtoff in struct tm])
  1501. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[struct tm tim; tim.tm_gmtoff = 0;]])],
  1502. [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
  1503. AC_MSG_RESULT(yes)],
  1504. [AC_MSG_RESULT(no)
  1505. AC_MSG_CHECKING([for global timezone variable])
  1506. dnl FIXME: we don't want a link check here because that won't work
  1507. dnl when cross-compiling. So instead we make an assumption that
  1508. dnl the header file will mention timezone if it exists.
  1509. dnl Don't find the win32 function timezone
  1510. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
  1511. [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
  1512. AC_MSG_RESULT(yes)],
  1513. [AC_MSG_RESULT(no)
  1514. AC_MSG_CHECKING([for global _timezone variable])
  1515. dnl FIXME: As above, don't want link check
  1516. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
  1517. [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
  1518. [Define if your platform has the global _timezone variable.])
  1519. AC_MSG_RESULT(yes)],
  1520. [AC_MSG_RESULT(no)])])])
  1521. AC_CHECK_PROGS(PERL, perl, false)
  1522. SYSDEP_SOURCES=
  1523. SIGNAL_HANDLER_AUX=
  1524. case "${host}" in
  1525. *-*-solaris2*)
  1526. SIGNAL_HANDLER=include/posix-signal.h
  1527. ;;
  1528. i?86-*-linux*)
  1529. SIGNAL_HANDLER=include/i386-signal.h
  1530. SIGNAL_HANDLER_AUX=include/x86_64-signal.h
  1531. ;;
  1532. # ia64-*)
  1533. # SYSDEP_SOURCES=sysdep/ia64.c
  1534. # test -d sysdep || mkdir sysdep
  1535. # ;;
  1536. hppa*-*-linux*)
  1537. SIGNAL_HANDLER=include/pa-signal.h
  1538. ;;
  1539. hppa*-hp-hpux*)
  1540. SIGNAL_HANDLER=include/hppa-signal.h
  1541. ;;
  1542. ia64-*-linux*)
  1543. SIGNAL_HANDLER=include/dwarf2-signal.h
  1544. ;;
  1545. powerpc*-*-linux*)
  1546. SIGNAL_HANDLER=include/powerpc-signal.h
  1547. ;;
  1548. alpha*-*-linux*)
  1549. SIGNAL_HANDLER=include/dwarf2-signal.h
  1550. ;;
  1551. s390*-*-linux*)
  1552. SIGNAL_HANDLER=include/s390-signal.h
  1553. ;;
  1554. x86_64*-*-linux*)
  1555. SIGNAL_HANDLER=include/x86_64-signal.h
  1556. SIGNAL_HANDLER_AUX=include/i386-signal.h
  1557. ;;
  1558. sparc*-*-linux*)
  1559. SIGNAL_HANDLER=include/dwarf2-signal.h
  1560. ;;
  1561. sh*-*-linux*)
  1562. SIGNAL_HANDLER=include/sh-signal.h
  1563. ;;
  1564. *mingw*)
  1565. SIGNAL_HANDLER=include/win32-signal.h
  1566. ;;
  1567. mips*-*-linux*)
  1568. SIGNAL_HANDLER=include/mips-signal.h
  1569. ;;
  1570. m68*-*-linux*)
  1571. SIGNAL_HANDLER=include/dwarf2-signal.h
  1572. ;;
  1573. powerpc*-*-darwin* | i?86-*-darwin[[912]]* | x86_64-*-darwin[[912]]*)
  1574. SIGNAL_HANDLER=include/darwin-signal.h
  1575. ;;
  1576. powerpc*-*-aix*)
  1577. SIGNAL_HANDLER=include/aix-signal.h
  1578. ;;
  1579. i?86-*-freebsd* | x86_64-*-freebsd*)
  1580. SIGNAL_HANDLER=include/freebsd-signal.h
  1581. ;;
  1582. *)
  1583. SIGNAL_HANDLER=include/default-signal.h
  1584. ;;
  1585. esac
  1586. # If we're using sjlj exceptions, forget what we just learned.
  1587. if test "$enable_sjlj_exceptions" = yes; then
  1588. SIGNAL_HANDLER=include/default-signal.h
  1589. SIGNAL_HANDLER_AUX=
  1590. fi
  1591. AC_SUBST(SYSDEP_SOURCES)
  1592. if test -z "$SIGNAL_HANDLER_AUX"; then
  1593. SIGNAL_HANDLER_AUX=$SIGNAL_HANDLER
  1594. fi
  1595. AC_CONFIG_LINKS(include/java-signal.h:$SIGNAL_HANDLER
  1596. include/java-signal-aux.h:$SIGNAL_HANDLER_AUX)
  1597. if test "${multilib}" = "yes"; then
  1598. multilib_arg="--enable-multilib"
  1599. else
  1600. multilib_arg=
  1601. fi
  1602. # See if we support thread-local storage.
  1603. GCC_CHECK_TLS
  1604. # For _Unwind_GetIPInfo.
  1605. GCC_CHECK_UNWIND_GETIPINFO
  1606. # See if linker supports anonymous version scripts.
  1607. AC_CACHE_CHECK([whether ld supports anonymous version scripts],
  1608. [libjava_cv_anon_version_script],
  1609. [AC_ARG_ENABLE(symvers,
  1610. AS_HELP_STRING([--disable-symvers],
  1611. [disable symbol versioning for libjava]),
  1612. [case "$enableval" in
  1613. yes|gnu*) libjava_cv_anon_version_script=yes ;;
  1614. no) libjava_cv_anon_version_script=no ;;
  1615. *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]);;
  1616. esac],
  1617. [libjava_cv_anon_version_script=yes]
  1618. )
  1619. if test x$libjava_cv_anon_version_script = xyes; then
  1620. save_CFLAGS="$CFLAGS"; save_LDFLAGS="$LDFLAGS"
  1621. CFLAGS="$CFLAGS -fPIC";
  1622. LDFLAGS="$LDFLAGS -shared -Wl,--version-script,conftest.map"
  1623. echo '{ global: globalsymb*; local: *; };' > conftest.map
  1624. AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},,
  1625. [libjava_cv_anon_version_script=gnu],
  1626. [libjava_cv_anon_version_script=no])
  1627. if test x$libjava_cv_anon_version_script = xno; then
  1628. case "$target_os" in
  1629. solaris2*)
  1630. LDFLAGS="$save_LDFLAGS"
  1631. LDFLAGS="$LDFLAGS -shared -Wl,-M,conftest.map"
  1632. # Sun ld doesn't understand wildcards here.
  1633. echo '{ global: globalsymbol; local: *; };' > conftest.map
  1634. AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},,
  1635. [libjava_cv_anon_version_script=sun], [])
  1636. ;;
  1637. esac
  1638. fi
  1639. CFLAGS="$save_CFLAGS"; LDFLAGS="$save_LDFLAGS"
  1640. fi
  1641. ])
  1642. AM_CONDITIONAL(ANONVERSCRIPT, test "$libjava_cv_anon_version_script" != no)
  1643. AM_CONDITIONAL(ANONVERSCRIPT_GNU, test "$libjava_cv_anon_version_script" = gnu)
  1644. AM_CONDITIONAL(ANONVERSCRIPT_SUN, test "$libjava_cv_anon_version_script" = sun)
  1645. # Check if linker supports static linking on a per library basis
  1646. LD_START_STATIC_SPEC=
  1647. LD_FINISH_STATIC_SPEC=
  1648. if $LD --help 2>&1 | grep -- -call_shared >/dev/null 2>&1; then
  1649. if $LD --help 2>&1 | grep -- -non_shared >/dev/null 2>&1; then
  1650. LD_START_STATIC_SPEC='%{static-libgcj:-non_shared}'
  1651. LD_FINISH_STATIC_SPEC='%{static-libgcj:-call_shared}'
  1652. fi
  1653. fi
  1654. AC_SUBST(LD_START_STATIC_SPEC)
  1655. AC_SUBST(LD_FINISH_STATIC_SPEC)
  1656. here=`${PWDCMD-pwd}`
  1657. AC_SUBST(here)
  1658. # We get this from the environment.
  1659. AC_SUBST(GCJFLAGS)
  1660. default_python_dir="/share/gcc-`cat ${srcdir}/../gcc/BASE-VER`/python/libjava"
  1661. AC_ARG_WITH([python-dir],
  1662. AS_HELP_STRING([--with-python-dir],
  1663. [the location to install Python modules. This path should NOT include the prefix.]),
  1664. [with_python_dir=$withval], [with_python_dir="${default_python_dir}"])
  1665. # Needed for installing Python modules during make install.
  1666. python_mod_dir="\${prefix}${with_python_dir}"
  1667. # Needed for substituting into aot-compile*
  1668. python_mod_dir_expanded="${expanded_prefix}${with_python_dir}"
  1669. AC_MSG_RESULT(Python modules dir: ${python_mod_dir_expanded});
  1670. AC_SUBST(python_mod_dir)
  1671. AC_SUBST(python_mod_dir_expanded)
  1672. # needed for aot-compile-rpm
  1673. MAKE=`which make`
  1674. AC_SUBST(MAKE)
  1675. AC_ARG_ENABLE([aot-compile-rpm],
  1676. [AS_HELP_STRING([--enable-aot-compile-rpm],
  1677. [enable installation of aot-compile-rpm [default=no]])],
  1678. [case "${enableval}" in
  1679. yes) AOT_RPM_ENABLED=yes ;;
  1680. no) AOT_RPM_ENABLED=no ;;
  1681. *) AC_MSG_ERROR([Unknown argument to enable/disable aot-compile-rpm]) ;;
  1682. esac],
  1683. [AOT_RPM_ENABLED=no]
  1684. )
  1685. AM_CONDITIONAL(INSTALL_AOT_RPM, test "x${AOT_RPM_ENABLED}" = xyes)
  1686. AC_ARG_ENABLE([java-home],
  1687. [AS_HELP_STRING([--enable-java-home],
  1688. [create a standard JDK-style directory layout in the install tree [default=no]])],
  1689. [case "${enableval}" in
  1690. yes) JAVA_HOME_ENABLED=yes ;;
  1691. no) JAVA_HOME_ENABLED=no ;;
  1692. *) AC_MSG_ERROR([Unknown argument to enable/disable java-home]) ;;
  1693. esac],
  1694. [JAVA_HOME_ENABLED=no]
  1695. )
  1696. AM_CONDITIONAL(CREATE_JAVA_HOME, test "x${JAVA_HOME_ENABLED}" = xyes)
  1697. # Only do these checks if java-home above is enabled.
  1698. if test "x${JAVA_HOME_ENABLED}" = xyes
  1699. then
  1700. AC_ARG_WITH([gcc-suffix],
  1701. AS_HELP_STRING([--with-gcc-suffix],
  1702. [the GCC tool suffix (defaults to empty string)]),
  1703. [gcc_suffix=$withval], [gcc_suffix=""])
  1704. AC_MSG_RESULT(GCC suffix: ${gcc_suffix})
  1705. AC_SUBST(gcc_suffix)
  1706. AC_ARG_WITH([arch-directory],
  1707. AS_HELP_STRING([--with-arch-directory],
  1708. [the arch directory under jre/lib (defaults to auto-detect)]),
  1709. [host_cpu=$withval], [host_cpu=""])
  1710. AC_ARG_WITH([os-directory],
  1711. AS_HELP_STRING([--with-os-directory],
  1712. [the os directory under include (defaults to auto-detect)]),
  1713. [host_os=$withval], [host_os=""])
  1714. AC_ARG_WITH([origin-name],
  1715. AS_HELP_STRING([--with-origin-name],
  1716. [the JPackage origin name of this package (default is gcj${gcc_suffix}]),
  1717. [origin_name=$withval], [origin_name=gcj${gcc_suffix}])
  1718. AC_MSG_RESULT(JPackage origin name: ${origin_name})
  1719. AC_ARG_WITH([arch-suffix],
  1720. AS_HELP_STRING([--with-arch-suffix],
  1721. [the arch directory suffix (default is the empty string]),
  1722. [arch_suffix=$withval], [arch_suffix=""])
  1723. AC_MSG_RESULT(arch suffix: ${arch_suffix})
  1724. AC_ARG_WITH([jvm-root-dir],
  1725. AS_HELP_STRING([--with-jvm-root-dir],
  1726. [where to install SDK (default is ${prefix}/lib/jvm)]),
  1727. [jvm_root_dir=$withval], [jvm_root_dir="\${prefix}/lib/jvm"])
  1728. AC_MSG_RESULT(JVM root installation directory: ${jvm_root_dir})
  1729. AC_ARG_WITH([jvm-jar-dir],
  1730. AS_HELP_STRING([--with-jvm-jar-dir],
  1731. [where to install jars (default is ${prefix}/lib/jvm-exports)]),
  1732. [jvm_jar_dir=$withval], [jvm_jar_dir=\${prefix}/lib/jvm-exports])
  1733. AC_MSG_RESULT(JAR root installation directory: ${jvm_jar_dir})
  1734. JAVA_VERSION=1.5.0
  1735. BUILD_VERSION=0
  1736. AC_SUBST(JAVA_VERSION)
  1737. AC_SUBST(BUILD_VERSION)
  1738. AC_MSG_RESULT(Java version: ${JAVA_VERSION})
  1739. jre_dir=jre
  1740. jre_lnk=jre-${JAVA_VERSION}-${origin_name}
  1741. sdk_lnk=java-${JAVA_VERSION}-${origin_name}
  1742. JVM_ROOT_DIR=${jvm_root_dir}
  1743. AC_SUBST(JVM_ROOT_DIR)
  1744. AC_MSG_RESULT(JVM ROOT directory: ${JVM_ROOT_DIR})
  1745. JVM_JAR_ROOT_DIR=${jvm_jar_dir}
  1746. AC_SUBST(JVM_JAR_ROOT_DIR)
  1747. AC_MSG_RESULT(JVM JAR ROOT directory: ${JVM_JAR_ROOT_DIR})
  1748. JVM_JAR_DIR=${jvm_jar_dir}
  1749. AC_SUBST(JVM_JAR_DIR)
  1750. AC_MSG_RESULT(JVM JAR directory: ${JVM_JAR_DIR})
  1751. JRE_DIR=${jre_dir}
  1752. AC_SUBST(JRE_DIR)
  1753. JRE_LNK=${jre_lnk}
  1754. AC_SUBST(JRE_LNK)
  1755. SDK_LNK=${sdk_lnk}
  1756. AC_SUBST(SDK_LNK)
  1757. SDK_BIN_DIR=${jvm_root_dir}/bin
  1758. AC_SUBST(SDK_BIN_DIR)
  1759. AC_MSG_RESULT(SDK tools directory: ${SDK_BIN_DIR})
  1760. SDK_LIB_DIR=${jvm_root_dir}/lib
  1761. AC_SUBST(SDK_LIB_DIR)
  1762. AC_MSG_RESULT(SDK jar directory: ${SDK_LIB_DIR})
  1763. SDK_INCLUDE_DIR=${jvm_root_dir}/include
  1764. AC_SUBST(SDK_INCLUDE_DIR)
  1765. AC_MSG_RESULT(SDK include directory: ${SDK_INCLUDE_DIR})
  1766. JRE_BIN_DIR=${jvm_root_dir}/${jre_dir}/bin
  1767. AC_SUBST(JRE_BIN_DIR)
  1768. AC_MSG_RESULT(JRE tools directory: ${JRE_BIN_DIR})
  1769. JRE_LIB_DIR=${jvm_root_dir}/${jre_dir}/lib
  1770. AC_SUBST(JRE_LIB_DIR)
  1771. AC_MSG_RESULT(JRE lib directory: ${JRE_LIB_DIR})
  1772. # Find gcj prefix using gcj found in PATH.
  1773. gcj_prefix=`which gcj${gcc_suffix} | sed "s%/bin/gcj${gcc_suffix}%%"`
  1774. # Where do the gcj binaries live?
  1775. # For jhbuild based builds, they all live in a sibling of bin called
  1776. # gcj-bin. Check for gcj-bin first, and use bin otherwise.
  1777. GCJ_BIN_DIR=`if test -d ${gcj_prefix}/gcj-bin; then echo ${gcj_prefix}/gcj-bin; else echo ${gcj_prefix}/bin; fi`
  1778. AC_SUBST(GCJ_BIN_DIR)
  1779. AC_MSG_RESULT(GCJ tools directory: ${GCJ_BIN_DIR})
  1780. AC_MSG_RESULT(host is ${host})
  1781. if test "x${host_cpu}" = "x"
  1782. then
  1783. case ${host} in
  1784. *-mingw* | *-cygwin*)
  1785. host_cpu=x86;;
  1786. i486-* | i586-* | i686-*)
  1787. host_cpu=i386;;
  1788. x86_64-*)
  1789. host_cpu=amd64;;
  1790. *)
  1791. host_cpu=${host_cpu};;
  1792. esac
  1793. fi
  1794. AC_MSG_RESULT(arch directory: ${host_cpu})
  1795. CPU=${host_cpu}
  1796. AC_SUBST(CPU)
  1797. if test "x${host_os}" = "x"
  1798. then
  1799. case ${host} in
  1800. *-mingw* | *-cygwin*)
  1801. host_os=win32;;
  1802. *-linux*)
  1803. host_os=linux;;
  1804. *)
  1805. host_os=${host_os};;
  1806. esac
  1807. fi
  1808. echo os directory: ${host_os}
  1809. OS=${host_os}
  1810. AC_SUBST(OS)
  1811. # make an expanded $libdir, for substituting into
  1812. # scripts (and other non-Makefile things).
  1813. LIBDIR=$libdir
  1814. if test "x${exec_prefix}" = "xNONE"
  1815. then
  1816. lib_exec_prefix=$expanded_prefix
  1817. else
  1818. lib_exec_prefix=$exec_prefix
  1819. fi
  1820. LIBDIR=`echo $libdir | sed "s:\\\${exec_prefix}:$lib_exec_prefix:g"`
  1821. AC_SUBST(LIBDIR)
  1822. fi
  1823. AC_CONFIG_FILES([
  1824. Makefile
  1825. libgcj.pc
  1826. libgcj.spec
  1827. libgcj-test.spec
  1828. gcj/Makefile
  1829. include/Makefile
  1830. testsuite/Makefile
  1831. contrib/aotcompile.py
  1832. contrib/aot-compile
  1833. contrib/aot-compile-rpm
  1834. contrib/generate-cacerts.pl
  1835. contrib/rebuild-gcj-db
  1836. ])
  1837. if test ${multilib} = yes; then
  1838. multilib_arg="--enable-multilib"
  1839. else
  1840. multilib_arg=
  1841. fi
  1842. AC_CONFIG_FILES([scripts/jar], [chmod +x scripts/jar])
  1843. AC_OUTPUT