From: Dave Hart Date: Mon, 4 May 2009 02:05:29 +0000 (+0000) Subject: solve occasional sntp link problems with socket APIs by bringing its X-Git-Tag: NTP_4_2_5P171~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee8e199478ea7ad5ed2263ebcf3972ad3011c36a;p=thirdparty%2Fntp.git solve occasional sntp link problems with socket APIs by bringing its AC_SEARCH_LIBS for gethostent in line with main and gsoc_sntp configure tests, bump sntp/configure.ac cache version to 20090503 as a result --- ntp_cacheversion.m4: clear even other version stamps when flushing cache iff we are the top configure this invocation. bk: 49fe4d69JMkuKPTXH-6ZgjwgjfeJgg --- diff --git a/ChangeLog b/ChangeLog index 778c33990..a7e4ede8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ * Autokey documentation cleanup from Dave Mills. -* do not clear config.cache when it is already empty +* Fix problem linking msntp on Solaris when sntp subdir is configured + before parent caused by different gethostent library search order. +* Do not clear config.cache when it is already empty. (4.2.5p170) 2009/05/02 Released by Harlan Stenn * [Bug 1152] adjust PARSE to new refclock_pps logic * Include (4.2.4p7-RC5) diff --git a/configure.ac b/configure.ac index 14e3f7832..93d87aea4 100644 --- a/configure.ac +++ b/configure.ac @@ -11,11 +11,27 @@ AC_INIT([ntp], [VERSION_NUMBER]) # configure.ac at the same time, as the cache is shared. # Previously used values should never be used again. -ntp_configure_cache_version=0 +ntp_configure_cache_version=20090503 # When the cache version of config.cache and configure do not # match, NTP_CACHEVERSION will flush the cache. +# $NTP_CONFIGURE_PARENT is used to detect the top-level configure in +# NTP_CACHEVERSION. It is set to an empty string to indicate "known to +# have no parent" while unset indicates no knowledge. Just before +# AC_CONFIG_SUBDIRS in NTP's main configure.ac, NTP_CONFIGURE_PARENT +# is set to top. In all NTP configure.ac files, we set it to NULL +# if it is unset, so NTP_CACHE_VERSION does not rely on a heuristic. +# It may seem tempting to set it to '' unilaterally in this main +# NTP configure.ac, but that would preclude someone packaging NTP +# as part of a parent package with configure, as NTP_CACHEVERSION +# requires parents of its users to use it as well. When invoked by a +# parent configure script, it would be wrong to assume we are the top +# level configure invocation. We must respect NTP_CONFIGURE_PARENT. + +case "${NTP_CONFIGURE_PARENT=}" in +esac + NTP_CACHEVERSION([main], [$ntp_configure_cache_version]) AM_INIT_AUTOMAKE @@ -4720,6 +4736,11 @@ AC_CONFIG_FILES(scripts/plot_summary, [chmod +x scripts/plot_summary]) AC_CONFIG_FILES(scripts/summary, [chmod +x scripts/summary]) AC_CONFIG_FILES(util/Makefile) +# $NTP_CONFIGURE_PARENT is used to detect the top-level configure in +# NTP_CACHEVERSION (m4/ntp_cacheversion.m4) + +NTP_CONFIGURE_PARENT='top' ; export NTP_CONFIGURE_PARENT + AC_CONFIG_SUBDIRS(sntp) AC_CONFIG_SUBDIRS(gsoc_sntp) diff --git a/gsoc_sntp/configure.ac b/gsoc_sntp/configure.ac index b95523c4e..1136f86d9 100644 --- a/gsoc_sntp/configure.ac +++ b/gsoc_sntp/configure.ac @@ -11,7 +11,7 @@ AC_INIT([sntp], [VERSION_NUMBER]) # configure.ac at the same time, as the cache is shared. # Previously used values should never be used again. -sntp_configure_cache_version=0 +sntp_configure_cache_version=20090503 # When the version of config.cache and configure do not # match, NTP_CACHEVERSION will flush the cache. @@ -99,6 +99,7 @@ case "$host" in # -D_XOPEN_SOURCE=600 seems OK for c99 #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__" CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" + libxnet=-lxnet ;; esac @@ -126,13 +127,13 @@ AC_PROG_LIBTOOL # Checks for libraries. -AC_CHECK_FUNC(gethostent, , +AC_CHECK_FUNC([gethostent], , [AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket])]) -AC_CHECK_FUNC(openlog, , +AC_CHECK_FUNC([openlog], , [AC_SEARCH_LIBS([openlog], [gen], , [AC_SEARCH_LIBS([openlog], [syslog], , , [$libxnet -lsocket])])]) -AC_CHECK_FUNC(setsockopt, , +AC_CHECK_FUNC([setsockopt], , [AC_SEARCH_LIBS([setsockopt], [socket xnet])]) # Checks for header files. diff --git a/m4/ntp_cacheversion.m4 b/m4/ntp_cacheversion.m4 index fa5d3d8a7..0d54c170e 100644 --- a/m4/ntp_cacheversion.m4 +++ b/m4/ntp_cacheversion.m4 @@ -24,7 +24,43 @@ AC_DEFUN_ONCE([NTP_CACHEVERSION], [ AC_BEFORE([$0], [AM_CONFIG_HEADER])dnl AC_BEFORE([$0], [AC_PROG_CC])dnl + # Is this the top-level configure, or a child invoked + # by a parent via AC_CONFIG_SUBDIRS? There is no + # reliable general way to say, so we use a variable + # NTP_CONFIGURE_PARENT set to an empty string early + # in our top-level configure.ac and then set to the + # simple flag value 'top' before AC_CONFIG_SUBDIRS. + # Assuming only two levels of configure.ac files, + # only the parent has to manage AC_CONFIG_PARENT. + case "${NTP_CONFIGURE_PARENT-varnotset}" in + '') + ntp_top_configure=1 + ;; + varnotset) + # without a clear indication from NTP_CONFIGURE_PARENT + # heuristically assume we are a child configure if our + # cache file path begins with ../ + case "$cache_file" in + ../*) + ntp_top_configure=0 + AC_MSG_WARN([Using heuristic, guessing this configure is ]) + AC_MSG_WARN([a child of another configure script based ]) + AC_MSG_WARN([on cache file name starting with ../]) + ;; + *) + ntp_top_configure=1 + AC_MSG_WARN([Using heuristic, guessing this configure is ]) + AC_MSG_WARN([_not_ a child of another configure script ]) + AC_MSG_WARN([based on cache file name not starting ]) + AC_MSG_WARN([with ../]) + esac + ;; + *) + ntp_top_configure=0; + esac + ntp_cache_flush=1 + case "$ntp_cv_[$1]_cache_version" in [$2]) # same version, good @@ -37,33 +73,6 @@ AC_DEFUN_ONCE([NTP_CACHEVERSION], [ ntp_cache_flush=0 ;; *) - # Is this the top-level configure, or a child invoked - # by a parent via AC_CONFIG_SUBDIRS? There is no - # reliable general way to say, so we use a variable - # NTP_CONFIGURE_PARENT set to an empty string early - # in our top-level configure.ac and then set to the - # simple flag value 'top' before AC_CONFIG_SUBDIRS. - # Assuming only two levels of configure.ac files, - # only the parent has to manage AC_CONFIG_PARENT. - case "${NTP_CONFIGURE_PARENT-varnotset}" in - '') - ntp_top_configure=1 - ;; - varnotset) - # without a clear indication from NTP_CONFIGURE_PARENT - # heuristically assume we are a child configure if our - # cache file path begins with ../ - case "$cache_file" in - ../*) - ntp_top_configure=0 - ;; - *) - ntp_top_configure=1 - esac - ;; - *) - ntp_top_configure=0; - esac case "$ntp_top_configure" in 1) # Do not clear the cache immediately after it is created @@ -81,8 +90,10 @@ AC_DEFUN_ONCE([NTP_CACHEVERSION], [ # Parent configure just created cache from empty, # flushing would be counterproductive. ntp_cache_flush=0; + ;; + *) + AC_MSG_ERROR([NTP_CACHEVERSION var ntp_top_configure misset]) esac - $as_unset ntp_top_configure esac ;; *) @@ -90,14 +101,33 @@ AC_DEFUN_ONCE([NTP_CACHEVERSION], [ esac case "$ntp_cache_flush" in 1) - # Clear all *_cv_* variables except our various components' - # ntp_cv_*_cache_version vars. + # Do we flush all variables or exclude others' version stamps? + + case "$ntp_top_configure" in + 1) + # Clear all *_cv_* variables including our child subdirs' + # ntp_cv_*_cache_version variables. This prevents subdir + # configure scripts from noticing a version mismatch just + # after the top configure in the invocation cleared and + # recreated the cache. - c_varname_list=`set | - sed -n -e 's/=.*$//' \ - -e '/ntp_cv_.*_cache_version/d' \ - -e '/_cv_/p' - ` + c_varname_list=`set | + sed -n -e 's/=.*$//' \ + -e '/_cv_/p' + ` + ;; + *) + # This is not the top configure this particular invocation. + # Clear all *_cv_* variables sparing the version stamps + # of other configure scripts, so we don't trigger + # useless repeated clearings. + + c_varname_list=`set | + sed -n -e 's/=.*$//' \ + -e '/ntp_cv_.*_cache_version/d' \ + -e '/_cv_/p' + ` + esac for c_varname in $c_varname_list do dnl use AS_UNSET([$c_varname]) eventually @@ -117,5 +147,6 @@ AC_DEFUN_ONCE([NTP_CACHEVERSION], [ # save configure version in config.cache for next time ntp_cv_[$1]_cache_version="[$2]" - $as_unset ntp_cache_flush + $as_unset ntp_cache_flush ntp_top_configure + ])dnl diff --git a/sntp/configure.ac b/sntp/configure.ac index 2979cb03e..9123fa889 100644 --- a/sntp/configure.ac +++ b/sntp/configure.ac @@ -9,7 +9,7 @@ AC_INIT([msntp]) # configure.ac at the same time, as the cache is shared. # Previously used values should never be used again. -msntp_configure_cache_version=0 +msntp_configure_cache_version=20090503 # When the version of config.cache and configure do not # match, NTP_CACHEVERSION will flush the cache. @@ -79,6 +79,18 @@ case "$ac_cv_c_inline" in AC_SUBST(HAVE_INLINE) 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__" + libxnet=-lxnet + ;; +esac + # Checks for libraries. @@ -136,11 +148,12 @@ case "$ac_cv_have_ss_family_in_struct_ss$ac_cv_have___ss_family_in_struct_ss" in esac # Checks for library functions. +AC_CHECK_FUNC([gethostent], , + [AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket])]) #AC_FUNC_MEMCMP dnl HMS: we don't have a memcmp.c to use here, so why bother? AC_FUNC_SETVBUF_REVERSED AC_TYPE_SIGNAL AC_CHECK_FUNCS([alarm]) -AC_CHECK_FUNC([gethostent], , AC_SEARCH_LIBS([gethostent], [nsl], , , [-lsocket])) AC_CHECK_FUNCS([gettimeofday inet_ntoa memset]) AC_CHECK_FUNCS([socket], , AC_SEARCH_LIBS([socket], [socket])) AC_CHECK_FUNCS([sqrt], , AC_SEARCH_LIBS([sqrt], [m]))