]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
add NTP_CACHEVERSION to toss config.cache from different version
authorDave Hart <hart@ntp.org>
Fri, 1 May 2009 20:05:24 +0000 (20:05 +0000)
committerDave Hart <hart@ntp.org>
Fri, 1 May 2009 20:05:24 +0000 (20:05 +0000)
---
enable gcc -Wstrict-overflow for gsoc_sntp

bk: 49fb5604JG8G8yJencEpKJK7N85fPA

ChangeLog
configure.ac
gsoc_sntp/Makefile.am
gsoc_sntp/configure.ac
include/ntp.h
m4/ntp_cacheversion.m4 [new file with mode: 0644]
ntpd/ntp_refclock.c
sntp/Makefile.am
sntp/configure.ac

index 501ce2aa04d00058ea3f4f2053f938d1011c3fc6..030318cdef2f580e5b90c3e90897da7b894ae557 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+* Add NTP_CACHEVERSION mechanism to ignore incompatible config.cache
+* Enable gcc -Wstrict-overflow for gsoc_sntp as well
 * [Bug 1090] Fix bogus leap seconds in refclock_hpgps.
 (4.2.5p168) 2009/04/29 Released by Harlan Stenn <stenn@ntp.org>
 * Include (4.2.4p7-RC4)
index f6e6e8a8b2748e90d92c242445b78deea214bf7e..951bc18438fdd6bcd6c1e107f43a83c33183bc0c 100644 (file)
@@ -1,7 +1,23 @@
 dnl -*-fundamental-*-
 dnl Process this file with autoconf to produce a configure script.
 m4_include([version.m4])
-AC_INIT(ntp, VERSION_NUMBER)
+AC_INIT([ntp], [VERSION_NUMBER])
+
+# Increment ntp_configure_cache_version by one for each change to
+# configure.ac or .m4 files which invalidates cached values from
+# previous versions.
+
+# It is not necessary to bump the version in more than one
+# configure.ac at the same time, as the cache is shared.
+# Previously used values should never be used again.
+
+ntp_configure_cache_version=0
+
+# When the cache version of config.cache and configure do not
+# match, NTP_CACHEVERSION will flush the cache.
+
+NTP_CACHEVERSION([main], [$ntp_configure_cache_version])
+
 AM_INIT_AUTOMAKE
 AC_CANONICAL_HOST
 dnl the 'build' machine is where we run configure and compile
@@ -140,7 +156,7 @@ case "$GCC" in
        ]
     )
     CFLAGS="$SAVED_CFLAGS_AC"
-    unset SAVED_CFLAGS_AC
+    $as_unset SAVED_CFLAGS_AC
     #
     # $ac_cv_gcc_Wstrict_overflow is tested later to add the 
     # flag to CFLAGS.
@@ -164,7 +180,7 @@ case "$GCC" in
        ]
     )
     CFLAGS="$SAVED_CFLAGS_AC"
-    unset SAVED_CFLAGS_AC
+    $as_unset SAVED_CFLAGS_AC
     #
     # $ac_cv_gcc_Winit_self is tested later to add the 
     # flag to CFLAGS.
@@ -3868,7 +3884,7 @@ esac
 # be better to simply remove the hunk above, I did not want
 # to remove it if there is hope it will be used again.
 #
-unset ac_cv_make_tickadj
+$as_unset ac_cv_make_tickadj
 
 AC_CACHE_CHECK([if we want and can make the tickadj utility], ac_cv_make_tickadj,
 ac_cv_make_tickadj=yes)
@@ -4278,7 +4294,7 @@ AC_MSG_CHECKING([if we want the windows symmetric client hack])
 
 # default is no, unless --enable-ntp-signd was given
 ans=$wintime_default
