- disabled gtk static build, problems with cairo
[cacao.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT(cacao, 0.92cvs, cacao@cacaojvm.org)
4 AC_CONFIG_SRCDIR(src/cacao/cacao.c)
5 AC_CANONICAL_HOST
6 AC_PREREQ(2.59)
7 AM_INIT_AUTOMAKE([1.9.0])
8 AM_MAINTAINER_MODE
9
10 AM_CONFIG_HEADER([config.h])
11
12 AC_PREFIX_DEFAULT(/usr/local/cacao)
13
14
15 dnl system type
16 case "$host_cpu" in
17 alpha | alphaev56 )
18         ARCH_DIR="alpha"
19         STATIC_CLASSPATH="1"
20         CFLAGS="-mieee -D__ALPHA__"
21         ;;
22
23 i386 | i486 | i586 | i686 )
24         ARCH_DIR="i386"
25         STATIC_CLASSPATH="0"
26         CFLAGS="-D__I386__ $CFLAGS"
27         ;;
28
29 mips )
30         ARCH_DIR="mips"
31         STATIC_CLASSPATH="1"
32
33 dnl for MIPSPro Compiler
34 dnl     CFLAGS="-64 -OPT:Olimit=0 -woff 1110,1164,1515 -D__MIPS__ -D__MIPSEB__"
35         CFLAGS="-64 -OPT:Olimit=0 -D__MIPS__ -D__MIPSEB__"
36
37 dnl for GCC
38 dnl     CFLAGS="-mabi=64 -D__MIPS__ -D__MIPSEB__"
39 dnl     LDFLAGS="-mabi=64"
40         ;;
41
42 powerpc | ppc )
43         ARCH_DIR="powerpc"
44         STATIC_CLASSPATH="1"
45         CFLAGS="-D__POWERPC__"
46         ;;
47
48 x86_64 )
49         ARCH_DIR="x86_64"
50         STATIC_CLASSPATH="0"
51         CFLAGS="-D__X86_64__"
52         ;;
53
54 xdspcore )
55         ARCH_DIR="xdspcore"
56         STATIC_CLASSPATH="1"
57         CFLAGS="-D__XDSPCORE__"
58         USE_SCHEDULER="1"
59         ;;
60 * )
61         AC_MSG_ERROR($host_cpu systems are not supported at this time)
62         ;;
63 esac
64
65
66 dnl set optimization and debugging for all architectures and systems
67 CFLAGS="-O0 -g3 $CFLAGS"
68
69
70 case "$host_os" in
71 *linux* | *Linux* )
72         CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__LINUX__ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
73         ;;
74 *darwin* )
75         CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__DARWIN__"
76         ;;
77 *irix* )
78         CFLAGS="$CFLAGS -D__IRIX__"
79         ;;
80 * )
81         ;;
82 esac
83
84
85 dnl define and substitute some architecture specific variables
86 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [Architecture directory])
87 AC_SUBST(ARCH_DIR)
88 AC_SUBST(USE_SCHEDULER)
89
90
91 dnl define install prefix
92 if test "x$prefix" = xNONE; then
93         CACAO_INSTALL_PREFIX=$ac_default_prefix
94 else
95         CACAO_INSTALL_PREFIX=$prefix
96 fi
97 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [Installation prefix])
98 AC_SUBST(CACAO_INSTALL_PREFIX)
99
100
101 dnl Checks for programs.
102 AC_PROG_CC
103 AM_PROG_AS
104 AC_PROG_RANLIB
105 AC_DISABLE_SHARED
106 AC_PROG_LIBTOOL
107 AC_PROG_LN_S
108 AC_PROG_MAKE_SET
109
110 dnl Checks for header files.
111 AC_HEADER_DIRENT
112 AC_HEADER_STDC
113 AC_CHECK_HEADERS([fcntl.h])
114 AC_CHECK_HEADERS([sys/time.h])
115 AC_CHECK_HEADERS([unistd.h])
116 AC_CHECK_HEADERS([sys/ioctl.h])
117
118 dnl Checks for typedefs, structures, and compiler characteristics.
119 AC_C_CONST
120 AC_C_INLINE
121 AC_TYPE_OFF_T
122 AC_TYPE_SIZE_T
123 AC_HEADER_TIME
124 AC_STRUCT_TM
125
126 dnl Checks for library functions.
127 AC_PROG_GCC_TRADITIONAL
128 AC_FUNC_MEMCMP
129 AC_FUNC_MMAP
130 AC_TYPE_SIGNAL
131 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
132
133 dnl Checks for libraries.
134 AC_CHECK_LIB(m, fmod)
135
136 dnl Check for mmap header anomalies (missing MAP_FAILED, etc.)
137 if test $ac_cv_func_mmap_fixed_mapped = yes; then
138         AC_CACHE_CHECK(whether MAP_FAILED is defined,
139                        ac_cv_map_failed,
140                        AC_EGREP_CPP(yes, 
141                                     [#include <sys/mman.h>
142                                      #ifdef MAP_FAILED
143                                         yes
144                                      #endif],
145                                     ac_cv_map_failed=yes,
146                                     ac_cv_map_failed=no))
147
148         AC_CACHE_CHECK(whether MAP_ANONYMOUS is defined,
149                        ac_cv_map_anonymous,
150                        AC_EGREP_CPP(yes, 
151                                     [#include <sys/mman.h>
152                                      #ifdef MAP_ANONYMOUS
153                                         yes
154                                      #endif],
155                                     ac_cv_map_anonymous=yes,
156                                     ac_cv_map_anonymous=no))
157
158         AC_CACHE_CHECK(whether MAP_ANON is defined,
159                        ac_cv_map_anon,
160                        AC_EGREP_CPP(yes, 
161                                     [#include <sys/mman.h>
162                                      #ifdef MAP_ANON
163                                         yes
164                                      #endif],
165                                     ac_cv_map_anon=yes,
166                                     ac_cv_map_anon=no))
167
168         if test $ac_cv_map_failed = yes; then
169                 AC_DEFINE([HAVE_MAP_FAILED], 1, [Define if <sys/mman.h> defines MAP_FAILED])
170         fi
171
172         if test $ac_cv_map_anonymous = yes; then
173                 AC_DEFINE([HAVE_MAP_ANONYMOUS], 1, [Define if <sys/mman.h> defines MAP_ANONYMOUS])
174         fi
175
176         if test $ac_cv_map_anon = yes; then
177                 AC_DEFINE([HAVE_MAP_ANON], 1, [Define if <sys/mman.h> defines MAP_ANON])
178         fi
179 fi
180
181
182 dnl Features
183
184 dnl check arguments
185
186 dnl check for garbage collector
187 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-gc,disable garbage collector [[default=yes]])])
188
189 AC_MSG_CHECKING(whether GC should be disabled)
190 if test x"$disable_gc" = "xyes"; then
191         AC_MSG_RESULT(yes)
192         AM_CONDITIONAL([DISABLE_GC], [true])
193 else
194         AC_MSG_RESULT(no)
195         AM_CONDITIONAL([DISABLE_GC], [false])
196 fi
197
198
199 dnl check for statistics
200 AC_ARG_ENABLE([statistics], [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])])
201
202 AC_MSG_CHECKING(whether statistics generation should be enabled)
203 if test x"$enable_statistics" = "xno"; then
204         AC_MSG_RESULT(no)
205         AM_CONDITIONAL([STATISTICS], [false])
206 else
207         AC_MSG_RESULT(yes)
208         AC_DEFINE([STATISTICS], 1, [use statistics])
209         AM_CONDITIONAL([STATISTICS], [true])
210 fi
211
212
213 dnl threads
214 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
215 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
216
217 AC_MSG_CHECKING(whether to include threads support)
218 enable_threads=${enable_threads:-native}
219 case "$enable_threads" in
220 no | none | single)
221         AC_MSG_RESULT(no)
222         dnl no threads for boehm
223         ac_configure_args="$ac_configure_args --disable-boehm-threads"
224         AM_CONDITIONAL([USE_THREADS], [false])
225         AM_CONDITIONAL([NATIVE_THREADS], [false])
226         ;;
227
228 green | native | posix | pthreads)
229         AC_DEFINE([USE_THREADS], 1, [use threads])
230         AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
231         AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
232
233         AM_CONDITIONAL([USE_THREADS], [true])
234
235         if test x"$enable_threads" != "xgreen"; then
236                 AC_MSG_RESULT(yes, native)
237                 AC_CHECK_LIB(pthread, main)
238                 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
239
240                 CFLAGS="$CFLAGS -D_REENTRANT"
241
242                 dnl tell boehm to support threads as well
243                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-boehm-threads=posix"
244                 AM_CONDITIONAL([NATIVE_THREADS], [true])
245
246         else
247                 AC_MSG_RESULT(yes, green)
248
249                 dnl no threads for boehm
250                 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-boehm-threads"
251                 AM_CONDITIONAL([NATIVE_THREADS], [false])
252         fi
253     ;;
254 *)
255     AC_MSG_ERROR($enable_threads is an unknown thread package)
256     ;;
257 esac
258
259
260 dnl Check whether the compiler supports the __thread keyword.
261 if test "x$use__thread" != xno; then
262   AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
263   [cat > conftest.c <<\EOF
264 __thread int a = 42;
265 EOF
266   if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
267     ac_cv_gcc___thread=yes 
268   else
269     ac_cv_gcc___thread=no
270   fi
271   rm -f conftest*])
272   if test "$ac_cv_gcc___thread" = yes; then
273     AC_DEFINE([HAVE___THREAD], 1, [have __thread])
274   fi
275 else
276   ac_cv_gcc___thread=no
277 fi
278
279
280 dnl check if linear scan register allocator(lsra) should be used
281 AC_ARG_ENABLE([lsra], [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])])
282
283 AC_MSG_CHECKING(whether lsra should be supported)
284 if test x"$enable_lsra" = "xno"; then
285         AC_MSG_RESULT(no)
286 else
287         AC_MSG_RESULT(yes)
288         AC_DEFINE([LSRA], 1, [use lsra])
289 fi
290
291
292 dnl check for inlining
293 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
294
295 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
296 dnl if test x"$enable_inlining" = "xno"; then
297 dnl     AC_MSG_RESULT(yes)
298 dnl     AM_CONDITIONAL([USE_INLINING], [false])
299 dnl else
300 dnl     AC_MSG_RESULT(no)
301         AC_DEFINE([USE_INLINING], 1, [use method inlining])
302         AM_CONDITIONAL([USE_INLINING], [true])
303 dnl fi
304
305
306 dnl check for instruction scheduler
307 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
308
309 AC_MSG_CHECKING(whether instruction scheduler should be supported)
310 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
311         case "${ARCH_DIR}" in
312                 xdspcore )
313                         ;;
314                 * )
315                         AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
316                         ;;
317         esac
318
319         AC_MSG_RESULT(yes)
320         AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
321         AM_CONDITIONAL([USE_SCHEDULER], [true])
322 else
323         AC_MSG_RESULT(no)
324         AM_CONDITIONAL([USE_SCHEDULER], [false])
325 fi
326
327
328 dnl check if zlib should be used
329 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
330
331 AC_MSG_CHECKING(whether zip archives should be supported)
332 if test x"$enable_zlib" = "xno"; then
333         AC_MSG_RESULT(no)
334         AM_CONDITIONAL([USE_ZLIB], [false])
335 else
336         AC_MSG_RESULT(yes)
337         AC_DEFINE([USE_ZLIB], 1, [use zlib])
338         AC_CHECK_HEADERS([zlib.h])
339         AC_CHECK_LIB(z, main)
340         AM_CONDITIONAL([USE_ZLIB], [true])
341 fi
342
343
344 dnl check if classpath should be linked statically with CACAO
345 AC_ARG_ENABLE([dynamicclasspath], [AS_HELP_STRING(--disable-dynamicclasspath, link classpath native code static even on platforms supporting dynamic loading)], [use_dynamicclasspath=$enableval], [use_dynamicclasspath=yes])
346
347 AC_MSG_CHECKING(whether to link GNU classpath statically)
348 if test x"$use_dynamicclasspath" = "xno"; then
349         STATIC_CLASSPATH="1"
350 fi
351
352 if test x"${STATIC_CLASSPATH}" = "x1"; then
353         AC_MSG_RESULT(yes)
354         AM_CONDITIONAL([STATIC_CLASSPATH], [true])
355 else
356         AC_MSG_RESULT(no)
357         AM_CONDITIONAL([STATIC_CLASSPATH], [false])
358 fi
359 AC_SUBST(STATIC_CLASSPATH)
360
361
362 dnl enable gtk peer
363 AC_ARG_ENABLE([gtk-peer], [AS_HELP_STRING(--enable-gtk-peer,compile GTK native peers [[default=no]])])
364
365 AC_MSG_CHECKING(whether to use GTK awt peers)
366 if test x"$enable_gtk_peer" = "xyes"; then
367         AC_MSG_RESULT(yes)
368         AC_DEFINE([USE_GTK], 1, [use gtk])
369         AM_CONDITIONAL([USE_GTK_PEER], [true])
370         USE_GTK_PEER=yes
371 else
372         AC_MSG_RESULT(no)
373         AM_CONDITIONAL([USE_GTK_PEER], [false])
374         CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-gtk-peer"
375         USE_GTK_PEER=no
376 fi
377 AC_SUBST(USE_GTK_PEER)
378
379
380 dnl pass configure options to classpath
381 if test x"${STATIC_CLASSPATH}" = "x1"; then
382         AC_DEFINE([STATIC_CLASSPATH], 1, [use classpath statically linked])
383         AM_CONDITIONAL([STATIC_CLASSPATH], [true])
384         CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-static --disable-shared"
385
386
387         dnl check for some classpath related stuff when we link statically
388         AM_ICONV_LINK
389
390         dnl taken from GNU classpath configure.ac
391         if test x"${USE_GTK_PEER}" = "xyes"; then
392                 AC_ERROR(XXX this is not supported yet)
393                 AC_PATH_XTRA
394                 if test "$no_x" = yes; then
395                         AC_MSG_ERROR([GTK+ peers requested but no X library available])
396                 fi
397                 dnl We explicitly want the XTest Extension for Robot support.
398                 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
399                              [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
400                              [${X_LIBS}])
401                 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0)
402                 AC_SUBST(GTK_CFLAGS)
403                 AC_SUBST(GTK_LIBS)
404
405                 AC_SUBST(CAIRO_LIBS)
406                 AC_SUBST(CAIRO_CFLAGS)
407         fi
408         PKG_CHECK_MODULES(PANGOFT2, pangoft2)
409         AC_SUBST(PANGOFT2_LIBS)
410         AC_SUBST(PANGOFT2_CFLAGS)
411 else
412         AM_CONDITIONAL([STATIC_CLASSPATH], [false])
413         CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-static --enable-shared"
414 fi
415
416
417 dnl should we use an external classpath installation
418 AC_ARG_WITH([external-classpath], [AS_HELP_STRING(--with-external-classpath=<dir>,installation directory of external GNU classpath [[default=no]])])
419
420 AC_MSG_CHECKING(whether to use an external GNU classpath)
421 if test x"$with_external_classpath" != "x"; then
422         if test x"$with_external_classpath" = "xyes"; then
423                 AC_MSG_ERROR(please specify the installation prefix)
424         fi
425         AC_MSG_RESULT($with_external_classpath)
426         AC_DEFINE([WITH_EXTERNAL_CLASSPATH], 1, [external classpath])
427         AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [true])
428         EXTERNAL_CLASSPATH_PREFIX="$with_external_classpath"
429         AC_DEFINE_UNQUOTED([EXTERNAL_CLASSPATH_PREFIX], "${EXTERNAL_CLASSPATH_PREFIX}", [external classpath directory])
430         AC_SUBST(EXTERNAL_CLASSPATH_PREFIX)
431 else
432         AC_MSG_RESULT(no)
433         AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [false])
434 fi
435
436
437 dnl set some essential classpath options, even if their classpath default is
438 dnl suitable for us
439 ac_configure_args="$ac_configure_args --libdir=${CACAO_INSTALL_PREFIX}/jre/lib/${ARCH_DIR} --enable-jni --disable-cni --disable-regen-headers ${CONFIGURE_ARGS}"
440
441
442 dnl now configure boehm gc and gnu classpath
443 dnl the export is not my favorite (is there another way?)
444 export CFLAGS
445 AC_CONFIG_SUBDIRS(src/boehm-gc src/classpath)
446
447
448 AC_CONFIG_FILES([Makefile]
449                 [doc/Makefile]
450                 [doc/handbook/Makefile]
451                 [man/Makefile]
452                 [src/Makefile]
453                 [src/cacao/Makefile]
454                 [src/cacaoh/Makefile]
455                 [src/lib/Makefile]
456                 [src/mm/Makefile]
457                 [src/native/Makefile]
458                 [src/native/include/Makefile]
459                 [src/native/tools/Makefile]
460                 [src/native/vm/Makefile]
461                 [src/scripts/Makefile]
462                 [src/scripts/cacao]
463                 [src/scripts/java]
464                 [src/scripts/rmic]
465                 [src/scripts/rmiregistry]
466                 [src/threads/Makefile]
467                 [src/threads/green/Makefile]
468                 [src/threads/native/Makefile]
469                 [src/toolbox/Makefile]
470                 [src/vm/Makefile]
471                 [src/vm/jit/Makefile]
472                 [src/vm/jit/alpha/Makefile]
473                 [src/vm/jit/i386/Makefile]
474                 [src/vm/jit/inline/Makefile]
475                 [src/vm/jit/loop/Makefile]
476                 [src/vm/jit/mips/Makefile]
477                 [src/vm/jit/powerpc/Makefile]
478                 [src/vm/jit/schedule/Makefile]
479                 [src/vm/jit/tools/Makefile]
480                 [src/vm/jit/verify/Makefile]
481                 [src/vm/jit/x86_64/Makefile]
482                 [tests/Makefile]
483                 [tests/kaffe/Makefile]
484                 [tests/native/Makefile])
485
486 AC_OUTPUT
487
488
489 ## Local variables:
490 ## mode: m4
491 ## indent-tabs-mode: t
492 ## c-basic-offset: 4
493 ## tab-width: 8
494 ## compile-command: "automake --add-missing"
495 ## End: