diff options
author | Lukas Larsson <[email protected]> | 2019-05-02 12:19:14 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2019-05-02 12:19:14 +0200 |
commit | 37bc04b573bc4a088e98a9cc5586a35c99b9eb00 (patch) | |
tree | a4eaf5050c846b26281119528f943d1b8a357f69 /erts | |
parent | dc8161bc5955768971696d66f49197d77d4f5e85 (diff) | |
parent | aa0a3f324dbe9de200bc9559b8c3b62536f0126d (diff) | |
download | otp-37bc04b573bc4a088e98a9cc5586a35c99b9eb00.tar.gz otp-37bc04b573bc4a088e98a9cc5586a35c99b9eb00.tar.bz2 otp-37bc04b573bc4a088e98a9cc5586a35c99b9eb00.zip |
Merge branch 'lukas/OTP-22/misc-fixes/OTP-15788'
* lukas/OTP-22/misc-fixes/OTP-15788:
erts: Fix PGO configure test for gcc
Diffstat (limited to 'erts')
-rw-r--r-- | erts/configure.in | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/erts/configure.in b/erts/configure.in index 2538505ee7..506ce0d0fb 100644 --- a/erts/configure.in +++ b/erts/configure.in @@ -590,6 +590,22 @@ AC_SUBST(WERRORFLAGS) ## Check if we can do profile guided optimization of beam_emu LM_CHECK_ENABLE_CFLAG([-fprofile-generate -Werror],[PROFILE_GENERATE]) LM_CHECK_ENABLE_CFLAG([-fprofile-use -Werror],[PROFILE_USE]) +LM_CHECK_ENABLE_CFLAG([-fprofile-use -fprofile-correction -Werror],[PROFILE_CORRECTION]) + +if test "X$PROFILE_CORRECTION" = "Xtrue"; then + saved_CFLAGS=$CFLAGS + saved_LDFLAGS=$LDFLAGS + CFLAGS="-fprofile-generate $saved_CFLAGS" + LDFLAGS="-fprofile-generate $saved_LDFLAGS" + AC_MSG_CHECKING([whether $CC links with -fprofile-generate]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[return 0;])], + [AC_MSG_RESULT([yes]) + PROFILE_GENERATE=true], + [AC_MSG_RESULT([no]) + PROFILE_GENERATE=false]) + CFLAGS=$saved_CFLAGS + LDFLAGS=$saved_LDFLAGS +fi ## Check if this is clang LM_CHECK_ENABLE_CFLAG([-fprofile-instr-generate -Werror],[PROFILE_INSTR_GENERATE]) @@ -614,8 +630,8 @@ if test "X$PROFILE_INSTR_GENERATE" = "Xtrue"; then if test "X$LLVM_PROFDATA" != "X"; then CFLAGS="-fprofile-instr-use=default.profdata -Werror $saved_CFLAGS"; $LLVM_PROFDATA merge -output=default.profdata *.profraw; - AC_MSG_CHECKING([whether gcc accepts -fprofile-instr-use=default.profdata -Werror]) - AC_COMPILE_IFELSE([], + AC_MSG_CHECKING([whether $CC accepts -fprofile-instr-use=default.profdata -Werror]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[return 0;])], [AC_MSG_RESULT([yes]) PROFILE_INSTR_USE=true], [AC_MSG_RESULT([no]) @@ -637,8 +653,6 @@ AS_HELP_STRING([--enable-pgo], esac ],enable_pgo=default) -LM_CHECK_ENABLE_CFLAG([-fprofile-use -fprofile-correction -Werror],[PROFILE_CORRECTION]) - USE_PGO=false AC_MSG_CHECKING([whether to do PGO of erts]) if test $enable_pgo = no; then |