[PPL-devel] [GIT] ppl/ppl(master): Improved the actions of AC_RUN_IFELSE when cross-compiling.

Roberto Bagnara bagnara at cs.unipr.it
Tue Mar 24 20:39:44 CET 2009


Module: ppl/ppl
Branch: master
Commit: 17dae899576e6314c6ee76ea6b631e886554b1b2
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=17dae899576e6314c6ee76ea6b631e886554b1b2

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Tue Mar 24 19:19:34 2009 +0100

Improved the actions of AC_RUN_IFELSE when cross-compiling.

---

 configure.ac                          |    2 +-
 interfaces/C/tests/formatted_output.c |    1 +
 m4/ac_check_fpu_control.m4            |    4 +-
 m4/ac_check_gmp.m4                    |   22 +++++++++++--
 m4/ac_cxx_double_exact_output.m4      |    2 +-
 m4/ac_cxx_flexible_arrays.m4          |   51 +++++++++++++++++++++++++++++++-
 m4/ac_cxx_float_exact_output.m4       |    2 +-
 m4/ac_cxx_ieee_inexact_flag.m4        |    2 +-
 m4/ac_cxx_limit_memory.m4             |    2 +-
 m4/ac_cxx_long_double_exact_output.m4 |    2 +-
 m4/ac_cxx_proper_long_double.m4       |    2 +-
 m4/ac_cxx_remainder_bug.m4            |    2 +-
 12 files changed, 78 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index aed857d..8583b40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -943,7 +943,7 @@ then
   ac_jlong_can_contain_pointers=no
   AC_MSG_RESULT(no),
   ac_jlong_can_contain_pointers=no
-  AC_MSG_RESULT(no))
+  AC_MSG_RESULT([assuming it cannot]))
   AC_LANG_POP(C++)
   CPPFLAGS="$ac_save_CPPFLAGS"
 fi
diff --git a/interfaces/C/tests/formatted_output.c b/interfaces/C/tests/formatted_output.c
index c6eeea2..2717c6a 100644
--- a/interfaces/C/tests/formatted_output.c
+++ b/interfaces/C/tests/formatted_output.c
@@ -42,6 +42,7 @@ main() {
   ppl_assign_Coefficient_from_mpz_t(coeff, z);
   ppl_new_Constraint_System(&cs);
   for (i = 0; i < DIMENSION; ++i) {
+    printf("%d\n", i);
     ppl_new_Linear_Expression_with_dimension(&le, DIMENSION);
     ppl_Linear_Expression_add_to_coefficient(le, i, coeff);
     ppl_new_Constraint(&c, le, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
diff --git a/m4/ac_check_fpu_control.m4 b/m4/ac_check_fpu_control.m4
index a9c87a6..ee28d20 100644
--- a/m4/ac_check_fpu_control.m4
+++ b/m4/ac_check_fpu_control.m4
@@ -26,7 +26,7 @@ ac_save_LIBS="$LIBS"
 LIBS="$LIBS -lm"
 AC_LANG_PUSH(C++)
 AC_CHECK_HEADERS([fenv.h ieeefp.h])
-AC_MSG_CHECKING([for the possibility to control the FPU])
+AC_MSG_CHECKING([if it is possible to control the FPU])
 AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #if i386
 
@@ -115,7 +115,7 @@ main() {
   ac_cv_can_control_fpu=1,
   AC_MSG_RESULT(no)
   ac_cv_can_control_fpu=0,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cv_can_control_fpu=0
 )
 AM_CONDITIONAL(CAN_CONTROL_FPU, test $ac_cv_can_control_fpu = 1)
diff --git a/m4/ac_check_gmp.m4 b/m4/ac_check_gmp.m4
index 71fbdd8..541cb36 100644
--- a/m4/ac_check_gmp.m4
+++ b/m4/ac_check_gmp.m4
@@ -51,7 +51,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <iostream>
 
 #if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 1) || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR == 1 && __GNU_MP_VERSION_PATCHLEVEL < 3)
-#error "GMP version 4.1.3 or higher is required"
+#GMP version 4.1.3 or higher is required
 #endif
 
 int
@@ -95,8 +95,22 @@ main() {
   ac_cv_have_gmp=yes,
   AC_MSG_RESULT(no)
   ac_cv_have_gmp=no,
-  AC_MSG_RESULT(no)
-  ac_cv_have_gmp=no)
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <gmpxx.h>
+
+#if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 1) || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR == 1 && __GNU_MP_VERSION_PATCHLEVEL < 3)
+#GMP version 4.1.3 or higher is required
+#endif
+
+int
+main() {
+  return 0;
+}
+]])],
+    AC_MSG_RESULT(yes)
+    ac_cv_have_gmp=yes,
+    AC_MSG_RESULT(no)
+    ac_cv_have_gmp=no))
 
 have_gmp=${ac_cv_have_gmp}
 
