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