]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Add configure --without-sntp option to disable building sntp and
authorDave Hart <hart@ntp.org>
Wed, 12 Jan 2011 05:23:49 +0000 (05:23 +0000)
committerDave Hart <hart@ntp.org>
Wed, 12 Jan 2011 05:23:49 +0000 (05:23 +0000)
  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

49 files changed:
ChangeLog
Makefile.am
adjtimed/Makefile.am
bootstrap
build
clockstuff/Makefile.am
configure.ac
excludes [deleted file]
flock-build
include/Makefile.am
include/lib_strbuf.h
include/ntp_stdlib.h
kernel/Makefile.am
kernel/sys/Makefile.am
libntp/Makefile.am
libntp/lib_strbuf.c
libntp/msyslog.c
libparse/Makefile.am
ntpd/Makefile.am
ntpdate/Makefile.am
ntpdc/Makefile.am
ntpq/Makefile.am
ntpsnmpd/Makefile.am
parseutil/Makefile.am
ports/winnt/include/config.h
ports/winnt/libntp/syslog.c
ports/winnt/scripts/mkver.bat
scripts/genver
sntp/Makefile.am
sntp/configure.ac
sntp/include/Makefile.am [new file with mode: 0644]
sntp/include/autogen-version.def [moved from include/autogen-version.def with 100% similarity]
sntp/include/copyright.def [moved from include/copyright.def with 86% similarity]
sntp/include/debug-opt.def [moved from include/debug-opt.def with 100% similarity]
sntp/include/homerc.def [moved from include/homerc.def with 100% similarity]
sntp/m4/define_dir.m4 [moved from m4/define_dir.m4 with 100% similarity]
sntp/m4/ntp_cacheversion.m4 [moved from m4/ntp_cacheversion.m4 with 100% similarity]
sntp/m4/ntp_dir_sep.m4 [moved from m4/ntp_dir_sep.m4 with 100% similarity]
sntp/m4/ntp_googletest.m4 [moved from m4/ntp_googletest.m4 with 100% similarity]
sntp/m4/ntp_ipv6.m4 [new file with mode: 0644]
sntp/m4/ntp_lib_m.m4 [moved from m4/ntp_lib_m.m4 with 100% similarity]
sntp/m4/ntp_libntp.m4 [new file with mode: 0644]
sntp/m4/ntp_lineeditlibs.m4 [moved from m4/ntp_lineeditlibs.m4 with 100% similarity]
sntp/m4/ntp_openssl.m4 [moved from m4/ntp_openssl.m4 with 93% similarity]
sntp/m4/ntp_vpathhack.m4 [moved from m4/ntp_vpathhack.m4 with 100% similarity]
sntp/m4/os_cflags.m4 [moved from m4/os_cflags.m4 with 97% similarity]
sntp/tests/Makefile.am
tests/libntp/Makefile.am
util/Makefile.am

index a9846c1cbc3bc02da8ead972fdc754490ab03bda..c607810f8469eb475fb5b2e9c86a4a4cde8e153b 100644 (file)
--- 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 <stenn@ntp.org>
 * refclock_nmea.c refactoring by Juergen Perlinger.
 (4.2.7p115) 2011/01/09 Released by Harlan Stenn <stenn@ntp.org>
index 4ab08f87fdcc30ebe6a130d147d53287a07661c7..502f2db3f0d4c27735cae7e8d169f46f25e3068b 100644 (file)
@@ -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?
index c97a08a7dfa5f34c1fbd5d1fc0c4ad0bd8c94447..1ab50cff4bd296f5b211f14798adc07564e9a62b 100644 (file)
@@ -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
 
