OSDN Git Service

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