diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 96672f8b9ce..23057295399 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,6 +1,13 @@ +2008-04-25 Benjamin Kosnik + + PR libstdc++/35887 + * acinclude.m4: (GLIBCXX_ENABLE_PARALLEL): Check for thread support. + * configure.ac: Re-order compiler macros. + * configure: Regenerated. + 2008-04-24 Benjamin Kosnik - PR libstdc++/35887 + PR libstdc++/35887 * configure.ac: Add default argument to GLIBCXX_ENABLE_PARALLEL. Move atomic warnings to GLIBCXX_ENABLE_ATOMIC_BUILTINS. * acinclude.m4 (GLIBCXX_ENABLE_PARALLEL): Check for --disable-libgomp. @@ -9,7 +16,7 @@ * include/Makefile.am (parallel_headers): Make conditional on ENABLE_PARALLEL. * include/Makefile.in: Regenerate. - + 2008-04-24 Paolo Carlini PR libstdc++/35969 @@ -30,7 +37,7 @@ * include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS_4. * libsupc++/guard.cc: Use _GLIBCXX_ATOMIC_BUILTINS_4. * doc/xml/manual/concurrency.xm: Update docs. - + 2008-04-23 Benjamin Kosnik * config/os/hpux/os_defines.h: Use _GLIBCXX_BEGIN_NAMESPACE, diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 90c4e4f6d21..0b76efcc46b 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1748,14 +1748,19 @@ AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [ enable_parallel=no; - # Check to see if OpenMP is explicitly disabled. - AC_MSG_CHECKING([for libgomp support]) - GLIBCXX_ENABLE(libgomp,$1,,[enable code depending on libgomp],[permit yes|no]) - AC_MSG_RESULT([$enable_libgomp]) - if test x$enable_libgomp = xno; then - enable_parallel=no - else - enable_parallel=yes + # Check to see if threads are disabled. + # Requires GLIBCXX_ENABLE_THREADS. + if test x$enable_thread = xyes; then + + # Check to see if OpenMP is disabled. + AC_MSG_CHECKING([for libgomp support]) + GLIBCXX_ENABLE(libgomp,$1,,[enable code depending on libgomp], + [permit yes|no]) + AC_MSG_RESULT([$enable_libgomp]) + if test x$enable_libgomp = xyes; then + enable_parallel=yes + fi + fi AC_MSG_CHECKING([for parallel mode support]) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index ca764fc3589..ded1ca36a66 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -458,7 +458,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS glibcxx_thread_h WERROR SECTION_FLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -13980,6 +13980,354 @@ echo "${ECHO_T}$enable_libstdcxx_pch" >&6 + + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + old_CXXFLAGS="$CXXFLAGS" + + # Compile unoptimized. + CXXFLAGS='-O0 -S' + + # Fake what AC_TRY_COMPILE does, without linking as this is + # unnecessary for a builtins test. + + cat > conftest.$ac_ext << EOF +#line 14000 "configure" +int main() +{ + // NB: _Atomic_word not necessarily int. + 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(); + return 0; +} +EOF + + echo "$as_me:$LINENO: checking for atomic builtins for int" >&5 +echo $ECHO_N "checking for atomic builtins for int... $ECHO_C" >&6 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if grep __sync_ conftest.s >/dev/null 2>&1 ; then + enable_atomic_builtinsi=no + else + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_ATOMIC_BUILTINS_4 1 +_ACEOF + + enable_atomic_builtinsi=yes + fi + fi + echo "$as_me:$LINENO: result: $enable_atomic_builtinsi" >&5 +echo "${ECHO_T}$enable_atomic_builtinsi" >&6 + rm -f conftest* + + cat > conftest.$ac_ext << EOF +#line 14040 "configure" +int main() +{ + 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(); + return 0; +} +EOF + + echo "$as_me:$LINENO: checking for atomic builtins for bool" >&5 +echo $ECHO_N "checking for atomic builtins for bool... $ECHO_C" >&6 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if grep __sync_ conftest.s >/dev/null 2>&1 ; then + enable_atomic_builtinsb=no + else + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_ATOMIC_BUILTINS_1 1 +_ACEOF + + enable_atomic_builtinsb=yes + fi + fi + echo "$as_me:$LINENO: result: $enable_atomic_builtinsb" >&5 +echo "${ECHO_T}$enable_atomic_builtinsb" >&6 + rm -f conftest* + + CXXFLAGS="$old_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # Set atomicity_dir to builtins if either of above tests pass. + if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then + atomicity_dir=cpu/generic/atomicity_builtins + fi + + # If still generic, set to mutex. + if test $atomicity_dir = "cpu/generic" ; then + atomicity_dir=cpu/generic/atomicity_mutex + { echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5 +echo "$as_me: WARNING: No native atomic operations are provided for this platform." >&2;} + if test $target_thread_file = single; then + { echo "$as_me:$LINENO: WARNING: They cannot be faked when thread support is disabled." >&5 +echo "$as_me: WARNING: They cannot be faked when thread support is disabled." >&2;} + { echo "$as_me:$LINENO: WARNING: Thread-safety of certain classes is not guaranteed." >&5 +echo "$as_me: WARNING: Thread-safety of certain classes is not guaranteed." >&2;} + else + { echo "$as_me:$LINENO: WARNING: They will be faked using a mutex." >&5 +echo "$as_me: WARNING: They will be faked using a mutex." >&2;} + { echo "$as_me:$LINENO: WARNING: Performance of certain classes will degrade as a result." >&5 +echo "$as_me: WARNING: Performance of certain classes will degrade as a result." >&2;} + fi + fi + + + + echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 +echo $ECHO_N "checking for thread model used by GCC... $ECHO_C" >&6 + target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` + echo "$as_me:$LINENO: result: $target_thread_file" >&5 +echo "${ECHO_T}$target_thread_file" >&6 + + if test $target_thread_file != single; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GTHR_DEFAULT 1 +_ACEOF + + fi + + glibcxx_thread_h=gthr-$target_thread_file.h + + gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h} + if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then + enable_thread=yes + else + enable_thread=no + fi + + + + +# Checks for compiler support that don't require linking. + + # All these tests are for C++; save the language and the compiler flags. + # The CXXFLAGS thing is suspicious, but based on similar bits previously + # found in GLIBCXX_CONFIGURE. + + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + + # Check for maintainer-mode bits. + if test x"$USE_MAINTAINER_MODE" = xno; then + WERROR='' + else + WERROR='-Werror' + fi + + # Check for -ffunction-sections -fdata-sections + echo "$as_me:$LINENO: checking for g++ that supports -ffunction-sections -fdata-sections" >&5 +echo $ECHO_N "checking for g++ that supports -ffunction-sections -fdata-sections... $ECHO_C" >&6 + CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections' + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int foo; void bar() { }; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_fdsections=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_fdsections=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" + else + # this is the suspicious part + CXXFLAGS='' + fi + if test x"$ac_fdsections" = x"yes"; then + SECTION_FLAGS='-ffunction-sections -fdata-sections' + fi + echo "$as_me:$LINENO: result: $ac_fdsections" >&5 +echo "${ECHO_T}$ac_fdsections" >&6 + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + echo "$as_me:$LINENO: checking for ISO C++200x standard layout type support" >&5 +echo $ECHO_N "checking for ISO C++200x standard layout type support... $ECHO_C" >&6 + if test "${ac_standard_layout+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS='-std=gnu++0x' + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +struct b + { + bool t; + + // Need standard layout relaxation from POD + private: + b& operator=(const b&); + b(const b&); + }; + + int main() + { + b tst1 = { false }; + return 0; + } +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_standard_layout=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_standard_layout=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + CXXFLAGS="$ac_save_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi + + echo "$as_me:$LINENO: result: $ac_standard_layout" >&5 +echo "${ECHO_T}$ac_standard_layout" >&6 + if test x"$ac_standard_layout" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_USE_STANDARD_LAYOUT 1 +_ACEOF + + fi + + # Enable all the variable C++ runtime options that doesn't require linking. echo "$as_me:$LINENO: checking for underlying I/O to use" >&5 @@ -16909,10 +17257,14 @@ echo "${ECHO_T}$enable_libstdcxx_debug" >&6 enable_parallel=no; - # Check to see if OpenMP is explicitly disabled. - echo "$as_me:$LINENO: checking for libgomp support" >&5 + # Check to see if threads are disabled. + # Requires GLIBCXX_ENABLE_THREADS. + if test x$enable_thread = xyes; then + + # Check to see if OpenMP is disabled. + echo "$as_me:$LINENO: checking for libgomp support" >&5 echo $ECHO_N "checking for libgomp support... $ECHO_C" >&6 - # Check whether --enable-libgomp or --disable-libgomp was given. + # Check whether --enable-libgomp or --disable-libgomp was given. if test "${enable_libgomp+set}" = set; then enableval="$enable_libgomp" @@ -16927,12 +17279,12 @@ else enable_libgomp=yes fi; - echo "$as_me:$LINENO: result: $enable_libgomp" >&5 + echo "$as_me:$LINENO: result: $enable_libgomp" >&5 echo "${ECHO_T}$enable_libgomp" >&6 - if test x$enable_libgomp = xno; then - enable_parallel=no - else - enable_parallel=yes + if test x$enable_libgomp = xyes; then + enable_parallel=yes + fi + fi echo "$as_me:$LINENO: checking for parallel mode support" >&5 @@ -17955,353 +18307,6 @@ fi - echo "$as_me:$LINENO: checking for ISO C++200x standard layout type support" >&5 -echo $ECHO_N "checking for ISO C++200x standard layout type support... $ECHO_C" >&6 - if test "${ac_standard_layout+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - - - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - ac_test_CXXFLAGS="${CXXFLAGS+set}" - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS='-std=gnu++0x' - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -struct b - { - bool t; - - // Need standard layout relaxation from POD - private: - b& operator=(const b&); - b(const b&); - }; - - int main() - { - b tst1 = { false }; - return 0; - } -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_standard_layout=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_standard_layout=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - - CXXFLAGS="$ac_save_CXXFLAGS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi - - echo "$as_me:$LINENO: result: $ac_standard_layout" >&5 -echo "${ECHO_T}$ac_standard_layout" >&6 - if test x"$ac_standard_layout" = x"yes"; then - -cat >>confdefs.h <<\_ACEOF -#define _GLIBCXX_USE_STANDARD_LAYOUT 1 -_ACEOF - - fi - - - echo "$as_me:$LINENO: checking for thread model used by GCC" >&5 -echo $ECHO_N "checking for thread model used by GCC... $ECHO_C" >&6 - target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` - echo "$as_me:$LINENO: result: $target_thread_file" >&5 -echo "${ECHO_T}$target_thread_file" >&6 - - if test $target_thread_file != single; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GTHR_DEFAULT 1 -_ACEOF - - fi - - glibcxx_thread_h=gthr-$target_thread_file.h - - gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h} - if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then - enable_thread=yes - else - enable_thread=no - fi - - - - -# Checks for compiler support that don't require linking. - - - - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - old_CXXFLAGS="$CXXFLAGS" - - # Compile unoptimized. - CXXFLAGS='-O0 -S' - - # Fake what AC_TRY_COMPILE does, without linking as this is - # unnecessary for a builtins test. - - cat > conftest.$ac_ext << EOF -#line 18102 "configure" -int main() -{ - // NB: _Atomic_word not necessarily int. - 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(); - return 0; -} -EOF - - echo "$as_me:$LINENO: checking for atomic builtins for int" >&5 -echo $ECHO_N "checking for atomic builtins for int... $ECHO_C" >&6 - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep __sync_ conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtinsi=no - else - -cat >>confdefs.h <<\_ACEOF -#define _GLIBCXX_ATOMIC_BUILTINS_4 1 -_ACEOF - - enable_atomic_builtinsi=yes - fi - fi - echo "$as_me:$LINENO: result: $enable_atomic_builtinsi" >&5 -echo "${ECHO_T}$enable_atomic_builtinsi" >&6 - rm -f conftest* - - cat > conftest.$ac_ext << EOF -#line 18142 "configure" -int main() -{ - 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(); - return 0; -} -EOF - - echo "$as_me:$LINENO: checking for atomic builtins for bool" >&5 -echo $ECHO_N "checking for atomic builtins for bool... $ECHO_C" >&6 - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - if grep __sync_ conftest.s >/dev/null 2>&1 ; then - enable_atomic_builtinsb=no - else - -cat >>confdefs.h <<\_ACEOF -#define _GLIBCXX_ATOMIC_BUILTINS_1 1 -_ACEOF - - enable_atomic_builtinsb=yes - fi - fi - echo "$as_me:$LINENO: result: $enable_atomic_builtinsb" >&5 -echo "${ECHO_T}$enable_atomic_builtinsb" >&6 - rm -f conftest* - - CXXFLAGS="$old_CXXFLAGS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - # Set atomicity_dir to builtins if either of above tests pass. - if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then - atomicity_dir=cpu/generic/atomicity_builtins - fi - - # If still generic, set to mutex. - if test $atomicity_dir = "cpu/generic" ; then - atomicity_dir=cpu/generic/atomicity_mutex - { echo "$as_me:$LINENO: WARNING: No native atomic operations are provided for this platform." >&5 -echo "$as_me: WARNING: No native atomic operations are provided for this platform." >&2;} - if test $target_thread_file = single; then - { echo "$as_me:$LINENO: WARNING: They cannot be faked when thread support is disabled." >&5 -echo "$as_me: WARNING: They cannot be faked when thread support is disabled." >&2;} - { echo "$as_me:$LINENO: WARNING: Thread-safety of certain classes is not guaranteed." >&5 -echo "$as_me: WARNING: Thread-safety of certain classes is not guaranteed." >&2;} - else - { echo "$as_me:$LINENO: WARNING: They will be faked using a mutex." >&5 -echo "$as_me: WARNING: They will be faked using a mutex." >&2;} - { echo "$as_me:$LINENO: WARNING: Performance of certain classes will degrade as a result." >&5 -echo "$as_me: WARNING: Performance of certain classes will degrade as a result." >&2;} - fi - fi - - - - # All these tests are for C++; save the language and the compiler flags. - # The CXXFLAGS thing is suspicious, but based on similar bits previously - # found in GLIBCXX_CONFIGURE. - - - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - ac_test_CXXFLAGS="${CXXFLAGS+set}" - ac_save_CXXFLAGS="$CXXFLAGS" - - # Check for maintainer-mode bits. - if test x"$USE_MAINTAINER_MODE" = xno; then - WERROR='' - else - WERROR='-Werror' - fi - - # Check for -ffunction-sections -fdata-sections - echo "$as_me:$LINENO: checking for g++ that supports -ffunction-sections -fdata-sections" >&5 -echo $ECHO_N "checking for g++ that supports -ffunction-sections -fdata-sections... $ECHO_C" >&6 - CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections' - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -int foo; void bar() { }; -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_fdsections=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_fdsections=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" - else - # this is the suspicious part - CXXFLAGS='' - fi - if test x"$ac_fdsections" = x"yes"; then - SECTION_FLAGS='-ffunction-sections -fdata-sections' - fi - echo "$as_me:$LINENO: result: $ac_fdsections" >&5 -echo "${ECHO_T}$ac_fdsections" >&6 - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - # Only do link tests if native. Else, hardcode. if $GLIBCXX_IS_NATIVE; then @@ -121659,6 +121664,9 @@ s,@GLIBCXX_HOSTED_FALSE@,$GLIBCXX_HOSTED_FALSE,;t t s,@GLIBCXX_BUILD_PCH_TRUE@,$GLIBCXX_BUILD_PCH_TRUE,;t t s,@GLIBCXX_BUILD_PCH_FALSE@,$GLIBCXX_BUILD_PCH_FALSE,;t t s,@glibcxx_PCHFLAGS@,$glibcxx_PCHFLAGS,;t t +s,@glibcxx_thread_h@,$glibcxx_thread_h,;t t +s,@WERROR@,$WERROR,;t t +s,@SECTION_FLAGS@,$SECTION_FLAGS,;t t s,@CSTDIO_H@,$CSTDIO_H,;t t s,@BASIC_FILE_H@,$BASIC_FILE_H,;t t s,@BASIC_FILE_CC@,$BASIC_FILE_CC,;t t @@ -121698,9 +121706,6 @@ s,@GLIBCXX_BUILD_DEBUG_FALSE@,$GLIBCXX_BUILD_DEBUG_FALSE,;t t s,@ENABLE_PARALLEL_TRUE@,$ENABLE_PARALLEL_TRUE,;t t s,@ENABLE_PARALLEL_FALSE@,$ENABLE_PARALLEL_FALSE,;t t s,@EXTRA_CXX_FLAGS@,$EXTRA_CXX_FLAGS,;t t -s,@glibcxx_thread_h@,$glibcxx_thread_h,;t t -s,@WERROR@,$WERROR,;t t -s,@SECTION_FLAGS@,$SECTION_FLAGS,;t t s,@SECTION_LDFLAGS@,$SECTION_LDFLAGS,;t t s,@OPT_LDFLAGS@,$OPT_LDFLAGS,;t t s,@LIBMATHOBJS@,$LIBMATHOBJS,;t t diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index c3f1756373e..7279b118923 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -95,6 +95,12 @@ GLIBCXX_ENABLE_HOSTED # Enable compiler support that doesn't require linking. GLIBCXX_ENABLE_SJLJ_EXCEPTIONS GLIBCXX_ENABLE_PCH($is_hosted) +GLIBCXX_ENABLE_ATOMIC_BUILTINS +GLIBCXX_ENABLE_THREADS + +# Checks for compiler support that don't require linking. +GLIBCXX_CHECK_COMPILER_FEATURES +GLIBCXX_CHECK_STANDARD_LAYOUT # Enable all the variable C++ runtime options that doesn't require linking. GLIBCXX_ENABLE_CSTDIO @@ -113,12 +119,7 @@ GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) # Checks for operating systems support that don't require linking. GLIBCXX_CHECK_SYSTEM_ERROR -GLIBCXX_CHECK_STANDARD_LAYOUT -GLIBCXX_ENABLE_THREADS -# Checks for compiler support that don't require linking. -GLIBCXX_ENABLE_ATOMIC_BUILTINS -GLIBCXX_CHECK_COMPILER_FEATURES # Only do link tests if native. Else, hardcode. if $GLIBCXX_IS_NATIVE; then