From: Dave Hart Date: Wed, 12 Jan 2011 05:23:49 +0000 (+0000) Subject: Add configure --without-sntp option to disable building sntp and X-Git-Tag: NTP_4_2_7P117~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=241c32158130fabfb9e49cf5c76105fb59264a58;p=thirdparty%2Fntp.git 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. bk: 4d2d3ae5qHgCJgo6Em6MNVzUt-4eIg --- diff --git a/ChangeLog b/ChangeLog index a9846c1cb..c607810f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +* 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 * refclock_nmea.c refactoring by Juergen Perlinger. (4.2.7p115) 2011/01/09 Released by Harlan Stenn diff --git a/Makefile.am b/Makefile.am index 4ab08f87f..502f2db3f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## 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 = @@ -45,7 +45,7 @@ DIST_SUBDIRS = \ tests \ $(NULL) -DISTCHECK_CONFIGURE_FLAGS = -C +DISTCHECK_CONFIGURE_FLAGS = -C --with-sntp EXTRA_DIST = \ $(srcdir)/COPYRIGHT \ @@ -63,13 +63,9 @@ EXTRA_DIST = \ 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 \ @@ -82,8 +78,6 @@ EXTRA_DIST = \ bincheck.mf \ depsver.mf \ deps-ver \ - $(srcdir)/version \ - version.m4 \ \ $(NULL) @@ -96,11 +90,8 @@ ETAGS_ARGS = Makefile.am configure.ac 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) @@ -117,36 +108,12 @@ COPYRIGHT-please: $(srcdir)/COPYRIGHT 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 @@ -169,9 +136,12 @@ CommitLog: FRC.CommitLog -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 @@ -194,7 +164,7 @@ BHOST=`(hostname || uname -n)` 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? diff --git a/adjtimed/Makefile.am b/adjtimed/Makefile.am index c97a08a7d..1ab50cff4 100644 --- a/adjtimed/Makefile.am +++ b/adjtimed/Makefile.am @@ -9,7 +9,16 @@ endif 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 diff --git a/bootstrap b/bootstrap index 01e36d35c..e837f74fe 100755 --- a/bootstrap +++ b/bootstrap @@ -29,7 +29,7 @@ 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, @@ -37,17 +37,17 @@ scripts/genver || { echo scripts/genver failed ; exit 1; } 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... @@ -80,11 +80,6 @@ prog_opt_files=`grep -l '^prog.name' $def_files` ## 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} diff --git a/build b/build index 18e223c7a..9f26752cf 100755 --- a/build +++ b/build @@ -30,12 +30,15 @@ esac #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 diff --git a/clockstuff/Makefile.am b/clockstuff/Makefile.am index 0ab3cfa7f..c235b2333 100644 --- a/clockstuff/Makefile.am +++ b/clockstuff/Makefile.am @@ -7,20 +7,27 @@ EXTRA_DIST = clktest-opts.def 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 diff --git a/configure.ac b/configure.ac index e1667f59a..8c19e08a4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ 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 @@ -54,9 +54,8 @@ ntp_parse_ok=${ntp_parse_ok=no} 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 @@ -67,51 +66,15 @@ AC_PROG_CPP 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 @@ -130,87 +93,6 @@ LIBOPTS_CHECK_NOBUILD([sntp/libopts]) 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]), @@ -229,70 +111,10 @@ AC_PROG_MAKE_SET 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 @@ -348,30 +170,6 @@ AC_PROG_INSTALL # 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]) @@ -469,79 +267,6 @@ case "$host" in 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 - #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 - #endif - #include - ]], - [[ - ]] - )], - [ - 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], [], [], [ @@ -1058,205 +783,6 @@ case "$ntp_cv_struct_ppsclockev" in [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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #include - ]], - [[ - 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( @@ -1554,45 +1080,6 @@ case $want_getifaddrs in ;; 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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #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 @@ -5332,287 +4819,8 @@ case "$ans" 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 - #include - ]], - [[ - 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 - #include - #include - ]], - [[ - 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 " - ;; - *) - 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 " - ;; - *) - 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 - #include - #include - $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 - #include - #include - $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 - #include - #include - $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 - #include - ]], - [[ - 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 - #include - ]], - [[ - 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. diff --git a/excludes b/excludes deleted file mode 100644 index 36cb351e9..000000000 --- a/excludes +++ /dev/null @@ -1 +0,0 @@ -*.obj *.pch *.bsc *.pdb *.sbr nt*.zip *.tar *.gz *.ilk beta*.zip diff --git a/flock-build b/flock-build index 83dadea53..245071d8e 100755 --- a/flock-build +++ b/flock-build @@ -52,6 +52,10 @@ esac # * 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`} @@ -59,7 +63,7 @@ c_d=${PWD:-`pwd`} SIG=`perl -e 'print rand'` case "$LIST" in - '') LIST="malarky rackety" ;; + '') LIST="pogo" ;; esac for i in $LIST diff --git a/include/Makefile.am b/include/Makefile.am index 56f931a25..82f81db48 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,7 +1,6 @@ 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 diff --git a/include/lib_strbuf.h b/include/lib_strbuf.h index 6242cc958..b114ab819 100644 --- a/include/lib_strbuf.h +++ b/include/lib_strbuf.h @@ -3,6 +3,7 @@ */ #include +#include /* for ZERO() */ /* * Sizes of things @@ -20,8 +21,6 @@ extern int lib_inited; */ #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); \ diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h index 7b23dff3e..b147be06a 100644 --- a/include/ntp_stdlib.h +++ b/include/ntp_stdlib.h @@ -37,6 +37,9 @@ extern int msnprintf(char *, size_t, const char *, ...) __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 diff --git a/kernel/Makefile.am b/kernel/Makefile.am index 8508029cd..c9cf385a7 100644 --- a/kernel/Makefile.am +++ b/kernel/Makefile.am @@ -1,4 +1,3 @@ -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies AUTOMAKE_OPTIONS = SUBDIRS = sys ETAGS_ARGS = Makefile.am diff --git a/kernel/sys/Makefile.am b/kernel/sys/Makefile.am index 417111406..0fce1f71e 100644 --- a/kernel/sys/Makefile.am +++ b/kernel/sys/Makefile.am @@ -1,4 +1,3 @@ -#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 diff --git a/libntp/Makefile.am b/libntp/Makefile.am index af0220015..79ee44d08 100644 --- a/libntp/Makefile.am +++ b/libntp/Makefile.am @@ -1,5 +1,4 @@ NULL= -#AUTOMAKE_OPTIONS = ../ansi2knr no-dependencies AUTOMAKE_OPTIONS = BUILT_SOURCES = CLEANFILES = @@ -104,9 +103,15 @@ libntp_a_SOURCES = systime.c $(libntp_a_SRCS) 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 diff --git a/libntp/lib_strbuf.c b/libntp/lib_strbuf.c index a482fe08a..bdb3ace00 100644 --- a/libntp/lib_strbuf.c +++ b/libntp/lib_strbuf.c @@ -17,7 +17,7 @@ libbufstr lib_stringbuf[LIB_NUMBUF]; 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. @@ -25,8 +25,7 @@ int lib_inited = 0; 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; } diff --git a/libntp/msyslog.c b/libntp/msyslog.c index b6d9d72a3..d90e72850 100644 --- a/libntp/msyslog.c +++ b/libntp/msyslog.c @@ -41,6 +41,47 @@ void format_errmsg (char *, size_t, const char *, int); /* + * 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. */ @@ -122,11 +163,11 @@ format_errmsg( int errval ) { + char errmsg[256]; char c; char *n; const char *f; size_t len; - char *err; n = nfmt; f = fmt; @@ -142,12 +183,12 @@ format_errmsg( *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; } } diff --git a/libparse/Makefile.am b/libparse/Makefile.am index d6b9da394..7d2e1fda1 100644 --- a/libparse/Makefile.am +++ b/libparse/Makefile.am @@ -56,10 +56,14 @@ libparse_kernel_a_LIBADD = \ 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 diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am index 8b1c1c2ab..54647e154 100644 --- a/ntpd/Makefile.am +++ b/ntpd/Makefile.am @@ -9,9 +9,14 @@ endif 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@ @@ -120,10 +125,14 @@ check_PROGRAMS = @MAKE_CHECK_Y2K@ 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@ @@ -266,11 +275,11 @@ check-saveconfig: $(srcdir)/complete.conf compsave.conf ../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 diff --git a/ntpdate/Makefile.am b/ntpdate/Makefile.am index 06987e466..bfb345ea7 100644 --- a/ntpdate/Makefile.am +++ b/ntpdate/Makefile.am @@ -14,13 +14,17 @@ EXTRA_PROGRAMS= ntptimeset 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 @@ -30,11 +34,11 @@ $(PROGRAMS): $(LDADD) ../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 diff --git a/ntpdc/Makefile.am b/ntpdc/Makefile.am index 00aeffb80..5ed79104a 100644 --- a/ntpdc/Makefile.am +++ b/ntpdc/Makefile.am @@ -1,5 +1,5 @@ NULL= -AUTOMAKE_OPTIONS= +AUTOMAKE_OPTIONS= if NTP_BINSUBDIR_IS_BIN bin_PROGRAMS= ntpdc @@ -10,9 +10,16 @@ endif 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@ @@ -27,12 +34,14 @@ EXTRA_DIST= nl_in.c nl.pl layout.std \ 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 @@ -65,11 +74,11 @@ $(PROGRAMS): $(LDADD) ../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 diff --git a/ntpq/Makefile.am b/ntpq/Makefile.am index 5f392ba7b..1346602b4 100644 --- a/ntpq/Makefile.am +++ b/ntpq/Makefile.am @@ -7,9 +7,14 @@ else 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 \ @@ -25,12 +30,14 @@ BUILT_SOURCES= ntpq-opts.c ntpq-opts.h 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 @@ -56,11 +63,11 @@ $(PROGRAMS): $(LDADD) ../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 diff --git a/ntpsnmpd/Makefile.am b/ntpsnmpd/Makefile.am index 168de2787..e13eedf67 100644 --- a/ntpsnmpd/Makefile.am +++ b/ntpsnmpd/Makefile.am @@ -14,13 +14,16 @@ ntpsnmpd_SOURCES= netsnmp_daemonize.c ntpsnmpd.c ntpSnmpSubagentObject.c \ # 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 @@ -28,11 +31,14 @@ CLEANFILES= 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 diff --git a/parseutil/Makefile.am b/parseutil/Makefile.am index e06b34990..3dc7dc157 100644 --- a/parseutil/Makefile.am +++ b/parseutil/Makefile.am @@ -1,5 +1,5 @@ NULL= -#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies + AUTOMAKE_OPTIONS = BUILT_SOURCES = CLEANFILES = @@ -10,9 +10,11 @@ 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 +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 \ diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h index ab08935e5..8491b01a4 100644 --- a/ports/winnt/include/config.h +++ b/ports/winnt/include/config.h @@ -117,6 +117,7 @@ #include #include /* time_t for timeval decl */ #include +#include /* --------------------------------------------------------------------- * Above this line are #include lines and the few #define lines @@ -297,6 +298,7 @@ typedef int socklen_t; #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 */ @@ -361,11 +363,12 @@ typedef __int32 int32_t; /* define a typedef for int32_t */ # 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 @@ -377,7 +380,6 @@ typedef __int32 int32_t; /* define a typedef for int32_t */ # define HAVE_IO_COMPLETION_PORT # define ISC_PLATFORM_NEEDNTOP # define ISC_PLATFORM_NEEDPTON -# define HAVE_VPRINTF #define HAVE_LIMITS_H 1 #define HAVE_STRDUP @@ -416,8 +418,6 @@ typedef unsigned long uintptr_t; #define NEED_S_CHAR_TYPEDEF -#define USE_PROTOTYPES /* for ntp_types.h */ - /* Directory separator, usually / or \ */ #define DIR_SEP '\\' diff --git a/ports/winnt/libntp/syslog.c b/ports/winnt/libntp/syslog.c index c45bb3d01..b0a84ac92 100644 --- a/ports/winnt/libntp/syslog.c +++ b/ports/winnt/libntp/syslog.c @@ -26,6 +26,7 @@ #include #include +#include #include "messages.h" @@ -208,9 +209,10 @@ ntp_strerror( 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; } diff --git a/ports/winnt/scripts/mkver.bat b/ports/winnt/scripts/mkver.bat index 5a196f48c..e273de29d 100755 --- a/ports/winnt/scripts/mkver.bat +++ b/ports/winnt/scripts/mkver.bat @@ -237,13 +237,13 @@ REM **************************************************************************** :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\\ (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 diff --git a/scripts/genver b/scripts/genver index b41ce8c26..2b3d16210 100755 --- a/scripts/genver +++ b/scripts/genver @@ -12,8 +12,8 @@ do -f) force=1 ;; - version.m4) - outputs="version.m4 $outputs" + *version.m4) + outputs="m4/version.m4 $outputs" ;; *version.def) outputs="include/version.def $outputs" @@ -28,14 +28,14 @@ do 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 @@ -48,14 +48,14 @@ TEMPDIR=${TEMPDIR=/tmp} 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 ;; diff --git a/sntp/Makefile.am b/sntp/Makefile.am index 84af7397f..4f95d04d7 100644 --- a/sntp/Makefile.am +++ b/sntp/Makefile.am @@ -4,27 +4,35 @@ NULL = ## 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 @@ -54,7 +62,6 @@ sntp_SOURCES = \ $(NULL) EXTRA_DIST = \ - $(srcdir)/autogen-version.def \ bincheck.mf \ $(srcdir)/COPYRIGHT \ deps-ver \ @@ -66,23 +73,24 @@ EXTRA_DIST = \ 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 @@ -97,60 +105,40 @@ noinst_DATA= \ $(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 @@ -172,23 +160,23 @@ $(srcdir)/COPYRIGHT: check-COPYRIGHT $(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) diff --git a/sntp/configure.ac b/sntp/configure.ac index f09c72b7c..7b795d990 100644 --- a/sntp/configure.ac +++ b/sntp/configure.ac @@ -1,10 +1,10 @@ # -*- 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 @@ -47,96 +47,16 @@ AC_DEFINE_UNQUOTED([STR_SYSTEM], "$host", [canonical system (cpu-vendor-os) of w 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: @@ -153,59 +73,9 @@ case "${enable_libopts_install+set}" in 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]) @@ -228,79 +98,9 @@ esac # 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 - #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 - #endif - #include - ]], - [[ - ]] - )], - [ - 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. @@ -350,242 +150,7 @@ esac 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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #endif - #ifdef HAVE_SYS_SOCKET_H - # include - #endif - #ifdef HAVE_NETINET_IN_H - # include - #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 - #include - ]], - [[ - 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], @@ -644,287 +209,6 @@ AC_CHECK_FUNC([inet_ntop], [], 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 - #include - ]], - [[ - 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 - #include - #include - ]], - [[ - 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 " - ;; - *) - 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 " - ;; - *) - 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 - #include - #include - $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 - #include - #include - $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 - #include - #include - $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 - #include - ]], - [[ - 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 - #include - ]], - [[ - 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 - ### @@ -936,35 +220,11 @@ AC_DEFINE([HAVE_TERMIOS], 1, [sntp does not care about TTY stuff]) # 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 diff --git a/sntp/include/Makefile.am b/sntp/include/Makefile.am new file mode 100644 index 000000000..8628a9424 --- /dev/null +++ b/sntp/include/Makefile.am @@ -0,0 +1,18 @@ +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 diff --git a/include/autogen-version.def b/sntp/include/autogen-version.def similarity index 100% rename from include/autogen-version.def rename to sntp/include/autogen-version.def diff --git a/include/copyright.def b/sntp/include/copyright.def similarity index 86% rename from include/copyright.def rename to sntp/include/copyright.def index 978e89a13..b14a38664 100644 --- a/include/copyright.def +++ b/sntp/include/copyright.def @@ -14,7 +14,7 @@ environrc; 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`; diff --git a/include/debug-opt.def b/sntp/include/debug-opt.def similarity index 100% rename from include/debug-opt.def rename to sntp/include/debug-opt.def diff --git a/include/homerc.def b/sntp/include/homerc.def similarity index 100% rename from include/homerc.def rename to sntp/include/homerc.def diff --git a/m4/define_dir.m4 b/sntp/m4/define_dir.m4 similarity index 100% rename from m4/define_dir.m4 rename to sntp/m4/define_dir.m4 diff --git a/m4/ntp_cacheversion.m4 b/sntp/m4/ntp_cacheversion.m4 similarity index 100% rename from m4/ntp_cacheversion.m4 rename to sntp/m4/ntp_cacheversion.m4 diff --git a/m4/ntp_dir_sep.m4 b/sntp/m4/ntp_dir_sep.m4 similarity index 100% rename from m4/ntp_dir_sep.m4 rename to sntp/m4/ntp_dir_sep.m4 diff --git a/m4/ntp_googletest.m4 b/sntp/m4/ntp_googletest.m4 similarity index 100% rename from m4/ntp_googletest.m4 rename to sntp/m4/ntp_googletest.m4 diff --git a/sntp/m4/ntp_ipv6.m4 b/sntp/m4/ntp_ipv6.m4 new file mode 100644 index 000000000..1c6f21eb2 --- /dev/null +++ b/sntp/m4/ntp_ipv6.m4 @@ -0,0 +1,527 @@ +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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + #ifdef HAVE_NETINET_IN_H + # include + #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 + #include + ]], + [[ + 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 + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #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 + #include + ]], + [[ + 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 + #include + #include + ]], + [[ + 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 " + ;; + *) + 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 " + ;; + *) + 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 + #include + #include + $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 + #include + #include + $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 + #include + #include + $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 + #include + ]], + [[ + 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 + #include + ]], + [[ + 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 ====================================================================== diff --git a/m4/ntp_lib_m.m4 b/sntp/m4/ntp_lib_m.m4 similarity index 100% rename from m4/ntp_lib_m.m4 rename to sntp/m4/ntp_lib_m.m4 diff --git a/sntp/m4/ntp_libntp.m4 b/sntp/m4/ntp_libntp.m4 new file mode 100644 index 000000000..044747597 --- /dev/null +++ b/sntp/m4/ntp_libntp.m4 @@ -0,0 +1,281 @@ +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 + #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 + #endif + #include + ]], + [[ + ]] + )], + [ + 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 ====================================================================== diff --git a/m4/ntp_lineeditlibs.m4 b/sntp/m4/ntp_lineeditlibs.m4 similarity index 100% rename from m4/ntp_lineeditlibs.m4 rename to sntp/m4/ntp_lineeditlibs.m4 diff --git a/m4/ntp_openssl.m4 b/sntp/m4/ntp_openssl.m4 similarity index 93% rename from m4/ntp_openssl.m4 rename to sntp/m4/ntp_openssl.m4 index fba569395..2c799a5c4 100644 --- a/m4/ntp_openssl.m4 +++ b/sntp/m4/ntp_openssl.m4 @@ -2,6 +2,9 @@ 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( @@ -212,7 +215,7 @@ case "$ntp_openssl" in /usr/include) ;; *) - CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC" + CPPFLAGS_NTP="$CPPFLAGS_NTP -I$OPENSSL_INC" ;; esac case "$OPENSSL_LIB" in @@ -226,17 +229,20 @@ case "$ntp_openssl" 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], @@ -282,8 +288,6 @@ case "$ntp_openssl" in LCRYPTO="$LCRYPTO -lz" esac esac - LIBS="$NTPO_SAVED_LIBS" - AS_UNSET([NTPO_SAVED_LIBS]) esac # @@ -345,16 +349,22 @@ case "$GCC$ntp_openssl" in 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 ====================================================================== diff --git a/m4/ntp_vpathhack.m4 b/sntp/m4/ntp_vpathhack.m4 similarity index 100% rename from m4/ntp_vpathhack.m4 rename to sntp/m4/ntp_vpathhack.m4 diff --git a/m4/os_cflags.m4 b/sntp/m4/os_cflags.m4 similarity index 97% rename from m4/os_cflags.m4 rename to sntp/m4/os_cflags.m4 index 7fac93bd1..f1865e61a 100644 --- a/m4/os_cflags.m4 +++ b/sntp/m4/os_cflags.m4 @@ -7,7 +7,7 @@ AC_DEFUN([NTP_OS_CFLAGS], [ set) ;; *) - ntp_os_cflags="" + ntp_os_cflags= case "$host_os" in aix[[1-3]]*) ;; @@ -91,8 +91,8 @@ AC_DEFUN([NTP_OS_CFLAGS], [ ;; *) 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]) ]) diff --git a/sntp/tests/Makefile.am b/sntp/tests/Makefile.am index bd4092309..96147d647 100644 --- a/sntp/tests/Makefile.am +++ b/sntp/tests/Makefile.am @@ -1,6 +1,9 @@ NULL = -check_PROGRAMS = tests +check_PROGRAMS = +if BUILD_SNTP +check_PROGRAMS += tests +endif sntp_objs = .. @@ -50,10 +53,12 @@ LDADD = $(LIBOPTS_LDADD) \ @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 @@ -70,6 +75,6 @@ TEST_OUTPUT_DIR = $(abs_builddir)/data TESTS_ENVIRONMENT = $(top_srcdir)/tests/test-driver $(TEST_INPUT_DIR) $(TEST_OUTPUT_DIR) -if !SNTP_CROSSCOMPILE +if !NTP_CROSSCOMPILE TESTS += $(check_PROGRAMS) endif diff --git a/tests/libntp/Makefile.am b/tests/libntp/Makefile.am index 7f8ec4415..ff49c0ef9 100644 --- a/tests/libntp/Makefile.am +++ b/tests/libntp/Makefile.am @@ -1,7 +1,18 @@ +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 \ @@ -51,7 +62,7 @@ INCLUDES += -I$(top_srcdir)/lib/isc/nothreads/include INCLUDES += -I$(top_srcdir)/lib/isc/unix/include INCLUDES += -I$(top_srcdir)/sntp -TESTS = +TESTS = if !NTP_CROSSCOMPILE TESTS += tests diff --git a/util/Makefile.am b/util/Makefile.am index 86388dd38..b1d82cc8a 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -12,9 +12,14 @@ endif 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 @@ -31,12 +36,14 @@ DISTCLEANFILES= .version version.c 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 @@ -64,11 +71,11 @@ jitter_LDADD= 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