index 01e36d35cb8cb2509df87f38f46909b65035376d..e837f74fe5f3da5947928e9c9fb387a28941e5c9 100755 (executable)
--- 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 18e223c7adf206ab2d04f5b31b07c21e033c4717..9f26752cf6a11c2510e4fb5448e6411e475de41a 100755 (executable)
--- 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
index 0ab3cfa7fe1265a7768c9b154523267f9f3a620f..c235b2333f365c98e7d89cbfd6b9f9985bb3e6a1 100644 (file)
@@ -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
index e1667f59afa39936e028c1692463446327edaa51..8c19e08a4830131f2be61163d994b777bef71c05 100644 (file)
@@ -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 <sys/socket.h>
-    #endif
-])
-case "$host" in
- *-hp-hpux*)
-    AC_CACHE_CHECK(
-       [if net/if.h requires mpinfou predeclaration],
-       [ntp_cv_predecl_mpinfou],
-       [
-           np_cv_predecl_mpinfou=no
-           case "$ac_cv_header_net_if_h" in
-            no)
-               AC_COMPILE_IFELSE(
-                   [AC_LANG_PROGRAM(
-                       [[
-                           typedef union mpinfou {
-                                   struct pdk_mpinfo *pdkptr;
-                                   struct mpinfo *pikptr;
-                           } mpinfou_t;
-                           #ifdef HAVE_SYS_SOCKET_H
-                           # include <sys/socket.h>
-                           #endif
-                           #include <net/if.h>
-                       ]],
-                       [[
-                       ]]
-                   )],
-                   [
-                       ntp_cv_predecl_mpinfou=yes
-                       ac_cv_header_net_if_h=yes
-                   ]
-               )
-           esac
-       ]
-    )
-    case "$ntp_cv_predecl_mpinfou" in
-     yes)
-       cat >>confdefs.h <<_ACEOF
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
-       struct pdk_mpinfo *pdkptr;
-       struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-_ACEOF
-       AH_BOTTOM([
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
-       struct pdk_mpinfo *pdkptr;
-       struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-])
-    esac
-esac
 
 AC_CHECK_HEADERS([net/if6.h])
 AC_CHECK_HEADERS([net/route.h], [], [], [
@@ -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 <sys/types.h>
-               #endif
-               #ifdef HAVE_SYS_SOCKET_H
-               # include <sys/socket.h>
-               #endif
-               #ifdef HAVE_NETINET_IN_H
-               # include <netinet/in.h>
-               #endif
-           ]],
-           [[
-               struct sockaddr_storage n;
-           ]]
-       )],
-       [ntp_cv_sockaddr_storage=yes],
-       [ntp_cv_sockaddr_storage=no]
-    )]
-)
-case "$ntp_cv_sockaddr_storage" in
- yes)
-    AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
-       [Does a system header define struct sockaddr_storage?])
-esac
-
-AC_CACHE_CHECK(
-    [for sockaddr_storage.ss_family],
-    [ntp_cv_have_ss_family],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #ifdef HAVE_SYS_TYPES_H
-               # include <sys/types.h>
-               #endif
-               #ifdef HAVE_SYS_SOCKET_H
-               # include <sys/socket.h>
-               #endif
-               #ifdef HAVE_NETINET_IN_H
-               # include <netinet/in.h>
-               #endif
-           ]],
-           [[
-               struct sockaddr_storage s;
-               s.ss_family = 1;
-           ]]
-       )],
-       [ntp_cv_have_ss_family=yes],
-       [ntp_cv_have_ss_family=no]
-    )]
-)
-
-case "$ntp_cv_have_ss_family" in
- no)
-    AC_CACHE_CHECK(
-       [for sockaddr_storage.__ss_family],
-       [ntp_cv_have___ss_family],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #ifdef HAVE_SYS_TYPES_H
-                   # include <sys/types.h>
-                   #endif
-                   #ifdef HAVE_SYS_SOCKET_H
-                   # include <sys/socket.h>
-                   #endif
-                   #ifdef HAVE_NETINET_IN_H
-                   # include <netinet/in.h>
-                   #endif
-               ]],
-               [[
-                   struct sockaddr_storage s;
-                   s.__ss_family = 1;
-               ]]
-           )],
-           [ntp_cv_have___ss_family=yes],
-           [ntp_cv_have___ss_family=no]
-       )]
-    )
-    case "$ntp_cv_have___ss_family" in
-     yes)
-       AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
-           [Does struct sockaddr_storage have __ss_family?])
-    esac
-    ;;
-esac
-
-AH_VERBATIM(
-    [HAVE___SS_FAMILY_IN_SS_VERBATIM],
-    [
-       /* Handle sockaddr_storage.__ss_family */
-       #ifdef HAVE___SS_FAMILY_IN_SS
-       # define ss_family __ss_family
-       #endif /* HAVE___SS_FAMILY_IN_SS */
-    ]
-)
-
-AC_CACHE_CHECK(
-    [for sockaddr_storage.ss_len],
-    [ntp_cv_have_ss_len],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #ifdef HAVE_SYS_TYPES_H
-               # include <sys/types.h>
-               #endif
-               #ifdef HAVE_SYS_SOCKET_H
-               # include <sys/socket.h>
-               #endif
-               #ifdef HAVE_NETINET_IN_H
-               # include <netinet/in.h>
-               #endif
-           ]],
-           [[
-               struct sockaddr_storage s;
-               s.ss_len = 1;
-           ]]
-       )],
-       [ntp_cv_have_ss_len=yes],
-       [ntp_cv_have_ss_len=no]
-    )]
-)
-
-case "$ntp_cv_have_ss_len" in
- no)
-    AC_CACHE_CHECK(
-       [for sockaddr_storage.__ss_len],
-       [ntp_cv_have___ss_len],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #ifdef HAVE_SYS_TYPES_H
-                   # include <sys/types.h>
-                   #endif
-                   #ifdef HAVE_SYS_SOCKET_H
-                   # include <sys/socket.h>
-                   #endif
-                   #ifdef HAVE_NETINET_IN_H
-                   # include <netinet/in.h>
-                   #endif
-               ]],
-               [[
-                   struct sockaddr_storage s;
-                   s.__ss_len = 1;
-               ]]
-           )],
-           [ntp_cv_have___ss_len=yes],
-           [ntp_cv_have___ss_len=no]
-       )]
-    )
-    case "$ntp_cv_have___ss_len" in
-     yes)
-       AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
-           [Does struct sockaddr_storage have __ss_len?])
-    esac
-    ;;
-esac
-
-AH_VERBATIM(
-    [HAVE___SS_LEN_IN_SS_VERBATIM],
-    [
-       /* Handle sockaddr_storage.__ss_len */
-       #ifdef HAVE___SS_LEN_IN_SS
-       # define ss_len __ss_len
-       #endif /* HAVE___SS_LEN_IN_SS */
-    ]
-)
-
-#
-# Look for in_port_t.
-#
-AC_CACHE_CHECK(
-    [for in_port_t],
-    [isc_cv_have_in_port_t],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <netinet/in.h>
-           ]],
-           [[
-               in_port_t port = 25; 
-               return (0);
-           ]]
-       )],
-       [isc_cv_have_in_port_t=yes],
-       [isc_cv_have_in_port_t=no]
-    )]
-)
-case "$isc_cv_have_in_port_t" in
- no)
-       AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
-           [Declare in_port_t?])
-esac
-
 case "$ac_cv_header_machine_soundcard_h$ac_cv_header_sys_soundcard_h" in
   *yes*)
     AC_CACHE_CHECK(
@@ -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 <sys/types.h>
-                       #endif
-                       #ifdef HAVE_SYS_SOCKET_H
-                       # include <sys/socket.h>
-                       #endif
-                   ]], [[
-                       extern
-                       getsockname(int, $getsockname_arg2, 
-                               $ntp_cv_getsockname_socklen_type *);
-                   ]]
-               )],
-               [getsockname_socklen_type_found=yes ; break 2],
-               []
-           )
-       done
-    done
-    case "$getsockname_socklen_type_found" in
-     no)
-       ntp_cv_getsockname_socklen_type='socklen_t'
-    esac
-    AS_UNSET([getsockname_arg2])
-    AS_UNSET([getsockname_socklen_type_found])
-    ]
-)
-AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
-                  [$ntp_cv_getsockname_socklen_type],
-                  [What is getsockname()'s socklen type?])
-
 AC_CHECK_FUNCS([getuid getrusage hstrerror])
 AC_CHECK_FUNC([gettimeofday], [], [
 case "$host" in
@@ -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 <sys/types.h>
-               #include <sys/socket.h>
-           ]],
-           [[
-               extern struct sockaddr *ps;
-               return ps->sa_len;
-           ]]
-       )],
-       [isc_cv_platform_havesalen=yes],
-       [isc_cv_platform_havesalen=no]
-    )]
-)
-case "$isc_cv_platform_havesalen" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
-        [struct sockaddr has sa_len?])
-esac
-
-AC_ARG_ENABLE(
-    [ipv6],
-    [AS_HELP_STRING(
-       [--enable-ipv6],
-       [s use IPv6?]
-    )]
-)
-
-case "$enable_ipv6" in
- yes|''|autodetect)
-    case "$host" in
-     powerpc-ibm-aix4*)
-       ;;
-     *)
-       AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
-       ;;
-    esac
-    ;;
- no)
-    ;;
-esac
-
+NTP_IPV6
 