-unset wintime_default
+$as_unset wintime_default
 
 AC_ARG_ENABLE(
     [wintime],
index ef9fa6fe9fa3c53be1f4b669f21b5cfc3b3f22b2..659f6c423e810d319f389e049beede18a708b405 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile.am for JMK's SNTP, by Harlan Stenn
 
 AUTOMAKE_OPTIONS = foreign
-ACLOCAL_AMFLAGS= -I libopts/m4
+ACLOCAL_AMFLAGS= -I ../m4 -I libopts/m4
 
 AM_CPPFLAGS=   $(LIBOPTS_CFLAGS) -I$(top_srcdir)/../include
 LDADD= $(LIBOPTS_LDADD) -lm ../libntp/libntp.a
index 302441e03764b9fc9dd27ce4b73b28781878845c..dc8d5c3e8653aac6530c39a728ee646abe458f5f 100644 (file)
@@ -2,6 +2,22 @@
 # Process this file with autoconf to produce a configure script.
 m4_include([../version.m4])
 AC_INIT([sntp], [VERSION_NUMBER])
+
+# Increment sntp_configure_cache_version by one for each change to
+# configure.ac or .m4 files which invalidates cached values from
+# previous versions.
+
+# It is not necessary to bump the version in more than one
+# configure.ac at the same time, as the cache is shared.
+# Previously used values should never be used again.
+
+sntp_configure_cache_version=0
+
+# When the version of config.cache and configure do not
+# match, NTP_CACHEVERSION will flush the cache.
+
+NTP_CACHEVERSION([sntp], [$sntp_configure_cache_version])
+
 AM_INIT_AUTOMAKE
 AC_CANONICAL_HOST
 dnl the 'build' machine is where we run configure and compile
@@ -61,7 +77,7 @@ case "$GCC" in
     # CFLAGS="$CFLAGS -Wwrite-strings"
     case "$ac_cv_gcc_Wstrict_overflow" in
      yes)
-       #not yet#CFLAGS="$CFLAGS -Wstrict-overflow"
+       CFLAGS="$CFLAGS -Wstrict-overflow"
     esac
 esac
 
index b188c123ec05e68d99b3c635df80665a9af446b6..592ac7bc65bf48b18eca7f36fcec0d2882109dc4 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <math.h>
 
+#include <ntp_fp.h>
 #include <ntp_types.h>
 #ifdef OPENSSL
 #include <ntp_crypto.h>
