diff --git a/Makefile.in b/Makefile.in index a2ac0b7..5cd19be 100644 --- a/Makefile.in +++ b/Makefile.in @@ -31,7 +31,7 @@ DOCDIR=@DOCDIR@ CC = @CC@ CCWARNFLAGS = @CCWARNFLAGS@ OPTFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ @SYSDEFS@ @EXTRA_DEFS@ +CPPFLAGS = @CPPFLAGS@ DESTDIR= @@ -75,9 +75,6 @@ chronyd : $(OBJS) $(EXTRA_OBJS) chronyc : $(CLI_OBJS) $(CC) $(OPTFLAGS) -o chronyc $(CLI_OBJS) $(LDFLAGS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS) -conf.o : conf.c - $(CC) $(CFLAGS) $(CPPFLAGS) -DDEFAULT_CONF_DIR=\"$(SYSCONFDIR)\" -c $< - client.o : client.c $(CC) $(CFLAGS) $(CPPFLAGS) @READLINE_COMPILE@ -c $< diff --git a/acquire.c b/acquire.c index 0a02ee0..ff554ca 100644 --- a/acquire.c +++ b/acquire.c @@ -37,6 +37,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "acquire.h" diff --git a/addrfilt.c b/addrfilt.c index f280f0b..b6ae1ae 100644 --- a/addrfilt.c +++ b/addrfilt.c @@ -28,6 +28,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "addrfilt.h" diff --git a/broadcast.c b/broadcast.c index 11c8d70..1e3314b 100644 --- a/broadcast.c +++ b/broadcast.c @@ -24,6 +24,8 @@ Deal with broadcast server functions. */ +#include "config.h" + #include "sysincl.h" #include "memory.h" diff --git a/client.c b/client.c index aad6944..d73e3dc 100644 --- a/client.c +++ b/client.c @@ -26,6 +26,8 @@ from it whilst running. */ +#include "config.h" + #include "sysincl.h" #include "candm.h" diff --git a/clientlog.c b/clientlog.c index 0243753..7666ffd 100644 --- a/clientlog.c +++ b/clientlog.c @@ -31,6 +31,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "clientlog.h" #include "conf.h" diff --git a/cmdmon.c b/cmdmon.c index 04dd7d0..e0ea228 100644 --- a/cmdmon.c +++ b/cmdmon.c @@ -25,6 +25,8 @@ Command and monitoring module in the main program */ +#include "config.h" + #include "sysincl.h" #include "cmdmon.h" diff --git a/cmdparse.c b/cmdparse.c index f91a3da..0bf2492 100644 --- a/cmdparse.c +++ b/cmdparse.c @@ -26,6 +26,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "cmdparse.h" diff --git a/conf.c b/conf.c index 187f1e3..87050eb 100644 --- a/conf.c +++ b/conf.c @@ -36,6 +36,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "conf.h" diff --git a/configure b/configure index f3a9373..b0265c3 100755 --- a/configure +++ b/configure @@ -8,6 +8,8 @@ # # ======================================================================= +rm -f config.h + # This configure script determines the operating system type and version if [ "x${CC}" = "x" ]; then @@ -69,7 +71,7 @@ test_code () { #}}} #{{{ usage usage () { - cat <> config.h + else + echo "#define $1 $2" >> config.h + fi +} +#}}} # ====================================================================== @@ -169,7 +180,7 @@ for option do case "$option" in --trace ) - EXTRA_DEFS="-DTRACEON" + add_def TRACEON ;; --disable-readline ) feat_readline=0 @@ -257,17 +268,17 @@ case $SYSTEM in 4.* ) EXTRA_OBJECTS="sys_sunos.o strerror.o" EXTRA_LIBS="-lkvm" - SYSDEFS="-DSUNOS" + add_def SUNOS echo "Configuring for SunOS (" $SYSTEM "version" $VERSION ")" ;; 5.* ) EXTRA_OBJECTS="sys_solaris.o" EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf" EXTRA_CLI_LIBS="-lsocket -lnsl" - SYSDEFS="-DSOLARIS" + add_def SOLARIS echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")" if [ $VERSION = "5.3" ]; then - SYSDEFS="$SYSDEFS -DHAS_NO_BZERO" + add_def HAS_NO_BZERO echo "Using memset() instead of bzero()" fi ;; @@ -279,12 +290,12 @@ case $SYSTEM in try_rtc=1 try_setsched=1 try_lockmem=1 - SYSDEFS="-DLINUX" + add_def LINUX echo "Configuring for " $SYSTEM if [ "${MACHINE}" = "alpha" ]; then echo "Enabling -mieee" # FIXME: Should really test for GCC - SYSDEFS="$SYSDEFS -mieee -DALPHA" + MYCFLAGS="$MYCFLAGS -mieee" fi ;; @@ -293,7 +304,7 @@ case $SYSTEM in # be supported with the SunOS 4.x driver files. EXTRA_OBJECTS="sys_sunos.o strerror.o" EXTRA_LIBS="-lkvm" - SYSDEFS="-DSUNOS" + add_def SUNOS echo "Configuring for $SYSTEM (using SunOS driver)" ;; NetBSD-* ) @@ -308,13 +319,13 @@ case $SYSTEM in EXTRA_OBJECTS="sys_solaris.o" EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf" EXTRA_CLI_LIBS="-lsocket -lnsl" - SYSDEFS="-DSOLARIS" + add_def SOLARIS echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")" ;; CYGWIN32_NT-i[3456]86 ) EXTRA_OBJECTS="sys_winnt.o" EXTRA_LIBS="" - SYSDEFS="-DWINNT" + add_def WINNT echo "Configuring for Windows NT (Cygwin32)" ;; * ) @@ -336,11 +347,11 @@ else fi if test_code '' 'stdint.h' '' '' ''; then - SYSDEFS="${SYSDEFS} -DHAS_STDINT_H" + add_def HAS_STDINT_H fi if test_code '' 'inttypes.h' '' '' ''; then - SYSDEFS="${SYSDEFS} -DHAS_INTTYPES_H" + add_def HAS_INTTYPES_H fi if [ $feat_ipv6 = "1" ] && \ @@ -350,7 +361,7 @@ if [ $feat_ipv6 = "1" ] && \ n.sin6_addr = in6addr_any; return !inet_ntop(AF_INET6, &n.sin6_addr.s6_addr, p, sizeof(p));' then - SYSDEFS="${SYSDEFS} -DHAVE_IPV6" + add_def HAVE_IPV6 fi if [ $feat_pps = "1" ] && \ @@ -360,7 +371,7 @@ if [ $feat_pps = "1" ] && \ struct timespec ts; return time_pps_fetch(h, PPS_TSFMT_TSPEC, &i, &ts);' then - SYSDEFS="${SYSDEFS} -DHAVE_PPSAPI" + add_def HAVE_PPSAPI fi if [ $feat_linuxcaps = "1" ] && [ $try_linuxcaps = "1" ] && \ @@ -370,7 +381,7 @@ if [ $feat_linuxcaps = "1" ] && [ $try_linuxcaps = "1" ] && \ '' '-lcap' \ 'prctl(PR_SET_KEEPCAPS, 1);cap_set_proc(cap_from_text("cap_sys_time=ep"));' then - EXTRA_DEFS="${EXTRA_DEFS} -DFEAT_LINUXCAPS=1" + add_def FEAT_LINUXCAPS EXTRA_LIBS="-lcap" fi @@ -379,7 +390,7 @@ if [ $feat_rtc = "1" ] && [ $try_rtc = "1" ] && \ 'ioctl(1, RTC_UIE_ON&RTC_UIE_OFF&RTC_RD_TIME&RTC_SET_TIME, 0&RTC_UF);' then EXTRA_OBJECTS="$EXTRA_OBJECTS rtc_linux.o" - EXTRA_DEFS="$EXTRA_DEFS -DFEAT_RTC=1" + add_def FEAT_RTC fi if [ $try_setsched = "1" ] && \ @@ -390,7 +401,7 @@ if [ $try_setsched = "1" ] && \ sched_get_priority_max(SCHED_FIFO); sched_setscheduler(0, SCHED_FIFO, &sched);' then - SYSDEFS="${SYSDEFS} -DHAVE_SCHED_SETSCHEDULER" + add_def HAVE_SCHED_SETSCHEDULER fi if [ $try_lockmem = "1" ] && \ @@ -401,12 +412,12 @@ if [ $try_lockmem = "1" ] && \ setrlimit(RLIMIT_MEMLOCK, &rlim); mlockall(MCL_CURRENT|MCL_FUTURE);' then - SYSDEFS="${SYSDEFS} -DHAVE_MLOCKALL" + add_def HAVE_MLOCKALL fi if [ $feat_forcednsretry = "1" ] then - EXTRA_DEFS="$EXTRA_DEFS -DFORCE_DNSRETRY=1" + add_def FORCE_DNSRETRY fi READLINE_COMPILE="" @@ -417,7 +428,9 @@ if [ $feat_readline = "1" ]; then "$readline_inc" "$readline_lib -ledit" \ 'add_history(readline("prompt"));' then - READLINE_COMPILE="-DFEAT_READLINE=1 -DUSE_EDITLINE=1 $readline_inc" + add_def FEAT_READLINE + add_def USE_EDITLINE + READLINE_COMPILE="$readline_inc" READLINE_LINK="$readline_lib -ledit" fi fi @@ -427,7 +440,8 @@ if [ $feat_readline = "1" ]; then "$readline_inc" "$readline_lib $ncurses_lib -lreadline -lncurses" \ 'add_history(readline("prompt"));' then - READLINE_COMPILE="-DFEAT_READLINE=1 $readline_inc" + add_def FEAT_READLINE + READLINE_COMPILE="$readline_inc" READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses" fi fi @@ -478,6 +492,8 @@ if [ "x$SETDOCDIR" != "x" ]; then DOCDIR=$SETDOCDIR fi +add_def DEFAULT_CONF_DIR "\"$SYSCONFDIR\"" + sed -e "s%@EXTRA_OBJECTS@%${EXTRA_OBJECTS}%;\ s%@CC@%${MYCC}%;\ s%@CFLAGS@%${MYCFLAGS}%;\ @@ -486,8 +502,6 @@ sed -e "s%@EXTRA_OBJECTS@%${EXTRA_OBJECTS}%;\ s%@LIBS@%${LIBS}%;\ s%@LDFLAGS@%${MYLDFLAGS}%;\ s%@EXTRA_LIBS@%${EXTRA_LIBS}%;\ - s%@SYSDEFS@%${SYSDEFS}%;\ - s%@EXTRA_DEFS@%${EXTRA_DEFS}%;\ s%@EXTRA_CLI_LIBS@%${EXTRA_CLI_LIBS}%;\ s%@READLINE_COMPILE@%${READLINE_COMPILE}%;\ s%@READLINE_LINK@%${READLINE_LINK}%;\ diff --git a/keys.c b/keys.c index eda42c9..68a1f1b 100644 --- a/keys.c +++ b/keys.c @@ -25,6 +25,8 @@ */ +#include "config.h" + #include #include #include diff --git a/local.c b/local.c index a48ff87..8017512 100644 --- a/local.c +++ b/local.c @@ -28,6 +28,8 @@ They interface with the system specific driver files in sys_*.c */ +#include "config.h" + #include #include diff --git a/logging.c b/logging.c index ff8832f..282d86e 100644 --- a/logging.c +++ b/logging.c @@ -25,6 +25,8 @@ Module to handle logging of diagnostic information */ +#include "config.h" + #include "sysincl.h" #include "main.h" diff --git a/main.c b/main.c index 93148fc..f7db900 100644 --- a/main.c +++ b/main.c @@ -25,6 +25,8 @@ The main program */ +#include "config.h" + #include "sysincl.h" #include "main.h" diff --git a/manual.c b/manual.c index 16686de..93a9617 100644 --- a/manual.c +++ b/manual.c @@ -30,6 +30,8 @@ */ +#include "config.h" + #include #include "manual.h" diff --git a/md5.c b/md5.c index f997a6e..e7a1121 100644 --- a/md5.c +++ b/md5.c @@ -37,6 +37,8 @@ *********************************************************************** */ +#include "config.h" + #include "md5.h" /* diff --git a/mkdirpp.c b/mkdirpp.c index 65bc9b2..88e29da 100644 --- a/mkdirpp.c +++ b/mkdirpp.c @@ -26,6 +26,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "mkdirpp.h" diff --git a/nameserv.c b/nameserv.c index 268ee2e..1770845 100644 --- a/nameserv.c +++ b/nameserv.c @@ -26,6 +26,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "nameserv.h" diff --git a/ntp_core.c b/ntp_core.c index 639b350..6c8a4ea 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -25,6 +25,8 @@ Core NTP protocol engine */ +#include "config.h" + #include "sysincl.h" #include "ntp_core.h" diff --git a/ntp_io.c b/ntp_io.c index baaf79a..9bad2bc 100644 --- a/ntp_io.c +++ b/ntp_io.c @@ -26,6 +26,8 @@ This file deals with the IO aspects of reading and writing NTP packets */ +#include "config.h" + #include "sysincl.h" #include "ntp_io.h" diff --git a/ntp_sources.c b/ntp_sources.c index d773978..43a5d91 100644 --- a/ntp_sources.c +++ b/ntp_sources.c @@ -27,6 +27,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "ntp_sources.h" diff --git a/pktlength.c b/pktlength.c index 74f35db..a2682f7 100644 --- a/pktlength.c +++ b/pktlength.c @@ -26,6 +26,8 @@ integer endianness within the structures. */ +#include "config.h" + #include "sysincl.h" #include "util.h" diff --git a/refclock.c b/refclock.c index 6fd3527..edb743d 100644 --- a/refclock.c +++ b/refclock.c @@ -25,6 +25,8 @@ */ +#include "config.h" + #include "refclock.h" #include "reference.h" #include "conf.h" diff --git a/refclock_pps.c b/refclock_pps.c index 0a28b06..3a7ae1e 100644 --- a/refclock_pps.c +++ b/refclock_pps.c @@ -25,6 +25,8 @@ */ +#include "config.h" + #include "refclock.h" #if HAVE_PPSAPI diff --git a/refclock_shm.c b/refclock_shm.c index 083a06c..b9edea4 100644 --- a/refclock_shm.c +++ b/refclock_shm.c @@ -25,6 +25,8 @@ */ +#include "config.h" + #include "refclock.h" #include "logging.h" #include "util.h" diff --git a/refclock_sock.c b/refclock_sock.c index b4140dc..79e0e54 100644 --- a/refclock_sock.c +++ b/refclock_sock.c @@ -25,6 +25,8 @@ */ +#include "config.h" + #include "refclock.h" #include "logging.h" #include "util.h" diff --git a/reference.c b/reference.c index 14f6199..2c58b3b 100644 --- a/reference.c +++ b/reference.c @@ -25,6 +25,8 @@ This module keeps track of the source which we are claiming to be our reference, for the purposes of generating outgoing NTP packets */ +#include "config.h" + #include "sysincl.h" #include "memory.h" diff --git a/regress.c b/regress.c index 1613d55..9322d1f 100644 --- a/regress.c +++ b/regress.c @@ -26,6 +26,8 @@ */ +#include "config.h" + #include #include diff --git a/rtc.c b/rtc.c index 612f5b0..4010900 100644 --- a/rtc.c +++ b/rtc.c @@ -23,6 +23,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "rtc.h" diff --git a/rtc_linux.c b/rtc_linux.c index 5fbcf0c..7f53da8 100644 --- a/rtc_linux.c +++ b/rtc_linux.c @@ -26,6 +26,8 @@ */ +#include "config.h" + #if defined LINUX #ifdef sparc diff --git a/sched.c b/sched.c index 3da75bd..c70e195 100644 --- a/sched.c +++ b/sched.c @@ -26,6 +26,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "sched.h" diff --git a/sources.c b/sources.c index bc515e9..5b022f3 100644 --- a/sources.c +++ b/sources.c @@ -28,6 +28,8 @@ */ +#include "config.h" + #include "sysincl.h" #include "sources.h" diff --git a/sourcestats.c b/sourcestats.c index bdb07dd..e36356a 100644 --- a/sourcestats.c +++ b/sourcestats.c @@ -26,6 +26,8 @@ analysis on the samples obtained from the sources, to determined frequencies and error bounds. */ +#include "config.h" + #include "sysincl.h" #include "sourcestats.h" diff --git a/strerror.c b/strerror.c index 7928dc5..8396142 100644 --- a/strerror.c +++ b/strerror.c @@ -24,6 +24,8 @@ Replacement strerror function for systems that don't have it */ +#include "config.h" + #ifdef SUNOS #include diff --git a/sys.c b/sys.c index ac73ec4..6c752fa 100644 --- a/sys.c +++ b/sys.c @@ -25,6 +25,8 @@ in the various operating-system specific modules */ +#include "config.h" + #include "sys.h" #include "logging.h" diff --git a/sys_linux.c b/sys_linux.c index 7370d22..441e6e4 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -27,6 +27,8 @@ */ +#include "config.h" + #ifdef LINUX #include diff --git a/sys_netbsd.c b/sys_netbsd.c index ada0e65..863f572 100644 --- a/sys_netbsd.c +++ b/sys_netbsd.c @@ -25,6 +25,8 @@ Driver file for the NetBSD operating system. */ +#include "config.h" + #ifdef __NetBSD__ #include diff --git a/sys_solaris.c b/sys_solaris.c index e08a602..db40091 100644 --- a/sys_solaris.c +++ b/sys_solaris.c @@ -24,6 +24,8 @@ Driver file for Solaris operating system */ +#include "config.h" + #ifdef SOLARIS #include diff --git a/sys_sunos.c b/sys_sunos.c index da38e46..5178c5a 100644 --- a/sys_sunos.c +++ b/sys_sunos.c @@ -24,6 +24,8 @@ Driver file for the SunOS 4.1.x operating system. */ +#include "config.h" + #ifdef SUNOS #include diff --git a/tempcomp.c b/tempcomp.c index c92d2c3..55bd091 100644 --- a/tempcomp.c +++ b/tempcomp.c @@ -25,6 +25,8 @@ */ +#include "config.h" + #include "conf.h" #include "local.h" #include "memory.h" diff --git a/util.c b/util.c index 2fe4763..0761c94 100644 --- a/util.c +++ b/util.c @@ -25,6 +25,8 @@ Various utility functions */ +#include "config.h" + #include "sysincl.h" #include "util.h" diff --git a/wrap_adjtimex.c b/wrap_adjtimex.c index 740e455..34e8251 100644 --- a/wrap_adjtimex.c +++ b/wrap_adjtimex.c @@ -29,6 +29,8 @@ */ +#include "config.h" + #ifdef LINUX #define _LOOSE_KERNEL_NAMES