autoconfig test offsetof
authorGengbin Zheng <gzheng@illinois.edu>
Sat, 22 Oct 2011 02:57:17 +0000 (21:57 -0500)
committerGengbin Zheng <gzheng@illinois.edu>
Sat, 22 Oct 2011 02:57:17 +0000 (21:57 -0500)
src/arch/common/cc-pgcc.sh
src/arch/gemini_gni-crayxe/conv-mach.sh
src/arch/mpi-crayxe/conv-mach.sh
src/arch/mpi-crayxt/conv-mach.sh
src/arch/mpi-linux-x86_64/cc-mpicxx.sh
src/conv-core/converse.h
src/scripts/configure
src/scripts/configure.in
src/scripts/conv-autoconfig.h.in

index 4a7b49b045736688dc9efcf6f1db9d2a03f7c60a..327fa12441d2fca291107378b684dfc235db6138 100644 (file)
@@ -6,11 +6,11 @@ case `hostname` in
 esac
 
 CMK_CPP_C="pgcc -E "
-CMK_CC="pgcc -fPIC $CMK_DEFS  -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
+CMK_CC="pgcc -fPIC $CMK_DEFS  -DCMK_FIND_FIRST_OF_PREDICATE=1 "
 CMK_CC_RELIABLE="gcc "
 #CMK_CXX="pgCC --instantiate=used "
-CMK_CXX="pgCC -fPIC $CMK_DEFS  -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
-CMK_CXXPP="pgCC -E  -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
+CMK_CXX="pgCC -fPIC $CMK_DEFS  -DCMK_FIND_FIRST_OF_PREDICATE=1 "
+CMK_CXXPP="pgCC -E  -DCMK_FIND_FIRST_OF_PREDICATE=1 "
 CMK_LD="$CMK_CC "
 CMK_LDXX="$CMK_CXX "
 
index fbd6568c30688acb1882c836bf6c35681aa5cd6d..06e6ce45f9ebb1be1e8e85cf56d684277e6be093 100644 (file)
@@ -19,8 +19,8 @@ CMK_QT="generic64"
 # compiler for compiling sequential programs
 if test -n "$PGCC"
 then
-CMK_CC="$CMK_CC -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
-CMK_CXX="$CMK_CXX -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
+CMK_CC="$CMK_CC -DCMK_FIND_FIRST_OF_PREDICATE=1 "
+CMK_CXX="$CMK_CXX -DCMK_FIND_FIRST_OF_PREDICATE=1 "
 # gcc is needed for building QT
 CMK_SEQ_CC="gcc "
 CMK_SEQ_CXX="pgCC "
index 20bd4fd49363f8026d9a8bf2ccc53c4c53e2449a..e59e457aa26b1f4097faccf7f01539063f9ee995 100644 (file)
@@ -22,8 +22,8 @@ CMK_LD_LIBRARY_PATH="-Wl,-rpath,$CHARMLIBSO/"
 # compiler for compiling sequential programs
 if test -n "$PGCC"
 then
-CMK_CC="$CMK_CC -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
-CMK_CXX="$CMK_CXX -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
+CMK_CC="$CMK_CC -DCMK_FIND_FIRST_OF_PREDICATE=1 "
+CMK_CXX="$CMK_CXX -DCMK_FIND_FIRST_OF_PREDICATE=1 "
 # gcc is needed for building QT
 CMK_SEQ_CC="gcc -fPIC "
 CMK_SEQ_CXX="pgCC -fPIC "
index 20bd4fd49363f8026d9a8bf2ccc53c4c53e2449a..e59e457aa26b1f4097faccf7f01539063f9ee995 100644 (file)
@@ -22,8 +22,8 @@ CMK_LD_LIBRARY_PATH="-Wl,-rpath,$CHARMLIBSO/"
 # compiler for compiling sequential programs
 if test -n "$PGCC"
 then
