1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

build-sys: use _FORTIFY_SOURCE only if optimizing

Rather then force the user to undefine _FORTIFY_SOURCE,
don't define it in the first place if it cannot be used.

I'm assuming that -O* can only be sensibly specified in $CFLAGS.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-01-11 10:03:04 -05:00
parent b37844d3d7
commit 6a17986542
2 changed files with 6 additions and 4 deletions

View File

@ -54,7 +54,7 @@ args="$args \
fi fi
if [ "x$1" = "xc" ]; then if [ "x$1" = "xc" ]; then
./configure CFLAGS='-g -O0 -Wp,-U_FORTIFY_SOURCE' $args ./configure CFLAGS='-g -O0' $args
make clean make clean
else else
echo echo
@ -62,6 +62,6 @@ else
echo "Initialized build system. For a common configuration please run:" echo "Initialized build system. For a common configuration please run:"
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
echo echo
echo "./configure CFLAGS='-g -O0 -Wp,-U_FORTIFY_SOURCE' $args" echo "./configure CFLAGS='-g -O0' $args"
echo echo
fi fi

View File

@ -167,8 +167,10 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
--param=ssp-buffer-size=4]) --param=ssp-buffer-size=4])
AC_SUBST([OUR_CFLAGS], $with_cflags) AC_SUBST([OUR_CFLAGS], $with_cflags)
CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\ AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
-Wp,-D_FORTIFY_SOURCE=2]) 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_CPPFLAGS], $with_cppflags) AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\