Fixed link time optimizer check for FreeBSD

This commit is contained in:
Maria Matejka 2019-02-27 14:40:05 +01:00
parent f249d0b84c
commit a68442e056
2 changed files with 32 additions and 6 deletions

24
aclocal.m4 vendored
View file

@ -131,6 +131,30 @@ AC_DEFUN([BIRD_CHECK_ANDROID_LOG],
) )
]) ])
AC_DEFUN([BIRD_CHECK_LTO],
[
bird_tmp_cflags="$CFLAGS"
bird_tmp_ldflags="$CFLAGS"
CFLAGS="-flto"
LDFLAGS="-flto"
AC_CACHE_CHECK(
[whether link time optimizer is available],
[bird_cv_c_lto],
[
AC_LINK_IFELSE(
[AC_LANG_PROGRAM()],
[bird_cv_c_lto=yes],
[bird_cv_c_lto=no]
)
]
)
CFLAGS="$bird_tmp_cflags"
LDFLAGS="$bird_tmp_ldflags"
])
AC_DEFUN([BIRD_CHECK_GCC_OPTION], AC_DEFUN([BIRD_CHECK_GCC_OPTION],
[ [
bird_tmp_cflags="$CFLAGS" bird_tmp_cflags="$CFLAGS"

View file

@ -137,22 +137,24 @@ if test "$bird_cflags_default" = yes ; then
BIRD_CHECK_GCC_OPTION([bird_cv_c_option_wno_missing_init], [-Wno-missing-field-initializers], [-Wall -Wextra]) BIRD_CHECK_GCC_OPTION([bird_cv_c_option_wno_missing_init], [-Wno-missing-field-initializers], [-Wall -Wextra])
BIRD_CHECK_GCC_OPTION([bird_cv_c_option_fno_strict_aliasing], [-fno-strict-aliasing]) BIRD_CHECK_GCC_OPTION([bird_cv_c_option_fno_strict_aliasing], [-fno-strict-aliasing])
BIRD_CHECK_GCC_OPTION([bird_cv_c_option_fno_strict_overflow], [-fno-strict-overflow]) BIRD_CHECK_GCC_OPTION([bird_cv_c_option_fno_strict_overflow], [-fno-strict-overflow])
if test "$enable_debug" = no; then
BIRD_CHECK_GCC_OPTION([bird_cv_c_option_flto], [-flto])
fi
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wno-parentheses" CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wno-parentheses"
BIRD_ADD_GCC_OPTION([bird_cv_c_option_wno_pointer_sign], [-Wno-pointer-sign]) BIRD_ADD_GCC_OPTION([bird_cv_c_option_wno_pointer_sign], [-Wno-pointer-sign])
BIRD_ADD_GCC_OPTION([bird_cv_c_option_wno_missing_init], [-Wno-missing-field-initializers]) BIRD_ADD_GCC_OPTION([bird_cv_c_option_wno_missing_init], [-Wno-missing-field-initializers])
BIRD_ADD_GCC_OPTION([bird_cv_c_option_fno_strict_aliasing], [-fno-strict-aliasing]) BIRD_ADD_GCC_OPTION([bird_cv_c_option_fno_strict_aliasing], [-fno-strict-aliasing])
BIRD_ADD_GCC_OPTION([bird_cv_c_option_fno_strict_overflow], [-fno-strict-overflow]) BIRD_ADD_GCC_OPTION([bird_cv_c_option_fno_strict_overflow], [-fno-strict-overflow])
if test "$enable_debug" = no; then
BIRD_ADD_GCC_OPTION([bird_cv_c_option_flto], [-flto])
fi
fi fi
AC_MSG_CHECKING([CFLAGS]) AC_MSG_CHECKING([CFLAGS])
AC_MSG_RESULT([$CFLAGS]) AC_MSG_RESULT([$CFLAGS])
if test "$enable_debug" = no; then
BIRD_CHECK_LTO
fi
if test "$bird_cv_c_lto" = yes; then
CFLAGS="$CFLAGS -flto"
LDFLAGS="$LDFLAGS -flto"
fi
AC_PROG_CPP AC_PROG_CPP
AC_PROG_INSTALL AC_PROG_INSTALL