[cgma-dev] r4623 - cgm/trunk/m4

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Mar 21 14:23:05 CDT 2011


Author: kraftche
Date: 2011-03-21 14:23:05 -0500 (Mon, 21 Mar 2011)
New Revision: 4623

Modified:
   cgm/trunk/m4/compiler.m4
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: cgm/trunk/m4/compiler.m4
===================================================================
--- cgm/trunk/m4/compiler.m4	2011-03-21 19:22:59 UTC (rev 4622)
+++ cgm/trunk/m4/compiler.m4	2011-03-21 19:23:05 UTC (rev 4623)
@@ -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], [





















More information about the cgma-dev mailing list