From 674394c272f65cca61f0032d0f27ee1576e7aa49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org> Date: Fri, 22 Feb 2013 22:18:16 +0000 Subject: [PATCH] [m4] Replace some deprecated AC_TRY_COMPILE by AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[. This commit is related to FS#1257. [[Imported from SVN: r7384]] --- m4/cxx0x_compiler.m4 | 8 ++++---- m4/cxx0x_nullptr.m4 | 5 +++-- m4/cxx0x_static_assert.m4 | 3 ++- m4/dune_deprecated.m4 | 14 ++++++++++---- m4/dune_unused.m4 | 8 +++++--- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/m4/cxx0x_compiler.m4 b/m4/cxx0x_compiler.m4 index 9136e21a8..bc0736bc8 100644 --- a/m4/cxx0x_compiler.m4 +++ b/m4/cxx0x_compiler.m4 @@ -15,10 +15,10 @@ AC_DEFUN([GXX0X],[ if test "x$GXX" = xyes && test "x$gxx0xcheck" = xyes; then AC_LANG_PUSH([C++]) CXX="$CXX -std=c++11" - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <iostream> #include <array> - ], [], + ]], [])], dune_cv_gplusplus_accepts_cplusplus11=yes, dune_cv_gplusplus_accepts_cplusplus11=no) AC_LANG_POP([C++]) @@ -36,10 +36,10 @@ AC_DEFUN([GXX0X],[ if test "x$GXX" = xyes && test "x$gxx0xcheck" = xyes; then AC_LANG_PUSH([C++]) CXX="$CXX -std=c++0x" - AC_TRY_COMPILE([ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <iostream> #include <array> - ], [], + ]], [])], dune_cv_gplusplus_accepts_cplusplus0x=yes, dune_cv_gplusplus_accepts_cplusplus0x=no) AC_LANG_POP([C++]) diff --git a/m4/cxx0x_nullptr.m4 b/m4/cxx0x_nullptr.m4 index 5ada34a3e..0e09739c3 100644 --- a/m4/cxx0x_nullptr.m4 +++ b/m4/cxx0x_nullptr.m4 @@ -3,10 +3,11 @@ AC_DEFUN([NULLPTR_CHECK],[ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([GXX0X]) AC_LANG_PUSH([C++]) - AC_TRY_COMPILE([],[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [],[[ char* ch = nullptr; if(ch!=nullptr) { ; } - ], + ]])], dune_cv_nullptr_support=yes, dune_cv_nullptr_support=no) AC_LANG_POP diff --git a/m4/cxx0x_static_assert.m4 b/m4/cxx0x_static_assert.m4 index 1c6a7cc62..3cead1a7d 100644 --- a/m4/cxx0x_static_assert.m4 +++ b/m4/cxx0x_static_assert.m4 @@ -3,7 +3,8 @@ AC_DEFUN([STATIC_ASSERT_CHECK],[ AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([GXX0X]) AC_LANG_PUSH([C++]) - AC_TRY_COMPILE([],[static_assert(true,"MSG")], + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([], [[static_assert(true,"MSG")]])], dune_cv_static_assert_support=yes, dune_cv_static_assert_support=no) AC_LANG_POP diff --git a/m4/dune_deprecated.m4 b/m4/dune_deprecated.m4 index 01c8b6ebc..49d0edab7 100644 --- a/m4/dune_deprecated.m4 +++ b/m4/dune_deprecated.m4 @@ -5,7 +5,8 @@ AC_DEFUN([DUNE_CHECKDEPRECATED],[ AC_CACHE_CHECK([for __attribute__((deprecated))], dune_cv_attribute_deprecated, [ AC_LANG_PUSH([C++]) - AC_TRY_COMPILE([#define DEP __attribute__((deprecated)) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define DEP __attribute__((deprecated)) class bar { bar() DEP; }; class peng { } DEP; template <class T> @@ -13,7 +14,9 @@ AC_DEFUN([DUNE_CHECKDEPRECATED],[ template <class T> class t_peng { t_peng() {}; } DEP; void foo() DEP; - void foo() {};],[], + void foo() {}; + ]], + [])], dune_cv_attribute_deprecated="yes", dune_cv_attribute_deprecated="no") AC_LANG_POP([C++]) @@ -22,7 +25,8 @@ AC_DEFUN([DUNE_CHECKDEPRECATED],[ AC_CACHE_CHECK([for __attribute__((deprecated("message")))], dune_cv_attribute_deprecated_message, [ AC_LANG_PUSH([C++]) - AC_TRY_COMPILE([#define DEP __attribute__((deprecated("fireworks!"))) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define DEP __attribute__((deprecated("fireworks!"))) class bar { bar() DEP; }; class peng { } DEP; template <class T> @@ -30,7 +34,9 @@ AC_DEFUN([DUNE_CHECKDEPRECATED],[ template <class T> class t_peng { t_peng() {}; } DEP; void foo() DEP; - void foo() {};],[], + void foo() {}; + ]], + [])], dune_cv_attribute_deprecated_message="yes", dune_cv_attribute_deprecated_message="no") AC_LANG_POP([C++]) diff --git a/m4/dune_unused.m4 b/m4/dune_unused.m4 index 1147bc3b2..352ba3071 100644 --- a/m4/dune_unused.m4 +++ b/m4/dune_unused.m4 @@ -3,12 +3,14 @@ AC_DEFUN([DUNE_CHECKUNUSED],[ AC_CACHE_CHECK([for __attribute__((unused))], dune_cv_attribute_unused, [ AC_LANG_PUSH([C++]) - AC_TRY_COMPILE([#define UNUSED __attribute__((unused)) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define UNUSED __attribute__((unused)) void f(int a UNUSED, int UNUSED) { int UNUSED b; - }], - [], + } + ]], + [])], dune_cv_attribute_unused="yes", dune_cv_attribute_unused="no") AC_LANG_POP([C++]) -- GitLab