OSDN Git Service

Mention PR number in my previous commit
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / acinclude.m4
index 2d046e9..45e0229 100644 (file)
@@ -49,7 +49,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
   # Keep these sync'd with the list in Makefile.am.  The first provides an
   # expandable list at autoconf time; the second provides an expandable list
   # (i.e., shell variable) at configure time.
-  m4_define([glibcxx_SUBDIRS],[include libsupc++ src doc po testsuite])
+  m4_define([glibcxx_SUBDIRS],[include libsupc++ python src doc po testsuite])
   SUBDIRS='glibcxx_SUBDIRS'
 
   # These need to be absolute paths, yet at the same time need to
@@ -79,35 +79,6 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
     AC_HELP_STRING([--with-newlib],
                    [assume newlib as a system C library]))
 
-  # We're almost certainly being configured before anything else which uses
-  # C++, so all of our AC_PROG_* discoveries will be cached.  It's vital that
-  # we not cache the value of CXX that we "discover" here, because it's set
-  # to something unique for us and libjava.  Other target libraries need to
-  # find CXX for themselves.  We yank the rug out from under the normal AC_*
-  # process by sneakily renaming the cache variable.  This also lets us debug
-  # the value of "our" CXX in postmortems.
-  #
-  # We must also force CXX to /not/ be a precious variable, otherwise the
-  # wrong (non-multilib-adjusted) value will be used in multilibs.  This
-  # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS.  And as a side
-  # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
-  # that ourselves.  Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
-  #
-  # -fno-builtin must be present here so that a non-conflicting form of
-  # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
-
-  m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
-  m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
-  m4_define([_AC_ARG_VAR_PRECIOUS],[])
-  save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -fno-builtin"
-  AC_PROG_CC
-  AC_PROG_CXX
-  CXXFLAGS="$save_CXXFLAGS"
-  m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
-  AC_SUBST(CFLAGS)
-  AC_SUBST(CXXFLAGS)
-
   # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
   # available).  Uncomment the next line to force a particular method.
   AC_PROG_LN_S
@@ -2429,7 +2400,8 @@ dnl is intended to be an all-or-nothing switch, so all the atomic operations
 dnl that are used should be checked.
 dnl
 dnl Note:
-dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
+dnl libgomp and libgfortran do this with a link test, instead of an asm test.
+dnl see: CHECK_SYNC_FETCH_AND_ADD
 dnl
 dnl Defines:
 dnl  _GLIBCXX_ATOMIC_BUILTINS_1 
@@ -2441,110 +2413,12 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
   old_CXXFLAGS="$CXXFLAGS"
-
-  # Do link tests if possible, instead asm tests.
-  if test x$gcc_no_link != xyes; then  
-
-  # Can do link tests.
-
-  CXXFLAGS="$CXXFLAGS -fno-exceptions"
-
-  AC_MSG_CHECKING([for atomic builtins for bool])
-  AC_CACHE_VAL(glibcxx_cv_atomic_bool, [
-    AC_TRY_LINK(
-      [ ],
-      [typedef bool atomic_type;
-       atomic_type c1;
-       atomic_type c2;
-       const atomic_type c3(0);
-       __sync_fetch_and_add(&c1, c2);
-       __sync_val_compare_and_swap(&c1, c3, c2);
-       __sync_lock_test_and_set(&c1, c3);
-       __sync_lock_release(&c1);
-       __sync_synchronize();],
-      [glibcxx_cv_atomic_bool=yes],
-      [glibcxx_cv_atomic_bool=no])
-  ])    
-  if test $glibcxx_cv_atomic_bool = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
-      [Define if builtin atomic operations for bool are supported on this host.])
-  fi
-  AC_MSG_RESULT($glibcxx_cv_atomic_bool)
-
-  AC_MSG_CHECKING([for atomic builtins for short])
-  AC_CACHE_VAL(glibcxx_cv_atomic_short, [
-    AC_TRY_LINK(
-      [ ],
-      [typedef short atomic_type;
-       atomic_type c1;
-       atomic_type c2;
-       const atomic_type c3(0);
-       __sync_fetch_and_add(&c1, c2);
-       __sync_val_compare_and_swap(&c1, c3, c2);
-       __sync_lock_test_and_set(&c1, c3);
-       __sync_lock_release(&c1);
-       __sync_synchronize();],
-      [glibcxx_cv_atomic_short=yes],
-      [glibcxx_cv_atomic_short=no])
-  ])    
-  if test $glibcxx_cv_atomic_short = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
-      [Define if builtin atomic operations for short are supported on this host.])
-  fi
-  AC_MSG_RESULT($glibcxx_cv_atomic_short)
-
-  AC_MSG_CHECKING([for atomic builtins for int])
-  AC_CACHE_VAL(glibcxx_cv_atomic_int, [
-    AC_TRY_LINK(
-      [ ],
-      [typedef int atomic_type;
-       atomic_type c1;
-       atomic_type c2;
-       const atomic_type c3(0);
-       __sync_fetch_and_add(&c1, c2);
-       __sync_val_compare_and_swap(&c1, c3, c2);
-       __sync_lock_test_and_set(&c1, c3);
-       __sync_lock_release(&c1);
-       __sync_synchronize();],
-      [glibcxx_cv_atomic_int=yes],
-      [glibcxx_cv_atomic_int=no])
-  ])    
-  if test $glibcxx_cv_atomic_int = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
-      [Define if builtin atomic operations for int are supported on this host.])
-  fi
-  AC_MSG_RESULT($glibcxx_cv_atomic_int)
-
-  AC_MSG_CHECKING([for atomic builtins for long long])
-  AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [
-    AC_TRY_LINK(
-      [ ],
-      [typedef long long atomic_type;
-       atomic_type c1;
-       atomic_type c2;
-       const atomic_type c3(0);
-       __sync_fetch_and_add(&c1, c2);
-       __sync_val_compare_and_swap(&c1, c3, c2);
-       __sync_lock_test_and_set(&c1, c3);
-       __sync_lock_release(&c1);
-       __sync_synchronize();],
-      [glibcxx_cv_atomic_long_long=yes],
-      [glibcxx_cv_atomic_long_long=no])
-  ])    
-  if test $glibcxx_cv_atomic_long_long = yes; then
-    AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
-      [Define if builtin atomic operations for long long are supported on this host.])
-  fi
-  AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
-
-  else
-
-  # Do asm tests.
-
+  
   # Compile unoptimized.
   CXXFLAGS='-O0 -S'
 
