From: Dave Hart Date: Tue, 22 Feb 2011 23:21:13 +0000 (+0000) Subject: [Bug 1834] ntpdate 4.2.7p131 aborts with assertion failure. X-Git-Tag: NTP_4_2_7P133~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d85ad701d4ee445d4d2826832a01cad92fb9ce6;p=thirdparty%2Fntp.git [Bug 1834] ntpdate 4.2.7p131 aborts with assertion failure. Move sntp last in top-level Makefile.am SUBDIRS so that the libevent tearoff (if required) and sntp are compiled after the rest. Use a single set of Automake options for each package in configure.ac AM_INIT, remove Makefile.am AUTOMAKE_OPTIONS= lines. Correct spurious sntp rebuilds triggered by a make misperception sntp/version was out-of-date relative to phony target FRC.version. Do not cache paths to perl, test, or pkg-config, searching the PATH at configure time is worth it to pick up tool updates. bk: 4d6444e989DgWlmObv_bBOKSQF1ZrA --- diff --git a/ChangeLog b/ChangeLog index 5fc6e58aa..3e4434d5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +* [Bug 1834] ntpdate 4.2.7p131 aborts with assertion failure. +* Move sntp last in top-level Makefile.am SUBDIRS so that the libevent + tearoff (if required) and sntp are compiled after the rest. +* Use a single set of Automake options for each package in configure.ac + AM_INIT, remove Makefile.am AUTOMAKE_OPTIONS= lines. +* Correct spurious sntp rebuilds triggered by a make misperception + sntp/version was out-of-date relative to phony target FRC.version. +* Do not cache paths to perl, test, or pkg-config, searching the PATH + at configure time is worth it to pick up tool updates. (4.2.7p132) 2011/02/22 Released by Harlan Stenn * [Bug 1832] ntpdate doesn't allow timeout > 2s. * [Bug 1833] The checking sem_timedwait() fails without -pthread. diff --git a/Makefile.am b/Makefile.am index 69fe286b2..e90e7a46b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,6 @@ SUBDIRS = \ scripts \ include \ libntp \ - sntp \ libparse \ ntpd \ ntpdate \ @@ -18,6 +17,7 @@ SUBDIRS = \ clockstuff \ kernel \ util \ + sntp \ tests \ $(NULL) @@ -51,8 +51,6 @@ EXTRA_DIST = \ lib/isc \ ports \ \ - bincheck.mf \ - depsver.mf \ deps-ver \ \ $(NULL) @@ -60,8 +58,6 @@ EXTRA_DIST = \ CLEANFILES = DISTCLEANFILES = .gcc-warning -ETAGS_ARGS = Makefile.am configure.ac - # HMS: Keep .gcc-warning first, as that way it gets printed first. BUILT_SOURCES = \ .gcc-warning \ diff --git a/adjtimed/Makefile.am b/adjtimed/Makefile.am index 128dbb590..8387875d1 100644 --- a/adjtimed/Makefile.am +++ b/adjtimed/Makefile.am @@ -1,28 +1,23 @@ ## adjtimed Makefile.am if NTP_BINSUBDIR_IS_BIN -bin_PROGRAMS= @MAKE_ADJTIMED@ +bin_PROGRAMS = @MAKE_ADJTIMED@ else -sbin_PROGRAMS= @MAKE_ADJTIMED@ +sbin_PROGRAMS = @MAKE_ADJTIMED@ endif -BUILT_SOURCES= check-libntp -CLEANFILES= -EXTRA_PROGRAMS= adjtimed +BUILT_SOURCES = +CLEANFILES = +EXTRA_PROGRAMS = adjtimed AM_CFLAGS = $(CFLAGS_NTP) AM_CPPFLAGS = $(NTP_INCS) -AM_CPPFLAGS += $(LIBOPTS_CFLAGS) AM_CPPFLAGS += $(CPPFLAGS_NTP) LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(PTHREAD_LIBS) -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/sntp/check-libntp.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/check-libopts.mf b/check-libopts.mf new file mode 100644 index 000000000..99424e317 --- /dev/null +++ b/check-libopts.mf @@ -0,0 +1,14 @@ +## check-libopts.mf - automake fragment +## +## If we are not using the tearoff libopts, we won't be +## building its libopts.la, so the submake is allowed +## to fail. + +BUILT_SOURCES += check-libopts +CLEANFILES += check-libopts + +check-libopts: ../sntp/libopts/libopts.la + @echo stamp > $@ + +../sntp/libopts/libopts.la: + -cd ../sntp/libopts && $(MAKE) libopts.la diff --git a/clockstuff/Makefile.am b/clockstuff/Makefile.am index 7f4f1e510..19578feae 100644 --- a/clockstuff/Makefile.am +++ b/clockstuff/Makefile.am @@ -1,7 +1,7 @@ noinst_PROGRAMS = @PROPDELAY@ @CHUTEST@ @CLKTEST@ EXTRA_PROGRAMS = propdelay chutest clktest -BUILT_SOURCES = check-libntp clktest-opts.c clktest-opts.h +BUILT_SOURCES = clktest-opts.c clktest-opts.h EXTRA_DIST = clktest-opts.def clktest_SOURCES = clktest.c clktest-opts.c clktest-opts.h @@ -31,18 +31,9 @@ $(srcdir)/clktest-opts.h: $(srcdir)/clktest-opts.c $(srcdir)/clktest-opts.c: $(srcdir)/clktest-opts.def $(std_def_list) $(run_ag) clktest-opts.def -## chutest$(EXEEXT): ../libntp/libntp.a -## clktest$(EXEEXT): ../libntp/libntp.a - -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - CLEANFILES = +include $(top_srcdir)/sntp/check-libntp.mf +include $(top_srcdir)/check-libopts.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/configure.ac b/configure.ac index a0da1e72e..258639c74 100644 --- a/configure.ac +++ b/configure.ac @@ -103,6 +103,8 @@ esac dnl we need to check for cross compile tools for vxWorks here AC_PROG_AWK +AS_UNSET([ac_cv_prog_AWK]) +AC_SUBST([AWK]) dnl scripts/ntpver.in AC_PROG_MAKE_SET AC_SUBST([CFLAGS]) @@ -111,9 +113,16 @@ AC_SUBST([LDFLAGS]) AC_PROG_LN_S AC_ISC_POSIX + AC_PATH_PROG([PATH_PERL], [perl]) -AC_PATH_PROG([PATH_SH], [sh]) +dnl Saving cached hardcoded paths rather than searching $PATH during a +dnl cached configure run is an optimization not worth the the cost of +dnl preventing newly-installed tools from being found. Short-circuit +dnl the caching after the tests so preset overrides still work. +AS_UNSET([ac_cv_path_PATH_PERL]) AC_PATH_PROG([PATH_TEST], [test]) +AS_UNSET([ac_cv_path_PATH_TEST]) +AC_SUBST([CONFIG_SHELL]) dnl for scripts #!/path/to/sh AC_ARG_WITH( [net-snmp-config], @@ -147,7 +156,8 @@ case "$PROG_NET_SNMP_CONFIG" in ;; *) AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG]) - ;; + AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG]) +;; esac AC_MSG_RESULT([$PATH_NET_SNMP_CONFIG]) diff --git a/include/Makefile.am b/include/Makefile.am index f2e140b1b..9294f3f44 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,6 +1,4 @@ NULL = -AUTOMAKE_OPTIONS = -ETAGS_ARGS = $(srcdir)/Makefile.am SUBDIRS = isc diff --git a/include/isc/Makefile.am b/include/isc/Makefile.am index 14aa70813..160203b0c 100644 --- a/include/isc/Makefile.am +++ b/include/isc/Makefile.am @@ -1,6 +1,4 @@ NULL = -AUTOMAKE_OPTIONS = -ETAGS_ARGS = $(srcdir)/Makefile.am noinst_HEADERS = \ mem.h \ diff --git a/libparse/Makefile.am b/libparse/Makefile.am index 1df4208ff..64f614863 100644 --- a/libparse/Makefile.am +++ b/libparse/Makefile.am @@ -1,10 +1,10 @@ NULL= -BUILT_SOURCES = check-libntp +BUILT_SOURCES = +CLEANFILES = noinst_LIBRARIES = @MAKE_LIBPARSE@ @MAKE_LIBPARSE_KERNEL@ EXTRA_LIBRARIES = libparse.a libparse_kernel.a EXTRA_PROGRAMS = parsestreams parsesolaris noinst_PROGRAMS = @MAKE_PARSEKMODULE@ -CLEANFILES = K_CFLAGS = -DPARSESTREAM -DNTP_NEED_BOPS @@ -125,19 +125,16 @@ parsestreams.loadable_module.o: $(parsestreams_OBJECTS) libparse_kernel.a ../lib parse: $(parsesolaris_OBJECTS) libparse_kernel.a ../libntp/libntp.a $(LD) -r -o $@ $(parsesolaris_OBJECTS) libparse_kernel.a ../libntp/libntp.a -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - parsesolaris.o: sys/systm.h sys/systm.h: -mkdir sys sed -e '/ffs(.*)/d' < /usr/include/sys/systm.h > sys/systm.h +## check-libparse is invoked by ntpd/Makefile.am +check-libparse: $(noinst_LIBRARIES) + @: do-nothing action to avoid default SCCS get + +include $(top_srcdir)/sntp/check-libntp.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am index 98cb29066..b46c24381 100644 --- a/ntpd/Makefile.am +++ b/ntpd/Makefile.am @@ -1,5 +1,4 @@ NULL= -AUTOMAKE_OPTIONS= if NTP_BINSUBDIR_IS_BIN bin_PROGRAMS= ntpd @MAKE_NTPDSIM@ @@ -73,7 +72,7 @@ B_S_DIST= \ BUILT_SOURCES= \ $(VPHACK) \ - check-libntp \ + $(LIBPARSE) \ ntp_parser.c \ ntp_parser.h \ $(VPHACK_AFTER) \ @@ -86,14 +85,14 @@ man_MANS= $(srcdir)/ntpd.1 # simulator currently uses ntpd-opts.[ch]. This also means there is no # longer a reason to have ntpdbase-opts.def split off of ntpd-opts.def. -LDADD_NTPD_COMMON = @LDADD_LIBNTP@ $(LIBOPTS_LDADD) @PTHREAD_LIBS@ -LDADD_NTPD_COMMON += $(LIBM) @LCRYPTO@ @LSCF@ +LDADD_NTPD_COMMON = @LDADD_LIBNTP@ $(LIBOPTS_LDADD) $(PTHREAD_LIBS) +LDADD_NTPD_COMMON += $(LIBM) $(LCRYPTO) $(LSCF) ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_NTPD_COMMON) ntpdsim_LDADD = $(LDADD) ../libntp/libntpsim.a $(LDADD_NTPD_COMMON) ntpdsim_CPPFLAGS = $(AM_CPPFLAGS) -DSIM -check_y2k_LDADD = $(LDADD) ../libntp/libntp.a @LDADD_LIBNTP@ @PTHREAD_LIBS@ +check_y2k_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_LIBNTP) $(PTHREAD_LIBS) ## we don't want $(LDADD) in keyword_gen_LDADD -keyword_gen_LDADD = ../libntp/libntp.a @LDADD_LIBNTP@ @PTHREAD_LIBS@ +keyword_gen_LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(PTHREAD_LIBS) DISTCLEANFILES = \ keyword-gen \ @@ -120,7 +119,6 @@ EXTRA_DIST = \ $(B_S_DIST) \ $(NULL) -ETAGS_ARGS = Makefile.am ### Y2Kfixes check_PROGRAMS = @MAKE_CHECK_Y2K@ EXTRA_PROGRAMS = check_y2k ntpdsim keyword-gen @@ -135,8 +133,8 @@ std_def_list = \ $(top_srcdir)/sntp/include/version.def \ $(NULL) -check-local: @MAKE_CHECK_Y2K@ $(CHECK_SAVECONFIG) - test -z "@MAKE_CHECK_Y2K@" || ./@MAKE_CHECK_Y2K@ +check-local: $(MAKE_CHECK_Y2K) $(CHECK_SAVECONFIG) + test -z "$(MAKE_CHECK_Y2K)" || ./$(MAKE_CHECK_Y2K) ntpd_SOURCES = \ ntp_config.c \ @@ -263,19 +261,11 @@ check-saveconfig: $(srcdir)/complete.conf compsave.conf -diff $(srcdir)/complete.conf compsave.conf cmp $(srcdir)/complete.conf compsave.conf && echo stamp > $@ -../libopts/libopts.la: - cd ../libopts && $(MAKE) libopts.la - -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - -../libntp/libntp.a: - cd ../libntp && $(MAKE) +../libntp/libntpsim.a: + cd ../libntp && $(MAKE) libntpsim.a ../libparse/libparse.a: - cd ../libparse && $(MAKE) libparse.a + cd ../libparse && $(MAKE) check-libparse $(top_srcdir)/sntp/version: cd $(top_srcdir)/sntp && $(MAKE) version @@ -285,5 +275,7 @@ version.o: $(ntpd_OBJECTS) ../libntp/libntp.a @LIBPARSE@ Makefile $(top_srcdir)/ $(COMPILE) -c version.c include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/check-libopts.mf +include $(top_srcdir)/sntp/check-libntp.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/ntpdate/Makefile.am b/ntpdate/Makefile.am index 9c63c2c15..e753b67c4 100644 --- a/ntpdate/Makefile.am +++ b/ntpdate/Makefile.am @@ -1,17 +1,17 @@ -NULL= +NULL = -BUILT_SOURCES= check-libntp -CLEANFILES= +BUILT_SOURCES = +CLEANFILES = if NTP_BINSUBDIR_IS_BIN -bin_PROGRAMS= ntpdate +bin_PROGRAMS = ntpdate else -sbin_PROGRAMS= ntpdate +sbin_PROGRAMS = ntpdate endif -EXTRA_PROGRAMS= ntptimeset +EXTRA_PROGRAMS = ntptimeset -ntptimeset_SOURCES= ntptimeset.c ntptime_config.c +ntptimeset_SOURCES = ntptimeset.c ntptime_config.c AM_CFLAGS = $(CFLAGS_NTP) @@ -27,14 +27,6 @@ noinst_HEADERS= ntpdate.h $(PROGRAMS): $(LDADD) -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - $(top_srcdir)/sntp/version: cd $(top_srcdir)/sntp && $(MAKE) version @@ -43,5 +35,6 @@ version.o: $(ntpdate_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/ver $(COMPILE) -c version.c include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/sntp/check-libntp.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/ntpdate/ntpdate.c b/ntpdate/ntpdate.c index 63e2faada..933b5d16a 100644 --- a/ntpdate/ntpdate.c +++ b/ntpdate/ntpdate.c @@ -1764,7 +1764,7 @@ init_io(void) */ if (check_ntp_port_in_use) { ZERO(addr); - INSIST(res->ai_addrlen < sizeof(addr)); + INSIST(res->ai_addrlen <= sizeof(addr)); memcpy(&addr, res->ai_addr, res->ai_addrlen); rc = bind(fd[nbsock], &addr.sa, SOCKLEN(&addr)); if (rc < 0) { diff --git a/ntpdc/Makefile.am b/ntpdc/Makefile.am index aba33a418..2b4405416 100644 --- a/ntpdc/Makefile.am +++ b/ntpdc/Makefile.am @@ -8,7 +8,7 @@ endif EXTRA_PROGRAMS= ntpdc-layout EXTRA_DATA= check-layout -BUILT_SOURCES= check-libntp @MAKE_CHECK_LAYOUT@ ntpdc-opts.c ntpdc-opts.h +BUILT_SOURCES= @MAKE_CHECK_LAYOUT@ ntpdc-opts.c ntpdc-opts.h AM_CFLAGS = $(CFLAGS_NTP) @@ -69,14 +69,6 @@ check-layout: ntpdc-layout $(srcdir)/layout.std layout.here $(PROGRAMS): version.o -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - $(top_srcdir)/sntp/version: cd $(top_srcdir)/sntp && $(MAKE) version @@ -90,5 +82,7 @@ nl.c: nl_in.c nl.pl Makefile.am ../config.h ../include/ntp_request.h ntpdc.h $(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/check-libopts.mf +include $(top_srcdir)/sntp/check-libntp.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/ntpq/Makefile.am b/ntpq/Makefile.am index 44d81f23d..5d4a78aa6 100644 --- a/ntpq/Makefile.am +++ b/ntpq/Makefile.am @@ -23,7 +23,7 @@ CLEANFILES= DISTCLEANFILES= .version version.c ETAGS_ARGS= Makefile.am EXTRA_DIST= ntpq-opts.def ntpq.1 ntpq-opts.texi ntpq-opts.menu -BUILT_SOURCES= check-libntp ntpq-opts.c ntpq-opts.h +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)" \ @@ -55,14 +55,6 @@ $(srcdir)/ntpq-opts.texi: $(srcdir)/ntpq-opts.def $(std_def_list) $(run_ag) -Taginfo.tpl -DLEVEL=section ntpq-opts.def $(top_srcdir)/scripts/check--help $@ -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - $(top_srcdir)/sntp/version: cd $(top_srcdir)/sntp && $(MAKE) version @@ -73,5 +65,7 @@ version.o: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/versio $(COMPILE) -c version.c include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/check-libopts.mf +include $(top_srcdir)/sntp/check-libntp.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/ntpsnmpd/Makefile.am b/ntpsnmpd/Makefile.am index de7bc14c8..fd215850f 100644 --- a/ntpsnmpd/Makefile.am +++ b/ntpsnmpd/Makefile.am @@ -24,7 +24,7 @@ AM_CPPFLAGS += $(CPPFLAGS_NTP) EXTRA_DIST= ntpsnmpd-opts.def ntpsnmpd.1 ntpsnmpd-opts.texi \ ntpsnmpd-opts.menu ntpv4-mib.mib -BUILT_SOURCES= check-libntp ntpsnmpd-opts.c ntpsnmpd-opts.h +BUILT_SOURCES= ntpsnmpd-opts.c ntpsnmpd-opts.h CLEANFILES= noinst_DATA= $(srcdir)/ntpsnmpd-opts.texi $(srcdir)/ntpsnmpd-opts.menu man_MANS= $(srcdir)/ntpsnmpd.1 @@ -54,14 +54,8 @@ $(srcdir)/ntpsnmpd-opts.texi: $(srcdir)/ntpsnmpd-opts.def $(std_def_list) $(run_ag) -Taginfo.tpl -DLEVEL=section ntpsnmpd-opts.def $(top_srcdir)/scripts/check--help $@ -check-libntp: FRC - cd ../libntp && $(MAKE) - -FRC: - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/sntp/check-libntp.mf +include $(top_srcdir)/check-libopts.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/scripts/mkver.in b/scripts/mkver.in index 4557a0442..f3ea05c9b 100644 --- a/scripts/mkver.in +++ b/scripts/mkver.in @@ -1,4 +1,4 @@ -#!@PATH_SH@ +#!@CONFIG_SHELL@ PROG=${1-UNKNOWN} ConfStr="$PROG" diff --git a/scripts/ntpver.in b/scripts/ntpver.in index be36897c4..9615e66d6 100644 --- a/scripts/ntpver.in +++ b/scripts/ntpver.in @@ -1,7 +1,7 @@ -#!@PATH_SH@ +#!@CONFIG_SHELL@ # print version string of NTP daemon # Copyright (c) 1997 by Ulrich Windl # Modified 970318: Harlan Stenn: rewritten... # usage: ntpver hostname -ntpq -c "rv 0 daemon_version" $* | awk '/daemon_version/ { print $2 }' +ntpq -c "rv 0 daemon_version" $* | @AWK@ '/daemon_version/ { print $2 }' diff --git a/sntp/Makefile.am b/sntp/Makefile.am index 14f974b61..32975e1c4 100644 --- a/sntp/Makefile.am +++ b/sntp/Makefile.am @@ -92,10 +92,8 @@ DISTCLEANFILES = \ $(NULL) EXTRA_DIST = \ - bincheck.mf \ $(srcdir)/COPYRIGHT \ deps-ver \ - depsver.mf \ @NTP_FORCE_LIBEVENT_DIST@ \ sntp-opts.def \ sntp-opts.menu \ @@ -109,12 +107,11 @@ EXTRA_DIST = \ $(NULL) BUILT_SOURCES = \ - check-libntp \ $(srcdir)/COPYRIGHT \ libtool \ $(srcdir)/sntp-opts.c \ $(srcdir)/sntp-opts.h \ - $(srcdir)/version \ + check-version \ $(srcdir)/include/version.def \ $(srcdir)/m4/version.m4 \ $(srcdir)/include/version.texi \ @@ -137,7 +134,7 @@ noinst_DATA= \ $(srcdir)/sntp-opts.menu \ $(NULL) -FRC FRC.version: +FRC: @: 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 @@ -147,8 +144,11 @@ FRC FRC.version: $(PROGRAMS): version.o ## We probably need something about libevent, too -version.o: $(sntp_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version - env CSET=`cat $(top_srcdir)/version` ../$(top_builddir)/scripts/mkver sntp +## That is probably not possible since LDADD_LIBEVENT may be +## non-file "-levent_core". + +version.o: $(sntp_OBJECTS) ../libntp/libntp.a $(srcdir)/version + env CSET=`cat $(srcdir)/version` $(top_builddir)/../scripts/mkver sntp $(COMPILE) -c version.c check-autogen-version.def: FRC @@ -166,13 +166,11 @@ $(srcdir)/autogen-version.def: built-sources-only: $(BUILT_SOURCES) @: do-nothing action to avoid default SCCS get -# 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 && \ +## HMS: The next bit is still suboptimal. We'll get an error if this is +## a bk repo and srcdir or version is unwritable. + +check-version: + -test -r $(srcdir)/../SCCS/s.ChangeSet && \ (bk version) >/dev/null 2>&1 && \ cd $(srcdir)/.. && \ x=`bk -R prs -hr+ -nd:I: ChangeSet` && \ @@ -227,12 +225,6 @@ $(srcdir)/sntp-opts.texi: $(srcdir)/sntp-opts.def $(srcdir)/include/version.def $(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 ) -check-libntp: FRC - cd ../libntp && $(MAKE) - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - libtool: $(LIBTOOL_DEPS) ./config.status --recheck @@ -243,5 +235,7 @@ dist-hook: libevent-dist-hook @: do-nothing action to avoid default SCCS get include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/check-libntp.mf +include $(top_srcdir)/check-libopts.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/sntp/check-libntp.mf b/sntp/check-libntp.mf new file mode 100644 index 000000000..51b3a05fa --- /dev/null +++ b/sntp/check-libntp.mf @@ -0,0 +1,15 @@ +## check-libntp.mf - automake fragment +## +## tests/libntp/Makefile.am +## sntp/tests/Makefile.am +## The above files have adaptations of this for deeper nesting. + +BUILT_SOURCES += check-libntp +CLEANFILES += check-libntp + +check-libntp: ../libntp/libntp.a + @echo stamp > $@ + +../libntp/libntp.a: + cd ../libntp && $(MAKE) libntp.a + diff --git a/sntp/check-libopts.mf b/sntp/check-libopts.mf new file mode 100644 index 000000000..42e3db838 --- /dev/null +++ b/sntp/check-libopts.mf @@ -0,0 +1,14 @@ +## check-libopts.mf - automake fragment +## +## If we are not using the tearoff libopts, we won't be +## building its libopts.la, so the submake is allowed +## to fail. + +BUILT_SOURCES += check-libopts +CLEANFILES += check-libopts + +check-libopts: libopts/libopts.la + @echo stamp > $@ + +libopts/libopts.la: + -cd libopts && $(MAKE) libopts.la diff --git a/sntp/m4/ntp_googletest.m4 b/sntp/m4/ntp_googletest.m4 index fd492c896..5dd28c995 100644 --- a/sntp/m4/ntp_googletest.m4 +++ b/sntp/m4/ntp_googletest.m4 @@ -14,6 +14,7 @@ AC_ARG_WITH( case "$try_gtest" in yes) AC_PATH_PROG([GTEST_CONFIG], [gtest-config]) + AS_UNSET([ac_cv_path_GTEST_CONFIG]) case x${GTEST_CONFIG} in x) ;; *) diff --git a/sntp/m4/ntp_libevent.m4 b/sntp/m4/ntp_libevent.m4 index 6f914224a..2720146b8 100644 --- a/sntp/m4/ntp_libevent.m4 +++ b/sntp/m4/ntp_libevent.m4 @@ -14,28 +14,14 @@ dnl NTP_LIBEVENT_CHECK_NOBUILD([2.0.9], [sntp/libevent]) dnl NTP_LIBEVENT_CHECK dnl AC_DEFUN([NTP_LIBEVENT_CHECK_NOBUILD], [ +AC_REQUIRE([NTP_PKG_CONFIG])dnl -ntp_pkgconfig_min_version='0.15.0' ntp_libevent_min_version=m4_default([$1], [2.0.9]) ntp_libevent_tearoff=m4_default([$2], [libevent]) AC_SUBST([CPPFLAGS_LIBEVENT]) AC_SUBST([LDADD_LIBEVENT]) -AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -# Make sure pkg-config is recent enough -case "$PKG_CONFIG" in - /*) - AC_MSG_CHECKING([if pkg-config is at least version $ntp_pkgconfig_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $ntp_pkgconfig_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi - ;; -esac - AC_ARG_ENABLE( [local-libevent], [AC_HELP_STRING( diff --git a/sntp/m4/ntp_openssl.m4 b/sntp/m4/ntp_openssl.m4 index 2c799a5c4..27931d6ff 100644 --- a/sntp/m4/ntp_openssl.m4 +++ b/sntp/m4/ntp_openssl.m4 @@ -1,6 +1,7 @@ dnl ###################################################################### dnl OpenSSL support shared by top-level and sntp/configure.ac AC_DEFUN([NTP_OPENSSL], [ +AC_REQUIRE([NTP_PKG_CONFIG])dnl LCRYPTO= AC_SUBST([LCRYPTO]) @@ -14,31 +15,19 @@ AC_ARG_WITH( [ans=$withval], [ans=x] ) +need_dash_r= case "$ans" in - no) - need_dash_r= - ;; yes) need_dash_r=1 ;; -esac -# HMS: Why isn't this $build? -# Well, that depends on if we need this for the build toolchain or -# for info in the host executable... -# I still have no idea which way this should go, but nobody has complained. -case "$host" in - *-*-netbsd*) - case "$need_dash_r" in - no) ;; - *) need_dash_r=1 - ;; - esac - ;; - *-*-solaris*) - case "$need_dash_r" in - no) ;; - *) need_dash_r=1 - ;; + x) + case "$host" in + *-*-netbsd*) + need_dash_r=1 + ;; + *-*-solaris*) + need_dash_r=1 + ;; esac ;; esac @@ -47,8 +36,6 @@ AC_SUBST([OPENSSL]) AC_SUBST([OPENSSL_INC]) AC_SUBST([OPENSSL_LIB]) -AC_PATH_PROG([PKG_CONFIG], [pkg-config]) - AC_MSG_CHECKING([for openssl library directory]) AC_ARG_WITH( [openssl-libdir], diff --git a/sntp/m4/ntp_pkg_config.m4 b/sntp/m4/ntp_pkg_config.m4 new file mode 100644 index 000000000..28a7315a6 --- /dev/null +++ b/sntp/m4/ntp_pkg_config.m4 @@ -0,0 +1,26 @@ +dnl NTP_PKG_CONFIG -*- Autoconf -*- +dnl +dnl Look for pkg-config, which must be at least +dnl $ntp_pkgconfig_min_version. +dnl +AC_DEFUN([NTP_PKG_CONFIG], [ + +dnl lower the minimum version if you find an earlier one works +ntp_pkgconfig_min_version='0.15.0' +AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +AS_UNSET([ac_cv_path_PKG_CONFIG]) + +case "$PKG_CONFIG" in + /*) + AC_MSG_CHECKING([if pkg-config is at least version $ntp_pkgconfig_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $ntp_pkgconfig_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + ;; +esac + +]) dnl NTP_PKG_CONFIG + diff --git a/sntp/tests/Makefile.am b/sntp/tests/Makefile.am index ec0c874a1..910a95ccd 100644 --- a/sntp/tests/Makefile.am +++ b/sntp/tests/Makefile.am @@ -88,5 +88,17 @@ if !NTP_CROSSCOMPILE TESTS += $(check_PROGRAMS) endif +## check-libntp.mf - automake fragment +## slightly adapted for deeper directory + +BUILT_SOURCES += check-libntp +CLEANFILES += check-libntp + +check-libntp: ../../libntp/libntp.a + @echo stamp > $@ + +../../libntp/libntp.a: + cd ../../libntp && $(MAKE) libntp.a + include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/tests/libntp/Makefile.am b/tests/libntp/Makefile.am index f5d8727fc..7be168a5d 100644 --- a/tests/libntp/Makefile.am +++ b/tests/libntp/Makefile.am @@ -76,5 +76,17 @@ if !NTP_CROSSCOMPILE TESTS += tests endif +## check-libntp.mf - automake fragment +## slightly adapted for deeper directory + +BUILT_SOURCES += check-libntp +CLEANFILES += check-libntp + +check-libntp: ../../libntp/libntp.a + @echo stamp > $@ + +../../libntp/libntp.a: + cd ../../libntp && $(MAKE) libntp.a + include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf diff --git a/util/Makefile.am b/util/Makefile.am index 2fc2b4efb..42335d7d8 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -25,7 +25,7 @@ ntp_keygen_LDADD += $(LDADD_LIBNTP) $(PTHREAD_LIBS) $(LCRYPTO) ntp_keygen_SOURCES = ntp-keygen.c ntp-keygen-opts.c ntp-keygen-opts.h EXTRA_DIST= ntp-keygen-opts.def ntp-keygen.1 ntp-keygen-opts.texi ntp-keygen-opts.menu -BUILT_SOURCES= check-libntp ntp-keygen-opts.c ntp-keygen-opts.h +BUILT_SOURCES= ntp-keygen-opts.c ntp-keygen-opts.h CLEANFILES= DISTCLEANFILES= .version version.c noinst_DATA= $(srcdir)/ntp-keygen-opts.texi $(srcdir)/ntp-keygen-opts.menu @@ -60,13 +60,6 @@ $(srcdir)/ntp-keygen-opts.texi: $(srcdir)/ntp-keygen-opts.def $(std_def_list) jitter_SOURCES= jitter.c jitter.h jitter_LDADD= -FRC: - -check-libntp: FRC ../libntp/libntp.a - -../libntp/libntp.a: - cd ../libntp && $(MAKE) - kern.o: kern.c $(COMPILE) -DHAVE_TIMEX_H -c kern.c @@ -80,5 +73,7 @@ version.o: $(ntp_keygen_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/ $(COMPILE) -c version.c include $(top_srcdir)/bincheck.mf +include $(top_srcdir)/sntp/check-libntp.mf +include $(top_srcdir)/check-libopts.mf include $(top_srcdir)/depsver.mf include $(top_srcdir)/includes.mf