From b69159b5f89b95930fb162a75bb3854f62eb536a Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 4 Dec 2019 23:30:37 +0100 Subject: [PATCH] Define _FORTIFY_SOURCE only on linux-gnu --- configure | 8 ++++++-- configure.ac | 3 +-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 42d665e0..e871c2d0 100755 --- a/configure +++ b/configure @@ -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 diff --git a/configure.ac b/configure.ac index daf7aac5..fc3d5801 100644 --- a/configure.ac +++ b/configure.ac @@ -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"],[