-AC_CACHE_CHECK(
-    [for IPv6 structures],
-    [isc_cv_found_ipv6],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <sys/socket.h>
-               #include <netinet/in.h>
-           ]],
-           [[
-               struct sockaddr_in6 sin6;
-           ]]
-       )],
-       [isc_cv_found_ipv6=yes],
-       [isc_cv_found_ipv6=no]
-    )]
-)
-
-#
-# See whether IPv6 support is provided via a Kame add-on.
-# This is done before other IPv6 linking tests so LIBS is properly set.
-#
-AC_MSG_CHECKING([for Kame IPv6 support])
-AC_ARG_WITH(
-    [kame],
-    [AS_HELP_STRING(
-       [--with-kame],
-       [- =/usr/local/v6]
-    )],
-    [use_kame="$withval"],
-    [use_kame="no"]
-)
-case "$use_kame" in
- no)
-    ;;
- yes)
-    kame_path=/usr/local/v6
-    ;;
- *)
-    kame_path="$use_kame"
-    ;;
-esac
-case "$use_kame" in
- no)
-    AC_MSG_RESULT([no])
-    ;;
- *)
-    if test -f $kame_path/lib/libinet6.a; then
-       AC_MSG_RESULT([$kame_path/lib/libinet6.a])
-       LIBS="-L$kame_path/lib -linet6 $LIBS"
-    else
-       AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
-
-Please choose the proper path with the following command:
-
-    configure --with-kame=PATH
-])
-    fi
-    ;;
-esac
-
-#
-# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
-# Including it on Kame-using platforms is very bad, though, because
-# Kame uses #error against direct inclusion.   So include it on only
-# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
-# This is done before the in6_pktinfo check because that's what
-# netinet6/in6.h is needed for.
-#
-case "$host" in
- *-bsdi4.[[01]]*)
-    AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
-       [Do we need netinet6/in6.h?])
-    isc_netinet6in6_hack="#include <netinet6/in6.h>"
-    ;;
- *)
-    isc_netinet6in6_hack=""
-    ;;
-esac
-
-#
-# This is similar to the netinet6/in6.h issue.
-#
-case "$host" in
- *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
-    AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
-       [Do we need to fix in6isaddr?])
-    isc_netinetin6_hack="#include <netinet/in6.h>"
-    ;;
- *)
-    isc_netinetin6_hack=""
-    ;;
-esac
-
-
-case "$isc_cv_found_ipv6" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
-    AC_CACHE_CHECK(
-       [for in6_pktinfo],
-       [isc_cv_have_in6_pktinfo],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #include <sys/types.h>
-                   #include <sys/socket.h>
-                   #include <netinet/in.h>
-                   $isc_netinetin6_hack
-                   $isc_netinet6in6_hack
-               ]],
-               [[
-                   struct in6_pktinfo xyzzy;
-               ]]
-           )],
-           [isc_cv_have_in6_pktinfo=yes],
-           [isc_cv_have_in6_pktinfo=no]
-       )]
-    )
-    case "$isc_cv_have_in6_pktinfo" in
-     yes)
-       AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
-               [have struct in6_pktinfo?])
-    esac
-
-
-    # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
-    AC_CACHE_CHECK(
-       [for sockaddr_in6.sin6_scope_id],
-       [isc_cv_have_sin6_scope_id],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #include <sys/types.h>
-                   #include <sys/socket.h>
-                   #include <netinet/in.h>
-                   $isc_netinetin6_hack
-                   $isc_netinet6in6_hack
-               ]],
-               [[
-                   struct sockaddr_in6 xyzzy;
-                   xyzzy.sin6_scope_id = 0;
-               ]]
-           )],
-           [isc_cv_have_sin6_scope_id=yes],
-           [isc_cv_have_sin6_scope_id=no]
-       )]
-    )
-
-    case "$isc_cv_have_sin6_scope_id" in
-     yes)
-       AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
-    esac
-    ;;
-esac
-
-
-# We need this check run even without isc_cv_found_ipv6=yes
-
-AC_CACHE_CHECK(
-    [for in6addr_any],
-    [isc_cv_have_in6addr_any],
-    [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <sys/socket.h>
-               #include <netinet/in.h>
-               $isc_netinetin6_hack
-               $isc_netinet6in6_hack
-           ]],
-           [[
-               struct in6_addr in6; 
-               in6 = in6addr_any;
-           ]]
-       )],
-       [isc_cv_have_in6addr_any=yes],
-       [isc_cv_have_in6addr_any=no]
-    )]
-)
-
-case "$isc_cv_have_in6addr_any" in
- no)
-    AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
-esac
-
-
-AC_CACHE_CHECK(
-    [for struct if_laddrconf],
-    [isc_cv_struct_if_laddrconf],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <net/if6.h>
-           ]],
-           [[
-               struct if_laddrconf a;
-           ]]
-       )],
-       [isc_cv_struct_if_laddrconf=yes],
-       [isc_cv_struct_if_laddrconf=no]
-    )]
-)
-
-case "$isc_cv_struct_if_laddrconf" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
-       [have struct if_laddrconf?])
-esac
-
-AC_CACHE_CHECK(
-    [for struct if_laddrreq],
-    [isc_cv_struct_if_laddrreq],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <net/if6.h>
-           ]],
-           [[
-               struct if_laddrreq a;
-           ]]
-       )],
-       [isc_cv_struct_if_laddrreq=yes],
-       [isc_cv_struct_if_laddrreq=no]
-    )]
-)
-
-case "$isc_cv_struct_if_laddrreq" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
-       [have struct if_laddrreq?])
-esac
 
 #
 # Look for a sysctl call to get the list of network interfaces.
diff --git a/excludes b/excludes
deleted file mode 100644 (file)
index 36cb351..0000000
--- a/excludes
+++ /dev/null
@@ -1 +0,0 @@
-*.obj *.pch *.bsc *.pdb *.sbr nt*.zip *.tar *.gz *.ilk beta*.zip
index 83dadea5305acea4e103b5879e99a17bc478bc73..245071d8e6e7070125bf15d05bd3d050535031fa 100755 (executable)
@@ -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
index 56f931a2545ad1ef344a6499ef24a09a57cba68a..82f81db487b6a4fdc49d5f8b282dab80cf50dbf1 100644 (file)
@@ -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
 
index 6242cc9583f74fa7bd6e2b4ee7063d0ef2c5e73c..b114ab8197c1028cde6d3045af2f0652568b0b94 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include <ntp_types.h>
+#include <ntp_malloc.h>                        /* 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);          \
index 7b23dff3e5d787d6b6836641f151d155c8885f68..b147be06a6d7afb348bff87aba9152e70d1b2460 100644 (file)
@@ -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
index 8508029cd58781060e94331cc79597a13a7610d4..c9cf385a7e7a30f384ca3dc10fe9c7bb903b5357 100644 (file)
@@ -1,4 +1,3 @@
-#AUTOMAKE_OPTIONS = ../util/ansi2knr no-dependencies
 AUTOMAKE_OPTIONS = 
 SUBDIRS = sys
 ETAGS_ARGS = Makefile.am
index 417111406a024daba65825abb7ae9407d9270378..0fce1f71e3c640c6b40d4c5955d10f4feea569ed 100644 (file)
@@ -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
index af0220015602e2b7444ac053635fffad2e4d1a96..79ee44d08fc38016f5dac4180aef7183d149577f 100644 (file)
@@ -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
 
index a482fe08a074a738e6edfcedb7f363db36b3850b..bdb3ace00db3b84ae4c29cecf48c05dcaf12f603 100644 (file)
@@ -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;
 }
index b6d9d72a335cbdd32b4fa55b11be5e86b58eb319..d90e728503018815db1ec4449977f8a9f5f84aac 100644 (file)
@@ -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;
                }
        }
index d6b9da394ae1fe417ba7b522afbb91257feafec8..7d2e1fda105826216270a226c1986ded4efb4094 100644 (file)
@@ -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
 
