1285612Sdelphijdnl SNTP subpackage configure.ac			-*- Autoconf -*-
2285612Sdelphijdnl
3285612Sdelphijm4_include([m4/version.m4])
4285612SdelphijAC_PREREQ([2.61])
5285612SdelphijAC_INIT(
6285612Sdelphij    [sntp],
7285612Sdelphij    [VERSION_NUMBER],
8285612Sdelphij    [http://bugs.ntp.org./],
9285612Sdelphij    [],
10285612Sdelphij    [http://www.ntp.org./]dnl
11285612Sdelphij)
12285612SdelphijAC_CONFIG_MACRO_DIR([m4])
13285612SdelphijAC_CONFIG_AUX_DIR([libevent/build-aux])
14289997SglebiusAC_LANG([C])
15285612Sdelphij
16285612Sdelphij# Bump sntp_configure_cache_version for each change to configure.ac or
17285612Sdelphij# .m4 files which invalidates cached values from previous configure 
18285612Sdelphij# runs.
19285612Sdelphij#
20285612Sdelphij# If the change affects cache variables used only by the main NTP
21285612Sdelphij# configure.ac, then only its version number should be bumped, while
22285612Sdelphij# the subdir configure.ac version numbers should be unchanged.  The
23285612Sdelphij# same is true for a test/variable that is used only by one subdir
24285612Sdelphij# being changed incompatibly; only that subdir's cache version needs
25285612Sdelphij# bumping.
26285612Sdelphij#
27285612Sdelphij# If a change affects variables shared by all NTP configure scripts,
28285612Sdelphij# please bump the version numbers of each.  If you are not sure, the
29285612Sdelphij# safe choice is to bump all on any cache-invalidating change.
30285612Sdelphij#
31285612Sdelphij# In order to avoid the risk of version stamp collision between -stable
32285612Sdelphij# and -dev branches, do not simply increment the version, instead use
33285612Sdelphij# the date YYYYMMDD optionally with -HHMM if there is more than one
34285612Sdelphij# bump in a day.
35285612Sdelphij
36285612Sdelphijsntp_configure_cache_version=20120806
37285612Sdelphij
38285612Sdelphij# When the version of config.cache and configure do not
39285612Sdelphij# match, NTP_CACHEVERSION will flush the cache.
40285612Sdelphij
41285612SdelphijNTP_CACHEVERSION([sntp], [$sntp_configure_cache_version])
42285612Sdelphij
43285612SdelphijAM_INIT_AUTOMAKE([1.10 foreign -Wall -Wno-gnu])
44285612Sdelphijdnl AM_SILENT_RULES req. automake 1.11.  [yes] defaults V=0
45285612Sdelphijm4_ifdef(
46285612Sdelphij    [AM_SILENT_RULES],
47285612Sdelphij    [AM_SILENT_RULES([yes])]
48285612Sdelphij)
49285612SdelphijAC_CANONICAL_BUILD
50182007SrobertoAC_CANONICAL_HOST
51285612Sdelphijdnl the 'build' machine is where we run configure and compile
52285612Sdelphijdnl the 'host' machine is where the resulting stuff runs.
53285612SdelphijAC_DEFINE_UNQUOTED([STR_SYSTEM], "$host", [canonical system (cpu-vendor-os) of where we should run])
54285612SdelphijAC_CONFIG_HEADER([config.h])
55285612Sdelphijdnl AC_ARG_PROGRAM
56132451Sroberto
57285612SdelphijNTP_PROG_CC
58316069SdelphijNTP_COMPILER
59316069SdelphijNTP_HARDEN
60132451Sroberto
61285612SdelphijNTP_LOCINFO()
62182007Sroberto
63285612Sdelphijdnl AM_PROG_AR req. automake 1.12
64285612Sdelphijm4_ifdef(
65285612Sdelphij    [AM_PROG_AR],
66285612Sdelphij    [AM_PROG_AR]
67285612Sdelphij)
68200576Sroberto
69285612SdelphijNTP_LIBNTP
70285612Sdelphij
71285612SdelphijAC_DISABLE_SHARED
72182007SrobertoAC_PROG_LIBTOOL
73285612SdelphijAC_SUBST([LIBTOOL_DEPS])
74182007Sroberto
75285612SdelphijNTP_WITHSNTP
76285612Sdelphij
77285612Sdelphijcase "$SNTP" in
78285612Sdelphij '')
79285612Sdelphij    SNTP_DB=
80285612Sdelphij    SNTP_DL=
81285612Sdelphij    SNTP_DS=
82285612Sdelphij    ;;
83285612Sdelphijesac
84285612Sdelphij
85285612Sdelphij###
86285612Sdelphij
87182007Sroberto# NTP has (so far) been relying on leading-edge autogen.
88182007Sroberto# Therefore, by default:
89182007Sroberto# - use the version we ship with
90182007Sroberto# - do not install it
91182007Sroberto# - build a static copy (AC_DISABLE_SHARED - done earlier)
92182007Srobertocase "${enable_local_libopts+set}" in
93182007Sroberto set) ;;
94182007Sroberto *) enable_local_libopts=yes ;;
95182007Srobertoesac
96182007Srobertocase "${enable_libopts_install+set}" in
97182007Sroberto set) ;;
98182007Sroberto *) enable_libopts_install=no ;;
99182007Srobertoesac
100285612Sdelphijenable_nls=no
101182007SrobertoLIBOPTS_CHECK
102182007Sroberto
103285612Sdelphij# From when we only used libevent for sntp:
104285612Sdelphij#AM_COND_IF(
105285612Sdelphij#    [BUILD_SNTP],
106285612Sdelphij#    [NTP_LIBEVENT_CHECK],
107285612Sdelphij#    [NTP_LIBEVENT_CHECK_NOBUILD]
108285612Sdelphij#)
109182007Sroberto
110285612SdelphijNTP_LIBEVENT_CHECK([2])
111182007Sroberto
112285612Sdelphij# Checks for libraries.
113200576Sroberto
114285612Sdelphijdnl NTP_LIBNTP checks for inet_XtoY
115285612Sdelphijdnl AC_SEARCH_LIBS([inet_pton], [nsl])
116200576Sroberto
117285612Sdelphijdnl AC_SEARCH_LIBS([openlog], [gen syslog])
118285612SdelphijLIB_SYSLOG=''
119285612SdelphijAC_SUBST([LIB_SYSLOG])
120285612SdelphijHMS_SEARCH_LIBS([LIB_SYSLOG], [openlog], [gen syslog])
121200576Sroberto
122132451Sroberto# Checks for header files.
123285612SdelphijAC_CHECK_HEADERS([netdb.h string.h strings.h syslog.h])
124285612SdelphijNTP_SYSEXITS_H
125285612SdelphijNTP_FACILITYNAMES
126132451Sroberto
127132451Sroberto# Checks for typedefs, structures, and compiler characteristics.
128285612SdelphijAC_HEADER_STDBOOL
129132451Sroberto
130285612SdelphijNTP_OPENSSL
131285612SdelphijNTP_IPV6
132132451Sroberto
133285612Sdelphij###
134132451Sroberto
135285612Sdelphij# Hacks
136285612Sdelphij# these need work if we're to move libntp under sntp
137285612SdelphijAC_DEFINE([HAVE_NO_NICE], 1, [sntp does not care about 'nice'])
138285612SdelphijAC_DEFINE([HAVE_TERMIOS], 1, [sntp does not care about TTY stuff])
139132451Sroberto
140132451Sroberto# Checks for library functions.
141285612SdelphijAC_CHECK_FUNCS([socket])
142132451Sroberto
143285612SdelphijNTP_UNITYBUILD
144316069Sdelphij## HMS: if we don't find c++ we should not look for gtest.
145316069Sdelphij#AC_PROG_CXX
146316069Sdelphij#NTP_GOOGLETEST
147132451Sroberto
148301256SdelphijSNTP_PROBLEM_TESTS
149301256Sdelphij
150285612Sdelphij# All libraries should be in various LIB_* variables now. 
151285612Sdelphij#LIBS=
152285612Sdelphij# Sadly not.  There is a gettext() check somewhere, and on Solaris this pulls
153285612Sdelphij# in -lintl -lgen, outside our "scope".
154182007Sroberto
155285612SdelphijAC_CONFIG_FILES([Makefile])
156285612SdelphijAC_CONFIG_FILES([include/Makefile])
157285612SdelphijAC_CONFIG_FILES([scripts/Makefile])
158285612SdelphijAC_CONFIG_FILES([tests/Makefile])
159285612SdelphijAC_CONFIG_FILES([tests/fileHandlingTest.h])
160285612SdelphijAC_CONFIG_FILES([unity/Makefile])
161182007Sroberto
162132451SrobertoAC_OUTPUT
163