]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Do not attempt to execute built binaries from ntpd/Makefile when
authorDave Hart <hart@ntp.org>
Tue, 20 Oct 2009 17:47:04 +0000 (17:47 +0000)
committerDave Hart <hart@ntp.org>
Tue, 20 Oct 2009 17:47:04 +0000 (17:47 +0000)
  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

ChangeLog
configure.ac
ntpd/Makefile.am
sntp/configure.ac
sntp/main.c

index d7940447bb0c948ab0159f3bc2fe7532e75761a8..4cd60244f80a509362693a0e1cdca77b1dc251ad 100644 (file)
--- 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 <stenn@ntp.org>
 * [Bug 1343] lib/isc build breaks on systems without IPv6 headers.
 (4.2.5p234-RC) 2009/10/16 Released by Harlan Stenn <stenn@ntp.org>
index 852c53d7f62f49b36a3731cd93a8abd4d43e2c31..9a13db6e2ee1860b4168c969e8b24ac94318c097 100644 (file)
@@ -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
index ee1c10ba57ba246b56fe9a03c7a105fe8157d6d8..cc80d61f1f75c65be30bc956a9795635b664db99 100644 (file)
@@ -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
index e72d2734f32a435bd90f2adaab2f0235ca504fd5..c8f8cb028e12ac79a8e55161f2f0facde87dbea9 100644 (file)
@@ -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
index c545d26faf48c9425899b9a64079e4b1953efa0a..a9736427c0b825e28d76a1a0f3cd1f4097b2fc32 100644 (file)
@@ -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);