@@ -140,7 +154,7 @@ int main() {
   ac_cv_gmp_supports_exceptions=yes,
   AC_MSG_RESULT(no)
   ac_cv_gmp_supports_exceptions=no,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cv_gmp_supports_exceptions=no)
 
 gmp_supports_exceptions=${ac_cv_gmp_supports_exceptions}
diff --git a/m4/ac_cxx_double_exact_output.m4 b/m4/ac_cxx_double_exact_output.m4
index 56ca6dc..73240b3 100644
--- a/m4/ac_cxx_double_exact_output.m4
+++ b/m4/ac_cxx_double_exact_output.m4
@@ -127,7 +127,7 @@ main() {
   ac_cxx_double_exact_output=1,
   AC_MSG_RESULT(no)
   ac_cxx_double_exact_output=0,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cxx_double_exact_output=0)
 
 AC_DEFINE_UNQUOTED(PPL_CXX_DOUBLE_EXACT_OUTPUT, $ac_cxx_double_exact_output,
diff --git a/m4/ac_cxx_flexible_arrays.m4 b/m4/ac_cxx_flexible_arrays.m4
index deda89c..8319f07 100644
--- a/m4/ac_cxx_flexible_arrays.m4
+++ b/m4/ac_cxx_flexible_arrays.m4
@@ -76,8 +76,55 @@ main() {
   ac_cxx_supports_flexible_arrays=yes,
   AC_MSG_RESULT(no)
   ac_cxx_supports_flexible_arrays=no,
-  AC_MSG_RESULT(no)
-  ac_cxx_supports_flexible_arrays=no)
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <new>
+#include <cstddef>
+
+class A {
+private:
+  int i;
+  bool b;
+
+public:
+  A()
+    : i(0), b(false) {
+  }
+};
+
+class B {
+private:
+  int capacity;
+  A vec[];
+
+public:
+  void* operator new(size_t fixed_size, int c) {
+    return ::operator new(fixed_size + c*sizeof(B));
+  }
+
+  void operator delete(void* p) {
+    ::operator delete(p);
+  }
+
+  void operator delete(void* p, int) {
+    ::operator delete(p);
+  }
+
+  B(int s)
+    : capacity(s) {
+  }
+};
+
+int
+main() {
+  B* p = new (100) B(100);
+  delete p;
+  return 0;
+}
+]])],
+    AC_MSG_RESULT(yes)
+    ac_cxx_supports_flexible_arrays=yes,
+    AC_MSG_RESULT(no)
+    ac_cxx_supports_flexible_arrays=no))
 
 if test x"$ac_cxx_supports_flexible_arrays" = xyes
 then