diff --git a/m4/ntp_cacheversion.m4 b/m4/ntp_cacheversion.m4
new file mode 100644 (file)
index 0000000..18a9aa6
--- /dev/null
@@ -0,0 +1,82 @@
+# NTP_CACHEVERSION(component, version)
+# ------------------------------------
+# compare this configure script's cache version stamp with the stamp
+# saved by the prior run in config.cache.  If they differ, clear all
+# cache variables to avoid using results cached with a script that
+# is known to differ in a cache-invalidating manner.
+#
+# Note: use immediately following AC_INIT in configure.ac, as clearing
+# all _cv_ variables only makes sense immediately after loading, before
+# use or modification.
+#
+# It is assumed that parent configure.ac files which use
+# AC_CONFIG_SUBDIR to invoke child configure.ac files have used 
+# NTP_CACHEVERSION if any children do.  The top-level configure script
+# will clear a previous cache lacking any saved cache version number,
+# while children do not.  The reason is the children can rely on the
+# parent having cleared any cache variables predating this mechanism.
+# Therefore the child can rely on the config.cache generated by the
+# parent on the first run despite not finding its version stamp
+# previously saved.
+
+AC_DEFUN_ONCE([NTP_CACHEVERSION], [
+    AC_BEFORE([$0], [AM_INIT_AUTOMAKE])dnl
+    AC_BEFORE([$0], [AM_CONFIG_HEADER])dnl
+    AC_BEFORE([$0], [AC_PROG_CC])dnl
+
+    ntp_cache_flush=1
+    case "$ntp_cv_[$1]_cache_version" in
+     [$2])
+       # same version, good
+       ntp_cache_flush=0
+       ;;
+     '')
+       # No cache, predates ntp_cv_$1_cache_version, or is empty.
+       case "$cache_file" in
+        ../*)
+           # Parent configure will have cleared cache once already.
+           # This will misfire if a top-level configure is invoked
+           # with --config-cache= value beginning with '../', is
+           # there a better way to detect this configure was
+           # invoked by a parent directory configure?
+           ntp_cache_flush=0
+           ;;
+        /dev/null)
+           ntp_cache_flush=0
+       esac
+       ;;
+     *)
+       # configure cache version mismatches config.cache version
+    esac
+    case "$ntp_cache_flush" in
+     1)
+       # Clear all *_cv_* variables except our various components' 
+       # ntp_cv_*_cache_version vars.
+       
+       c_varname_list=`set |
+                       sed 's/=.*$//' |
+                       grep -F _cv_ | 
+                       grep -v 'ntp_cv_.*_cache_version'
+                      `
+       for c_varname in $c_varname_list
+       do
+           dnl use AS_UNSET([$c_varname]) eventually
+           eval ${c_varname}=; 
+           $as_unset $c_varname
+       done
+       
+       dnl use AS_UNSET([c_varname_list c_varname]) eventually
+       c_varname_list=; $as_unset c_varname_list c_varname
+       
+       AC_MSG_NOTICE([$cache_file saved by another version, ignored.])
+       AC_MSG_NOTICE([configure script cache version: [$2]])
+       c_version="${ntp_cv_[$1]_cache_version:-(no version found)}"
+       AC_MSG_NOTICE([$cache_file version: $c_version])
+       $as_unset c_version
+    esac
+
+    # save configure version in config.cache for next time
+    ntp_cv_[$1]_cache_version="[$2]"
+
+    $as_unset ntp_cache_flush
+])dnl
index f3dcdcfb0664f82768115cf5b42b38e353fa0adc..c28660dab3c0ab848cc2458fe21f37814679b9d2 100644 (file)
@@ -1215,7 +1215,7 @@ refclock_ppsapi(
        struct refclock_atom *ap        /* atom structure pointer */
        )
 {
-       if (!ap->handle) {
+       if (ap->handle == 0) {
                if (time_pps_create(fddev, &ap->handle) < 0) {
                        msyslog(LOG_ERR,
                            "refclock_ppsapi: time_pps_create: %m");
@@ -1301,7 +1301,7 @@ refclock_pps(
         * most recent PPS timestamp.
         */ 
        pp = peer->procptr;
-       if (!ap->handle)
+       if (ap->handle == 0)
                return (0);
 
        if (ap->pps_params.mode == 0 && sys_leap != LEAP_NOTINSYNC) {
index 1bee65de1ef6d746058d7125171faa75a49778f6..b4ad02e52ae85a5c2c320896060e6429ae6ef2bd 100644 (file)
@@ -3,7 +3,7 @@
 # N.M. Maclaren, October 2000.
 
 AUTOMAKE_OPTIONS = foreign
-ACLOCAL_AMFLAGS= -I libopts/m4
+ACLOCAL_AMFLAGS= -I ../m4 -I libopts/m4
 
 AM_CPPFLAGS=   $(LIBOPTS_CFLAGS)
 LDADD= $(LIBOPTS_LDADD)
index be6943ff9d42e5a079a81055d0eab6770800c998..14d2edd2652939169d21d21119653c549f35c46f 100644 (file)
@@ -1,5 +1,21 @@
 # Process this file with autoconf to produce a configure script.
-AC_INIT(main.c)
+AC_INIT([msntp])
+
+# Increment msntp_configure_version by one for each
+# change to configure.ac or .m4 files which invalidates
+# cached values from previous versions.
+
+# It is not necessary to bump the version in more than one
+# configure.ac at the same time, as the cache is shared.
+# Previously used values should never be used again.
+
+msntp_configure_cache_version=0
+
+# When the version of config.cache and configure do not
+# match, NTP_CACHEVERSION will flush the cache.
+
+NTP_CACHEVERSION([msntp], [$msntp_configure_cache_version])
+
 AM_INIT_AUTOMAKE([msntp],[1.6])
 AC_CONFIG_SRCDIR([header.h])
 AC_CANONICAL_HOST