[MOAB-dev] r3153 - in MOAB/trunk: . m4
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Fri Sep 18 17:33:55 CDT 2009
Author: kraftche
Date: 2009-09-18 17:33:55 -0500 (Fri, 18 Sep 2009)
New Revision: 3153
Modified:
MOAB/trunk/configure.ac
MOAB/trunk/m4/compiler.m4
Log:
Work around bug in either autoconf 2.64 or automake 1.11: split compiler
detection (whether there exists a working compiler, which compiler to use,
etc.) from detection of compiler flags (determine which flags the compiler
supports, which the user requested, etc.) and to the latter test later.
Modified: MOAB/trunk/configure.ac
===================================================================
--- MOAB/trunk/configure.ac 2009-09-18 20:28:17 UTC (rev 3152)
+++ MOAB/trunk/configure.ac 2009-09-18 22:33:55 UTC (rev 3153)
@@ -54,6 +54,7 @@
AC_PROG_MAKE_SET
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
+SNL_COMPILER_FLAGS
AC_CHECK_PROG([ZCAT],[gunzip],[gunzip -c],[])
AC_CHECK_PROG([ZCAT],[gzip],[gzip -cd],[])
Modified: MOAB/trunk/m4/compiler.m4
===================================================================
--- MOAB/trunk/m4/compiler.m4 2009-09-18 20:28:17 UTC (rev 3152)
+++ MOAB/trunk/m4/compiler.m4 2009-09-18 22:33:55 UTC (rev 3153)
@@ -112,19 +112,39 @@
if test "xno" != "x$CHECK_CC"; then
AC_PROG_CC( [$CC_LIST] )
- SNL_CC_FLAGS
fi
AC_PROG_CPP
if test "xno" != "x$CHECK_CXX"; then
AC_PROG_CXX( [$CXX_LIST] )
AC_PROG_CXXCPP
- SNL_CXX_FLAGS
fi
if test "xno" != "x$CHECK_FC"; then
AC_PROG_FC( [$FC_LIST] )
AC_PROG_F77( [$F77_LIST] )
fi
+]) # SNL_CHECK_COMPILERS
+
+
+
+#######################################################################################
+# Implement checks for C and C++ compiler options
+#
+# CFLAGS - C compiler flags
+# CXXFLAGS - C++ compiler flags
+#
+#######################################################################################
+AC_DEFUN([SNL_COMPILER_FLAGS], [
+
+
+if test "xno" != "x$CHECK_CC"; then
+ SNL_CC_FLAGS
+fi
+if test "xno" != "x$CHECK_CXX"; then
+ SNL_CXX_FLAGS
+fi
+
+
# Try to determine compiler-specific flags. This must be done
# before setting up libtool so that it can override libtool settings.
CFLAGS="$USER_CFLAGS $SNL_CC_SPECIAL"
@@ -216,7 +236,7 @@
CFLAGS="$CFLAGS $SNL_CC_64BIT"
])
-]) # SNL_CHECK_COMPILERS
+]) # SNL_COMPILER_FLAGS
#######################################################################################
# *******************************************************************************
@@ -232,11 +252,11 @@
# - action upon failure
#################################################################################
AC_DEFUN([SNL_TRY_COMPILER_DEFINE], [
-AC_COMPILE_IFELSE([
-AC_LANG_PROGRAM( [[#ifndef $1
- choke me
-#endif]], []) ],
-[$2],[$3])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM( [[#ifndef $1
+ choke me
+ #endif]], []) ],
+ [$2],[$3])
])
@@ -248,7 +268,7 @@
# SNL_CXX_64BIT : Flag to force compilation of 64-bit code
#######################################################################################
AC_DEFUN([SNL_CXX_FLAGS], [
-AC_REQUIRE([AC_PROG_CXX])
+AC_LANG_PUSH([C++])
# Detect compiler
AC_MSG_CHECKING([for known c++ compilers])
@@ -261,8 +281,6 @@
# For efficiency, limit checks to relevant OSs
else
cxx_compiler=unknown
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
case "$target_os" in
aix*)
SNL_TRY_COMPILER_DEFINE([__IBMCPP__],[cxx_compiler=VisualAge])
@@ -295,8 +313,9 @@
SNL_TRY_COMPILER_DEFINE([__PGI],[cc_cmopiler=PortlandGroup])
;;
esac
- AC_LANG_RESTORE
fi
+
+AC_LANG_POP([C++])
AC_MSG_RESULT([$cxx_compiler])
if test "x$cxx_compiler" = "xunknown"; then
AC_MSG_WARN([Unrecognized C++ compiler: $CXX])
@@ -380,7 +399,7 @@
# SNL_CC_64BIT : Flag to force compilation of 64-bit code
#######################################################################################
AC_DEFUN([SNL_CC_FLAGS], [
-AC_REQUIRE([AC_PROG_CC])
+AC_LANG_PUSH([C])
# Detect compiler
@@ -428,6 +447,7 @@
;;
esac
fi
+AC_LANG_POP([C])
AC_MSG_RESULT([$cc_compiler])
if test "x$cc_compiler" = "xunknown"; then
AC_MSG_WARN([Unrecognized C compiler: $CXX])
More information about the moab-dev
mailing list