-  # Fake what AC_TRY_COMPILE does.
+  # Fake what AC_TRY_COMPILE does, without linking as this is
+  # unnecessary for a builtins test.
 
     cat > conftest.$ac_ext << EOF
 [#]line __oline__ "configure"
@@ -2566,14 +2440,14 @@ EOF
     AC_MSG_CHECKING([for atomic builtins for bool])
     if AC_TRY_EVAL(ac_compile); then
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
-        glibcxx_cv_atomic_bool=no
+        enable_atomic_builtinsb=no
       else
       AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
       [Define if builtin atomic operations for bool are supported on this host.])
-        glibcxx_cv_atomic_bool=yes
+        enable_atomic_builtinsb=yes
       fi
     fi
-    AC_MSG_RESULT($glibcxx_cv_atomic_bool)
+    AC_MSG_RESULT($enable_atomic_builtinsb)
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
@@ -2596,14 +2470,14 @@ EOF
     AC_MSG_CHECKING([for atomic builtins for short])
     if AC_TRY_EVAL(ac_compile); then
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
-        glibcxx_cv_atomic_short=no
+        enable_atomic_builtinss=no
       else
       AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
       [Define if builtin atomic operations for short are supported on this host.])
-        glibcxx_cv_atomic_short=yes
+        enable_atomic_builtinss=yes
       fi
     fi
-    AC_MSG_RESULT($glibcxx_cv_atomic_short)
+    AC_MSG_RESULT($enable_atomic_builtinss)
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
@@ -2627,14 +2501,14 @@ EOF
     AC_MSG_CHECKING([for atomic builtins for int])
     if AC_TRY_EVAL(ac_compile); then
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
-        glibcxx_cv_atomic_int=no
+        enable_atomic_builtinsi=no
       else
       AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
         [Define if builtin atomic operations for int are supported on this host.])
-        glibcxx_cv_atomic_int=yes
+        enable_atomic_builtinsi=yes
       fi
     fi
-    AC_MSG_RESULT($glibcxx_cv_atomic_int)
+    AC_MSG_RESULT($enable_atomic_builtinsi)
     rm -f conftest*
 
     cat > conftest.$ac_ext << EOF
@@ -2657,23 +2531,22 @@ EOF
     AC_MSG_CHECKING([for atomic builtins for long long])
     if AC_TRY_EVAL(ac_compile); then
       if grep __sync_ conftest.s >/dev/null 2>&1 ; then
-        glibcxx_cv_atomic_long_long=no
+        enable_atomic_builtinsll=no
       else
       AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
       [Define if builtin atomic operations for long long are supported on this host.])
-        glibcxx_cv_atomic_long_long=yes
+        enable_atomic_builtinsll=yes
       fi
     fi
-    AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
+    AC_MSG_RESULT($enable_atomic_builtinsll)
     rm -f conftest*
 
-  fi
 
   CXXFLAGS="$old_CXXFLAGS"
   AC_LANG_RESTORE
 
   # Set atomicity_dir to builtins if either of above tests pass.
-  if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
+  if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then
     atomicity_dir=cpu/generic/atomicity_builtins
   fi