]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
configure: rework setting of privops macros
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 8 Dec 2015 15:43:08 +0000 (16:43 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 8 Dec 2015 17:02:05 +0000 (18:02 +0100)
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

index d268f77055eae363da0869b21b47ae25c1d485d1..ff95b17e149445f0ecdb3f52172b8ff87c413607 100755 (executable)
--- 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 '<linux/rtc.h>' 'sys/ioctl.h linux/rtc.h' '' '' \
     'ioctl(1, RTC_UIE_ON&RTC_UIE_OFF&RTC_RD_TIME&RTC_SET_TIME, 0&RTC_UF);'