From 08e034ad5940f24f99a24630c7b71a0de728d05b Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Sat, 6 Feb 2016 16:19:54 -0800 Subject: [PATCH] Detect working ifunc before enabling dynamic sized delete support Particularly, on arm-linux and x86-64-debian-kfreebsd compilation fails due to lack of support for ifunc. So it is necessary to test at configure time whether ifunc is supported. --- configure.ac | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3f8a5e0..3e0ddda 100644 --- a/configure.ac +++ b/configure.ac @@ -334,7 +334,20 @@ AC_ARG_ENABLE([dynamic-sized-delete-support], [AS_HELP_STRING([--disable-dynamic-sized-delete-support], [don't try to build run-time switch for sized delete operator])], [enable_dyn_sized_delete="$enableval"], - [enable_dyn_sized_delete=yes]) + [enable_dyn_sized_delete=default]) + +AS_IF([test "x$enable_dyn_sized_delete" = xdefault], + [AC_CACHE_CHECK( + [if the compiler supports ifunc attributes for target], + [perftools_cv_ifunc_result], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ + void *resolve_foo() {return 0;} + void foo() __attribute__((ifunc("resolve_foo"))); + ],[foo();])], + [perftools_cv_ifunc_result=yes], + [perftools_cv_ifunc_result=no])])] + [enable_dyn_sized_delete=$perftools_cv_ifunc_result]) AS_IF([test "x$enable_dyn_sized_delete" = xyes], [AC_DEFINE([ENABLE_DYNAMIC_SIZED_DELETE], 1, @@ -348,7 +361,9 @@ AC_ARG_ENABLE([sized-delete], AS_IF([test "x$enable_sized_delete" = xyes], [AC_DEFINE([ENABLE_SIZED_DELETE], 1, [Build sized deletion operators]) AC_MSG_NOTICE([Will build sized deallocation operators])], - [AC_MSG_NOTICE([Will not build sized deallocation operators])]) + [AS_IF([test "x$enable_dyn_sized_delete" = xyes], + [AC_MSG_NOTICE([Will build dynamically detected sized deallocation operators])], + [AC_MSG_NOTICE([Will not build sized deallocation operators])])]) AS_IF([test "x$enable_sized_delete" = xyes -o "x$enable_dyn_sized_delete" = xyes], [AC_CACHE_CHECK([if C++ compiler supports -fsized-deallocation],