[MOAB-dev] r1516 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Mon Jan 14 13:05:55 CST 2008


Author: kraftche
Date: 2008-01-14 13:05:55 -0600 (Mon, 14 Jan 2008)
New Revision: 1516

Modified:
   MOAB/trunk/acsite.m4
   MOAB/trunk/configure.in
Log:
Add configure test for support of template specialization

Modified: MOAB/trunk/acsite.m4
===================================================================
--- MOAB/trunk/acsite.m4	2008-01-10 19:43:44 UTC (rev 1515)
+++ MOAB/trunk/acsite.m4	2008-01-14 19:05:55 UTC (rev 1516)
@@ -238,7 +238,7 @@
 #######################################################################################
 # Check if template definitions (.cpp files) must be
 # included (in the .hpp files).
-# Sets TEMPLATE_DEFS_INCLUDED=1
+# Sets TEMPLATE_DEFS_INCLUDED=-DTEMPLATE_DEFS_INCLUDED
 #######################################################################################
 AC_DEFUN([SNL_TEMPLATE_DEFS_INCLUDED], [
 AC_LANG_SAVE
@@ -266,9 +266,32 @@
 AC_LANG_RESTORE
 ]) # SNL_TEMPLATE_DEFS_INCLUDED
 
+#######################################################################################
+# Check if compiler supports template class specialization.
+# Sets TEMPLATE_SPECIALIZATION=-DTEMPLATE_SPECIALIZATION
+#######################################################################################
+AC_DEFUN([SNL_TEMPLATE_SPECIALIZATION], [
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
 
+AC_MSG_CHECKING([if C++ compiler supports template specialization])
+AC_TRY_COMPILE([
+template <unsigned S> class MyTempl { public: char data[S]; };
+template <> class MyTempl<0> { public: char value; };
+],[
+MyTempl<1> one;
+MyTempl<0> zero;
+one.data[0] = zero.value = '\0';
+],
+[TEMPLATE_SPECIALIZATION=-DTEMPLATE_SPECIALIZATION; AC_MSG_RESULT(yes)],
+[TEMPLATE_SPECIALIZATION=; AC_MSG_RESULT(no)])
 
+AC_LANG_RESTORE
+]) # SNL_TEMPLATE_DEFS_INCLUDED
 
+
+
+
 #######################################################################################
 # Check for HDF5 library and related stuff
 # Sets HAVE_HDF5 to 'yes' or 'no'

Modified: MOAB/trunk/configure.in
===================================================================
--- MOAB/trunk/configure.in	2008-01-10 19:43:44 UTC (rev 1515)
+++ MOAB/trunk/configure.in	2008-01-14 19:05:55 UTC (rev 1516)
@@ -24,6 +24,8 @@
 AC_SUBST([ZCAT])
 AM_CONDITIONAL([HAVE_ZCAT],[test "x" = "x$ZCAT"])
 
+SNL_TEMPLATE_SPECIALIZATION
+DEFINES="$DEFINES $TEMPLATE_SPECIALIZATION"
 
 ################################################################################
 #                              Version Stuff




More information about the moab-dev mailing list