1dnl Modifications Copyright (C) 2004, 2005 by Etienne Gagnon.
2dnl Modifications Copyright (C) 2004 by David Belanger.
3dnl Modifications Copyright (C) 2004, 2005 by Grzegorz Prokopski.
4
5dnl Process this file with autoconf to produce a configure script.
6
7dnl -----------------------------------------------------------
8dnl Turning off cache for debug reasons
9dnl -----------------------------------------------------------
10dnl define([AC_CACHE_LOAD], )dnl
11dnl define([AC_CACHE_SAVE], )dnl
12
13dnl *** IMPORTANT: Uncomment the apropriate line below. ***
14dnl a) uncomment for official releases.  Please update version number.
15AC_INIT([sablevm-classpath], [1.13], [http://sablevm.org/])
16dnl b) uncomment for development on the trunk
17dnl AC_INIT([sablevm-classpath], [trunk+]esyscmd([svn info | grep ^Revision: | awk '{print $2}' | head -n 1 | xargs echo -n]), [http://sablevm.org/])
18dnl c) uncomment for development on branches.  Please update branch name.
19dnl AC_INIT([sablevm-classpath], [merge+]esyscmd([svn info | grep ^Revision: | awk '{print $2}' | head -n 1 | xargs echo -n]), [http://sablevm.org/])
20dnl The following code makes sure that a branch version has been
21dnl selected above, when developing on a branch in a subversion working
22dnl copy.
23dnl
24dnl If one of the svn, grep or cut command is missing, the script assumes
25dnl that the version is OK.
26if test -d .svn ; then
27  SVN_URL=`svn info | grep ^URL\: | cut -c6- | grep -v '/sablevm-classpath/trunk$' | grep -v '/tags/'`
28  if test "x$SVN_URL" != "x" ; then
29    case $PACKAGE_VERSION in
30      trunk+*) echo "$PACKAGE_VERSION is not an appropriate branch version"
31               echo "Please uncomment appropatiate AC INIT macro in configure.ac"
32               exit 1 ;;
33      *+*)     ;;
34      *)       echo "$PACKAGE_VERSION is not an appropriate branch version"
35               echo "Please uncomment appropatiate AC INIT macro in configure.ac"
36               exit 1 ;;
37    esac
38  fi
39fi
40
41AC_CONFIG_SRCDIR(java/lang/System.java)
42
43AC_CANONICAL_TARGET
44
45AC_SUBST(LIBRELEASE, ["]AC_PACKAGE_VERSION["])
46
47dnl -----------------------------------------------------------
48dnl Fold all IA-32 CPU architectures into "x86"
49dnl -----------------------------------------------------------
50if expr ${target_cpu} : '.*86' > /dev/null; then target_cpu=x86; fi
51
52dnl -----------------------------------------------------------
53dnl We will not track/change lib version until we reach version 1.0
54dnl at which time we'll have to be more anal about such things
55dnl -----------------------------------------------------------
56case "$host_os" in
57     darwin*)
58	cp_module=""
59	;;
60	*)
61	cp_module="-module"
62	;;
63esac
64
65CLASSPATH_MODULE="${cp_module} -release ${LIBRELEASE} -no-undefined"
66AC_SUBST(CLASSPATH_MODULE)
67
68AC_PREREQ(2.59)
69AM_INIT_AUTOMAKE([1.9.0 gnu std-options tar-ustar])
70AC_CONFIG_HEADERS([include/config.h])
71AC_PREFIX_DEFAULT(/usr/local)
72
73AC_ARG_ENABLE([compilation-warnings],
74              [AS_HELP_STRING(--enable-compilation-warnings,compilation warnings [default=no])],
75              [case "${enableval}" in
76                 yes) COMPILATION_WARNINGS=yes ;;
77                 no) COMPILATION_WARNINGS=no ;;
78                 *) COMPILATION_WARNINGS=no ;;
79               esac],
80              [COMPILATION_WARNINGS=no])
81
82case "${COMPILATION_WARNINGS}" in
83     no) JIKES_FLAGS="$JIKES_FLAGS -q" ;;
84     *) ;;
85esac
86AC_SUBST(JIKES_FLAGS)
87
88AC_ARG_ENABLE([java],
89              [AS_HELP_STRING(--enable-java,compile Java source [default=yes])],
90              [case "${enableval}" in
91                 yes) COMPILE_JAVA=yes ;;
92                 no) COMPILE_JAVA=no ;;
93                 *) COMPILE_JAVA=yes ;;
94               esac],
95              [COMPILE_JAVA=yes])
96AM_CONDITIONAL(INSTALL_CLASS_FILES, test "x${COMPILE_JAVA}" = xyes)
97
98dnl -----------------------------------------------------------
99dnl Enable JNI libraries (enabled by default)
100dnl -----------------------------------------------------------
101AC_ARG_ENABLE([jni],
102              [AS_HELP_STRING(--enable-jni,compile JNI source [default=yes])],
103              [case "${enableval}" in
104                yes) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
105                no) COMPILE_JNI=no ;;
106                *) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
107              esac],
108              [COMPILE_JNI=yes])
109AM_CONDITIONAL(CREATE_JNI_LIBRARIES, test "x${COMPILE_JNI}" = xyes)
110
111dnl -----------------------------------------------------------
112dnl Enable core JNI libraries (enabled by default)
113dnl -----------------------------------------------------------
114AC_ARG_ENABLE([core-jni],
115              [AS_HELP_STRING(--enable-core-jni,
116	                      compile JNI sources for core [default=yes])],
117              [case "${enableval}" in
118                yes) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
119                no) COMPILE_CORE_JNI=no ;;
120                *) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
121              esac],
122              [COMPILE_CORE_JNI=yes])
123AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes)
124
125dnl ------------------------------------------------------------
126dnl Whether to compile with -Werror or not (disabled by default)
127dnl ------------------------------------------------------------
128AC_ARG_ENABLE([Werror],
129              [AS_HELP_STRING(--enable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
130              [case "${enableval}" in
131                yes) ENABLE_WERROR=yes ;;
132                no) ENABLE_WERROR=no ;;
133                *) ENABLE_WERROR=no ;;
134              esac],
135              [ENABLE_WERROR=no])
136
137dnl -----------------------------------------------------------
138dnl Default AWT toolkit
139dnl -----------------------------------------------------------
140AC_ARG_ENABLE(default-toolkit,
141  AS_HELP_STRING([--enable-default-toolkit],
142                 [fully qualified class name of default AWT toolkit]))
143default_toolkit=$enable_default_toolkit
144if test "$default_toolkit" = ""; then
145   default_toolkit=gnu.java.awt.peer.gtk.GtkToolkit
146fi
147AC_SUBST(default_toolkit)
148
149dnl -----------------------------------------------------------
150dnl Native libxml/xslt library (disabled by default)
151dnl -----------------------------------------------------------
152AC_ARG_ENABLE([xmlj],
153              [AS_HELP_STRING(--enable-xmlj,compile native libxml/xslt library [default=no])],
154              [case "${enableval}" in
155                yes) COMPILE_XMLJ=yes ;;
156                no) COMPILE_XMLJ=no ;;
157                *) COMPILE_XMLJ=no ;;
158              esac],
159              [COMPILE_XMLJ=no])
160AM_CONDITIONAL(CREATE_XMLJ_LIBRARY, test "x${COMPILE_XMLJ}" = xyes)
161
162dnl -----------------------------------------------------------
163dnl ALSA code (enabled by default)
164dnl -----------------------------------------------------------
165AC_ARG_ENABLE([alsa],
166              [AS_HELP_STRING(--disable-alsa,compile ALSA providers (enable by --enable-alsa) [default=yes])],
167              [case "${enableval}" in
168                yes) COMPILE_ALSA=yes ;;
169                no) COMPILE_ALSA=no ;;
170                *) COMPILE_ALSA=yes ;;
171              esac],
172	      [AC_CHECK_HEADERS([alsa/asoundlib.h],COMPILE_ALSA=yes,COMPILE_ALSA=no)])
173AM_CONDITIONAL(CREATE_ALSA_LIBRARIES, test "x${COMPILE_ALSA}" = xyes)
174
175dnl -----------------------------------------------------------
176dnl DSSI code (enabled by default)
177dnl -----------------------------------------------------------
178AC_ARG_ENABLE([alsa],
179              [AS_HELP_STRING(--disable-dssi,compile DSSI providers (enable by --enable-dssi) [default=yes])],
180              [case "${enableval}" in
181                yes) COMPILE_DSSI=yes ;;
182                no) COMPILE_DSSI=no ;;
183                *) COMPILE_DSSI=yes ;;
184              esac],
185              [AC_CHECK_HEADERS([dssi.h],COMPILE_DSSI=yes,COMPILE_DSSI=no)])
186AM_CONDITIONAL(CREATE_DSSI_LIBRARIES, test "x${COMPILE_DSSI}" = xyes)
187
188dnl -----------------------------------------------------------
189dnl GTK native peer (enabled by default)
190dnl -----------------------------------------------------------
191AC_ARG_ENABLE([gtk-peer],
192              [AS_HELP_STRING(--disable-gtk-peer,compile GTK native peers (disabled by --disable-jni) [default=yes])],
193              [case "${enableval}" in
194                yes) COMPILE_GTK_PEER=yes ;;
195                no) COMPILE_GTK_PEER=no ;;
196                *) COMPILE_GTK_PEER=yes ;;
197              esac],
198              [COMPILE_GTK_PEER=yes])
199AM_CONDITIONAL(CREATE_GTK_PEER_LIBRARIES, test "x${COMPILE_GTK_PEER}" = xyes)
200
201dnl -----------------------------------------------------------
202dnl GTK native peer error checking
203dnl -----------------------------------------------------------
204AC_ARG_ENABLE([gtk-peers],,AC_MSG_ERROR([No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer]))
205
206dnl ------------------------------------------------------------
207dnl determine whether to enable the cairo GTK Graphics2D backend
208dnl ------------------------------------------------------------
209AC_ARG_ENABLE([gtk-cairo],
210              [AS_HELP_STRING(--enable-gtk-cairo,build the cairo Graphics2D implementation on GTK [default=no])],
211              [case "${enableval}" in
212                yes) GTK_CAIRO_ENABLED=true ;;
213                no) GTK_CAIRO_ENABLED=false ;;
214                *) GTK_CAIRO_ENABLED=true ;;
215              esac],
216              [GTK_CAIRO_ENABLED=false])
217AC_SUBST(GTK_CAIRO_ENABLED)
218if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
219  AC_DEFINE(GTK_CAIRO, 1, [defined if cairo support was built in])
220fi
221AM_CONDITIONAL(GTK_CAIRO, test "x${GTK_CAIRO_ENABLED}" = xtrue)
222
223dnl -----------------------------------------------------------
224dnl Qt native peer (disabled by default)
225dnl -----------------------------------------------------------
226AC_ARG_ENABLE([qt-peer],
227              [AS_HELP_STRING(--enable-qt-peer,compile Qt4 native peers (disabled by --disable-jni) [default=no])],
228              [case "${enableval}" in
229                yes) COMPILE_QT_PEER=yes ;;
230                no) COMPILE_QT_PEER=no ;;
231                *) COMPILE_QT_PEER=yes ;;
232              esac],
233              [COMPILE_QT_PEER=no])
234AM_CONDITIONAL(CREATE_QT_PEER_LIBRARIES, test "x${COMPILE_QT_PEER}" = xyes)
235
236
237dnl -----------------------------------------------------------
238dnl Sets the native libraries installation dir
239dnl -----------------------------------------------------------
240AC_ARG_WITH([native-libdir],
241	    [AS_HELP_STRING(--with-native-libdir,sets the installation directore for native libraries [default='${libdir}/${PACKAGE}'])],
242	    [
243	     nativelibdir=${withval}
244	    ],
245	    [
246	     nativelibdir='${libdir}/${PACKAGE}'
247	    ])
248
249AC_SUBST(nativelibdir)
250
251dnl -----------------------------------------------------------
252dnl Sets the Java library installation dir.
253dnl -----------------------------------------------------------
254AC_ARG_WITH([glibj-dir],
255	    [AS_HELP_STRING(--with-glibj-dir,sets the installation directory for glibj.zip [default='${libdir}/${PACKAGE}'])],
256	    [
257	     glibjdir=${withval}
258	    ],
259	    [
260	     glibjdir='${datadir}/${PACKAGE}'
261	    ])
262
263AC_SUBST(glibjdir)
264
265dnl -----------------------------------------------------------
266dnl Regenerate headers at build time (disabled by default)
267dnl -----------------------------------------------------------
268AC_ARG_ENABLE([regen-headers],
269              [AS_HELP_STRING(--enable-regen-headers,automatically regenerate JNI headers [default=no])],
270              [case "${enableval}" in
271                yes) REGENERATE_JNI_HEADERS=yes ;;
272                no) REGENERATE_JNI_HEADERS=no ;;
273                *) REGENERATE_JNI_HEADERS=no ;;
274              esac],
275              [REGENERATE_JNI_HEADERS=no])
276AM_CONDITIONAL(CREATE_JNI_HEADERS, test "x${REGENERATE_JNI_HEADERS}" = xyes)
277
278AC_PROG_LN_S
279AC_PROG_INSTALL
280
281dnl -----------------------------------------------------------
282dnl Checks for programs.
283dnl -----------------------------------------------------------
284AC_PROG_CXX
285dnl Initialize libtool
286AC_DISABLE_STATIC
287AC_PROG_LIBTOOL
288dnl AC_PROG_AWK
289AC_PROG_CC
290AC_PROG_CPP
291
292if test "x${COMPILE_JNI}" = xyes; then
293  AC_HEADER_STDC
294
295  dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64,
296  dnl at least.
297  AC_COMPILE_CHECK_SIZEOF(void *)
298
299  dnl Checking for endianess.
300  AC_C_BIGENDIAN_CROSS
301
302  dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
303  dnl On that system, sys/ioctl.h will not include sys/filio.h unless
304  dnl BSD_COMP is defined; just including sys/filio.h is simpler.
305  dnl Check for crt_externs.h on Darwin.
306  AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h \
307		    asm/ioctls.h \
308		    inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
309		    sys/time.h \
310		    sys/select.h \
311		    crt_externs.h \
312                    fcntl.h \
313		    sys/mman.h])
314  AC_CHECK_HEADERS([sys/socket.h])
315
316  AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
317  AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
318  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]))
319  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]))
320
321  AC_CHECK_TYPE([socklen_t],
322    AC_DEFINE(HAVE_SOCKLEN_T, 1, Define to 1 if <sys/socket.h> defines socklen_t),,[
323#include	"confdefs.h"	/* the header built by configure so far */
324#ifdef HAVE_SYS_TYPES_H
325#include <sys/types.h>
326#endif
327#ifdef HAVE_SYS_SOCKET_H
328#include <sys/socket.h>
329#endif])
330
331  AC_CHECK_FUNCS([ftruncate fsync select \
332		  gethostname socket strerror fork pipe execve open close \
333		  lseek fstat read write htonl memset htons connect \
334		  getsockname getpeername bind listen accept \
335		  recvfrom send sendto setsockopt getsockopt time mktime \
336		  localtime_r \
337		  strerror_r \
338                  fcntl \
339		  mmap munmap mincore msync madvise getpagesize sysconf])
340
341  AC_HEADER_TIME
342  AC_STRUCT_TM
343  AC_STRUCT_TIMEZONE
344
345  AC_MSG_CHECKING([for tm_gmtoff in struct tm])
346  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
347  [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
348   AC_MSG_RESULT(yes)],
349  [AC_MSG_RESULT(no)
350   AC_MSG_CHECKING([for global timezone variable])
351   dnl FIXME: we don't want a link check here because that won't work
352   dnl when cross-compiling.  So instead we make an assumption that
353   dnl the header file will mention timezone if it exists.
354   dnl Don't find the win32 function timezone
355   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
356     [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
357      AC_MSG_RESULT(yes)],
358     [AC_MSG_RESULT(no)
359       AC_MSG_CHECKING([for global _timezone variable])
360       dnl FIXME: As above, don't want link check
361       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
362         [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
363            [Define if your platform has the global _timezone variable.])
364          AC_MSG_RESULT(yes)],
365          [AC_MSG_RESULT(no)])])])
366
367  AC_C_CONST
368  AC_C_ATTRIBUTE
369
370  dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
371  AM_ICONV
372
373  dnl When using gcc we want warnings, lots of warnings :-)
374  if test "x${GCC}" = xyes; then
375    if test "x${COMPILATION_WARNINGS}" = "xyes"; then
376      AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE"
377      dnl We want ISO C90 pedantic ansi, but with longlong (jlong) support
378      dnl and modern POSIX and BSD C library functions/prototypes.
379      WARNING_CFLAGS='-pedantic -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long'
380      AC_SUBST(WARNING_CFLAGS)
381      dnl Strict warning flags which not every module uses.
382      dnl Should probably be configurable.
383      STRICT_WARNING_CFLAGS=-Wstrict-prototypes
384      AC_SUBST(STRICT_WARNING_CFLAGS)
385    fi
386    case $host in
387      powerpc-apple-darwin*)
388        AM_CFLAGS="$AM_CFLAGS -no-cpp-precomp"
389        AM_CPPFLAGS="-D__PPC__ -D_BIG_ENDIAN"
390        AC_SUBST(AM_CPPFLAGS)
391        ;;
392    esac
393
394    dnl Whether or not to add -Werror, also not used by all modueles.
395    dnl Can be configured by --disable-Werror
396    ERROR_CFLAGS=
397    if test "x${ENABLE_WERROR}" = xyes; then
398       ERROR_CFLAGS='-Werror'
399    fi
400    AC_SUBST(ERROR_CFLAGS)
401  fi
402
403  dnl Check for libxml and libxslt libraries (when xmlj is enabled).
404  if test "x${COMPILE_XMLJ}" = xyes; then
405    PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.6.8)
406    PKG_CHECK_MODULES(XSLT, libxslt >= 1.1.11)
407    AC_SUBST(XML_LIBS)
408    AC_SUBST(XML_CFLAGS)
409    AC_SUBST(XSLT_LIBS)
410    AC_SUBST(XSLT_CFLAGS)
411  fi
412
413  dnl Check for AWT related gthread/gtk
414  if test "x${COMPILE_GTK_PEER}" = xyes; then
415    AC_PATH_XTRA
416    if test "$no_x" = yes; then
417        AC_MSG_ERROR([GTK+ peers requested but no X library available])
418    fi
419    dnl We explicitly want the XTest Extension for Robot support.
420    AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
421       	  [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
422       	  [${X_LIBS}])
423    PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
424
425    if test "x${enable_gtk_cairo}" = xyes; then
426      PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
427    fi
428
429    PKG_CHECK_MODULES(PANGOFT2, pangoft2)
430    PKG_CHECK_MODULES(FREETYPE2, freetype2)
431
432    AC_SUBST(GTK_CFLAGS)
433    AC_SUBST(GTK_LIBS)
434    AC_SUBST(CAIRO_LIBS)
435    AC_SUBST(CAIRO_CFLAGS)
436    AC_SUBST(PANGOFT2_LIBS)
437    AC_SUBST(PANGOFT2_CFLAGS)
438    AC_SUBST(FREETYPE2_LIBS)
439    AC_SUBST(FREETYPE2_CFLAGS)
440  fi
441
442  dnl Check for AWT related Qt4
443  if test "x${COMPILE_QT_PEER}" = xyes; then
444    PKG_CHECK_MODULES(QT, QtGui >= 4.0.1, HAVE_QT4="yes", HAVE_QT4="no")
445    if test "x$HAVE_QT4" = "xyes"; then
446      dnl Check needed because in some cases the QtGui includedir
447      dnl doesn't contain the subsystem dir.
448      QT_INCLUDE_DIR=$($PKG_CONFIG --variable=includedir QtGui)
449      EXTRA_QT_INCLUDE_DIR="$QT_INCLUDE_DIR/Qt"
450      AC_CHECK_FILE([$QT_INCLUDE_DIR/QWidget],
451      AC_MSG_NOTICE([No extra QT_INCLUDE_DIR needed]),
452      AC_CHECK_FILE([$EXTRA_QT_INCLUDE_DIR/QWidget],
453	QT_CFLAGS="$QT_CFLAGS -I$EXTRA_QT_INCLUDE_DIR",
454	AC_MSG_WARN([QWidget not found])))
455	AC_CHECK_PROG(MOC, [moc], [moc])
456    fi
457    if test "x$HAVE_QT4" = "xno"; then
458      AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
459      case "$host_os" in
460  	darwin*)
461  	  AC_ARG_WITH([qt4dir],
462  	    [AS_HELP_STRING([--with-qt4dir=DIR],
463  	    [Qt4 installation directory used for OS-X.
464  	    For other systems use pkg-config.])],
465  	    [QT4DIR=$withval]
466  	    )
467  	  if test x"$QT4DIR" = x ; then
468  	    AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
469  	  fi
470  	  AC_MSG_RESULT([QT4DIR... $QT4DIR])
471  	  AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
472  	  if test x"$MOC" = x; then
473  	    AC_MSG_ERROR([*** This is not the right Qt installation])
474  	  fi
475  	  QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
476  	  QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
477  	  QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
478  	  QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
479  	  ;;
480  	*)
481  	  AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
482  	  of your installed Qt4 installation.])
483  	  ;;
484      esac
485    fi
486    AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
487    AC_SUBST(QT_CFLAGS)
488    AC_SUBST(QT_LIBS)
489  fi
490fi
491
492CLASSPATH_WITH_JAVAH
493
494dnl -----------------------------------------------------------
495dnl Add the include files for the native abstraction layer.
496dnl Used by AM_CPPFLAGS in the different modules.
497dnl -----------------------------------------------------------
498CLASSPATH_INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/native/jni/classpath -I\$(top_srcdir)/native/target/Linux -I\$(top_srcdir)/native/target/generic"
499AC_SUBST(CLASSPATH_INCLUDES)
500
501dnl -----------------------------------------------------------
502if test "x${COMPILE_JNI}" = xyes; then
503  AC_MSG_CHECKING(jni_md.h support)
504  if test -f ${srcdir}/include/jni_md-${target_cpu}-${target_os}.h; then
505    AC_MSG_RESULT(yes)
506  else
507    target_cpu=x86
508    target_os=linux-gnu
509    AC_MSG_WARN(no, using x86-linux-gnu)
510  fi
511  ac_sources="include/jni_md-${target_cpu}-${target_os}.h"
512  ac_dests="include/jni_md.h"
513  while test -n "$ac_sources"; do
514    set $ac_dests; ac_dest=$1; shift; ac_dests=$*
515    set $ac_sources; ac_source=$1; shift; ac_sources=$*
516    ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
517  done
518  AC_CONFIG_LINKS([$ac_config_links_1])
519fi
520
521CLASSPATH_FIND_JAVAC
522
523CLASSPATH_WITH_CLASSLIB
524
525dnl -----------------------------------------------------------
526dnl Initialize maintainer mode
527dnl -----------------------------------------------------------
528AM_MAINTAINER_MODE
529
530dnl -----------------------------------------------------------
531dnl Enable debugging statements at compile time.  By default
532dnl these statements should be optimized out of the bytecode
533dnl produced by an optimizing Java compiler and not hinder
534dnl performance because debugging is turned off by default.
535dnl -----------------------------------------------------------
536AC_ARG_ENABLE([debug],
537              [AS_HELP_STRING(--enable-debug,enable runtime debugging code)],
538              [case "${enableval}" in
539                yes)
540              	LIBDEBUG="true"
541                AC_DEFINE(DEBUG, 1, [Define to 1 if you want native library runtime debugging code enabled])
542              	;;
543                no)   LIBDEBUG="false" ;;
544                *) 	AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
545              esac],
546              [LIBDEBUG="false"])
547AC_SUBST(LIBDEBUG)
548
549dnl -----------------------------------------------------------
550dnl Enable execution of all static initializer loadLibrary()
551dnl calls at compile time.  By default most people will not
552dnl want to disable this, but some VMs (gcj) don't need or want
553dnl them.
554dnl -----------------------------------------------------------
555AC_ARG_ENABLE([load-library],
556              [AS_HELP_STRING(--enable-load-library,enable to use JNI native methods [default=yes])],
557              [case "${enableval}" in
558                yes) INIT_LOAD_LIBRARY="true" ;;
559                no) INIT_LOAD_LIBRARY="false" ;;
560                *) AC_MSG_ERROR(bad value ${enableval} for --enable-load-library) ;;
561              esac],
562              [INIT_LOAD_LIBRARY="true"])
563AC_SUBST(INIT_LOAD_LIBRARY)
564
565
566dnl -----------------------------------------------------------
567dnl Should the VM explicitly run class initialization subfunctions for
568dnl java.lang.System?   (default is false -- the subfunctions will be run
569dnl automatically by the class initializer)
570dnl -----------------------------------------------------------
571AC_ARG_ENABLE([java-lang-system-explicit-initialization],
572              [AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM explicitly invoke java.lang.System's static initialization methods [default=no])],
573              [case "${enableval}" in
574                yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
575                no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
576                *) AC_MSG_ERROR(bad value ${enableval} for --enable-java-lang-system-explicit-initialization) ;;
577              esac],
578              [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
579AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
580
581
582dnl -----------------------------------------------------------
583dnl avoiding automake complaints
584dnl -----------------------------------------------------------
585REMOVE=""
586AC_SUBST(REMOVE)
587
588dnl -----------------------------------------------------------
589dnl This is probably useless.
590dnl -----------------------------------------------------------
591AC_PATH_PROG(MKDIR, mkdir)
592AC_PATH_PROG(CP, cp)
593AC_PATH_PROG(DATE, date)
594
595dnl -----------------------------------------------------------
596dnl According to the GNU coding guide, we shouldn't require find,
597dnl and zip, however GNU provides both so it should be okay
598dnl -----------------------------------------------------------
599AC_PATH_PROG(FIND, find)
600
601dnl -----------------------------------------------------------
602dnl Specify which jar-like tool to use
603dnl -----------------------------------------------------------
604CLASSPATH_WITH_JAR
605
606dnl -----------------------------------------------------------
607dnl Specify what to install (install libclasspath.jar|resources.jar (storeonly) by default)
608dnl -----------------------------------------------------------
609CLASSPATH_WITH_COMPRESSED_CLASSES
610
611dnl -----------------------------------------------------------
612dnl Enable API documentation generation (disabled by default)
613dnl -----------------------------------------------------------
614CLASSPATH_WITH_GJDOC
615
616dnl -----------------------------------------------------------
617dnl Whether to use jay to regenerate parsers.
618dnl -----------------------------------------------------------
619REGEN_WITH_JAY
620
621dnl -----------------------------------------------------------
622dnl This sets the build-time default, which can now be overridden
623dnl by setting the system property gnu.classpath.awt.gtk.portable.native.sync
624dnl to "true" or "false".
625dnl -----------------------------------------------------------
626AC_ARG_ENABLE([portable-native-sync],
627              [AS_HELP_STRING(--enable-portable-native-sync,synchronize VM threads portably)],
628              [case "${enableval}" in
629                yes)
630                     AC_DEFINE(PORTABLE_NATIVE_SYNC, 1, [Define if you want to synchronize VM threads portably by default; undef otherwise])
631                     ;;
632                no)  ;;
633                *)
634                     AC_MSG_ERROR(bad value ${enableval} for --enable-portable-native-sync)
635                     ;;
636              esac],
637              [])
638
639dnl -----------------------------------------------------------
640dnl output files
641dnl -----------------------------------------------------------
642dnl please don't include: doc/Makefile, doc/api/Makefile, and examples/Makefile
643AC_CONFIG_FILES([Makefile
644external/Makefile
645external/sax/Makefile
646external/w3c_dom/Makefile
647gnu/classpath/Configuration.java
648include/Makefile
649native/Makefile
650native/fdlibm/Makefile
651native/jawt/Makefile
652native/jni/Makefile
653native/jni/classpath/Makefile
654native/jni/java-io/Makefile
655native/jni/java-lang/Makefile
656native/jni/java-net/Makefile
657native/jni/java-nio/Makefile
658native/jni/java-util/Makefile
659native/jni/gtk-peer/Makefile
660native/jni/qt-peer/Makefile
661native/jni/xmlj/Makefile
662native/jni/midi-alsa/Makefile
663native/jni/midi-dssi/Makefile
664native/target/Makefile
665native/target/Linux/Makefile
666native/target/generic/Makefile
667resource/Makefile
668scripts/Makefile
669scripts/classpath.spec
670lib/Makefile
671lib/gen-classlist.sh
672lib/copy-vmresources.sh
673])
674AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
675AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
676AC_OUTPUT
677
678dnl fix the long filename problem in generated Makefiles
679find ${srcdir} -name Makefile | while read ONE; do
680  cat ${ONE} | sed 's/^\(.*\)TAR\(.*\)chof\(.*\)|\(.*\)/\1TAR\2chf\3 --posix |\4/' >${ONE}.new
681  mv -f ${ONE}.new ${ONE}
682done
683
684