Import fmit upstream version 0.97.6
[fmit.git] / m4 / ac_cxx_exceptions.m4
1 dnl @synopsis AC_CXX_EXCEPTIONS
2 dnl
3 dnl If the C++ compiler supports exceptions handling (try,
4 dnl throw and catch), define HAVE_EXCEPTIONS.
5 dnl
6 dnl @version $Id: ac_cxx_exceptions.m4,v 1.1 2005/01/07 02:52:49 norwin Exp $
7 dnl @author Todd Veldhuizen and Luc Maisonobe <luc@spaceroots.org>
8 dnl
9 AC_DEFUN([AC_CXX_EXCEPTIONS],
10 [AC_CACHE_CHECK(whether the compiler supports exceptions,
11 ac_cv_cxx_exceptions,
12 [AC_LANG_SAVE
13  AC_LANG_CPLUSPLUS
14  AC_TRY_COMPILE(,[try { throw  1; } catch (int i) { return i; }],
15  ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no)
16  AC_LANG_RESTORE
17 ])
18 if test "$ac_cv_cxx_exceptions" = yes; then
19   AC_DEFINE(HAVE_EXCEPTIONS,,[define if the compiler supports exceptions])
20 fi
21 ])