]> gcc.gnu.org Git - gcc.git/blame - libjava/configure.in
ActivationInstantiator.java, [...]: Removed redundant modifiers.
[gcc.git] / libjava / configure.in
CommitLineData
ee9dd372
TT
1dnl Process this with autoconf to create configure
2AC_INIT(java/lang/System.java)
3
6706f116
AO
4# This works around the fact that libtool configuration may change LD
5# for this particular configuration, but some shells, instead of
6# keeping the changes in LD private, export them just because LD is
7# exported.
8ORIGINAL_LD_FOR_MULTILIBS=$LD
9
347b9364 10AC_PROG_LN_S
ee9dd372
TT
11
12dnl We use these options to decide which functions to include.
13AC_ARG_WITH(target-subdir,
7941ceab 14[ --with-target-subdir=SUBDIR
ffccc6be 15 configuring in a subdirectory])
ee9dd372 16AC_ARG_WITH(cross-host,
7941ceab 17[ --with-cross-host=HOST configuring with a cross compiler])
ee9dd372 18
9e7823cc
L
19AC_ARG_WITH(newlib,
20[ --with-newlib Configuring with newlib])
21
ee9dd372
TT
22LIBGCJ_CONFIGURE(.)
23
3610e0d5 24AM_CONFIG_HEADER(include/config.h gcj/libgcj-config.h)
ee9dd372 25
d6f6aaf6 26# Only use libltdl for non-newlib builds.
2d29f3a1 27if test "x${with_newlib}" = "x" || test "x${with_newlib}" = "xno"; then
7af85558
TT
28 AC_LIBLTDL_CONVENIENCE
29 AC_LIBTOOL_DLOPEN
30 DIRLTDL=libltdl
e1a3a7d0 31 AC_DEFINE(USE_LTDL, 1, [Define if libltdl is in use.])
7af85558
TT
32 # Sigh. Libtool's macro doesn't do the right thing.
33 INCLTDL="-I\$(top_srcdir)/libltdl $INCLTDL"
7f7ba9bf 34 # FIXME: this is a hack.
1e6347d8 35 sub_auxdir="`cd $ac_aux_dir && ${PWDCMD-pwd}`"
f1eba847 36 ac_configure_args="$ac_configure_args --with-auxdir=$sub_auxdir"
7af85558
TT
37fi
38AC_SUBST(INCLTDL)
39AC_SUBST(LIBLTDL)
40AC_SUBST(DIRLTDL)
a3ffcff3 41AM_PROG_LIBTOOL
4f5a5d5c 42AC_CONFIG_SUBDIRS($DIRLTDL)
a3ffcff3 43
ee9dd372
TT
44if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then
45 COMPPATH=.
46else
47 COMPPATH=..
48fi
49AC_SUBST(COMPPATH)
50
51dnl The -no-testsuite modules omit the test subdir.
52AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
53
ffccc6be
AG
54dnl Should the runtime set system properties by examining the
55dnl environment variable GCJ_PROPERTIES?
56AC_ARG_ENABLE(getenv-properties,
57[ --disable-getenv-properties
58 don't set system properties from GCJ_PROPERTIES])
59
60dnl Whether GCJ_PROPERTIES is used depends on the target.
3610e0d5 61if test -z "$enable_getenv_properties"; then
ffccc6be
AG
62 enable_getenv_properties=${enable_getenv_properties_default-yes}
63fi
64if test "$enable_getenv_properties" = no; then
e1a3a7d0
MK
65 AC_DEFINE(DISABLE_GETENV_PROPERTIES, 1,
66 [Define if system properties shouldn't be read from getenv("GCJ_PROPERTIES").])
ffccc6be
AG
67fi
68
b5ee195f
AG
69dnl Whether we should use arguments to main()
70if test -z "$enable_main_args"; then
71 enable_main_args=${enable_main_args_default-yes}
72fi
73if test "$enable_main_args" = no; then
e1a3a7d0 74 AC_DEFINE(DISABLE_MAIN_ARGS, 1, [Define if we should ignore arguments to main().])
b5ee195f
AG
75fi
76
3610e0d5
TT
77
78dnl Should we use hashtable-based synchronization?
79dnl Currently works only for Linux X86/ia64
80dnl Typically faster and more space-efficient
81AC_ARG_ENABLE(hash-synchronization,
82[ --enable-hash-synchronization
a28400bb 83 use global hash table for monitor locks])
3610e0d5
TT
84
85if test -z "$enable_hash_synchronization"; then
86 enable_hash_synchronization=$enable_hash_synchronization_default
87fi
3610e0d5 88
a28400bb
ME
89# Do we allow intermodule optimizations (i.e. compiling many files at once)?
90AC_ARG_ENABLE(libgcj-multifile,
91[ --enable-libgcj-multifile
92 allow compilation of several files at once],
93[case "${enableval}" in
94 yes) enable_libgcj_multifile=yes ;;
95 no) enable_libgcj_multifile=no ;;
96 *) AC_MSG_ERROR(bad value ${enableval} for --enable-libgcj-multifile) ;;
97esac],[enable_libgcj_multifile=no])
98AM_CONDITIONAL(ONESTEP, test "$enable_libgcj_multifile" = yes)
99
45597167
BM
100dnl configure.host sets slow_pthread_self if the synchronization code should
101dnl try to avoid pthread_self calls by caching thread IDs in a hashtable.
102if test "${slow_pthread_self}" = "yes"; then
e1a3a7d0
MK
103 AC_DEFINE(SLOW_PTHREAD_SELF, 1,
104 [Define if if the synchronization code should try to avoid pthread_self calls by caching thread IDs in a hashtable.])
45597167
BM
105fi
106
3610e0d5 107
ee9dd372 108dnl See if the user has requested runtime debugging.
213858c0
BM
109LIBGCJDEBUG="false"
110AC_SUBST(LIBGCJDEBUG)
ee9dd372 111AC_ARG_ENABLE(libgcj-debug,
7941ceab 112[ --enable-libgcj-debug enable runtime debugging code],
ee9dd372 113 if test "$enable_libgcj_debug" = yes; then
e1a3a7d0 114 AC_DEFINE(DEBUG, 1, [Define this if you want runtime debugging enabled.])
213858c0 115 LIBGCJDEBUG="true"
ee9dd372
TT
116 fi)
117
3cf88fb4 118dnl See if the user has the interpreter included.
58eb6e7c 119AC_ARG_ENABLE(interpreter,
7941ceab 120[ --enable-interpreter enable interpreter],
58eb6e7c 121 if test "$enable_interpreter" = yes; then
b11f6430
AG
122 # This can also be set in configure.host.
123 libgcj_interpreter=yes
f7ccaa38
BM
124 elif test "$enable_interpreter" = no; then
125 libgcj_interpreter=no
58eb6e7c
AG
126 fi)
127
b11f6430 128if test "$libgcj_interpreter" = yes; then
e1a3a7d0 129 AC_DEFINE(INTERPRETER, 1, [Define if you want a bytecode interpreter.])
b11f6430 130fi
b2ae5f70
TT
131INTERPRETER="$libgcj_interpreter"
132AC_SUBST(INTERPRETER)
b11f6430 133
52a11cbf
RH
134AC_MSG_CHECKING([for exception model to use])
135AC_LANG_SAVE
136AC_LANG_CPLUSPLUS
3cf88fb4 137AC_ARG_ENABLE(sjlj-exceptions,
52a11cbf
RH
138[ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
139[:],
140[dnl Botheration. Now we've got to detect the exception model.
141dnl Link tests against libgcc.a are problematic since -- at least
142dnl as of this writing -- we've not been given proper -L bits for
143dnl single-tree newlib and libgloss.
144dnl
145dnl This is what AC_TRY_COMPILE would do if it didn't delete the
146dnl conftest files before we got a change to grep them first.
147cat > conftest.$ac_ext << EOF
148[#]line __oline__ "configure"
149struct S { ~S(); };
150void bar();
151void foo()
152{
153 S s;
154 bar();
155}
156EOF
157old_CXXFLAGS="$CXXFLAGS"
158CXXFLAGS=-S
159if AC_TRY_EVAL(ac_compile); then
160 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
161 enable_sjlj_exceptions=yes
162 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
163 enable_sjlj_exceptions=no
164 fi
165fi
166CXXFLAGS="$old_CXXFLAGS"
167rm -f conftest*])
168if test x$enable_sjlj_exceptions = xyes; then
169 AC_DEFINE(SJLJ_EXCEPTIONS, 1,
170 [Define if the compiler is configured for setjmp/longjmp exceptions.])
171 ac_exception_model_name=sjlj
172elif test x$enable_sjlj_exceptions = xno; then
173 ac_exception_model_name="call frame"
174else
175 AC_MSG_ERROR([unable to detect exception model])
3cf88fb4 176fi
52a11cbf
RH
177AC_LANG_RESTORE
178AC_MSG_RESULT($ac_exception_model_name)
3cf88fb4 179
605dc89b
BM
180# If we are non using SJLJ exceptions, and this host does not have support
181# for unwinding from a signal handler, enable checked dereferences and divides.
182if test $can_unwind_signal = no && test $enable_sjlj_exceptions = no; then
183 CHECKREFSPEC=-fcheck-references
184 DIVIDESPEC=-fuse-divide-subroutine
185 EXCEPTIONSPEC=
186fi
187
4b68fe8a
TT
188dnl See if the user wants to disable java.net. This is the mildly
189dnl ugly way that we admit that target-side configuration sucks.
190AC_ARG_ENABLE(java-net,
191[ --disable-java-net disable java.net])
192
193dnl Whether java.net is built by default can depend on the target.
3610e0d5 194if test -z "$enable_java_net"; then
4b68fe8a
TT
195 enable_java_net=${enable_java_net_default-yes}
196fi
006d4a9b 197if test "$enable_java_net" = no; then
e1a3a7d0 198 AC_DEFINE(DISABLE_JAVA_NET, 1, [Define if java.net native functions should be stubbed out.])
4b68fe8a
TT
199fi
200
c8fb9813
AG
201dnl See if the user wants to configure without libffi. Some
202dnl architectures don't support it, and default values are set in
203dnl configure.host.
204AC_ARG_WITH(libffi,
205[ --without-libffi don't use libffi],,with_libffi=${with_libffi_default-yes})
206
207LIBFFI=
208LIBFFIINCS=
209if test "$with_libffi" != no; then
e1a3a7d0 210 AC_DEFINE(USE_LIBFFI, 1, [Define if we're to use libffi.])
ce3b24a7 211 LIBFFI=../libffi/libffi_convenience.la
a15e868a 212 LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include'
c8fb9813
AG
213fi
214AC_SUBST(LIBFFI)
215AC_SUBST(LIBFFIINCS)
216
54c2f04b
AG
217dnl See if the user wants to disable JVMPI support.
218AC_ARG_ENABLE(jvmpi,
219[ --disable-jvmpi disable JVMPI support])
220
221if test "$enable_jvmpi" != no; then
e1a3a7d0 222 AC_DEFINE(ENABLE_JVMPI, 1, [Define if you are using JVMPI.])
54c2f04b
AG
223fi
224
ee9dd372
TT
225dnl If the target is an eCos system, use the appropriate eCos
226dnl I/O routines.
227dnl FIXME: this should not be a local option but a global target
228dnl system; at present there is no eCos target.
b5ee195f 229TARGET_ECOS=${PROCESS-"no"}
ee9dd372 230AC_ARG_WITH(ecos,
7941ceab 231[ --with-ecos enable runtime eCos target support],
ee9dd372
TT
232TARGET_ECOS="$with_ecos"
233)
234
8c78e3a3 235PLATFORMOBJS=
ee9dd372 236case "$TARGET_ECOS" in
54a190dd 237 no) case "$host" in
b8fe3c1e 238 *mingw*)
54a190dd 239 PLATFORM=Win32
9b5f18b1 240 PLATFORMNET=Win32
8c78e3a3
BM
241 PLATFORMOBJS=win32.lo
242 PLATFORMH=win32.h
e2a450f6 243 CHECK_FOR_BROKEN_MINGW_LD
54a190dd
AM
244 ;;
245 *)
246 PLATFORM=Posix
9b5f18b1 247 PLATFORMNET=Posix
8c78e3a3
BM
248 PLATFORMOBJS=posix.lo
249 PLATFORMH=posix.h
54a190dd
AM
250 ;;
251 esac
ee9dd372
TT
252 ;;
253 *)
54a190dd 254 PLATFORM=Ecos
9b5f18b1 255 PLATFORMNET=NoNet
e1a3a7d0 256 AC_DEFINE(ECOS, 1, [Define if you're running eCos.])
8c78e3a3
BM
257 PLATFORMOBJS=posix.lo
258 PLATFORMH=posix.h
ee9dd372
TT
259 ;;
260esac
8c78e3a3
BM
261AC_SUBST(PLATFORMOBJS)
262AC_LINK_FILES(include/$PLATFORMH, include/platform.h)
ee9dd372 263
e1a3a7d0
MK
264AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
265 [Define if you have int32_t and uint32_t.]))
266AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1,
267 [Define if you have int32_t and uint32_t.]))
268AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
269 [Define if you have u_int32_t]))
270AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1,
271 [Define if you have u_int32_t]))
0d16618c 272
ee9dd372
TT
273
274dnl These may not be defined in a non-ANS conformant embedded system.
275dnl FIXME: Should these case a runtime exception in that case?
e1a3a7d0
MK
276AC_EGREP_HEADER(mktime, time.h, AC_DEFINE(HAVE_MKTIME, 1,
277 [Define is you have 'mktime' in <time.h>]))
278AC_EGREP_HEADER(localtime, time.h, AC_DEFINE(HAVE_LOCALTIME, 1,
279 [Define is you have 'localtime' in <time.h>]))
ee9dd372
TT
280
281dnl Create the subdirectory for natFileDescriptor.cc, or the attempt
282dnl to create the link will fail.
283test -d java || mkdir java
284test -d java/io || mkdir java/io
213858c0 285test -d gnu || mkdir gnu
2d933a0b
AG
286AC_LINK_FILES(java/io/natFile${FILE-${PLATFORM}}.cc, java/io/natFile.cc)
287AC_LINK_FILES(java/io/natFileDescriptor${FILE-${PLATFORM}}.cc, java/io/natFileDescriptor.cc)
ee9dd372 288
42962a48
TT
289dnl Likewise for ConcreteProcess.java and natConcreteProcess.cc.
290test -d java/lang || mkdir java/lang
54a190dd
AM
291AC_LINK_FILES(java/lang/${PLATFORM}Process.java, java/lang/ConcreteProcess.java)
292AC_LINK_FILES(java/lang/nat${PLATFORM}Process.cc, java/lang/natConcreteProcess.cc)
42962a48 293
4a503716 294dnl Likewise for natInetAddress.cc and natNetworkInterface.cc.
9b5f18b1 295test -d java/net || mkdir java/net
71a15b15
MK
296AC_LINK_FILES(java/net/natInetAddress${PLATFORMNET}.cc, java/net/natInetAddress.cc)
297AC_LINK_FILES(java/net/natNetworkInterface${PLATFORMNET}.cc, java/net/natNetworkInterface.cc)
4a503716
MK
298
299dnl Likewise for natPlainSocketImpl.cc and natPlainDatagramSocketImpl.ca.c
300test -d gnu/java || mkdir gnu/java
301test -d gnu/java/net || mkdir gnu/java/net
302AC_LINK_FILES(gnu/java/net/natPlainSocketImpl${PLATFORMNET}.cc, gnu/java/net/natPlainSocketImpl.cc)
303AC_LINK_FILES(gnu/java/net/natPlainDatagramSocketImpl${PLATFORMNET}.cc, gnu/java/net/natPlainDatagramSocketImpl.cc)
9b5f18b1 304
4a8e624f 305case "${host}" in
b8fe3c1e 306 *mingw*)
4a8e624f
AM
307 SYSTEMSPEC="-lgdi32 -lwsock32 -lws2_32"
308 ;;
309 *)
310 SYSTEMSPEC=
311 ;;
312esac
f994389b
TT
313AC_SUBST(SYSTEMSPEC)
314
1e6347d8 315LIBGCJTESTSPEC="-L`${PWDCMD-pwd}`/.libs -rpath `${PWDCMD-pwd}`/.libs"
0f9c645e
AG
316AC_SUBST(LIBGCJTESTSPEC)
317
f994389b 318AC_ARG_WITH(system-zlib,
7941ceab 319[ --with-system-zlib use installed libz])
f994389b
TT
320ZLIBSPEC=
321AC_SUBST(ZLIBSPEC)
0f9c645e
AG
322ZLIBTESTSPEC=
323AC_SUBST(ZLIBTESTSPEC)
f994389b 324
5aac1dac
TT
325AC_PATH_XTRA
326
327dnl Determine which AWT peer libraries to build
328AC_ARG_ENABLE(java-awt,
329[ --enable-java-awt list of AWT peer implementations to be built])
330
331peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
332use_xlib_awt=""
333use_gtk_awt=""
334# The default toolkit to use is the first one specified.
335TOOLKIT=
336AC_SUBST(TOOLKIT)
337
338for peer in $peerlibs ; do
339 case $peer in
340 xlib)
341 if test "$no_x" = yes; then
342 echo "*** xlib peers requested but no X library available" 1>&2
343 exit 1
344 else
345 use_xlib_awt="yes"
346 if test -z "$TOOLKIT"; then
9e8e1bec 347 TOOLKIT=gnu.awt.xlib.XToolkit
5aac1dac
TT
348 fi
349 fi
350 ;;
351 gtk)
352 if test "$no_x" = yes; then
353 echo "*** xlib peers requested but no X library available" 1>&2
354 exit 1
355 else
356 use_gtk_awt=yes
357 if test -z "$TOOLKIT"; then
358 TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
359 fi
360 test -d jniinclude || mkdir jniinclude
361 fi
362 ;;
363 no)
364 use_xlib_awt=
365 use_gtk_awt=
366 break
367 ;;
368 *)
369 echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
370 exit 1
371 esac
372done
373
374AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
375AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
376
377
f994389b
TT
378dnl FIXME: this should be _libs on some hosts.
379libsubdir=.libs
380
ee9dd372
TT
381dnl Allow the GC to be disabled. Can be useful when debugging.
382AC_MSG_CHECKING([for garbage collector to use])
383AC_ARG_ENABLE(java-gc,
384changequote(<<,>>)dnl
7941ceab 385<< --enable-java-gc=TYPE choose garbage collector [boehm]>>,
ee9dd372
TT
386changequote([,])
387 GC=$enableval,
388 GC=boehm)
389GCLIBS=
390GCINCS=
391GCDEPS=
392GCOBJS=
f994389b 393GCSPEC=
bf3b8e42 394JC1GCSPEC=
0f9c645e 395GCTESTSPEC=
ee9dd372
TT
396case "$GC" in
397 boehm)
398 AC_MSG_RESULT(boehm)
ce3b24a7 399 GCLIBS=../boehm-gc/libgcjgc_convenience.la
bf3b8e42 400 JC1GCSPEC='-fuse-boehm-gc'
1e6347d8 401 GCTESTSPEC="-L`${PWDCMD-pwd}`/../boehm-gc/.libs -rpath `${PWDCMD-pwd}`/../boehm-gc/.libs"
ce3b24a7 402
ee9dd372
TT
403 dnl We also want to pick up some cpp flags required when including
404 dnl boehm-config.h. Yuck.
7160c99d 405 GCINCS="`cat ../boehm-gc/boehm-cflags`"
a3ffcff3 406 GCOBJS=boehm.lo
ee9dd372
TT
407 GCHDR=boehm-gc.h
408 dnl The POSIX thread support needs to know this.
e1a3a7d0 409 AC_DEFINE(HAVE_BOEHM_GC, 1, [Define if Boehm GC in use.])
ee9dd372
TT
410 ;;
411 no)
412 AC_MSG_RESULT(none)
a3ffcff3 413 GCOBJS=nogc.lo
ee9dd372
TT
414 GCHDR=no-gc.h
415 ;;
416 *)
417 AC_MSG_ERROR(unrecognized collector \"$GC\")
418 ;;
419esac
420AC_SUBST(GCLIBS)
421AC_SUBST(GCINCS)
422AC_SUBST(GCDEPS)
423AC_SUBST(GCOBJS)
f994389b 424AC_SUBST(GCSPEC)
bf3b8e42 425AC_SUBST(JC1GCSPEC)
0f9c645e 426AC_SUBST(GCTESTSPEC)
ee9dd372
TT
427AC_LINK_FILES(include/$GCHDR, include/java-gc.h)
428
429
2d65a52e
AO
430AC_MSG_CHECKING([for thread model used by GCC])
431THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
432AC_MSG_RESULT([$THREADS])
ee9dd372
TT
433
434case "$THREADS" in
435 no | none | single)
436 THREADS=none
437 ;;
438 posix | pthreads)
439 THREADS=posix
440 case "$host" in
441 *-*-linux*)
e1a3a7d0 442 AC_DEFINE(LINUX_THREADS, 1, [Define if using POSIX threads on Linux.])
ee9dd372
TT
443 ;;
444 esac
445 ;;
54a190dd
AM
446 win32)
447 ;;
448 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
ee9dd372
TT
449 AC_MSG_ERROR(thread package $THREADS not yet supported)
450 ;;
451 *)
452 AC_MSG_ERROR($THREADS is an unknown thread package)
453 ;;
454esac
ee9dd372 455
620a329b 456THREADCXXFLAGS=
5c009209 457THREADLDFLAGS=
ee9dd372
TT
458THREADLIBS=
459THREADINCS=
460THREADDEPS=
461THREADOBJS=
462THREADH=
f994389b 463THREADSPEC=
ee9dd372
TT
464case "$THREADS" in
465 posix)
1518ec60
TT
466 case "$host" in
467 *-*-cygwin*)
468 # Don't set THREADLIBS here. Cygwin doesn't have -lpthread.
469 ;;
da979152
LR
470changequote(<<,>>)
471 *-*-freebsd[1234]*)
472changequote([,])
473 # Before FreeBSD 5, it didn't have -lpthread (or any library which
474 # merely adds pthread_* functions) but it does have a -pthread switch
475 # which is required at link-time to select -lc_r *instead* of -lc.
5c009209 476 THREADLDFLAGS=-pthread
da979152
LR
477 # Don't set THREADSPEC here as might be expected since -pthread is
478 # not processed when found within a spec file, it must come from
479 # the command line. For now, the user must provide the -pthread
480 # switch to link code compiled with gcj. In future, consider adding
481 # support for weak references to pthread_* functions ala gthr.h API.
482 THREADSPEC='%{!pthread: %eUnder this configuration, the user must provide -pthread when linking.}'
483 ;;
484 *-*-freebsd*)
485 # FreeBSD 5 implements a model much closer to other modern UNIX
486 # which support threads. However, it still does not support
487 # -lpthread.
5c009209 488 THREADLDFLAGS=-pthread
da979152
LR
489 THREADSPEC=-lc_r
490 ;;
620a329b
RS
491 alpha*-dec-osf*)
492 THREADCXXFLAGS=-pthread
493 # boehm-gc needs some functions from librt, so link that too.
494 THREADLIBS='-lpthread -lrt'
495 THREADSPEC='-lpthread -lrt'
496 ;;
1518ec60
TT
497 *)
498 THREADLIBS=-lpthread
499 THREADSPEC=-lpthread
500 ;;
501 esac
a3ffcff3 502 THREADOBJS=posix-threads.lo
ee9dd372
TT
503 THREADH=posix-threads.h
504 # MIT pthreads doesn't seem to have the mutexattr functions.
505 # But for now we don't check for it. We just assume you aren't
506 # using MIT pthreads.
e1a3a7d0 507 AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
7f6e0fe6
TT
508
509 # If we're using the Boehm GC, then we happen to know that it
510 # defines _REENTRANT, so we don't bother. Eww.
511 if test "$GC" != boehm; then
512 AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
513 fi
514 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Required define if using POSIX threads])
ee9dd372
TT
515 ;;
516
54a190dd
AM
517 win32)
518 THREADOBJS=win32-threads.lo
519 THREADH=win32-threads.h
520 ;;
521
ee9dd372 522 none)
a3ffcff3 523 THREADOBJS=no-threads.lo
ee9dd372
TT
524 THREADH=no-threads.h
525 ;;
526esac
527AC_LINK_FILES(include/$THREADH, include/java-threads.h)
528AC_SUBST(THREADLIBS)
529AC_SUBST(THREADINCS)
530AC_SUBST(THREADDEPS)
531AC_SUBST(THREADOBJS)
f994389b 532AC_SUBST(THREADSPEC)
5c009209 533AC_SUBST(THREADLDFLAGS)
620a329b 534AC_SUBST(THREADCXXFLAGS)
ee9dd372 535
902c431d
DD
536if test -d sysdep; then true; else mkdir sysdep; fi
537AC_LINK_FILES(sysdep/$sysdeps_dir/locks.h, sysdep/locks.h)
45597167 538
cf6b8de4
TT
539HASH_SYNC_SPEC=
540# Hash synchronization is only useful with posix threads right now.
7deae97a 541if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
cf6b8de4 542 HASH_SYNC_SPEC=-fhash-synchronization
860a1536 543 AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
cf6b8de4
TT
544fi
545AC_SUBST(HASH_SYNC_SPEC)
546
547
ee9dd372
TT
548AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
549
550CANADIAN=no
551NULL_TARGET=no
f2646bf2 552NATIVE=yes
ee9dd372 553
212a2676 554# We're in the tree with gcc, and need to include some of its headers.
7f7ba9bf 555GCC_UNWIND_INCLUDE='-I$(libgcj_basedir)/../gcc'
ee9dd372 556
e2ea015c
AG
557# Figure out where generated headers like libgcj-config.h get installed.
558changequote(,)dnl
902c431d 559gcc_version_trigger=${libgcj_basedir}/../gcc/version.c
e2ea015c
AG
560gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
561gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
6ab37e1e 562tool_include_dir='$(libdir)/gcc/$(target_alias)/'${gcc_version}/include
e2ea015c
AG
563changequote([,])dnl
564AC_SUBST(tool_include_dir)
395cb211 565AC_SUBST(gcc_version)
e2ea015c 566
9e7823cc 567if test "x${with_newlib}" = "xyes"; then
ee9dd372
TT
568 # We are being configured with a cross compiler. AC_REPLACE_FUNCS
569 # may not work correctly, because the compiler may not be able to
570 # link executables.
571
572 # We assume newlib. This lets us hard-code the functions we know
573 # we'll have.
e1a3a7d0
MK
574 AC_DEFINE(HAVE_MEMMOVE, 1, [Define if you have memmove.])
575 AC_DEFINE(HAVE_MEMCPY, 1, [Define if you have memcpy.])
576 AC_DEFINE(HAVE_STRERROR, 1, [Define if you have strerror.])
577 AC_DEFINE(HAVE_TIME, 1, [Define if you have time.])
578 AC_DEFINE(HAVE_GMTIME_R, 1, [Define if you have the 'gmtime_r' function])
579 AC_DEFINE(HAVE_LOCALTIME_R, 1, [Define if you have the 'localtime_r' function.])
5463a4f3 580 AC_DEFINE(HAVE_USLEEP_DECL, 1, [Define if usleep is declared in <unistd.h>.])
ee9dd372 581 dnl This is only for POSIX threads.
e1a3a7d0 582 AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT, 1, [Define if using POSIX threads that have the mutexattr functions.])
ee9dd372
TT
583 dnl We also assume we are using gcc, which provides alloca.
584 AC_DEFINE(HAVE_ALLOCA)
585
6150df62 586 dnl Assume we do not have getuid and friends.
e1a3a7d0 587 AC_DEFINE(NO_GETUID, 1, [Define if getuid() and friends are missing.])
9b5f18b1 588 PLATFORMNET=NoNet
ee9dd372 589else
b5ee195f 590 AC_CHECK_FUNCS(strerror ioctl select fstat open fsync sleep opendir)
6150df62 591 AC_CHECK_FUNCS(gmtime_r localtime_r readdir_r getpwuid_r getcwd)
f4047540 592 AC_CHECK_FUNCS(access stat mkdir rename rmdir unlink realpath utime chmod)
860a1536 593 AC_CHECK_FUNCS(nl_langinfo setlocale)
ee9dd372 594 AC_CHECK_FUNCS(inet_aton inet_addr, break)
6130b0af 595 AC_CHECK_FUNCS(inet_pton uname inet_ntoa)
0148e1ee 596 AC_CHECK_FUNCS(fork execvp pipe sigaction ftruncate)
283a159f 597 AC_CHECK_HEADERS(execinfo.h unistd.h dlfcn.h)
19367215
HB
598 AC_CHECK_FUNC(backtrace, [
599 case "$host" in
600 ia64-*-linux*)
601 # Has broken backtrace()
602 ;;
603 *)
e1a3a7d0
MK
604 AC_DEFINE(HAVE_BACKTRACE, 1,
605 [Define if your platform has a working backtrace() function.])
19367215
HB
606 ;;
607 esac
e4261ef7
RM
608 ], [
609 case "$host" in
610 *mingw*)
611 # Has backtrace() defined in libgcj itself
e1a3a7d0
MK
612 AC_DEFINE(HAVE_BACKTRACE, 1,
613 [Define if your platform has a working backtrace() function.])
e4261ef7
RM
614 ;;
615 esac
19367215
HB
616 ])
617
b9f243c2 618 AC_CHECK_LIB(dl, dladdr, [
e1a3a7d0 619 AC_DEFINE(HAVE_DLADDR, 1, [Define if you have dladdr()])])
9e7823cc
L
620 if test x"$build" = x"$host"; then
621 AC_CHECK_FILES(/proc/self/exe, [
e1a3a7d0 622 AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])])
9e7823cc
L
623 else
624 case $host in
625 *-linux*)
e1a3a7d0 626 AC_DEFINE(HAVE_PROC_SELF_EXE, 1, [Define if you have /proc/self/exe])
9e7823cc
L
627 ;;
628 esac
629 fi
ee9dd372 630
860a1536 631 AM_ICONV
999825b0 632 AM_LC_MESSAGES
ebecd56d 633 AC_STRUCT_TIMEZONE
860a1536 634
ee9dd372 635 AC_CHECK_FUNCS(gethostbyname_r, [
e1a3a7d0
MK
636 AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
637 [Define if you have the 'gethostbyname_r' function.])
ee9dd372
TT
638 # There are two different kinds of gethostbyname_r.
639 # We look for the one that returns `int'.
640 # Hopefully this check is robust enough.
641 AC_EGREP_HEADER(int.*gethostbyname_r, netdb.h, [
e1a3a7d0 642 AC_DEFINE(GETHOSTBYNAME_R_RETURNS_INT, 1, [Define if gethostbyname_r returns 'int'.])])
34c5c0e1
AO
643
644 case " $GCINCS " in
645 *" -D_REENTRANT "*) ;;
646 *)
647 dnl On DU4.0, gethostbyname_r is only declared with -D_REENTRANT
648 AC_CACHE_CHECK([whether gethostbyname_r declaration requires -D_REENTRANT],
649 [libjava_cv_gethostbyname_r_needs_reentrant],
650 [ AC_LANG_SAVE
651 AC_LANG_CPLUSPLUS
652 AC_TRY_COMPILE([#include <netdb.h>],
653 [gethostbyname_r("", 0, 0);],
654 [libjava_cv_gethostbyname_r_needs_reentrant=no], [dnl
655 CPPFLAGS_SAVE="$CPPFLAGS"
656 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
657 AC_TRY_COMPILE([#include <netdb.h>], [gethostbyname_r("", 0, 0);],
658 [libjava_cv_gethostbyname_r_needs_reentrant=yes],
659 [libjava_cv_gethostbyname_r_needs_reentrant=fail])
660 CPPFLAGS="$CPPFLAGS_SAVE"
661 ])
662 AC_LANG_RESTORE
663 ])
664 if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
7f6e0fe6 665 AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
34c5c0e1
AO
666 fi
667 ;;
668 esac
669
670 AC_CACHE_CHECK([for struct hostent_data],
671 [libjava_cv_struct_hostent_data], [dnl
672 AC_TRY_COMPILE([
673#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
674# define _REENTRANT 1
675#endif
676#include <netdb.h>], [struct hostent_data data;],
677 [libjava_cv_struct_hostent_data=yes],
678 [libjava_cv_struct_hostent_data=no])])
679 if test "x$libjava_cv_struct_hostent_data" = xyes; then
680 AC_DEFINE(HAVE_STRUCT_HOSTENT_DATA, 1,
681 [Define if struct hostent_data is defined in netdb.h])
682 fi
683 ])
ee9dd372 684
da979152
LR
685 # FIXME: libjava source code expects to find a prototype for
686 # gethostbyaddr_r in netdb.h. The outer check ensures that
687 # HAVE_GETHOSTBYADDR_R will not be defined if the prototype fails
688 # to exist where expected. (The root issue: AC_CHECK_FUNCS assumes C
689 # linkage check is enough, yet C++ code requires proper prototypes.)
690 AC_EGREP_HEADER(gethostbyaddr_r, netdb.h, [
ee9dd372 691 AC_CHECK_FUNCS(gethostbyaddr_r, [
e1a3a7d0
MK
692 AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
693 [Define if you have the 'gethostbyaddr_r' function.])
ee9dd372
TT
694 # There are two different kinds of gethostbyaddr_r.
695 # We look for the one that returns `int'.
696 # Hopefully this check is robust enough.
697 AC_EGREP_HEADER(int.*gethostbyaddr_r, netdb.h, [
e1a3a7d0
MK
698 AC_DEFINE(GETHOSTBYADDR_R_RETURNS_INT, 1,
699 [Define if gethostbyaddr_r returns 'int'.])])])])
ee9dd372
TT
700
701 AC_CHECK_FUNCS(gethostname, [
e1a3a7d0
MK
702 AC_DEFINE(HAVE_GETHOSTNAME, 1,
703 [Define if you have the 'gethostname' function.])
ee9dd372 704 AC_EGREP_HEADER(gethostname, unistd.h, [
e1a3a7d0
MK
705 AC_DEFINE(HAVE_GETHOSTNAME_DECL, 1,
706 [Define if gethostname is declared in <unistd.h>.])])])
ee9dd372 707
6b3517ea
RO
708 AC_CHECK_FUNCS(usleep, [
709 AC_EGREP_HEADER(usleep, unistd.h, [
e1a3a7d0
MK
710 AC_DEFINE(HAVE_USLEEP_DECL, 1,
711 [Define if usleep is declared in <unistd.h>.])])])
6b3517ea 712
bc5afba4
TT
713 # Look for these functions in the thread library, but only bother
714 # if using POSIX threads.
715 if test "$THREADS" = posix; then
716 save_LIBS="$LIBS"
717 LIBS="$LIBS $THREADLIBS"
718 # Some POSIX thread systems don't have pthread_mutexattr_settype.
719 # E.g., Solaris.
720 AC_CHECK_FUNCS(pthread_mutexattr_settype pthread_mutexattr_setkind_np)
721
722 # Look for sched_yield. Up to Solaris 2.6, it is in libposix4, since
723 # Solaris 7 the name librt is preferred.
724 AC_CHECK_FUNCS(sched_yield, , [
725 AC_CHECK_LIB(rt, sched_yield, [
726 AC_DEFINE(HAVE_SCHED_YIELD)
727 THREADLIBS="$THREADLIBS -lrt"
f1b856d9 728 THREADSPEC="$THREADSPEC -lrt"], [
bc5afba4
TT
729 AC_CHECK_LIB(posix4, sched_yield, [
730 AC_DEFINE(HAVE_SCHED_YIELD)
731 THREADLIBS="$THREADLIBS -lposix4"
f1b856d9 732 THREADSPEC="$THREADSPEC -lposix4"])])])
bc5afba4
TT
733 LIBS="$save_LIBS"
734
735 # We can save a little space at runtime if the mutex has m_count
736 # or __m_count. This is a nice hack for Linux.
737 AC_TRY_COMPILE([#include <pthread.h>], [
738 extern pthread_mutex_t *mutex; int q = mutex->m_count;
e1a3a7d0
MK
739 ], AC_DEFINE(PTHREAD_MUTEX_HAVE_M_COUNT, 1,
740 [Define if pthread_mutex_t has m_count member.]), [
bc5afba4
TT
741 AC_TRY_COMPILE([#include <pthread.h>], [
742 extern pthread_mutex_t *mutex; int q = mutex->__m_count;
e1a3a7d0
MK
743 ], AC_DEFINE(PTHREAD_MUTEX_HAVE___M_COUNT, 1,
744 [Define if pthread_mutex_t has __m_count member.]))])
bc5afba4 745 fi
ee9dd372
TT
746
747 # We require a way to get the time.
748 time_found=no
749 AC_CHECK_FUNCS(gettimeofday time ftime, time_found=yes)
750 if test "$time_found" = no; then
751 AC_MSG_ERROR([no function found to get the time])
752 fi
753
138607df 754 AC_CHECK_FUNCS(memmove)
ee9dd372
TT
755
756 # We require memcpy.
757 memcpy_found=no
758 AC_CHECK_FUNCS(memcpy, memcpy_found=yes)
759 if test "$memcpy_found" = no; then
760 AC_MSG_ERROR([memcpy is required])
761 fi
762
04942eac
TT
763 AC_CHECK_LIB(dl, dlopen, [
764 AC_DEFINE(HAVE_DLOPEN, 1, [Define if dlopen is available])])
8107bcf9 765
f994389b
TT
766 # Some library-finding code we stole from Tcl.
767 #--------------------------------------------------------------------
768 # Check for the existence of the -lsocket and -lnsl libraries.
769 # The order here is important, so that they end up in the right
770 # order in the command line generated by make. Here are some
771 # special considerations:
772 # 1. Use "connect" and "accept" to check for -lsocket, and
773 # "gethostbyname" to check for -lnsl.
774 # 2. Use each function name only once: can't redo a check because
775 # autoconf caches the results of the last check and won't redo it.
776 # 3. Use -lnsl and -lsocket only if they supply procedures that
777 # aren't already present in the normal libraries. This is because
778 # IRIX 5.2 has libraries, but they aren't needed and they're
779 # bogus: they goof up name resolution if used.
780 # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
781 # To get around this problem, check for both libraries together
782 # if -lsocket doesn't work by itself.
783 #--------------------------------------------------------------------
784
785 AC_CACHE_CHECK([for socket libraries], gcj_cv_lib_sockets,
786 [gcj_cv_lib_sockets=
787 gcj_checkBoth=0
788 unset ac_cv_func_connect
789 AC_CHECK_FUNC(connect, gcj_checkSocket=0, gcj_checkSocket=1)
790 if test "$gcj_checkSocket" = 1; then
791 unset ac_cv_func_connect
792 AC_CHECK_LIB(socket, main, gcj_cv_lib_sockets="-lsocket",
793 gcj_checkBoth=1)
794 fi
795 if test "$gcj_checkBoth" = 1; then
796 gcj_oldLibs=$LIBS
797 LIBS="$LIBS -lsocket -lnsl"
798 unset ac_cv_func_accept
799 AC_CHECK_FUNC(accept,
800 [gcj_checkNsl=0
801 gcj_cv_lib_sockets="-lsocket -lnsl"])
802 unset ac_cv_func_accept
803 LIBS=$gcj_oldLibs
804 fi
805 unset ac_cv_func_gethostbyname
806 gcj_oldLibs=$LIBS
807 LIBS="$LIBS $gcj_cv_lib_sockets"
808 AC_CHECK_FUNC(gethostbyname, ,
809 [AC_CHECK_LIB(nsl, main,
810 [gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"])])
811 unset ac_cv_func_gethostbyname
812 LIBS=$gcj_oldLIBS
813 ])
814 SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets"
815
816 if test "$with_system_zlib" = yes; then
ce3b24a7 817 AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=)
f994389b
TT
818 fi
819
5aac1dac
TT
820 # Test for Gtk stuff, if asked for.
821 if test "$use_gtk_awt" = yes; then
29e531ff
TF
822 AM_PATH_GTK_2_0(2.0.0,,exit 1)
823 AM_PATH_GLIB_2_0(2.0.0,,exit 1,gthread)
5aac1dac
TT
824 dnl XXX Fix me when libart.m4 has the compile test fixed!
825 enable_libarttest=no
826 AM_PATH_LIBART(2.1.0,,exit 1)
827 fi
828
4b7f154f
TT
829 # On Solaris, and maybe other architectures, the Boehm collector
830 # requires -ldl.
831 if test "$GC" = boehm; then
832 AC_CHECK_LIB(dl, main, SYSTEMSPEC="$SYSTEMSPEC -ldl")
833 fi
17fdfd9f 834fi
4b7f154f 835
17fdfd9f
RE
836if test -z "${with_multisubdir}"; then
837 builddotdot=.
838else
58d2986d 839changequote(<<,>>)
17fdfd9f 840 builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`
58d2986d 841changequote([,])
d6f6aaf6
ME
842fi
843
844# Which gcj do we use?
845which_gcj=default
846built_gcc_dir="`cd ${builddotdot}/../../gcc && ${PWDCMD-pwd}`"
847if test -n "${with_cross_host}"; then
848 # We are being configured with a cross compiler. We can't
849 # use ac_exeext, because that is for the target platform.
850 NATIVE=no
851 cross_host_exeext=
852 case "${with_cross_host}" in
853 *mingw* | *cygwin*)
854 cross_host_exeext=.exe
855 ;;
856 esac
857 if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
e7cca7f4 858 if test x"$build_alias" = x"$with_cross_host"; then
d6f6aaf6
ME
859 # Ordinary cross (host!=target and host=build)
860 which_gcj=built
861 else
862 # Canadian cross (host!=target and host!=build)
863 which_gcj=cross
864 fi
865 else
866 which_gcj=cross
867 fi
868else
869 # We are being configured with a native or crossed-native compiler
870 if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
871 if test x"$build" = x"$host"; then
872 # True native build (host=target and host=build)
873 which_gcj=built
874 else
875 # Crossed-native build (host=target and host!=build)
876 which_gcj=cross
877 fi
878 else
879 which_gcj=path
880 fi
881fi
882case "${which_gcj}" in
883 built)
884 GCJ="$built_gcc_dir/gcj -B`${PWDCMD-pwd}`/ -B$built_gcc_dir/"
885 ;;
886 cross)
887 # See the comment in Makefile.am about CANADIAN being a misnomer
888 CANADIAN=yes
889 NULL_TARGET=no
890 if test "x${with_newlib}" = "xyes"; then
891 # FIXME (comment): Why is this needed?
892 GCC_UNWIND_INCLUDE=
893 GCJ="${target_alias}-gcj"
894 else
895 GCJ="${target_alias}-gcj -B`${PWDCMD-pwd}`/"
896 fi
897 ;;
898 path)
899 # See the comment in Makefile.am about CANADIAN being a misnomer
ee9dd372
TT
900 CANADIAN=yes
901 NULL_TARGET=yes
1e6347d8 902 GCJ="gcj -B`${PWDCMD-pwd}`/"
d6f6aaf6
ME
903 ;;
904esac
ee9dd372 905
58d2986d
AO
906# Create it, so that compile/link tests don't fail
907test -f libgcj.spec || touch libgcj.spec
58d2986d 908
5ec89e89
AO
909# We must search the source tree for java.lang, since we still don't
910# have libgcj.jar nor java/lang/*.class
911GCJ_SAVE_CPPFLAGS=$CPPFLAGS
1e6347d8 912CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
5ec89e89
AO
913
914# Since some classes depend on this one, we need its source available
915# before we can do any GCJ compilation test :-(
916if test ! -f gnu/classpath/Configuration.java; then
917 test -d gnu || mkdir gnu
918 test -d gnu/classpath || mkdir gnu/classpath
5aac1dac
TT
919 sed -e 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
920 -e 's,@TOOLKIT@,$TOOLKIT,' \
5ec89e89
AO
921 < $srcdir/gnu/classpath/Configuration.java.in \
922 > gnu/classpath/Configuration.java
923 # We do not want to redirect the output of the grep below to /dev/null,
924 # but we add /dev/null to the input list so that grep will print the
925 # filename of Configuration.java in case it finds any matches.
926 if grep @ gnu/classpath/Configuration.java /dev/null; then
927 AC_MSG_ERROR([configure.in is missing the substitutions above])
928 fi
929fi
930
58d2986d
AO
931LT_AC_PROG_GCJ
932
5ec89e89
AO
933CPPFLAGS=$GCJ_SAVE_CPPFLAGS
934
b5ee195f 935AC_COMPILE_CHECK_SIZEOF(void *)
99444711 936
f994389b 937ZLIBS=
ce3b24a7 938SYS_ZLIBS=
41e0e0cd 939ZINCS=
ce3b24a7
BM
940
941if test -z "$ZLIBSPEC"; then
942 # Use zlib from the GCC tree.
41e0e0cd 943 ZINCS='-I$(top_srcdir)/../zlib'
ce3b24a7 944 ZLIBS=../zlib/libzgcj_convenience.la
f994389b 945else
ce3b24a7
BM
946 # System's zlib.
947 SYS_ZLIBS="$ZLIBSPEC"
f994389b
TT
948fi
949AC_SUBST(ZLIBS)
ce3b24a7 950AC_SUBST(SYS_ZLIBS)
41e0e0cd 951AC_SUBST(ZINCS)
67a60018 952AC_SUBST(DIVIDESPEC)
5cb27a46 953AC_SUBST(CHECKREFSPEC)
e529c2c1 954AC_SUBST(EXCEPTIONSPEC)
c4ebd83d 955AC_SUBST(IEEESPEC)
f994389b 956
ee9dd372
TT
957AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
958AM_CONDITIONAL(NULL_TARGET, test "$NULL_TARGET" = yes)
f2646bf2 959AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes || test "$NULL_TARGET" = yes)
7013e7cd 960AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
52a11cbf 961AC_SUBST(GCC_UNWIND_INCLUDE)
ee9dd372 962
dbf45a01
AO
963if test -n "$with_cross_host" &&
964 test x"$with_cross_host" != x"no"; then
965 toolexecdir='$(exec_prefix)/$(target_alias)'
966 toolexecmainlibdir='$(toolexecdir)/lib'
967else
968 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
969 toolexecmainlibdir='$(libdir)'
970fi
ff8b9ca8
AS
971multi_os_directory=`$CC -print-multi-os-directory`
972case $multi_os_directory in
973 .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /.
974 *) toolexeclibdir=$toolexecmainlibdir/$multi_os_directory ;;
975esac
dbf45a01
AO
976AC_SUBST(toolexecdir)
977AC_SUBST(toolexecmainlibdir)
978AC_SUBST(toolexeclibdir)
979
1b5a2139
BM
980# Determine gcj version number.
981changequote(<<,>>)
982gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`
983changequote([,])
984GCJVERSION=$gcjversion
985AC_SUBST(GCJVERSION)
986AC_DEFINE_UNQUOTED(GCJVERSION, "$GCJVERSION", [Short GCJ version ID])
987
ee9dd372
TT
988dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
989dnl On that system, sys/ioctl.h will not include sys/filio.h unless
990dnl BSD_COMP is defined; just including sys/filio.h is simpler.
26ad77f1 991AC_CHECK_HEADERS(unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h pwd.h sys/config.h stdint.h langinfo.h locale.h)
ee9dd372
TT
992dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
993dnl for now. If you change this, you also must update natFile.cc.
994AC_CHECK_HEADERS(dirent.h)
04942eac
TT
995AC_CHECK_HEADERS(inttypes.h, [
996 AC_DEFINE(HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
997 AC_DEFINE(JV_HAVE_INTTYPES_H, 1, [Define if <inttypes.h> is available])
998])
0669d0ed 999AC_HEADER_SYS_WAIT
ee9dd372 1000
a3e174ea 1001AC_CHECK_TYPE([ssize_t], [int])
ccfe7e46
AO
1002
1003AC_MSG_CHECKING([for in_addr_t])
1004AC_TRY_COMPILE([#include <sys/types.h>
1005#if STDC_HEADERS
1006#include <stdlib.h>
1007#include <stddef.h>
1008#endif
1009#if HAVE_NETINET_IN_H
1010#include <netinet/in.h>
1011#endif], [in_addr_t foo;],
e1a3a7d0
MK
1012 [AC_DEFINE(HAVE_IN_ADDR_T, 1,
1013 [Define to 1 if 'in_addr_t' is defined in sys/types.h or netinet/in.h.])
ccfe7e46
AO
1014 AC_MSG_RESULT(yes)],
1015 [AC_MSG_RESULT(no)])
1016
1017AC_MSG_CHECKING([whether struct ip_mreq is in netinet/in.h])
1018AC_TRY_COMPILE([#include <netinet/in.h>], [struct ip_mreq mreq;],
e1a3a7d0
MK
1019 [AC_DEFINE(HAVE_STRUCT_IP_MREQ, 1,
1020 [Define if struct ip_mreq is defined in netinet/in.h.])
ccfe7e46
AO
1021 AC_MSG_RESULT(yes)],
1022 [AC_MSG_RESULT(no)])
a3e174ea 1023
60a78ccf
RO
1024AC_MSG_CHECKING([whether struct ipv6_mreq is in netinet/in.h])
1025AC_TRY_COMPILE([#include <netinet/in.h>], [struct ipv6_mreq mreq6;],
e1a3a7d0
MK
1026 [AC_DEFINE(HAVE_STRUCT_IPV6_MREQ, 1,
1027 [Define if struct ipv6_mreq is defined in netinet/in.h.])
60a78ccf
RO
1028 AC_MSG_RESULT(yes)],
1029 [AC_MSG_RESULT(no)])
1030
ee9dd372
TT
1031AC_MSG_CHECKING([whether struct sockaddr_in6 is in netinet/in.h])
1032AC_TRY_COMPILE([#include <netinet/in.h>], [struct sockaddr_in6 addr6;],
e1a3a7d0
MK
1033 [AC_DEFINE(HAVE_INET6, 1,
1034 [Define if inet6 structures are defined in netinet/in.h.])
ee9dd372
TT
1035 AC_MSG_RESULT(yes)],
1036 [AC_MSG_RESULT(no)])
1037
1038AC_MSG_CHECKING([for socklen_t in sys/socket.h])
60a78ccf
RO
1039AC_TRY_COMPILE([#define _POSIX_PII_SOCKET
1040#include <sys/types.h>
9121d9b1 1041#include <sys/socket.h>], [socklen_t x = 5;],
e1a3a7d0 1042 [AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define it socklen_t typedef is in sys/socket.h.])
ee9dd372
TT
1043 AC_MSG_RESULT(yes)],
1044 [AC_MSG_RESULT(no)])
1045
1046AC_MSG_CHECKING([for tm_gmtoff in struct tm])
1047AC_TRY_COMPILE([#include <time.h>], [struct tm tim; tim.tm_gmtoff = 0;],
e1a3a7d0 1048 [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
ee9dd372
TT
1049 AC_MSG_RESULT(yes)],
1050 [AC_MSG_RESULT(no)
1051 AC_MSG_CHECKING([for global timezone variable])
1052 dnl FIXME: we don't want a link check here because that won't work
1053 dnl when cross-compiling. So instead we make an assumption that
1054 dnl the header file will mention timezone if it exists.
0659e0e3
DB
1055 dnl Don't find the win32 function timezone
1056 AC_TRY_COMPILE([#include <time.h>], [void i(){long z2 = 2*timezone;}],
e1a3a7d0 1057 [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
ee9dd372 1058 AC_MSG_RESULT(yes)],
0659e0e3
DB
1059 [AC_MSG_RESULT(no)
1060 AC_MSG_CHECKING([for global _timezone variable])
1061 dnl FIXME: As above, don't want link check
1062 AC_TRY_COMPILE([#include <time.h>], [long z2 = _timezone;],
e1a3a7d0
MK
1063 [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
1064 [Define if your platform has the global _timezone variable.])
0659e0e3
DB
1065 AC_MSG_RESULT(yes)],
1066 [AC_MSG_RESULT(no)])])])
ee9dd372
TT
1067
1068AC_FUNC_ALLOCA
c0daa902 1069AC_FUNC_MMAP
ee9dd372
TT
1070
1071AC_CHECK_PROGS(PERL, perl, false)
1072
6c80c45e
TT
1073SYSDEP_SOURCES=
1074
1075case "${host}" in
1076 i?86-*-linux*)
1077 SIGNAL_HANDLER=include/i386-signal.h
1078 ;;
714708c8 1079 sparc*-sun-solaris*)
6c80c45e
TT
1080 SIGNAL_HANDLER=include/sparc-signal.h
1081 ;;
5a0bf1ee
RH
1082# ia64-*)
1083# SYSDEP_SOURCES=sysdep/ia64.c
1084# test -d sysdep || mkdir sysdep
1085# ;;
90b2d2af
AH
1086 ia64-*-linux*)
1087 SIGNAL_HANDLER=include/dwarf2-signal.h
1088 ;;
01936f3a 1089 powerpc-*-linux*)
beea2324 1090 SIGNAL_HANDLER=include/powerpc-signal.h
01936f3a 1091 ;;
c9bffcd5
AH
1092 alpha*-*-linux*)
1093 SIGNAL_HANDLER=include/dwarf2-signal.h
1094 ;;
e793a714
UW
1095 s390*-*-linux*)
1096 SIGNAL_HANDLER=include/s390-signal.h
1097 ;;
7b204712 1098 x86_64*-*-linux*)
399df6db 1099 SIGNAL_HANDLER=include/x86_64-signal.h
7b204712 1100 ;;
714708c8
DM
1101 sparc*-*-linux*)
1102 SIGNAL_HANDLER=include/dwarf2-signal.h
1103 ;;
4977bab6
ZW
1104 sh-*-linux* | sh[[34]]*-*-linux*)
1105 SIGNAL_HANDLER=include/dwarf2-signal.h
1106 ;;
b8fe3c1e 1107 *mingw*)
54a190dd
AM
1108 SIGNAL_HANDLER=include/win32-signal.h
1109 ;;
6c80c45e
TT
1110 *)
1111 SIGNAL_HANDLER=include/default-signal.h
1112 ;;
1113esac
1114
1115# If we're using sjlj exceptions, forget what we just learned.
c9bffcd5 1116if test "$enable_sjlj_exceptions" = yes; then
3cf88fb4 1117 SIGNAL_HANDLER=include/default-signal.h
3cf88fb4 1118fi
a4e44caa 1119
4b445d7c
AH
1120# Define here any compiler flags that you need in order to make backtrace() work.
1121BACKTRACESPEC=
1122case "${host}" in
1123 x86_64*-*-linux*)
1124 BACKTRACESPEC=-fno-omit-frame-pointer
1125 ;;
1126esac
1127AC_SUBST(BACKTRACESPEC)
1128
6c80c45e
TT
1129AC_SUBST(SYSDEP_SOURCES)
1130
a4e44caa
AH
1131AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h)
1132
ee9dd372
TT
1133if test "${multilib}" = "yes"; then
1134 multilib_arg="--enable-multilib"
1135else
1136 multilib_arg=
1137fi
1138
5950e016 1139
2622c79d 1140
1e6347d8 1141here=`${PWDCMD-pwd}`
ee9dd372
TT
1142AC_SUBST(here)
1143
7e0c895f
TT
1144# We get this from the environment.
1145AC_SUBST(GCJFLAGS)
480222b5 1146
7fbbd122 1147AC_OUTPUT(Makefile libgcj.pc libgcj.spec libgcj-test.spec gnu/classpath/Configuration.java gcj/Makefile include/Makefile testsuite/Makefile,
eb019738
TT
1148[# Only add multilib support code if we just rebuilt top-level Makefile.
1149case " $CONFIG_FILES " in
1150 *" Makefile "*)
6706f116 1151 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
eb019738
TT
1152 ac_file=Makefile . ${libgcj_basedir}/../config-ml.in
1153 ;;
1154esac
480222b5
TT
1155
1156# Make subdirectories and `.d' files. Look in both srcdir and
1157# builddir for the .java files.
1e6347d8 1158h=`${PWDCMD-pwd}`
480222b5 1159: > deps.mk
5aac1dac
TT
1160( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) ;
1161 find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) | \
480222b5 1162 fgrep -v testsuite | \
5aac1dac 1163 sed -e 's/\.java/.d/'\;'s/\.cc/.d/'\;'s/\.c/.d/' | \
480222b5
TT
1164 while read f; do
1165 echo "include $f" >> deps.mk
1166 test -f $f || {
1167changequote(<<,>>)
1168 d=`echo $f | sed -e 's,/[^/]*$,,'`
1169changequote([,])
9dd668d2
BM
1170 if test ! -d $d; then
1171 $libgcj_basedir/../mkinstalldirs $d
1172 fi;
583e347f 1173 echo > $f
480222b5
TT
1174 }
1175 done
1176],
ee9dd372
TT
1177srcdir=${srcdir}
1178host=${host}
1179target=${target}
1180with_multisubdir=${with_multisubdir}
1181ac_configure_args="${multilib_arg} ${ac_configure_args}"
1182CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
1183libgcj_basedir=${libgcj_basedir}
1184CC="${CC}"
1185CXX="${CXX}"
3343fdd2 1186ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
ee9dd372 1187)
This page took 0.50536 seconds and 5 git commands to generate.