Fix memory leak in ipa-pure-const
[gcc.git] / libjava / configure.ac
index 4cfd49fd56f9f9d254392f8c5243071d9e6d42b6..656384be1fae685f880fa3f5ef19b2f195b195d0 100644 (file)
@@ -1,4 +1,7 @@
 dnl # Process this with autoconf to create configure
+
+sinclude(../config/sjlj.m4)
+
 AC_PREREQ(2.64)
 # Still use "libjava" here to placate dejagnu.
 AC_INIT([libjava], [version-unused],, [libjava])
@@ -24,6 +27,8 @@ _GCC_TOPLEV_NONCANONICAL_TARGET
 
 AC_SUBST(target_noncanonical)
 
+GCC_LIBSTDCXX_RAW_CXX_FLAGS
+
 # This works around the fact that libtool configuration may change LD
 # for this particular configuration, but some shells, instead of
 # keeping the changes in LD private, export them just because LD is
@@ -469,7 +474,7 @@ case "${which_gcj}" in
    cross)
       if test "x${with_newlib}" = "xyes"; then
          # FIXME (comment): Why is this needed?
-         GCC_UNWIND_INCLUDE=
+         LIBGCC_UNWIND_INCLUDE=
       fi
       GCJH='$(target_noncanonical)-gcjh'
    ;;
@@ -697,58 +702,10 @@ INTERPRETER="$libgcj_interpreter"
 AC_SUBST(INTERPRETER)
 AM_CONDITIONAL(INTERPRETER, test "$libgcj_interpreter" = yes)
 
-AC_MSG_CHECKING([for exception model to use])
-AC_LANG_PUSH(C++)
-AC_ARG_ENABLE(sjlj-exceptions,
-  AS_HELP_STRING([--enable-sjlj-exceptions],
-                 [force use of builtin_setjmp for exceptions]),
-[:],
-[dnl Botheration.  Now we've got to detect the exception model.
-dnl Link tests against libgcc.a are problematic since -- at least
-dnl as of this writing -- we've not been given proper -L bits for
-dnl single-tree newlib and libgloss.
-dnl
-dnl This is what AC_TRY_COMPILE would do if it didn't delete the
-dnl conftest files before we got a change to grep them first.
-cat > conftest.$ac_ext << EOF
-[#]line __oline__ "configure"
-struct S { ~S(); };
-void bar();
-void foo()
-{
-  S s;
-  bar();
-}
-EOF
-old_CXXFLAGS="$CXXFLAGS"  
-CXXFLAGS=-S
-if AC_TRY_EVAL(ac_compile); then
-  if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
-    enable_sjlj_exceptions=yes
-  elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
-    enable_sjlj_exceptions=no
-  elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
-    # ARM EH ABI.
-    enable_sjlj_exceptions=no
-  fi
-fi
-CXXFLAGS="$old_CXXFLAGS"
-rm -f conftest*])
-if test x$enable_sjlj_exceptions = xyes; then
-  AC_DEFINE(SJLJ_EXCEPTIONS, 1,
-       [Define if the compiler is configured for setjmp/longjmp exceptions.])
-  ac_exception_model_name=sjlj
-elif test x$enable_sjlj_exceptions = xno; then
-  ac_exception_model_name="call frame"
-else
-  AC_MSG_ERROR([unable to detect exception model])
-fi
-AC_LANG_POP(C++)
-AC_MSG_RESULT($ac_exception_model_name)
-
-# If we are non using SJLJ exceptions, and this host does not have support 
+# If we are not using SJLJ exceptions, and this host does not have support 
 # for unwinding from a signal handler, enable checked dereferences and divides.
-if test $can_unwind_signal = no && test $enable_sjlj_exceptions = no; then
+GCC_CHECK_SJLJ_EXCEPTIONS
+if test $ac_cv_sjlj_exceptions = no && test $can_unwind_signal = no; then
   CHECKREFSPEC=-fcheck-references
   DIVIDESPEC=-fuse-divide-subroutine
   EXCEPTIONSPEC=
@@ -931,7 +888,7 @@ case "${host}" in
     # on Darwin -single_module speeds up loading of the dynamic libraries.
     extra_ldflags_libjava=-Wl,-single_module
     ;;
-arm*linux*eabi)
+arm*-*-linux-*)
     # Some of the ARM unwinder code is actually in libstdc++.  We
     # could in principle replicate it in libgcj, but it's better to
     # have a dependency on libstdc++.
