]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Print enabled/disabled features with version
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 19 Sep 2014 15:46:34 +0000 (17:46 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 22 Sep 2014 11:14:16 +0000 (13:14 +0200)
client.c
configure
main.c

index aa78959192213833b65089d753ce2006f1bf67d4..0008857b1502ca2ac846d5c04590b4a90b60a1ce 100644 (file)
--- a/client.c
+++ b/client.c
@@ -2762,7 +2762,7 @@ main(int argc, char **argv)
     } else if (!strcmp(*argv, "-6")) {
       family = IPADDR_INET6;
     } else if (!strcmp("-v", *argv) || !strcmp("--version",*argv)) {
-      printf("chronyc (chrony) version %s\n", CHRONY_VERSION);
+      printf("chronyc (chrony) version %s (%s)\n", CHRONY_VERSION, CHRONYC_FEATURES);
       exit(0);
     } else if (!strncmp(*argv, "-", 1)) {
       fprintf(stderr, "Usage : %s [-h <hostname>] [-p <port-number>] [-n] [-4|-6] [-m] [-a] [-f <file>]] [command]\n", progname);
index c2e54d10642871f7ea162293f98d75da8fe94583..11950ca0bfebeaffa73095b9f4e74ac143a2df7d 100755 (executable)
--- a/configure
+++ b/configure
@@ -168,6 +168,22 @@ pkg_config () {
   pkg-config $@ 2> /dev/null
 }
 #}}}
+#{{{ get_features
+get_features () {
+  ff=1
+  for f; do
+    if [ "$ff" = "0" ]; then
+      echo -n " "
+    fi
+    if grep "define FEAT_$f" config.h > /dev/null; then
+      echo -n "+$f"
+    else
+      echo -n "-$f"
+    fi
+    ff=0
+  done
+}
+#}}}
 
 # ======================================================================
 
@@ -739,6 +755,13 @@ add_def DEFAULT_CONF_FILE "\"$SYSCONFDIR/chrony.conf\""
 add_def DEFAULT_USER "\"$default_user\""
 add_def MAIL_PROGRAM "\"$mail_program\""
 
+common_features="`get_features ASYNCDNS IPV6 SECHASH`"
+chronyc_features="`get_features READLINE`"
+chronyd_features="`get_features CMDMON NTP REFCLOCK RTC PRIVDROP DEBUG`"
+add_def CHRONYC_FEATURES "\"$chronyc_features $common_features\""
+add_def CHRONYD_FEATURES "\"$chronyd_features $common_features\""
+echo "Features : $chronyd_features $chronyc_features $common_features"
+
 if [ -f version.txt ]; then
   add_def CHRONY_VERSION "\"`cat version.txt`\""
 else
diff --git a/main.c b/main.c
index 868cb7f904af91725ceb5e61aa339f032fd5e0b8..2831d67386ff9778c0f60ea80e127baac798abd7 100644 (file)
--- a/main.c
+++ b/main.c
@@ -379,7 +379,7 @@ int main
       do_init_rtc = 1;
     } else if (!strcmp("-v", *argv) || !strcmp("--version",*argv)) {
       /* This write to the terminal is OK, it comes before we turn into a daemon */
-      printf("chronyd (chrony) version %s\n", CHRONY_VERSION);
+      printf("chronyd (chrony) version %s (%s)\n", CHRONY_VERSION, CHRONYD_FEATURES);
       exit(0);
     } else if (!strcmp("-n", *argv)) {
       nofork = 1;
@@ -425,7 +425,8 @@ int main
   
   LOG_SetDebugLevel(debug);
   
-  LOG(LOGS_INFO, LOGF_Main, "chronyd version %s starting", CHRONY_VERSION);
+  LOG(LOGS_INFO, LOGF_Main, "chronyd version %s starting (%s)",
+      CHRONY_VERSION, CHRONYD_FEATURES);
 
   DNS_SetAddressFamily(address_family);