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