2 # =======================================================================
4 # chronyd/chronyc - Programs for keeping computer clocks accurate.
6 # Copyright (C) Richard P. Curnow 1997-2003
7 # Copyright (C) Bryan Christianson 2016
8 # Copyright (C) Miroslav Lichvar 2009, 2012-2018
9 # Copyright (C) Stefan R. Filipek 2019
11 # =======================================================================
13 # This configure script determines the operating system type and version
15 # ======================================================================
26 printf "%s" "Checking for $name : "
29 echo "#include \"config.h\""
33 echo "int main(int argc, char **argv) {"
38 echo "docheck.c:" >> config.log
39 cat docheck.c
>> config.log
40 echo $MYCC $MYCFLAGS $MYCPPFLAGS $cflags -o docheck docheck.c
$ldflags \
41 $MYLDFLAGS >> config.log
42 $MYCC $MYCFLAGS $MYCPPFLAGS $cflags -o docheck docheck.c
$ldflags \
43 $MYLDFLAGS >> config.log
2>&1
53 rm -f docheck.c docheck
64 printf "%s" "Checking for $name : "
66 echo $executable $options >> config.log
67 $executable $options >> config.log
2>&1
83 $PKG_CONFIG "$@" 2>> config.log
89 \`configure' configures this package to adapt to many kinds of systems.
91 Usage: ./configure [OPTION]...
93 Defaults for the options are specified in brackets.
96 -h, --help display this help and exit
98 Installation directories:
99 --prefix=PREFIX install architecture-independent files in PREFIX
101 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
104 By default, \`make install' will install all the files in
105 \`/usr/local/bin', \`/usr/local/lib' etc. You can specify
106 an installation prefix other than \`/usr/local' using \`--prefix',
107 for instance \`--prefix=$HOME'.
109 For better control, use the options below.
110 --disable-readline Disable line editing support
111 --without-readline Don't use GNU readline even if it is available
112 --without-editline Don't use editline even if it is available
113 --with-readline-includes=DIR Specify where readline include directory is
114 --with-readline-library=DIR Specify where readline lib directory is
115 --with-ncurses-library=DIR Specify where ncurses lib directory is
116 --disable-sechash Disable support for hashes other than MD5
117 --without-nettle Don't use nettle even if it is available
118 --without-nss Don't use NSS even if it is available
119 --without-tomcrypt Don't use libtomcrypt even if it is available
120 --disable-nts Disable NTS support
121 --without-gnutls Don't use gnutls even if it is available
122 --disable-cmdmon Disable command and monitoring support
123 --disable-ntp Disable NTP support
124 --disable-refclock Disable reference clock support
125 --disable-phc Disable PHC refclock driver
126 --disable-pps Disable PPS refclock driver
127 --disable-ipv6 Disable IPv6 support
128 --disable-rtc Don't include RTC even on Linux
129 --disable-privdrop Disable support for dropping root privileges
130 --without-libcap Don't use libcap even if it is available
131 --enable-scfilter Enable support for system call filtering
132 --without-seccomp Don't use seccomp even if it is available
133 --disable-asyncdns Disable asynchronous name resolving
134 --disable-forcednsretry Don't retry on permanent DNS error
135 --without-clock-gettime Don't use clock_gettime() even if it is available
136 --disable-timestamping Disable support for SW/HW timestamping
137 --enable-ntp-signd Enable support for MS-SNTP authentication in Samba
138 --with-ntp-era=SECONDS Specify earliest assumed NTP time in seconds
139 since 1970-01-01 [50*365 days ago]
140 --with-user=USER Specify default chronyd user [root]
141 --with-hwclockfile=PATH Specify default path to hwclock(8) adjtime file
142 --with-pidfile=PATH Specify default pidfile [/var/run/chrony/chronyd.pid]
143 --with-rtcdevice=PATH Specify default path to RTC device [/dev/rtc]
144 --with-sendmail=PATH Path to sendmail binary [/usr/lib/sendmail]
145 --enable-debug Enable debugging support
147 Fine tuning of the installation directories:
148 --sysconfdir=DIR chrony.conf location [/etc]
149 --bindir=DIR user executables [EPREFIX/bin]
150 --sbindir=DIR system admin executables [EPREFIX/sbin]
151 --datarootdir=DIR data root [PREFIX/share]
152 --mandir=DIR man documentation [DATAROOTDIR/man]
153 --docdir=DIR documentation root [DATAROOTDIR/doc/chrony]
154 --localstatedir=DIR modifiable single-machine data [/var]
155 --chronyrundir=DIR location for chrony sockets [LOCALSTATEDIR/run/chrony]
156 --chronyvardir=DIR location for chrony data [LOCALSTATEDIR/lib/chrony]
158 Overriding system detection when cross-compiling:
159 --host-system=OS Specify system name (uname -s)
160 --host-release=REL Specify system release (uname -r)
161 --host-machine=CPU Specify machine (uname -m)
163 Some influential environment variables:
164 CC C compiler command
165 CFLAGS C compiler flags
166 CPPFLAGS C preprocessor flags, e.g. -I<include dir> if you have
167 headers in a nonstandard directory <include dir>
168 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
169 nonstandard directory <lib dir>
170 PKG_CONFIG path to pkg-config utility
172 directories to add to pkg-config's search path
174 path overriding pkg-config's built-in search path
176 Use these variables to override the choices made by \`configure' or to help
177 it to find libraries and programs with nonstandard names/locations.
185 if [ "x$2" = "x" ]; then
186 echo "#define $1 1" >> config.h
188 echo "#define $1 $2" >> config.h
196 if [ "$ff" = "0" ]; then
199 if grep "define FEAT_$f" config.h
> /dev
/null
; then
209 # ======================================================================
213 OPERATINGSYSTEM
=`uname -s`
263 default_hwclockfile
=""
264 default_pidfile
="/var/run/chrony/chronyd.pid"
265 default_rtcdevice
="/dev/rtc"
266 mail_program
="/usr/lib/sendmail"
283 --with-readline-library=* )
284 readline_lib
=-L`echo $option | sed -e 's/^.*=//;'`
286 --with-readline-includes=* )
287 readline_inc
=-I`echo $option | sed -e 's/^.*=//;'`
289 --with-ncurses-library=* )
290 ncurses_lib
=-L`echo $option | sed -e 's/^.*=//;'`
292 --prefix=* |
--install_prefix=* )
293 SETPREFIX
=`echo $option | sed -e 's/[^=]*=//;'`
296 SETEPREFIX
=`echo $option | sed -e 's/[^=]*=//;'`
299 SETSYSCONFDIR
=`echo $option | sed -e 's/^.*=//;'`
302 SETBINDIR
=`echo $option | sed -e 's/^.*=//;'`
305 SETSBINDIR
=`echo $option | sed -e 's/^.*=//;'`
308 SETDATAROOTDIR
=`echo $option | sed -e 's/^.*=//;'`
311 SETMANDIR
=`echo $option | sed -e 's/^.*=//;'`
314 SETDOCDIR
=`echo $option | sed -e 's/^.*=//;'`
317 SETLOCALSTATEDIR
=`echo $option | sed -e 's/^.*=//;'`
319 --chronyrundir=* |
--chronysockdir=* )
320 SETCHRONYRUNDIR
=`echo $option | sed -e 's/^.*=//;'`
323 SETCHRONYVARDIR
=`echo $option | sed -e 's/^.*=//;'`
349 --without-libcap|
--disable-linuxcaps)
364 --disable-forcednsretry)
367 --without-clock-gettime)
370 --disable-timestamping)
377 ntp_era_split
=`echo $option | sed -e 's/^.*=//;'`
380 default_user
=`echo $option | sed -e 's/^.*=//;'`
382 --with-hwclockfile=* )
383 default_hwclockfile
=`echo $option | sed -e 's/^.*=//;'`
386 default_pidfile
=`echo $option | sed -e 's/^.*=//;'`
389 default_rtcdevice
=`echo $option | sed -e 's/^.*=//;'`
392 mail_program
=`echo $option | sed -e 's/^.*=//;'`
413 OPERATINGSYSTEM
=`echo $option | sed -e 's/^.*=//;'`
416 VERSION
=`echo $option | sed -e 's/^.*=//;'`
419 MACHINE
=`echo $option | sed -e 's/^.*=//;'`
426 echo "Unrecognized option : " $option
430 rm -f config.h config.log
432 SYSTEM
=${OPERATINGSYSTEM}-${MACHINE}
434 case $OPERATINGSYSTEM in
436 EXTRA_OBJECTS
="sys_generic.o sys_linux.o sys_timex.o sys_posix.o"
437 [ $try_libcap != "0" ] && try_libcap
=1
439 [ $try_seccomp != "0" ] && try_seccomp
=1
445 echo "Configuring for " $SYSTEM
448 # recvmmsg() seems to be broken on FreeBSD 11.0 and it's just
449 # a wrapper around recvmsg()
451 EXTRA_OBJECTS
="sys_generic.o sys_netbsd.o sys_timex.o sys_posix.o"
455 if [ $feat_droproot = "1" ]; then
456 add_def FEAT_PRIVDROP
457 priv_ops
="ADJUSTTIME ADJUSTTIMEX SETTIME BINDSOCKET"
459 echo "Configuring for $SYSTEM"
462 EXTRA_OBJECTS
="sys_generic.o sys_netbsd.o sys_timex.o sys_posix.o"
467 echo "Configuring for $SYSTEM"
470 EXTRA_OBJECTS
="sys_macosx.o"
471 LIBS
="$LIBS -lresolv"
473 if [ $feat_droproot = "1" ]; then
474 add_def FEAT_PRIVDROP
475 priv_ops
="ADJUSTTIME SETTIME BINDSOCKET"
477 major
=`echo $VERSION | cut -d. -f1`
478 # ntp_adjtime is not available in macOS 10.12 (Darwin 16.x.x) and earlier
479 if [ $major -gt "16" ]; then
480 add_def HAVE_MACOS_SYS_TIMEX
481 EXTRA_OBJECTS
="$EXTRA_OBJECTS sys_generic.o sys_netbsd.o sys_timex.o"
482 if [ $feat_droproot = "1" ]; then
483 priv_ops
="$priv_ops ADJUSTTIMEX"
486 echo "Configuring for macOS (" $SYSTEM "macOS version" $VERSION ")"
489 EXTRA_OBJECTS
="sys_generic.o sys_solaris.o sys_timex.o sys_posix.o"
490 LIBS
="$LIBS -lsocket -lnsl -lresolv"
494 # These are needed to have msg_control in struct msghdr
495 add_def __EXTENSIONS__
496 add_def _XOPEN_SOURCE
1
497 add_def _XOPEN_SOURCE_EXTENDED
1
498 if [ $feat_droproot = "1" ]; then
499 add_def FEAT_PRIVDROP
500 priv_ops
="ADJUSTTIMEX SETTIME BINDSOCKET"
502 echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")"
505 echo "error: $SYSTEM is not supported (yet?)"
510 if [ $feat_debug = "1" ]; then
513 add_def DEBUG
$feat_debug
515 if [ $feat_cmdmon = "1" ]; then
517 EXTRA_OBJECTS
="$EXTRA_OBJECTS cmdmon.o manual.o pktlength.o"
520 if [ $feat_ntp = "1" ]; then
522 EXTRA_OBJECTS
="$EXTRA_OBJECTS ntp_auth.o ntp_core.o ntp_ext.o ntp_io.o ntp_sources.o"
523 if [ $feat_ntp_signd = "1" ]; then
525 EXTRA_OBJECTS
="$EXTRA_OBJECTS ntp_signd.o"
532 if [ "$feat_cmdmon" = "1" ] ||
[ $feat_ntp = "1" ]; then
533 EXTRA_OBJECTS
="$EXTRA_OBJECTS addrfilt.o clientlog.o keys.o nameserv.o"
538 if [ $feat_refclock = "1" ]; then
539 add_def FEAT_REFCLOCK
540 EXTRA_OBJECTS
="$EXTRA_OBJECTS refclock.o refclock_phc.o refclock_pps.o refclock_shm.o refclock_sock.o"
545 MYCPPFLAGS
="$CPPFLAGS"
548 if [ "x$MYCC" = "x" ]; then
549 for cc
in gcc clang cc
""; do
550 if [ "x$cc" = "x" ]; then
551 echo "error: no C compiler found"
555 if test_code
"$MYCC" '' '' '' ''; then
560 if ! test_code
"$MYCC" '' '' '' ''; then
561 echo "error: C compiler $MYCC cannot create executables"
566 if [ "x$MYCFLAGS" = "x" ]; then
569 TESTCFLAGS
="-D_FORTIFY_SOURCE=2 -fPIE"
570 TESTLDFLAGS
="-pie -Wl,-z,relro,-z,now"
571 if test_code
'hardening compiler options' '' "$TESTCFLAGS" "$TESTLDFLAGS" ''; then
572 MYCFLAGS
="$MYCFLAGS $TESTCFLAGS"
573 MYLDFLAGS
="$MYLDFLAGS $TESTLDFLAGS"
575 TESTCFLAGS
="-fstack-protector-strong --param=ssp-buffer-size=4"
576 if test_code
'-fstack-protector-strong' '' "$TESTCFLAGS" '' ''; then
577 MYCFLAGS
="$MYCFLAGS $TESTCFLAGS"
579 TESTCFLAGS
="-fstack-protector --param=ssp-buffer-size=4"
580 if test_code
'-fstack-protector' '' "$TESTCFLAGS" '' ''; then
581 MYCFLAGS
="$MYCFLAGS $TESTCFLAGS"
586 if [ "x$MYCC" = "xgcc" ] ||
[ "x$MYCC" = "xclang" ]; then
587 MYCFLAGS
="$MYCFLAGS -Wmissing-prototypes -Wall"
590 if [ "x$PKG_CONFIG" = "x" ]; then
591 PKG_CONFIG
=pkg-config
594 if ! test_executable
"pkg-config" $PKG_CONFIG --version; then
600 if test_code
'64-bit time_t' 'time.h' '' '' '
601 char x[sizeof(time_t) > 4 ? 1 : -1] = {0};
604 add_def HAVE_LONG_TIME_T
1
606 if [ "x$ntp_era_split" != "x" ]; then
607 split_seconds
=$ntp_era_split
610 if [ "x$SOURCE_DATE_EPOCH" != "x" ]; then
611 split_seconds
=$SOURCE_DATE_EPOCH
613 split_seconds
=`date '+%s'`
615 if [ "x$split_seconds" = "x" ]; then
616 echo "error: could not get current time, --with-ntp-era option is needed"
619 split_days
=$
((50 * 365))
622 add_def NTP_ERA_SPLIT
"(${split_seconds}LL - $split_days * 24 * 3600)"
624 date_format
='+%Y-%m-%dT%H:%M:%SZ'
626 # Print the full NTP interval if a suitable date is found
627 if [ "x`date -u -d '1970-01-01 UTC 9 days ago 5 seconds 3 seconds' \
628 $date_format 2> /dev/null`" = "x1969-12-23T00:00:08Z" ]
630 time1
="`date -u -d "1970-01-01 UTC
$split_days days ago
$split_seconds seconds
" \
632 time2
="`date -u -d "1970-01-01 UTC
$split_days days ago
$split_seconds seconds
4294967296 seconds
" \
634 echo "NTP time mapped to $time1/$time2"
638 MATHCODE
='return (int) pow(2.0, log(sqrt((double)argc)));'
639 if ! test_code
'math' 'math.h' '' '' "$MATHCODE"; then
640 if test_code
'math in -lm' 'math.h' '' '-lm' "$MATHCODE"; then
643 echo "error: could not compile/link a program which uses sqrt(), log(), pow()"
648 if test_code
'struct in_pktinfo' 'sys/socket.h netinet/in.h' '' '' '
649 struct in_pktinfo ipi;
650 return sizeof (ipi.ipi_spec_dst.s_addr) + IP_PKTINFO;'
652 add_def HAVE_IN_PKTINFO
655 if [ $feat_ipv6 = "1" ] && \
656 test_code
'IPv6 support' 'arpa/inet.h sys/socket.h netinet/in.h' '' "$LIBS" '
657 struct sockaddr_in6 n;
659 n.sin6_addr = in6addr_any;
660 return !inet_ntop(AF_INET6, &n.sin6_addr.s6_addr, p, sizeof(p));'
663 if test_code
'struct in6_pktinfo' 'sys/socket.h netinet/in.h' '' '' '
664 return sizeof (struct in6_pktinfo) + IPV6_PKTINFO;'
666 add_def HAVE_IN6_PKTINFO
668 if test_code
'struct in6_pktinfo with _GNU_SOURCE' 'sys/socket.h netinet/in.h' \
669 '-D_GNU_SOURCE' '' 'return sizeof (struct in6_pktinfo) + IPV6_PKTINFO;'
672 add_def HAVE_IN6_PKTINFO
677 if [ $try_clock_gettime = "1" ]; then
678 if test_code
'clock_gettime()' 'time.h' '' '' \
679 'clock_gettime(CLOCK_REALTIME, NULL);'
681 add_def HAVE_CLOCK_GETTIME
683 if test_code
'clock_gettime() in -lrt' 'time.h' '' '-lrt' \
684 'clock_gettime(CLOCK_REALTIME, NULL);'
686 add_def HAVE_CLOCK_GETTIME
687 EXTRA_LIBS
="$EXTRA_LIBS -lrt"
692 if test_code
'getaddrinfo()' 'sys/types.h sys/socket.h netdb.h' '' "$LIBS" \
693 'return getaddrinfo(0, 0, 0, 0);'
695 add_def HAVE_GETADDRINFO
698 if [ $feat_asyncdns = "1" ] && \
699 test_code
'pthread' 'pthread.h' '-pthread' '' '
701 return (int)pthread_create(&thread, NULL, (void *)1, NULL);'
703 add_def FEAT_ASYNCDNS
704 add_def USE_PTHREAD_ASYNCDNS
705 EXTRA_OBJECTS
="$EXTRA_OBJECTS nameserv_async.o"
709 if test_code
'arc4random_buf()' 'stdlib.h' '' '' 'arc4random_buf(NULL, 0);'; then
710 add_def HAVE_ARC4RANDOM
713 if test_code
'getrandom()' 'stdlib.h sys/random.h' '' '' \
714 'return getrandom(NULL, 256, 0);'; then
715 add_def HAVE_GETRANDOM
720 return !recvmmsg(0, &hdr, 1, MSG_DONTWAIT, 0);'
721 if [ $try_recvmmsg = "1" ]; then
722 if test_code
'recvmmsg()' 'sys/socket.h' '' "$LIBS" "$RECVMMSG_CODE"; then
723 add_def HAVE_RECVMMSG
725 if test_code
'recvmmsg() with _GNU_SOURCE' 'sys/socket.h' '-D_GNU_SOURCE' \
726 "$LIBS" "$RECVMMSG_CODE"
729 add_def HAVE_RECVMMSG
734 if [ $feat_timestamping = "1" ] && [ $try_timestamping = "1" ] &&
735 test_code
'SW/HW timestamping' 'sys/types.h sys/socket.h linux/net_tstamp.h
736 linux/errqueue.h linux/ptp_clock.h' '' '' '
737 int val = SOF_TIMESTAMPING_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE |
738 SOF_TIMESTAMPING_RAW_HARDWARE | SOF_TIMESTAMPING_OPT_CMSG;
739 return sizeof (struct scm_timestamping) + SCM_TSTAMP_SND + PTP_SYS_OFFSET +
740 setsockopt(0, SOL_SOCKET, SO_SELECT_ERR_QUEUE + SO_TIMESTAMPING,
741 &val, sizeof (val));'
743 add_def HAVE_LINUX_TIMESTAMPING
744 EXTRA_OBJECTS
="$EXTRA_OBJECTS hwclock.o ntp_io_linux.o"
746 if test_code
'other timestamping options' \
747 'sys/types.h sys/socket.h linux/net_tstamp.h' '' '' '
748 struct scm_ts_pktinfo pktinfo;
749 pktinfo.if_index = pktinfo.pkt_length = 0;
750 return pktinfo.if_index + pktinfo.pkt_length + HWTSTAMP_FILTER_NTP_ALL +
751 SCM_TIMESTAMPING_PKTINFO +
752 SOF_TIMESTAMPING_OPT_PKTINFO + SOF_TIMESTAMPING_OPT_TX_SWHW;'; then
753 add_def HAVE_LINUX_TIMESTAMPING_RXFILTER_NTP
1
754 add_def HAVE_LINUX_TIMESTAMPING_OPT_PKTINFO
1
755 add_def HAVE_LINUX_TIMESTAMPING_OPT_TX_SWHW
1
760 if [ $feat_refclock = "1" ] && [ $feat_pps = "1" ]; then
761 if test_code
'<sys/timepps.h>' 'inttypes.h time.h sys/timepps.h' '' '' ''; then
762 timepps_h
="sys/timepps.h"
763 add_def HAVE_SYS_TIMEPPS_H
765 if test_code
'<timepps.h>' 'inttypes.h time.h timepps.h' '' '' ''; then
766 timepps_h
="timepps.h"
767 add_def HAVE_TIMEPPS_H
772 if [ "x$timepps_h" != "x" ] && \
773 test_code
'PPSAPI' "inttypes.h string.h time.h $timepps_h" '' '' '
777 ts.tv_sec = ts.tv_nsec = 0;
778 return time_pps_fetch(h, PPS_TSFMT_TSPEC, &i, &ts);'
783 if [ $feat_droproot = "1" ] && [ $try_libcap = "1" ] && \
786 'sys/types.h pwd.h sys/prctl.h sys/capability.h grp.h' \
788 'prctl(PR_SET_KEEPCAPS, 1);cap_set_proc(cap_from_text("cap_sys_time=ep"));'
790 add_def FEAT_PRIVDROP
791 EXTRA_LIBS
="$EXTRA_LIBS -lcap"
794 if [ $feat_droproot = "1" ] && [ $try_clockctl = "1" ] && \
795 test_code
'<sys/clockctl.h>' 'sys/clockctl.h' '' '' ''
797 add_def FEAT_PRIVDROP
798 priv_ops
="BINDSOCKET"
801 if [ $feat_scfilter = "1" ] && [ $try_seccomp = "1" ] && \
802 test_code seccomp
'seccomp.h' '' '-lseccomp' \
803 'seccomp_init(SCMP_ACT_KILL);'
805 add_def FEAT_SCFILTER
806 # NAME2IPADDRESS shouldn't be enabled with other operations as the helper
807 # process works on one request at the time and the async resolver could
808 # block the main thread
809 priv_ops
="NAME2IPADDRESS RELOADDNS"
810 EXTRA_LIBS
="$EXTRA_LIBS -lseccomp"
813 if [ "x$priv_ops" != "x" ]; then
814 EXTRA_OBJECTS
="$EXTRA_OBJECTS privops.o"
815 add_def PRIVOPS_HELPER
816 for o
in $priv_ops; do
821 if [ $feat_rtc = "1" ] && [ $try_rtc = "1" ] && \
822 test_code
'<linux/rtc.h>' 'sys/ioctl.h linux/rtc.h' '' '' \
823 'ioctl(1, RTC_UIE_ON&RTC_UIE_OFF&RTC_RD_TIME&RTC_SET_TIME, 0&RTC_UF);'
825 EXTRA_OBJECTS
="$EXTRA_OBJECTS rtc_linux.o"
829 if [ $feat_refclock = "1" ] && [ $feat_phc = "1" ] && [ $try_phc = "1" ] && \
830 grep '#define HAVE_CLOCK_GETTIME' config.h
> /dev
/null
&& \
831 test_code
'<linux/ptp_clock.h>' 'sys/ioctl.h linux/ptp_clock.h' '' '' \
832 'ioctl(1, PTP_CLOCK_GETCAPS + PTP_SYS_OFFSET, 0);'
834 grep 'HAVE_LINUX_TIMESTAMPING' config.h
> /dev
/null ||
835 EXTRA_OBJECTS
="$EXTRA_OBJECTS hwclock.o"
839 if [ $try_setsched = "1" ] && \
841 'pthread_setschedparam()' \
842 'pthread.h sched.h' '-pthread' '' '
843 struct sched_param sched;
844 sched_get_priority_max(SCHED_FIFO);
845 pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched);'
847 add_def HAVE_PTHREAD_SETSCHEDPARAM
851 if [ $try_lockmem = "1" ] && \
855 mlockall(MCL_CURRENT|MCL_FUTURE);'
857 add_def HAVE_MLOCKALL
859 if [ $try_lockmem = "1" ] && \
861 'setrlimit(RLIMIT_MEMLOCK, ...)' \
862 'sys/resource.h' '' '' '
864 rlim.rlim_max = rlim.rlim_cur = RLIM_INFINITY;
865 setrlimit(RLIMIT_MEMLOCK, &rlim);'
867 add_def HAVE_SETRLIMIT_MEMLOCK
870 if [ $feat_forcednsretry = "1" ]
872 add_def FORCE_DNSRETRY
876 if [ $feat_readline = "1" ]; then
877 if [ $try_editline = "1" ]; then
878 if test_code editline
'stdio.h editline/readline.h' \
879 "$readline_inc" "$readline_lib -ledit" \
880 'add_history(readline("prompt"));'
882 add_def FEAT_READLINE
884 MYCPPFLAGS
="$MYCPPFLAGS $readline_inc"
885 READLINE_LINK
="$readline_lib -ledit"
889 if [ "x$READLINE_LINK" = "x" ] && [ $try_readline = "1" ]; then
890 if test_code readline
'stdio.h readline/readline.h readline/history.h' \
891 "$readline_inc" "$readline_lib -lreadline" \
892 'add_history(readline("prompt"));'
894 add_def FEAT_READLINE
895 MYCPPFLAGS
="$MYCPPFLAGS $readline_inc"
896 READLINE_LINK
="$readline_lib -lreadline"
900 if [ "x$READLINE_LINK" = "x" ] && [ $try_readline = "1" ]; then
901 if test_code
'readline with -lncurses' \
902 'stdio.h readline/readline.h readline/history.h' \
903 "$readline_inc" "$readline_lib $ncurses_lib -lreadline -lncurses" \
904 'add_history(readline("prompt"));'
906 add_def FEAT_READLINE
907 MYCPPFLAGS
="$MYCPPFLAGS $readline_inc"
908 READLINE_LINK
="$readline_lib $ncurses_lib -lreadline -lncurses"
912 EXTRA_CLI_LIBS
="$EXTRA_CLI_LIBS $READLINE_LINK"
915 HASH_OBJ
="hash_intmd5.o"
918 if [ $feat_sechash = "1" ] && [ "x$HASH_LINK" = "x" ] && [ $try_nettle = "1" ]; then
919 test_cflags
="`pkg_config --cflags nettle`"
920 test_link
="`pkg_config --libs nettle`"
921 if test_code
'nettle' 'nettle/nettle-meta.h nettle/sha2.h' \
922 "$test_cflags" "$test_link" \
923 'return nettle_hashes[0]->context_size;'
925 HASH_OBJ
="hash_nettle.o"
926 HASH_LINK
="$test_link"
927 MYCPPFLAGS
="$MYCPPFLAGS $test_cflags"
930 if test_code
'CMAC in nettle' 'nettle/cmac.h' "$test_cflags" "$test_link" \
931 'cmac128_update(NULL, NULL, NULL, 0, NULL);'
934 EXTRA_OBJECTS
="$EXTRA_OBJECTS cmac_nettle.o"
935 EXTRA_CLI_OBJECTS
="$EXTRA_CLI_OBJECTS cmac_nettle.o"
940 if [ $feat_sechash = "1" ] && [ "x$HASH_LINK" = "x" ] && [ $try_nss = "1" ]; then
941 test_cflags
="`pkg_config --cflags nss`"
942 test_link
="`pkg_config --libs-only-L nss` -lfreebl3"
943 if test_code
'NSS' 'nss.h hasht.h nsslowhash.h' \
944 "$test_cflags" "$test_link" \
945 'NSSLOWHASH_Begin(NSSLOWHASH_NewContext(NSSLOW_Init(), HASH_AlgSHA512));'
947 HASH_OBJ
="hash_nss.o"
948 HASH_LINK
="$test_link"
949 MYCPPFLAGS
="$MYCPPFLAGS $test_cflags"
954 if [ $feat_sechash = "1" ] && [ "x$HASH_LINK" = "x" ] && [ $try_tomcrypt = "1" ]; then
955 if test_code
'tomcrypt' 'tomcrypt.h' '-I/usr/include/tomcrypt' '-ltomcrypt' \
956 'hash_memory_multi(find_hash("md5"), NULL, NULL, NULL, 0, NULL, 0);'
958 HASH_OBJ
="hash_tomcrypt.o"
959 HASH_LINK
="-ltomcrypt"
960 MYCPPFLAGS
="$MYCPPFLAGS -I/usr/include/tomcrypt"
965 EXTRA_OBJECTS
="$EXTRA_OBJECTS $HASH_OBJ"
966 EXTRA_CLI_OBJECTS
="$EXTRA_CLI_OBJECTS $HASH_OBJ"
967 LIBS
="$LIBS $HASH_LINK"
969 if [ $feat_ntp = "1" ] && [ $feat_nts = "1" ] && [ $try_gnutls = "1" ] && \
970 echo "$HASH_LINK" |
grep 'nettle' > /dev
/null
; then
971 test_cflags
="`pkg_config --cflags gnutls`"
972 test_link
="`pkg_config --libs gnutls`"
973 if test_code
'gnutls' 'gnutls/gnutls.h' \
974 "$test_cflags" "$test_link" '
975 return gnutls_init(NULL, 0) +
976 gnutls_priority_init2(NULL, "", NULL, GNUTLS_PRIORITY_INIT_DEF_APPEND) +
977 gnutls_prf_rfc5705(NULL, 0, "", 0, "", 16, NULL);' &&
978 test_code
'AES128 in nettle' 'nettle/aes.h' '' "$LIBS" \
979 'aes128_set_encrypt_key(NULL, NULL);'
981 EXTRA_OBJECTS
="$EXTRA_OBJECTS nts_ke_client.o nts_ke_server.o nts_ke_session.o"
982 EXTRA_OBJECTS
="$EXTRA_OBJECTS nts_ntp_auth.o nts_ntp_client.o nts_ntp_server.o"
983 EXTRA_OBJECTS
="$EXTRA_OBJECTS siv_nettle.o"
984 LIBS
="$LIBS $test_link"
985 MYCPPFLAGS
="$MYCPPFLAGS $test_cflags"
989 if test_code
'SIV in nettle' \
990 'nettle/siv-cmac.h' "" "$LIBS" \
991 'siv_cmac_aes128_set_key(NULL, NULL);'
993 add_def HAVE_NETTLE_SIV_CMAC
998 if [ $use_pthread = "1" ]; then
999 MYCFLAGS
="$MYCFLAGS -pthread"
1003 if [ "x$SETSYSCONFDIR" != "x" ]; then
1004 SYSCONFDIR
=$SETSYSCONFDIR
1008 if [ "x$SETPREFIX" != "x" ]; then
1013 if [ "x$SETEPREFIX" != "x" ]; then
1017 BINDIR
=${EPREFIX}/bin
1018 if [ "x$SETBINDIR" != "x" ]; then
1022 SBINDIR
=${EPREFIX}/sbin
1023 if [ "x$SETSBINDIR" != "x" ]; then
1027 DATAROOTDIR
=${PREFIX}/share
1028 if [ "x$SETDATAROOTDIR" != "x" ]; then
1029 DATAROOTDIR
=$SETDATAROOTDIR
1032 MANDIR
=${DATAROOTDIR}/man
1033 if [ "x$SETMANDIR" != "x" ]; then
1037 DOCDIR
=${DATAROOTDIR}/doc
/chrony
1038 if [ "x$SETDOCDIR" != "x" ]; then
1043 if [ "x$SETLOCALSTATEDIR" != "x" ]; then
1044 LOCALSTATEDIR
=$SETLOCALSTATEDIR
1047 CHRONYRUNDIR
=${LOCALSTATEDIR}/run
/chrony
1048 if [ "x$SETCHRONYRUNDIR" != "x" ]; then
1049 CHRONYRUNDIR
=$SETCHRONYRUNDIR
1052 CHRONYVARDIR
=${LOCALSTATEDIR}/lib
/chrony
1053 if [ "x$SETCHRONYVARDIR" != "x" ]; then
1054 CHRONYVARDIR
=$SETCHRONYVARDIR
1057 add_def DEFAULT_CONF_FILE
"\"$SYSCONFDIR/chrony.conf\""
1058 add_def DEFAULT_HWCLOCK_FILE
"\"$default_hwclockfile\""
1059 add_def DEFAULT_PID_FILE
"\"$default_pidfile\""
1060 add_def DEFAULT_RTC_DEVICE
"\"$default_rtcdevice\""
1061 add_def DEFAULT_USER
"\"$default_user\""
1062 add_def DEFAULT_COMMAND_SOCKET
"\"$CHRONYRUNDIR/chronyd.sock\""
1063 add_def MAIL_PROGRAM
"\"$mail_program\""
1065 common_features
="`get_features SECHASH IPV6 DEBUG`"
1066 chronyc_features
="`get_features READLINE`"
1067 chronyd_features
="`get_features CMDMON NTP REFCLOCK RTC PRIVDROP SCFILTER SIGND ASYNCDNS NTS`"
1068 add_def CHRONYC_FEATURES
"\"$chronyc_features $common_features\""
1069 add_def CHRONYD_FEATURES
"\"$chronyd_features $common_features\""
1070 echo "Features : $chronyd_features $chronyc_features $common_features"
1072 if [ -f version.txt
]; then
1073 CHRONY_VERSION
="`cat version.txt`"
1075 CHRONY_VERSION
="DEVELOPMENT"
1078 add_def CHRONY_VERSION
"\"${CHRONY_VERSION}\""
1080 for f
in Makefile
doc
/Makefile test
/unit
/Makefile
1083 sed -e "s%@EXTRA_OBJS@%${EXTRA_OBJECTS}%;\
1084 s%@EXTRA_CLI_OBJS@%${EXTRA_CLI_OBJECTS}%;\
1086 s%@CFLAGS@%${MYCFLAGS}%;\
1087 s%@CPPFLAGS@%${MYCPPFLAGS}%;\
1088 s%@LDFLAGS@%${MYLDFLAGS}%;\
1090 s%@EXTRA_LIBS@%${EXTRA_LIBS}%;\
1091 s%@EXTRA_CLI_LIBS@%${EXTRA_CLI_LIBS}%;\
1092 s%@SYSCONFDIR@%${SYSCONFDIR}%;\
1093 s%@BINDIR@%${BINDIR}%;\
1094 s%@SBINDIR@%${SBINDIR}%;\
1095 s%@DOCDIR@%${DOCDIR}%;\
1096 s%@MANDIR@%${MANDIR}%;\
1097 s%@LOCALSTATEDIR@%${LOCALSTATEDIR}%;\
1098 s%@CHRONYRUNDIR@%${CHRONYRUNDIR}%;\
1099 s%@CHRONYVARDIR@%${CHRONYVARDIR}%;\
1100 s%@DEFAULT_HWCLOCK_FILE@%${default_hwclockfile}%;\
1101 s%@DEFAULT_PID_FILE@%${default_pidfile}%;\
1102 s%@DEFAULT_RTC_DEVICE@%${default_rtcdevice}%;\
1103 s%@DEFAULT_USER@%${default_user}%;\
1104 s%@CHRONY_VERSION@%${CHRONY_VERSION}%;" \
1108 # =======================================================================
1109 # vim:et:sw=2:ht=2:sts=2:fdm=marker:cms=#%s