[systemd-devel] [PATCH] build: Honour SUID_CFLAGS and SUID_LDFLAGS

Cristian Rodríguez crrodriguez at opensuse.org
Sat May 17 09:39:47 PDT 2014


This is the standard* way used to pass special linker/compiler
flags such as -fPIE and -pie

* "Standard" in the sense it is understood by many other
packages  and commonly used by distributions.
---
 configure.ac | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 30ef33d..c798674 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,9 @@ LT_INIT([disable-static])
 AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by systemd])])
 AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by systemd])])
 
+AC_ARG_VAR([SUID_CFLAGS], [CFLAGS used for binaries which are usually with the suid bit])
+AC_ARG_VAR([SUID_LDFLAGS], [LDFLAGS used for binaries which are usually with the suid bit])
+
 # i18n stuff for the PolicyKit policy files
 IT_PROG_INTLTOOL([0.40.0])
 
@@ -181,7 +184,7 @@ AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
         [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
                -flto])],
         [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
-AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
+AC_SUBST([OUR_CFLAGS], "$SUID_CFLAGS $with_cflags $sanitizer_cflags")
 
 AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
         [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
@@ -196,7 +199,7 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
         -Wl,-z,relro \
         -Wl,-z,now \
         -Wl,-fuse-ld=gold])
-AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
+AC_SUBST([OUR_LDFLAGS], "$SUID_LDFLAGS $with_ldflags $sanitizer_ldflags")
 
 AC_CHECK_SIZEOF(pid_t)
 AC_CHECK_SIZEOF(uid_t)
-- 
1.8.4.5



More information about the systemd-devel mailing list