OSDN Git Service

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