Define _FORTIFY_SOURCE only on linux-gnu

This commit is contained in:
Frank Denis 2019-12-04 23:30:37 +01:00
parent 46afa6c3a9
commit b69159b5f8
2 changed files with 7 additions and 4 deletions

8
configure vendored
View File

@ -6903,6 +6903,8 @@ if test $ac_cv_defined___wasi__ != "no"; then :
WASI="yes"
fi
case $host_os in #(
linux-gnu) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS" >&5
$as_echo_n "checking whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS... " >&6; }
@ -6962,7 +6964,10 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
;; #(
*) :
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fvisibility=hidden" >&5
$as_echo_n "checking whether C compiler accepts -fvisibility=hidden... " >&6; }
@ -7042,7 +7047,6 @@ else
:
fi
CPPFLAGS="$CPPFLAGS -U_FORTIFY_SOURCE"
;;
esac

View File

@ -217,14 +217,13 @@ AC_C_VARARRAYS
AC_CHECK_DEFINE([__wasi__], [WASI="yes"], [])
AX_ADD_FORTIFY_SOURCE
AS_CASE([$host_os], [linux-gnu], [AX_ADD_FORTIFY_SOURCE], [ ])
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
[CFLAGS="$CFLAGS -fvisibility=hidden"])
AS_CASE([$host_os], [cygwin*|mingw*|msys|pw32*|cegcc*], [ ], [
AX_CHECK_COMPILE_FLAG([-fPIC], [CFLAGS="$CFLAGS -fPIC"])
CPPFLAGS="$CPPFLAGS -U_FORTIFY_SOURCE"
])
AS_IF([test "$enable_pie" != "no"],[