mirror of
https://github.com/matrix-construct/construct
synced 2024-09-26 18:38:52 +02:00
configure: Improve profile build related.
This commit is contained in:
parent
0f851d1d98
commit
910dafbb85
3 changed files with 65 additions and 7 deletions
39
configure.ac
39
configure.ac
|
@ -381,30 +381,54 @@ dnl
|
||||||
dnl Profiling mode
|
dnl Profiling mode
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to do a profile build)
|
AC_MSG_CHECKING(whether to instrument build for runtime profile generation)
|
||||||
AC_ARG_ENABLE(profile, RB_HELP_STRING([--enable-profile], [Enable profiling]),
|
AC_ARG_ENABLE(profile, RB_HELP_STRING([--enable-profile], [Generate profile at runtime]),
|
||||||
[
|
[
|
||||||
profiling="yes"
|
profiling="yes"
|
||||||
|
AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
|
||||||
|
|
||||||
AM_COND_IF(GCC,
|
AM_COND_IF(GCC,
|
||||||
[
|
[
|
||||||
AC_MSG_RESULT([yes, adding -pg])
|
AC_MSG_RESULT([yes, adding -pg])
|
||||||
RB_VAR_PREPEND([CXXFLAGS], ["-pg"])
|
RB_VAR_PREPEND([CXXFLAGS], ["-pg"])
|
||||||
AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
AM_COND_IF(CLANG,
|
AM_COND_IF(CLANG,
|
||||||
[
|
[
|
||||||
AC_MSG_RESULT([yes, adding profiling flags])
|
AC_MSG_RESULT([yes, adding profiling flags])
|
||||||
RB_VAR_PREPEND([CXXFLAGS], ["-fprofile-instr-generate"])
|
|
||||||
RB_VAR_PREPEND([CXXFLAGS], ["-fcoverage-mapping"])
|
#RB_VAR_PREPEND([CXXFLAGS], ["-fprofile-generate"])
|
||||||
RB_VAR_PREPEND([LDFLAGS], ["-fprofile-instr-generate"])
|
#RB_VAR_PREPEND([LDFLAGS], ["-Wl,-fprofile-generate"])
|
||||||
AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
|
|
||||||
|
dnl TODO: $enableval=instr?
|
||||||
|
dnl RB_VAR_PREPEND([CXXFLAGS], ["-fprofile-instr-generate"])
|
||||||
|
dnl RB_VAR_PREPEND([CXXFLAGS], ["-fcoverage-mapping"])
|
||||||
|
dnl RB_VAR_PREPEND([LDFLAGS], ["-Wl,-fprofile-instr-generate"])
|
||||||
])
|
])
|
||||||
|
|
||||||
], [
|
], [
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
profiling="no"
|
profiling="no"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(whether to use a specific runtime profile)
|
||||||
|
AC_ARG_WITH(profile, RB_HELP_STRING([--with-profile[[[=$PWD]]]], [Path to profdata]),
|
||||||
|
[
|
||||||
|
profiling_use=$withval
|
||||||
|
AC_MSG_RESULT([yes, "$profiling_use"])
|
||||||
|
AC_SUBST(PROFILE_USE, $profiling_use)
|
||||||
|
|
||||||
|
dnl AM_COND_IF(CLANG,
|
||||||
|
dnl [
|
||||||
|
dnl RB_VAR_PREPEND([CXXFLAGS], [-fprofile-use="$profiling_use"])
|
||||||
|
dnl ])
|
||||||
|
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([PROFILE], [[[[ "$profiling" = "yes" ]]]])
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Precompiled headers
|
dnl Precompiled headers
|
||||||
dnl
|
dnl
|
||||||
|
@ -2593,6 +2617,7 @@ echo "Developer profiling ............... $profiling"
|
||||||
echo "Precompiled headers ............... $build_pch"
|
echo "Precompiled headers ............... $build_pch"
|
||||||
echo "Optimized compile ................. $optimize"
|
echo "Optimized compile ................. $optimize"
|
||||||
echo "Optimized linking ................. $lto"
|
echo "Optimized linking ................. $lto"
|
||||||
|
echo "Optimized runtime ................. $profiling_used"
|
||||||
echo "Optimization level ................ $optimize_level"
|
echo "Optimization level ................ $optimize_level"
|
||||||
echo "Machine tuned ..................... $machine_tuning"
|
echo "Machine tuned ..................... $machine_tuning"
|
||||||
echo
|
echo
|
||||||
|
|
|
@ -36,6 +36,12 @@ AM_LDFLAGS = \
|
||||||
$(EXTRA_LDFLAGS) \
|
$(EXTRA_LDFLAGS) \
|
||||||
###
|
###
|
||||||
|
|
||||||
|
if PROFILE
|
||||||
|
if CLANG
|
||||||
|
AM_CXXFLAGS += -fprofile-generate
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
bin_PROGRAMS = construct
|
bin_PROGRAMS = construct
|
||||||
|
|
||||||
construct_LDFLAGS = \
|
construct_LDFLAGS = \
|
||||||
|
|
|
@ -61,6 +61,18 @@ AM_LDFLAGS += -Wl,--enable-runtime-pseudo-reloc
|
||||||
AM_LDFLAGS += -export-symbols-regex '*'
|
AM_LDFLAGS += -export-symbols-regex '*'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if PROFILE
|
||||||
|
if CLANG
|
||||||
|
AM_CXXFLAGS += -fprofile-generate
|
||||||
|
AM_LDFLAGS += -Wl,-fprofile-generate
|
||||||
|
#TODO: XXX
|
||||||
|
#AM_CXXFLAGS += -fprofile-instr-generate
|
||||||
|
#AM_CXXFLAGS += -fcoverage-mapping
|
||||||
|
#AM_LDFLAGS += -Wl,-fprofile-instr-generate
|
||||||
|
#AM_LDFLAGS += -Wl,-fcoverage-mapping
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# libircd
|
# libircd
|
||||||
#
|
#
|
||||||
|
@ -108,6 +120,13 @@ libircd_la_LIBADD = \
|
||||||
$(EXTRA_LIBS) \
|
$(EXTRA_LIBS) \
|
||||||
###
|
###
|
||||||
|
|
||||||
|
if PROFILE
|
||||||
|
if CLANG11
|
||||||
|
#TODO: XXX
|
||||||
|
libircd_la_LIBADD += /usr/lib/llvm-11/lib/clang/11.0.0/lib/linux/libclang_rt.profile-x86_64.a
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# Unit list
|
# Unit list
|
||||||
#
|
#
|
||||||
|
@ -221,6 +240,14 @@ libircd_la_SOURCES += ircd.cc
|
||||||
# Specific unit configurations
|
# Specific unit configurations
|
||||||
#
|
#
|
||||||
|
|
||||||
|
if CLANG
|
||||||
|
if !PROFILE
|
||||||
|
if !DEBUG
|
||||||
|
SPIRIT_UNIT_CXXFLAGS += -fprofile-use
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
client.lo: AM_CPPFLAGS := ${ASIO_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
|
client.lo: AM_CPPFLAGS := ${ASIO_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
|
||||||
ctx_x86_64.lo: AM_CPPFLAGS := -I$(top_srcdir)/include
|
ctx_x86_64.lo: AM_CPPFLAGS := -I$(top_srcdir)/include
|
||||||
ctx.lo: AM_CPPFLAGS := ${ASIO_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
|
ctx.lo: AM_CPPFLAGS := ${ASIO_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
|
||||||
|
|
Loading…
Reference in a new issue