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