sntp/tests. withsntp=no in the environment changes the default.
Build infrastructure cleanup:
Move m4 directory to sntp/m4.
Share a single set of genver output between sntp and the top level.
Share a single set of autogen included .defs in sntp/include.
Share a single set of build-aux scripts (e.g. config.guess, missing).
Add ntp_libntp.m4 and ntp_ipv6.m4 to reduce configure.ac duplication.
Warn and exit build/flock-build if bootstrap needs to be run.
bk: 4d2d3ae5qHgCJgo6Em6MNVzUt-4eIg
+* Add configure --without-sntp option to disable building sntp and
+ sntp/tests. withsntp=no in the environment changes the default.
+* Build infrastructure cleanup:
+ Move m4 directory to sntp/m4.
+ Share a single set of genver output between sntp and the top level.
+ Share a single set of autogen included .defs in sntp/include.
+ Share a single set of build-aux scripts (e.g. config.guess, missing).
+ Add ntp_libntp.m4 and ntp_ipv6.m4 to reduce configure.ac duplication.
+ Warn and exit build/flock-build if bootstrap needs to be run.
(4.2.7p116) 2011/01/10 Released by Harlan Stenn <stenn@ntp.org>
* refclock_nmea.c refactoring by Juergen Perlinger.
(4.2.7p115) 2011/01/09 Released by Harlan Stenn <stenn@ntp.org>
## LIBOPTS_CHECK_NOBUILD works with Automake 1.10 now
AUTOMAKE_OPTIONS = foreign 1.10
-ACLOCAL_AMFLAGS = -I m4 -I sntp/libopts/m4
+ACLOCAL_AMFLAGS = -I sntp/m4 -I sntp/libopts/m4
NULL =
tests \
$(NULL)
-DISTCHECK_CONFIGURE_FLAGS = -C
+DISTCHECK_CONFIGURE_FLAGS = -C --with-sntp
EXTRA_DIST = \
$(srcdir)/COPYRIGHT \
WHERE-TO-START \
bootstrap \
build \
- config.guess \
config.h.in \
- config.sub \
dot.emacs \
- excludes \
flock-build \
- install-sh \
packageinfo.sh \
readme.y2kfixes \
results.y2kfixes \
bincheck.mf \
depsver.mf \
deps-ver \
- $(srcdir)/version \
- version.m4 \
\
$(NULL)
BUILT_SOURCES = \
.gcc-warning \
libtool \
+ sntp/built-sources-only \
$(srcdir)/COPYRIGHT \
- $(srcdir)/version \
- $(srcdir)/version.m4 \
- $(srcdir)/include/version.def \
- $(srcdir)/include/version.texi \
$(srcdir)/.checkChangeLog \
$(NULL)
Rather than determine our $(srcdir) from sntp/Makefile.am \
COPYRIGHT-please serves as a fixed target.
-# HMS: The next bit is still suboptimal. If bk is present but this NTP
-# repo is not a bk repo, we'll get an error message from the prs command.
-# Unfortunately, I haven't found the necessary magic to redirect this error
-# output to /dev/null under ancient/unique shells like the one Ultrix uses.
-# We'll also get an error if srcdir or version is unwritable.
-$(srcdir)/version: FRC.version
- -(bk version) >/dev/null 2>&1 && \
- cd $(srcdir) && \
- x=`bk -R prs -hr+ -nd:I: ChangeSet` && \
- y=`cat version 2>/dev/null` || true && \
- case "$$x" in ''|$$y) ;; *) echo $$x > version ;; esac
-
-$(srcdir)/version.m4: $(srcdir)/packageinfo.sh
- TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
- ./scripts/genver version.m4
-
-$(srcdir)/include/version.def: $(srcdir)/packageinfo.sh
- TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
- ./scripts/genver include/version.def
-
-$(srcdir)/include/version.texi: $(srcdir)/packageinfo.sh
- TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
- ./scripts/genver include/version.texi
-
$(srcdir)/.checkChangeLog: $(srcdir)/ChangeLog $(srcdir)/scripts/checkChangeLog
cd $(srcdir) && \
./scripts/checkChangeLog
-libtool: $(LIBTOOL_DEPS)
- ./config.status --recheck
+sntp/built-sources-only: FRC.sntp
+ @cd sntp && $(MAKE) built-sources-only
dist-hook:
@find $(distdir) -type d -name SCCS -print | xargs rm -rf
-a SCCS/s.ChangeSet -ot CommitLog \
|| scripts/genCommitLog
+libtool: $(LIBTOOL_DEPS)
+ ./config.status --recheck
+
# HMS: The following seems to be a work-in-progress...
-CVO=`$(srcdir)/config.guess`
+CVO=`$(srcdir)/sntp/build-aux/config.guess`
.buildcvo:
echo "$(CVO)" > .buildcvo
echo " "; \
fi
-FRC.CommitLog FRC.distwarn FRC.checkcvo FRC.checkhost FRC.version:
+FRC.CommitLog FRC.distwarn FRC.checkcvo FRC.checkhost FRC.sntp:
@: do-nothing action prevents any default
# HMS: what was I trying to do with this?
BUILT_SOURCES=
CLEANFILES=
EXTRA_PROGRAMS= adjtimed
-AM_CPPFLAGS= -I$(top_srcdir)/include
+
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
+
LDADD= ../libntp/libntp.a
ETAGS_ARGS= Makefile.am
set -e
-scripts/genver || { echo scripts/genver failed ; exit 1; }
+(cd sntp && ../scripts/genver) || { echo scripts/genver failed ; exit 1; }
# autoreconf says:
# The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
AUTORECONF=${AUTORECONF:-autoreconf}
-case `hostname` in
- pogo.udel.edu)
- if fgrep -q 4.2.4 version.m4; then
- AUTOCONF=autoconf-2.59
- AUTOHEADER=autoheader-2.59
- AUTOMAKE=automake-1.9
- ACLOCAL=aclocal-1.9
- export AUTOCONF AUTOHEADER AUTOMAKE ACLOCAL
- fi
- ;;
-esac
+# case `hostname` in
+# pogo.udel.edu)
+# if fgrep -q 4.2.4 sntp/m4/version.m4; then
+# AUTOCONF=autoconf-2.59
+# AUTOHEADER=autoheader-2.59
+# AUTOMAKE=automake-1.9
+# ACLOCAL=aclocal-1.9
+# export AUTOCONF AUTOHEADER AUTOMAKE ACLOCAL
+# fi
+# ;;
+# esac
# 20060629: HMS: Let's try checking in libopts and the autogen-generated files
## The copy for ntp...
## Non-AutoGen stuff
-for i in autogen-version.def version.def version.texi
-do
- cmp -s include/$i sntp/$i || cp -fp include/$i sntp/$i
-done
-
# touch the stuff generated by the opt files
for f in ${prog_opt_files}
#set -e
#set -x
+if [ ! -r sntp/build-aux/config.guess ] ; then
+ echo "Error: bootstrap required." 1>&2 && exit 1
+fi
+
# scripts/cvo.sh invokes config.guess, and we want it to use the copy
-# in the top directory (alongside build) if there's not another
-# config.guess earlier on the path, so we invoke it using env to append
-# . to the PATH.
+# in the build-aux directory if there's not another config.guess earlier
+# on the path, so we invoke it using env to append to the PATH.
-CVO=`env PATH="$PATH:." scripts/cvo.sh @cvo@`
+CVO=`env PATH="$PATH:./sntp/build-aux" scripts/cvo.sh @cvo@`
case "$CVO" in
*-*-*-*) echo "scripts/cvo.sh returned <$CVO>, which makes no sense to me."
exit 1
clktest_SOURCES = clktest.c clktest-opts.c clktest-opts.h
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
-INCLUDES += -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
LDADD = ../libntp/libntp.a
propdelay_LDADD = $(LIBM) $(LDADD)
run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \
- autogen -L ../include --writable
-std_def_list= $(top_srcdir)/include/debug-opt.def \
- $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/homerc.def \
- $(top_srcdir)/include/version.def
+ autogen -L ../sntp/include --writable
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
$(srcdir)/clktest-opts.h: $(srcdir)/clktest-opts.c
@: do-nothing action to avoid default SCCS get, .h built with .c
dnl -*-fundamental-*-
dnl Process this file with autoconf to produce a configure script.
-m4_include([version.m4])
+m4_include([sntp/m4/version.m4])
AC_PREREQ([2.61])
AC_INIT([ntp], [VERSION_NUMBER])
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_AUX_DIR([.])
+AC_CONFIG_MACRO_DIR([sntp/m4])
+AC_CONFIG_AUX_DIR([sntp/build-aux])
# Bump ntp_configure_cache_version for each change to configure.ac or
# .m4 files which invalidates cached values from previous configure
ntp_ripe_ncc_ok=${ntp_parse_ok=no}
ntp_jupiter_ok=${ntp_jupiter_ok=no}
-dnl check these early to avoid autoconf warnings
-AC_AIX
-AC_MINIX
+dnl must come before AC_PROG_CC or similar
+AC_USE_SYSTEM_EXTENSIONS
dnl we need to check for cross compile tools for vxWorks here
AC_PROG_CC
AC_PROG_CXX
AC_PROG_YACC
-# AC_PROG_CC_STDC has two functions. It attempts to find a compiler
-# capable of C99, or failing that, for C89. CC is set afterward with
-# the selected invocation, such as "gcc --std=gnu99". Also, the
-# ac_cv_prog_cc_stdc variable is no if the compiler selected for CC
-# does not accept C89.
-
-AC_PROG_CC_STDC
-
-case "$ac_cv_prog_cc_stdc" in
- no)
- AC_MSG_WARN([ANSI C89/ISO C90 is the minimum to compile NTP ]
- [version 4.2.5 and higher.])
- ;;
-esac
-
-# HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
-case "$host" in
- *-pc-cygwin*)
- CFLAGS="$CFLAGS -DSYS_CYGWIN32"
- ;;
- i386-sequent-sysv4)
- case "$CC" in
- cc)
- CFLAGS="$CFLAGS -Wc,+abi-socket"
- ;;
- esac
- ;;
- *-*-mpeix*)
- CPPFLAGS="$CPPFLAGS -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB"
- LDFLAGS="$LDFLAGS -L/SYSLOG/PUB"
- LIBS="$LIBS -lcurses"
- ;;
- *-*-solaris*)
- # see "man standards".
- # -D_XOPEN_SOURCE=500 is probably OK for c89 and before
- # -D_XOPEN_SOURCE=600 seems OK for c99
- #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
- CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
- ;;
-esac
-
-NTP_OS_CFLAGS
-NTP_DIR_SEP
+NTP_LIBNTP
NTP_VPATH_HACK
+# So far, the only shared library we might use is libopts.
+# It's a small library - we might as well use a static version of it.
+AC_DISABLE_SHARED
+LT_INIT
+AC_SUBST([LIBTOOL_DEPS])
+
# NTP has (so far) been relying on leading-edge autogen.
# Therefore, by default:
# - use the version we ship with
AC_FUNC_FORK
AC_FUNC_ALLOCA
-AC_CACHE_CHECK(
- [if $CC can handle @%:@warning],
- [ntp_cv_cpp_warning],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]], [[#warning foo]])],
- [ntp_cv_cpp_warning=yes],
- [ntp_cv_cpp_warning=no]
- )]
-)
-case "$ntp_cv_cpp_warning" in
- no)
- AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1],
- [Should we avoid @%:@warning on option name collisions?])
-esac
-
-case "$GCC" in
- yes)
- SAVED_CFLAGS_NTP="$CFLAGS"
- CFLAGS="$CFLAGS -Wstrict-overflow"
- AC_CACHE_CHECK(
- [if $CC can handle -Wstrict-overflow],
- [ntp_cv_gcc_Wstrict_overflow],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]], [[]])],
- [ntp_cv_gcc_Wstrict_overflow=yes],
- [ntp_cv_gcc_Wstrict_overflow=no]
- ) ]
- )
- #
- # $ntp_cv_gcc_Wstrict_overflow is tested later to add the
- # flag to CFLAGS.
- #
- CFLAGS="$SAVED_CFLAGS_NTP -Winit-self"
- AC_CACHE_CHECK(
- [if $CC can handle -Winit-self],
- [ntp_cv_gcc_Winit_self],
- [
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]], [[]])],
- [ntp_cv_gcc_Winit_self=yes],
- [ntp_cv_gcc_Winit_self=no]
- )
- ]
- )
- CFLAGS="$SAVED_CFLAGS_NTP"
- AS_UNSET([SAVED_CFLAGS_NTP])
- #
- # $ntp_cv_gcc_Winit_self is tested later to add the
- # flag to CFLAGS.
- #
- ;;
-esac
-
-# Expose a cross-compilation indicator to makefiles
-AM_CONDITIONAL([NTP_CROSSCOMPILE], [test $build != $host])
-
-AC_MSG_CHECKING([for bin subdirectory])
-AC_ARG_WITH(
- [binsubdir],
- [AS_HELP_STRING(
- [--with-binsubdir],
- [bin ={bin,sbin}]
- )],
- [use_binsubdir="$withval"],
- [use_binsubdir="bin"]
-)
-case "$use_binsubdir" in
- bin)
- ;;
- sbin)
- ;;
- *)
- AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
- ;;
-esac
-AC_MSG_RESULT([$use_binsubdir])
-
-BINSUBDIR=$use_binsubdir
-AC_SUBST([BINSUBDIR])
-AM_CONDITIONAL([NTP_BINSUBDIR_IS_BIN], [test "bin" = "$BINSUBDIR"])
-
AC_MSG_CHECKING([for deprecated --with-arlib])
AC_ARG_WITH([arlib],
AS_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
rm -f conftest*
-case "$GCC" in
- yes)
- CFLAGS="$CFLAGS -Wall"
- # CFLAGS="$CFLAGS -Wcast-align"
- CFLAGS="$CFLAGS -Wcast-qual"
- # CFLAGS="$CFLAGS -Wconversion"
- # CFLAGS="$CFLAGS -Werror"
- # CFLAGS="$CFLAGS -Wextra"
- # CFLAGS="$CFLAGS -Wfloat-equal"
- CFLAGS="$CFLAGS -Wmissing-prototypes"
- CFLAGS="$CFLAGS -Wpointer-arith"
- CFLAGS="$CFLAGS -Wshadow"
- # CFLAGS="$CFLAGS -Wtraditional"
- # CFLAGS="$CFLAGS -Wwrite-strings"
- case "$ntp_cv_gcc_Winit_self" in
- yes)
- CFLAGS="$CFLAGS -Winit-self"
- ;;
- esac
- case "$ntp_cv_gcc_Wstrict_overflow" in
- yes)
- CFLAGS="$CFLAGS -Wstrict-overflow"
- ;;
- esac
- # -W[no-]strict-prototypes is added later depending on OpenSSL
- ;;
-esac
-
-ac_busted_vpath_in_make=no
-
-case "$build" in
- *-*-irix6.1*) # 64 bit only
- # busted vpath?
- ;;
- *-*-irix6*) # 6.2 (and later?)
- ac_busted_vpath_in_make=yes
- ;;
- *-*-solaris2.5.1)
- ac_busted_vpath_in_make=yes
- ;;
- *-*-unicosmp*)
- ac_busted_vpath_in_make=yes
- ;;
-esac
-
-case "$ac_busted_vpath_in_make$srcdir" in
- no*) ;;
- yes.) ;;
- *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | grep 'GNU Make'`" in
- '')
- AC_MSG_ERROR([building outside of the main directory requires GNU make])
- ;;
- esac
- ;;
-esac
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
-# So far, the only shared library we might use is libopts.
-# It's a small library - we might as well use a static version of it.
-AC_DISABLE_SHARED
-AC_PROG_LIBTOOL
-
AC_PROG_LN_S
AC_PROG_GCC_TRADITIONAL
AC_C_VOLATILE
# Checks for libraries.
NTP_LINEEDITLIBS
-NTP_LIB_M
-
-# [Bug 1628] On Solaris, we need -lxnet -lsocket. Generalize this to
-# avoid keying on the OS name: If we find socket functions in
-# libsocket, next try for them in libxnet without libsocket, if found,
-# list both. If we simply tested libxnet first, we would find the
-# functions there and never add libsocket. See also [Bug 660]
-# http://bugs.ntp.org/show_bug.cgi?id=660#c9
-saved_LIBS=$LIBS
-AC_SEARCH_LIBS([setsockopt], [socket])
-case "$ac_cv_search_setsockopt" in
- -lsocket)
- LIBS="$saved_LIBS"
- AC_SEARCH_LIBS([getsockopt], [xnet])
- case "$ac_cv_search_getsockopt" in
- -lxnet)
- LIBS="-lxnet -lsocket $saved_LIBS"
- ;;
- *) LIBS="-lsocket $saved_LIBS"
- ;;
- esac
- ;;
-esac
-AS_UNSET([saved_LIBS])
AC_SEARCH_LIBS([inet_pton], [nsl])
AC_SEARCH_LIBS([openlog], [gen syslog])
esac
AC_CHECK_HEADERS([arpa/nameser.h])
-AC_CHECK_HEADERS([sys/socket.h])
-
-
-dnl HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4
-dnl due to an incomplete type (a union) mpinfou used in an array. gcc3
-dnl compiles it without complaint. The mpinfou union is defined later
-dnl in the resulting preprocessed source than the spu_info array in
-dnl /usr/include/machine/sys/getppdp.h:
-dnl extern union mpinfou spu_info[];
-dnl triggering the error. Our strategy is on HP-UX only, test compile
-dnl net/if.h. If that fails, try adding a duplicate definition of
-dnl mpinfou, and if that helps add it to confdefs.h (used for further
-dnl configure tests) and config.h.
-#
-AC_CHECK_HEADERS([net/if.h], [], [], [
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
-])
-case "$host" in
- *-hp-hpux*)
- AC_CACHE_CHECK(
- [if net/if.h requires mpinfou predeclaration],
- [ntp_cv_predecl_mpinfou],
- [
- np_cv_predecl_mpinfou=no
- case "$ac_cv_header_net_if_h" in
- no)
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- typedef union mpinfou {
- struct pdk_mpinfo *pdkptr;
- struct mpinfo *pikptr;
- } mpinfou_t;
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #include <net/if.h>
- ]],
- [[
- ]]
- )],
- [
- ntp_cv_predecl_mpinfou=yes
- ac_cv_header_net_if_h=yes
- ]
- )
- esac
- ]
- )
- case "$ntp_cv_predecl_mpinfou" in
- yes)
- cat >>confdefs.h <<_ACEOF
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
- struct pdk_mpinfo *pdkptr;
- struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-_ACEOF
- AH_BOTTOM([
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
- struct pdk_mpinfo *pdkptr;
- struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-])
- esac
-esac
AC_CHECK_HEADERS([net/if6.h])
AC_CHECK_HEADERS([net/route.h], [], [], [
[Does a system header define struct ppsclockev?])
esac
-AC_CACHE_CHECK(
- [for struct sockaddr_storage],
- [ntp_cv_sockaddr_storage],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage n;
- ]]
- )],
- [ntp_cv_sockaddr_storage=yes],
- [ntp_cv_sockaddr_storage=no]
- )]
-)
-case "$ntp_cv_sockaddr_storage" in
- yes)
- AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
- [Does a system header define struct sockaddr_storage?])
-esac
-
-AC_CACHE_CHECK(
- [for sockaddr_storage.ss_family],
- [ntp_cv_have_ss_family],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.ss_family = 1;
- ]]
- )],
- [ntp_cv_have_ss_family=yes],
- [ntp_cv_have_ss_family=no]
- )]
-)
-
-case "$ntp_cv_have_ss_family" in
- no)
- AC_CACHE_CHECK(
- [for sockaddr_storage.__ss_family],
- [ntp_cv_have___ss_family],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.__ss_family = 1;
- ]]
- )],
- [ntp_cv_have___ss_family=yes],
- [ntp_cv_have___ss_family=no]
- )]
- )
- case "$ntp_cv_have___ss_family" in
- yes)
- AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
- [Does struct sockaddr_storage have __ss_family?])
- esac
- ;;
-esac
-
-AH_VERBATIM(
- [HAVE___SS_FAMILY_IN_SS_VERBATIM],
- [
- /* Handle sockaddr_storage.__ss_family */
- #ifdef HAVE___SS_FAMILY_IN_SS
- # define ss_family __ss_family
- #endif /* HAVE___SS_FAMILY_IN_SS */
- ]
-)
-
-AC_CACHE_CHECK(
- [for sockaddr_storage.ss_len],
- [ntp_cv_have_ss_len],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.ss_len = 1;
- ]]
- )],
- [ntp_cv_have_ss_len=yes],
- [ntp_cv_have_ss_len=no]
- )]
-)
-
-case "$ntp_cv_have_ss_len" in
- no)
- AC_CACHE_CHECK(
- [for sockaddr_storage.__ss_len],
- [ntp_cv_have___ss_len],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.__ss_len = 1;
- ]]
- )],
- [ntp_cv_have___ss_len=yes],
- [ntp_cv_have___ss_len=no]
- )]
- )
- case "$ntp_cv_have___ss_len" in
- yes)
- AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
- [Does struct sockaddr_storage have __ss_len?])
- esac
- ;;
-esac
-
-AH_VERBATIM(
- [HAVE___SS_LEN_IN_SS_VERBATIM],
- [
- /* Handle sockaddr_storage.__ss_len */
- #ifdef HAVE___SS_LEN_IN_SS
- # define ss_len __ss_len
- #endif /* HAVE___SS_LEN_IN_SS */
- ]
-)
-
-#
-# Look for in_port_t.
-#
-AC_CACHE_CHECK(
- [for in_port_t],
- [isc_cv_have_in_port_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <netinet/in.h>
- ]],
- [[
- in_port_t port = 25;
- return (0);
- ]]
- )],
- [isc_cv_have_in_port_t=yes],
- [isc_cv_have_in_port_t=no]
- )]
-)
-case "$isc_cv_have_in_port_t" in
- no)
- AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
- [Declare in_port_t?])
-esac
-
case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
*yes*)
AC_CACHE_CHECK(
;;
esac
-AC_CACHE_CHECK(
- [type of socklen arg for getsockname()],
- [ntp_cv_getsockname_socklen_type],
- [
- getsockname_socklen_type_found=no
- for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
- for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- ]], [[
- extern
- getsockname(int, $getsockname_arg2,
- $ntp_cv_getsockname_socklen_type *);
- ]]
- )],
- [getsockname_socklen_type_found=yes ; break 2],
- []
- )
- done
- done
- case "$getsockname_socklen_type_found" in
- no)
- ntp_cv_getsockname_socklen_type='socklen_t'
- esac
- AS_UNSET([getsockname_arg2])
- AS_UNSET([getsockname_socklen_type_found])
- ]
-)
-AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
- [$ntp_cv_getsockname_socklen_type],
- [What is getsockname()'s socklen type?])
-
AC_CHECK_FUNCS([getuid getrusage hstrerror])
AC_CHECK_FUNC([gettimeofday], [], [
case "$host" in
[Are Solaris privileges available?])
esac
-AC_CACHE_CHECK(
- [struct sockaddr for sa_len],
- [isc_cv_platform_havesalen],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- ]],
- [[
- extern struct sockaddr *ps;
- return ps->sa_len;
- ]]
- )],
- [isc_cv_platform_havesalen=yes],
- [isc_cv_platform_havesalen=no]
- )]
-)
-case "$isc_cv_platform_havesalen" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
- [struct sockaddr has sa_len?])
-esac
-
-AC_ARG_ENABLE(
- [ipv6],
- [AS_HELP_STRING(
- [--enable-ipv6],
- [s use IPv6?]
- )]
-)
-
-case "$enable_ipv6" in
- yes|''|autodetect)
- case "$host" in
- powerpc-ibm-aix4*)
- ;;
- *)
- AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
- ;;
- esac
- ;;
- no)
- ;;
-esac
-
+NTP_IPV6
-AC_CACHE_CHECK(
- [for IPv6 structures],
- [isc_cv_found_ipv6],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- ]],
- [[
- struct sockaddr_in6 sin6;
- ]]
- )],
- [isc_cv_found_ipv6=yes],
- [isc_cv_found_ipv6=no]
- )]
-)
-
-#
-# See whether IPv6 support is provided via a Kame add-on.
-# This is done before other IPv6 linking tests so LIBS is properly set.
-#
-AC_MSG_CHECKING([for Kame IPv6 support])
-AC_ARG_WITH(
- [kame],
- [AS_HELP_STRING(
- [--with-kame],
- [- =/usr/local/v6]
- )],
- [use_kame="$withval"],
- [use_kame="no"]
-)
-case "$use_kame" in
- no)
- ;;
- yes)
- kame_path=/usr/local/v6
- ;;
- *)
- kame_path="$use_kame"
- ;;
-esac
-case "$use_kame" in
- no)
- AC_MSG_RESULT([no])
- ;;
- *)
- if test -f $kame_path/lib/libinet6.a; then
- AC_MSG_RESULT([$kame_path/lib/libinet6.a])
- LIBS="-L$kame_path/lib -linet6 $LIBS"
- else
- AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
-
-Please choose the proper path with the following command:
-
- configure --with-kame=PATH
-])
- fi
- ;;
-esac
-
-#
-# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
-# Including it on Kame-using platforms is very bad, though, because
-# Kame uses #error against direct inclusion. So include it on only
-# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
-# This is done before the in6_pktinfo check because that's what
-# netinet6/in6.h is needed for.
-#
-case "$host" in
- *-bsdi4.[[01]]*)
- AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
- [Do we need netinet6/in6.h?])
- isc_netinet6in6_hack="#include <netinet6/in6.h>"
- ;;
- *)
- isc_netinet6in6_hack=""
- ;;
-esac
-
-#
-# This is similar to the netinet6/in6.h issue.
-#
-case "$host" in
- *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
- AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
- [Do we need to fix in6isaddr?])
- isc_netinetin6_hack="#include <netinet/in6.h>"
- ;;
- *)
- isc_netinetin6_hack=""
- ;;
-esac
-
-
-case "$isc_cv_found_ipv6" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
- AC_CACHE_CHECK(
- [for in6_pktinfo],
- [isc_cv_have_in6_pktinfo],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- $isc_netinetin6_hack
- $isc_netinet6in6_hack
- ]],
- [[
- struct in6_pktinfo xyzzy;
- ]]
- )],
- [isc_cv_have_in6_pktinfo=yes],
- [isc_cv_have_in6_pktinfo=no]
- )]
- )
- case "$isc_cv_have_in6_pktinfo" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
- [have struct in6_pktinfo?])
- esac
-
-
- # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
- AC_CACHE_CHECK(
- [for sockaddr_in6.sin6_scope_id],
- [isc_cv_have_sin6_scope_id],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- $isc_netinetin6_hack
- $isc_netinet6in6_hack
- ]],
- [[
- struct sockaddr_in6 xyzzy;
- xyzzy.sin6_scope_id = 0;
- ]]
- )],
- [isc_cv_have_sin6_scope_id=yes],
- [isc_cv_have_sin6_scope_id=no]
- )]
- )
-
- case "$isc_cv_have_sin6_scope_id" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
- esac
- ;;
-esac
-
-
-# We need this check run even without isc_cv_found_ipv6=yes
-
-AC_CACHE_CHECK(
- [for in6addr_any],
- [isc_cv_have_in6addr_any],
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- $isc_netinetin6_hack
- $isc_netinet6in6_hack
- ]],
- [[
- struct in6_addr in6;
- in6 = in6addr_any;
- ]]
- )],
- [isc_cv_have_in6addr_any=yes],
- [isc_cv_have_in6addr_any=no]
- )]
-)
-
-case "$isc_cv_have_in6addr_any" in
- no)
- AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
-esac
-
-
-AC_CACHE_CHECK(
- [for struct if_laddrconf],
- [isc_cv_struct_if_laddrconf],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <net/if6.h>
- ]],
- [[
- struct if_laddrconf a;
- ]]
- )],
- [isc_cv_struct_if_laddrconf=yes],
- [isc_cv_struct_if_laddrconf=no]
- )]
-)
-
-case "$isc_cv_struct_if_laddrconf" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
- [have struct if_laddrconf?])
-esac
-
-AC_CACHE_CHECK(
- [for struct if_laddrreq],
- [isc_cv_struct_if_laddrreq],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <net/if6.h>
- ]],
- [[
- struct if_laddrreq a;
- ]]
- )],
- [isc_cv_struct_if_laddrreq=yes],
- [isc_cv_struct_if_laddrreq=no]
- )]
-)
-
-case "$isc_cv_struct_if_laddrreq" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
- [have struct if_laddrreq?])
-esac
#
# Look for a sysctl call to get the list of network interfaces.
+++ /dev/null
-*.obj *.pch *.bsc *.pdb *.sbr nt*.zip *.tar *.gz *.ilk beta*.zip
# * pogo sparc-sun-solaris2.10
# * rackety freebsd-6.1
+if [ ! -r sntp/build-aux/config.guess ] ; then
+ echo "Error: bootstrap required." 1>&2 && exit 1
+fi
+
# HMS: we need $PWD because solaris produces /deacon/backroom when
# we are in /backroom and in general there is no /deacon/backroom.
c_d=${PWD:-`pwd`}
SIG=`perl -e 'print rand'`
case "$LIST" in
- '') LIST="malarky rackety" ;;
+ '') LIST="pogo" ;;
esac
for i in $LIST
NULL =
AUTOMAKE_OPTIONS =
ETAGS_ARGS = $(srcdir)/Makefile.am
-EXTRA_DIST = autogen-version.def copyright.def debug-opt.def homerc.def version.def version.texi
SUBDIRS = isc
*/
#include <ntp_types.h>
+#include <ntp_malloc.h> /* for ZERO() */
/*
* Sizes of things
*/
#define LIB_GETBUF(bufp) \
do { \
- if (!lib_inited) \
- init_lib(); \
ZERO(lib_stringbuf[lib_nextbuf]); \
(bufp) = &lib_stringbuf[lib_nextbuf++][0]; \
lib_nextbuf %= COUNTOF(lib_stringbuf); \
__attribute__((__format__(__printf__, 3, 4)));
extern void msyslog(int, const char *, ...)
__attribute__((__format__(__printf__, 2, 3)));
+#ifndef errno_to_str
+extern void errno_to_str(int, char *, size_t);
+#endif
/*
* When building without OpenSSL, use a few macros of theirs to
-#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
AUTOMAKE_OPTIONS =
SUBDIRS = sys
ETAGS_ARGS = Makefile.am
-#AUTOMAKE_OPTIONS = ../../util/ansi2knr no-dependencies
AUTOMAKE_OPTIONS =
noinst_HEADERS = bsd_audioirig.h chudefs.h clkdefs.h i8253.h parsestreams.h \
pcl720.h ppsclock.h timex.h tpro.h tt560_api.h
NULL=
-#AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies
AUTOMAKE_OPTIONS =
BUILT_SOURCES =
CLEANFILES =
libntpsim_a_SOURCES = systime_s.c $(libntp_a_SRCS)
EXTRA_libntp_a_SOURCES = adjtimex.c
ETAGS_ARGS = Makefile.am
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
+
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
EXTRA_DIST = README
int lib_nextbuf;
int ipv4_works;
int ipv6_works;
-int lib_inited = 0;
+int lib_inited;
/*
* initialization routine. Might be needed if the code is ROMized.
void
init_lib(void)
{
- lib_nextbuf = 0;
ipv4_works = (ISC_R_SUCCESS == isc_net_probeipv4());
ipv6_works = (ISC_R_SUCCESS == isc_net_probeipv6());
- lib_inited = 1;
+ lib_inited = TRUE;
}
/*
+ * errno_to_str() - a thread-safe strerror() replacement.
+ * Hides the varied signatures of strerror_r().
+ * For Windows, we have:
+ * #define errno_to_str isc_strerror
+ */
+#ifndef errno_to_str
+void
+errno_to_str(
+ int err,
+ char * buf,
+ size_t bufsiz
+ )
+{
+# if defined(STRERROR_R_CHAR_P) || !defined(HAVE_DECL_STRERROR_R)
+ char * pstatic;
+
+# ifdef STRERROR_R_CHAR_P
+ /*
+ * For older GNU strerror_r, the return value either points to
+ * buf, or to static storage. We want the result always in buf
+ */
+ pstatic = strerror_r(err, buf, bufsiz);
+# else
+ pstatic = strerror(err);
+# endif
+ if (pstatic != buf)
+ strncpy(buf, pstatic, bufsiz);
+# else
+ int rc;
+
+ rc = strerror_r(err, buf, bufsiz);
+ if (rc < 0)
+ snprintf(buf, bufsiz, "strerror_r(%d): errno %d",
+ err, errno);
+# endif
+}
+#endif /* errno_to_str */
+
+
+/*
+ * addto_syslog()
* This routine adds the contents of a buffer to the syslog or an
* application-specific logfile.
*/
int errval
)
{
+ char errmsg[256];
char c;
char *n;
const char *f;
size_t len;
- char *err;
n = nfmt;
f = fmt;
*n++ = c;
continue;
}
- err = strerror(errval);
- len = strlen(err);
+ errno_to_str(errval, errmsg, sizeof(errmsg));
+ len = strlen(errmsg);
/* Make sure we have enough space for the error message */
if ((n + len) < (nfmt + lennfmt - 1)) {
- memcpy(n, err, len);
+ memcpy(n, errmsg, len);
n += len;
}
}
kgpstolfp.o \
$(NULL)
-
-INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include -I$(top_srcdir)/kernel
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += -I$(top_srcdir)/kernel
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
ETAGS_ARGS = Makefile.am
noinst_LIBRARIES= libntpd.a
-AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
# LDADD might need RESLIB and ADJLIB.
LDADD= version.o libntpd.a @LIBPARSE@
EXTRA_PROGRAMS = check_y2k ntpdsim keyword-gen
noinst_DATA = $(srcdir)/ntpd-opts.texi $(srcdir)/ntpd-opts.menu
run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \
- autogen -L ../include --writable
-std_def_list= $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/version.def
+ autogen -L ../sntp/include --writable
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
check-local: @MAKE_CHECK_Y2K@ $(CHECK_SAVECONFIG)
test -z "@MAKE_CHECK_Y2K@" || ./@MAKE_CHECK_Y2K@
../libparse/libparse.a:
cd ../libparse && $(MAKE) libparse.a
-$(top_srcdir)/version:
- cd $(top_srcdir) && $(MAKE) version
+$(top_srcdir)/sntp/version:
+ cd $(top_srcdir)/sntp && $(MAKE) version
-version.o: $(ntpd_OBJECTS) ../libntp/libntp.a @LIBPARSE@ Makefile $(top_srcdir)/version
- env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpd
+version.o: $(ntpd_OBJECTS) ../libntp/libntp.a @LIBPARSE@ Makefile $(top_srcdir)/sntp/version
+ env CSET=`cat $(top_srcdir)/sntp/version` $(top_builddir)/scripts/mkver ntpd
$(COMPILE) -c version.c
include $(top_srcdir)/bincheck.mf
ntptimeset_SOURCES= ntptimeset.c ntptime_config.c
-AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
# LDADD might need RESLIB and ADJLIB
LDADD= version.o ../libntp/libntp.a
-ntpdate_LDADD= $(LDADD) $(LIBM) @LCRYPTO@
+ntpdate_LDADD= $(LDADD) $(LIBOPTS_LDADD) $(LIBM) @LCRYPTO@
DISTCLEANFILES= .version version.c stamp-v
noinst_HEADERS= ntpdate.h
ETAGS_ARGS= Makefile.am
../libntp/libntp.a:
cd ../libntp && $(MAKE)
-$(top_srcdir)/version :
- cd $(top_srcdir) && $(MAKE) version
+$(top_srcdir)/sntp/version:
+ cd $(top_srcdir)/sntp && $(MAKE) version
-version.o: $(ntpdate_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
- env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdate
+version.o: $(ntpdate_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/version
+ env CSET=`cat $(top_srcdir)/sntp/version` $(top_builddir)/scripts/mkver ntpdate
$(COMPILE) -c version.c
include $(top_srcdir)/bincheck.mf
NULL=
-AUTOMAKE_OPTIONS=
+AUTOMAKE_OPTIONS=
if NTP_BINSUBDIR_IS_BIN
bin_PROGRAMS= ntpdc
EXTRA_PROGRAMS= ntpdc-layout
EXTRA_DATA= check-layout
BUILT_SOURCES= @MAKE_CHECK_LAYOUT@ ntpdc-opts.c ntpdc-opts.h
-AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
+
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
+
# LDADD might need RESLIB and ADJLIB
ntpdc_LDADD= version.o $(LIBOPTS_LDADD) ../libntp/libntp.a \
@EDITLINE_LIBS@ @LCRYPTO@
man_MANS= $(srcdir)/ntpdc.1
noinst_DATA= $(srcdir)/ntpdc-opts.texi $(srcdir)/ntpdc-opts.menu
run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \
- autogen -L ../include --writable
-std_def_list= $(top_srcdir)/include/debug-opt.def \
- $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/homerc.def \
- $(top_srcdir)/include/version.def
+ autogen -L ../sntp/include --writable
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.c
@: do-nothing action to avoid default SCCS get, .h built with .c
../libntp/libntp.a:
cd ../libntp && $(MAKE)
-$(top_srcdir)/version :
- cd $(top_srcdir) && $(MAKE) version
+$(top_srcdir)/sntp/version:
+ cd $(top_srcdir)/sntp && $(MAKE) version
-version.o: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
- env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdc
+version.o: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/version
+ env CSET=`cat $(top_srcdir)/sntp/sntp/version` $(top_builddir)/scripts/mkver ntpdc
$(COMPILE) -c version.c
# I ran nl_in.c (attached, to be installed into ntpdc) through
sbin_PROGRAMS= ntpq
endif
-AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
# LDADD might need RESLIB and ADJLIB
ntpq_LDADD= version.o $(LIBOPTS_LDADD) $(LIBM) ../libntp/libntp.a \
man_MANS= $(srcdir)/ntpq.1
noinst_DATA= $(srcdir)/ntpq-opts.texi $(srcdir)/ntpq-opts.menu
run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \
- autogen -L ../include --writable
-std_def_list= $(top_srcdir)/include/debug-opt.def \
- $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/homerc.def \
- $(top_srcdir)/include/version.def
+ autogen -L ../sntp/include --writable
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
ntpq_SOURCES= ntpq.c ntpq-subs.c ntpq-opts.c ntpq-opts.h
libntpq_a_SOURCES = libntpq.c libntpq.h libntpq_subs.c
../libntp/libntp.a:
cd ../libntp && $(MAKE)
-$(top_srcdir)/version :
- cd $(top_srcdir) && $(MAKE) version
+$(top_srcdir)/sntp/version:
+ cd $(top_srcdir)/sntp && $(MAKE) version
-version.o: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
- env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpq
+version.o: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/version
+ env CSET=`cat $(top_srcdir)/sntp/version` $(top_builddir)/scripts/mkver ntpq
$(COMPILE) -c version.c
include $(top_srcdir)/bincheck.mf
# HMS: we probably want a version.o file here, too.
LDADD= ../ntpq/libntpq.a ../libntp/libntp.a @LCRYPTO@ @SNMP_LIBS@ \
$(LIBOPTS_LDADD)
-AM_CPPFLAGS= -I$(top_srcdir)/ntpq -I$(top_srcdir)/include \
- -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include \
- $(LIBOPTS_CFLAGS) @SNMP_CPPFLAGS@
-AM_CFLAGS= @SNMP_CFLAGS@
+INCLUDES = -I$(top_srcdir)/ntpq -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+INCLUDES += @SNMP_CPPFLAGS@
+
+AM_CFLAGS = @SNMP_CFLAGS@ @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
EXTRA_DIST= ntpsnmpd-opts.def ntpsnmpd.1 ntpsnmpd-opts.texi \
ntpsnmpd-opts.menu ntpv4-mib.mib
BUILT_SOURCES= ntpsnmpd-opts.c ntpsnmpd-opts.h
noinst_DATA= $(srcdir)/ntpsnmpd-opts.texi $(srcdir)/ntpsnmpd-opts.menu
man_MANS= $(srcdir)/ntpsnmpd.1
run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \
- autogen -L ../include --writable
-std_def_list= $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/homerc.def \
- $(top_srcdir)/include/version.def
+ autogen -L ../sntp/include --writable
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
$(srcdir)/ntpsnmpd-opts.h: $(srcdir)/ntpsnmpd-opts.c
@: do-nothing action to avoid default SCCS get, .h built with .c
NULL=
-#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
+
AUTOMAKE_OPTIONS =
BUILT_SOURCES =
CLEANFILES =
-I$(top_srcdir)/lib/isc/nothreads/include \
-I$(top_srcdir)/lib/isc/unix/include
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
+
ETAGS_ARGS = Makefile.am
DISTCLEANFILES = $(EXTRA_PROGRAMS)
-#EXTRA_DIST= TAGS
check-local: @DCFD@
case "$(noinst_PROGRAMS)" in \
#include <process.h>
#include <time.h> /* time_t for timeval decl */
#include <io.h>
+#include <isc/strerror.h>
/* ---------------------------------------------------------------------
* Above this line are #include lines and the few #define lines
#define isatty _isatty
#define mktemp _mktemp
#define getpid _getpid
+#define errno_to_str isc__strerror
typedef int pid_t; /* PID is an int */
typedef int ssize_t; /* ssize is an int */
# define SIZEOF_SHORT 2
# define SIZEOF_INT 4 /* for ntp_types.h */
+# define HAVE_ALLOCA
# define HAVE_SETVBUF
+# define HAVE_VPRINTF
# define HAVE_VSPRINTF
# define HAVE_SNPRINTF
# define HAVE_VSNPRINTF
-# define HAVE_PROTOTYPES /* from ntpq.mak */
# define HAVE_MEMMOVE
# define HAVE_TERMIOS_H
# define HAVE_ERRNO_H
# define HAVE_IO_COMPLETION_PORT
# define ISC_PLATFORM_NEEDNTOP
# define ISC_PLATFORM_NEEDPTON
-# define HAVE_VPRINTF
#define HAVE_LIMITS_H 1
#define HAVE_STRDUP
#define NEED_S_CHAR_TYPEDEF
-#define USE_PROTOTYPES /* for ntp_types.h */
-
/* Directory separator, usually / or \ */
#define DIR_SEP '\\'
#include <syslog.h>
#include <isc/strerror.h>
+#include <lib_strbuf.h>
#include "messages.h"
int code
)
{
- static char msgbuf[128];
+ char * buf;
- isc__strerror(code, msgbuf, sizeof(msgbuf));
+ LIB_GETBUF(buf);
+ isc__strerror(code, buf, LIB_BUFLENGTH);
- return msgbuf;
+ return buf;
}
:NOBK
REM ** If that was not successful, we'll take a look into a version file, if available
- IF EXIST ..\..\..\..\version (
- IF "%CSET%"=="" FOR /F "TOKENS=1" %%a IN ('type ..\..\..\..\version') DO @SET CSET=%%a
+ IF EXIST ..\..\..\..\sntp\version (
+ IF "%CSET%"=="" FOR /F "TOKENS=1" %%a IN ('type ..\..\..\..\sntp\version') DO @SET CSET=%%a
)
REM next if block can go away once all windows compilers are building in
REM ports\winnt\<compiler dir>\<binary name dir> (ports\winnt\vs2008\ntpd)
- IF EXIST ..\..\..\version (
- IF "%CSET%"=="" FOR /F "TOKENS=1" %%a IN ('type ..\..\..\version') DO @SET CSET=%%a
+ IF EXIST ..\..\..\sntp\version (
+ IF "%CSET%"=="" FOR /F "TOKENS=1" %%a IN ('type ..\..\..\sntp\version') DO @SET CSET=%%a
)
REM ** Now, expand our version number with the CSet revision, if we managed to get one
-f)
force=1
;;
- version.m4)
- outputs="version.m4 $outputs"
+ *version.m4)
+ outputs="m4/version.m4 $outputs"
;;
*version.def)
outputs="include/version.def $outputs"
done
case "$outputs" in
- '') outputs="version.m4 include/version.def include/version.texi" ;;
+ '') outputs="m4/version.m4 include/version.def include/version.texi" ;;
esac
set -e
-. ./packageinfo.sh
+. ../packageinfo.sh
-dversion=`scripts/VersionName`
+dversion=`../scripts/VersionName -p ../packageinfo.sh`
set +e
case "$outputs" in
*version.m4*)
echo "m4_define([VERSION_NUMBER],[${dversion}])" > "${TEMPDIR}/version.m4+"
- cmp -s "${TEMPDIR}/version.m4+" version.m4
+ cmp -s "${TEMPDIR}/version.m4+" m4/version.m4
rc=$?
case "$force$rc" in
00)
rm -f "${TEMPDIR}/version.m4+"
;;
*)
- mv "${TEMPDIR}/version.m4+" version.m4
+ mv "${TEMPDIR}/version.m4+" m4/version.m4
;;
esac
;;
## LIBOPTS_CHECK_NOBUILD works with Automake 1.10 now
AUTOMAKE_OPTIONS = foreign 1.10
-ACLOCAL_AMFLAGS = -I ../m4 -I libopts/m4
+ACLOCAL_AMFLAGS = -I m4 -I libopts/m4
-AM_CPPFLAGS = $(LIBOPTS_CFLAGS) -I$(top_srcdir)/../include \
- -I$(top_srcdir)/../lib/isc/include \
- -I$(top_srcdir)/../lib/isc/nothreads/include \
- -I$(top_srcdir)/../lib/isc/unix/include
+CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
-LDADD = $(LIBOPTS_LDADD) $(LIBM) ../libntp/libntp.a @LCRYPTO@
+INCLUDES = $(LIBOPTS_CFLAGS)
+INCLUDES += -I$(top_srcdir)/../include
+INCLUDES += -I$(top_srcdir)/../lib/isc/include
+INCLUDES += -I$(top_srcdir)/../lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/../lib/isc/unix/include
+
+LDADD = $(LIBOPTS_LDADD)
+LDADD += $(LIBM)
+LDADD += ../libntp/libntp.a
+LDADD += @LCRYPTO@
run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \
- autogen -L ../include --writable
+ autogen -L include --writable
+
+EXTRA_PROGRAMS = sntp
if NTP_BINSUBDIR_IS_BIN
-bin_PROGRAMS = sntp
+bin_PROGRAMS = @SNTP@
else
-sbin_PROGRAMS = sntp
+sbin_PROGRAMS = @SNTP@
endif
-CLEANFILES = check-COPYRIGHT-submake
+SUBDIRS = include
-SUBDIRS =
if NEED_LIBOPTS
SUBDIRS += libopts
endif
$(NULL)
EXTRA_DIST = \
- $(srcdir)/autogen-version.def \
bincheck.mf \
$(srcdir)/COPYRIGHT \
deps-ver \
sntp.html \
sntp.texi \
tests_main.h \
- $(srcdir)/version.def \
- $(srcdir)/version.m4 \
- $(srcdir)/version.texi \
+ $(srcdir)/version \
+ $(srcdir)/m4/version.m4 \
$(NULL)
-OLD_EXTRA_DIST= \
- autogen-version.def version.def version.m4 version.texi
-
-BUILT_SOURCES= \
- check-autogen-version.def \
- check-version.def \
- check-version.m4 \
- check-version.texi \
+BUILT_SOURCES = \
$(srcdir)/COPYRIGHT \
libtool \
$(srcdir)/sntp-opts.c \
$(srcdir)/sntp-opts.h \
+ $(srcdir)/version \
+ $(srcdir)/include/version.def \
+ $(srcdir)/m4/version.m4 \
+ $(srcdir)/include/version.texi \
+ $(NULL)
+
+CLEANFILES = \
+ built-sources-only \
+ check-COPYRIGHT-submake \
$(NULL)
man_MANS= $(srcdir)/sntp.1
$(srcdir)/sntp-opts.menu \
$(NULL)
-FRC:
+FRC FRC.version:
@: do-nothing action to prevent default SCCS get
@: FRC "force" depends on nothing and is not a file, so is
@: always out-of-date causing targets which depend on it to
@: similarly always be outdated causing their rules to fire
@: each time they or a dependent is built.
-check-autogen-version.def: FRC
- @cd $(srcdir) \
- && test -r ../include/autogen-version.def \
- && ( if cmp -s ../include/autogen-version.def autogen-version.def; \
- then : ; \
- else cp ../include/autogen-version.def autogen-version.def; \
- echo "Installing new sntp/autogen-version.def file"; \
- fi )
-
-$(srcdir)/autogen-version.def:
- $(MAKE) check-autogen-version.def
-
-check-version.def: FRC
- @cd $(srcdir) \
- && test -r ../include/version.def \
- && ( if cmp -s ../include/version.def version.def; \
- then : ; \
- else cp ../include/version.def version.def; \
- echo "Installing new sntp/version.def file"; \
- fi )
-
-$(srcdir)/version.def:
- $(MAKE) check-version.def
-
-check-version.m4: FRC
- @cd $(srcdir) \
- && test -r ../version.m4 \
- && ( if cmp -s ../version.m4 version.m4; \
- then : ; \
- else cp ../version.m4 version.m4; \
- echo "Installing new sntp/version.m4 file"; \
- fi )
-
-$(srcdir)/version.m4:
- $(MAKE) check-version.m4
-
-check-version.texi: FRC
- @cd $(srcdir) \
- && test -r ../include/version.texi \
- && ( if cmp -s ../include/version.texi version.texi; \
- then : ; \
- else cp ../include/version.texi version.texi; \
- echo "Installing new sntp/version.texi file"; \
- fi )
-
-$(srcdir)/version.texi:
- $(MAKE) check-version.texi
+built-sources-only: $(BUILT_SOURCES)
+ @touch $@
+
+# HMS: The next bit is still suboptimal. If bk is present but this NTP
+# repo is not a bk repo, we'll get an error message from the prs command.
+# Unfortunately, I haven't found the necessary magic to redirect this error
+# output to /dev/null under ancient/unique shells like the one Ultrix uses.
+# We'll also get an error if srcdir or version is unwritable.
+$(srcdir)/version: FRC.version
+ -test -r $(srcdir)/../SCCS/s.ChangeSet && \
+ (bk version) >/dev/null 2>&1 && \
+ cd $(srcdir)/.. && \
+ x=`bk -R prs -hr+ -nd:I: ChangeSet` && \
+ y=`cat sntp/version 2>/dev/null` || true && \
+ case "$$x" in ''|$$y) ;; *) echo $$x > sntp/version ;; esac
+
+$(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
+ TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
+ ../scripts/genver m4/version.m4
+
+$(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
+ TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
+ ../scripts/genver include/version.def
+
+$(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
+ TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
+ ../scripts/genver include/version.texi
$(srcdir)/../COPYRIGHT:
cd .. && $(MAKE) COPYRIGHT-please
$(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
@: do-nothing action to avoid default SCCS get, .h built with .c
-$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def
+$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(srcdir)/include/version.def $(srcdir)/include/copyright.def
$(run_ag) sntp-opts.def
-$(srcdir)/sntp.1: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def
+$(srcdir)/sntp.1: $(srcdir)/sntp-opts.def $(srcdir)/include/version.def $(srcdir)/include/copyright.def
$(run_ag) -Tagman1.tpl -bsntp sntp-opts.def
$(srcdir)/sntp-opts.menu: $(srcdir)/sntp-opts.texi
@: do-nothing action to avoid default SCCS get, .menu built with .texi
-$(srcdir)/sntp-opts.texi: $(srcdir)/sntp-opts.def $(srcdir)/version.def $(srcdir)/../include/copyright.def
+$(srcdir)/sntp-opts.texi: $(srcdir)/sntp-opts.def $(srcdir)/include/version.def $(srcdir)/include/copyright.def
$(run_ag) -Taginfo.tpl -DLEVEL=section sntp-opts.def
$(top_srcdir)/../scripts/check--help $@
-$(srcdir)/sntp.html: $(srcdir)/sntp-opts.menu $(srcdir)/sntp-opts.texi $(srcdir)/sntp.texi $(srcdir)/version.texi
+$(srcdir)/sntp.html: $(srcdir)/sntp-opts.menu $(srcdir)/sntp-opts.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
-../libntp/libntp.a: FRC
+../libntp/libntp.a:
cd ../libntp && $(MAKE) libntp.a
libtool: $(LIBTOOL_DEPS)
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-m4_include([../version.m4])
+m4_include([m4/version.m4])
AC_PREREQ([2.61])
AC_INIT([sntp], [VERSION_NUMBER])
-AC_CONFIG_MACRO_DIR([../m4])
-AC_CONFIG_AUX_DIR([.])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([build-aux])
# Bump sntp_configure_cache_version for each change to configure.ac or
# .m4 files which invalidates cached values from previous configure
AC_CONFIG_HEADER([config.h])
dnl AC_ARG_PROGRAM
-# Expose a cross-compilation indicator to makefiles
-AM_CONDITIONAL([SNTP_CROSSCOMPILE], [test $build != $host])
-
-dnl check these early to avoid autoconf warnings
-AC_AIX
-AC_MINIX
+dnl must come before AC_PROG_CC or similar
+AC_USE_SYSTEM_EXTENSIONS
# Checks for programs.
AM_PROG_CC_C_O
AC_PROG_CPP
-# AC_PROG_CC_STDC has two functions. It attempts to find a compiler
-# capable of C99, or failing that, for C89. CC is set afterward with
-# the selected invocation, such as "gcc --std=gnu99". Also, the
-# ac_cv_prog_cc_stdc variable is no if the compiler selected for CC
-# does not accept C89.
-
-AC_PROG_CC_STDC
-
-case "$ac_cv_prog_cc_stdc" in
- no)
- AC_MSG_WARN([ANSI C89/ISO C90 is the minimum to compile SNTP ]
- [version 4.2.5 and higher.])
-esac
-
-AC_CACHE_CHECK(
- [if $CC can handle @%:@warning],
- [ntp_cv_cpp_warning],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]], [[#warning foo]])],
- [ntp_cv_cpp_warning=yes],
- [ntp_cv_cpp_warning=no]
- )]
-)
-case "$ntp_cv_cpp_warning" in
- no)
- AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1],
- [Should we avoid @%:@warning on option name collisions?])
-esac
-
-case "$GCC" in
- yes)
- SAVED_CFLAGS_NTP="$CFLAGS"
- CFLAGS="$CFLAGS -Wstrict-overflow"
- AC_CACHE_CHECK(
- [if $CC can handle -Wstrict-overflow],
- [ntp_cv_gcc_Wstrict_overflow],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]], [[]])],
- [ntp_cv_gcc_Wstrict_overflow=yes],
- [ntp_cv_gcc_Wstrict_overflow=no]
- ) ]
- )
- #
- # $ntp_cv_gcc_Wstrict_overflow is tested later to add the
- # flag to CFLAGS.
- #
- CFLAGS="$SAVED_CFLAGS_NTP -Winit-self"
- AC_CACHE_CHECK(
- [if $CC can handle -Winit-self],
- [ntp_cv_gcc_Winit_self],
- [
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[]], [[]])],
- [ntp_cv_gcc_Winit_self=yes],
- [ntp_cv_gcc_Winit_self=no]
- )
- ]
- )
- CFLAGS="$SAVED_CFLAGS_NTP"
- AS_UNSET([SAVED_CFLAGS_NTP])
- #
- # $ntp_cv_gcc_Winit_self is tested later to add the
- # flag to CFLAGS.
- #
-esac
-
-# HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
-case "$host" in
- *-*-solaris*)
- # see "man standards".
- # -D_XOPEN_SOURCE=500 is probably OK for c89 and before
- # -D_XOPEN_SOURCE=600 seems OK for c99
- #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
- CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
- ;;
-esac
-
AC_DISABLE_SHARED
-AC_PROG_LIBTOOL
+LT_INIT
+AC_SUBST([LIBTOOL_DEPS])
# NTP has (so far) been relying on leading-edge autogen.
# Therefore, by default:
esac
LIBOPTS_CHECK
-NTP_DIR_SEP
+NTP_LIBNTP
# Checks for libraries.
-NTP_LIB_M
-
-case "$GCC" in
- yes)
- CFLAGS="$CFLAGS -Wall"
- # CFLAGS="$CFLAGS -Wcast-align"
- CFLAGS="$CFLAGS -Wcast-qual"
- # CFLAGS="$CFLAGS -Wconversion"
- # CFLAGS="$CFLAGS -Werror"
- # CFLAGS="$CFLAGS -Wextra"
- # CFLAGS="$CFLAGS -Wfloat-equal"
- CFLAGS="$CFLAGS -Wmissing-prototypes"
- CFLAGS="$CFLAGS -Wpointer-arith"
- CFLAGS="$CFLAGS -Wshadow"
- # CFLAGS="$CFLAGS -Wtraditional"
- # CFLAGS="$CFLAGS -Wwrite-strings"
- case "$ntp_cv_gcc_Winit_self" in
- yes)
- CFLAGS="$CFLAGS -Winit-self"
- esac
- case "$ntp_cv_gcc_Wstrict_overflow" in
- yes)
- CFLAGS="$CFLAGS -Wstrict-overflow"
- esac
- # -W[no-]strict-prototypes might be added by NTP_OPENSSL
-esac
-
-# [Bug 1628] On Solaris, we need -lxnet -lsocket. Generalize this to
-# avoid keying on the OS name: If we find socket functions in
-# libsocket, next try for them in libxnet without libsocket, if found,
-# list both. If we simply tested libxnet first, we would find the
-# functions there and never add libsocket. See also [Bug 660]
-# http://bugs.ntp.org/show_bug.cgi?id=660#c9
-saved_LIBS=$LIBS
-AC_SEARCH_LIBS([setsockopt], [socket])
-case "$ac_cv_search_setsockopt" in
- -lsocket)
- LIBS="$saved_LIBS"
- AC_SEARCH_LIBS([getsockopt], [xnet])
- case "$ac_cv_search_getsockopt" in
- -lxnet)
- LIBS="-lxnet -lsocket $saved_LIBS"
- ;;
- *)
- LIBS="-lsocket $saved_LIBS"
- ;;
- esac
- ;;
-esac
-AS_UNSET([saved_LIBS])
AC_SEARCH_LIBS([inet_pton], [nsl])
AC_SEARCH_LIBS([openlog], [gen syslog])
# Checks for header files.
AC_HEADER_STDC
-dnl HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4
-dnl due to an incomplete type (a union) mpinfou used in an array. gcc3
-dnl compiles it without complaint. The mpinfou union is defined later
-dnl in the resulting preprocessed source than the spu_info array in
-dnl /usr/include/machine/sys/getppdp.h:
-dnl extern union mpinfou spu_info[];
-dnl triggering the error. Our strategy is on HP-UX only, test compile
-dnl net/if.h. If that fails, try adding a duplicate definition of
-dnl mpinfou, and if that helps add it to confdefs.h (used for further
-dnl configure tests) and config.h.
-#
-AC_CHECK_HEADERS([net/if.h], [], [], [
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
-])
-case "$host" in
- *-hp-hpux*)
- AC_CACHE_CHECK(
- [if net/if.h requires mpinfou predeclaration],
- [ntp_cv_predecl_mpinfou],
- [
- np_cv_predecl_mpinfou=no
- case "$ac_cv_header_net_if_h" in
- no)
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- typedef union mpinfou {
- struct pdk_mpinfo *pdkptr;
- struct mpinfo *pikptr;
- } mpinfou_t;
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #include <net/if.h>
- ]],
- [[
- ]]
- )],
- [
- ntp_cv_predecl_mpinfou=yes
- ac_cv_header_net_if_h=yes
- ]
- )
- esac
- ]
- )
- case "$ntp_cv_predecl_mpinfou" in
- yes)
- cat >>confdefs.h <<_ACEOF
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
- struct pdk_mpinfo *pdkptr;
- struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-_ACEOF
- AH_BOTTOM([
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
- struct pdk_mpinfo *pdkptr;
- struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-])
- esac
-esac
AC_CHECK_HEADERS([netdb.h netinet/in.h stdlib.h string.h strings.h syslog.h])
-AC_CHECK_HEADERS([sys/socket.h sys/time.h])
+AC_CHECK_HEADERS([sys/time.h])
AC_HEADER_TIME
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
NTP_OPENSSL
-
-AC_CACHE_CHECK(
- [type of socklen arg for getsockname()],
- [ntp_cv_getsockname_socklen_type],
- [
- getsockname_socklen_type_found=no
- for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
- for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- ]], [[
- extern
- getsockname(int, $getsockname_arg2,
- $ntp_cv_getsockname_socklen_type *);
- ]]
- )],
- [getsockname_socklen_type_found=yes ; break 2],
- []
- )
- done
- done
- case "$getsockname_socklen_type_found" in
- no)
- ntp_cv_getsockname_socklen_type='socklen_t'
- esac
- AS_UNSET([getsockname_arg2])
- AS_UNSET([getsockname_socklen_type_found])
- ]
-)
-AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
- $ntp_cv_getsockname_socklen_type,
- [What is getsockname()'s socklen type?])
-
-AC_CACHE_CHECK(
- [for struct sockaddr_storage],
- [ntp_cv_sockaddr_storage],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage n;
- ]]
- )],
- [ntp_cv_sockaddr_storage=yes],
- [ntp_cv_sockaddr_storage=no]
- )]
-)
-case "$ntp_cv_sockaddr_storage" in
- yes)
- AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
- [Does a system header define struct sockaddr_storage?])
-esac
-
-AC_CACHE_CHECK(
- [for sockaddr_storage.ss_family],
- [ntp_cv_have_ss_family],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.ss_family = 1;
- ]]
- )],
- [ntp_cv_have_ss_family=yes],
- [ntp_cv_have_ss_family=no]
- )]
-)
-
-case "$ntp_cv_have_ss_family" in
- no)
- AC_CACHE_CHECK(
- [for sockaddr_storage.__ss_family],
- [ntp_cv_have___ss_family],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.__ss_family = 1;
- ]]
- )],
- [ntp_cv_have___ss_family=yes],
- [ntp_cv_have___ss_family=no]
- )]
- )
- case "$ntp_cv_have___ss_family" in
- yes)
- AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
- [Does struct sockaddr_storage have __ss_family?])
- esac
-esac
-
-AH_VERBATIM(
- [HAVE___SS_FAMILY_IN_SS_VERBATIM],
- [
- /* Handle sockaddr_storage.__ss_family */
- #ifdef HAVE___SS_FAMILY_IN_SS
- # define ss_family __ss_family
- #endif /* HAVE___SS_FAMILY_IN_SS */
- ]
-)
-
-AC_CACHE_CHECK(
- [for sockaddr_storage.ss_len],
- [ntp_cv_have_ss_len],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.ss_len = 1;
- ]]
- )],
- [ntp_cv_have_ss_len=yes],
- [ntp_cv_have_ss_len=no]
- )]
-)
-
-case "$ntp_cv_have_ss_len" in
- no)
- AC_CACHE_CHECK(
- [for sockaddr_storage.__ss_len],
- [ntp_cv_have___ss_len],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #ifdef HAVE_SYS_TYPES_H
- # include <sys/types.h>
- #endif
- #ifdef HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #ifdef HAVE_NETINET_IN_H
- # include <netinet/in.h>
- #endif
- ]],
- [[
- struct sockaddr_storage s;
- s.__ss_len = 1;
- ]]
- )],
- [ntp_cv_have___ss_len=yes],
- [ntp_cv_have___ss_len=no]
- )]
- )
- case "$ntp_cv_have___ss_len" in
- yes)
- AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
- [Does struct sockaddr_storage have __ss_len?])
- esac
-esac
-
-AH_VERBATIM(
- [HAVE___SS_LEN_IN_SS_VERBATIM],
- [
- /* Handle sockaddr_storage.__ss_len */
- #ifdef HAVE___SS_LEN_IN_SS
- # define ss_len __ss_len
- #endif /* HAVE___SS_LEN_IN_SS */
- ]
-)
-
-#
-# Look for in_port_t.
-#
-AC_CACHE_CHECK(
- [for in_port_t],
- [isc_cv_have_in_port_t],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <netinet/in.h>
- ]],
- [[
- in_port_t port = 25;
- return (0);
- ]]
- )],
- [isc_cv_have_in_port_t=yes],
- [isc_cv_have_in_port_t=no]
- )]
-)
-case "$isc_cv_have_in_port_t" in
- no)
- AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
- [Declare in_port_t?])
-esac
+NTP_IPV6
AC_CACHE_CHECK(
[for multicast IP support],
AC_CHECK_FUNC([inet_pton], [],
[AC_DEFINE([ISC_PLATFORM_NEEDPTON], [1], [ISC: provide inet_pton()])])
-AC_CACHE_CHECK(
- [struct sockaddr for sa_len],
- [isc_cv_platform_havesalen],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- ]],
- [[
- extern struct sockaddr *ps;
- return ps->sa_len;
- ]]
- )],
- [isc_cv_platform_havesalen=yes],
- [isc_cv_platform_havesalen=no]
- )]
-)
-case "$isc_cv_platform_havesalen" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
- [struct sockaddr has sa_len?])
-esac
-
-AC_ARG_ENABLE(
- [ipv6],
- [AS_HELP_STRING(
- [--enable-ipv6],
- [s use IPv6?]
- )]
-)
-
-case "$enable_ipv6" in
- yes|''|autodetect)
- case "$host" in
- powerpc-ibm-aix4*)
- ;;
- *)
- AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
- ;;
- esac
- ;;
- no)
- ;;
-esac
-
-
-AC_CACHE_CHECK(
- [for IPv6 structures],
- [isc_cv_found_ipv6],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- ]],
- [[
- struct sockaddr_in6 sin6;
- ]]
- )],
- [isc_cv_found_ipv6=yes],
- [isc_cv_found_ipv6=no]
- )]
-)
-
-#
-# See whether IPv6 support is provided via a Kame add-on.
-# This is done before other IPv6 linking tests so LIBS is properly set.
-#
-AC_MSG_CHECKING([for Kame IPv6 support])
-AC_ARG_WITH(
- [kame],
- [AS_HELP_STRING(
- [--with-kame],
- [- =/usr/local/v6]
- )],
- [use_kame="$withval"],
- [use_kame="no"]
-)
-case "$use_kame" in
- no)
- ;;
- yes)
- kame_path=/usr/local/v6
- ;;
- *)
- kame_path="$use_kame"
- ;;
-esac
-case "$use_kame" in
- no)
- AC_MSG_RESULT([no])
- ;;
- *)
- if test -f $kame_path/lib/libinet6.a; then
- AC_MSG_RESULT([$kame_path/lib/libinet6.a])
- LIBS="-L$kame_path/lib -linet6 $LIBS"
- else
- AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
-
-Please choose the proper path with the following command:
-
- configure --with-kame=PATH
-])
- fi
- ;;
-esac
-
-#
-# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
-# Including it on Kame-using platforms is very bad, though, because
-# Kame uses #error against direct inclusion. So include it on only
-# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
-# This is done before the in6_pktinfo check because that's what
-# netinet6/in6.h is needed for.
-#
-case "$host" in
- *-bsdi4.[[01]]*)
- AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
- [Do we need netinet6/in6.h?])
- isc_netinet6in6_hack="#include <netinet6/in6.h>"
- ;;
- *)
- isc_netinet6in6_hack=""
- ;;
-esac
-
-#
-# This is similar to the netinet6/in6.h issue.
-#
-case "$host" in
- *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
- AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
- [Do we need to fix in6isaddr?])
- isc_netinetin6_hack="#include <netinet/in6.h>"
- ;;
- *)
- isc_netinetin6_hack=""
- ;;
-esac
-
-
-case "$isc_cv_found_ipv6" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
- AC_CACHE_CHECK(
- [for in6_pktinfo],
- [isc_cv_have_in6_pktinfo],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- $isc_netinetin6_hack
- $isc_netinet6in6_hack
- ]],
- [[
- struct in6_pktinfo xyzzy;
- ]]
- )],
- [isc_cv_have_in6_pktinfo=yes],
- [isc_cv_have_in6_pktinfo=no]
- )]
- )
- case "$isc_cv_have_in6_pktinfo" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
- [have struct in6_pktinfo?])
- esac
-
-
- # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
- AC_CACHE_CHECK(
- [for sockaddr_in6.sin6_scope_id],
- [isc_cv_have_sin6_scope_id],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- $isc_netinetin6_hack
- $isc_netinet6in6_hack
- ]],
- [[
- struct sockaddr_in6 xyzzy;
- xyzzy.sin6_scope_id = 0;
- ]]
- )],
- [isc_cv_have_sin6_scope_id=yes],
- [isc_cv_have_sin6_scope_id=no]
- )]
- )
-
- case "$isc_cv_have_sin6_scope_id" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
- esac
-esac
-
-
-# We need this check run even without isc_cv_found_ipv6=yes
-
-AC_CACHE_CHECK(
- [for in6addr_any],
- [isc_cv_have_in6addr_any],
- [AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- $isc_netinetin6_hack
- $isc_netinet6in6_hack
- ]],
- [[
- struct in6_addr in6;
- in6 = in6addr_any;
- ]]
- )],
- [isc_cv_have_in6addr_any=yes],
- [isc_cv_have_in6addr_any=no]
- )]
-)
-
-case "$isc_cv_have_in6addr_any" in
- no)
- AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
-esac
-
-
-AC_CACHE_CHECK(
- [for struct if_laddrconf],
- [isc_cv_struct_if_laddrconf],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <net/if6.h>
- ]],
- [[
- struct if_laddrconf a;
- ]]
- )],
- [isc_cv_struct_if_laddrconf=yes],
- [isc_cv_struct_if_laddrconf=no]
- )]
-)
-
-case "$isc_cv_struct_if_laddrconf" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
- [have struct if_laddrconf?])
-esac
-
-AC_CACHE_CHECK(
- [for struct if_laddrreq],
- isc_cv_struct_if_laddrreq,
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
- #include <sys/types.h>
- #include <net/if6.h>
- ]],
- [[
- struct if_laddrreq a;
- ]]
- )],
- [isc_cv_struct_if_laddrreq=yes],
- [isc_cv_struct_if_laddrreq=no]
- )]
-)
-
-case "$isc_cv_struct_if_laddrreq" in
- yes)
- AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
- [have struct if_laddrreq?])
-esac
-
###
# Checks for library functions.
AC_CHECK_FUNCS([socket vsnprintf vsprintf])
-AC_MSG_CHECKING([for bin subdirectory])
-AC_ARG_WITH(
- [binsubdir],
- [AS_HELP_STRING(
- [--with-binsubdir],
- [bin ={bin,sbin}]
- )],
- [use_binsubdir="$withval"],
- [use_binsubdir="bin"]
-)
-case "$use_binsubdir" in
- bin)
- ;;
- sbin)
- ;;
- *)
- AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
- ;;
-esac
-AC_MSG_RESULT([$use_binsubdir])
-
-BINSUBDIR=$use_binsubdir
-AC_SUBST([BINSUBDIR])
-AM_CONDITIONAL([NTP_BINSUBDIR_IS_BIN], [test "bin" = "$BINSUBDIR"])
-
# HMS: if we don't find c++ we should not look for gtest.
AC_PROG_CXX
NTP_GOOGLETEST
AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([include/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_OUTPUT
--- /dev/null
+NULL =
+
+EXTRA_DIST = \
+ autogen-version.def \
+ copyright.def \
+ debug-opt.def \
+ homerc.def \
+ version.def \
+ version.texi \
+ $(NULL)
+
+noinst_HEADERS =
+
+$(srcdir)/version.def: $(srcdir)/../../packageinfo.sh
+ cd .. && $(MAKE) $(abs_top_srcdir)/include/version.def
+
+$(srcdir)/version.texi: $(srcdir)/../../packageinfo.sh
+ cd .. && $(MAKE) $(abs_top_srcdir)/include/version.texi
no-misuse-usage;
version = `
-eval VERSION=\`sed -e 's/.*,\\[//' -e 's/\\].*//' < ../version.m4\`
+eval VERSION=\`sed -e 's/.*,\\[//' -e 's/\\].*//' < ../sntp/m4/version.m4\`
[ -z "${VERSION}" ] && echo "Cannot determine VERSION" && kill -TERM $AG_pid
echo $VERSION`;
--- /dev/null
+dnl ######################################################################
+dnl Common IPv6 detection for NTP configure.ac files
+AC_DEFUN([NTP_IPV6], [
+
+
+AC_CACHE_CHECK(
+ [for struct sockaddr_storage],
+ [ntp_cv_sockaddr_storage],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #ifdef HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ ]],
+ [[
+ struct sockaddr_storage n;
+ ]]
+ )],
+ [ntp_cv_sockaddr_storage=yes],
+ [ntp_cv_sockaddr_storage=no]
+ )]
+)
+case "$ntp_cv_sockaddr_storage" in
+ yes)
+ AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
+ [Does a system header define struct sockaddr_storage?])
+esac
+
+AC_CACHE_CHECK(
+ [for sockaddr_storage.ss_family],
+ [ntp_cv_have_ss_family],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #ifdef HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ ]],
+ [[
+ struct sockaddr_storage s;
+ s.ss_family = 1;
+ ]]
+ )],
+ [ntp_cv_have_ss_family=yes],
+ [ntp_cv_have_ss_family=no]
+ )]
+)
+
+case "$ntp_cv_have_ss_family" in
+ no)
+ AC_CACHE_CHECK(
+ [for sockaddr_storage.__ss_family],
+ [ntp_cv_have___ss_family],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #ifdef HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ ]],
+ [[
+ struct sockaddr_storage s;
+ s.__ss_family = 1;
+ ]]
+ )],
+ [ntp_cv_have___ss_family=yes],
+ [ntp_cv_have___ss_family=no]
+ )]
+ )
+ case "$ntp_cv_have___ss_family" in
+ yes)
+ AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
+ [Does struct sockaddr_storage have __ss_family?])
+ esac
+ ;;
+esac
+
+AH_VERBATIM(
+ [HAVE___SS_FAMILY_IN_SS_VERBATIM],
+ [
+ /* Handle sockaddr_storage.__ss_family */
+ #ifdef HAVE___SS_FAMILY_IN_SS
+ # define ss_family __ss_family
+ #endif /* HAVE___SS_FAMILY_IN_SS */
+ ]
+)
+
+AC_CACHE_CHECK(
+ [for sockaddr_storage.ss_len],
+ [ntp_cv_have_ss_len],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #ifdef HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ ]],
+ [[
+ struct sockaddr_storage s;
+ s.ss_len = 1;
+ ]]
+ )],
+ [ntp_cv_have_ss_len=yes],
+ [ntp_cv_have_ss_len=no]
+ )]
+)
+
+case "$ntp_cv_have_ss_len" in
+ no)
+ AC_CACHE_CHECK(
+ [for sockaddr_storage.__ss_len],
+ [ntp_cv_have___ss_len],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #ifdef HAVE_NETINET_IN_H
+ # include <netinet/in.h>
+ #endif
+ ]],
+ [[
+ struct sockaddr_storage s;
+ s.__ss_len = 1;
+ ]]
+ )],
+ [ntp_cv_have___ss_len=yes],
+ [ntp_cv_have___ss_len=no]
+ )]
+ )
+ case "$ntp_cv_have___ss_len" in
+ yes)
+ AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
+ [Does struct sockaddr_storage have __ss_len?])
+ esac
+ ;;
+esac
+
+AH_VERBATIM(
+ [HAVE___SS_LEN_IN_SS_VERBATIM],
+ [
+ /* Handle sockaddr_storage.__ss_len */
+ #ifdef HAVE___SS_LEN_IN_SS
+ # define ss_len __ss_len
+ #endif /* HAVE___SS_LEN_IN_SS */
+ ]
+)
+
+#
+# Look for in_port_t.
+#
+AC_CACHE_CHECK(
+ [for in_port_t],
+ [isc_cv_have_in_port_t],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ ]],
+ [[
+ in_port_t port = 25;
+ return (0);
+ ]]
+ )],
+ [isc_cv_have_in_port_t=yes],
+ [isc_cv_have_in_port_t=no]
+ )]
+)
+case "$isc_cv_have_in_port_t" in
+ no)
+ AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
+ [Declare in_port_t?])
+esac
+
+AC_CACHE_CHECK(
+ [type of socklen arg for getsockname()],
+ [ntp_cv_getsockname_socklen_type],
+ [
+ getsockname_socklen_type_found=no
+ for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
+ for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ ]], [[
+ extern
+ getsockname(int, $getsockname_arg2,
+ $ntp_cv_getsockname_socklen_type *);
+ ]]
+ )],
+ [getsockname_socklen_type_found=yes ; break 2],
+ []
+ )
+ done
+ done
+ case "$getsockname_socklen_type_found" in
+ no)
+ ntp_cv_getsockname_socklen_type='socklen_t'
+ esac
+ AS_UNSET([getsockname_arg2])
+ AS_UNSET([getsockname_socklen_type_found])
+ ]
+)
+AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
+ [$ntp_cv_getsockname_socklen_type],
+ [What is getsockname()'s socklen type?])
+
+AC_CACHE_CHECK(
+ [struct sockaddr for sa_len],
+ [isc_cv_platform_havesalen],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ ]],
+ [[
+ extern struct sockaddr *ps;
+ return ps->sa_len;
+ ]]
+ )],
+ [isc_cv_platform_havesalen=yes],
+ [isc_cv_platform_havesalen=no]
+ )]
+)
+case "$isc_cv_platform_havesalen" in
+ yes)
+ AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
+ [struct sockaddr has sa_len?])
+esac
+
+AC_ARG_ENABLE(
+ [ipv6],
+ [AS_HELP_STRING(
+ [--enable-ipv6],
+ [s use IPv6?]
+ )]
+)
+
+case "$enable_ipv6" in
+ yes|''|autodetect)
+ case "$host" in
+ powerpc-ibm-aix4*)
+ ;;
+ *)
+ AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
+ ;;
+ esac
+ ;;
+ no)
+ ;;
+esac
+
+
+AC_CACHE_CHECK(
+ [for IPv6 structures],
+ [isc_cv_found_ipv6],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ ]],
+ [[
+ struct sockaddr_in6 sin6;
+ ]]
+ )],
+ [isc_cv_found_ipv6=yes],
+ [isc_cv_found_ipv6=no]
+ )]
+)
+
+#
+# See whether IPv6 support is provided via a Kame add-on.
+# This is done before other IPv6 linking tests so LIBS is properly set.
+#
+AC_MSG_CHECKING([for Kame IPv6 support])
+AC_ARG_WITH(
+ [kame],
+ [AS_HELP_STRING(
+ [--with-kame],
+ [- =/usr/local/v6]
+ )],
+ [use_kame="$withval"],
+ [use_kame="no"]
+)
+case "$use_kame" in
+ no)
+ ;;
+ yes)
+ kame_path=/usr/local/v6
+ ;;
+ *)
+ kame_path="$use_kame"
+ ;;
+esac
+case "$use_kame" in
+ no)
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ if test -f $kame_path/lib/libinet6.a; then
+ AC_MSG_RESULT([$kame_path/lib/libinet6.a])
+ LIBS="-L$kame_path/lib -linet6 $LIBS"
+ else
+ AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
+
+Please choose the proper path with the following command:
+
+ configure --with-kame=PATH
+])
+ fi
+ ;;
+esac
+
+#
+# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
+# Including it on Kame-using platforms is very bad, though, because
+# Kame uses #error against direct inclusion. So include it on only
+# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
+# This is done before the in6_pktinfo check because that's what
+# netinet6/in6.h is needed for.
+#
+case "$host" in
+ *-bsdi4.[[01]]*)
+ AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
+ [Do we need netinet6/in6.h?])
+ isc_netinet6in6_hack="#include <netinet6/in6.h>"
+ ;;
+ *)
+ isc_netinet6in6_hack=""
+ ;;
+esac
+
+#
+# This is similar to the netinet6/in6.h issue.
+#
+case "$host" in
+ *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
+ AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
+ [Do we need to fix in6isaddr?])
+ isc_netinetin6_hack="#include <netinet/in6.h>"
+ ;;
+ *)
+ isc_netinetin6_hack=""
+ ;;
+esac
+
+
+case "$isc_cv_found_ipv6" in
+ yes)
+ AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
+ AC_CACHE_CHECK(
+ [for in6_pktinfo],
+ [isc_cv_have_in6_pktinfo],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ $isc_netinetin6_hack
+ $isc_netinet6in6_hack
+ ]],
+ [[
+ struct in6_pktinfo xyzzy;
+ ]]
+ )],
+ [isc_cv_have_in6_pktinfo=yes],
+ [isc_cv_have_in6_pktinfo=no]
+ )]
+ )
+ case "$isc_cv_have_in6_pktinfo" in
+ yes)
+ AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
+ [have struct in6_pktinfo?])
+ esac
+
+
+ # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
+ AC_CACHE_CHECK(
+ [for sockaddr_in6.sin6_scope_id],
+ [isc_cv_have_sin6_scope_id],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ $isc_netinetin6_hack
+ $isc_netinet6in6_hack
+ ]],
+ [[
+ struct sockaddr_in6 xyzzy;
+ xyzzy.sin6_scope_id = 0;
+ ]]
+ )],
+ [isc_cv_have_sin6_scope_id=yes],
+ [isc_cv_have_sin6_scope_id=no]
+ )]
+ )
+
+ case "$isc_cv_have_sin6_scope_id" in
+ yes)
+ AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
+ esac
+esac
+
+
+# We need this check run even without isc_cv_found_ipv6=yes
+
+AC_CACHE_CHECK(
+ [for in6addr_any],
+ [isc_cv_have_in6addr_any],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ $isc_netinetin6_hack
+ $isc_netinet6in6_hack
+ ]],
+ [[
+ struct in6_addr in6;
+ in6 = in6addr_any;
+ ]]
+ )],
+ [isc_cv_have_in6addr_any=yes],
+ [isc_cv_have_in6addr_any=no]
+ )]
+)
+
+case "$isc_cv_have_in6addr_any" in
+ no)
+ AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
+esac
+
+
+AC_CACHE_CHECK(
+ [for struct if_laddrconf],
+ [isc_cv_struct_if_laddrconf],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <net/if6.h>
+ ]],
+ [[
+ struct if_laddrconf a;
+ ]]
+ )],
+ [isc_cv_struct_if_laddrconf=yes],
+ [isc_cv_struct_if_laddrconf=no]
+ )]
+)
+
+case "$isc_cv_struct_if_laddrconf" in
+ yes)
+ AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
+ [have struct if_laddrconf?])
+esac
+
+AC_CACHE_CHECK(
+ [for struct if_laddrreq],
+ isc_cv_struct_if_laddrreq,
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <sys/types.h>
+ #include <net/if6.h>
+ ]],
+ [[
+ struct if_laddrreq a;
+ ]]
+ )],
+ [isc_cv_struct_if_laddrreq=yes],
+ [isc_cv_struct_if_laddrreq=no]
+ )]
+)
+
+case "$isc_cv_struct_if_laddrreq" in
+ yes)
+ AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
+ [have struct if_laddrreq?])
+esac
+
+
+])dnl
+dnl ======================================================================
--- /dev/null
+dnl ######################################################################
+dnl Common m4sh code for libntp clients
+AC_DEFUN([NTP_LIBNTP], [
+
+# Expose a cross-compilation indicator to makefiles
+AM_CONDITIONAL([NTP_CROSSCOMPILE], [test $build != $host])
+
+CFLAGS_NTP=
+CPPFLAGS_NTP=
+AC_SUBST([CFLAGS_NTP])
+AC_SUBST([CPPFLAGS_NTP])
+
+# AC_PROG_CC_STDC has two functions. It attempts to find a compiler
+# capable of C99, or failing that, for C89. CC is set afterward with
+# the selected invocation, such as "gcc --std=gnu99". Also, the
+# ac_cv_prog_cc_stdc variable is no if the compiler selected for CC
+# does not accept C89.
+
+AC_PROG_CC_STDC
+
+case "$ac_cv_prog_cc_stdc" in
+ no)
+ AC_MSG_WARN([ANSI C89/ISO C90 is the minimum to compile NTP]
+ [ version 4.2.5 and higher.])
+ ;;
+esac
+
+AC_CACHE_CHECK(
+ [if $CC can handle @%:@warning],
+ [ntp_cv_cpp_warning],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[#warning foo]])],
+ [ntp_cv_cpp_warning=yes],
+ [ntp_cv_cpp_warning=no]
+ )]
+)
+case "$ntp_cv_cpp_warning" in
+ no)
+ AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1],
+ [Should we avoid @%:@warning on option name collisions?])
+esac
+
+case "$GCC" in
+ yes)
+ SAVED_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Wstrict-overflow"
+ AC_CACHE_CHECK(
+ [if $CC can handle -Wstrict-overflow],
+ [ntp_cv_gcc_Wstrict_overflow],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[]])],
+ [ntp_cv_gcc_Wstrict_overflow=yes],
+ [ntp_cv_gcc_Wstrict_overflow=no]
+ ) ]
+ )
+ #
+ # $ntp_cv_gcc_Wstrict_overflow is tested later to add the
+ # flag to CFLAGS.
+ #
+ CFLAGS="$SAVED_CFLAGS -Winit-self"
+ AC_CACHE_CHECK(
+ [if $CC can handle -Winit-self],
+ [ntp_cv_gcc_Winit_self],
+ [
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]], [[]])],
+ [ntp_cv_gcc_Winit_self=yes],
+ [ntp_cv_gcc_Winit_self=no]
+ )
+ ]
+ )
+ CFLAGS="$SAVED_CFLAGS"
+ AS_UNSET([SAVED_CFLAGS])
+ #
+ # $ntp_cv_gcc_Winit_self is tested later to add the
+ # flag to CFLAGS_NTP.
+ #
+esac
+
+case "$GCC" in
+ yes)
+ CFLAGS_NTP="$CFLAGS_NTP -Wall"
+ # CFLAGS_NTP="$CFLAGS_NTP -Wcast-align"
+ CFLAGS_NTP="$CFLAGS_NTP -Wcast-qual"
+ # CFLAGS_NTP="$CFLAGS_NTP -Wconversion"
+ # CFLAGS_NTP="$CFLAGS_NTP -Werror"
+ # CFLAGS_NTP="$CFLAGS_NTP -Wextra"
+ # CFLAGS_NTP="$CFLAGS_NTP -Wfloat-equal"
+ CFLAGS_NTP="$CFLAGS_NTP -Wmissing-prototypes"
+ CFLAGS_NTP="$CFLAGS_NTP -Wpointer-arith"
+ CFLAGS_NTP="$CFLAGS_NTP -Wshadow"
+ # CFLAGS_NTP="$CFLAGS_NTP -Wtraditional"
+ # CFLAGS_NTP="$CFLAGS_NTP -Wwrite-strings"
+ case "$ntp_cv_gcc_Winit_self" in
+ yes)
+ CFLAGS_NTP="$CFLAGS_NTP -Winit-self"
+ esac
+ case "$ntp_cv_gcc_Wstrict_overflow" in
+ yes)
+ CFLAGS_NTP="$CFLAGS_NTP -Wstrict-overflow"
+ esac
+ # -W[no-]strict-prototypes might be added by NTP_OPENSSL
+esac
+
+NTP_OS_CFLAGS
+NTP_LIB_M
+NTP_DIR_SEP
+
+AC_MSG_CHECKING([for bin subdirectory])
+AC_ARG_WITH(
+ [binsubdir],
+ [AS_HELP_STRING(
+ [--with-binsubdir],
+ [bin ={bin,sbin}]
+ )],
+ [use_binsubdir="$withval"],
+ [use_binsubdir="bin"]
+)
+case "$use_binsubdir" in
+ bin)
+ ;;
+ sbin)
+ ;;
+ *)
+ AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
+ ;;
+esac
+AC_MSG_RESULT([$use_binsubdir])
+
+BINSUBDIR=$use_binsubdir
+AC_SUBST([BINSUBDIR])
+AM_CONDITIONAL([NTP_BINSUBDIR_IS_BIN], [test "bin" = "$BINSUBDIR"])
+
+ac_busted_vpath_in_make=no
+case "$build" in
+ *-*-irix6.1*) # 64 bit only
+ # busted vpath?
+ ;;
+ *-*-irix6*) # 6.2 (and later?)
+ ac_busted_vpath_in_make=yes
+ ;;
+ *-*-solaris2.5.1)
+ ac_busted_vpath_in_make=yes
+ ;;
+ *-*-unicosmp*)
+ ac_busted_vpath_in_make=yes
+ ;;
+esac
+
+case "$ac_busted_vpath_in_make$srcdir" in
+ yes.|no*)
+ ;;
+ *) case "`${MAKE-make} -v -f /dev/null 2>/dev/null | grep 'GNU Make'`" in
+ '')
+ AC_MSG_ERROR([building outside of the main directory requires GNU make])
+ esac
+ ;;
+esac
+
+dnl HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4
+dnl due to an incomplete type (a union) mpinfou used in an array. gcc3
+dnl compiles it without complaint. The mpinfou union is defined later
+dnl in the resulting preprocessed source than the spu_info array in
+dnl /usr/include/machine/sys/getppdp.h:
+dnl extern union mpinfou spu_info[];
+dnl triggering the error. Our strategy is on HP-UX only, test compile
+dnl net/if.h. If that fails, try adding a duplicate definition of
+dnl mpinfou, and if that helps add it to confdefs.h (used for further
+dnl configure tests) and config.h.
+#
+AC_CHECK_HEADERS([sys/socket.h])
+AC_CHECK_HEADERS([net/if.h], [], [], [
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+])
+case "$host" in
+ *-hp-hpux*)
+ AC_CACHE_CHECK(
+ [if net/if.h requires mpinfou predeclaration],
+ [ntp_cv_predecl_mpinfou],
+ [
+ np_cv_predecl_mpinfou=no
+ case "$ac_cv_header_net_if_h" in
+ no)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ typedef union mpinfou {
+ struct pdk_mpinfo *pdkptr;
+ struct mpinfo *pikptr;
+ } mpinfou_t;
+ #ifdef HAVE_SYS_SOCKET_H
+ # include <sys/socket.h>
+ #endif
+ #include <net/if.h>
+ ]],
+ [[
+ ]]
+ )],
+ [
+ ntp_cv_predecl_mpinfou=yes
+ ac_cv_header_net_if_h=yes
+ ]
+ )
+ esac
+ ]
+ )
+ case "$ntp_cv_predecl_mpinfou" in
+ yes)
+ cat >>confdefs.h <<_ACEOF
+#ifndef MPINFOU_PREDECLARED
+# define MPINFOU_PREDECLARED
+typedef union mpinfou {
+ struct pdk_mpinfo *pdkptr;
+ struct mpinfo *pikptr;
+} mpinfou_t;
+#endif
+_ACEOF
+ AH_BOTTOM([
+#ifndef MPINFOU_PREDECLARED
+# define MPINFOU_PREDECLARED
+typedef union mpinfou {
+ struct pdk_mpinfo *pdkptr;
+ struct mpinfo *pikptr;
+} mpinfou_t;
+#endif
+])
+ esac
+esac
+
+# [Bug 1628] On Solaris, we need -lxnet -lsocket. Generalize this to
+# avoid keying on the OS name: If we find socket functions in
+# libsocket, next try for them in libxnet without libsocket, if found,
+# list both. If we simply tested libxnet first, we would find the
+# functions there and never add libsocket. See also [Bug 660]
+# http://bugs.ntp.org/show_bug.cgi?id=660#c9
+saved_LIBS=$LIBS
+AC_SEARCH_LIBS([setsockopt], [socket])
+case "$ac_cv_search_setsockopt" in
+ -lsocket)
+ LIBS="$saved_LIBS"
+ AC_SEARCH_LIBS([getsockopt], [xnet])
+ case "$ac_cv_search_getsockopt" in
+ -lxnet)
+ LIBS="-lxnet -lsocket $saved_LIBS"
+ ;;
+ *) LIBS="-lsocket $saved_LIBS"
+ ;;
+ esac
+ ;;
+esac
+AS_UNSET([saved_LIBS])
+
+AC_FUNC_STRERROR_R
+
+dnl preset withsntp=no in env to change default to --without-sntp
+AC_MSG_CHECKING([if sntp will be built])
+AC_ARG_WITH(
+ [sntp],
+ [AS_HELP_STRING(
+ [--without-sntp],
+ [- disable building sntp and sntp/tests]
+ )],
+ [],
+ [with_sntp="${withsntp=yes}"]
+)
+case "$with_sntp" in
+ no)
+ SNTP=
+ ;;
+ *)
+ SNTP=sntp
+ ;;
+esac
+AC_SUBST([SNTP])
+AM_CONDITIONAL([BUILD_SNTP], [test -n "$SNTP"])
+AC_MSG_RESULT([$with_sntp])
+
+])dnl
+dnl ======================================================================
dnl OpenSSL support shared by top-level and sntp/configure.ac
AC_DEFUN([NTP_OPENSSL], [
+LCRYPTO=
+AC_SUBST([LCRYPTO])
+
AC_ARG_WITH(
[rpath],
[AS_HELP_STRING(
/usr/include)
;;
*)
- CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC"
+ CPPFLAGS_NTP="$CPPFLAGS_NTP -I$OPENSSL_INC"
;;
esac
case "$OPENSSL_LIB" in
esac
;;
esac
- AC_SUBST([LCRYPTO], [-lcrypto])
+ LCRYPTO="-lcrypto"
AC_DEFINE([OPENSSL], [1], [Use OpenSSL?])
esac
+NTPO_SAVED_CPPFLAGS="$CPPFLAGS"
+NTPO_SAVED_LIBS="$LIBS"
+
#
# check for linking with -lcrypto failure, and try -lz -lcrypto.
# Helps m68k-atari-mint
#
case "$ntp_openssl" in
yes)
- NTPO_SAVED_LIBS="$LIBS"
+ CPPFLAGS="$CPPFLAGS $CPPFLAGS_NTP"
LIBS="$NTPO_SAVED_LIBS $LCRYPTO"
AC_CACHE_CHECK(
[if linking with $LCRYPTO alone works],
LCRYPTO="$LCRYPTO -lz"
esac
esac
- LIBS="$NTPO_SAVED_LIBS"
- AS_UNSET([NTPO_SAVED_LIBS])
esac
#
esac
case "$openssl_triggers_warnings" in
yes)
- CFLAGS="$SAVED_CFLAGS -Wno-strict-prototypes"
+ CFLAGS_NTP="$CFLAGS_NTP -Wno-strict-prototypes"
;;
*)
- CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes"
+ CFLAGS_NTP="$CFLAGS_NTP -Wstrict-prototypes"
esac
;;
yesno)
# gcc without OpenSSL
- CFLAGS="$SAVED_CFLAGS -Wstrict-prototypes"
+ CFLAGS_NTP="$CFLAGS_NTP -Wstrict-prototypes"
esac
+
+CFLAGS="$SAVED_CFLAGS"
+CPPFLAGS="$NTPO_SAVED_CPPFLAGS"
+LIBS="$NTPO_SAVED_LIBS"
AS_UNSET([SAVED_CFLAGS])
+AS_UNSET([NTPO_SAVED_CPPFLAGS])
+AS_UNSET([NTPO_SAVED_LIBS])
])
dnl ======================================================================
set)
;;
*)
- ntp_os_cflags=""
+ ntp_os_cflags=
case "$host_os" in
aix[[1-3]]*)
;;
;;
*)
ntp_os_cflags_msg="$ntp_os_cflags"
- CFLAGS="$CFLAGS $ntp_os_cflags"
esac
+ CFLAGS_NTP="$CFLAGS_NTP $ntp_os_cflags"
AC_MSG_RESULT([$ntp_os_cflags_msg])
AS_UNSET([ntp_os_cflags_msg])
])
NULL =
-check_PROGRAMS = tests
+check_PROGRAMS =
+if BUILD_SNTP
+check_PROGRAMS += tests
+endif
sntp_objs = ..
@LCRYPTO@ \
@GTEST_LDFLAGS@ \
@GTEST_LIBS@ \
- $(sntp_SOURCES_USED)
+ $(sntp_SOURCES_USED) \
+ $(NULL)
+AM_CFLAGS = @CFLAGS_NTP@
AM_CXXFLAGS = @GTEST_CXXFLAGS@
-AM_CPPFLAGS = @GTEST_CPPFLAGS@
+AM_CPPFLAGS = @GTEST_CPPFLAGS@ @CPPFLAGS_NTP@
INCLUDES = $(LIBOPTS_CFLAGS)
INCLUDES += -I$(top_srcdir)/../include
TESTS_ENVIRONMENT = $(top_srcdir)/tests/test-driver $(TEST_INPUT_DIR) $(TEST_OUTPUT_DIR)
-if !SNTP_CROSSCOMPILE
+if !NTP_CROSSCOMPILE
TESTS += $(check_PROGRAMS)
endif
+NULL =
+
check_PROGRAMS = tests
-LDADD = @top_builddir@/libntp/libntp.a @LCRYPTO@ @GTEST_LDFLAGS@ @GTEST_LIBS@
+
+LDADD = \
+ @top_builddir@/libntp/libntp.a \
+ @LCRYPTO@ \
+ @GTEST_LDFLAGS@ \
+ @GTEST_LIBS@ \
+ $(NULL)
+
+AM_CFLAGS = @CFLAGS_NTP@
AM_CXXFLAGS = @GTEST_CXXFLAGS@
-AM_CPPFLAGS = @GTEST_CPPFLAGS@
+AM_CPPFLAGS = @GTEST_CPPFLAGS@ @CPPFLAGS_NTP@
+
tests_SOURCES = $(top_srcdir)/sntp/tests_main.cpp \
libntptest.cpp \
a_md5encrypt.cpp \
INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
INCLUDES += -I$(top_srcdir)/sntp
-TESTS =
+TESTS =
if !NTP_CROSSCOMPILE
TESTS += tests
EXTRA_PROGRAMS= audio-pcm byteorder hist jitter kern longsize \
ntptime pps-api precision sht testrs6000 tg tg2 tickadj timetrim
-AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
- -I$(top_srcdir)/lib/isc/nothreads/include \
- -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
+INCLUDES = -I$(top_srcdir)/include
+INCLUDES += -I$(top_srcdir)/lib/isc/include
+INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include
+INCLUDES += -I$(top_srcdir)/lib/isc/unix/include
+INCLUDES += $(LIBOPTS_CFLAGS)
+
+AM_CFLAGS = @CFLAGS_NTP@
+AM_CPPFLAGS = @CPPFLAGS_NTP@
# LDADD might need RESLIB and ADJLIB
LDADD= ../libntp/libntp.a
noinst_DATA= $(srcdir)/ntp-keygen-opts.texi $(srcdir)/ntp-keygen-opts.menu
man_MANS= $(srcdir)/ntp-keygen.1
run_ag= cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" \
- autogen -L ../include --writable
-std_def_list= $(top_srcdir)/include/debug-opt.def \
- $(top_srcdir)/include/autogen-version.def \
- $(top_srcdir)/include/copyright.def \
- $(top_srcdir)/include/homerc.def \
- $(top_srcdir)/include/version.def
+ autogen -L ../sntp/include --writable
+std_def_list = \
+ $(top_srcdir)/sntp/include/debug-opt.def \
+ $(top_srcdir)/sntp/include/autogen-version.def \
+ $(top_srcdir)/sntp/include/copyright.def \
+ $(top_srcdir)/sntp/include/homerc.def \
+ $(top_srcdir)/sntp/include/version.def \
+ $(NULL)
$(srcdir)/ntp-keygen-opts.h: $(srcdir)/ntp-keygen-opts.c
@: do-nothing action to avoid default SCCS get, .h built with .c
kern.o: kern.c
$(COMPILE) -DHAVE_TIMEX_H -c kern.c
-$(top_srcdir)/version :
- cd $(top_srcdir) && $(MAKE) version
+$(top_srcdir)/sntp/version:
+ cd $(top_srcdir)/sntp && $(MAKE) version
-version.o: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
- env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntp-keygen
+version.o: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/version
+ env CSET=`cat $(top_srcdir)/sntp/version` $(top_builddir)/scripts/mkver ntp-keygen
$(COMPILE) -c version.c
include $(top_srcdir)/bincheck.mf