mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
configure: Add PROFILE_USE conditional and subst.
This commit is contained in:
parent
1a386fd06f
commit
c002e03242
3 changed files with 31 additions and 23 deletions
46
configure.ac
46
configure.ac
|
@ -427,32 +427,38 @@ AC_ARG_ENABLE(profile, RB_HELP_STRING([--enable-profile], [Generate profile at r
|
||||||
profiling="no"
|
profiling="no"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([PROFILE], [[[[ "$profiling" = "yes" ]]]])
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to use a specific runtime profile)
|
AC_MSG_CHECKING(whether to use a specific runtime profile)
|
||||||
AC_ARG_WITH(profile, RB_HELP_STRING([--with-profile[[[=$PWD]]]], [Path to profdata]),
|
AC_ARG_WITH(profile, RB_HELP_STRING([--with-profile[[[=$PWD]]]], [Path to profdata]),
|
||||||
[
|
[
|
||||||
profiling_use=$withval
|
profile_use=$withval
|
||||||
AC_MSG_RESULT([yes, "$profiling_use"])
|
AC_MSG_RESULT([yes, "$profile_use"])
|
||||||
AC_SUBST(PROFILE_USE, $profiling_use)
|
AC_SUBST(PROFILE_USE, $profile_use)
|
||||||
|
|
||||||
dnl AM_COND_IF(CLANG,
|
|
||||||
dnl [
|
|
||||||
dnl RB_VAR_PREPEND([CXXFLAGS], [-fprofile-use="$profiling_use"])
|
|
||||||
dnl ])
|
|
||||||
|
|
||||||
], [
|
], [
|
||||||
AC_MSG_RESULT([no])
|
AM_COND_IF([CLANG],
|
||||||
|
[
|
||||||
|
profile_use="yes"
|
||||||
|
AC_MSG_RESULT([yes, if default.profdata is found])
|
||||||
|
], [
|
||||||
|
profile_use="no"
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
AM_CONDITIONAL([PROFILE], [[[[ "$profiling" = "yes" ]]]])
|
AM_CONDITIONAL([PROFILE_USE], [[[[ "$profile_use" != "no" ]] && [[ "$profiling" == "no" ]]]])
|
||||||
|
|
||||||
dnl Provide the correct target to the Makefiles
|
AM_COND_IF([PROFILE_USE],
|
||||||
AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata)
|
[
|
||||||
AM_COND_IF(CLANG14, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-14) ])
|
dnl Provide the correct target to the Makefiles
|
||||||
AM_COND_IF(CLANG13, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-13) ])
|
AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata)
|
||||||
AM_COND_IF(CLANG12, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-12) ])
|
AM_COND_IF(CLANG14, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-14) ])
|
||||||
AM_COND_IF(CLANG11, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-11) ])
|
AM_COND_IF(CLANG13, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-13) ])
|
||||||
AM_COND_IF(CLANG10, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-10) ])
|
AM_COND_IF(CLANG12, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-12) ])
|
||||||
AM_COND_IF(CLANG9, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-9) ])
|
AM_COND_IF(CLANG11, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-11) ])
|
||||||
|
AM_COND_IF(CLANG10, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-10) ])
|
||||||
|
AM_COND_IF(CLANG9, [ AC_PATH_PROG(LLVM_PROFDATA, llvm-profdata-9) ])
|
||||||
|
])
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Precompiled headers
|
dnl Precompiled headers
|
||||||
|
@ -3003,7 +3009,7 @@ echo "Developer assertions .............. $assert ($assert_type)"
|
||||||
echo "Developer warnings ................ $warnings"
|
echo "Developer warnings ................ $warnings"
|
||||||
echo "Optimized compile ................. $optimize (-O$optimize_level)"
|
echo "Optimized compile ................. $optimize (-O$optimize_level)"
|
||||||
echo "Optimized linking ................. $lto"
|
echo "Optimized linking ................. $lto"
|
||||||
echo "Optimized runtime ................. $profiling_use"
|
echo "Optimized runtime ................. $profile_use"
|
||||||
echo "Profiling runtime ................. $profiling"
|
echo "Profiling runtime ................. $profiling"
|
||||||
echo "Precompile headers ................ $build_pch"
|
echo "Precompile headers ................ $build_pch"
|
||||||
echo "Machine tuned ..................... $machine_tuning"
|
echo "Machine tuned ..................... $machine_tuning"
|
||||||
|
|
|
@ -57,16 +57,16 @@ AM_CXXFLAGS += -fwhole-program-vtables
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !PROFILE
|
|
||||||
if CLANG
|
if CLANG
|
||||||
|
if PROFILE_USE
|
||||||
AM_CXXFLAGS += -fprofile-use
|
AM_CXXFLAGS += -fprofile-use
|
||||||
BUILT_SOURCES += default.profdata
|
BUILT_SOURCES += default.profdata
|
||||||
CLEANFILES += default.profdata
|
CLEANFILES += default.profdata
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if PROFILE
|
|
||||||
if CLANG
|
if CLANG
|
||||||
|
if PROFILE
|
||||||
AM_CXXFLAGS += -fprofile-generate
|
AM_CXXFLAGS += -fprofile-generate
|
||||||
AM_LDFLAGS += -Wl,-fprofile-generate
|
AM_LDFLAGS += -Wl,-fprofile-generate
|
||||||
#TODO: XXX
|
#TODO: XXX
|
||||||
|
|
|
@ -47,8 +47,8 @@ AM_CXXFLAGS += -fwhole-program-vtables
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !PROFILE
|
|
||||||
if CLANG
|
if CLANG
|
||||||
|
if PROFILE_USE
|
||||||
AM_CXXFLAGS += -fprofile-use
|
AM_CXXFLAGS += -fprofile-use
|
||||||
BUILT_SOURCES += default.profdata
|
BUILT_SOURCES += default.profdata
|
||||||
CLEANFILES += default.profdata
|
CLEANFILES += default.profdata
|
||||||
|
@ -210,5 +210,7 @@ id.lo: CXXFLAGS += ${AM_CXXFLAGS} ${SPIRIT_UNIT_CXXFLAGS}
|
||||||
#
|
#
|
||||||
|
|
||||||
# LLVM PGO text to binary for -fprofile-use
|
# LLVM PGO text to binary for -fprofile-use
|
||||||
|
if CLANG
|
||||||
default.profdata:
|
default.profdata:
|
||||||
-$(LLVM_PROFDATA) merge -output=default.profdata default.proftext
|
-$(LLVM_PROFDATA) merge -output=default.profdata default.proftext
|
||||||
|
endif
|
||||||
|
|
Loading…
Reference in a new issue