]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
configure.ac: rev3 for stackprof with --enable-stackprof option
authorSerhei Makarov <serhei@serhei.io>
Fri, 12 Jun 2026 21:29:58 +0000 (17:29 -0400)
committerSerhei Makarov <serhei@serhei.io>
Fri, 12 Jun 2026 21:29:58 +0000 (17:29 -0400)
configure.ac

index da61d5f900f24cb081ee7bb30b75ee3fde2b8295..d0fba6174d2deee30671a7f10b316a72c2417d53 100644 (file)
@@ -900,7 +900,7 @@ fi
 AC_CHECK_PROG(HAVE_ZSTD, zstd, yes, no)
 AM_CONDITIONAL([HAVE_ZSTD],[test "x$HAVE_ZSTD" = "xyes"])
 
-# For tests that need to use C++20
+# For tests and programs that need to use C++20
 AX_CXX_COMPILE_STDCXX(20, noext, optional)
 AS_IF([test "x$HAVE_CXX20" = "x1"], [HAVE_CXX20=yes], [HAVE_CXX20=no])
 AM_CONDITIONAL([HAVE_CXX20],[test "x$HAVE_CXX20" = "xyes"])
@@ -913,6 +913,8 @@ AS_IF([test "x$HAVE_CXX11" = "x1"], [HAVE_CXX11=yes], [HAVE_CXX11=no])
 AM_CONDITIONAL([HAVE_CXX11],[test "x$HAVE_CXX11" = "xyes"])
 
 # For eu-stackprof
+AC_ARG_ENABLE([stackprof],[AS_HELP_STRING([--enable-stackprof], [Build eu-stackprof])],
+  [], [enable_stackprof=auto])
 # optional:
 AC_CHECK_HEADERS([perfmon/pfmlib_perf_event.h])
 AM_CONDITIONAL([HAVE_LIBPFM], [test "x${ac_cv_header_perfmon_pfmlib_perf_event_h}" = "xyes" ])
@@ -930,11 +932,17 @@ AS_IF([test "x$HAVE_CXX20" = "xyes"], [
   AC_LANG_POP
   CXXFLAGS="$old_CXXFLAGS"
 ])
-AS_IF([test "x${ac_cv_header_linux_perf_event_h}x${ac_cv_have_cxx20_format_h}x${HAVE_CXX20}" = "xyesxyesxyes" ],[enable_stackprof=yes],[enable_stackprof=no])
-AM_CONDITIONAL(ENABLE_STACKPROF, test "x$enable_stackprof" = "xyes")
-if test "x${ac_cv_header_linux_perf_event_h}x$enable_stackprof" = "xyesxno"; then
-   AC_MSG_WARN([Unable to build eu-stackprof, missing C++20 with format.h])
+if test "x$enable_stackprof" = "xno"; then
+   true
+elif test "x${ac_cv_header_linux_perf_event_h}x${ac_cv_have_cxx20_format_h}x${HAVE_CXX20}" = "xyesxyesxyes"; then
+   enable_stackprof=yes
+elif test "x$enable_stackprof" = "xyes"; then
+   AC_MSG_ERROR([Unable to build eu-stackprof, missing linux <perf_event.h> or C++20 with <format.h>])
+else
+   enable_stackprof=no
 fi
+AM_CONDITIONAL([ENABLE_STACKPROF],[test "x$enable_stackprof" = "xyes"])
+AS_IF([test "x$enable_stackprof" = "xyes"],[AC_DEFINE([ENABLE_STACKPROF], [1], [Build eu-stackprof])])
 
 AC_CHECK_HEADERS([execinfo.h])