-CMK_CC="$CMK_CC -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
-CMK_CXX="$CMK_CXX -DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1 "
+CMK_CC="$CMK_CC -DCMK_FIND_FIRST_OF_PREDICATE=1 "
+CMK_CXX="$CMK_CXX -DCMK_FIND_FIRST_OF_PREDICATE=1 "
 # gcc is needed for building QT
 CMK_SEQ_CC="gcc -fPIC "
 CMK_SEQ_CXX="pgCC -fPIC "
index 8a89d3434daf7bead48acd7e9eb5eba939438c56..277cbd39d12859a6ed1f0e8563480f289eba68e9 100644 (file)
@@ -18,7 +18,7 @@ CMK_REAL_COMPILER=`$MPICXX -show 2>/dev/null | cut -d' ' -f1 `
 case "$CMK_REAL_COMPILER" in
 g++)   CMK_AMD64="-m64 -fPIC" ;;
 icpc)  CMK_AMD64="-m64";;
-pgCC)  CMK_AMD64="-DCMK_FIND_FIRST_OF_PREDICATE=1 -DCMK_NEEDS_OFFSETOF=1" ;;
+pgCC)  CMK_AMD64="-DCMK_FIND_FIRST_OF_PREDICATE=1 " ;;
 FCC)   CMK_AMD64="-Kfast -DCMK_FIND_FIRST_OF_PREDICATE=1 --variadic_macros";;
 esac
 CMK_REAL_C_COMPILER=`$MPICC -show 2>/dev/null | cut -d' ' -f1 `
index ef6065cd4c19202247a31d47b50c941737ee9538..21c53506d9e73dc28b5748e4cebd38cc4dbf1970 100644 (file)
@@ -74,9 +74,11 @@ typedef bool CmiBool;
 #define CmiTrue true
 #endif
 
-#if CMK_NEEDS_OFFSETOF
+#if ! CMK_HAS_OFFSETOF
 #undef offsetof
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#else
+#include <stddef.h>
 #endif
 
 extern "C" {
index 2ad8cee3a1a827c64dc369e32daa3c6ad912efb4..74cce6952e15731455e4bec792b276e069992b6c 100755 (executable)
@@ -2671,6 +2671,27 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+#### test if offsetof exists ####
+cat > $t <<EOT
+#include <stddef.h>
+
+struct FooType {
+        int f1;
+        int f2;
+        double f3;
+};
+
+void foo()
+{
+  int off = offsetof(FooType, f2);
+}
+EOT
+test_cxx "whether offsetof is defined" "yes" "no" ""
+
+cat >>confdefs.h <<_ACEOF
+#define CMK_HAS_OFFSETOF $pass
+_ACEOF
+
 
 #### test if we can use gcc x86 assembly like this ####
 cat > $t <<EOT
index a68fa422821822557bbba375ff1449bc553d7649..222a4484db3668b2f12a420104d9ea0b95e0cc6f 100644 (file)
@@ -767,6 +767,23 @@ EOT
 test_cxx "whether operator delete can be overloaded in same class" "ok" "no" ""
 AC_DEFINE_UNQUOTED(CMK_MULTIPLE_DELETE, $strictpass, [whether operator delete can be overloaded in same class])
 
+#### test if offsetof exists ####
+cat > $t <<EOT
+#include <stddef.h>
+
+struct FooType {
+        int f1;
+        int f2;
+        double f3;
+};
+
+void foo()
+{
+  int off = offsetof(FooType, f2);
+}
+EOT
+test_cxx "whether offsetof is defined" "yes" "no" ""
+AC_DEFINE_UNQUOTED(CMK_HAS_OFFSETOF, $pass, [whether offsetof exists])
 
 #### test if we can use gcc x86 assembly like this ####
 cat > $t <<EOT
index 498a6c9285c3dd80f67ed17c777f6893db936441..5b8bddcfc1955a3c16df3f150437621c1ad1aff9 100644 (file)
 /* whether NUMA control related functions exist */
 #undef CMK_HAS_NUMACTRL
 
+/* whether offsetof exists */
+#undef CMK_HAS_OFFSETOF
+
 /* whether PMI_Get_nid exists */
 #undef CMK_HAS_PMI_GET_NID