summaryrefslogtreecommitdiff
path: root/m4/ax_cxx_reinterpret_cast.m4
diff options
context:
space:
mode:
authorPeter Kokot <peterkokot@gmail.com>2018-07-26 15:31:37 +0200
committerPeter Kokot <peterkokot@gmail.com>2018-07-26 15:54:20 +0200
commit27efe2db1b0988303e46bd5dda65ff9ec12de18b (patch)
tree79da0613ed4c5ea1f8bb2807f99ec6a9fad44fb1 /m4/ax_cxx_reinterpret_cast.m4
parent72e8def2648d7d05daa95d533079e7373b7218d7 (diff)
downloadautoconf-archive-27efe2db1b0988303e46bd5dda65ff9ec12de18b.tar.gz
Replace AC_TRY_COMPILE and AC_LANG_
Autoconf 2.50 in 2001 made several macros obsolete. These include macros for temporary changing the language - AC_LANG_SAVE, AC_LANG_CPLUSPLUS, AC_LANG_C, and AC_LANG_RESTORE. Instead of these the AC_LANG_PUSH and AC_LANG_POP macros should be used with later Autoconf versions. AC_TRY_COMPILE macros should be replaced with AC_COMPILE_IFELSE. Refs: - http://git.savannah.gnu.org/cgit/autoconf.git/tree/NEWS - https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Language-Choice.html - https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
Diffstat (limited to 'm4/ax_cxx_reinterpret_cast.m4')
-rw-r--r--m4/ax_cxx_reinterpret_cast.m415
1 files changed, 7 insertions, 8 deletions
diff --git a/m4/ax_cxx_reinterpret_cast.m4 b/m4/ax_cxx_reinterpret_cast.m4
index 70245b5..887c80c 100644
--- a/m4/ax_cxx_reinterpret_cast.m4
+++ b/m4/ax_cxx_reinterpret_cast.m4
@@ -21,22 +21,21 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 7
+#serial 8
AU_ALIAS([AC_CXX_REINTERPRET_CAST], [AX_CXX_REINTERPRET_CAST])
AC_DEFUN([AX_CXX_REINTERPRET_CAST],
[AC_CACHE_CHECK(whether the compiler supports reinterpret_cast<>,
ax_cv_cxx_reinterpret_cast,
-[AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <typeinfo>
+[AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <typeinfo>
class Base { public : Base () {} virtual void f () = 0;};
class Derived : public Base { public : Derived () {} virtual void f () {} };
class Unrelated { public : Unrelated () {} };
-int g (Unrelated&) { return 0; }],[
-Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);],
- ax_cv_cxx_reinterpret_cast=yes, ax_cv_cxx_reinterpret_cast=no)
- AC_LANG_RESTORE
+int g (Unrelated&) { return 0; }]], [[
+Derived d;Base& b=d;Unrelated& e=reinterpret_cast<Unrelated&>(b);return g(e);]])],
+ [ax_cv_cxx_reinterpret_cast=yes], [ax_cv_cxx_reinterpret_cast=no])
+ AC_LANG_POP([C++])
])
if test "$ax_cv_cxx_reinterpret_cast" = yes; then
AC_DEFINE(HAVE_REINTERPRET_CAST,,