1 dnl Process this file with autoconf to produce a configure script.
3 dnl -----------------------------------------------------------
4 dnl Turning off cache for debug reasons
5 dnl -----------------------------------------------------------
6 dnl define([AC_CACHE_LOAD], )dnl
7 dnl define([AC_CACHE_SAVE], )dnl
9 AC_INIT([GNU Classpath],[0.18],[classpath@gnu.org],[classpath])
10 AC_CONFIG_SRCDIR(java/lang/System.java)
14 dnl -----------------------------------------------------------
15 dnl Fold all IA-32 CPU architectures into "x86"
16 dnl -----------------------------------------------------------
17 if expr ${target_cpu} : '.*86' > /dev/null; then target_cpu=x86; fi
19 dnl -----------------------------------------------------------
20 dnl We will not track/change lib version until we reach version 1.0
21 dnl at which time we'll have to be more anal about such things
22 dnl -----------------------------------------------------------
23 AC_SUBST(LIBVERSION, "0:0:0")
33 CLASSPATH_MODULE="${cp_module} -version-info ${LIBVERSION} -no-undefined"
34 AC_SUBST(CLASSPATH_MODULE)
37 AM_INIT_AUTOMAKE([1.9.0 gnu std-options tar-ustar])
38 AC_CONFIG_HEADERS([include/config.h])
39 AC_PREFIX_DEFAULT(/usr/local/classpath)
41 dnl -----------------------------------------------------------
42 dnl Enable JNI libraries (enabled by default)
43 dnl -----------------------------------------------------------
45 [AS_HELP_STRING(--enable-jni,compile JNI source [default=yes])],
46 [case "${enableval}" in
47 yes) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
49 *) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
52 AM_CONDITIONAL(CREATE_JNI_LIBRARIES, test "x${COMPILE_JNI}" = xyes)
54 dnl -----------------------------------------------------------
55 dnl Enable core JNI libraries (enabled by default)
56 dnl -----------------------------------------------------------
57 AC_ARG_ENABLE([core-jni],
58 [AS_HELP_STRING(--enable-core-jni,
59 compile JNI sources for core [default=yes])],
60 [case "${enableval}" in
61 yes) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
62 no) COMPILE_CORE_JNI=no ;;
63 *) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
65 [COMPILE_CORE_JNI=yes])
66 AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes)
68 dnl -----------------------------------------------------------
69 dnl Whether to compile with -Werror or not (enabled by default)
70 dnl -----------------------------------------------------------
71 AC_ARG_ENABLE([Werror],
72 [AS_HELP_STRING(--disable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
73 [case "${enableval}" in
74 yes) ENABLE_WERROR=yes ;;
75 no) ENABLE_WERROR=no ;;
76 *) ENABLE_WERROR=yes ;;
80 dnl -----------------------------------------------------------
81 dnl Default AWT toolkit
82 dnl -----------------------------------------------------------
83 AC_ARG_ENABLE(default-toolkit,
84 AS_HELP_STRING([--enable-default-toolkit],
85 [fully qualified class name of default AWT toolkit]))
86 default_toolkit=$enable_default_toolkit
87 if test "$default_toolkit" = ""; then
88 default_toolkit=gnu.java.awt.peer.gtk.GtkToolkit
90 AC_SUBST(default_toolkit)
92 dnl -----------------------------------------------------------
93 dnl Native libxml/xslt library (disabled by default)
94 dnl -----------------------------------------------------------
96 [AS_HELP_STRING(--enable-xmlj,compile native libxml/xslt library [default=no])],
97 [case "${enableval}" in
98 yes) COMPILE_XMLJ=yes ;;
99 no) COMPILE_XMLJ=no ;;
100 *) COMPILE_XMLJ=no ;;
103 AM_CONDITIONAL(CREATE_XMLJ_LIBRARY, test "x${COMPILE_XMLJ}" = xyes)
105 dnl -----------------------------------------------------------
106 dnl GTK native peer (enabled by default)
107 dnl -----------------------------------------------------------
108 AC_ARG_ENABLE([gtk-peer],
109 [AS_HELP_STRING(--disable-gtk-peer,compile GTK native peers (disabled by --disable-jni) [default=yes])],
110 [case "${enableval}" in
111 yes) COMPILE_GTK_PEER=yes ;;
112 no) COMPILE_GTK_PEER=no ;;
113 *) COMPILE_GTK_PEER=yes ;;
115 [COMPILE_GTK_PEER=yes])
116 AM_CONDITIONAL(CREATE_GTK_PEER_LIBRARIES, test "x${COMPILE_GTK_PEER}" = xyes)
118 dnl -----------------------------------------------------------
119 dnl GTK native peer error checking
120 dnl -----------------------------------------------------------
121 AC_ARG_ENABLE([gtk-peers],,AC_MSG_ERROR([No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer]))
123 dnl ------------------------------------------------------------
124 dnl determine whether to enable the cairo GTK Graphics2D backend
125 dnl ------------------------------------------------------------
126 AC_ARG_ENABLE([gtk-cairo],
127 [AS_HELP_STRING(--enable-gtk-cairo,build the cairo Graphics2D implementation on GTK [default=no])],
128 [case "${enableval}" in
129 yes) GTK_CAIRO_ENABLED=true ;;
130 no) GTK_CAIRO_ENABLED=false ;;
131 *) GTK_CAIRO_ENABLED=true ;;
133 [GTK_CAIRO_ENABLED=false])
134 AC_SUBST(GTK_CAIRO_ENABLED)
135 if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
136 AC_DEFINE(GTK_CAIRO, 1, [defined if cairo support was built in])
138 AM_CONDITIONAL(GTK_CAIRO, test "x${GTK_CAIRO_ENABLED}" = xtrue)
140 dnl -----------------------------------------------------------
141 dnl Qt native peer (disabled by default)
142 dnl -----------------------------------------------------------
143 AC_ARG_ENABLE([qt-peer],
144 [AS_HELP_STRING(--enable-qt-peer,compile Qt4 native peers (disabled by --disable-jni) [default=no])],
145 [case "${enableval}" in
146 yes) COMPILE_QT_PEER=yes ;;
147 no) COMPILE_QT_PEER=no ;;
148 *) COMPILE_QT_PEER=yes ;;
150 [COMPILE_QT_PEER=no])
151 AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)
153 dnl -----------------------------------------------------------
154 dnl Regenerate headers at build time (disabled by default)
155 dnl -----------------------------------------------------------
156 AC_ARG_ENABLE([regen-headers],
157 [AS_HELP_STRING(--enable-regen-headers,automatically regenerate JNI headers [default=no])],
158 [case "${enableval}" in
159 yes) REGENERATE_JNI_HEADERS=yes ;;
160 no) REGENERATE_JNI_HEADERS=no ;;
161 *) REGENERATE_JNI_HEADERS=no ;;
163 [REGENERATE_JNI_HEADERS=no])
164 AM_CONDITIONAL(CREATE_JNI_HEADERS, test "x${REGENERATE_JNI_HEADERS}" = xyes)
169 dnl -----------------------------------------------------------
170 dnl Checks for programs.
171 dnl -----------------------------------------------------------
173 dnl Initialize libtool
180 if test "x${COMPILE_JNI}" = xyes; then
183 dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64,
185 AC_COMPILE_CHECK_SIZEOF(void *)
187 dnl Checking for endianess.
190 dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
191 dnl On that system, sys/ioctl.h will not include sys/filio.h unless
192 dnl BSD_COMP is defined; just including sys/filio.h is simpler.
193 dnl Check for crt_externs.h on Darwin.
194 AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h \
196 inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
203 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
204 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
205 AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
206 AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
208 AC_CHECK_FUNCS([ftruncate fsync select \
209 gethostname socket strerror fork pipe execve open close \
210 lseek fstat read write htonl memset htons connect \
211 getsockname getpeername bind listen accept \
212 recvfrom send sendto setsockopt getsockopt time mktime \
216 mmap munmap mincore msync madvise getpagesize sysconf])
222 AC_MSG_CHECKING([for tm_gmtoff in struct tm])
223 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
224 [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
227 AC_MSG_CHECKING([for global timezone variable])
228 dnl FIXME: we don't want a link check here because that won't work
229 dnl when cross-compiling. So instead we make an assumption that
230 dnl the header file will mention timezone if it exists.
231 dnl Don't find the win32 function timezone
232 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
233 [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
236 AC_MSG_CHECKING([for global _timezone variable])
237 dnl FIXME: As above, don't want link check
238 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
239 [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
240 [Define if your platform has the global _timezone variable.])
242 [AC_MSG_RESULT(no)])])])
246 dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
249 dnl When using gcc we want warnings, lots of warnings :-)
250 if test "x${GCC}" = xyes; then
251 dnl We want ISO C90 pedantic ansi, but with longlong (jlong) support
252 dnl and modern POSIX and BSD C library functions/prototypes.
254 dnl Warning flags for (almost) everybody.
255 dnl Should probably be configurable
256 WARNING_CFLAGS='-pedantic -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long'
257 AC_SUBST(WARNING_CFLAGS)
259 dnl Strict warning flags which not every module uses.
260 dnl Should probably be configurable.
261 STRICT_WARNING_CFLAGS=-Wstrict-prototypes
262 AC_SUBST(STRICT_WARNING_CFLAGS)
264 dnl Whether or not to add -Werror, also not used by all modueles.
265 dnl Can be configured by --disable-Werror
267 if test "x${ENABLE_WERROR}" = xyes; then
268 ERROR_CFLAGS='-Werror'
270 AC_SUBST(ERROR_CFLAGS)
273 dnl Check for libxml and libxslt libraries (when xmlj is enabled).
274 if test "x${COMPILE_XMLJ}" = xyes; then
275 PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.6.8)
276 PKG_CHECK_MODULES(XSLT, libxslt >= 1.1.11)
280 AC_SUBST(XSLT_CFLAGS)
283 dnl Check for AWT related gthread/gtk
284 if test "x${COMPILE_GTK_PEER}" = xyes; then
286 if test "$no_x" = yes; then
287 AC_MSG_ERROR([GTK+ peers requested but no X library available])
289 dnl We explicitly want the XTest Extension for Robot support.
290 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
291 [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
293 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
298 dnl Check for AWT related Qt4
299 if test "x${COMPILE_QT_PEER}" = xyes; then
300 PKG_CHECK_MODULES(QT, QtGui >= 4.0.1)
301 dnl Check needed because in some cases the QtGui includedir
302 dnl doesn't contain the subsystem dir.
303 QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
304 EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
305 AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
306 AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
307 AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
308 QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
309 AC_MSG_WARN([QWidget not found])))
310 AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
311 AC_CHECK_PROG(MOC, [moc], [moc])
316 if test "x${enable_gtk_cairo}" = xyes; then
317 PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
318 PKG_CHECK_MODULES(PANGOFT2, pangoft2)
321 AC_SUBST(CAIRO_CFLAGS)
322 AC_SUBST(PANGOFT2_LIBS)
323 AC_SUBST(PANGOFT2_CFLAGS)
328 dnl -----------------------------------------------------------
329 dnl Add the include files for the native abstraction layer.
330 dnl Used by AM_CPPFLAGS in the different modules.
331 dnl -----------------------------------------------------------
332 CLASSPATH_INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/native/jni/classpath -I\$(top_srcdir)/native/target/Linux -I\$(top_srcdir)/native/target/generic"
333 AC_SUBST(CLASSPATH_INCLUDES)
335 dnl -----------------------------------------------------------
336 if test "x${COMPILE_JNI}" = xyes; then
337 AC_MSG_CHECKING(jni_md.h support)
338 if test -f ${srcdir}/include/jni_md-${target_cpu}-${target_os}.h; then
343 AC_MSG_WARN(no, using x86-linux-gnu)
345 ac_sources="include/jni_md-${target_cpu}-${target_os}.h"
346 ac_dests="include/jni_md.h"
347 while test -n "$ac_sources"; do
348 set $ac_dests; ac_dest=$1; shift; ac_dests=$*
349 set $ac_sources; ac_source=$1; shift; ac_sources=$*
350 ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
352 AC_CONFIG_LINKS([$ac_config_links_1])
357 CLASSPATH_WITH_CLASSLIB
359 dnl -----------------------------------------------------------
360 dnl Initialize maintainer mode
361 dnl -----------------------------------------------------------
364 dnl -----------------------------------------------------------
365 dnl Enable debugging statements at compile time. By default
366 dnl these statements should be optimized out of the bytecode
367 dnl produced by an optimizing Java compiler and not hinder
368 dnl performance because debugging is turned off by default.
369 dnl -----------------------------------------------------------
370 AC_ARG_ENABLE([debug],
371 [AS_HELP_STRING(--enable-debug,enable runtime debugging code)],
372 [case "${enableval}" in
375 AC_DEFINE(DEBUG, 1, [Define to 1 if you want native library runtime debugging code enabled])
377 no) LIBDEBUG="false" ;;
378 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
383 dnl -----------------------------------------------------------
384 dnl Enable execution of all static initializer loadLibrary()
385 dnl calls at compile time. By default most people will not
386 dnl want to disable this, but some VMs (gcj) don't need or want
388 dnl -----------------------------------------------------------
389 AC_ARG_ENABLE([load-library],
390 [AS_HELP_STRING(--enable-load-library,enable to use JNI native methods [default=yes])],
391 [case "${enableval}" in
392 yes) INIT_LOAD_LIBRARY="true" ;;
393 no) INIT_LOAD_LIBRARY="false" ;;
394 *) AC_MSG_ERROR(bad value ${enableval} for --enable-load-library) ;;
396 [INIT_LOAD_LIBRARY="true"])
397 AC_SUBST(INIT_LOAD_LIBRARY)
400 dnl -----------------------------------------------------------
401 dnl Should the VM explicitly run class initialization subfunctions for
402 dnl java.lang.System? (default is false -- the subfunctions will be run
403 dnl automatically by the class initializer)
404 dnl -----------------------------------------------------------
405 AC_ARG_ENABLE([java-lang-system-explicit-initialization],
406 [AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM explicitly invoke java.lang.System's static initialization methods [default=no])],
407 [case "${enableval}" in
408 yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
409 no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
410 *) AC_MSG_ERROR(bad value ${enableval} for --enable-java-lang-system-explicit-initialization) ;;
412 [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
413 AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
416 dnl -----------------------------------------------------------
417 dnl avoiding automake complaints
418 dnl -----------------------------------------------------------
422 dnl -----------------------------------------------------------
423 dnl This is probably useless.
424 dnl -----------------------------------------------------------
425 AC_PATH_PROG(MKDIR, mkdir)
427 AC_PATH_PROG(DATE, date)
429 dnl -----------------------------------------------------------
430 dnl According to the GNU coding guide, we shouldn't require find,
431 dnl and zip, however GNU provides both so it should be okay
432 dnl -----------------------------------------------------------
433 AC_PATH_PROG(FIND, find)
435 dnl -----------------------------------------------------------
436 dnl Specify what to install (install only glibj.zip by default)
437 dnl -----------------------------------------------------------
440 dnl -----------------------------------------------------------
441 dnl Enable API documentation generation (disabled by default)
442 dnl -----------------------------------------------------------
445 dnl -----------------------------------------------------------
446 dnl Whether to use jay to regenerate parsers.
447 dnl -----------------------------------------------------------
450 dnl -----------------------------------------------------------
451 dnl This sets the build-time default, which can now be overridden
452 dnl by setting the system property gnu.classpath.awt.gtk.portable.native.sync
453 dnl to "true" or "false".
454 dnl -----------------------------------------------------------
455 AC_ARG_ENABLE([portable-native-sync],
456 [AS_HELP_STRING(--enable-portable-native-sync,synchronize VM threads portably)],
457 [case "${enableval}" in
459 AC_DEFINE(PORTABLE_NATIVE_SYNC, 1, [Define if you want to synchronize VM threads portably by default; undef otherwise])
463 AC_MSG_ERROR(bad value ${enableval} for --enable-portable-native-sync)
468 dnl -----------------------------------------------------------
470 dnl -----------------------------------------------------------
471 AC_CONFIG_FILES([Makefile
475 external/sax/Makefile
476 external/w3c_dom/Makefile
477 gnu/classpath/Configuration.java
480 native/fdlibm/Makefile
483 native/jni/classpath/Makefile
484 native/jni/java-io/Makefile
485 native/jni/java-lang/Makefile
486 native/jni/java-net/Makefile
487 native/jni/java-nio/Makefile
488 native/jni/java-util/Makefile
489 native/jni/gtk-peer/Makefile
490 native/jni/qt-peer/Makefile
491 native/jni/xmlj/Makefile
492 native/target/Makefile
493 native/target/Linux/Makefile
494 native/target/generic/Makefile
497 scripts/classpath.spec
501 examples/Makefile.jawt])
502 AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])