index 8b1c1c2abc1f1553cd84c71d9bc062a57806c0b3..54647e15408cc8cc5e376a7323bd60c58cac97e3 100644 (file)
@@ -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
index 06987e4663acfc3af1e3bbd33c73abb183936f79..bfb345ea756fa3d7252322cd6004e7e16863124b 100644 (file)
@@ -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
index 00aeffb8033dc5360d2a75bf61188acab3e9892e..5ed79104aac23c355c60eb6b5693ea101b9017a5 100644 (file)
@@ -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
index 5f392ba7b0279fca9824b50ceee7b3a21455e2b0..1346602b456ef8defce13468bc2fa58502ccc40c 100644 (file)
@@ -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
index 168de27873100ab67394f978e0aab5073542038a..e13eedf670a83b84bcc11c79e381033f0601df8a 100644 (file)
@@ -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
index e06b34990d755052969ea711539da12bdd8e20ed..3dc7dc1570effeefbe47457ec283167e17548793 100644 (file)
@@ -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    \
index ab08935e5fbe0bcfb8ca8ede84d0c420ddd7bb6a..8491b01a4b8e8b4201680454be9a0dc8ae170f92 100644 (file)
 #include <process.h>
 #include <time.h>              /* time_t for timeval decl */
 #include <io.h>
