From fedc605956a0bfedb10b2e218308c38d692268a5 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 8 Dec 2015 16:43:08 +0100 Subject: [PATCH] configure: rework setting of privops macros Prepare a list of required privileged operations first and from that define the PRIVOPS macros. This will reduce the amount of code that will be needed when the privileged helper is used on other platforms. --- configure | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/configure b/configure index d268f77..ff95b17 100755 --- a/configure +++ b/configure @@ -202,6 +202,7 @@ try_libcap=-1 try_clockctl=0 feat_scfilter=0 try_seccomp=-1 +priv_ops="" readline_lib="" readline_inc="" ncurses_lib="" @@ -393,12 +394,8 @@ case $OPERATINGSYSTEM in EXTRA_CLI_LIBS="-lresolv" add_def MACOSX if [ $feat_droproot = "1" ]; then - EXTRA_OBJECTS="$EXTRA_OBJECTS privops.o" - add_def PRIVOPS_ADJUSTTIME - add_def PRIVOPS_SETTIME - add_def PRIVOPS_BINDSOCKET - add_def PRIVOPS_HELPER add_def FEAT_PRIVDROP + priv_ops="ADJUSTTIME SETTIME BINDSOCKET" fi echo "Configuring for MacOS X (" $SYSTEM "MacOS X version" $VERSION ")" ;; @@ -627,6 +624,14 @@ then EXTRA_LIBS="$EXTRA_LIBS -lseccomp" fi +if [ "x$priv_ops" != "x" ]; then + EXTRA_OBJECTS="$EXTRA_OBJECTS privops.o" + add_def PRIVOPS_HELPER + for o in $priv_ops; do + add_def PRIVOPS_$o + done +fi + if [ $feat_rtc = "1" ] && [ $try_rtc = "1" ] && \ test_code '' 'sys/ioctl.h linux/rtc.h' '' '' \ 'ioctl(1, RTC_UIE_ON&RTC_UIE_OFF&RTC_RD_TIME&RTC_SET_TIME, 0&RTC_UF);'