2004-01-07 18:34:40 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
define([OMPI_CXX_FIND_EXCEPTION_FLAGS],[
|
2004-01-07 18:34:40 +03:00
|
|
|
#
|
|
|
|
# Arguments: none
|
|
|
|
#
|
|
|
|
# Dependencies: none
|
|
|
|
#
|
|
|
|
# Get the exception handling flags for the C++ compiler. Leaves
|
|
|
|
# CXXFLAGS undisturbed.
|
|
|
|
# Provides --with-exflags command line argument for configure as well.
|
|
|
|
#
|
2004-06-07 19:33:53 +04:00
|
|
|
# Sets OMPI_CXX_EXCEPTION_CXXFLAGS and OMPI_CXX_EXCEPTION_LDFLAGS as
|
2004-01-07 18:34:40 +03:00
|
|
|
# appropriate.
|
|
|
|
# Must call AC_SUBST manually
|
|
|
|
#
|
|
|
|
|
|
|
|
# Command line flags
|
|
|
|
|
|
|
|
AC_ARG_WITH(exflags,
|
|
|
|
AC_HELP_STRING([--with-exflags],
|
|
|
|
[Specify flags necessary to enable C++ exceptions]),
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_force_exflags="$withval")
|
2004-01-07 18:34:40 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_CXXFLAGS_SAVE="$CXXFLAGS"
|
2004-01-07 18:34:40 +03:00
|
|
|
AC_MSG_CHECKING([for compiler exception flags])
|
|
|
|
|
|
|
|
# See which flags to use
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_force_exflags" != ""; then
|
2004-01-07 18:34:40 +03:00
|
|
|
|
|
|
|
# If the user supplied flags, use those
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_exflags="$ompi_force_exflags"
|
2004-01-07 18:34:40 +03:00
|
|
|
elif test "$GXX" = "yes"; then
|
|
|
|
|
|
|
|
# g++ has changed their flags a few times. Sigh.
|
|
|
|
|
|
|
|
CXXFLAGS="$CXXFLAGS -fexceptions"
|
|
|
|
|
|
|
|
AC_LANG_SAVE
|
|
|
|
AC_LANG_CPLUSPLUS
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[]], [[try { int i = 0; } catch(...) { int j = 2; }]]), ompi_happy=1, ompi_happy=0)
|
2004-01-07 18:34:40 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
if test "$ompi_happy" = "1"; then
|
|
|
|
ompi_exflags="-fexceptions";
|
2004-01-07 18:34:40 +03:00
|
|
|
else
|
|
|
|
CXXFLAGS="$CXXFLAGS_SAVE -fhandle-exceptions"
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[]], [[try { int i = 0; } catch(...) { int j = 2; }]]), ompi_happy=1, ompi_happy=0)
|
|
|
|
if test "$ompi_happy" = "1"; then
|
|
|
|
ompi_exflags="-fhandle-exceptions";
|
2004-01-07 18:34:40 +03:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
AC_LANG_RESTORE
|
|
|
|
elif test "`basename $CXX`" = "KCC"; then
|
|
|
|
|
|
|
|
# KCC flags
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_exflags="--exceptions"
|
2004-01-07 18:34:40 +03:00
|
|
|
fi
|
2004-06-07 19:33:53 +04:00
|
|
|
CXXFLAGS="$ompi_CXXFLAGS_SAVE"
|
2004-01-07 18:34:40 +03:00
|
|
|
|
|
|
|
# Save the result
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
OMPI_CXX_EXCEPTIONS_CXXFLAGS="$ompi_exflags"
|
|
|
|
OMPI_CXX_EXCEPTIONS_LDFLAGS="$ompi_exflags"
|
|
|
|
if test "$ompi_exflags" = ""; then
|
2004-01-07 18:34:40 +03:00
|
|
|
AC_MSG_RESULT([none necessary])
|
|
|
|
else
|
2004-06-07 19:33:53 +04:00
|
|
|
AC_MSG_RESULT([$ompi_exflags])
|
2004-01-07 18:34:40 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Clean up
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
unset ompi_force_exflags ompi_CXXFLAGS_SAVE ompi_exflags ompi_happy])dnl
|
2004-01-07 18:34:40 +03:00
|
|
|
|