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