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 -----------------------------------------------------------
320CLASSPATH_TOOLEXECLIBDIR
321
322dnl -----------------------------------------------------------
323dnl Sets the native libraries installation dir
324dnl -----------------------------------------------------------
325dnl GCJ LOCAL: default to ${toolexeclibdir}/gcj-${gcc_version}-${libgcj_soversion}
326AC_ARG_WITH([native-libdir],
327	    [AS_HELP_STRING(--with-native-libdir,sets the installation directory for native libraries [default='${libdir}/${PACKAGE}'])],
328	    [
329	     nativeexeclibdir=${withval}
330	    ],
331	    [
332	     nativeexeclibdir='${toolexeclibdir}/gcj-'`cat ${srcdir}/../../gcc/BASE-VER`-`awk -F: '/^[[^#]].*:/ { print $1 }' ${srcdir}/../libtool-version`
333	    ])
334
335AC_SUBST(nativeexeclibdir)
336
337dnl -----------------------------------------------------------
338dnl Sets the Java library installation dir.
339dnl -----------------------------------------------------------
340AC_ARG_WITH([glibj-dir],
341	    [AS_HELP_STRING(--with-glibj-dir,sets the installation directory for glibj.zip [default='${libdir}/${PACKAGE}'])],
342	    [
343	     glibjdir=${withval}
344	    ],
345	    [
346	     glibjdir='${datadir}/${PACKAGE}'
347	    ])
348
349AC_SUBST(glibjdir)
350
351dnl -----------------------------------------------------------
352dnl Sets the Antlr jar to use for compiling gjdoc
353dnl -----------------------------------------------------------
354AC_ARG_WITH([antlr-jar],
355            [AS_HELP_STRING([--with-antlr-jar=file],[Use ANTLR from the specified jar file])],
356            [
357             ANTLR_JAR=$withval
358            ],
359            [
360             ANTLR_JAR="$ANTLR_JAR"
361            ])
362
363dnl -----------------------------------------------------------
364dnl Regenerate headers at build time (enabled if not found)
365dnl -----------------------------------------------------------
366AC_MSG_CHECKING([whether to regenerate the headers])
367AC_ARG_ENABLE([regen-headers],
368              [AS_HELP_STRING(--enable-regen-headers,automatically regenerate JNI headers [default=yes if headers don't exist])],
369              [case "${enableval}" in
370                yes) REGENERATE_JNI_HEADERS=yes ;;
371                no) REGENERATE_JNI_HEADERS=no ;;
372                *) REGENERATE_JNI_HEADERS=yes ;;
373              esac],
374              [if test -e ${srcdir}/include/java_lang_VMSystem.h; then
375			REGENERATE_JNI_HEADERS=no ;
376		   else
377			REGENERATE_JNI_HEADERS=yes ;
378	       fi])
379AC_MSG_RESULT(${REGENERATE_JNI_HEADERS})
380AM_CONDITIONAL(CREATE_JNI_HEADERS, test "x${REGENERATE_JNI_HEADERS}" = xyes)
381
382dnl ------------------------------------------------------------------------
383dnl Regenerate GJDoc parser at build time (enabled if not found)
384dnl ------------------------------------------------------------------------
385AC_MSG_CHECKING([whether to regenerate the GJDoc parser])
386AC_ARG_ENABLE([regen-gjdoc-parser],
387              [AS_HELP_STRING(--enable-regen-gjdoc-parser,automatically regenerate the GJDoc parser [default=yes if generated source doesn't exist])],
388              [case "${enableval}" in
389                yes) REGENERATE_GJDOC_PARSER=yes ;;
390                no) REGENERATE_GJDOC_PARSER=no ;;
391                *) REGENERATE_GJDOC_PARSER=yes ;;
392              esac],
393              [if test -e ${srcdir}/tools/generated/gnu/classpath/tools/gjdoc/expr/JavaLexer.java; then
394			REGENERATE_GJDOC_PARSER=no ;
395		   else
396			REGENERATE_GJDOC_PARSER=yes ;
397	       fi])
398AC_MSG_RESULT(${REGENERATE_GJDOC_PARSER})
399AM_CONDITIONAL(CREATE_GJDOC_PARSER, test "x${REGENERATE_GJDOC_PARSER}" = xyes)
400
401dnl -----------------------------------------------------------
402dnl Enable tool wrapper binaries (disabled by default)
403dnl -----------------------------------------------------------
404AC_ARG_ENABLE([tool-wrappers],
405              [AS_HELP_STRING(--enable-tool-wrappers,create tool wrapper binaries [default=no])],
406              [case x"${enableval}" in
407                xyes)
408                  COMPILE_WRAPPERS=yes;
409                  AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
410                  AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
411                  ;;
412                xno) COMPILE_WRAPPERS=no ;;
413		x) COMPILE_WRAPPERS=yes ;;
414                *) COMPILE_WRAPPERS=yes ;;
415              esac],
416              [COMPILE_WRAPPERS=no])
417AM_CONDITIONAL(CREATE_WRAPPERS, test "x${COMPILE_WRAPPERS}" = xyes)
418
419AC_PROG_LN_S
420AC_PROG_INSTALL
421
422dnl -----------------------------------------------------------
423dnl Checks for programs.
424dnl -----------------------------------------------------------
425
426dnl Initialize libtool
427AC_DISABLE_STATIC
428LT_INIT
429AC_PROG_AWK
430AC_PROG_CC
431AM_PROG_CC_C_O
432AC_PROG_CPP
433AC_PROG_CXX
434
435# Handle -Werror default case.
436if test "$ENABLE_WERROR" = default; then
437  case "$host_os" in
438    *linux*)
439      if test "$GCC" = yes; then
440        ENABLE_WERROR=yes
441      fi
442      ;;
443  esac
444fi
445
446if test "x${COMPILE_COLLECTIONS}" = xyes; then
447  AC_PATH_PROG(PERL, [perl])
448  AC_SUBST(PERL)
449  AC_SUBST(COLLECTIONS_PREFIX)
450  AC_CONFIG_FILES([lib/mkcollections.pl])
451  AC_CONFIG_COMMANDS([mkcollections.pl],[chmod 755 lib/mkcollections.pl])
452fi
453
454if test "x${COMPILE_JNI}" = xyes; then
455  GCC_ATTRIBUTE_UNUSED
456
457  AC_HEADER_STDC
458
459  dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64,
460  dnl at least.
461  AC_COMPILE_CHECK_SIZEOF(void *)
462
463  dnl Checking for endianess.
464  AC_C_BIGENDIAN_CROSS
465
466  dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
467  dnl On that system, sys/ioctl.h will not include sys/filio.h unless
468  dnl BSD_COMP is defined; just including sys/filio.h is simpler.
469  dnl Check for crt_externs.h on Darwin.
470  dnl Check for netinet/in_systm.h, netinet/ip.h and net/if.h for Windows CE.
471  dnl Check for sys/loadavg.h for getloadavg() on Solaris 9.
472  dnl Check for sys/sockio.h for SIOCGIFFLAGS on OpenSolaris.
473  AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h \
474		    asm/ioctls.h \
475		    inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
476		    sys/time.h \
477		    sys/select.h \
478		    crt_externs.h \
479                    fcntl.h \
480		    sys/mman.h \
481		    magic.h \
482                    sys/event.h sys/epoll.h \
483		    ifaddrs.h \
484		    netinet/in_systm.h netinet/ip.h net/if.h \
485		    sys/loadavg.h sys/sockio.h])
486
487  AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
488  AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
489  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]))
490  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]))
491
492  AC_SEARCH_LIBS([clock_gettime], [rt])
493  AC_SEARCH_LIBS([inet_pton],[nsl])
494  AC_CHECK_LIB([socket], [gethostname])
495
496  AC_CHECK_FUNCS([ftruncate fsync select \
497		  gethostname socket strerror fork pipe execve open close \
498		  lseek fstat read readv write writev htonl memset htons connect \
499		  getsockname getpeername bind listen accept \
500		  recvfrom send sendto setsockopt getsockopt time mktime clock_gettime \
501		  gethostbyname_r localtime_r \
502		  strerror_r \
503                  fcntl \
504		  statvfs \
505		  mmap munmap mincore msync madvise getpagesize sysconf \
506		  lstat readlink \
507 		  inet_aton inet_addr inet_pton \
508		  getifaddrs kqueue kevent epoll_create \
509                  getloadavg])
510
511  LIBMAGIC=
512  AC_CHECK_LIB(magic, magic_open, LIBMAGIC=-lmagic)
513  AC_SUBST(LIBMAGIC)
514
515  AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
516  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[struct sockaddr_in6 addr6;]])],
517                    [AC_DEFINE(HAVE_INET6, 1,
518                     [Define if inet6 structures are defined in netinet/in.h.])
519                     AC_MSG_RESULT(yes)],
520                    [AC_MSG_RESULT(no)])
521
522  AC_HEADER_TIME
523  AC_STRUCT_TM
524  AC_STRUCT_TIMEZONE
525
526  AC_MSG_CHECKING([for tm_gmtoff in struct tm])
527  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
528  [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
529   AC_MSG_RESULT(yes)],
530  [AC_MSG_RESULT(no)
531   AC_MSG_CHECKING([for global timezone variable])
532   dnl FIXME: we don't want a link check here because that won't work
533   dnl when cross-compiling.  So instead we make an assumption that
534   dnl the header file will mention timezone if it exists.
535   dnl Don't find the win32 function timezone
536   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
537     [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
538      AC_MSG_RESULT(yes)],
539     [AC_MSG_RESULT(no)
540       AC_MSG_CHECKING([for global _timezone variable])
541       dnl FIXME: As above, don't want link check
542       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
543         [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
544            [Define if your platform has the global _timezone variable.])
545          AC_MSG_RESULT(yes)],
546          [AC_MSG_RESULT(no)])])])
547
548  AC_C_CONST
549  AC_C_INLINE
550  AC_C_ATTRIBUTE
551  AX_FUNC_WHICH_GETHOSTBYNAME_R
552
553  dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
554  AM_ICONV
555
556  dnl When using gcc we want warnings, lots of warnings :-)
557  if test "x${GCC}" = xyes; then
558    dnl We want ISO C90 ansi, but with longlong (jlong) support
559    dnl and modern POSIX and BSD C library functions/prototypes.
560
561    dnl Warning flags for (almost) everybody.
562    dnl Should probably be configurable
563    WARNING_CFLAGS='-W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long'
564    AC_SUBST(WARNING_CFLAGS)
565
566    dnl CFLAGS that are used for all native code.  We want to compile
567    dnl everything with unwinder data so that backtrace() will always
568    dnl work.
569    EXTRA_CFLAGS='-fexceptions -fasynchronous-unwind-tables'
570    AC_SUBST(EXTRA_CFLAGS)
571
572    dnl Strict warning flags which not every module uses.
573    dnl Should probably be configurable.
574    STRICT_WARNING_CFLAGS='-Wstrict-prototypes -pedantic'
575    AC_SUBST(STRICT_WARNING_CFLAGS)
576
577    dnl Whether or not to add -Werror, also not used by all modueles.
578    dnl Can be configured by --disable-Werror
579    ERROR_CFLAGS=
580    if test "x${ENABLE_WERROR}" = xyes; then
581       ERROR_CFLAGS='-Werror'
582    fi
583    AC_SUBST(ERROR_CFLAGS)
584  fi
585
586  dnl Check for libxml and libxslt libraries (when xmlj is enabled).
587  if test "x${COMPILE_XMLJ}" = xyes; then
588    PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.6.8)
589    PKG_CHECK_MODULES(XSLT, libxslt >= 1.1.11)
590    AC_SUBST(XML_LIBS)
591    AC_SUBST(XML_CFLAGS)
592    AC_SUBST(XSLT_LIBS)
593    AC_SUBST(XSLT_CFLAGS)
594  fi
595
596  dnl Check for AWT related gthread/gtk
597  if test "x${COMPILE_GTK_PEER}" = xyes; then
598    AC_PATH_XTRA
599    if test "$no_x" = yes; then
600        AC_MSG_ERROR([GTK+ peers requested but no X library available])
601    fi
602    dnl Check if we can link against the XTest library and set
603    dnl HAVE_XTEST accordingly.
604    AC_CHECK_LIB([Xtst], [XTestQueryExtension],
605                 [AC_DEFINE(HAVE_XTEST, 1, [Define to 1 if you have libXtst.])[XTEST_LIBS="$XTEST_LIBS -X11 -lXtst"]],
606                 [true],
607                 [${X_LIBS}])
608
609
610    PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
611    PKG_CHECK_MODULES(FREETYPE2, freetype2)
612    PKG_CHECK_MODULES(PANGOFT2, pangoft2)
613    PKG_CHECK_MODULES(CAIRO, cairo >= 1.1.8)
614    dnl Check if we can link against the XRender library and set
615    dnl HAVE_XRENDER accordingly.
616    AC_CHECK_LIB([Xrender], [XRenderQueryExtension],
617		 [AC_DEFINE(HAVE_XRENDER, 1, [Define to 1 if you have libXrender.])[X_EXTRA_LIBS="$X_EXTRA_LIBS -lXrender"]],
618		 [true],
619		 [${X_LIBS}])
620
621    dnl Check if we can link against the XRandR library and set
622    dnl HAVE_XRANDR accordingly.
623    AC_CHECK_LIB([Xrandr], [XRRQueryExtension],
624                 [AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have libXrandr.])[X_EXTRA_LIBS="$X_EXTRA_LIBS -lXrandr"]],
625                 [true],
626                 [${X_LIBS}])
627
628    AC_SUBST(GTK_CFLAGS)
629    AC_SUBST(GTK_LIBS)
630    AC_SUBST(FREETYPE2_LIBS)
631    AC_SUBST(FREETYPE2_CFLAGS)
632    AC_SUBST(PANGOFT2_LIBS)
633    AC_SUBST(PANGOFT2_CFLAGS)
634    AC_SUBST(XTEST_LIBS)
635  fi
636
637  dnl gconf-peer
638  if  test "x${COMPILE_GCONF_PEER}" = xyes; then
639    PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.6.0)
640    AC_SUBST(GCONF_CFLAGS)
641    AC_SUBST(GCONF_LIBS)
642    dnl we also need gdk for locking
643    PKG_CHECK_MODULES(GDK, gdk-2.0 >= 2.8)
644    AC_SUBST(GDK_CFLAGS)
645    AC_SUBST(GDK_LIBS)
646    dnl check if the config value was given form the command line,
647    dnl if not, overwrite the default if we have the gconf backend
648    dnl compiled in
649    USE_GCONF_PREFS_PEER=$enable_default_preferences_peer
650    if test "$USE_GCONF_PREFS_PEER" = ""; then
651      DEFAULT_PREFS_PEER=gnu.java.util.prefs.GConfBasedFactory
652    fi
653  fi
654
655  dnl gstreamer-peer
656  if  test "x${COMPILE_GSTREAMER_PEER}" = xyes; then
657    GST_MAJORMINOR=0.10
658    GST_REQUIRED=0.10.10
659
660    dnl gstreamer
661    PKG_CHECK_MODULES(GSTREAMER, gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED)
662    AC_SUBST(GSTREAMER_CFLAGS)
663    AC_SUBST(GSTREAMER_LIBS)
664
665    dnl gstreamer-base
666    PKG_CHECK_MODULES(GSTREAMER_BASE,
667                      gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED)
668    AC_SUBST(GSTREAMER_BASE_CFLAGS)
669    AC_SUBST(GSTREAMER_BASE_LIBS)
670
671    dnl gstreamer-plugin-base
672    PKG_CHECK_MODULES(GSTREAMER_PLUGINS_BASE,
673                      gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQUIRED)
674    AC_SUBST(GSTREAMER_PLUGINS_BASE_CFLAGS)
675    AC_SUBST(GSTREAMER_PLUGINS_BASE_LIBS)
676
677	GST_PLUGIN_LDFLAGS='-module -avoid-version -Wno-unused-parameter -no-undefined'
678	AC_SUBST(GST_PLUGIN_LDFLAGS)
679
680    PKG_CHECK_MODULES(GDK, gdk-2.0 >= 2.8)
681    AC_SUBST(GDK_CFLAGS)
682    AC_SUBST(GDK_LIBS)
683
684	dnl set the gstreamer based file reader, writer and mixer
685	GSTREAMER_FILE_READER=gnu.javax.sound.sampled.gstreamer.io.GstAudioFileReader
686	GSTREAMER_MIXER_PROVIDER=gnu.javax.sound.sampled.gstreamer.GStreamerMixerProvider
687  fi
688  dnl add the gstreamer resources
689  AC_SUBST(GSTREAMER_FILE_READER)
690  AC_SUBST(GSTREAMER_MIXER_PROVIDER)
691
692  dnl Check for AWT related Qt4
693  if test "x${COMPILE_QT_PEER}" = xyes; then
694    PKG_CHECK_MODULES(QT, QtCore QtGui >= 4.1.0, HAVE_QT4="yes", HAVE_QT4="no")
695    if test "x$HAVE_QT4" = "xyes"; then
696      dnl Check needed because in some cases the QtGui includedir
697      dnl doesn't contain the subsystem dir.
698      QT_INCLUDE_DIR=`$PKG_CONFIG --variable=includedir QtGui`
699      EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
700      AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
701      AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
702      AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
703	QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
704	AC_MSG_WARN([QWidget not found])))
705	AC_CHECK_PROG(MOC, [moc], [moc])
706	AC_CHECK_PROG(MOC4, [moc-qt4], [moc-qt4])
707	if test x"$MOC4" != x ; then
708	  AC_MSG_NOTICE([Using $MOC4 as moc])
709	  MOC=$MOC4;
710	fi
711    fi
712    if test "x$HAVE_QT4" = "xno"; then
713      AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
714      case "$host_os" in
715  	darwin*)
716  	  AC_ARG_WITH([qt4dir],
717  	    [AS_HELP_STRING([--with-qt4dir=DIR],
718  	    [Qt4 installation directory used for OS-X.
719  	    For other systems use pkg-config.])],
720  	    [QT4DIR=$withval]
721  	    )
722  	  if test x"$QT4DIR" = x ; then
723  	    AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
724  	  fi
725  	  AC_MSG_RESULT([QT4DIR... $QT4DIR])
726  	  AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
727  	  if test x"$MOC" = x; then
728  	    AC_MSG_ERROR([*** This is not the right Qt installation])
729  	  fi
730  	  QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
731  	  QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
732  	  QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
733  	  QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
734  	  ;;
735  	*)
736  	  AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
737  	  of your installed Qt4 installation.])
738  	  ;;
739      esac
740    fi
741    AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
742    AC_SUBST(QT_CFLAGS)
743    AC_SUBST(QT_LIBS)
744  fi
745  dnl **********************************************************************
746  dnl Check for MSG_NOSIGNAL
747  dnl **********************************************************************
748  AC_MSG_CHECKING(for MSG_NOSIGNAL)
749  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[ int f = MSG_NOSIGNAL; ]])],[ AC_MSG_RESULT(yes)
750     AC_DEFINE(HAVE_MSG_NOSIGNAL, 1,
751     	       [Define this symbol if you have MSG_NOSIGNAL]) ],[ AC_MSG_RESULT(no)
752  ])
753 dnl **********************************************************************
754 dnl Check for SO_NOSIGPIPE (Darwin equivalent for MSG_NOSIGNAL)
755 dnl **********************************************************************
756 AC_MSG_CHECKING(for SO_NOSIGPIPE )
757 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[ int f = SO_NOSIGPIPE; ]])],[ AC_MSG_RESULT(yes)
758    AC_DEFINE(HAVE_SO_NOSIGPIPE, 1,
759    	      [Define this symbol if you have SO_NOSIGPIPE]) ],[ AC_MSG_RESULT(no)
760 ])
761  dnl **********************************************************************
762  dnl Check for MSG_WAITALL
763  dnl **********************************************************************
764  AC_MSG_CHECKING(for MSG_WAITALL)
765  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[ int f = MSG_WAITALL; ]])],[ AC_MSG_RESULT(yes)
766     AC_DEFINE(HAVE_MSG_WAITALL, 1,
767     	       [Define this symbol if you have MSG_WAITALL]) ],[ AC_MSG_RESULT(no)
768  ])
769
770  dnl Check for plugin support headers and libraries.
771  if test "x${COMPILE_PLUGIN}" = xyes; then
772    PKG_CHECK_MODULES(MOZILLA, mozilla-plugin libxul-unstable, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
773    if test "x${MOZILLA_FOUND}" = xno; then
774      PKG_CHECK_MODULES(MOZILLA, mozilla-plugin, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
775    fi
776    if test "x${MOZILLA_FOUND}" = xno; then
777      PKG_CHECK_MODULES(MOZILLA, firefox-plugin firefox-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
778    fi
779    if test "x${MOZILLA_FOUND}" = xno; then
780      PKG_CHECK_MODULES(MOZILLA, xulrunner-plugin xulrunner-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
781    fi
782    if test "x${MOZILLA_FOUND}" = xno; then
783      PKG_CHECK_MODULES(MOZILLA, mozilla-firefox-plugin mozilla-firefox-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
784    fi
785    if test "x${MOZILLA_FOUND}" = xno; then
786      PKG_CHECK_MODULES(MOZILLA, seamonkey-plugin seamonkey-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
787    fi
788    if test "x${MOZILLA_FOUND}" = xno; then
789      PKG_CHECK_MODULES(MOZILLA, iceape-plugin iceape-xpcom, [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
790    fi
791    if test "x${MOZILLA_FOUND}" = xno; then
792      AC_MSG_ERROR([Couldn't find plugin support headers and libraries, try --disable-plugin])
793    fi
794
795    PKG_CHECK_MODULES(GLIB, glib-2.0)
796    PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.8 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
797
798    AC_SUBST(MOZILLA_CFLAGS)
799    AC_SUBST(MOZILLA_LIBS)
800    AC_SUBST(GLIB_CFLAGS)
801    AC_SUBST(GLIB_LIBS)
802    AC_SUBST(GTK_CFLAGS)
803    AC_SUBST(GTK_LIBS)
804
805    AC_SUBST(PLUGIN_DIR, $HOME/.mozilla/plugins/)
806  fi
807
808  dnl Check for GNU MP library and header file
809  dnl for GNU MP versions >= 4.2 use __gmpz_combit; otherwise look for
810  dnl __gmpz_mul_si for earlier versions (>= 3.1).
811  dnl IMPORTANT: if you decide to look for __gmpz_combit, don't forget to
812  dnl change the name of the corresponding ac_ variable on lines 860...
813  AC_ARG_WITH(gmp, [  --with-gmp=PATH         specify prefix directory for the installed GMP package.
814                          Equivalent to --with-gmp-include=PATH/include
815                          plus --with-gmp-lib=PATH/lib])
816  AC_ARG_WITH(gmp_include, [  --with-gmp-include=PATH specify directory for installed GMP include files])
817  AC_ARG_WITH(gmp_lib, [  --with-gmp-lib=PATH     specify directory for the installed GMP library])
818
819  if test "x$with_gmp" != x; then
820    gmplibs=-lgmp
821    gmpinc=
822    gmplibs="-L$with_gmp/lib $gmplibs"
823    gmpinc="-I$with_gmp/include $gmpinc"
824    if test "x$with_gmp_include" != x; then
825      gmpinc="-I$with_gmp_include $gmpinc"
826    fi
827    if test "x$with_gmp_lib" != x; then
828      gmplibs="-L$with_gmp_lib $gmplibs"
829    fi
830  else
831    gmplibs="-lgmp"
832    gmpinc="-I/usr/include"
833  fi
834
835  if test "x${COMPILE_GMP}" = xyes; then
836    AC_MSG_CHECKING([for GMP directories])
837    if test "x$with_gmp" != x; then
838       gmplibs="-L$with_gmp/lib -lgmp"
839       gmpinc="-I$with_gmp/include"
840       if test "x$with_gmp_include" != x; then
841       	  gmpinc="-I$with_gmp_include $gmpinc"
842       fi
843       if test "x$with_gmp_lib" != x; then
844       	  gmplibs="-L$with_gmp_lib $gmplibs"
845       fi
846    else
847        with_gmp="/usr"
848	gmplibs="-lgmp"
849    	gmpinc="-I/usr/include"
850    fi
851    AC_MSG_RESULT([prefix=$with_gmp, libs=$gmplibs, inc=$gmpinc])
852    AC_CHECK_LIB(gmp, __gmpz_mul_si,
853      [GMP_CFLAGS="$gmpinc"
854       GMP_LIBS="$gmplibs" ],
855      [GMP_CFLAGS=
856       GMP_LIBS= ])
857    AC_SUBST(GMP_CFLAGS)
858    AC_SUBST(GMP_LIBS)
859
860    AC_CHECK_HEADERS([gmp.h])
861  fi
862
863else
864  COMPILE_GMP=no
865fi
866
867if test "x${REGENERATE_JNI_HEADERS}" = xyes; then
868  CLASSPATH_WITH_JAVAH
869fi
870
871dnl -----------------------------------------------------------
872dnl Add the include files for the native abstraction layer.
873dnl Used by AM_CPPFLAGS in the different modules.
874dnl -----------------------------------------------------------
875CLASSPATH_INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/native/jni/classpath -I\$(top_srcdir)/native/jni/native-lib"
876AC_SUBST(CLASSPATH_INCLUDES)
877
878dnl -----------------------------------------------------------
879if test "x${COMPILE_JNI}" = xyes; then
880  AC_MSG_CHECKING(jni_md.h support)
881  if test -f ${srcdir}/include/jni_md-${target_cpu}-${target_os}.h; then
882    AC_MSG_RESULT(yes)
883  else
884    target_cpu=x86
885    target_os=linux-gnu
886    AC_MSG_WARN(no, using x86-linux-gnu)
887  fi
888  ac_sources="include/jni_md-${target_cpu}-${target_os}.h"
889  ac_dests="include/jni_md.h"
890  while test -n "$ac_sources"; do
891    set $ac_dests; ac_dest=$1; shift; ac_dests=$*
892    set $ac_sources; ac_source=$1; shift; ac_sources=$*
893    ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
894  done
895  AC_CONFIG_LINKS([$ac_config_links_1])
896fi
897
898CLASSPATH_WITH_CLASSLIB
899
900dnl -----------------------------------------------------------
901dnl Initialize maintainer mode
902dnl -----------------------------------------------------------
903AM_MAINTAINER_MODE
904
905dnl -----------------------------------------------------------
906dnl Enable debugging statements at compile time.  By default
907dnl these statements should be optimized out of the bytecode
908dnl produced by an optimizing Java compiler and not hinder
909dnl performance because debugging is turned off by default.
910dnl -----------------------------------------------------------
911AC_ARG_ENABLE([debug],
912              [AS_HELP_STRING(--enable-debug,enable runtime debugging code)],
913              [case "${enableval}" in
914                yes)
915              	LIBDEBUG="true"
916                AC_DEFINE(DEBUG, 1, [Define to 1 if you want native library runtime debugging code enabled])
917              	;;
918                no)   LIBDEBUG="false" ;;
919                *) 	AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
920              esac],
921              [LIBDEBUG="false"])
922AC_SUBST(LIBDEBUG)
923
924dnl -----------------------------------------------------------
925dnl Enable execution of all static initializer loadLibrary()
926dnl calls at compile time.  By default most people will not
927dnl want to disable this, but some VMs (gcj) don't need or want
928dnl them.
929dnl -----------------------------------------------------------
930AC_ARG_ENABLE([load-library],
931              [AS_HELP_STRING(--enable-load-library,enable to use JNI native methods [default=yes])],
932              [case "${enableval}" in
933                yes) INIT_LOAD_LIBRARY="true" ;;
934                no) INIT_LOAD_LIBRARY="false" ;;
935                *) AC_MSG_ERROR(bad value ${enableval} for --enable-load-library) ;;
936              esac],
937              [INIT_LOAD_LIBRARY="true"])
938AC_SUBST(INIT_LOAD_LIBRARY)
939
940
941dnl -----------------------------------------------------------
942dnl Specify the jar file containing the Eclipse Java Compiler.  If
943dnl this option is not specified then the com.sun.tools.javac
944dnl implementation will not be included in tools.zip.
945dnl -----------------------------------------------------------
946dnl GCJ LOCAL: default to $multi_basedir/ecj.jar
947dnl In the default case where $multi_basedir/ecj.jar is found
948dnl $(jardir)/ecj.jar will not expand properly in GNU Classpath's
949dnl gnu/classpath/Configuration.java.  That is OK though since libjava's
950dnl gnu/classpath/Configuration.java overrides GNU Classpath's and
951dnl ECJ_JAR_FILE will be properly expanded in libjava's
952dnl gnu/classpath/natConfiguration.cc.
953AC_ARG_WITH([ecj-jar],
954  	    [AS_HELP_STRING([--with-ecj-jar=ABS.PATH],
955  	    [specify jar file containing the Eclipse Java Compiler])],
956  	    [ECJ_JAR=$withval],
957	    [if test -f $multi_basedir/ecj.jar; then
958	       ECJ_JAR='$(jardir)/ecj.jar'
959	     fi])
960AC_SUBST(ECJ_JAR)
961
962dnl -----------------------------------------------------------
963dnl Should the VM explicitly run class initialization subfunctions for
964dnl java.lang.System?   (default is false -- the subfunctions will be run
965dnl automatically by the class initializer)
966dnl -----------------------------------------------------------
967AC_ARG_ENABLE([java-lang-system-explicit-initialization],
968              [AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM explicitly invoke java.lang.System's static initialization methods [default=no])],
969              [case "${enableval}" in
970                yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
971                no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
972                *) AC_MSG_ERROR(bad value ${enableval} for --enable-java-lang-system-explicit-initialization) ;;
973              esac],
974              [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
975AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
976
977
978dnl -----------------------------------------------------------
979dnl avoiding automake complaints
980dnl -----------------------------------------------------------
981REMOVE=""
982AC_SUBST(REMOVE)
983
984dnl -----------------------------------------------------------
985dnl This is probably useless.
986dnl -----------------------------------------------------------
987AC_PATH_PROG(MKDIR, mkdir)
988AC_PATH_PROG(CP, cp)
989AC_PATH_PROG(DATE, date)
990
991dnl -----------------------------------------------------------
992dnl According to the GNU coding guide, we shouldn't require find,
993dnl and zip, however GNU provides both so it should be okay
994dnl -----------------------------------------------------------
995AC_PATH_PROG(FIND, find)
996
997dnl -----------------------------------------------------------
998dnl Specify what to install (install only glibj.zip by default)
999dnl -----------------------------------------------------------
1000CLASSPATH_WITH_GLIBJ
1001
1002dnl -----------------------------------------------------------
1003dnl Enable API documentation generation (disabled by default)
1004dnl -----------------------------------------------------------
1005CLASSPATH_WITH_GJDOC
1006
1007dnl -----------------------------------------------------------
1008dnl Whether to use jay to regenerate parsers.
1009dnl -----------------------------------------------------------
1010REGEN_WITH_JAY
1011
1012dnl -----------------------------------------------------------
1013dnl This sets the build-time default, which can now be overridden
1014dnl by setting the system property gnu.classpath.awt.gtk.portable.native.sync
1015dnl to "true" or "false".
1016dnl -----------------------------------------------------------
1017AC_ARG_ENABLE([portable-native-sync],
1018              [AS_HELP_STRING(--enable-portable-native-sync,synchronize VM threads portably)],
1019              [case "${enableval}" in
1020                yes)
1021                     AC_DEFINE(PORTABLE_NATIVE_SYNC, 1, [Define if you want to synchronize VM threads portably by default; undef otherwise])
1022                     ;;
1023                no)  ;;
1024                *)
1025                     AC_MSG_ERROR(bad value ${enableval} for --enable-portable-native-sync)
1026                     ;;
1027              esac],
1028              [])
1029
1030AX_CREATE_STDINT_H([include/config-int.h])
1031
1032dnl -----------------------------------------------------------------------
1033dnl                    Support for using a prebuilt class library
1034dnl -----------------------------------------------------------------------
1035AC_ARG_WITH([glibj_zip],
1036            AS_HELP_STRING([--with-glibj-zip=ABS.PATH],
1037                           [use prebuilt glibj.zip class library]))
1038
1039case "$with_glibj_zip" in
1040"")
1041        use_glibj_zip=false
1042        ;;
1043"no" )
1044        use_glibj_zip=false
1045        ;;
1046"yes")
1047        AC_MSG_ERROR([Please suply an absolute path to a prebuilt glibj.zip])
1048        ;;
1049*)
1050        use_glibj_zip=true
1051        PATH_TO_GLIBJ_ZIP=$with_glibj_zip
1052	;;
1053esac;
1054
1055AM_CONDITIONAL(USE_PREBUILT_GLIBJ_ZIP, test x$use_glibj_zip = xtrue)
1056AC_SUBST(PATH_TO_GLIBJ_ZIP)
1057
1058if test "x${TOOLSDIR}" != x; then
1059  dnl GCJ LOCAL
1060  if test "x${COMPILE_WRAPPERS}" = xno && test "x${enable_java_maintainer_mode}" = xyes; then
1061    AC_PROG_JAVA_WORKS
1062  fi
1063  dnl END GCJ LOCAL
1064  if test "x${COMPILE_GJDOC}" = xyes; then
1065    AC_LIB_ANTLR
1066    dnl GCJ LOCAL
1067    if test "x${REGENERATE_GJDOC_PARSER}" = xyes && test "x${enable_java_maintainer_mode}" = xyes; then
1068    dnl END GCJ LOCAL
1069	AC_PROG_ANTLR(2,7,1)
1070    fi
1071  fi
1072fi
1073
1074
1075# Check for javac if we need to build either the class library,
1076# the examples or the tools
1077if test "x${use_glibj_zip}" = xfalse || \
1078   test "x${EXAMPLESDIR}" != x || \
1079   test "x${TOOLSDIR}" != x && \
1080   test "x${build_class_files}" != xno && \
1081   test "${enable_java_maintainer_mode}" = yes; then dnl GCJ_LOCAL
1082	AC_PROG_JAVAC_WORKS
1083  	CLASSPATH_JAVAC_MEM_CHECK
1084else
1085   AM_CONDITIONAL(GCJ_JAVAC, false)
1086fi
1087
1088dnl -----------------------------------------------------------
1089dnl Build with Escher based X peers.
1090dnl -----------------------------------------------------------
1091AC_ARG_WITH([escher],
1092	 AS_HELP_STRING([--with-escher=ABS.PATH],
1093	                [specify path to escher dir or JAR for X peers]))
1094case "$with_escher" in
1095"")
1096        use_escher=false
1097        ;;
1098"no")
1099        use_escher=false
1100        ;;
1101"yes")
1102        AC_MSG_ERROR([Please supply an absolute path to Escher library])
1103        ;;
1104*)
1105        use_escher=true
1106        PATH_TO_ESCHER=$with_escher
1107        ;;
1108esac
1109
1110AM_CONDITIONAL(USE_ESCHER, test x$use_escher = xtrue)
1111AC_SUBST(PATH_TO_ESCHER)
1112
1113dnl -----------------------------------------------------------
1114dnl Check if local socket support should be included.
1115dnl -----------------------------------------------------------
1116AC_ARG_ENABLE([local-sockets],
1117              [AS_HELP_STRING(--enable-local-sockets,enables local (AF_LOCAL) socket API [default: no])],
1118              [case "${enableval}" in
1119                yes)
1120                  ENABLE_LOCAL_SOCKETS=yes
1121                  ;;
1122                *)
1123                  ENABLE_LOCAL_SOCKETS=no
1124                  ;;
1125               esac],
1126              [])
1127if test "x$ENABLE_LOCAL_SOCKETS" = "xyes"
1128then
1129  AC_CHECK_HEADER([sys/un.h])
1130  AC_CHECK_FUNCS([read write bind listen accept shutdown], [],
1131                 AC_MSG_ERROR([networking support not available]))
1132  AC_DEFINE(ENABLE_LOCAL_SOCKETS, [1], [Define to enable support for local sockets.])
1133fi
1134AM_CONDITIONAL(ENABLE_LOCAL_SOCKETS, test "x$ENABLE_LOCAL_SOCKETS" = "xyes")
1135
1136dnl -----------------------------------------------------------
1137dnl Add the default preference peer
1138dnl -----------------------------------------------------------
1139AC_SUBST(DEFAULT_PREFS_PEER)
1140
1141dnl -----------------------------------------------------------
1142dnl Set GNU MP related params
1143dnl -----------------------------------------------------------
1144WANT_NATIVE_BIG_INTEGER=false
1145if test "x${COMPILE_GMP}" = xyes; then
1146  if test "x${ac_cv_lib_gmp___gmpz_mul_si}" = xyes; then
1147    if test "x${ac_cv_header_gmp_h}" = xyes; then
1148      WANT_NATIVE_BIG_INTEGER=true
1149      AC_DEFINE(WITH_GNU_MP, 1, [Define to 1 if gmp is usable])
1150    else
1151      COMPILE_GMP=no
1152    fi
1153  else
1154    COMPILE_GMP=no
1155  fi
1156fi
1157AC_SUBST(WANT_NATIVE_BIG_INTEGER)
1158AM_CONDITIONAL(CREATE_GMPBI_LIBRARY, test "x${COMPILE_GMP}" = xyes)
1159
1160dnl -----------------------------------------------------------
1161dnl output files
1162dnl -----------------------------------------------------------
1163AC_CONFIG_FILES([Makefile
1164doc/Makefile
1165doc/api/Makefile
1166external/Makefile
1167external/sax/Makefile
1168external/w3c_dom/Makefile
1169external/relaxngDatatype/Makefile
1170external/jsr166/Makefile
1171gnu/classpath/Configuration.java
1172gnu/java/security/Configuration.java
1173include/Makefile
1174native/Makefile
1175native/fdlibm/Makefile
1176native/jawt/Makefile
1177native/jni/Makefile
1178native/jni/classpath/Makefile
1179native/jni/java-io/Makefile
1180native/jni/java-lang/Makefile
1181native/jni/java-math/Makefile
1182native/jni/java-net/Makefile
1183native/jni/java-nio/Makefile
1184native/jni/java-util/Makefile
1185native/jni/gtk-peer/Makefile
1186native/jni/gconf-peer/Makefile
1187native/jni/gstreamer-peer/Makefile
1188native/jni/qt-peer/Makefile
1189native/jni/xmlj/Makefile
1190native/jni/midi-alsa/Makefile
1191native/jni/midi-dssi/Makefile
1192native/jni/native-lib/Makefile
1193native/plugin/Makefile
1194resource/Makefile
1195resource/META-INF/services/java.util.prefs.PreferencesFactory
1196resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader
1197resource/META-INF/services/javax.sound.sampled.spi.MixerProvider
1198scripts/Makefile
1199scripts/classpath.spec
1200lib/Makefile
1201lib/gen-classlist.sh
1202lib/copy-vmresources.sh
1203scripts/check_jni_methods.sh
1204tools/Makefile
1205examples/Makefile
1206examples/Makefile.jawt
1207examples/Makefile.java2d])
1208
1209CLASSPATH_COND_IF([CREATE_WRAPPERS], [test "x${COMPILE_WRAPPERS}" = xyes], [],
1210[AC_CONFIG_FILES([tools/gappletviewer
1211tools/gjarsigner
1212tools/gkeytool
1213tools/gjar
1214tools/gnative2ascii
1215tools/gserialver
1216tools/grmiregistry
1217tools/gtnameserv
1218tools/gorbd
1219tools/grmid
1220tools/grmic
1221tools/gjavah])
1222
1223AC_CONFIG_COMMANDS([gappletviewer],[chmod 755 tools/gappletviewer])
1224AC_CONFIG_COMMANDS([gjarsigner],[chmod 755 tools/gjarsigner])
1225AC_CONFIG_COMMANDS([gkeytool],[chmod 755 tools/gkeytool])
1226AC_CONFIG_COMMANDS([gjar],[chmod 755 tools/gjar])
1227AC_CONFIG_COMMANDS([gnative2ascii],[chmod 755 tools/gnative2ascii])
1228AC_CONFIG_COMMANDS([gserialver],[chmod 755 tools/gserialver])
1229AC_CONFIG_COMMANDS([grmiregistry],[chmod 755 tools/grmiregistry])
1230AC_CONFIG_COMMANDS([gtnameserv],[chmod 755 tools/gtnameserv])
1231AC_CONFIG_COMMANDS([gorbd],[chmod 755 tools/gorbd])
1232AC_CONFIG_COMMANDS([grmid],[chmod 755 tools/grmid])
1233AC_CONFIG_COMMANDS([grmic],[chmod 755 tools/grmic])
1234AC_CONFIG_COMMANDS([gjavah], [chmod 755 tools/gjavah])
1235])
1236
1237if test "x${COMPILE_GJDOC}" = xyes
1238then
1239AC_CONFIG_FILES([tools/gjdoc])
1240AC_CONFIG_COMMANDS([gjdoc], [chmod 755 tools/gjdoc])
1241fi
1242
1243AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
1244AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
1245AC_OUTPUT
1246
1247# Create standard.omit based on decisions we just made.
1248cat ${srcdir}/lib/standard.omit.in > lib/standard.omit
1249if test x$use_escher != xtrue; then
1250   echo gnu/java/awt/peer/x/.*java$ >> lib/standard.omit
1251fi
1252
1253if test "x${COMPILE_PLUGIN}" = "xyes" ; then
1254  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.])
1255fi
1256