@@ -961,17 +918,9 @@ esac
 AC_CACHE_CHECK([for --no-merge-exidx-entries], [libgcj_cv_exidx],
   [saved_ldflags="$LDFLAGS"
    LDFLAGS="${LDFLAGS} -Wl,--no-merge-exidx-entries"
-   # The IRIX 6 ld doesn't recognize --no-merge-exidx-entries, but only
-   # warns about unknown options, which breaks the testsuite.  So enable
-   # AC_LANG_WERROR, but there's currently (autoconf 2.64) no way to turn
-   # it off again.  As a workaround, save and restore werror flag like
-   # AC_PATH_XTRA.
-   ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag=$ac_[]_AC_LANG_ABBREV[]_werror_flag
-   AC_LANG_WERROR
    AC_LINK_IFELSE([int main(void){ return 0;} ],
                      [eval "libgcj_cv_exidx=yes"],
                      [eval "libgcj_cv_exidx=no"])
-   ac_[]_AC_LANG_ABBREV[]_werror_flag=$ac_xsave_[]_AC_LANG_ABBREV[]_werror_flag
    LDFLAGS="${saved_ldflags}"]
 )
 if test "${libgcj_cv_exidx}" = "yes"; then
@@ -1038,7 +987,7 @@ case "$THREADS" in
  no | none | single)
     THREADS=none
     ;;
- aix | posix | posix95 | pthreads)
+ aix | posix | pthreads)
     THREADS=posix
     case "$host" in
      *-*-linux*)
@@ -1070,7 +1019,7 @@ case "$THREADS" in
      *-*-cygwin*)
        # Don't set THREADLIBS here.  Cygwin doesn't have -lpthread.
        ;;
-     *-*-freebsd[[1234]]*)
+     *-*-freebsd[[34]].*)
        # Before FreeBSD 5, it didn't have -lpthread (or any library which
        # merely adds pthread_* functions) but it does have a -pthread switch
        # which is required at link-time to select -lc_r *instead* of -lc.
@@ -1088,25 +1037,12 @@ case "$THREADS" in
        THREADLDFLAGS=-pthread
        THREADSPEC=-lpthread
        ;;
-     alpha*-dec-osf* | hppa*-hp-hpux*)
+     hppa*-hp-hpux*)
        THREADCXXFLAGS=-pthread
        # boehm-gc needs some functions from librt, so link that too.
        THREADLIBS='-lpthread -lrt'
        THREADSPEC='-lpthread -lrt'
        ;;
-     *-*-solaris2.8)
-       # Always use alternate thread library on Solaris 8.  Need libthread
-       # for TLS support.
-       # Need -Wl,-R to get it through libtool ...
-       THREADLIBS='-L/usr/lib/lwp$(MULTISUBDIR) -Wl,-R -Wl,/usr/lib/lwp$(MULTISUBDIR) -lpthread -lthread'
-       # ... while ld only accepts -R.
-       THREADSPEC='-L/usr/lib/lwp%{m64:/64} -R/usr/lib/lwp%{m64:/64} -lpthread -lthread'
-        ;;
-     *-*-solaris2.9)
-       # As on Solaris 8, need libthread for TLS support.
-       THREADLIBS='-lpthread -lthread'
-       THREADSPEC='-lpthread -lthread'
-       ;;
      *-*-darwin*)
        # Don't set THREADLIBS or THREADSPEC as Darwin already
        # provides pthread via libSystem.
@@ -1145,9 +1081,14 @@ case "$THREADS" in
     # FIXME: In Java we are able to detect thread death at the end of
     # Thread.run() so we should be able to clean up the exception handling
     # contexts ourselves.
-    THREADSTARTFILESPEC='crtmt%O%s'
+    case "$host" in
+    *-w64-mingw*)
+      ;;
+    *)
+      THREADSTARTFILESPEC='crtmt%O%s'
+      ;;
+    esac
     ;;
-
  none)
     THREADH=no-threads.h
     ;;
@@ -1199,8 +1140,8 @@ AC_SUBST(HASH_SYNC_SPEC)
 
 AM_CONDITIONAL(USING_GCC, test "$GCC" = yes)
 
