Makefile.am (AM_CXXFLAGS): Define ECJ_JAR_FILE.
[gcc.git] / libjava / classpath / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
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
8
9 AC_INIT([GNU Classpath],[0.94-pre],[classpath@gnu.org],[classpath])
10 AC_CONFIG_SRCDIR(java/lang/System.java)
11
12 AC_CANONICAL_TARGET
13
14 dnl GCJ LOCAL
15 AC_ARG_ENABLE(java-maintainer-mode,
16 AS_HELP_STRING([--enable-java-maintainer-mode],
17 [allow rebuilding of .class and .h files]))
18 AM_CONDITIONAL(JAVA_MAINTAINER_MODE, test "$enable_java_maintainer_mode" = yes)
19 dnl END GCJ LOCAL
20
21 # Find the rest of the source tree framework.
22 AM_ENABLE_MULTILIB(, ../..)
23
24 dnl -----------------------------------------------------------
25 dnl Fold all IA-32 CPU architectures into "x86"
26 dnl -----------------------------------------------------------
27 if expr ${target_cpu} : '.*86' > /dev/null; then target_cpu=x86; fi
28
29 dnl -----------------------------------------------------------
30 dnl We will not track/change lib version until we reach version 1.0
31 dnl at which time we'll have to be more anal about such things
32 dnl -----------------------------------------------------------
33 AC_SUBST(LIBVERSION, "0:0:0")
34 case "$host_os" in
35 darwin*)
36 cp_module=""
37 ;;
38 *)
39 cp_module="-module"
40 ;;
41 esac
42
43 CLASSPATH_MODULE="${cp_module} -version-info ${LIBVERSION} -no-undefined"
44 AC_SUBST(CLASSPATH_MODULE)
45
46 CLASSPATH_CONVENIENCE="-no-undefined"
47 AC_SUBST(CLASSPATH_CONVENIENCE)
48
49 AC_PREREQ(2.59)
50 AM_INIT_AUTOMAKE([1.9.0 gnu std-options tar-ustar])
51 AC_CONFIG_HEADERS([include/config.h])
52 AC_PREFIX_DEFAULT(/usr/local/classpath)
53
54 dnl GCC LOCAL
55 GCC_NO_EXECUTABLES
56
57 dnl -----------------------------------------------------------
58 dnl Enable collections.jar (disabled by default)
59 dnl -----------------------------------------------------------
60 AC_ARG_ENABLE([collections],
61 [AS_HELP_STRING(--enable-collections,create collections.jar [default=no])],
62 [case x"${enableval}" in
63 xyes) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
64 xno) COMPILE_COLLECTIONS=no ;;
65 x) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
66 *) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"${enableval}\"" ;;
67 esac],
68 [COMPILE_COLLECTIONS=no])
69 AM_CONDITIONAL(CREATE_COLLECTIONS, test "x${COMPILE_COLLECTIONS}" = xyes)
70
71 dnl -----------------------------------------------------------
72 dnl Enable JNI libraries (enabled by default)
73 dnl -----------------------------------------------------------
74 AC_ARG_ENABLE([jni],
75 [AS_HELP_STRING(--enable-jni,compile JNI source [default=yes])],
76 [case "${enableval}" in
77 yes) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
78 no) COMPILE_JNI=no ;;
79 *) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
80 esac],
81 [COMPILE_JNI=yes])
82 AM_CONDITIONAL(CREATE_JNI_LIBRARIES, test "x${COMPILE_JNI}" = xyes)
83
84 dnl -----------------------------------------------------------
85 dnl Enable core JNI libraries (enabled by default)
86 dnl -----------------------------------------------------------
87 AC_ARG_ENABLE([core-jni],
88 [AS_HELP_STRING(--enable-core-jni,
89 compile JNI sources for core [default=yes])],
90 [case "${enableval}" in
91 yes) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
92 no) COMPILE_CORE_JNI=no ;;
93 *) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
94 esac],
95 [COMPILE_CORE_JNI=yes])
96 AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes)
97
98 dnl -----------------------------------------------------------
99 dnl Default Preference Backend
100 dnl -----------------------------------------------------------
101 AC_ARG_ENABLE([default-preferences-peer],
102 [AS_HELP_STRING([--enable-default-preferences-peer@<:@=peer type or class name@:>@],
103 [specify one of: "gconf" [default] for a GConf based backend, "file" for a file based one, "memory" for a transient one, or a fully qualified class name implementing java.util.prefs.PreferencesFactory])],
104 [case "${enableval}" in
105 file) DEFAULT_PREFS_PEER=gnu.java.util.prefs.FileBasedFactory ;;
106 gconf|yes|true) DEFAULT_PREFS_PEER=gnu.java.util.prefs.GConfBasedFactory ;;
107 memory) DEFAULT_PREFS_PEER=gnu.java.util.prefs.MemoryBasedFactory ;;
108 no|false) AC_MSG_ERROR(bad value '${enableval}' for --enable-default-preferences-peer) ;;
109 *) DEFAULT_PREFS_PEER=${enableval} ;;
110 esac],
111 [DEFAULT_PREFS_PEER=gnu.java.util.prefs.GConfBasedFactory])
112 dnl AC_SUBST(DEFAULT_PREFS_PEER)
113
114 dnl -----------------------------------------------------------
115 dnl GConf native peer (enabled by default)
116 dnl -----------------------------------------------------------
117 AC_ARG_ENABLE([gconf-peer],
118 [AS_HELP_STRING(--disable-gconf-peer,compile GConf native peers (disabled by --disable-jni) [default=yes])],
119 [case "${enableval}" in
120 yes) COMPILE_GCONF_PEER=yes ;;
121 no) COMPILE_GCONF_PEER=no ;;
122 *) COMPILE_GCONF_PEER=yes ;;
123 esac],
124 [COMPILE_GCONF_PEER=yes])
125 AM_CONDITIONAL(CREATE_GCONF_PEER_LIBRARIES, test "x${COMPILE_GCONF_PEER}" = xyes)
126
127 dnl -----------------------------------------------------------
128 dnl GTK native peer error checking
129 dnl -----------------------------------------------------------
130 AC_ARG_ENABLE([gconf-peers],,AC_MSG_ERROR([No --enable-gconf-peers (or --disable-gconf-peers) option; you want --enable-gconf-peer]))
131
132 dnl ------------------------------------------------------------
133 dnl Whether to compile with -Werror or not (disabled by default)
134 dnl ------------------------------------------------------------
135 AC_ARG_ENABLE([Werror],
136 [AS_HELP_STRING(--enable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
137 [case "${enableval}" in
138 yes) ENABLE_WERROR=yes ;;
139 no) ENABLE_WERROR=no ;;
140 *) ENABLE_WERROR=default ;;
141 esac],
142 [ENABLE_WERROR=default])
143
144 dnl -----------------------------------------------------------
145 dnl Default AWT toolkit
146 dnl -----------------------------------------------------------
147 AC_ARG_ENABLE(default-toolkit,
148 AS_HELP_STRING([--enable-default-toolkit],
149 [fully qualified class name of default AWT toolkit]))
150 default_toolkit=$enable_default_toolkit
151 if test "$default_toolkit" = ""; then
152 default_toolkit=gnu.java.awt.peer.gtk.GtkToolkit
153 fi
154 AC_SUBST(default_toolkit)
155
156 dnl -----------------------------------------------------------
157 dnl Native libxml/xslt library (disabled by default)
158 dnl -----------------------------------------------------------
159 AC_ARG_ENABLE([xmlj],
160 [AS_HELP_STRING(--enable-xmlj,compile native libxml/xslt library [default=no])],
161 [case "${enableval}" in
162 yes) COMPILE_XMLJ=yes ;;
163 no) COMPILE_XMLJ=no ;;
164 *) COMPILE_XMLJ=no ;;
165 esac],
166 [COMPILE_XMLJ=no])
167 AM_CONDITIONAL(CREATE_XMLJ_LIBRARY, test "x${COMPILE_XMLJ}" = xyes)
168
169 dnl -----------------------------------------------------------
170 dnl ALSA code (enabled by default)
171 dnl -----------------------------------------------------------
172 AC_ARG_ENABLE([alsa],
173 [AS_HELP_STRING(--disable-alsa,compile ALSA providers (enable by --enable-alsa) [default=yes])],
174 [case "${enableval}" in
175 yes) COMPILE_ALSA=yes ;;
176 no) COMPILE_ALSA=no ;;
177 *) COMPILE_ALSA=yes ;;
178 esac],
179 [AC_CHECK_HEADERS([alsa/asoundlib.h],
180 [AC_CHECK_LIB([asound], [snd_seq_open], COMPILE_ALSA=yes,COMPILE_ALSA=no)],
181 COMPILE_ALSA=no)])
182 AM_CONDITIONAL(CREATE_ALSA_LIBRARIES, test "x${COMPILE_ALSA}" = xyes)
183
184 dnl -----------------------------------------------------------
185 dnl DSSI code (enabled by default)
186 dnl -----------------------------------------------------------
187 AC_ARG_ENABLE([dssi],
188 [AS_HELP_STRING(--disable-dssi,compile DSSI providers (enable by --enable-dssi) [default=yes])],
189 [case "${enableval}" in
190 yes) COMPILE_DSSI=yes ;;
191 no) COMPILE_DSSI=no ;;
192 *) COMPILE_DSSI=yes ;;
193 esac],
194 [COMPILE_DSSI=no
195 AC_CHECK_HEADERS([dssi.h], [
196 AC_CHECK_HEADERS([jack/jack.h],COMPILE_DSSI=yes)])])
197 AM_CONDITIONAL(CREATE_DSSI_LIBRARIES, test "x${COMPILE_DSSI}" = xyes)
198
199 dnl -----------------------------------------------------------
200 dnl GTK native peer (enabled by default)
201 dnl -----------------------------------------------------------
202 AC_ARG_ENABLE([gtk-peer],
203 [AS_HELP_STRING(--disable-gtk-peer,compile GTK native peers (disabled by --disable-jni) [default=yes])],
204 [case "${enableval}" in
205 yes) COMPILE_GTK_PEER=yes ;;
206 no) COMPILE_GTK_PEER=no ;;
207 *) COMPILE_GTK_PEER=yes ;;
208 esac],
209 [COMPILE_GTK_PEER=yes])
210 AM_CONDITIONAL(CREATE_GTK_PEER_LIBRARIES, test "x${COMPILE_GTK_PEER}" = xyes)
211
212 dnl -----------------------------------------------------------
213 dnl GTK native peer error checking
214 dnl -----------------------------------------------------------
215 AC_ARG_ENABLE([gtk-peers],,AC_MSG_ERROR([No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer]))
216
217 dnl -----------------------------------------------------------
218 dnl Qt native peer (disabled by default)
219 dnl -----------------------------------------------------------
220 AC_ARG_ENABLE([qt-peer],
221 [AS_HELP_STRING(--enable-qt-peer,compile Qt4 native peers (disabled by --disable-jni) [default=no])],
222 [case "${enableval}" in
223 yes) COMPILE_QT_PEER=yes ;;
224 no) COMPILE_QT_PEER=no ;;
225 *) COMPILE_QT_PEER=yes ;;
226 esac],
227 [COMPILE_QT_PEER=no])
228 AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)
229
230 dnl -----------------------------------------------------------
231 dnl Plugin (enabled by default)
232 dnl -----------------------------------------------------------
233 AC_ARG_ENABLE([plugin],
234 [AS_HELP_STRING(--disable-plugin,compile gcjwebplugin (disabled by --disable-plugin) [default=yes])],
235 [case "${enableval}" in
236 yes) COMPILE_PLUGIN=yes ;;
237 no) COMPILE_PLUGIN=no ;;
238 *) COMPILE_PLUGIN=yes ;;
239 esac],
240 [COMPILE_PLUGIN=yes])
241 AM_CONDITIONAL(CREATE_PLUGIN, test "x${COMPILE_PLUGIN}" = xyes)
242
243 dnl -----------------------------------------------------------
244 dnl GCJ LOCAL: Calculates and substitutes toolexeclibdir. $libdir is
245 dnl defined to the same value for all multilibs. We define toolexeclibdir
246 dnl so that we can refer to the multilib installation directories from
247 dnl classpath's build files.
248 dnl -----------------------------------------------------------
249 CLASSPATH_TOOLEXECLIBDIR
250
251 dnl -----------------------------------------------------------
252 dnl Sets the native libraries installation dir
253 dnl -----------------------------------------------------------
254 dnl GCJ LOCAL: default to ${toolexeclibdir}/gcj-${gcc_version}
255 AC_ARG_WITH([native-libdir],
256 [AS_HELP_STRING(--with-native-libdir,sets the installation directory for native libraries [default='${libdir}/${PACKAGE}'])],
257 [
258 nativeexeclibdir=${withval}
259 ],
260 [
261 nativeexeclibdir='${toolexeclibdir}/gcj-'`cat ${srcdir}/../../gcc/BASE-VER`
262 ])
263
264 AC_SUBST(nativeexeclibdir)
265
266 dnl -----------------------------------------------------------
267 dnl Sets the Java library installation dir.
268 dnl -----------------------------------------------------------
269 AC_ARG_WITH([glibj-dir],
270 [AS_HELP_STRING(--with-glibj-dir,sets the installation directory for glibj.zip [default='${libdir}/${PACKAGE}'])],
271 [
272 glibjdir=${withval}
273 ],
274 [
275 glibjdir='${datadir}/${PACKAGE}'
276 ])
277
278 AC_SUBST(glibjdir)
279
280 dnl -----------------------------------------------------------
281 dnl Sets the VM name for use in tool wrapper scripts
282 dnl -----------------------------------------------------------
283 AC_ARG_WITH([vm],
284 [AS_HELP_STRING(--with-vm,sets the VM binary name [default='${prefix}/bin/jamvm'])],
285 [
286 VM_BINARY=${withval}
287 ],
288 [
289 VM_BINARY='${prefix}/bin/jamvm'
290 ])
291
292 AC_SUBST(VM_BINARY)
293 AM_CONDITIONAL(FOUND_CACAO, test "x`basename $VM_BINARY`" = xcacao)
294
295 dnl -----------------------------------------------------------
296 dnl Regenerate headers at build time (disabled by default)
297 dnl -----------------------------------------------------------
298 AC_ARG_ENABLE([regen-headers],
299 [AS_HELP_STRING(--enable-regen-headers,automatically regenerate JNI headers [default=no])],
300 [case "${enableval}" in
301 yes) REGENERATE_JNI_HEADERS=yes ;;
302 no) REGENERATE_JNI_HEADERS=no ;;
303 *) REGENERATE_JNI_HEADERS=no ;;
304 esac],
305 [REGENERATE_JNI_HEADERS=no])
306 AM_CONDITIONAL(CREATE_JNI_HEADERS, test "x${REGENERATE_JNI_HEADERS}" = xyes)
307
308 dnl -----------------------------------------------------------
309 dnl Enable tool wrapper binaries (disabled by default)
310 dnl -----------------------------------------------------------
311 AC_ARG_ENABLE([tool-wrappers],
312 [AS_HELP_STRING(--enable-tool-wrappers,create tool wrapper binaries [default=no])],
313 [case x"${enableval}" in
314 xyes)
315 COMPILE_WRAPPERS=yes;
316 AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
317 AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
318 ;;
319 xno) COMPILE_WRAPPERS=no ;;
320 x) COMPILE_WRAPPERS=yes ;;
321 *) COMPILE_WRAPPERS=yes ;;
322 esac],
323 [COMPILE_WRAPPERS=no])
324 AM_CONDITIONAL(CREATE_WRAPPERS, test "x${COMPILE_WRAPPERS}" = xyes)
325
326 AC_PROG_LN_S
327 AC_PROG_INSTALL
328
329 dnl -----------------------------------------------------------
330 dnl Checks for programs.
331 dnl -----------------------------------------------------------
332
333 dnl Initialize libtool
334 AC_DISABLE_STATIC
335 AC_PROG_LIBTOOL
336 dnl AC_PROG_AWK
337 AC_PROG_CC
338 AC_PROG_CPP
339 AC_PROG_CXX
340
341 # Handle -Werror default case.
342 if test "$ENABLE_WERROR" = default; then
343 case "$host_os" in
344 *linux*)
345 if test "$GCC" = yes; then
346 ENABLE_WERROR=yes
347 fi
348 ;;
349 esac
350 fi
351
352 if test "x${COMPILE_COLLECTIONS}" = xyes; then
353 AC_PATH_PROG(PERL, [perl])
354 AC_SUBST(PERL)
355 AC_SUBST(COLLECTIONS_PREFIX)
356 AC_CONFIG_FILES([lib/mkcollections.pl])
357 AC_CONFIG_COMMANDS([mkcollections.pl],[chmod 755 lib/mkcollections.pl])
358 fi
359
360 if test "x${COMPILE_JNI}" = xyes; then
361 GCC_ATTRIBUTE_UNUSED
362
363 AC_HEADER_STDC
364
365 dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64,
366 dnl at least.
367 AC_COMPILE_CHECK_SIZEOF(void *)
368
369 dnl Checking for endianess.
370 AC_C_BIGENDIAN_CROSS
371
372 dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
373 dnl On that system, sys/ioctl.h will not include sys/filio.h unless
374 dnl BSD_COMP is defined; just including sys/filio.h is simpler.
375 dnl Check for crt_externs.h on Darwin.
376 AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h \
377 asm/ioctls.h \
378 inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
379 sys/time.h \
380 sys/select.h \
381 crt_externs.h \
382 fcntl.h \
383 sys/mman.h \
384 magic.h \
385 sys/event.h sys/epoll.h \
386 ifaddrs.h])
387
388 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
389 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
390 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]))
391 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]))
392
393 AC_CHECK_FUNCS([ftruncate fsync select \
394 gethostname socket strerror fork pipe execve open close \
395 lseek fstat read readv write writev htonl memset htons connect \
396 getsockname getpeername bind listen accept \
397 recvfrom send sendto setsockopt getsockopt time mktime \
398 gethostbyname_r localtime_r \
399 strerror_r \
400 fcntl \
401 mmap munmap mincore msync madvise getpagesize sysconf \
402 lstat readlink \
403 inet_aton inet_addr inet_pton \
404 getifaddrs kqueue kevent epoll_create \
405 readdir_r ])
406
407 LIBMAGIC=
408 AC_CHECK_LIB(magic, magic_open, LIBMAGIC=-lmagic)
409 AC_SUBST(LIBMAGIC)
410
411 AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
412 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct sockaddr_in6 addr6;]])],
413 [AC_DEFINE(HAVE_INET6, 1,
414 [Define if inet6 structures are defined in netinet/in.h.])
415 AC_MSG_RESULT(yes)],
416 [AC_MSG_RESULT(no)])
417
418 AC_HEADER_TIME
419 AC_STRUCT_TM
420 AC_STRUCT_TIMEZONE
421
422 AC_MSG_CHECKING([for tm_gmtoff in struct tm])
423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
424 [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
425 AC_MSG_RESULT(yes)],
426 [AC_MSG_RESULT(no)
427 AC_MSG_CHECKING([for global timezone variable])
428 dnl FIXME: we don't want a link check here because that won't work
429 dnl when cross-compiling. So instead we make an assumption that
430 dnl the header file will mention timezone if it exists.
431 dnl Don't find the win32 function timezone
432 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
433 [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
434 AC_MSG_RESULT(yes)],
435 [AC_MSG_RESULT(no)
436 AC_MSG_CHECKING([for global _timezone variable])
437 dnl FIXME: As above, don't want link check
438 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
439 [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
440 [Define if your platform has the global _timezone variable.])
441 AC_MSG_RESULT(yes)],
442 [AC_MSG_RESULT(no)])])])
443
444 AC_C_CONST
445 AC_C_ATTRIBUTE
446
447 dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
448 AM_ICONV
449
450 dnl When using gcc we want warnings, lots of warnings :-)
451 if test "x${GCC}" = xyes; then
452 dnl We want ISO C90 ansi, but with longlong (jlong) support
453 dnl and modern POSIX and BSD C library functions/prototypes.
454
455 dnl Warning flags for (almost) everybody.
456 dnl Should probably be configurable
457 WARNING_CFLAGS='-W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long'
458 AC_SUBST(WARNING_CFLAGS)
459
460 dnl Strict warning flags which not every module uses.
461 dnl Should probably be configurable.
462 STRICT_WARNING_CFLAGS='-Wstrict-prototypes -pedantic'
463 AC_SUBST(STRICT_WARNING_CFLAGS)
464
465 dnl Whether or not to add -Werror, also not used by all modueles.
466 dnl Can be configured by --disable-Werror
467 ERROR_CFLAGS=
468 if test "x${ENABLE_WERROR}" = xyes; then
469 ERROR_CFLAGS='-Werror'
470 fi
471 AC_SUBST(ERROR_CFLAGS)
472 fi
473
474 dnl Check for libxml and libxslt libraries (when xmlj is enabled).
475 if test "x${COMPILE_XMLJ}" = xyes; then
476 PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.6.8)
477 PKG_CHECK_MODULES(XSLT, libxslt >= 1.1.11)
478 AC_SUBST(XML_LIBS)
479 AC_SUBST(XML_CFLAGS)
480 AC_SUBST(XSLT_LIBS)
481 AC_SUBST(XSLT_CFLAGS)
482 fi
483
484 dnl Check for AWT related gthread/gtk
485 if test "x${COMPILE_GTK_PEER}" = xyes; then
486 AC_PATH_XTRA
487 if test "$no_x" = yes; then
488 AC_MSG_ERROR([GTK+ peers requested but no X library available])
489 fi
490 dnl We explicitly want the XTest Extension for Robot support.
491 AC_CHECK_LIB([Xtst], [XTestQueryExtension],
492 [XTEST_LIBS="$XTEST_LIBS -lX11 -lXtst"],
493 [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
494 [${X_LIBS}])
495
496 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
497 PKG_CHECK_MODULES(FREETYPE2, freetype2)
498 PKG_CHECK_MODULES(PANGOFT2, pangoft2)
499 dnl Check if we can link against the XRender library and set
500 dnl HAVE_XRENDER accordingly.
501 AC_CHECK_LIB([Xrender], [XRenderQueryExtension],
502 [AC_DEFINE(HAVE_XRENDER, 1, [Define to 1 if you have libXrender.])[X_EXTRA_LIBS="$X_EXTRA_LIBS -lXrender"]],
503 [true],
504 [${X_LIBS}])
505
506 dnl Check if we can link against the XRandR library and set
507 dnl HAVE_XRANDR accordingly.
508 AC_CHECK_LIB([Xrandr], [XRRQueryExtension],
509 [AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have libXrandr.])[X_EXTRA_LIBS="$X_EXTRA_LIBS -lXrandr"]],
510 [true],
511 [${X_LIBS}])
512
513 AC_SUBST(GTK_CFLAGS)
514 AC_SUBST(GTK_LIBS)
515 AC_SUBST(FREETYPE2_LIBS)
516 AC_SUBST(FREETYPE2_CFLAGS)
517 AC_SUBST(PANGOFT2_LIBS)
518 AC_SUBST(PANGOFT2_CFLAGS)
519 AC_SUBST(XTEST_LIBS)
520 fi
521
522 dnl gconf-peer
523 if test "x${COMPILE_GCONF_PEER}" = xyes; then
524 PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.11.2)
525 AC_SUBST(GCONF_CFLAGS)
526 AC_SUBST(GCONF_LIBS)
527 dnl we also need gdk for locking
528 PKG_CHECK_MODULES(GDK, gdk-2.0 >= 2.8)
529 AC_SUBST(GDK_CFLAGS)
530 AC_SUBST(GDK_LIBS)
531 dnl check if the config value was given form the command line,
532 dnl if not, overwrite the default if we have the gconf backend
533 dnl compiled in
534 USE_GCONF_PREFS_PEER=$enable_default_preferences_peer
535 if test "$USE_GCONF_PREFS_PEER" = ""; then
536 DEFAULT_PREFS_PEER=gnu.java.util.prefs.GConfBasedFactory
537 fi
538 fi
539
540 dnl Check for AWT related Qt4
541 if test "x${COMPILE_QT_PEER}" = xyes; then
542 PKG_CHECK_MODULES(QT, QtCore QtGui >= 4.1.0, HAVE_QT4="yes", HAVE_QT4="no")
543 if test "x$HAVE_QT4" = "xyes"; then
544 dnl Check needed because in some cases the QtGui includedir
545 dnl doesn't contain the subsystem dir.
546 QT_INCLUDE_DIR=`$PKG_CONFIG --variable=includedir QtGui`
547 EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
548 AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
549 AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
550 AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
551 QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
552 AC_MSG_WARN([QWidget not found])))
553 AC_CHECK_PROG(MOC, [moc], [moc])
554 AC_CHECK_PROG(MOC, [moc-qt4], [moc-qt4])
555 fi
556 if test "x$HAVE_QT4" = "xno"; then
557 AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
558 case "$host_os" in
559 darwin*)
560 AC_ARG_WITH([qt4dir],
561 [AS_HELP_STRING([--with-qt4dir=DIR],
562 [Qt4 installation directory used for OS-X.
563 For other systems use pkg-config.])],
564 [QT4DIR=$withval]
565 )
566 if test x"$QT4DIR" = x ; then
567 AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
568 fi
569 AC_MSG_RESULT([QT4DIR... $QT4DIR])
570 AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
571 if test x"$MOC" = x; then
572 AC_MSG_ERROR([*** This is not the right Qt installation])
573 fi
574 QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
575 QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
576 QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
577 QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
578 ;;
579 *)
580 AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
581 of your installed Qt4 installation.])
582 ;;
583 esac
584 fi
585 AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
586 AC_SUBST(QT_CFLAGS)
587 AC_SUBST(QT_LIBS)
588 fi
589 dnl **********************************************************************
590 dnl Check for MSG_NOSIGNAL
591 dnl **********************************************************************
592 AC_MSG_CHECKING(for MSG_NOSIGNAL)
593 AC_TRY_COMPILE([#include <sys/socket.h>],
594 [ int f = MSG_NOSIGNAL; ],
595 [ AC_MSG_RESULT(yes)
596 AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,
597 [Define this symbol if you have MSG_NOSIGNAL]) ],
598 [ AC_MSG_RESULT(no)]
599 )
600 dnl **********************************************************************
601 dnl Check for SO_NOSIGPIPE (Darwin equivalent for MSG_NOSIGNAL)
602 dnl **********************************************************************
603 AC_MSG_CHECKING(for SO_NOSIGPIPE )
604 AC_TRY_COMPILE([#include <sys/socket.h>],
605 [ int f = SO_NOSIGPIPE; ],
606 [ AC_MSG_RESULT(yes)
607 AC_DEFINE(HAVE_SO_NOSIGPIPE, 1,
608 [Define this symbol if you have SO_NOSIGPIPE]) ],
609 [ AC_MSG_RESULT(no)]
610 )
611
612 dnl Check for plugin support headers and libraries.
613 if test "x${COMPILE_PLUGIN}" = xyes; then
614 PKG_CHECK_MODULES(MOZILLA, mozilla-plugin, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
615 if test "x${MOZILLA_FOUND}" = xno; then
616 PKG_CHECK_MODULES(MOZILLA, firefox-plugin firefox-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
617 fi
618 if test "x${MOZILLA_FOUND}" = xno; then
619 PKG_CHECK_MODULES(MOZILLA, xulrunner-plugin xulrunner-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
620 fi
621 if test "x${MOZILLA_FOUND}" = xno; then
622 PKG_CHECK_MODULES(MOZILLA, mozilla-firefox-plugin mozilla-firefox-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
623 fi
624 if test "x${MOZILLA_FOUND}" = xno; then
625 PKG_CHECK_MODULES(MOZILLA, seamonkey-plugin seamonkey-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
626 fi
627 PKG_CHECK_MODULES(GLIB, glib-2.0)
628
629 AC_SUBST(MOZILLA_CFLAGS)
630 AC_SUBST(MOZILLA_LIBS)
631 AC_SUBST(GLIB_CFLAGS)
632 AC_SUBST(GLIB_LIBS)
633
634 AC_SUBST(PLUGIN_DIR, $HOME/.mozilla/plugins/)
635 fi
636 fi
637
638 CLASSPATH_WITH_JAVAH
639
640 dnl -----------------------------------------------------------
641 dnl Add the include files for the native abstraction layer.
642 dnl Used by AM_CPPFLAGS in the different modules.
643 dnl -----------------------------------------------------------
644 CLASSPATH_INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/native/jni/classpath -I\$(top_srcdir)/native/jni/native-lib"
645 AC_SUBST(CLASSPATH_INCLUDES)
646
647 dnl -----------------------------------------------------------
648 if test "x${COMPILE_JNI}" = xyes; then
649 AC_MSG_CHECKING(jni_md.h support)
650 if test -f ${srcdir}/include/jni_md-${target_cpu}-${target_os}.h; then
651 AC_MSG_RESULT(yes)
652 else
653 target_cpu=x86
654 target_os=linux-gnu
655 AC_MSG_WARN(no, using x86-linux-gnu)
656 fi
657 ac_sources="include/jni_md-${target_cpu}-${target_os}.h"
658 ac_dests="include/jni_md.h"
659 while test -n "$ac_sources"; do
660 set $ac_dests; ac_dest=$1; shift; ac_dests=$*
661 set $ac_sources; ac_source=$1; shift; ac_sources=$*
662 ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
663 done
664 AC_CONFIG_LINKS([$ac_config_links_1])
665 fi
666
667 CLASSPATH_FIND_JAVAC
668
669 CLASSPATH_WITH_CLASSLIB
670
671 dnl -----------------------------------------------------------
672 dnl Initialize maintainer mode
673 dnl -----------------------------------------------------------
674 AM_MAINTAINER_MODE
675
676 dnl -----------------------------------------------------------
677 dnl Enable debugging statements at compile time. By default
678 dnl these statements should be optimized out of the bytecode
679 dnl produced by an optimizing Java compiler and not hinder
680 dnl performance because debugging is turned off by default.
681 dnl -----------------------------------------------------------
682 AC_ARG_ENABLE([debug],
683 [AS_HELP_STRING(--enable-debug,enable runtime debugging code)],
684 [case "${enableval}" in
685 yes)
686 LIBDEBUG="true"
687 AC_DEFINE(DEBUG, 1, [Define to 1 if you want native library runtime debugging code enabled])
688 ;;
689 no) LIBDEBUG="false" ;;
690 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
691 esac],
692 [LIBDEBUG="false"])
693 AC_SUBST(LIBDEBUG)
694
695 dnl -----------------------------------------------------------
696 dnl Enable execution of all static initializer loadLibrary()
697 dnl calls at compile time. By default most people will not
698 dnl want to disable this, but some VMs (gcj) don't need or want
699 dnl them.
700 dnl -----------------------------------------------------------
701 AC_ARG_ENABLE([load-library],
702 [AS_HELP_STRING(--enable-load-library,enable to use JNI native methods [default=yes])],
703 [case "${enableval}" in
704 yes) INIT_LOAD_LIBRARY="true" ;;
705 no) INIT_LOAD_LIBRARY="false" ;;
706 *) AC_MSG_ERROR(bad value ${enableval} for --enable-load-library) ;;
707 esac],
708 [INIT_LOAD_LIBRARY="true"])
709 AC_SUBST(INIT_LOAD_LIBRARY)
710
711
712 dnl -----------------------------------------------------------
713 dnl Specify the jar file containing the Eclipse Java Compiler. If
714 dnl this option is not specified then the com.sun.tools.javac
715 dnl implementation will not be included in tools.zip.
716 dnl -----------------------------------------------------------
717 dnl GCJ LOCAL: default to $multi_basedir/ecj.jar
718 dnl In the default case where $multi_basedir/ecj.jar is found
719 dnl $(jardir)/ecj.jar will not expand properly in GNU Classpath's
720 dnl gnu/classpath/Configuration.java. That is OK though since libjava's
721 dnl gnu/classpath/Configuration.java overrides GNU Classpath's and
722 dnl ECJ_JAR_FILE will be properly expanded in libjava's
723 dnl gnu/classpath/natConfiguration.cc.
724 AC_ARG_WITH([ecj-jar],
725 [AS_HELP_STRING([--with-ecj-jar=ABS.PATH],
726 [specify jar file containing the Eclipse Java Compiler])],
727 [ECJ_JAR=$withval],
728 [if test -f $multi_basedir/ecj.jar; then
729 ECJ_JAR='$(jardir)/ecj.jar'
730 fi])
731 AC_SUBST(ECJ_JAR)
732 AM_CONDITIONAL(FOUND_ECJ_JAR, test "$ECJ_JAR" != "")
733
734 dnl -----------------------------------------------------------
735 dnl Should the VM explicitly run class initialization subfunctions for
736 dnl java.lang.System? (default is false -- the subfunctions will be run
737 dnl automatically by the class initializer)
738 dnl -----------------------------------------------------------
739 AC_ARG_ENABLE([java-lang-system-explicit-initialization],
740 [AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM explicitly invoke java.lang.System's static initialization methods [default=no])],
741 [case "${enableval}" in
742 yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
743 no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
744 *) AC_MSG_ERROR(bad value ${enableval} for --enable-java-lang-system-explicit-initialization) ;;
745 esac],
746 [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
747 AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
748
749
750 dnl -----------------------------------------------------------
751 dnl avoiding automake complaints
752 dnl -----------------------------------------------------------
753 REMOVE=""
754 AC_SUBST(REMOVE)
755
756 dnl -----------------------------------------------------------
757 dnl This is probably useless.
758 dnl -----------------------------------------------------------
759 AC_PATH_PROG(MKDIR, mkdir)
760 AC_PATH_PROG(CP, cp)
761 AC_PATH_PROG(DATE, date)
762
763 dnl -----------------------------------------------------------
764 dnl According to the GNU coding guide, we shouldn't require find,
765 dnl and zip, however GNU provides both so it should be okay
766 dnl -----------------------------------------------------------
767 AC_PATH_PROG(FIND, find)
768
769 dnl -----------------------------------------------------------
770 dnl Specify what to install (install only glibj.zip by default)
771 dnl -----------------------------------------------------------
772 CLASSPATH_WITH_GLIBJ
773
774 dnl -----------------------------------------------------------
775 dnl Enable API documentation generation (disabled by default)
776 dnl -----------------------------------------------------------
777 CLASSPATH_WITH_GJDOC
778
779 dnl -----------------------------------------------------------
780 dnl Whether to use jay to regenerate parsers.
781 dnl -----------------------------------------------------------
782 REGEN_WITH_JAY
783
784 dnl -----------------------------------------------------------
785 dnl This sets the build-time default, which can now be overridden
786 dnl by setting the system property gnu.classpath.awt.gtk.portable.native.sync
787 dnl to "true" or "false".
788 dnl -----------------------------------------------------------
789 AC_ARG_ENABLE([portable-native-sync],
790 [AS_HELP_STRING(--enable-portable-native-sync,synchronize VM threads portably)],
791 [case "${enableval}" in
792 yes)
793 AC_DEFINE(PORTABLE_NATIVE_SYNC, 1, [Define if you want to synchronize VM threads portably by default; undef otherwise])
794 ;;
795 no) ;;
796 *)
797 AC_MSG_ERROR(bad value ${enableval} for --enable-portable-native-sync)
798 ;;
799 esac],
800 [])
801
802 AX_CREATE_STDINT_H([include/config-int.h])
803
804 dnl -----------------------------------------------------------------------
805 dnl Support for using a prebuilt class library
806 dnl -----------------------------------------------------------------------
807 AC_ARG_WITH([glibj_zip],
808 AS_HELP_STRING([--with-glibj-zip=ABS.PATH],
809 [use prebuilt glibj.zip class library]))
810
811 case "$with_glibj_zip" in
812 "")
813 use_glibj_zip=false
814 ;;
815 "no" )
816 use_glibj_zip=false
817 ;;
818 "yes")
819 AC_MSG_ERROR([Please suply an absolute path to a prebuilt glibj.zip])
820 ;;
821 *)
822 use_glibj_zip=true
823 PATH_TO_GLIBJ_ZIP=$with_glibj_zip
824 ;;
825 esac;
826
827 AM_CONDITIONAL(USE_PREBUILT_GLIBJ_ZIP, test x$use_glibj_zip = xtrue)
828 AC_SUBST(PATH_TO_GLIBJ_ZIP)
829
830 dnl -----------------------------------------------------------
831 dnl Build with Escher based X peers.
832 dnl -----------------------------------------------------------
833 AC_ARG_WITH([escher],
834 AS_HELP_STRING([--with-escher=ABS.PATH],
835 [specify path to escher dir or JAR for X peers]))
836 case "$with_escher" in
837 "")
838 use_escher=false
839 ;;
840 "no")
841 use_escher=false
842 ;;
843 "yes")
844 AC_MSG_ERROR([Please supply an absolute path to Escher library])
845 ;;
846 *)
847 use_escher=true
848 PATH_TO_ESCHER=$with_escher
849 ;;
850 esac
851
852 AM_CONDITIONAL(USE_ESCHER, test x$use_escher = xtrue)
853 AC_SUBST(PATH_TO_ESCHER)
854
855 dnl -----------------------------------------------------------
856 dnl Check if local socket support should be included.
857 dnl -----------------------------------------------------------
858 AC_ARG_ENABLE([local-sockets],
859 [AS_HELP_STRING(--enable-local-sockets,enables local (AF_LOCAL) socket API [default: no])],
860 [case "${enableval}" in
861 yes)
862 ENABLE_LOCAL_SOCKETS=yes
863 ;;
864 *)
865 ENABLE_LOCAL_SOCKETS=no
866 ;;
867 esac],
868 [])
869 if test "x$ENABLE_LOCAL_SOCKETS" = "xyes"
870 then
871 AC_CHECK_HEADER([sys/un.h])
872 AC_CHECK_FUNCS([read write bind listen accept shutdown], [],
873 AC_MSG_ERROR([networking support not available]))
874 AC_DEFINE(ENABLE_LOCAL_SOCKETS, [1], [Define to enable support for local sockets.])
875 fi
876 AM_CONDITIONAL(ENABLE_LOCAL_SOCKETS, test "x$ENABLE_LOCAL_SOCKETS" = "xyes")
877
878 dnl -----------------------------------------------------------
879 dnl Add the default preference peer
880 dnl -----------------------------------------------------------
881 AC_SUBST(DEFAULT_PREFS_PEER)
882
883 dnl -----------------------------------------------------------
884 dnl output files
885 dnl -----------------------------------------------------------
886 AC_CONFIG_FILES([Makefile
887 doc/Makefile
888 doc/api/Makefile
889 external/Makefile
890 external/sax/Makefile
891 external/w3c_dom/Makefile
892 external/relaxngDatatype/Makefile
893 external/jsr166/Makefile
894 gnu/classpath/Configuration.java
895 gnu/java/security/Configuration.java
896 include/Makefile
897 native/Makefile
898 native/fdlibm/Makefile
899 native/jawt/Makefile
900 native/jni/Makefile
901 native/jni/classpath/Makefile
902 native/jni/java-io/Makefile
903 native/jni/java-lang/Makefile
904 native/jni/java-net/Makefile
905 native/jni/java-nio/Makefile
906 native/jni/java-util/Makefile
907 native/jni/gtk-peer/Makefile
908 native/jni/gconf-peer/Makefile
909 native/jni/qt-peer/Makefile
910 native/jni/xmlj/Makefile
911 native/jni/midi-alsa/Makefile
912 native/jni/midi-dssi/Makefile
913 native/jni/native-lib/Makefile
914 native/plugin/Makefile
915 resource/Makefile
916 resource/META-INF/services/java.util.prefs.PreferencesFactory
917 scripts/Makefile
918 scripts/classpath.spec
919 lib/Makefile
920 lib/gen-classlist.sh
921 lib/copy-vmresources.sh
922 tools/Makefile
923 examples/Makefile
924 examples/Makefile.jawt
925 examples/Makefile.java2d])
926
927 if test "x${COMPILE_WRAPPERS}" = xno
928 then
929 AC_CONFIG_FILES([tools/gappletviewer
930 tools/gjarsigner
931 tools/gkeytool
932 tools/gjar
933 tools/gnative2ascii
934 tools/gserialver
935 tools/grmiregistry
936 tools/gtnameserv
937 tools/gorbd
938 tools/grmid
939 tools/grmic
940 tools/gjavah])
941 AC_CONFIG_COMMANDS([gappletviewer],[chmod 755 tools/gappletviewer])
942 AC_CONFIG_COMMANDS([gjarsigner],[chmod 755 tools/gjarsigner])
943 AC_CONFIG_COMMANDS([gkeytool],[chmod 755 tools/gkeytool])
944 AC_CONFIG_COMMANDS([gjar],[chmod 755 tools/gjar])
945 AC_CONFIG_COMMANDS([gnative2ascii],[chmod 755 tools/gnative2ascii])
946 AC_CONFIG_COMMANDS([gserialver],[chmod 755 tools/gserialver])
947 AC_CONFIG_COMMANDS([grmiregistry],[chmod 755 tools/grmiregistry])
948 AC_CONFIG_COMMANDS([gtnameserv],[chmod 755 tools/gtnameserv])
949 AC_CONFIG_COMMANDS([gorbd],[chmod 755 tools/gorbd])
950 AC_CONFIG_COMMANDS([grmid],[chmod 755 tools/grmid])
951 AC_CONFIG_COMMANDS([grmic],[chmod 755 tools/grmic])
952 AC_CONFIG_COMMANDS([gjavah], [chmod 755 tools/gjavah])
953 fi
954
955 AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
956 AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
957 AC_OUTPUT
958
959 # Create standard.omit based on decisions we just made.
960 cat ${srcdir}/lib/standard.omit.in > lib/standard.omit
961 if test x$use_escher != xtrue; then
962 echo gnu/java/awt/peer/x/.*java$ >> lib/standard.omit
963 fi