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 -----------------------------------------------------------
176 dnl Initialize libtool
184 if test "x${COMPILE_JNI}" = xyes; then
187 dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64,
189 AC_COMPILE_CHECK_SIZEOF(void *)
191 dnl Checking for endianess.
194 dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
195 dnl On that system, sys/ioctl.h will not include sys/filio.h unless
196 dnl BSD_COMP is defined; just including sys/filio.h is simpler.
197 dnl Check for crt_externs.h on Darwin.
198 AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h \
200 inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
207 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
208 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
209 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]))
210 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]))
212 AC_CHECK_FUNCS([ftruncate fsync select \
213 gethostname socket strerror fork pipe execve open close \
214 lseek fstat read write htonl memset htons connect \
215 getsockname getpeername bind listen accept \
216 recvfrom send sendto setsockopt getsockopt time mktime \
220 mmap munmap mincore msync madvise getpagesize sysconf])
226 AC_MSG_CHECKING([for tm_gmtoff in struct tm])
227 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
228 [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
231 AC_MSG_CHECKING([for global timezone variable])
232 dnl FIXME: we don't want a link check here because that won't work
233 dnl when cross-compiling. So instead we make an assumption that
234 dnl the header file will mention timezone if it exists.
235 dnl Don't find the win32 function timezone
236 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
237 [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
240 AC_MSG_CHECKING([for global _timezone variable])
241 dnl FIXME: As above, don't want link check
242 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
243 [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
244 [Define if your platform has the global _timezone variable.])
246 [AC_MSG_RESULT(no)])])])
250 dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
253 dnl When using gcc we want warnings, lots of warnings :-)
254 if test "x${GCC}" = xyes; then
255 dnl We want ISO C90 pedantic ansi, but with longlong (jlong) support
256 dnl and modern POSIX and BSD C library functions/prototypes.
258 dnl Warning flags for (almost) everybody.
259 dnl Should probably be configurable
260 WARNING_CFLAGS='-pedantic -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long'
261 AC_SUBST(WARNING_CFLAGS)
263 dnl Strict warning flags which not every module uses.
264 dnl Should probably be configurable.
265 STRICT_WARNING_CFLAGS=-Wstrict-prototypes
266 AC_SUBST(STRICT_WARNING_CFLAGS)
268 dnl Whether or not to add -Werror, also not used by all modueles.
269 dnl Can be configured by --disable-Werror
271 if test "x${ENABLE_WERROR}" = xyes; then
272 ERROR_CFLAGS='-Werror'
274 AC_SUBST(ERROR_CFLAGS)
277 dnl Check for libxml and libxslt libraries (when xmlj is enabled).
278 if test "x${COMPILE_XMLJ}" = xyes; then
279 PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.6.8)
280 PKG_CHECK_MODULES(XSLT, libxslt >= 1.1.11)
284 AC_SUBST(XSLT_CFLAGS)
287 dnl Check for AWT related gthread/gtk
288 if test "x${COMPILE_GTK_PEER}" = xyes; then
290 if test "$no_x" = yes; then
291 AC_MSG_ERROR([GTK+ peers requested but no X library available])
293 dnl We explicitly want the XTest Extension for Robot support.
294 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
295 [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
297 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
302 dnl Check for AWT related Qt4
303 if test "x${COMPILE_QT_PEER}" = xyes; then
304 PKG_CHECK_MODULES(QT, QtGui >= 4.0.1)
305 dnl Check needed because in some cases the QtGui includedir
306 dnl doesn't contain the subsystem dir.
307 QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
308 EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
309 AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
310 AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
311 AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
312 QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
313 AC_MSG_WARN([QWidget not found])))
314 AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
315 AC_CHECK_PROG(MOC, [moc], [moc])
320 if test "x${enable_gtk_cairo}" = xyes; then
321 PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
322 PKG_CHECK_MODULES(PANGOFT2, pangoft2)
325 AC_SUBST(CAIRO_CFLAGS)
326 AC_SUBST(PANGOFT2_LIBS)
327 AC_SUBST(PANGOFT2_CFLAGS)
332 dnl -----------------------------------------------------------
333 dnl Add the include files for the native abstraction layer.
334 dnl Used by AM_CPPFLAGS in the different modules.
335 dnl -----------------------------------------------------------
336 CLASSPATH_INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/native/jni/classpath -I\$(top_srcdir)/native/target/Linux -I\$(top_srcdir)/native/target/generic"
337 AC_SUBST(CLASSPATH_INCLUDES)
339 dnl -----------------------------------------------------------
340 if test "x${COMPILE_JNI}" = xyes; then
341 AC_MSG_CHECKING(jni_md.h support)
342 if test -f ${srcdir}/include/jni_md-${target_cpu}-${target_os}.h; then
347 AC_MSG_WARN(no, using x86-linux-gnu)
349 ac_sources="include/jni_md-${target_cpu}-${target_os}.h"
350 ac_dests="include/jni_md.h"
351 while test -n "$ac_sources"; do
352 set $ac_dests; ac_dest=$1; shift; ac_dests=$*
353 set $ac_sources; ac_source=$1; shift; ac_sources=$*
354 ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
356 AC_CONFIG_LINKS([$ac_config_links_1])
361 CLASSPATH_WITH_CLASSLIB
363 dnl -----------------------------------------------------------
364 dnl Initialize maintainer mode
365 dnl -----------------------------------------------------------
368 dnl -----------------------------------------------------------
369 dnl Enable debugging statements at compile time. By default
370 dnl these statements should be optimized out of the bytecode
371 dnl produced by an optimizing Java compiler and not hinder
372 dnl performance because debugging is turned off by default.
373 dnl -----------------------------------------------------------
374 AC_ARG_ENABLE([debug],
375 [AS_HELP_STRING(--enable-debug,enable runtime debugging code)],
376 [case "${enableval}" in
379 AC_DEFINE(DEBUG, 1, [Define to 1 if you want native library runtime debugging code enabled])
381 no) LIBDEBUG="false" ;;
382 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
387 dnl -----------------------------------------------------------
388 dnl Enable execution of all static initializer loadLibrary()
389 dnl calls at compile time. By default most people will not
390 dnl want to disable this, but some VMs (gcj) don't need or want
392 dnl -----------------------------------------------------------
393 AC_ARG_ENABLE([load-library],
394 [AS_HELP_STRING(--enable-load-library,enable to use JNI native methods [default=yes])],
395 [case "${enableval}" in
396 yes) INIT_LOAD_LIBRARY="true" ;;
397 no) INIT_LOAD_LIBRARY="false" ;;
398 *) AC_MSG_ERROR(bad value ${enableval} for --enable-load-library) ;;
400 [INIT_LOAD_LIBRARY="true"])
401 AC_SUBST(INIT_LOAD_LIBRARY)
404 dnl -----------------------------------------------------------
405 dnl Should the VM explicitly run class initialization subfunctions for
406 dnl java.lang.System? (default is false -- the subfunctions will be run
407 dnl automatically by the class initializer)
408 dnl -----------------------------------------------------------
409 AC_ARG_ENABLE([java-lang-system-explicit-initialization],
410 [AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM explicitly invoke java.lang.System's static initialization methods [default=no])],
411 [case "${enableval}" in
412 yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
413 no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
414 *) AC_MSG_ERROR(bad value ${enableval} for --enable-java-lang-system-explicit-initialization) ;;
416 [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
417 AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
420 dnl -----------------------------------------------------------
421 dnl avoiding automake complaints
422 dnl -----------------------------------------------------------
426 dnl -----------------------------------------------------------
427 dnl This is probably useless.
428 dnl -----------------------------------------------------------
429 AC_PATH_PROG(MKDIR, mkdir)
431 AC_PATH_PROG(DATE, date)
433 dnl -----------------------------------------------------------
434 dnl According to the GNU coding guide, we shouldn't require find,
435 dnl and zip, however GNU provides both so it should be okay
436 dnl -----------------------------------------------------------
437 AC_PATH_PROG(FIND, find)
439 dnl -----------------------------------------------------------
440 dnl Specify what to install (install only glibj.zip by default)
441 dnl -----------------------------------------------------------
444 dnl -----------------------------------------------------------
445 dnl Enable API documentation generation (disabled by default)
446 dnl -----------------------------------------------------------
449 dnl -----------------------------------------------------------
450 dnl Whether to use jay to regenerate parsers.
451 dnl -----------------------------------------------------------
454 dnl -----------------------------------------------------------
455 dnl This sets the build-time default, which can now be overridden
456 dnl by setting the system property gnu.classpath.awt.gtk.portable.native.sync
457 dnl to "true" or "false".
458 dnl -----------------------------------------------------------
459 AC_ARG_ENABLE([portable-native-sync],
460 [AS_HELP_STRING(--enable-portable-native-sync,synchronize VM threads portably)],
461 [case "${enableval}" in
463 AC_DEFINE(PORTABLE_NATIVE_SYNC, 1, [Define if you want to synchronize VM threads portably by default; undef otherwise])
467 AC_MSG_ERROR(bad value ${enableval} for --enable-portable-native-sync)
472 dnl -----------------------------------------------------------
474 dnl -----------------------------------------------------------
475 AC_CONFIG_FILES([Makefile
479 external/sax/Makefile
480 external/w3c_dom/Makefile
481 gnu/classpath/Configuration.java
484 native/fdlibm/Makefile
487 native/jni/classpath/Makefile
488 native/jni/java-io/Makefile
489 native/jni/java-lang/Makefile
490 native/jni/java-net/Makefile
491 native/jni/java-nio/Makefile
492 native/jni/java-util/Makefile
493 native/jni/gtk-peer/Makefile
494 native/jni/qt-peer/Makefile
495 native/jni/xmlj/Makefile
496 native/target/Makefile
497 native/target/Linux/Makefile
498 native/target/generic/Makefile
501 scripts/classpath.spec
505 examples/Makefile.jawt])
506 AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])