Make -z relro option conditional on it being available.

This commit is contained in:
gardners 2014-02-17 14:11:00 +10:30 committed by Andrew Bettison
parent 4062b3adbf
commit 0c8fcb0128
2 changed files with 12 additions and 1 deletions

View File

@ -87,7 +87,6 @@ INSTALL_DATA= $(INSTALL) -m 644
CFLAGS+=-Wextra
# Security enhancements from Debian
CFLAGS+=-fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2
LDFLAGS+=-Wl,-z,relro
DEFS= @DEFS@

View File

@ -129,6 +129,18 @@ AC_CHECK_LIB(nsl,callrpc,[LDFLAGS="$LDFLAGS -lnsl"])
AC_CHECK_LIB(socket,socket,[LDFLAGS="$LDFLAGS -lsocket"])
AC_CHECK_LIB(dl,dlopen,[LDFLAGS="$LDFLAGS -ldl"])
AC_CACHE_CHECK(for -z relro option,
libc_cv_z_relro, [dnl
libc_cv_z_relro=no
if AC_TRY_COMMAND([${CC-cc} -v --help 2>&1|grep "z relro" 1>&AS_MESSAGE_LOG_FD])
then
if AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep DATA_SEGMENT_RELRO_END 1>&AS_MESSAGE_LOG_FD])
then
libc_cv_z_relro=yes
LDFLAGS="$LDFLAGS -Wl,z,relro"
fi
fi])
dnl Some platforms still seem to lack the basic single precision trig and power related function.
AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.]))
AC_SEARCH_LIBS([cosf], [m], AC_DEFINE([HAVE_COSF], [1], [Define to 1 if you have the cosf() function.]))