[MOAB-dev] r4619 - in MOAB/trunk: . config

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Mar 21 14:16:35 CDT 2011


Author: kraftche
Date: 2011-03-21 14:16:35 -0500 (Mon, 21 Mar 2011)
New Revision: 4619

Modified:
   MOAB/trunk/config/compiler.m4
   MOAB/trunk/configure.ac
Log:
add simple checks that C++ compiler works because autoconf doesn't seem to check that if the compiler is specified by the user via CXX=

Modified: MOAB/trunk/config/compiler.m4
===================================================================
--- MOAB/trunk/config/compiler.m4	2011-03-21 19:15:38 UTC (rev 4618)
+++ MOAB/trunk/config/compiler.m4	2011-03-21 19:16:35 UTC (rev 4619)
@@ -10,6 +10,27 @@
 ])
 
 
+#######################################################################################
+# Check if the C++ compiler works.
+# Arguments: action on success and action on failure
+#######################################################################################
+AC_DEFUN([FATHOM_CHECK_CXX_WORKS], [
+  AC_LANG_PUSH([C++])
+  AC_MSG_CHECKING([if $CXX works])
+  AC_COMPILE_IFELSE(
+   [AC_LANG_PROGRAM( [class Cl { int i; public: Cl(int x) : i(x) {} };] [Cl x(5);])],
+   [AC_COMPILE_IFELSE( 
+      [AC_LANG_PROGRAM( [],
+[#ifdef __cplusplus
+   choke me
+ #endif])],
+      [AC_MSG_RESULT([no (accepted invalid input)]); $2], [AC_MSG_RESULT([yes]); $1])],
+    [AC_MSG_RESULT([no (failed on trival valid C++ source)]); $2])
+
+  AC_LANG_POP([C++])
+])
+
+
 ########## Helper function for FATHOM_CHECK_COMPILERS #############
 # args: compiler variable, compiler list, path
 AC_DEFUN([FATHOM_SET_MPI_COMPILER], [

Modified: MOAB/trunk/configure.ac
===================================================================
--- MOAB/trunk/configure.ac	2011-03-21 19:15:38 UTC (rev 4618)
+++ MOAB/trunk/configure.ac	2011-03-21 19:16:35 UTC (rev 4619)
@@ -60,6 +60,7 @@
 FATHOM_TEMPLATE_FUNC_SPECIALIZATION
 AM_CPPFLAGS="$AM_CPPFLAGS $TEMPLATE_SPECIALIZATION $TEMPLATE_FUNC_SPECIALIZATION"
 
+FATHOM_CHECK_CXX_WORKS([], [AC_MSG_ERROR([Cannot build without C++ compiler])])
 if test "xyes" = "x$ENABLE_FORTRAN" && test "x" != "x$FC"; then
   AC_FC_WRAPPERS
 fi








More information about the moab-dev mailing list