diff --git a/m4/ac_cxx_float_exact_output.m4 b/m4/ac_cxx_float_exact_output.m4
index 6a9d983..c964286 100644
--- a/m4/ac_cxx_float_exact_output.m4
+++ b/m4/ac_cxx_float_exact_output.m4
@@ -118,7 +118,7 @@ main() {
   ac_cxx_float_exact_output=1,
   AC_MSG_RESULT(no)
   ac_cxx_float_exact_output=0,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cxx_float_exact_output=0)
 
 AC_DEFINE_UNQUOTED(PPL_CXX_FLOAT_EXACT_OUTPUT, $ac_cxx_float_exact_output,
diff --git a/m4/ac_cxx_ieee_inexact_flag.m4 b/m4/ac_cxx_ieee_inexact_flag.m4
index dba6b50..5292002 100644
--- a/m4/ac_cxx_ieee_inexact_flag.m4
+++ b/m4/ac_cxx_ieee_inexact_flag.m4
@@ -114,7 +114,7 @@ int main() {
   ac_cxx_supports_ieee_inexact_flag=yes,
   AC_MSG_RESULT(no)
   ac_cxx_supports_ieee_inexact_flag=no,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cxx_supports_ieee_inexact_flag=no)
 
 if test x"$ac_cxx_supports_ieee_inexact_flag" = xyes
diff --git a/m4/ac_cxx_limit_memory.m4 b/m4/ac_cxx_limit_memory.m4
index 0f70a2b..8f970fe 100644
--- a/m4/ac_cxx_limit_memory.m4
+++ b/m4/ac_cxx_limit_memory.m4
@@ -98,7 +98,7 @@ main() try {
   ac_cxx_supports_limiting_memory=yes,
   AC_MSG_RESULT(no)
   ac_cxx_supports_limiting_memory=no,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cxx_supports_limiting_memory=no)
 
 if test x"$ac_cxx_supports_limiting_memory" = xyes
diff --git a/m4/ac_cxx_long_double_exact_output.m4 b/m4/ac_cxx_long_double_exact_output.m4
index 32b231f..1e49345 100644
--- a/m4/ac_cxx_long_double_exact_output.m4
+++ b/m4/ac_cxx_long_double_exact_output.m4
@@ -241,7 +241,7 @@ main() {
   ac_cxx_long_double_exact_output=1,
   AC_MSG_RESULT(no)
   ac_cxx_long_double_exact_output=0,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cxx_long_double_exact_output=0)
 
 AC_DEFINE_UNQUOTED(PPL_CXX_LONG_DOUBLE_EXACT_OUTPUT, $ac_cxx_long_double_exact_output,
diff --git a/m4/ac_cxx_proper_long_double.m4 b/m4/ac_cxx_proper_long_double.m4
index b491533..7886ac3 100644
--- a/m4/ac_cxx_proper_long_double.m4
+++ b/m4/ac_cxx_proper_long_double.m4
@@ -45,7 +45,7 @@ int main() {
   ac_cxx_provides_proper_long_double=yes,
   AC_MSG_RESULT(no)
   ac_cxx_provides_proper_long_double=no,
-  AC_MSG_RESULT(no)
+  AC_MSG_RESULT([assuming not])
   ac_cxx_provides_proper_long_double=no)
 
 if test x"$ac_cxx_provides_proper_long_double" = xyes
diff --git a/m4/ac_cxx_remainder_bug.m4 b/m4/ac_cxx_remainder_bug.m4
index 6315c06..2e93b6d 100644
--- a/m4/ac_cxx_remainder_bug.m4
+++ b/m4/ac_cxx_remainder_bug.m4
@@ -51,7 +51,7 @@ int main(int argc, char** argv) {
   ac_cv_cxx_has_remainder_bug=no,
   AC_MSG_RESULT(yes)
   ac_cv_cxx_has_remainder_bug=yes,
-  AC_MSG_RESULT(yes)
+  AC_MSG_RESULT([assuming yes])
   ac_cv_cxx_has_remainder_bug=yes)
 
 if test x"$ac_cv_cxx_has_remainder_bug" = xyes




More information about the PPL-devel mailing list