-# We're in the tree with gcc, and need to include some of its headers.
-GCC_UNWIND_INCLUDE='-I$(multi_basedir)/./libjava/../gcc'
+# We're in the tree with libgcc, and need to include some of its headers.
+LIBGCC_UNWIND_INCLUDE='-I$(multi_basedir)/./libjava/../libgcc'
 
 if test "x${with_newlib}" = "xyes"; then
    # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
@@ -1476,10 +1417,6 @@ else
    # requires -ldl.
    if test "$GC" = boehm; then
       case "${host}" in
-          mips-sgi-irix6*)
-           # While IRIX 6 has libdl for the O32 and N32 ABIs, the N64 one is
-           # missing.  It's unnecessary anyway since dlopen lives in libc.
-           ;;
          *-*-darwin*)
            ;;
          *)
@@ -1564,7 +1501,7 @@ AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes)
 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = yes)
 AM_CONDITIONAL(NEEDS_DATA_START, test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes)
 AM_CONDITIONAL(INSTALL_BINARIES, test -z "${with_multisubdir}")
-AC_SUBST(GCC_UNWIND_INCLUDE)
+AC_SUBST(LIBGCC_UNWIND_INCLUDE)
 
 # Process the option "--enable-version-specific-runtime-libs"
 # Calculate toolexeclibdir
@@ -1609,15 +1546,7 @@ AC_DEFINE_UNQUOTED(GCJVERSION, "$GCJVERSION", [Short GCJ version ID])
 # Determine where the standard .db file and GNU Classpath JNI
 # libraries are found.
 gcjsubdir=gcj-$gcjversion-$libgcj_soversion
-multi_os_directory=`$CC -print-multi-os-directory`
-case $multi_os_directory in
-  .)
-   dbexecdir='$(libdir)/'$gcjsubdir # Avoid /.
-   ;;
-  *)
-   dbexecdir='$(libdir)/'$multi_os_directory/$gcjsubdir
-   ;;
-esac
+dbexecdir='$(toolexeclibdir)/'$gcjsubdir
 AC_SUBST(dbexecdir)
 AC_SUBST(gcjsubdir)
 
@@ -1631,7 +1560,7 @@ TL_AC_GXX_INCLUDE_DIR
 # BSD_COMP is defined; just including sys/filio.h is simpler.
 # We avoid AC_HEADER_DIRENT since we really only care about dirent.h
 # for now.  If you change this, you also must update natFile.cc.
-AC_CHECK_HEADERS([unistd.h bstring.h sys/time.h sys/types.h fcntl.h \
+AC_CHECK_HEADERS([unistd.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 \
                  pwd.h sys/config.h stdint.h langinfo.h locale.h \
@@ -1727,11 +1656,12 @@ SYSDEP_SOURCES=
 SIGNAL_HANDLER_AUX=
 
 case "${host}" in
+ *-*-solaris2*)
+    SIGNAL_HANDLER=include/posix-signal.h
+    ;;
  i?86-*-linux*)
     SIGNAL_HANDLER=include/i386-signal.h
-    ;;
- *-*-solaris2*)
-    SIGNAL_HANDLER=include/solaris-signal.h
+    SIGNAL_HANDLER_AUX=include/x86_64-signal.h
     ;;
 # ia64-*)
 #    SYSDEP_SOURCES=sysdep/ia64.c
@@ -1780,13 +1710,16 @@ case "${host}" in
  powerpc*-*-aix*)
     SIGNAL_HANDLER=include/aix-signal.h
     ;;
+ i?86-*-freebsd* | x86_64-*-freebsd*)
+    SIGNAL_HANDLER=include/freebsd-signal.h
+    ;;
  *)
     SIGNAL_HANDLER=include/default-signal.h
     ;;
 esac
 
 # If we're using sjlj exceptions, forget what we just learned.
-if test "$enable_sjlj_exceptions" = yes; then
+if test "$ac_cv_sjlj_exceptions" = yes; then
    SIGNAL_HANDLER=include/default-signal.h
    SIGNAL_HANDLER_AUX=
 fi
@@ -1819,7 +1752,7 @@ AC_CACHE_CHECK([whether ld supports anonymous version scripts],
      AS_HELP_STRING([--disable-symvers],
                    [disable symbol versioning for libjava]),
        [case "$enableval" in
-         yes) libjava_cv_anon_version_script=yes ;;
+         yes|gnu*) libjava_cv_anon_version_script=yes ;;
          no)  libjava_cv_anon_version_script=no ;;
          *)   AC_MSG_ERROR([Unknown argument to enable/disable symvers]);;
         esac],