Enable PIE (if the compiler supports it) when compiling dumpcap. Do this
regardless of whether we're configured to install dumpcap setuid-root because
some users will end up running dumpcap as root regardless of how we were
configured.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@46608
f5534014-38df-0310-8fa8-
9805f1628bb7
diameter/Vodafone.xml \
diameter/AlcatelLucent.xml \
diameter/Nokia.xml \
- diameter/NokiaSiemensNetworks.xml
+ diameter/NokiaSiemensNetworks.xml
#
# Install the DTDs directory files in the "dtds" subdirectory
@SYSTEMCONFIGURATION_FRAMEWORKS@ \
@COREFOUNDATION_FRAMEWORKS@ \
@LIBCAP_LIBS@
-dumpcap_CFLAGS = $(AM_CLEAN_CFLAGS)
+dumpcap_CFLAGS = $(AM_CLEAN_CFLAGS) $(PIE_CFLAGS)
+dumpcap_LDFLAGS = $(PIE_LDFLAGS)
# Common headers
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/wiretap \
AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align)
AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wformat-security)
AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wold-style-definition, C)
+
+CFLAGS_before_pie=$CFLAGS
+AC_WIRESHARK_GCC_CFLAGS_CHECK(-fPIE, C)
+if test "x$CLFAGS" != "x$CFLAGS_before_pie"
+then
+ # Restore CFLAGS
+ CFLAGS=$CFLAGS_before_pie
+
+ LDFLAGS_before_pie=$LDFLAGS
+ AC_WIRESHARK_LDFLAGS_CHECK([-pie])
+ if test "x$LDFLAGS" != "x$LDFLAGS_before_pie"
+ then
+ # We can use PIE
+ PIE_CFLAGS="-fPIE"
+ PIE_LDFLAGS="-pie"
+
+ # Restore LDFLAGS
+ LDFLAGS=$LDFLAGS_before_pie
+ fi
+
+fi
+AC_SUBST(PIE_CFLAGS)
+AC_SUBST(PIE_LDFLAGS)
+
#
# XXX - OK for C++?
#