File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / m4 / ntp_cacheversion.m4
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 1 month ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    1: # NTP_CACHEVERSION(component, version)
    2: # ------------------------------------
    3: # compare this configure script's cache version stamp with the stamp
    4: # saved by the prior run in config.cache.  If they differ, clear all
    5: # cache variables to avoid using results cached with a script that
    6: # is known to differ in a cache-invalidating manner.
    7: #
    8: # Note: use immediately following AC_INIT in configure.ac, as clearing
    9: # all _cv_ variables only makes sense immediately after loading, before
   10: # use or modification.
   11: #
   12: # It is assumed that parent configure.ac files which use
   13: # AC_CONFIG_SUBDIR to invoke child configure.ac files have used 
   14: # NTP_CACHEVERSION if any children do.  The top-level configure script
   15: # will clear a previous cache lacking any saved cache version number,
   16: # while children do not.  The reason is the children can rely on the
   17: # parent having cleared any cache variables predating this mechanism.
   18: # Therefore the child can rely on the config.cache generated by the
   19: # parent on the first run despite not finding its version stamp
   20: # previously saved.  In this case top-level means a configure script
   21: # not invoked by another configure script in its parent directory.
   22: 
   23: AC_DEFUN_ONCE([NTP_CACHEVERSION], [
   24:     AC_BEFORE([$0], [AM_INIT_AUTOMAKE])dnl
   25:     AC_BEFORE([$0], [AM_CONFIG_HEADER])dnl
   26:     AC_BEFORE([$0], [AC_PROG_CC])dnl
   27:     AC_BEFORE([$0], [AC_CONFIG_SUBDIRS])dnl
   28: 
   29:     ntp_cache_flush=1
   30:     
   31:     case "$ntp_cv_[$1]_cache_version" in
   32:      [$2])
   33: 	# same version, good
   34: 	ntp_cache_flush=0
   35: 	;;
   36:      '')
   37: 	# No cache, predates ntp_cv_$1_cache_version, or is empty.
   38: 	case "$cache_file" in
   39: 	 /dev/null)
   40: 	    ntp_cache_flush=0
   41: 	    ;;
   42: 	 *)
   43: 	    case "$NTP_CACHEVERSION_PARENT" in
   44: 	     '')
   45: 		# Do not clear the cache immediately after it is created
   46: 		# empty as it is noisy.  Differentiate a newly-created 
   47: 		# config.cache from one predating the cache version 
   48: 		# mechanism by looking for the first cached variable set 
   49: 		# by Autoconf
   50: 		case "$ac_cv_path_install" in
   51: 		 '')
   52: 		    # empty config.cache file
   53: 		    ntp_cache_flush=0
   54: 		esac
   55: 		;;
   56: 	     *)
   57: 		# Parent configure just created cache from empty,
   58: 		# flushing would be counterproductive.
   59: 		ntp_cache_flush=0;
   60: 	    esac
   61: 	esac
   62: 	;;
   63:      *)
   64: 	# configure cache version mismatches config.cache version
   65:     esac
   66:     
   67:     case "$ntp_cache_flush" in
   68:      1)
   69: 	c_version="${ntp_cv_[$1]_cache_version:-(no version found)}"
   70: 	
   71: 	# Do we flush all variables or exclude others' version stamps?
   72: 
   73: 	case "$NTP_CACHEVERSION_PARENT" in
   74: 	 '')
   75: 	    # Clear all *_cv_* variables including our child subdirs'
   76: 	    # ntp_cv_*_cache_version variables.  This prevents subdir
   77: 	    # configure scripts from noticing a version mismatch just
   78: 	    # after the top configure in the invocation cleared and
   79: 	    # recreated the cache.
   80: 	
   81: 	    c_varname_list=`set |
   82: 			    sed -n -e 's/=.*$//' \
   83: 				   -e '/_cv_/p'
   84: 			   `
   85: 	    ;;
   86: 	 *)
   87: 	    # This is not the top configure this particular invocation.
   88: 	    # Clear all *_cv_* variables sparing the version stamps
   89: 	    # of other configure scripts, so we don't trigger
   90: 	    # useless repeated clearings.
   91: 
   92: 	    c_varname_list=`set |
   93: 			    sed -n -e 's/=.*$//' \
   94: 				   -e '/ntp_cv_.*_cache_version/d' \
   95: 				   -e '/_cv_/p'
   96: 			   `
   97: 	esac
   98: 	
   99: 	for c_varname in $c_varname_list
  100: 	do
  101: 	    AS_UNSET([$c_varname])
  102: 	done
  103: 	
  104: 	AC_MSG_NOTICE([[$cache_file saved by another version, ignored.]])
  105: 	AC_MSG_NOTICE([[configure script cache version: ]][$2])
  106: 	AC_MSG_NOTICE([[$cache_file version: $c_version]])
  107: 	AS_UNSET([c_varname])
  108: 	AS_UNSET([c_varname_list])
  109: 	AS_UNSET([c_version])
  110:     esac
  111: 
  112:     AS_UNSET([ntp_cache_flush])
  113: 
  114:     # save configure version in config.cache for next time
  115:     ntp_cv_[$1]_cache_version="[$2]"
  116: 
  117:     # let any subdir configure.ac NTP_CACHEVERSION invocations
  118:     # know they are not the top level.
  119:     NTP_CACHEVERSION_PARENT='[$1]' ; export NTP_CACHEVERSION_PARENT
  120: ])dnl
  121: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>