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"])
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" ])
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])