+#include <isc/strerror.h>
 
 /* ---------------------------------------------------------------------
  * Above this line are #include lines and the few #define lines
@@ -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 '\\'
 
index c45bb3d01d8f435a4827e384bda404d3a4853c5b..b0a84ac9286696d4a9c8915d4971dfeaeeb5e3d8 100644 (file)
@@ -26,6 +26,7 @@
 #include <syslog.h>
 
 #include <isc/strerror.h>
+#include <lib_strbuf.h>
 
 #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;
 }
index 5a196f48c3a78bbd01931be3a7e3fdb8967cc43a..e273de29d46cbccb91aca832463be0dea4ba84ea 100755 (executable)
@@ -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\<compiler dir>\<binary name dir> (ports\winnt\vs2008\ntpd)
-       IF EXIST ..\..\..\version ( 
-               IF "%CSET%"=="" FOR /F "TOKENS=1" %%a IN ('type ..\..\..\version') DO @SET CSET=%%a
+       IF EXIST ..\..\..\sntp\version (
+               IF "%CSET%"=="" FOR /F "TOKENS=1" %%a IN ('type ..\..\..\sntp\version') DO @SET CSET=%%a
        )
 
        REM ** Now, expand our version number with the CSet revision, if we managed to get one
index b41ce8c2657fb86364da9a4ef85b65a34f4d4f94..2b3d162107f12c86abad164448ed218af95f799d 100755 (executable)
@@ -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
     ;;
index 84af7397f258e049c6194cee15a7060a02c77162..4f95d04d78a95fe7e970b79971cbff2293a8a21a 100644 (file)
@@ -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)
index f09c72b7cc49f7f450de53c7bceebdd221fb45cb..7b795d99068626f1c889e774beb4fdedcb352ad9 100644 (file)
@@ -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 <sys/socket.h>
-    #endif
-])
-case "$host" in
- *-hp-hpux*)
-    AC_CACHE_CHECK(
-       [if net/if.h requires mpinfou predeclaration],
-       [ntp_cv_predecl_mpinfou],
-       [
-           np_cv_predecl_mpinfou=no
-           case "$ac_cv_header_net_if_h" in
-            no)
-               AC_COMPILE_IFELSE(
-                   [AC_LANG_PROGRAM(
-                       [[
-                           typedef union mpinfou {
-                                   struct pdk_mpinfo *pdkptr;
-                                   struct mpinfo *pikptr;
-                           } mpinfou_t;
-                           #ifdef HAVE_SYS_SOCKET_H
-                           # include <sys/socket.h>
-                           #endif
-                           #include <net/if.h>
-                       ]],
-                       [[
-                       ]]
-                   )],
-                   [
-                       ntp_cv_predecl_mpinfou=yes
-                       ac_cv_header_net_if_h=yes
-                   ]
-               )
-           esac
-       ]
-    )
-    case "$ntp_cv_predecl_mpinfou" in
-     yes)
-       cat >>confdefs.h <<_ACEOF
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
-       struct pdk_mpinfo *pdkptr;
-       struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-_ACEOF
-       AH_BOTTOM([
-#ifndef MPINFOU_PREDECLARED
-# define MPINFOU_PREDECLARED
-typedef union mpinfou {
-       struct pdk_mpinfo *pdkptr;
-       struct mpinfo *pikptr;
-} mpinfou_t;
-#endif
-])
-    esac
-esac
 
 AC_CHECK_HEADERS([netdb.h netinet/in.h stdlib.h string.h strings.h syslog.h])
-AC_CHECK_HEADERS([sys/socket.h sys/time.h])
+AC_CHECK_HEADERS([sys/time.h])
 AC_HEADER_TIME
 
 # Checks for typedefs, structures, and compiler characteristics.
@@ -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 <sys/types.h>
-                       #endif
-                       #ifdef HAVE_SYS_SOCKET_H
-                       # include <sys/socket.h>
-                       #endif
-                   ]], [[
-                       extern
-                       getsockname(int, $getsockname_arg2, 
-                               $ntp_cv_getsockname_socklen_type *);
-                   ]]
-               )],
-               [getsockname_socklen_type_found=yes ; break 2],
-               []
-           )
-       done
-    done
-    case "$getsockname_socklen_type_found" in
-     no)
-       ntp_cv_getsockname_socklen_type='socklen_t'
-    esac
-    AS_UNSET([getsockname_arg2])
-    AS_UNSET([getsockname_socklen_type_found])
-    ]
-)
-AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
-                  $ntp_cv_getsockname_socklen_type,
-                  [What is getsockname()'s socklen type?])
-
-AC_CACHE_CHECK(
-    [for struct sockaddr_storage],
-    [ntp_cv_sockaddr_storage],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #ifdef HAVE_SYS_TYPES_H
-               # include <sys/types.h>
-               #endif
-               #ifdef HAVE_SYS_SOCKET_H
-               # include <sys/socket.h>
-               #endif
-               #ifdef HAVE_NETINET_IN_H
-               # include <netinet/in.h>
-               #endif
-           ]],
-           [[
-               struct sockaddr_storage n;
-           ]]
-       )],
-       [ntp_cv_sockaddr_storage=yes],
-       [ntp_cv_sockaddr_storage=no]
-    )]
-)
-case "$ntp_cv_sockaddr_storage" in
- yes)
-    AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
-       [Does a system header define struct sockaddr_storage?])
-esac
-
-AC_CACHE_CHECK(
-    [for sockaddr_storage.ss_family],
-    [ntp_cv_have_ss_family],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #ifdef HAVE_SYS_TYPES_H
-               # include <sys/types.h>
-               #endif
-               #ifdef HAVE_SYS_SOCKET_H
-               # include <sys/socket.h>
-               #endif
-               #ifdef HAVE_NETINET_IN_H
-               # include <netinet/in.h>
-               #endif
-           ]],
-           [[
-               struct sockaddr_storage s;
-               s.ss_family = 1;
-           ]]
-       )],
-       [ntp_cv_have_ss_family=yes],
-       [ntp_cv_have_ss_family=no]
-    )]
-)
-
-case "$ntp_cv_have_ss_family" in
- no)
-    AC_CACHE_CHECK(
-       [for sockaddr_storage.__ss_family],
-       [ntp_cv_have___ss_family],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #ifdef HAVE_SYS_TYPES_H
-                   # include <sys/types.h>
-                   #endif
-                   #ifdef HAVE_SYS_SOCKET_H
-                   # include <sys/socket.h>
-                   #endif
-                   #ifdef HAVE_NETINET_IN_H
-                   # include <netinet/in.h>
-                   #endif
-               ]],
-               [[
-                   struct sockaddr_storage s;
-                   s.__ss_family = 1;
-               ]]
-           )],
-           [ntp_cv_have___ss_family=yes],
-           [ntp_cv_have___ss_family=no]
-       )]
-    )
-    case "$ntp_cv_have___ss_family" in
-     yes)
-       AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
-           [Does struct sockaddr_storage have __ss_family?])
-    esac
-esac
-
-AH_VERBATIM(
-    [HAVE___SS_FAMILY_IN_SS_VERBATIM],
-    [
-       /* Handle sockaddr_storage.__ss_family */
-       #ifdef HAVE___SS_FAMILY_IN_SS
-       # define ss_family __ss_family
-       #endif /* HAVE___SS_FAMILY_IN_SS */
-    ]
-)
-
-AC_CACHE_CHECK(
-    [for sockaddr_storage.ss_len],
-    [ntp_cv_have_ss_len],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #ifdef HAVE_SYS_TYPES_H
-               # include <sys/types.h>
-               #endif
-               #ifdef HAVE_SYS_SOCKET_H
-               # include <sys/socket.h>
-               #endif
-               #ifdef HAVE_NETINET_IN_H
-               # include <netinet/in.h>
-               #endif
-           ]],
-           [[
-               struct sockaddr_storage s;
-               s.ss_len = 1;
-           ]]
-       )],
-       [ntp_cv_have_ss_len=yes],
-       [ntp_cv_have_ss_len=no]
-    )]
-)
-
-case "$ntp_cv_have_ss_len" in
- no)
-    AC_CACHE_CHECK(
-       [for sockaddr_storage.__ss_len],
-       [ntp_cv_have___ss_len],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #ifdef HAVE_SYS_TYPES_H
-                   # include <sys/types.h>
-                   #endif
-                   #ifdef HAVE_SYS_SOCKET_H
-                   # include <sys/socket.h>
-                   #endif
-                   #ifdef HAVE_NETINET_IN_H
-                   # include <netinet/in.h>
-                   #endif
-               ]],
-               [[
-                   struct sockaddr_storage s;
-                   s.__ss_len = 1;
-               ]]
-           )],
-           [ntp_cv_have___ss_len=yes],
-           [ntp_cv_have___ss_len=no]
-       )]
-    )
-    case "$ntp_cv_have___ss_len" in
-     yes)
-       AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
-           [Does struct sockaddr_storage have __ss_len?])
-    esac
-esac
-
-AH_VERBATIM(
-    [HAVE___SS_LEN_IN_SS_VERBATIM],
-    [
-       /* Handle sockaddr_storage.__ss_len */
-       #ifdef HAVE___SS_LEN_IN_SS
-       # define ss_len __ss_len
-       #endif /* HAVE___SS_LEN_IN_SS */
-    ]
-)
-
-#
-# Look for in_port_t.
-#
-AC_CACHE_CHECK(
-    [for in_port_t],
-    [isc_cv_have_in_port_t],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <netinet/in.h>
-           ]],
-           [[
-               in_port_t port = 25; 
-               return (0);
-           ]]
-       )],
-       [isc_cv_have_in_port_t=yes],
-       [isc_cv_have_in_port_t=no]
-    )]
-)
-case "$isc_cv_have_in_port_t" in
- no)
-       AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
-           [Declare in_port_t?])
-esac
+NTP_IPV6
 
 AC_CACHE_CHECK(
     [for multicast IP support],
@@ -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 <sys/types.h>
-               #include <sys/socket.h>
-           ]],
-           [[
-               extern struct sockaddr *ps;
-               return ps->sa_len;
-           ]]
-       )],
-       [isc_cv_platform_havesalen=yes],
-       [isc_cv_platform_havesalen=no]
-    )]
-)
-case "$isc_cv_platform_havesalen" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
-        [struct sockaddr has sa_len?])
-esac
-
-AC_ARG_ENABLE(
-    [ipv6],
-    [AS_HELP_STRING(
-       [--enable-ipv6],
-       [s use IPv6?]
-    )]
-)
-
-case "$enable_ipv6" in
- yes|''|autodetect)
-    case "$host" in
-     powerpc-ibm-aix4*)
-       ;;
-     *)
-       AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
-       ;;
-    esac
-    ;;
- no)
-    ;;
-esac
-
-
-AC_CACHE_CHECK(
-    [for IPv6 structures],
-    [isc_cv_found_ipv6],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <sys/socket.h>
-               #include <netinet/in.h>
-           ]],
-           [[
-               struct sockaddr_in6 sin6;
-           ]]
-       )],
-       [isc_cv_found_ipv6=yes],
-       [isc_cv_found_ipv6=no]
-    )]
-)
-
-#
-# See whether IPv6 support is provided via a Kame add-on.
-# This is done before other IPv6 linking tests so LIBS is properly set.
-#
-AC_MSG_CHECKING([for Kame IPv6 support])
-AC_ARG_WITH(
-    [kame],
-    [AS_HELP_STRING(
-       [--with-kame],
-       [- =/usr/local/v6]
-    )],
-    [use_kame="$withval"],
-    [use_kame="no"]
-)
-case "$use_kame" in
- no)
-    ;;
- yes)
-    kame_path=/usr/local/v6
-    ;;
- *)
-    kame_path="$use_kame"
-    ;;
-esac
-case "$use_kame" in
- no)
-    AC_MSG_RESULT([no])
-    ;;
- *)
-    if test -f $kame_path/lib/libinet6.a; then
-       AC_MSG_RESULT([$kame_path/lib/libinet6.a])
-       LIBS="-L$kame_path/lib -linet6 $LIBS"
-    else
-       AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
-
-Please choose the proper path with the following command:
-
-    configure --with-kame=PATH
-])
-    fi
-    ;;
-esac
-
-#
-# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
-# Including it on Kame-using platforms is very bad, though, because
-# Kame uses #error against direct inclusion.   So include it on only
-# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
-# This is done before the in6_pktinfo check because that's what
-# netinet6/in6.h is needed for.
-#
-case "$host" in
- *-bsdi4.[[01]]*)
-    AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
-       [Do we need netinet6/in6.h?])
-    isc_netinet6in6_hack="#include <netinet6/in6.h>"
-    ;;
- *)
-    isc_netinet6in6_hack=""
-    ;;
-esac
-
-#
-# This is similar to the netinet6/in6.h issue.
-#
-case "$host" in
- *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
-    AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
-       [Do we need to fix in6isaddr?])
-    isc_netinetin6_hack="#include <netinet/in6.h>"
-    ;;
- *)
-    isc_netinetin6_hack=""
-    ;;
-esac
-
-
-case "$isc_cv_found_ipv6" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
-    AC_CACHE_CHECK(
-       [for in6_pktinfo],
-       [isc_cv_have_in6_pktinfo],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #include <sys/types.h>
-                   #include <sys/socket.h>
-                   #include <netinet/in.h>
-                   $isc_netinetin6_hack
-                   $isc_netinet6in6_hack
-               ]],
-               [[
-                   struct in6_pktinfo xyzzy;
-               ]]
-           )],
-           [isc_cv_have_in6_pktinfo=yes],
-           [isc_cv_have_in6_pktinfo=no]
-       )]
-    )
-    case "$isc_cv_have_in6_pktinfo" in
-     yes)
-       AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
-               [have struct in6_pktinfo?])
-    esac
-
-
-    # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
-    AC_CACHE_CHECK(
-       [for sockaddr_in6.sin6_scope_id],
-       [isc_cv_have_sin6_scope_id],
-       [AC_COMPILE_IFELSE(
-           [AC_LANG_PROGRAM(
-               [[
-                   #include <sys/types.h>
-                   #include <sys/socket.h>
-                   #include <netinet/in.h>
-                   $isc_netinetin6_hack
-                   $isc_netinet6in6_hack
-               ]],
-               [[
-                   struct sockaddr_in6 xyzzy;
-                   xyzzy.sin6_scope_id = 0;
-               ]]
-           )],
-           [isc_cv_have_sin6_scope_id=yes],
-           [isc_cv_have_sin6_scope_id=no]
-       )]
-    )
-
-    case "$isc_cv_have_sin6_scope_id" in
-     yes)
-       AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
-    esac
-esac
-
-
-# We need this check run even without isc_cv_found_ipv6=yes
-
-AC_CACHE_CHECK(
-    [for in6addr_any],
-    [isc_cv_have_in6addr_any],
-    [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <sys/socket.h>
-               #include <netinet/in.h>
-               $isc_netinetin6_hack
-               $isc_netinet6in6_hack
-           ]],
-           [[
-               struct in6_addr in6; 
-               in6 = in6addr_any;
-           ]]
-       )],
-       [isc_cv_have_in6addr_any=yes],
-       [isc_cv_have_in6addr_any=no]
-    )]
-)
-
-case "$isc_cv_have_in6addr_any" in
- no)
-    AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
-esac
-
-
-AC_CACHE_CHECK(
-    [for struct if_laddrconf],
-    [isc_cv_struct_if_laddrconf],
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <net/if6.h>
-           ]],
-           [[
-               struct if_laddrconf a;
-           ]]
-       )],
-       [isc_cv_struct_if_laddrconf=yes],
-       [isc_cv_struct_if_laddrconf=no]
-    )]
-)
-
-case "$isc_cv_struct_if_laddrconf" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
-       [have struct if_laddrconf?])
-esac
-
-AC_CACHE_CHECK(
-    [for struct if_laddrreq],
-    isc_cv_struct_if_laddrreq,
-    [AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-           [[
-               #include <sys/types.h>
-               #include <net/if6.h>
-           ]],
-           [[
-               struct if_laddrreq a;
-           ]]
-       )],
-       [isc_cv_struct_if_laddrreq=yes],
-       [isc_cv_struct_if_laddrreq=no]
-    )]
-)
-
-case "$isc_cv_struct_if_laddrreq" in
- yes)
-    AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
-       [have struct if_laddrreq?])
-esac
-
 
 ###
 
