configure.ac revision 289764
133965Sjdpdnl SNTP subpackage configure.ac			-*- Autoconf -*-
278828Sobriendnl
3218822Sdimm4_include([m4/version.m4])
460484SobrienAC_PREREQ([2.61])
533965SjdpAC_INIT(
633965Sjdp    [sntp],
7130561Sobrien    [VERSION_NUMBER],
833965Sjdp    [http://bugs.ntp.org./],
9130561Sobrien    [],
10130561Sobrien    [http://www.ntp.org./]dnl
11130561Sobrien)
12130561SobrienAC_CONFIG_MACRO_DIR([m4])
1333965SjdpAC_CONFIG_AUX_DIR([libevent/build-aux])
14130561SobrienAC_LANG([C])
15130561Sobrien
16130561Sobrien# Bump sntp_configure_cache_version for each change to configure.ac or
17130561Sobrien# .m4 files which invalidates cached values from previous configure 
1833965Sjdp# runs.
19130561Sobrien#
20130561Sobrien# If the change affects cache variables used only by the main NTP
21208737Sjmallett# configure.ac, then only its version number should be bumped, while
2233965Sjdp# the subdir configure.ac version numbers should be unchanged.  The
23218822Sdim# same is true for a test/variable that is used only by one subdir
2433965Sjdp# being changed incompatibly; only that subdir's cache version needs
2533965Sjdp# bumping.
2689857Sobrien#
2733965Sjdp# If a change affects variables shared by all NTP configure scripts,
2833965Sjdp# please bump the version numbers of each.  If you are not sure, the
2933965Sjdp# safe choice is to bump all on any cache-invalidating change.
3033965Sjdp#
3133965Sjdp# In order to avoid the risk of version stamp collision between -stable
3233965Sjdp# and -dev branches, do not simply increment the version, instead use
3333965Sjdp# the date YYYYMMDD optionally with -HHMM if there is more than one
3433965Sjdp# bump in a day.
3577298Sobrien
3633965Sjdpsntp_configure_cache_version=20120806
3733965Sjdp
3833965Sjdp# When the version of config.cache and configure do not
3933965Sjdp# match, NTP_CACHEVERSION will flush the cache.
4033965Sjdp
4133965SjdpNTP_CACHEVERSION([sntp], [$sntp_configure_cache_version])
4233965Sjdp
4333965SjdpAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
4433965Sjdpdnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
4577298Sobrienm4_ifdef(
4633965Sjdp    [AM_SILENT_RULES],
4733965Sjdp    [AM_SILENT_RULES([yes])]
4833965Sjdp)
4933965SjdpAC_CANONICAL_BUILD
5033965SjdpAC_CANONICAL_HOST
5177298Sobriendnl the 'build' machine is where we run configure and compile
5233965Sjdpdnl the 'host' machine is where the resulting stuff runs.
5333965SjdpAC_DEFINE_UNQUOTED([STR_SYSTEM], "$host", [canonical system (cpu-vendor-os) of where we should run])
5433965SjdpAC_CONFIG_HEADER([config.h])
5533965Sjdpdnl AC_ARG_PROGRAM
5633965Sjdp
5733965SjdpNTP_PROG_CC
5833965Sjdp
5933965SjdpNTP_LOCINFO()
6033965Sjdp
6133965Sjdpdnl AM_PROG_AR req. automake 1.12
6233965Sjdpm4_ifdef(
6333965Sjdp    [AM_PROG_AR],
6433965Sjdp    [AM_PROG_AR]
6533965Sjdp)
6633965Sjdp
6733965SjdpNTP_LIBNTP
6877298Sobrien
6933965SjdpAC_DISABLE_SHARED
7077298SobrienAC_PROG_LIBTOOL
7133965SjdpAC_SUBST([LIBTOOL_DEPS])
7291041Sobrien
7391041SobrienNTP_WITHSNTP
7433965Sjdp
7538889Sjdpcase "$SNTP" in
7638889Sjdp '')
7738889Sjdp    SNTP_DB=
7838889Sjdp    SNTP_DL=
7938889Sjdp    SNTP_DS=
8038889Sjdp    ;;
8138889Sjdpesac
8260484Sobrien
83218822Sdim###
84218822Sdim
85218822Sdim# NTP has (so far) been relying on leading-edge autogen.
86218822Sdim# Therefore, by default:
87218822Sdim# - use the version we ship with
88218822Sdim# - do not install it
89218822Sdim# - build a static copy (AC_DISABLE_SHARED - done earlier)
90218822Sdimcase "${enable_local_libopts+set}" in
91218822Sdim set) ;;
92218822Sdim *) enable_local_libopts=yes ;;
93218822Sdimesac
94218822Sdimcase "${enable_libopts_install+set}" in
95218822Sdim set) ;;
96218822Sdim *) enable_libopts_install=no ;;
97218822Sdimesac
98218822Sdimenable_nls=no
99218822SdimLIBOPTS_CHECK
100218822Sdim
101218822Sdim# From when we only used libevent for sntp:
102218822Sdim#AM_COND_IF(
10377298Sobrien#    [BUILD_SNTP],
10433965Sjdp#    [NTP_LIBEVENT_CHECK],
10533965Sjdp#    [NTP_LIBEVENT_CHECK_NOBUILD]
10677298Sobrien#)
10733965Sjdp
10833965SjdpNTP_LIBEVENT_CHECK([2])
10933965Sjdp
11077298Sobrien# Checks for libraries.
11191041Sobrien
11233965Sjdpdnl NTP_LIBNTP checks for inet_XtoY
11333965Sjdpdnl AC_SEARCH_LIBS([inet_pton], [nsl])
11433965Sjdp
11533965Sjdpdnl AC_SEARCH_LIBS([openlog], [gen syslog])
11633965SjdpLIB_SYSLOG=''
11733965SjdpAC_SUBST([LIB_SYSLOG])
11833965SjdpHMS_SEARCH_LIBS([LIB_SYSLOG], [openlog], [gen syslog])
11933965Sjdp
12033965Sjdp# Checks for header files.
12133965SjdpAC_CHECK_HEADERS([netdb.h string.h strings.h syslog.h])
12291041SobrienNTP_SYSEXITS_H
12391041SobrienNTP_FACILITYNAMES
12433965Sjdp
12533965Sjdp# Checks for typedefs, structures, and compiler characteristics.
12633965SjdpAC_HEADER_STDBOOL
12733965Sjdp
12833965SjdpNTP_OPENSSL
12933965SjdpNTP_IPV6
13091041Sobrien
13160484Sobrien###
13260484Sobrien
13391041Sobrien# Hacks
13491041Sobrien# these need work if we're to move libntp under sntp
13591041SobrienAC_DEFINE([HAVE_NO_NICE], 1, [sntp does not care about 'nice'])
13633965SjdpAC_DEFINE([HAVE_TERMIOS], 1, [sntp does not care about TTY stuff])
13733965Sjdp
13877298Sobrien# Checks for library functions.
13977298SobrienAC_CHECK_FUNCS([socket])
140218822Sdim
141218822SdimNTP_UNITYBUILD
142218822Sdim# HMS: if we don't find c++ we should not look for gtest.
143218822SdimAC_PROG_CXX
144218822SdimNTP_GOOGLETEST
14533965Sjdp
14638889Sjdp# All libraries should be in various LIB_* variables now. 
14738889Sjdp#LIBS=
14838889Sjdp# Sadly not.  There is a gettext() check somewhere, and on Solaris this pulls
14938889Sjdp# in -lintl -lgen, outside our "scope".
15038889Sjdp
15160484SobrienAC_CONFIG_FILES([Makefile])
152130561SobrienAC_CONFIG_FILES([include/Makefile])
15338889SjdpAC_CONFIG_FILES([scripts/Makefile])
15438889SjdpAC_CONFIG_FILES([tests/Makefile])
15538889SjdpAC_CONFIG_FILES([tests/fileHandlingTest.h])
15638889SjdpAC_CONFIG_FILES([unity/Makefile])
15738889Sjdp
158130561SobrienAC_OUTPUT
159130561Sobrien