Use config.h

This commit is contained in:
Miroslav Lichvar 2011-05-23 17:51:21 +02:00
parent 3120f8adb6
commit da2c8d9076
42 changed files with 118 additions and 27 deletions

View file

@ -31,7 +31,7 @@ DOCDIR=@DOCDIR@
CC = @CC@ CC = @CC@
CCWARNFLAGS = @CCWARNFLAGS@ CCWARNFLAGS = @CCWARNFLAGS@
OPTFLAGS = @CFLAGS@ OPTFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ @SYSDEFS@ @EXTRA_DEFS@ CPPFLAGS = @CPPFLAGS@
DESTDIR= DESTDIR=
@ -75,9 +75,6 @@ chronyd : $(OBJS) $(EXTRA_OBJS)
chronyc : $(CLI_OBJS) chronyc : $(CLI_OBJS)
$(CC) $(OPTFLAGS) -o chronyc $(CLI_OBJS) $(LDFLAGS) @READLINE_LINK@ $(LIBS) $(EXTRA_CLI_LIBS) $(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 client.o : client.c
$(CC) $(CFLAGS) $(CPPFLAGS) @READLINE_COMPILE@ -c $< $(CC) $(CFLAGS) $(CPPFLAGS) @READLINE_COMPILE@ -c $<

View file

@ -37,6 +37,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "acquire.h" #include "acquire.h"

View file

@ -28,6 +28,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "addrfilt.h" #include "addrfilt.h"

View file

@ -24,6 +24,8 @@
Deal with broadcast server functions. Deal with broadcast server functions.
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "memory.h" #include "memory.h"

View file

@ -26,6 +26,8 @@
from it whilst running. from it whilst running.
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "candm.h" #include "candm.h"

View file

@ -31,6 +31,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "clientlog.h" #include "clientlog.h"
#include "conf.h" #include "conf.h"

View file

@ -25,6 +25,8 @@
Command and monitoring module in the main program Command and monitoring module in the main program
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "cmdmon.h" #include "cmdmon.h"

View file

@ -26,6 +26,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "cmdparse.h" #include "cmdparse.h"

2
conf.c
View file

@ -36,6 +36,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "conf.h" #include "conf.h"

60
configure vendored
View file

@ -8,6 +8,8 @@
# #
# ======================================================================= # =======================================================================
rm -f config.h
# This configure script determines the operating system type and version # This configure script determines the operating system type and version
if [ "x${CC}" = "x" ]; then if [ "x${CC}" = "x" ]; then
@ -69,7 +71,7 @@ test_code () {
#}}} #}}}
#{{{ usage #{{{ usage
usage () { usage () {
cat <<EOF; cat <<EOF
\`configure' configures tdl to adapt to many kinds of systems. \`configure' configures tdl to adapt to many kinds of systems.
Usage: ./configure [OPTION]... Usage: ./configure [OPTION]...
@ -133,6 +135,15 @@ EOF
} }
#}}} #}}}
#{{{
add_def () {
if [ "x$2" = "x" ]; then
echo "#define $1 1" >> config.h
else
echo "#define $1 $2" >> config.h
fi
}
#}}}
# ====================================================================== # ======================================================================
@ -169,7 +180,7 @@ for option
do do
case "$option" in case "$option" in
--trace ) --trace )
EXTRA_DEFS="-DTRACEON" add_def TRACEON
;; ;;
--disable-readline ) --disable-readline )
feat_readline=0 feat_readline=0
@ -257,17 +268,17 @@ case $SYSTEM in
4.* ) 4.* )
EXTRA_OBJECTS="sys_sunos.o strerror.o" EXTRA_OBJECTS="sys_sunos.o strerror.o"
EXTRA_LIBS="-lkvm" EXTRA_LIBS="-lkvm"
SYSDEFS="-DSUNOS" add_def SUNOS
echo "Configuring for SunOS (" $SYSTEM "version" $VERSION ")" echo "Configuring for SunOS (" $SYSTEM "version" $VERSION ")"
;; ;;
5.* ) 5.* )
EXTRA_OBJECTS="sys_solaris.o" EXTRA_OBJECTS="sys_solaris.o"
EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf" EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf"
EXTRA_CLI_LIBS="-lsocket -lnsl" EXTRA_CLI_LIBS="-lsocket -lnsl"
SYSDEFS="-DSOLARIS" add_def SOLARIS
echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")" echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")"
if [ $VERSION = "5.3" ]; then if [ $VERSION = "5.3" ]; then
SYSDEFS="$SYSDEFS -DHAS_NO_BZERO" add_def HAS_NO_BZERO
echo "Using memset() instead of bzero()" echo "Using memset() instead of bzero()"
fi fi
;; ;;
@ -279,12 +290,12 @@ case $SYSTEM in
try_rtc=1 try_rtc=1
try_setsched=1 try_setsched=1
try_lockmem=1 try_lockmem=1
SYSDEFS="-DLINUX" add_def LINUX
echo "Configuring for " $SYSTEM echo "Configuring for " $SYSTEM
if [ "${MACHINE}" = "alpha" ]; then if [ "${MACHINE}" = "alpha" ]; then
echo "Enabling -mieee" echo "Enabling -mieee"
# FIXME: Should really test for GCC # FIXME: Should really test for GCC
SYSDEFS="$SYSDEFS -mieee -DALPHA" MYCFLAGS="$MYCFLAGS -mieee"
fi fi
;; ;;
@ -293,7 +304,7 @@ case $SYSTEM in
# be supported with the SunOS 4.x driver files. # be supported with the SunOS 4.x driver files.
EXTRA_OBJECTS="sys_sunos.o strerror.o" EXTRA_OBJECTS="sys_sunos.o strerror.o"
EXTRA_LIBS="-lkvm" EXTRA_LIBS="-lkvm"
SYSDEFS="-DSUNOS" add_def SUNOS
echo "Configuring for $SYSTEM (using SunOS driver)" echo "Configuring for $SYSTEM (using SunOS driver)"
;; ;;
NetBSD-* ) NetBSD-* )
@ -308,13 +319,13 @@ case $SYSTEM in
EXTRA_OBJECTS="sys_solaris.o" EXTRA_OBJECTS="sys_solaris.o"
EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf" EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf"
EXTRA_CLI_LIBS="-lsocket -lnsl" EXTRA_CLI_LIBS="-lsocket -lnsl"
SYSDEFS="-DSOLARIS" add_def SOLARIS
echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")" echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")"
;; ;;
CYGWIN32_NT-i[3456]86 ) CYGWIN32_NT-i[3456]86 )
EXTRA_OBJECTS="sys_winnt.o" EXTRA_OBJECTS="sys_winnt.o"
EXTRA_LIBS="" EXTRA_LIBS=""
SYSDEFS="-DWINNT" add_def WINNT
echo "Configuring for Windows NT (Cygwin32)" echo "Configuring for Windows NT (Cygwin32)"
;; ;;
* ) * )
@ -336,11 +347,11 @@ else
fi fi
if test_code '<stdint.h>' 'stdint.h' '' '' ''; then if test_code '<stdint.h>' 'stdint.h' '' '' ''; then
SYSDEFS="${SYSDEFS} -DHAS_STDINT_H" add_def HAS_STDINT_H
fi fi
if test_code '<inttypes.h>' 'inttypes.h' '' '' ''; then if test_code '<inttypes.h>' 'inttypes.h' '' '' ''; then
SYSDEFS="${SYSDEFS} -DHAS_INTTYPES_H" add_def HAS_INTTYPES_H
fi fi
if [ $feat_ipv6 = "1" ] && \ if [ $feat_ipv6 = "1" ] && \
@ -350,7 +361,7 @@ if [ $feat_ipv6 = "1" ] && \
n.sin6_addr = in6addr_any; n.sin6_addr = in6addr_any;
return !inet_ntop(AF_INET6, &n.sin6_addr.s6_addr, p, sizeof(p));' return !inet_ntop(AF_INET6, &n.sin6_addr.s6_addr, p, sizeof(p));'
then then
SYSDEFS="${SYSDEFS} -DHAVE_IPV6" add_def HAVE_IPV6
fi fi
if [ $feat_pps = "1" ] && \ if [ $feat_pps = "1" ] && \
@ -360,7 +371,7 @@ if [ $feat_pps = "1" ] && \
struct timespec ts; struct timespec ts;
return time_pps_fetch(h, PPS_TSFMT_TSPEC, &i, &ts);' return time_pps_fetch(h, PPS_TSFMT_TSPEC, &i, &ts);'
then then
SYSDEFS="${SYSDEFS} -DHAVE_PPSAPI" add_def HAVE_PPSAPI
fi fi
if [ $feat_linuxcaps = "1" ] && [ $try_linuxcaps = "1" ] && \ if [ $feat_linuxcaps = "1" ] && [ $try_linuxcaps = "1" ] && \
@ -370,7 +381,7 @@ if [ $feat_linuxcaps = "1" ] && [ $try_linuxcaps = "1" ] && \
'' '-lcap' \ '' '-lcap' \
'prctl(PR_SET_KEEPCAPS, 1);cap_set_proc(cap_from_text("cap_sys_time=ep"));' 'prctl(PR_SET_KEEPCAPS, 1);cap_set_proc(cap_from_text("cap_sys_time=ep"));'
then then
EXTRA_DEFS="${EXTRA_DEFS} -DFEAT_LINUXCAPS=1" add_def FEAT_LINUXCAPS
EXTRA_LIBS="-lcap" EXTRA_LIBS="-lcap"
fi 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);' 'ioctl(1, RTC_UIE_ON&RTC_UIE_OFF&RTC_RD_TIME&RTC_SET_TIME, 0&RTC_UF);'
then then
EXTRA_OBJECTS="$EXTRA_OBJECTS rtc_linux.o" EXTRA_OBJECTS="$EXTRA_OBJECTS rtc_linux.o"
EXTRA_DEFS="$EXTRA_DEFS -DFEAT_RTC=1" add_def FEAT_RTC
fi fi
if [ $try_setsched = "1" ] && \ if [ $try_setsched = "1" ] && \
@ -390,7 +401,7 @@ if [ $try_setsched = "1" ] && \
sched_get_priority_max(SCHED_FIFO); sched_get_priority_max(SCHED_FIFO);
sched_setscheduler(0, SCHED_FIFO, &sched);' sched_setscheduler(0, SCHED_FIFO, &sched);'
then then
SYSDEFS="${SYSDEFS} -DHAVE_SCHED_SETSCHEDULER" add_def HAVE_SCHED_SETSCHEDULER
fi fi
if [ $try_lockmem = "1" ] && \ if [ $try_lockmem = "1" ] && \
@ -401,12 +412,12 @@ if [ $try_lockmem = "1" ] && \
setrlimit(RLIMIT_MEMLOCK, &rlim); setrlimit(RLIMIT_MEMLOCK, &rlim);
mlockall(MCL_CURRENT|MCL_FUTURE);' mlockall(MCL_CURRENT|MCL_FUTURE);'
then then
SYSDEFS="${SYSDEFS} -DHAVE_MLOCKALL" add_def HAVE_MLOCKALL
fi fi
if [ $feat_forcednsretry = "1" ] if [ $feat_forcednsretry = "1" ]
then then
EXTRA_DEFS="$EXTRA_DEFS -DFORCE_DNSRETRY=1" add_def FORCE_DNSRETRY
fi fi
READLINE_COMPILE="" READLINE_COMPILE=""
@ -417,7 +428,9 @@ if [ $feat_readline = "1" ]; then
"$readline_inc" "$readline_lib -ledit" \ "$readline_inc" "$readline_lib -ledit" \
'add_history(readline("prompt"));' 'add_history(readline("prompt"));'
then 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" READLINE_LINK="$readline_lib -ledit"
fi fi
fi fi
@ -427,7 +440,8 @@ if [ $feat_readline = "1" ]; then
"$readline_inc" "$readline_lib $ncurses_lib -lreadline -lncurses" \ "$readline_inc" "$readline_lib $ncurses_lib -lreadline -lncurses" \
'add_history(readline("prompt"));' 'add_history(readline("prompt"));'
then then
READLINE_COMPILE="-DFEAT_READLINE=1 $readline_inc" add_def FEAT_READLINE
READLINE_COMPILE="$readline_inc"
READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses" READLINE_LINK="$readline_lib $ncurses_lib -lreadline -lncurses"
fi fi
fi fi
@ -478,6 +492,8 @@ if [ "x$SETDOCDIR" != "x" ]; then
DOCDIR=$SETDOCDIR DOCDIR=$SETDOCDIR
fi fi
add_def DEFAULT_CONF_DIR "\"$SYSCONFDIR\""
sed -e "s%@EXTRA_OBJECTS@%${EXTRA_OBJECTS}%;\ sed -e "s%@EXTRA_OBJECTS@%${EXTRA_OBJECTS}%;\
s%@CC@%${MYCC}%;\ s%@CC@%${MYCC}%;\
s%@CFLAGS@%${MYCFLAGS}%;\ s%@CFLAGS@%${MYCFLAGS}%;\
@ -486,8 +502,6 @@ sed -e "s%@EXTRA_OBJECTS@%${EXTRA_OBJECTS}%;\
s%@LIBS@%${LIBS}%;\ s%@LIBS@%${LIBS}%;\
s%@LDFLAGS@%${MYLDFLAGS}%;\ s%@LDFLAGS@%${MYLDFLAGS}%;\
s%@EXTRA_LIBS@%${EXTRA_LIBS}%;\ s%@EXTRA_LIBS@%${EXTRA_LIBS}%;\
s%@SYSDEFS@%${SYSDEFS}%;\
s%@EXTRA_DEFS@%${EXTRA_DEFS}%;\
s%@EXTRA_CLI_LIBS@%${EXTRA_CLI_LIBS}%;\ s%@EXTRA_CLI_LIBS@%${EXTRA_CLI_LIBS}%;\
s%@READLINE_COMPILE@%${READLINE_COMPILE}%;\ s%@READLINE_COMPILE@%${READLINE_COMPILE}%;\
s%@READLINE_LINK@%${READLINE_LINK}%;\ s%@READLINE_LINK@%${READLINE_LINK}%;\

2
keys.c
View file

@ -25,6 +25,8 @@
*/ */
#include "config.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View file

@ -28,6 +28,8 @@
They interface with the system specific driver files in sys_*.c They interface with the system specific driver files in sys_*.c
*/ */
#include "config.h"
#include <assert.h> #include <assert.h>
#include <stddef.h> #include <stddef.h>

View file

@ -25,6 +25,8 @@
Module to handle logging of diagnostic information Module to handle logging of diagnostic information
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "main.h" #include "main.h"

2
main.c
View file

@ -25,6 +25,8 @@
The main program The main program
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "main.h" #include "main.h"

View file

@ -30,6 +30,8 @@
*/ */
#include "config.h"
#include <stddef.h> #include <stddef.h>
#include "manual.h" #include "manual.h"

2
md5.c
View file

@ -37,6 +37,8 @@
*********************************************************************** ***********************************************************************
*/ */
#include "config.h"
#include "md5.h" #include "md5.h"
/* /*

View file

@ -26,6 +26,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "mkdirpp.h" #include "mkdirpp.h"

View file

@ -26,6 +26,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "nameserv.h" #include "nameserv.h"

View file

@ -25,6 +25,8 @@
Core NTP protocol engine Core NTP protocol engine
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "ntp_core.h" #include "ntp_core.h"

View file

@ -26,6 +26,8 @@
This file deals with the IO aspects of reading and writing NTP packets This file deals with the IO aspects of reading and writing NTP packets
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "ntp_io.h" #include "ntp_io.h"

View file

@ -27,6 +27,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "ntp_sources.h" #include "ntp_sources.h"

View file

@ -26,6 +26,8 @@
integer endianness within the structures. integer endianness within the structures.
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "util.h" #include "util.h"

View file

@ -25,6 +25,8 @@
*/ */
#include "config.h"
#include "refclock.h" #include "refclock.h"
#include "reference.h" #include "reference.h"
#include "conf.h" #include "conf.h"

View file

@ -25,6 +25,8 @@
*/ */
#include "config.h"
#include "refclock.h" #include "refclock.h"
#if HAVE_PPSAPI #if HAVE_PPSAPI

View file

@ -25,6 +25,8 @@
*/ */
#include "config.h"
#include "refclock.h" #include "refclock.h"
#include "logging.h" #include "logging.h"
#include "util.h" #include "util.h"

View file

@ -25,6 +25,8 @@
*/ */
#include "config.h"
#include "refclock.h" #include "refclock.h"
#include "logging.h" #include "logging.h"
#include "util.h" #include "util.h"

View file

@ -25,6 +25,8 @@
This module keeps track of the source which we are claiming to be This module keeps track of the source which we are claiming to be
our reference, for the purposes of generating outgoing NTP packets */ our reference, for the purposes of generating outgoing NTP packets */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "memory.h" #include "memory.h"

View file

@ -26,6 +26,8 @@
*/ */
#include "config.h"
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>

2
rtc.c
View file

@ -23,6 +23,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "rtc.h" #include "rtc.h"

View file

@ -26,6 +26,8 @@
*/ */
#include "config.h"
#if defined LINUX #if defined LINUX
#ifdef sparc #ifdef sparc

View file

@ -26,6 +26,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "sched.h" #include "sched.h"

View file

@ -28,6 +28,8 @@
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "sources.h" #include "sources.h"

View file

@ -26,6 +26,8 @@
analysis on the samples obtained from the sources, analysis on the samples obtained from the sources,
to determined frequencies and error bounds. */ to determined frequencies and error bounds. */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "sourcestats.h" #include "sourcestats.h"

View file

@ -24,6 +24,8 @@
Replacement strerror function for systems that don't have it Replacement strerror function for systems that don't have it
*/ */
#include "config.h"
#ifdef SUNOS #ifdef SUNOS
#include <errno.h> #include <errno.h>

2
sys.c
View file

@ -25,6 +25,8 @@
in the various operating-system specific modules in the various operating-system specific modules
*/ */
#include "config.h"
#include "sys.h" #include "sys.h"
#include "logging.h" #include "logging.h"

View file

@ -27,6 +27,8 @@
*/ */
#include "config.h"
#ifdef LINUX #ifdef LINUX
#include <sys/time.h> #include <sys/time.h>

View file

@ -25,6 +25,8 @@
Driver file for the NetBSD operating system. Driver file for the NetBSD operating system.
*/ */
#include "config.h"
#ifdef __NetBSD__ #ifdef __NetBSD__
#include <kvm.h> #include <kvm.h>

View file

@ -24,6 +24,8 @@
Driver file for Solaris operating system Driver file for Solaris operating system
*/ */
#include "config.h"
#ifdef SOLARIS #ifdef SOLARIS
#include <kvm.h> #include <kvm.h>

View file

@ -24,6 +24,8 @@
Driver file for the SunOS 4.1.x operating system. Driver file for the SunOS 4.1.x operating system.
*/ */
#include "config.h"
#ifdef SUNOS #ifdef SUNOS
#include <kvm.h> #include <kvm.h>

View file

@ -25,6 +25,8 @@
*/ */
#include "config.h"
#include "conf.h" #include "conf.h"
#include "local.h" #include "local.h"
#include "memory.h" #include "memory.h"

2
util.c
View file

@ -25,6 +25,8 @@
Various utility functions Various utility functions
*/ */
#include "config.h"
#include "sysincl.h" #include "sysincl.h"
#include "util.h" #include "util.h"

View file

@ -29,6 +29,8 @@
*/ */
#include "config.h"
#ifdef LINUX #ifdef LINUX
#define _LOOSE_KERNEL_NAMES #define _LOOSE_KERNEL_NAMES