From: Dave Hart Date: Tue, 20 Oct 2009 17:47:04 +0000 (+0000) Subject: Do not attempt to execute built binaries from ntpd/Makefile when X-Git-Tag: NTP_4_2_5P236_RC~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86f9dd40daa90f79862f09268524394b18ef3c6f;p=thirdparty%2Fntp.git Do not attempt to execute built binaries from ntpd/Makefile when cross-compiling (keyword-gen and ntpd --saveconfigquit). sntp/main.c: Remove duplicate global adr_buf[] (also defined in networking.c) which Piotr Grudzinski identified breaking his build. Correct in6addr_any test in configure.ac to attempt link too. bk: 4addf798UXIM0k9Q-l__E_uEbhGvwg --- diff --git a/ChangeLog b/ChangeLog index d7940447b..4cd60244f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ * [Bug 1343] ntpd/ntp_io.c close_fd() does not compile on Solaris 7. +* Do not attempt to execute built binaries from ntpd/Makefile when + cross-compiling (keyword-gen and ntpd --saveconfigquit). +* sntp/main.c: Remove duplicate global adr_buf[] (also defined in + networking.c) which Piotr Grudzinski identified breaking his build. +* Correct in6addr_any test in configure.ac to attempt link too. (4.2.5p235-RC) 2009/10/18 Released by Harlan Stenn * [Bug 1343] lib/isc build breaks on systems without IPv6 headers. (4.2.5p234-RC) 2009/10/16 Released by Harlan Stenn diff --git a/configure.ac b/configure.ac index 852c53d7f..9a13db6e2 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,7 @@ ntp_configure_cache_version=20090503 NTP_CACHEVERSION([main], [$ntp_configure_cache_version]) AM_INIT_AUTOMAKE +AC_CANONICAL_BUILD AC_CANONICAL_HOST dnl the 'build' machine is where we run configure and compile dnl the 'host' machine is where the resulting stuff runs. @@ -199,7 +200,8 @@ case "$GCC" in # 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, @@ -4621,9 +4623,9 @@ esac AC_CACHE_CHECK( [for in6addr_any], - ac_cv_have_in6addr_any, + isc_cv_have_in6addr_any, [ - AC_COMPILE_IFELSE( + AC_LINK_IFELSE( [ AC_LANG_PROGRAM( [ @@ -4639,13 +4641,13 @@ AC_CACHE_CHECK( ] ) ], - [ac_cv_have_in6addr_any=yes], - [ac_cv_have_in6addr_any=no] + [isc_cv_have_in6addr_any=yes], + [isc_cv_have_in6addr_any=no] ) ] ) -case "$ac_cv_have_in6addr_any" in +case "$isc_cv_have_in6addr_any" in no) AC_DEFINE(ISC_PLATFORM_NEEDIN6ADDRANY, , [missing in6addr_any?]) esac diff --git a/ntpd/Makefile.am b/ntpd/Makefile.am index ee1c10ba5..cc80d61f1 100644 --- a/ntpd/Makefile.am +++ b/ntpd/Makefile.am @@ -16,11 +16,21 @@ LDADD= version.o libntpd.a @LIBPARSE@ AM_YFLAGS= -d -t -r all if SAVECONFIG_ENABLED -CHECK_SAVECONFIG= check-saveconfig +if NTP_CROSSCOMPILE +CHECK_SAVECONFIG= else +CHECK_SAVECONFIG= check-saveconfig +endif +else !SAVECONFIG_ENABLED CHECK_SAVECONFIG= endif +if NTP_CROSSCOMPILE +NTP_KEYWORD_OUT=ntp_keyword.dummy +else +NTP_KEYWORD_OUT=ntp_keyword.out +endif + # # VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as # BSD make) to work around issues specific to compiling @@ -78,7 +88,8 @@ ntpdsim_LDADD = $(LDADD) -lm @LCRYPTO@ @LSCF@ $(LIBOPTS_LDADD) ../libntp/libntps ntpdsim_CFLAGS = $(CFLAGS) -DSIM check_y2k_LDADD = $(LDADD) ../libntp/libntp.a DISTCLEANFILES = keyword-gen .version version.c -CLEANFILES = check-saveconfig compsave.conf ntp_keyword.out +CLEANFILES = check-saveconfig compsave.conf ntp_keyword.out \ + ntp_keyword.dummy EXTRA_DIST = \ complete.conf \ ntpd-opts.def \ @@ -185,8 +196,11 @@ ntp_keyword.out: keyword-gen grep -v diff_ignore_line < $@ > cmp2 cmp cmp1 cmp2 > /dev/null || cp $@ $(srcdir)/ntp_keyword.h rm cmp1 cmp2 + +ntp_keyword.dummy: + echo stamp > $@ -$(srcdir)/ntp_keyword.h: ntp_keyword.out +$(srcdir)/ntp_keyword.h: $(NTP_KEYWORD_OUT) echo $(srcdir)/ntp_keyword.h is unchanged > /dev/null $(srcdir)/ntpd-opts.h: $(srcdir)/ntpd-opts.c diff --git a/sntp/configure.ac b/sntp/configure.ac index e72d2734f..c8f8cb028 100644 --- a/sntp/configure.ac +++ b/sntp/configure.ac @@ -31,6 +31,7 @@ sntp_configure_cache_version=20090503 NTP_CACHEVERSION([sntp], [$sntp_configure_cache_version]) AM_INIT_AUTOMAKE +AC_CANONICAL_BUILD AC_CANONICAL_HOST dnl the 'build' machine is where we run configure and compile dnl the 'host' machine is where the resulting stuff runs. @@ -495,9 +496,9 @@ esac AC_CACHE_CHECK( [for in6addr_any], - ac_cv_have_in6addr_any, + isc_cv_have_in6addr_any, [ - AC_COMPILE_IFELSE( + AC_LINK_IFELSE( [ AC_LANG_PROGRAM( [ @@ -513,13 +514,13 @@ AC_CACHE_CHECK( ] ) ], - [ac_cv_have_in6addr_any=yes], - [ac_cv_have_in6addr_any=no] + [isc_cv_have_in6addr_any=yes], + [isc_cv_have_in6addr_any=no] ) ] ) -case "$ac_cv_have_in6addr_any" in +case "$isc_cv_have_in6addr_any" in no) AC_DEFINE(ISC_PLATFORM_NEEDIN6ADDRANY, , [missing in6addr_any?]) esac diff --git a/sntp/main.c b/sntp/main.c index c545d26fa..a9736427c 100644 --- a/sntp/main.c +++ b/sntp/main.c @@ -19,7 +19,6 @@ char *progname = "sntp"; /* for msyslog */ int ai_fam_pref; volatile int debug; -char adr_buf[INET6_ADDRSTRLEN]; struct key *keys = NULL; @@ -162,6 +161,7 @@ on_wire ( struct addrinfo *host ) { + char addr_buf[INET6_ADDRSTRLEN]; register int try; SOCKET sock; struct pkt x_pkt; @@ -252,11 +252,11 @@ on_wire ( NTOHL_FP(&r_pkt.rec, &p_rec); NTOHL_FP(&r_pkt.xmt, &p_xmt); - if(ENABLED_OPT(NORMALVERBOSE)) { - getnameinfo(host->ai_addr, host->ai_addrlen, adr_buf, - sizeof(adr_buf), NULL, 0, NI_NUMERICHOST); + if (ENABLED_OPT(NORMALVERBOSE)) { + getnameinfo(host->ai_addr, host->ai_addrlen, addr_buf, + sizeof(addr_buf), NULL, 0, NI_NUMERICHOST); - printf("sntp on_wire: Received %i bytes from %s\n", rpktl, adr_buf); + printf("sntp on_wire: Received %i bytes from %s\n", rpktl, addr_buf); } #ifdef DEBUG @@ -318,12 +318,12 @@ on_wire ( } char logmsg[32 + INET6_ADDRSTRLEN]; - getnameinfo(host->ai_addr, host->ai_addrlen, adr_buf, sizeof(adr_buf), NULL, 0, NI_NUMERICHOST); + getnameinfo(host->ai_addr, host->ai_addrlen, addr_buf, sizeof(addr_buf), NULL, 0, NI_NUMERICHOST); - snprintf(logmsg, sizeof(logmsg), "Received no useable packet from %s!", adr_buf); + snprintf(logmsg, sizeof(logmsg), "Received no useable packet from %s!", addr_buf); - if(ENABLED_OPT(NORMALVERBOSE)) - printf("sntp on_wire: Received no useable packet from %s!\n", adr_buf); + if (ENABLED_OPT(NORMALVERBOSE)) + printf("sntp on_wire: Received no useable packet from %s!\n", addr_buf); log_msg(logmsg, 1);