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