diff options
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/acinclude.m4 | 70 | ||||
-rw-r--r-- | libstdc++-v3/aclocal.m4 | 70 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 67 |
4 files changed, 142 insertions, 72 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 389323f..1effa8e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2003-08-05 Phil Edwards <pme@gcc.gnu.org> + + * acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Put down the crack + pipe, open the window to let out the fumes, redo the option-handling + logic to properly execute the detection test. + * aclocal.m4, configure: Regenerate. + 2003-08-04 Phil Edwards <pme@gcc.gnu.org> Convert to new autotools. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 6f6b24e..f6f60ea 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1360,6 +1360,7 @@ dnl target may or may not support call frame exceptions. dnl dnl --enable-sjlj-exceptions forces the use of builtin setjmp. dnl --disable-sjlj-exceptions forces the use of call frame unwinding. +dnl Neither one forces an attempt at detection. dnl dnl Defines: dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it @@ -1368,17 +1369,17 @@ AC_DEFUN(GLIBCXX_ENABLE_SJLJ_EXCEPTIONS, [ AC_MSG_CHECKING([for exception model to use]) AC_LANG_SAVE AC_LANG_CPLUSPLUS - GLIBCXX_ENABLE(sjlj-exceptions,no,, + GLIBCXX_ENABLE(sjlj-exceptions,auto,, [force use of builtin_setjmp for exceptions], - [:], - [# Botheration. Now we've got to detect the exception model. - # Link tests against libgcc.a are problematic since -- at least - # as of this writing -- we've not been given proper -L bits for - # single-tree newlib and libgloss. - # - # This is what AC_TRY_COMPILE would do if it didn't delete the - # conftest files before we got a change to grep them first. - cat > conftest.$ac_ext << EOF + [permit yes|no|auto]) + + if test $enable_sjlj_exceptions = auto; then + # Botheration. Now we've got to detect the exception model. Link tests + # against libgcc.a are problematic since we've not been given proper -L + # bits for single-tree newlib and libgloss. + # + # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. + cat > conftest.$ac_ext << EOF [#]line __oline__ "configure" struct S { ~S(); }; void bar(); @@ -1388,27 +1389,34 @@ void foo() 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 - fi - fi - CXXFLAGS="$old_CXXFLAGS" - rm -f conftest* - ]) - if test $enable_sjlj_exceptions = yes; then - AC_DEFINE(_GLIBCXX_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 + 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 + fi + fi + CXXFLAGS="$old_CXXFLAGS" + rm -f conftest* + fi + + # This is a tad weird, for hysterical raisins. We have to map enable/disable + # to two different models. + case $enable_sjlj_exceptions in + yes) + AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1, + [Define if the compiler is configured for setjmp/longjmp exceptions.]) + ac_exception_model_name=sjlj + ;; + no) + ac_exception_model_name="call frame" + ;; + *) + AC_MSG_ERROR([unable to detect exception model]) + ;; + esac AC_LANG_RESTORE AC_MSG_RESULT($ac_exception_model_name) ]) diff --git a/libstdc++-v3/aclocal.m4 b/libstdc++-v3/aclocal.m4 index 79cb759..27aed6a 100644 --- a/libstdc++-v3/aclocal.m4 +++ b/libstdc++-v3/aclocal.m4 @@ -1373,6 +1373,7 @@ dnl target may or may not support call frame exceptions. dnl dnl --enable-sjlj-exceptions forces the use of builtin setjmp. dnl --disable-sjlj-exceptions forces the use of call frame unwinding. +dnl Neither one forces an attempt at detection. dnl dnl Defines: dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it @@ -1381,17 +1382,17 @@ AC_DEFUN(GLIBCXX_ENABLE_SJLJ_EXCEPTIONS, [ AC_MSG_CHECKING([for exception model to use]) AC_LANG_SAVE AC_LANG_CPLUSPLUS - GLIBCXX_ENABLE(sjlj-exceptions,no,, + GLIBCXX_ENABLE(sjlj-exceptions,auto,, [force use of builtin_setjmp for exceptions], - [:], - [# Botheration. Now we've got to detect the exception model. - # Link tests against libgcc.a are problematic since -- at least - # as of this writing -- we've not been given proper -L bits for - # single-tree newlib and libgloss. - # - # This is what AC_TRY_COMPILE would do if it didn't delete the - # conftest files before we got a change to grep them first. - cat > conftest.$ac_ext << EOF + [permit yes|no|auto]) + + if test $enable_sjlj_exceptions = auto; then + # Botheration. Now we've got to detect the exception model. Link tests + # against libgcc.a are problematic since we've not been given proper -L + # bits for single-tree newlib and libgloss. + # + # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. + cat > conftest.$ac_ext << EOF [#]line __oline__ "configure" struct S { ~S(); }; void bar(); @@ -1401,27 +1402,34 @@ void foo() 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 - fi - fi - CXXFLAGS="$old_CXXFLAGS" - rm -f conftest* - ]) - if test $enable_sjlj_exceptions = yes; then - AC_DEFINE(_GLIBCXX_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 + 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 + fi + fi + CXXFLAGS="$old_CXXFLAGS" + rm -f conftest* + fi + + # This is a tad weird, for hysterical raisins. We have to map enable/disable + # to two different models. + case $enable_sjlj_exceptions in + yes) + AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1, + [Define if the compiler is configured for setjmp/longjmp exceptions.]) + ac_exception_model_name=sjlj + ;; + no) + ac_exception_model_name="call frame" + ;; + *) + AC_MSG_ERROR([unable to detect exception model]) + ;; + esac AC_LANG_RESTORE AC_MSG_RESULT($ac_exception_model_name) ]) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index bc282b9..4691523 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -864,7 +864,7 @@ Optional Features: --disable-libtool-lock avoid locking (might break parallel builds) --enable-sjlj-exceptions force use of builtin_setjmp for exceptions - [default=no] + [default=auto] --enable-libunwind-exceptions force use of libunwind for exceptions [default=no] @@ -4837,25 +4837,72 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # Check whether --enable-sjlj-exceptions or --disable-sjlj-exceptions was given. if test "${enable_sjlj_exceptions+set}" = set; then enableval="$enable_sjlj_exceptions" - : + + case "$enableval" in + yes|no|auto) ;; + *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable sjlj-exceptions" >&5 +echo "$as_me: error: Unknown argument to enable/disable sjlj-exceptions" >&2;} + { (exit 1); exit 1; }; } ;; + esac + else - enable_sjlj_exceptions=no + enable_sjlj_exceptions=auto fi; - if test $enable_sjlj_exceptions = yes; then + + if test $enable_sjlj_exceptions = auto; then + # Botheration. Now we've got to detect the exception model. Link tests + # against libgcc.a are problematic since we've not been given proper -L + # bits for single-tree newlib and libgloss. + # + # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. + cat > conftest.$ac_ext << EOF +#line 4860 "configure" +struct S { ~S(); }; +void bar(); +void foo() +{ + S s; + bar(); +} +EOF + old_CXXFLAGS="$CXXFLAGS" + CXXFLAGS=-S + 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 _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 + fi + fi + CXXFLAGS="$old_CXXFLAGS" + rm -f conftest* + fi + + # This is a tad weird, for hysterical raisins. We have to map enable/disable + # to two different models. + case $enable_sjlj_exceptions in + yes) cat >>confdefs.h <<\_ACEOF #define _GLIBCXX_SJLJ_EXCEPTIONS 1 _ACEOF - ac_exception_model_name=sjlj - elif test x$enable_sjlj_exceptions = xno; then - ac_exception_model_name="call frame" - else - { { echo "$as_me:$LINENO: error: unable to detect exception model" >&5 + ac_exception_model_name=sjlj + ;; + no) + ac_exception_model_name="call frame" + ;; + *) + { { echo "$as_me:$LINENO: error: unable to detect exception model" >&5 echo "$as_me: error: unable to detect exception model" >&2;} { (exit 1); exit 1; }; } - fi + ;; + esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' |