@@ -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 (file)
index 0000000..8628a94
--- /dev/null
@@ -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
similarity index 86%
rename from include/copyright.def
rename to sntp/include/copyright.def
index 978e89a13610205ba429c37a3be34682bfa5be36..b14a3866440d78dd8c68d8fa9b1a9f0cd0195c81 100644 (file)
@@ -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`;
 
similarity index 100%
rename from include/homerc.def
rename to sntp/include/homerc.def
similarity index 100%
rename from m4/define_dir.m4
rename to sntp/m4/define_dir.m4
similarity index 100%
rename from m4/ntp_dir_sep.m4
rename to sntp/m4/ntp_dir_sep.m4
diff --git a/sntp/m4/ntp_ipv6.m4 b/sntp/m4/ntp_ipv6.m4
new file mode 100644 (file)
index 0000000..1c6f21e
--- /dev/null
@@ -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 <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
+           ]],
+           [[
+               struct sockaddr_storage n;
+           ]]
+       )],
+       [ntp_cv_sockaddr_storage=yes],
+       [ntp_cv_sockaddr_storage=no]
+    )]
+)
+case "$ntp_cv_sockaddr_storage" in
+ yes)
+    AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
+       [Does a system header define struct sockaddr_storage?])
+esac
+
+AC_CACHE_CHECK(
+    [for sockaddr_storage.ss_family],
+    [ntp_cv_have_ss_family],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
+           ]],
+           [[
+               struct sockaddr_storage s;
+               s.ss_family = 1;
+           ]]
+       )],
+       [ntp_cv_have_ss_family=yes],
+       [ntp_cv_have_ss_family=no]
+    )]
+)
+
+case "$ntp_cv_have_ss_family" in
+ no)
+    AC_CACHE_CHECK(
+       [for sockaddr_storage.__ss_family],
+       [ntp_cv_have___ss_family],
+       [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+               [[
+                   #ifdef HAVE_SYS_TYPES_H
+                   # include <sys/types.h>
+                   #endif
+                   #ifdef HAVE_SYS_SOCKET_H
+                   # include <sys/socket.h>
+                   #endif
+                   #ifdef HAVE_NETINET_IN_H
+                   # include <netinet/in.h>
+                   #endif
+               ]],
+               [[
+                   struct sockaddr_storage s;
+                   s.__ss_family = 1;
+               ]]
+           )],
+           [ntp_cv_have___ss_family=yes],
+           [ntp_cv_have___ss_family=no]
+       )]
+    )
+    case "$ntp_cv_have___ss_family" in
+     yes)
+       AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
+           [Does struct sockaddr_storage have __ss_family?])
+    esac
+    ;;
+esac
+
+AH_VERBATIM(
+    [HAVE___SS_FAMILY_IN_SS_VERBATIM],
+    [
+       /* Handle sockaddr_storage.__ss_family */
+       #ifdef HAVE___SS_FAMILY_IN_SS
+       # define ss_family __ss_family
+       #endif /* HAVE___SS_FAMILY_IN_SS */
+    ]
+)
+
+AC_CACHE_CHECK(
+    [for sockaddr_storage.ss_len],
+    [ntp_cv_have_ss_len],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #ifdef HAVE_SYS_TYPES_H
+               # include <sys/types.h>
+               #endif
+               #ifdef HAVE_SYS_SOCKET_H
+               # include <sys/socket.h>
+               #endif
+               #ifdef HAVE_NETINET_IN_H
+               # include <netinet/in.h>
+               #endif
+           ]],
+           [[
+               struct sockaddr_storage s;
+               s.ss_len = 1;
+           ]]
+       )],
+       [ntp_cv_have_ss_len=yes],
+       [ntp_cv_have_ss_len=no]
+    )]
+)
+
+case "$ntp_cv_have_ss_len" in
+ no)
+    AC_CACHE_CHECK(
+       [for sockaddr_storage.__ss_len],
+       [ntp_cv_have___ss_len],
+       [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+               [[
+                   #ifdef HAVE_SYS_TYPES_H
+                   # include <sys/types.h>
+                   #endif
+                   #ifdef HAVE_SYS_SOCKET_H
+                   # include <sys/socket.h>
+                   #endif
+                   #ifdef HAVE_NETINET_IN_H
+                   # include <netinet/in.h>
+                   #endif
+               ]],
+               [[
+                   struct sockaddr_storage s;
+                   s.__ss_len = 1;
+               ]]
+           )],
+           [ntp_cv_have___ss_len=yes],
+           [ntp_cv_have___ss_len=no]
+       )]
+    )
+    case "$ntp_cv_have___ss_len" in
+     yes)
+       AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
+           [Does struct sockaddr_storage have __ss_len?])
+    esac
+    ;;
+esac
+
+AH_VERBATIM(
+    [HAVE___SS_LEN_IN_SS_VERBATIM],
+    [
+       /* Handle sockaddr_storage.__ss_len */
+       #ifdef HAVE___SS_LEN_IN_SS
+       # define ss_len __ss_len
+       #endif /* HAVE___SS_LEN_IN_SS */
+    ]
+)
+
+#
+# Look for in_port_t.
+#
+AC_CACHE_CHECK(
+    [for in_port_t],
+    [isc_cv_have_in_port_t],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #include <sys/types.h>
+               #include <netinet/in.h>
+           ]],
+           [[
+               in_port_t port = 25; 
+               return (0);
+           ]]
+       )],
+       [isc_cv_have_in_port_t=yes],
+       [isc_cv_have_in_port_t=no]
+    )]
+)
+case "$isc_cv_have_in_port_t" in
+ no)
+       AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
+           [Declare in_port_t?])
+esac
+
+AC_CACHE_CHECK(
+    [type of socklen arg for getsockname()],
+    [ntp_cv_getsockname_socklen_type],
+    [
+    getsockname_socklen_type_found=no
+    for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
+       for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
+           AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM(
+                   [[
+                       #ifdef HAVE_SYS_TYPES_H
+                       # include <sys/types.h>
+                       #endif
+                       #ifdef HAVE_SYS_SOCKET_H
+                       # include <sys/socket.h>
+                       #endif
+                   ]], [[
+                       extern
+                       getsockname(int, $getsockname_arg2, 
+                               $ntp_cv_getsockname_socklen_type *);
+                   ]]
+               )],
+               [getsockname_socklen_type_found=yes ; break 2],
+               []
+           )
+       done
+    done
+    case "$getsockname_socklen_type_found" in
+     no)
+       ntp_cv_getsockname_socklen_type='socklen_t'
+    esac
+    AS_UNSET([getsockname_arg2])
+    AS_UNSET([getsockname_socklen_type_found])
+    ]
+)
+AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
+                  [$ntp_cv_getsockname_socklen_type],
+                  [What is getsockname()'s socklen type?])
+
+AC_CACHE_CHECK(
+    [struct sockaddr for sa_len],
+    [isc_cv_platform_havesalen],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #include <sys/types.h>
+               #include <sys/socket.h>
+           ]],
+           [[
+               extern struct sockaddr *ps;
+               return ps->sa_len;
+           ]]
+       )],
+       [isc_cv_platform_havesalen=yes],
+       [isc_cv_platform_havesalen=no]
+    )]
+)
+case "$isc_cv_platform_havesalen" in
+ yes)
+    AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
+        [struct sockaddr has sa_len?])
+esac
+
+AC_ARG_ENABLE(
+    [ipv6],
+    [AS_HELP_STRING(
+       [--enable-ipv6],
+       [s use IPv6?]
+    )]
+)
+
+case "$enable_ipv6" in
+ yes|''|autodetect)
+    case "$host" in
+     powerpc-ibm-aix4*)
+       ;;
+     *)
+       AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
+       ;;
+    esac
+    ;;
+ no)
+    ;;
+esac
+
+
+AC_CACHE_CHECK(
+    [for IPv6 structures],
+    [isc_cv_found_ipv6],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #include <sys/types.h>
+               #include <sys/socket.h>
+               #include <netinet/in.h>
+           ]],
+           [[
+               struct sockaddr_in6 sin6;
+           ]]
+       )],
+       [isc_cv_found_ipv6=yes],
+       [isc_cv_found_ipv6=no]
+    )]
+)
+
+#
+# See whether IPv6 support is provided via a Kame add-on.
+# This is done before other IPv6 linking tests so LIBS is properly set.
+#
+AC_MSG_CHECKING([for Kame IPv6 support])
+AC_ARG_WITH(
+    [kame],
+    [AS_HELP_STRING(
+       [--with-kame],
+       [- =/usr/local/v6]
+    )],
+    [use_kame="$withval"],
+    [use_kame="no"]
+)
+case "$use_kame" in
+ no)
+    ;;
+ yes)
+    kame_path=/usr/local/v6
+    ;;
+ *)
+    kame_path="$use_kame"
+    ;;
+esac
+case "$use_kame" in
+ no)
+    AC_MSG_RESULT([no])
+    ;;
+ *)
+    if test -f $kame_path/lib/libinet6.a; then
+       AC_MSG_RESULT([$kame_path/lib/libinet6.a])
+       LIBS="-L$kame_path/lib -linet6 $LIBS"
+    else
+       AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
+
+Please choose the proper path with the following command:
+
+    configure --with-kame=PATH
+])
+    fi
+    ;;
+esac
+
+#
+# Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
+# Including it on Kame-using platforms is very bad, though, because
+# Kame uses #error against direct inclusion.   So include it on only
+# the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
+# This is done before the in6_pktinfo check because that's what
+# netinet6/in6.h is needed for.
+#
+case "$host" in
+ *-bsdi4.[[01]]*)
+    AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
+       [Do we need netinet6/in6.h?])
+    isc_netinet6in6_hack="#include <netinet6/in6.h>"
+    ;;
+ *)
+    isc_netinet6in6_hack=""
+    ;;
+esac
+
+#
+# This is similar to the netinet6/in6.h issue.
+#
+case "$host" in
+ *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
+    AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
+       [Do we need to fix in6isaddr?])
+    isc_netinetin6_hack="#include <netinet/in6.h>"
+    ;;
+ *)
+    isc_netinetin6_hack=""
+    ;;
+esac
+
+
+case "$isc_cv_found_ipv6" in
+ yes)
+    AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
+    AC_CACHE_CHECK(
+       [for in6_pktinfo],
+       [isc_cv_have_in6_pktinfo],
+       [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+               [[
+                   #include <sys/types.h>
+                   #include <sys/socket.h>
+                   #include <netinet/in.h>
+                   $isc_netinetin6_hack
+                   $isc_netinet6in6_hack
+               ]],
+               [[
+                   struct in6_pktinfo xyzzy;
+               ]]
+           )],
+           [isc_cv_have_in6_pktinfo=yes],
+           [isc_cv_have_in6_pktinfo=no]
+       )]
+    )
+    case "$isc_cv_have_in6_pktinfo" in
+     yes)
+       AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
+               [have struct in6_pktinfo?])
+    esac
+
+
+    # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
+    AC_CACHE_CHECK(
+       [for sockaddr_in6.sin6_scope_id],
+       [isc_cv_have_sin6_scope_id],
+       [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+               [[
+                   #include <sys/types.h>
+                   #include <sys/socket.h>
+                   #include <netinet/in.h>
+                   $isc_netinetin6_hack
+                   $isc_netinet6in6_hack
+               ]],
+               [[
+                   struct sockaddr_in6 xyzzy;
+                   xyzzy.sin6_scope_id = 0;
+               ]]
+           )],
+           [isc_cv_have_sin6_scope_id=yes],
+           [isc_cv_have_sin6_scope_id=no]
+       )]
+    )
+
+    case "$isc_cv_have_sin6_scope_id" in
+     yes)
+       AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
+    esac
+esac
+
+
+# We need this check run even without isc_cv_found_ipv6=yes
+
+AC_CACHE_CHECK(
+    [for in6addr_any],
+    [isc_cv_have_in6addr_any],
+    [AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #include <sys/types.h>
+               #include <sys/socket.h>
+               #include <netinet/in.h>
+               $isc_netinetin6_hack
+               $isc_netinet6in6_hack
+           ]],
+           [[
+               struct in6_addr in6; 
+               in6 = in6addr_any;
+           ]]
+       )],
+       [isc_cv_have_in6addr_any=yes],
+       [isc_cv_have_in6addr_any=no]
+    )]
+)
+
+case "$isc_cv_have_in6addr_any" in
+ no)
+    AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
+esac
+
+
+AC_CACHE_CHECK(
+    [for struct if_laddrconf],
+    [isc_cv_struct_if_laddrconf],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #include <sys/types.h>
+               #include <net/if6.h>
+           ]],
+           [[
+               struct if_laddrconf a;
+           ]]
+       )],
+       [isc_cv_struct_if_laddrconf=yes],
+       [isc_cv_struct_if_laddrconf=no]
+    )]
+)
+
+case "$isc_cv_struct_if_laddrconf" in
+ yes)
+    AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
+       [have struct if_laddrconf?])
+esac
+
+AC_CACHE_CHECK(
+    [for struct if_laddrreq],
+    isc_cv_struct_if_laddrreq,
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+           [[
+               #include <sys/types.h>
+               #include <net/if6.h>
+           ]],
+           [[
+               struct if_laddrreq a;
+           ]]
+       )],
+       [isc_cv_struct_if_laddrreq=yes],
+       [isc_cv_struct_if_laddrreq=no]
+    )]
+)
+
+case "$isc_cv_struct_if_laddrreq" in
+ yes)
+    AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
+       [have struct if_laddrreq?])
+esac
+
+
+])dnl
+dnl ======================================================================
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 (file)
index 0000000..0447475
--- /dev/null
@@ -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 <sys/socket.h>
+    #endif
+])
+case "$host" in
+ *-hp-hpux*)
+    AC_CACHE_CHECK(
+       [if net/if.h requires mpinfou predeclaration],
+       [ntp_cv_predecl_mpinfou],
+       [
+           np_cv_predecl_mpinfou=no
+           case "$ac_cv_header_net_if_h" in
+            no)
+               AC_COMPILE_IFELSE(
+                   [AC_LANG_PROGRAM(
+                       [[
+                           typedef union mpinfou {
+                                   struct pdk_mpinfo *pdkptr;
+                                   struct mpinfo *pikptr;
+                           } mpinfou_t;
+                           #ifdef HAVE_SYS_SOCKET_H
+                           # include <sys/socket.h>
+                           #endif
+                           #include <net/if.h>
+                       ]],
+                       [[
+                       ]]
+                   )],
+                   [
+                       ntp_cv_predecl_mpinfou=yes
+                       ac_cv_header_net_if_h=yes
+                   ]
+               )
+           esac
+       ]
+    )
+    case "$ntp_cv_predecl_mpinfou" in
+     yes)
+       cat >>confdefs.h <<_ACEOF
+#ifndef MPINFOU_PREDECLARED
+# define MPINFOU_PREDECLARED
+typedef union mpinfou {
+       struct pdk_mpinfo *pdkptr;
+       struct mpinfo *pikptr;
+} mpinfou_t;
+#endif
+_ACEOF
+       AH_BOTTOM([
+#ifndef MPINFOU_PREDECLARED
+# define MPINFOU_PREDECLARED
+typedef union mpinfou {
+       struct pdk_mpinfo *pdkptr;
+       struct mpinfo *pikptr;
+} mpinfou_t;
+#endif
+])
+    esac
+esac
+
+# [Bug 1628] On Solaris, we need -lxnet -lsocket.  Generalize this to
+# avoid keying on the OS name:  If we find socket functions in
+# libsocket, next try for them in libxnet without libsocket, if found,
+# list both.  If we simply tested libxnet first, we would find the
+# functions there and never add libsocket.  See also [Bug 660]
+# http://bugs.ntp.org/show_bug.cgi?id=660#c9
+saved_LIBS=$LIBS
+AC_SEARCH_LIBS([setsockopt], [socket])
+case "$ac_cv_search_setsockopt" in
+ -lsocket)
+    LIBS="$saved_LIBS"
+    AC_SEARCH_LIBS([getsockopt], [xnet])
+    case "$ac_cv_search_getsockopt" in
+     -lxnet)
+       LIBS="-lxnet -lsocket $saved_LIBS"
+       ;;
+     *) LIBS="-lsocket $saved_LIBS"
+       ;;
+    esac
+    ;;
+esac
+AS_UNSET([saved_LIBS])
+
+AC_FUNC_STRERROR_R
+
+dnl preset withsntp=no in env to change default to --without-sntp
+AC_MSG_CHECKING([if sntp will be built])
+AC_ARG_WITH(
+    [sntp],
+    [AS_HELP_STRING(
+       [--without-sntp],
+       [- disable building sntp and sntp/tests]
+    )],
+    [],
+    [with_sntp="${withsntp=yes}"]
+)
+case "$with_sntp" in
+ no)
+    SNTP=
+    ;;
+ *)
+    SNTP=sntp
+    ;;
+esac
+AC_SUBST([SNTP])
+AM_CONDITIONAL([BUILD_SNTP], [test -n "$SNTP"])
+AC_MSG_RESULT([$with_sntp])
+
+])dnl
+dnl ======================================================================
similarity index 93%
rename from m4/ntp_openssl.m4
rename to sntp/m4/ntp_openssl.m4
index fba569395aeda1fefd68311e6b8f7a20f9bd3d52..2c799a5c4215cd488b0eaf19579099649bb10350 100644 (file)
@@ -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 ======================================================================
similarity index 100%
rename from m4/ntp_vpathhack.m4
rename to sntp/m4/ntp_vpathhack.m4
similarity index 97%
rename from m4/os_cflags.m4
rename to sntp/m4/os_cflags.m4
index 7fac93bd1e8c6207cb4eea205fe55db92309e0c5..f1865e61a8c2cb4984351484973c2f317c82f970 100644 (file)
@@ -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])
 ])
index bd40923091dd48f010b662489d1eec655e62b0ef..96147d647ac2fe6044099b4e1130c0002d06823d 100644 (file)
@@ -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
index 7f8ec4415279bcf571b5789956b185d8b75d1b21..ff49c0ef9c2d8457486d1a53d7dcd2f80ec15cd8 100644 (file)
@@ -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
index 86388dd384ae2a2fbdfe9d969470fc7a3e6028e0..b1d82cc8a1e8598c0b375a64194f59e08349cb54 100644 (file)
@@ -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