From df29c95dad48235456222f2582aa37e54d7cf9aa Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 16 Apr 2020 20:28:10 -0700 Subject: [PATCH] configure: Add some better clang-specific options for --enable-profile; output. --- configure.ac | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 37ca61187..111b5bac0 100644 --- a/configure.ac +++ b/configure.ac @@ -348,14 +348,25 @@ dnl AC_MSG_CHECKING(whether to do a profile build) AC_ARG_ENABLE(profile, AC_HELP_STRING([--enable-profile], [Enable profiling]), [ - if test "$ac_cv_c_compiler_gnu" = yes; then + profiling="yes" + AM_COND_IF(GCC, + [ AC_MSG_RESULT([yes, adding -pg]) CXXFLAGS+=" -pg" AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) - else - AC_MSG_RESULT([no, profile builds only work with gcc]) - fi + ]) + + AM_COND_IF(CLANG, + [ + AC_MSG_RESULT([yes, adding profiling flags]) + CXXFLAGS+=" -fprofile-instr-generate" + CXXFLAGS+=" -fcoverage-mapping" + LDFLAGS+=" -fprofile-instr-generate" + AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) + ]) ], [ + AC_MSG_RESULT([no]) + profiling="no" ]) dnl @@ -2174,6 +2185,7 @@ echo "Linker ............................ $LD" echo "Linker flags (LDFLAGS) ............ $LDFLAGS" echo "Developer debug ................... $debug" echo "Developer assert .................. $assert ($assert_type)" +echo "Developer profiling ............... $profiling" echo "Low-memory compile ................ $lowmem_compile" echo "Precompiled headers ............... $build_pch" echo "Optimized compile ................. $optimize"