Initial revision
[gcc.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.17+cvs],[classpath@gnu.org],[classpath])
10 AC_CONFIG_SRCDIR(java/lang/System.java)
11
12 AC_CANONICAL_TARGET
13
14 dnl -----------------------------------------------------------
15 dnl Fold all IA-32 CPU architectures into "x86"
16 dnl -----------------------------------------------------------
17 if expr ${target_cpu} : '.*86' > /dev/null; then target_cpu=x86; fi
18
19 dnl -----------------------------------------------------------
20 dnl We will not track/change lib version until we reach version 1.0
21 dnl at which time we'll have to be more anal about such things
22 dnl -----------------------------------------------------------
23 AC_SUBST(LIBVERSION, "0:0:0")
24 CLASSPATH_MODULE="-module -version-info ${LIBVERSION} -no-undefined"
25 AC_SUBST(CLASSPATH_MODULE)
26
27 AC_PREREQ(2.59)
28 AM_INIT_AUTOMAKE([1.9.0 gnu std-options tar-ustar])
29 AC_CONFIG_HEADERS([include/config.h])
30 AC_PREFIX_DEFAULT(/usr/local/classpath)
31
32 dnl -----------------------------------------------------------
33 dnl Enable JNI libraries (enabled by default)
34 dnl -----------------------------------------------------------
35 AC_ARG_ENABLE([jni],
36 [AS_HELP_STRING(--enable-jni,compile JNI source [default=yes])],
37 [case "${enableval}" in
38 yes) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
39 no) COMPILE_JNI=no ;;
40 *) COMPILE_JNI=yes; COMPILE_JAVA=yes ;;
41 esac],
42 [COMPILE_JNI=yes])
43 AM_CONDITIONAL(CREATE_JNI_LIBRARIES, test "x${COMPILE_JNI}" = xyes)
44
45 dnl -----------------------------------------------------------
46 dnl Enable core JNI libraries (enabled by default)
47 dnl -----------------------------------------------------------
48 AC_ARG_ENABLE([core-jni],
49 [AS_HELP_STRING(--enable-core-jni,
50 compile JNI sources for core [default=yes])],
51 [case "${enableval}" in
52 yes) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
53 no) COMPILE_CORE_JNI=no ;;
54 *) COMPILE_CORE_JNI=yes; COMPILE_JAVA=yes ;;
55 esac],
56 [COMPILE_CORE_JNI=yes])
57 AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes)
58
59 dnl -----------------------------------------------------------
60 dnl Whether to compile with -Werror or not (enabled by default)
61 dnl -----------------------------------------------------------
62 AC_ARG_ENABLE([Werror],
63 [AS_HELP_STRING(--disable-Werror,whether to compile C code with -Werror which turns any compiler warning into a compilation failure [default=no])],
64 [case "${enableval}" in
65 yes) ENABLE_WERROR=yes ;;
66 no) ENABLE_WERROR=no ;;
67 *) ENABLE_WERROR=yes ;;
68 esac],
69 [ENABLE_WERROR=no])
70
71 dnl -----------------------------------------------------------
72 dnl Default AWT toolkit
73 dnl -----------------------------------------------------------
74 AC_ARG_ENABLE(default-toolkit,
75 AS_HELP_STRING([--enable-default-toolkit],
76 [fully qualified class name of default AWT toolkit]))
77 default_toolkit=$enable_default_tookit
78 if test "$default_toolkit" = ""; then
79 default_toolkit=gnu.java.awt.peer.gtk.GtkToolkit
80 fi
81 AC_SUBST(default_toolkit)
82
83 dnl -----------------------------------------------------------
84 dnl Native libxml/xslt library (disabled by default)
85 dnl -----------------------------------------------------------
86 AC_ARG_ENABLE([xmlj],
87 [AS_HELP_STRING(--enable-xmlj,compile native libxml/xslt library [default=no])],
88 [case "${enableval}" in
89 yes) COMPILE_XMLJ=yes ;;
90 no) COMPILE_XMLJ=no ;;
91 *) COMPILE_XMLJ=no ;;
92 esac],
93 [COMPILE_XMLJ=no])
94 AM_CONDITIONAL(CREATE_XMLJ_LIBRARY, test "x${COMPILE_XMLJ}" = xyes)
95
96 dnl -----------------------------------------------------------
97 dnl GTK native peer (enabled by default)
98 dnl -----------------------------------------------------------
99 AC_ARG_ENABLE([gtk-peer],
100 [AS_HELP_STRING(--disable-gtk-peer,compile GTK native peers (disabled by --disable-jni) [default=yes])],
101 [case "${enableval}" in
102 yes) COMPILE_GTK_PEER=yes ;;
103 no) COMPILE_GTK_PEER=no ;;
104 *) COMPILE_GTK_PEER=yes ;;
105 esac],
106 [COMPILE_GTK_PEER=yes])
107 AM_CONDITIONAL(CREATE_GTK_PEER_LIBRARIES, test "x${COMPILE_GTK_PEER}" = xyes)
108
109 dnl -----------------------------------------------------------
110 dnl GTK native peer error checking
111 dnl -----------------------------------------------------------
112 AC_ARG_ENABLE([gtk-peers],,AC_MSG_ERROR([No --enable-gtk-peers (or --disable-gtk-peers) option; you want --enable-gtk-peer]))
113
114 dnl ------------------------------------------------------------
115 dnl determine whether to enable the cairo GTK Graphics2D backend
116 dnl ------------------------------------------------------------
117 AC_ARG_ENABLE([gtk-cairo],
118 [AS_HELP_STRING(--enable-gtk-cairo,build the cairo Graphics2D implementation on GTK [default=no])],
119 [case "${enableval}" in
120 yes) GTK_CAIRO_ENABLED=true ;;
121 no) GTK_CAIRO_ENABLED=false ;;
122 *) GTK_CAIRO_ENABLED=true ;;
123 esac],
124 [GTK_CAIRO_ENABLED=false])
125 AC_SUBST(GTK_CAIRO_ENABLED)
126 if test "x${GTK_CAIRO_ENABLED}" = xtrue; then
127 AC_DEFINE(GTK_CAIRO, 1, [defined if cairo support was built in])
128 fi
129 AM_CONDITIONAL(GTK_CAIRO, test "x${GTK_CAIRO_ENABLED}" = xtrue)
130
131 dnl -----------------------------------------------------------
132 dnl Regenerate headers at build time (disabled by default)
133 dnl -----------------------------------------------------------
134 AC_ARG_ENABLE([regen-headers],
135 [AS_HELP_STRING(--enable-regen-headers,automatically regenerate JNI headers [default=no])],
136 [case "${enableval}" in
137 yes) REGENERATE_JNI_HEADERS=yes ;;
138 no) REGENERATE_JNI_HEADERS=no ;;
139 *) REGENERATE_JNI_HEADERS=no ;;
140 esac],
141 [REGENERATE_JNI_HEADERS=no])
142 AM_CONDITIONAL(CREATE_JNI_HEADERS, test "x${REGENERATE_JNI_HEADERS}" = xyes)
143
144 AC_PROG_LN_S
145 AC_PROG_INSTALL
146
147 dnl -----------------------------------------------------------
148 dnl Checks for programs.
149 dnl -----------------------------------------------------------
150 dnl AC_PROG_CXX
151 dnl Initialize libtool
152 AC_DISABLE_STATIC
153 AC_PROG_LIBTOOL
154 dnl AC_PROG_AWK
155 AC_PROG_CC
156 AC_PROG_CPP
157
158 if test "x${COMPILE_JNI}" = xyes; then
159 AC_HEADER_STDC
160
161 dnl Checking sizeof void * is needed for fdlibm to work properly on ppc64,
162 dnl at least.
163 AC_COMPILE_CHECK_SIZEOF(void *)
164
165 dnl Checking for endianess.
166 AC_C_BIGENDIAN_CROSS
167
168 dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
169 dnl On that system, sys/ioctl.h will not include sys/filio.h unless
170 dnl BSD_COMP is defined; just including sys/filio.h is simpler.
171 dnl Check for crt_externs.h on Darwin.
172 AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h \
173 asm/ioctls.h \
174 inttypes.h stdint.h utime.h sys/utime.h sys/filio.h \
175 sys/time.h \
176 sys/select.h \
177 crt_externs.h \
178 fcntl.h])
179
180 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
181 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
182 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]))
183 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]))
184
185 AC_CHECK_FUNCS([ftruncate fsync select \
186 gethostname socket strerror fork pipe execve open close \
187 lseek fstat read write htonl memset htons connect \
188 getsockname getpeername bind listen accept \
189 recvfrom send sendto setsockopt getsockopt time mktime \
190 localtime_r \
191 strerror_r \
192 fcntl])
193
194 AC_HEADER_TIME
195 AC_STRUCT_TM
196 AC_STRUCT_TIMEZONE
197
198 AC_MSG_CHECKING([for tm_gmtoff in struct tm])
199 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
200 [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
201 AC_MSG_RESULT(yes)],
202 [AC_MSG_RESULT(no)
203 AC_MSG_CHECKING([for global timezone variable])
204 dnl FIXME: we don't want a link check here because that won't work
205 dnl when cross-compiling. So instead we make an assumption that
206 dnl the header file will mention timezone if it exists.
207 dnl Don't find the win32 function timezone
208 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
209 [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
210 AC_MSG_RESULT(yes)],
211 [AC_MSG_RESULT(no)
212 AC_MSG_CHECKING([for global _timezone variable])
213 dnl FIXME: As above, don't want link check
214 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
215 [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
216 [Define if your platform has the global _timezone variable.])
217 AC_MSG_RESULT(yes)],
218 [AC_MSG_RESULT(no)])])])
219
220 AC_C_CONST
221
222 dnl See if we HAVE_ICONV, how ICONV_CONST is set and LTLIBICONV
223 AM_ICONV
224
225 dnl When using gcc we want warnings, lots of warnings :-)
226 if test "x${GCC}" = xyes; then
227 dnl We want ISO C90 pedantic ansi, but with longlong (jlong) support
228 dnl and modern POSIX and BSD C library functions/prototypes.
229
230 dnl Warning flags for (almost) everybody.
231 dnl Should probably be configurable
232 WARNING_CFLAGS='-pedantic -W -Wall -Wmissing-declarations -Wwrite-strings -Wmissing-prototypes -Wno-long-long'
233 AC_SUBST(WARNING_CFLAGS)
234
235 dnl Strict warning flags which not every module uses.
236 dnl Should probably be configurable.
237 STRICT_WARNING_CFLAGS=-Wstrict-prototypes
238 AC_SUBST(STRICT_WARNING_CFLAGS)
239
240 dnl Whether or not to add -Werror, also not used by all modueles.
241 dnl Can be configured by --disable-Werror
242 ERROR_CFLAGS=
243 if test "x${ENABLE_WERROR}" = xyes; then
244 ERROR_CFLAGS='-Werror'
245 fi
246 AC_SUBST(ERROR_CFLAGS)
247 fi
248
249 dnl Check for libxml and libxslt libraries (when xmlj is enabled).
250 if test "x${COMPILE_XMLJ}" = xyes; then
251 PKG_CHECK_MODULES(XML, libxml-2.0 >= 2.6.8)
252 PKG_CHECK_MODULES(XSLT, libxslt >= 1.1.11)
253 AC_SUBST(XML_LIBS)
254 AC_SUBST(XML_CFLAGS)
255 AC_SUBST(XSLT_LIBS)
256 AC_SUBST(XSLT_CFLAGS)
257 fi
258
259 dnl Check for AWT related gthread/gtk
260 if test "x${COMPILE_GTK_PEER}" = xyes; then
261 AC_PATH_XTRA
262 if test "$no_x" = yes; then
263 AC_MSG_ERROR([GTK+ peers requested but no X library available])
264 fi
265 dnl We explicitly want the XTest Extension for Robot support.
266 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
267 [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
268 [${X_LIBS}])
269 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
270 AC_SUBST(GTK_CFLAGS)
271 AC_SUBST(GTK_LIBS)
272 fi
273
274 if test "x${enable_gtk_cairo}" = xyes; then
275 PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
276 PKG_CHECK_MODULES(PANGOFT2, pangoft2)
277 fi
278 AC_SUBST(CAIRO_LIBS)
279 AC_SUBST(CAIRO_CFLAGS)
280 AC_SUBST(PANGOFT2_LIBS)
281 AC_SUBST(PANGOFT2_CFLAGS)
282 fi
283
284 CLASSPATH_WITH_JAVAH
285
286 dnl -----------------------------------------------------------
287 dnl Add the include files for the native abstraction layer.
288 dnl Used by AM_CPPFLAGS in the different modules.
289 dnl -----------------------------------------------------------
290 CLASSPATH_INCLUDES="-I\$(top_srcdir)/include -I\$(top_srcdir)/native/jni/classpath -I\$(top_srcdir)/native/target/Linux -I\$(top_srcdir)/native/target/generic"
291 AC_SUBST(CLASSPATH_INCLUDES)
292
293 dnl -----------------------------------------------------------
294 if test "x${COMPILE_JNI}" = xyes; then
295 AC_MSG_CHECKING(jni_md.h support)
296 if test -f ${srcdir}/include/jni_md-${target_cpu}-${target_os}.h; then
297 AC_MSG_RESULT(yes)
298 else
299 target_cpu=x86
300 target_os=linux-gnu
301 AC_MSG_WARN(no, using x86-linux-gnu)
302 fi
303 ac_sources="include/jni_md-${target_cpu}-${target_os}.h"
304 ac_dests="include/jni_md.h"
305 while test -n "$ac_sources"; do
306 set $ac_dests; ac_dest=$1; shift; ac_dests=$*
307 set $ac_sources; ac_source=$1; shift; ac_sources=$*
308 ac_config_links_1="$ac_config_links_1 $ac_dest:$ac_source"
309 done
310 AC_CONFIG_LINKS([$ac_config_links_1])
311 fi
312
313 CLASSPATH_FIND_JAVAC
314
315 CLASSPATH_WITH_CLASSLIB
316
317 dnl -----------------------------------------------------------
318 dnl Initialize maintainer mode
319 dnl -----------------------------------------------------------
320 AM_MAINTAINER_MODE
321
322 dnl -----------------------------------------------------------
323 dnl Enable debugging statements at compile time. By default
324 dnl these statements should be optimized out of the bytecode
325 dnl produced by an optimizing Java compiler and not hinder
326 dnl performance because debugging is turned off by default.
327 dnl -----------------------------------------------------------
328 AC_ARG_ENABLE([debug],
329 [AS_HELP_STRING(--enable-debug,enable runtime debugging code)],
330 [case "${enableval}" in
331 yes)
332 LIBDEBUG="true"
333 AC_DEFINE(DEBUG, 1, [Define to 1 if you want native library runtime debugging code enabled])
334 ;;
335 no) LIBDEBUG="false" ;;
336 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
337 esac],
338 [LIBDEBUG="false"])
339 AC_SUBST(LIBDEBUG)
340
341 dnl -----------------------------------------------------------
342 dnl Enable execution of all static initializer loadLibrary()
343 dnl calls at compile time. By default most people will not
344 dnl want to disable this, but some VMs (gcj) don't need or want
345 dnl them.
346 dnl -----------------------------------------------------------
347 AC_ARG_ENABLE([load-library],
348 [AS_HELP_STRING(--enable-load-library,enable to use JNI native methods [default=yes])],
349 [case "${enableval}" in
350 yes) INIT_LOAD_LIBRARY="true" ;;
351 no) INIT_LOAD_LIBRARY="false" ;;
352 *) AC_MSG_ERROR(bad value ${enableval} for --enable-load-library) ;;
353 esac],
354 [INIT_LOAD_LIBRARY="true"])
355 AC_SUBST(INIT_LOAD_LIBRARY)
356
357
358 dnl -----------------------------------------------------------
359 dnl Should the VM explicitly run class initialization subfunctions for
360 dnl java.lang.System? (default is false -- the subfunctions will be run
361 dnl automatically by the class initializer)
362 dnl -----------------------------------------------------------
363 AC_ARG_ENABLE([java-lang-system-explicit-initialization],
364 [AS_HELP_STRING(--enable-java-lang-system-explicit-initialization,will the VM explicitly invoke java.lang.System's static initialization methods [default=no])],
365 [case "${enableval}" in
366 yes|true) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="true" ;;
367 no|false) JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false" ;;
368 *) AC_MSG_ERROR(bad value ${enableval} for --enable-java-lang-system-explicit-initialization) ;;
369 esac],
370 [JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION="false"])
371 AC_SUBST(JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION)
372
373
374 dnl -----------------------------------------------------------
375 dnl avoiding automake complaints
376 dnl -----------------------------------------------------------
377 REMOVE=""
378 AC_SUBST(REMOVE)
379
380 dnl -----------------------------------------------------------
381 dnl This is probably useless.
382 dnl -----------------------------------------------------------
383 AC_PATH_PROG(SH, sh)
384 AC_PATH_PROG(MKDIR, mkdir)
385 AC_PATH_PROG(CP, cp)
386 AC_PATH_PROG(DATE, date)
387
388 dnl -----------------------------------------------------------
389 dnl According to the GNU coding guide, we shouldn't require find,
390 dnl and zip, however GNU provides both so it should be okay
391 dnl -----------------------------------------------------------
392 AC_PATH_PROG(FIND, find)
393
394 dnl -----------------------------------------------------------
395 dnl Specify what to install (install only glibj.zip by default)
396 dnl -----------------------------------------------------------
397 CLASSPATH_WITH_GLIBJ
398
399 dnl -----------------------------------------------------------
400 dnl Enable API documentation generation (disabled by default)
401 dnl -----------------------------------------------------------
402 CLASSPATH_WITH_GJDOC
403
404 dnl -----------------------------------------------------------
405 dnl Whether to use jay to regenerate parsers.
406 dnl -----------------------------------------------------------
407 REGEN_WITH_JAY
408
409 dnl -----------------------------------------------------------
410 dnl This sets the build-time default, which can now be overridden
411 dnl by setting the system property gnu.classpath.awt.gtk.portable.native.sync
412 dnl to "true" or "false".
413 dnl -----------------------------------------------------------
414 AC_ARG_ENABLE([portable-native-sync],
415 [AS_HELP_STRING(--enable-portable-native-sync,synchronize VM threads portably)],
416 [case "${enableval}" in
417 yes)
418 AC_DEFINE(PORTABLE_NATIVE_SYNC, 1, [Define if you want to synchronize VM threads portably by default; undef otherwise])
419 ;;
420 no) ;;
421 *)
422 AC_MSG_ERROR(bad value ${enableval} for --enable-portable-native-sync)
423 ;;
424 esac],
425 [])
426
427 dnl -----------------------------------------------------------
428 dnl output files
429 dnl -----------------------------------------------------------
430 AC_CONFIG_FILES([Makefile
431 doc/Makefile
432 doc/api/Makefile
433 external/Makefile
434 external/sax/Makefile
435 external/w3c_dom/Makefile
436 gnu/classpath/Configuration.java
437 include/Makefile
438 native/Makefile
439 native/fdlibm/Makefile
440 native/jni/Makefile
441 native/jni/classpath/Makefile
442 native/jni/java-io/Makefile
443 native/jni/java-lang/Makefile
444 native/jni/java-net/Makefile
445 native/jni/java-nio/Makefile
446 native/jni/java-util/Makefile
447 native/jni/gtk-peer/Makefile
448 native/jni/xmlj/Makefile
449 native/target/Makefile
450 native/target/Linux/Makefile
451 native/target/generic/Makefile
452 resource/Makefile
453 scripts/Makefile
454 scripts/classpath.spec
455 lib/Makefile
456 lib/gen-classlist.sh
457 examples/Makefile])
458 AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
459 AC_OUTPUT