diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-01-25 23:28:46 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-01-25 23:28:46 -0200 |
commit | 27bcc9111b63e94d091c3fa47e81fe52b806cd3e (patch) | |
tree | 2c7fe7c55dffb63f55f8ac573859fe8d3a066ed4 /configure.ac | |
parent | 88f6ffe449fc1c92725615348b63c4b59bb50921 (diff) | |
download | kmod-27bcc9111b63e94d091c3fa47e81fe52b806cd3e.tar.gz |
build: enable LTO and _FORTIFY_SOURCE with optimization
If building with optimization enabled, enable LTO.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 648ff12..e7bab61 100644 --- a/configure.ac +++ b/configure.ac @@ -226,8 +226,18 @@ CC_CHECK_FLAGS_APPEND(with_cflags, [CFLAGS], [\ -fvisibility=hidden \ -ffunction-sections \ -fdata-sections]) -AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags") +AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], + [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ + -flto -ffat-lto-objects])], + [AC_MSG_RESULT([skipping -flto, optimization not enabled])]) + +AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], + [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\ + -Wp,-D_FORTIFY_SOURCE=2])], + [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])]) + +AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags") CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [ \ -Wl,--as-needed \ |