r316 - in lvm2/trunk: . daemons/clvmd dmeventd/mirror include lib lib/activate lib/cache lib/commands lib/datastruct lib/device lib/error lib/filters lib/format1 lib/format_pool lib/format_text lib/label lib/locking lib/log lib/metadata lib/mirror lib/misc lib/mm lib/regex lib/snapshot lib/striped lib/zero man tools

Bastian Blank waldi at costa.debian.org
Fri May 5 20:27:47 UTC 2006


Author: waldi
Date: Fri May  5 20:27:43 2006
New Revision: 316

Added:
   lvm2/trunk/lib/datastruct/list.c
Modified:
   lvm2/trunk/   (props changed)
   lvm2/trunk/Makefile.in
   lvm2/trunk/VERSION
   lvm2/trunk/WHATS_NEW
   lvm2/trunk/configure
   lvm2/trunk/configure.in
   lvm2/trunk/daemons/clvmd/Makefile.in
   lvm2/trunk/daemons/clvmd/clvmd-cman.c
   lvm2/trunk/daemons/clvmd/clvmd-comms.h
   lvm2/trunk/daemons/clvmd/clvmd.c
   lvm2/trunk/daemons/clvmd/lvm-functions.c
   lvm2/trunk/dmeventd/mirror/Makefile.in
   lvm2/trunk/include/Makefile.in
   lvm2/trunk/lib/Makefile.in
   lvm2/trunk/lib/activate/activate.c
   lvm2/trunk/lib/activate/activate.h
   lvm2/trunk/lib/activate/dev_manager.c
   lvm2/trunk/lib/activate/dev_manager.h
   lvm2/trunk/lib/cache/lvmcache.c
   lvm2/trunk/lib/cache/lvmcache.h
   lvm2/trunk/lib/commands/toolcontext.c
   lvm2/trunk/lib/datastruct/btree.c
   lvm2/trunk/lib/datastruct/list.h
   lvm2/trunk/lib/device/dev-cache.c
   lvm2/trunk/lib/device/device.h
   lvm2/trunk/lib/error/errseg.c
   lvm2/trunk/lib/filters/filter-composite.c
   lvm2/trunk/lib/filters/filter-persistent.c
   lvm2/trunk/lib/filters/filter-regex.c
   lvm2/trunk/lib/filters/filter-sysfs.c
   lvm2/trunk/lib/format1/disk-rep.c
   lvm2/trunk/lib/format1/disk-rep.h
   lvm2/trunk/lib/format1/format1.c
   lvm2/trunk/lib/format1/import-export.c
   lvm2/trunk/lib/format1/layout.c
   lvm2/trunk/lib/format1/lvm1-label.c
   lvm2/trunk/lib/format_pool/disk_rep.c
   lvm2/trunk/lib/format_pool/format_pool.c
   lvm2/trunk/lib/format_pool/import_export.c
   lvm2/trunk/lib/format_pool/pool_label.c
   lvm2/trunk/lib/format_text/archive.c
   lvm2/trunk/lib/format_text/archiver.c
   lvm2/trunk/lib/format_text/export.c
   lvm2/trunk/lib/format_text/format-text.c
   lvm2/trunk/lib/format_text/format-text.h
   lvm2/trunk/lib/format_text/import-export.h
   lvm2/trunk/lib/format_text/import.c
   lvm2/trunk/lib/format_text/import_vsn1.c
   lvm2/trunk/lib/format_text/text_label.c
   lvm2/trunk/lib/label/label.c
   lvm2/trunk/lib/locking/cluster_locking.c
   lvm2/trunk/lib/locking/external_locking.c
   lvm2/trunk/lib/locking/locking.c
   lvm2/trunk/lib/locking/locking.h
   lvm2/trunk/lib/log/log.c
   lvm2/trunk/lib/log/log.h
   lvm2/trunk/lib/metadata/metadata.c
   lvm2/trunk/lib/metadata/metadata.h
   lvm2/trunk/lib/metadata/snapshot_manip.c
   lvm2/trunk/lib/mirror/mirrored.c
   lvm2/trunk/lib/misc/lvm-string.c
   lvm2/trunk/lib/misc/lvm-string.h
   lvm2/trunk/lib/misc/sharedlib.c
   lvm2/trunk/lib/misc/sharedlib.h
   lvm2/trunk/lib/mm/memlock.c
   lvm2/trunk/lib/regex/matcher.c
   lvm2/trunk/lib/regex/parse_rx.c
   lvm2/trunk/lib/regex/ttree.c
   lvm2/trunk/lib/report/report.c
   lvm2/trunk/lib/snapshot/snapshot.c
   lvm2/trunk/lib/striped/striped.c
   lvm2/trunk/lib/zero/zero.c
   lvm2/trunk/make.tmpl.in
   lvm2/trunk/man/vgchange.8
   lvm2/trunk/man/vgcreate.8
   lvm2/trunk/tools/Makefile.in
   lvm2/trunk/tools/commands.h
   lvm2/trunk/tools/lvconvert.c
   lvm2/trunk/tools/lvcreate.c
   lvm2/trunk/tools/lvdisplay.c
   lvm2/trunk/tools/lvremove.c
   lvm2/trunk/tools/lvrename.c
   lvm2/trunk/tools/lvresize.c
   lvm2/trunk/tools/lvscan.c
   lvm2/trunk/tools/pvchange.c
   lvm2/trunk/tools/pvmove.c
   lvm2/trunk/tools/pvremove.c
   lvm2/trunk/tools/pvresize.c
   lvm2/trunk/tools/reporter.c
   lvm2/trunk/tools/toollib.c
   lvm2/trunk/tools/tools.h
   lvm2/trunk/tools/vgchange.c
   lvm2/trunk/tools/vgexport.c
   lvm2/trunk/tools/vgextend.c
   lvm2/trunk/tools/vgimport.c
   lvm2/trunk/tools/vgmerge.c
   lvm2/trunk/tools/vgreduce.c
   lvm2/trunk/tools/vgrename.c
   lvm2/trunk/tools/vgsplit.c

Log:
Merge /lvm2/upstream/current (2.02.05).


Modified: lvm2/trunk/Makefile.in
==============================================================================
--- lvm2/trunk/Makefile.in	(original)
+++ lvm2/trunk/Makefile.in	Fri May  5 20:27:43 2006
@@ -57,3 +57,13 @@
 pofile: po.pofile
 endif
 
+ifneq ("@CFLOW_CMD@", "")
+tools.cflow: lib.cflow
+cflow: tools.cflow
+endif
+
+ifneq ("@CSCOPE_CMD@", "")
+cscope.out: tools
+	@CSCOPE_CMD@ -b -R
+all: cscope.out
+endif

Modified: lvm2/trunk/VERSION
==============================================================================
--- lvm2/trunk/VERSION	(original)
+++ lvm2/trunk/VERSION	Fri May  5 20:27:43 2006
@@ -1 +1 @@
-2.02.02 (2006-02-07)
+2.02.05 (2006-04-21)

Modified: lvm2/trunk/WHATS_NEW
==============================================================================
--- lvm2/trunk/WHATS_NEW	(original)
+++ lvm2/trunk/WHATS_NEW	Fri May  5 20:27:43 2006
@@ -1,3 +1,36 @@
+Version 2.02.05 - 21st April 2006
+=================================
+  Fix vgid string termination in recent cache code.
+
+Version 2.02.04 - 19th April 2006
+=================================
+  Check for libsepol.
+  Add some cflow & scope support.
+  Separate out DEFS from CFLAGS.
+  Remove inlines and use unique function names.
+
+Version 2.02.03 - 14th April 2006
+=================================
+  vgrename accepts vgid and exported VG.
+  Add --partial to pvs.
+  When choosing between identically-named VGs, also consider creation_host.
+  Provide total log suppression with 2.
+  Fix vgexport/vgimport to set/reset PV exported flag so pv_attr is correct.
+  Add vgid to struct physical_volume and pass with vg_name to some functions.
+  If two or more VGs are found with the same name, use one that is not exported.
+  Whenever vgname is captured, also capture vgid and whether exported.
+  Remove an incorrect unlock_vg() from process_each_lv().
+  Update extent size information in vgchange and vgcreate man pages.
+  Introduce origin_from_cow() and lv_is_visible().
+  pvremove without -f now fails if there's no PV label.
+  Support lvconvert -s.
+  Suppress locking library load failure message if --ignorelockingfailure.
+  Propagate partial mode around cluster.
+  Fix archive file expiration.
+  Fix dmeventd build.
+  clvmd now uses libcman rather than cman ioctls.
+  clvmd will allow new cman to shutdown on request.
+
 Version 2.02.02 - 7th February 2006
 ===================================
   Add %.so: %.a make template rule.

Modified: lvm2/trunk/configure
==============================================================================
--- lvm2/trunk/configure	(original)
+++ lvm2/trunk/configure	Fri May  5 20:27:43 2006
@@ -1,9 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57.
+# Generated by GNU Autoconf 2.59.
 #
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
@@ -20,9 +19,10 @@
 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
   set -o posix
 fi
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
@@ -41,7 +41,7 @@
   LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
     $as_unset $as_var
@@ -218,16 +218,17 @@
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
+  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
 as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 # IFS
@@ -309,7 +310,7 @@
 #endif"
 
 ac_default_prefix=/usr
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP ALLOCA LIBOBJS POW_LIB MSGFMT MODPROBE_CMD JOBS STATIC_LINK LVM1 POOL SNAPSHOTS MIRRORS OWNER GROUP COPTIMISE_FLAG CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LDDEPS LIB_SUFFIX LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR CONFDIR STATICDIR INTL_PACKAGE INTL CLVMD CLUSTER FSADM DMEVENTD LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S SET_MAKE RANLIB ac_ct_RANLIB CFLOW_CMD CSCOPE_CMD CPP EGREP ALLOCA LIBOBJS POW_LIB MSGFMT MODPROBE_CMD JOBS STATIC_LINK LVM1 POOL SNAPSHOTS MIRRORS OWNER GROUP LVM_DEFS COPTIMISE_FLAG CLDFLAGS CLDWHOLEARCHIVE CLDNOWHOLEARCHIVE LDDEPS LIB_SUFFIX LVM_VERSION LVM1_FALLBACK DEBUG DEVMAPPER HAVE_LIBDL HAVE_SELINUX CMDLIB LOCALEDIR CONFDIR STATICDIR INTL_PACKAGE INTL CLVMD CLUSTER FSADM DMEVENTD LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -668,7 +669,7 @@
 
 # Be sure to have absolute paths.
 for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-              localstatedir libdir includedir oldincludedir infodir mandir
+	      localstatedir libdir includedir oldincludedir infodir mandir
 do
   eval ac_val=$`echo $ac_var`
   case $ac_val in
@@ -708,10 +709,10 @@
   # Try the directory containing this script, then its parent.
   ac_confdir=`(dirname "$0") 2>/dev/null ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$0" : 'X\(//\)[^/]' \| \
-         X"$0" : 'X\(//\)$' \| \
-         X"$0" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$0" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
   	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -803,9 +804,9 @@
   cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
+			  [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
+			  [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -927,12 +928,45 @@
     ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
     ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
 
     cd $ac_dir
     # Check for guested configure; otherwise get Cygnus style configure.
@@ -943,7 +977,7 @@
       echo
       $SHELL $ac_srcdir/configure  --help=recursive
     elif test -f $ac_srcdir/configure.ac ||
-           test -f $ac_srcdir/configure.in; then
+	   test -f $ac_srcdir/configure.in; then
       echo
       $ac_configure --help
     else
@@ -957,8 +991,7 @@
 if $ac_init_version; then
   cat <<\_ACEOF
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -970,7 +1003,7 @@
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
+generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
 
@@ -1047,19 +1080,19 @@
     2)
       ac_configure_args1="$ac_configure_args1 '$ac_arg'"
       if test $ac_must_keep_next = true; then
-        ac_must_keep_next=false # Got value, back to normal.
+	ac_must_keep_next=false # Got value, back to normal.
       else
-        case $ac_arg in
-          *=* | --config-cache | -C | -disable-* | --disable-* \
-          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-          | -with-* | --with-* | -without-* | --without-* | --x)
-            case "$ac_configure_args0 " in
-              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-            esac
-            ;;
-          -* ) ac_must_keep_next=true ;;
-        esac
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
       fi
       ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
       # Get rid of the leading space.
@@ -1093,12 +1126,12 @@
     case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
     *ac_space=\ *)
       sed -n \
-        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
-    	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
       ;;
     *)
       sed -n \
-        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
     esac;
 }
@@ -1127,7 +1160,7 @@
       for ac_var in $ac_subst_files
       do
 	eval ac_val=$`echo $ac_var`
-        echo "$ac_var='"'"'$ac_val'"'"'"
+	echo "$ac_var='"'"'$ac_val'"'"'"
       done | sort
       echo
     fi
@@ -1146,7 +1179,7 @@
       echo "$as_me: caught signal $ac_signal"
     echo "$as_me: exit $exit_status"
   } >&5
-  rm -f core core.* *.core &&
+  rm -f core *.core &&
   rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
      ' 0
@@ -1226,7 +1259,7 @@
 # value.
 ac_cache_corrupted=false
 for ac_var in `(set) 2>&1 |
-               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
   eval ac_old_set=\$ac_cv_env_${ac_var}_set
   eval ac_new_set=\$ac_env_${ac_var}_set
   eval ac_old_val="\$ac_cv_env_${ac_var}_value"
@@ -1243,13 +1276,13 @@
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
-        ac_cache_corrupted=:
+	ac_cache_corrupted=:
       fi;;
   esac
   # Pass precious variables to config.status.
@@ -1817,7 +1850,6 @@
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1837,8 +1869,8 @@
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output" >&5
-echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
   (eval $ac_link_default) 2>&5
@@ -1858,23 +1890,23 @@
   test -f "$ac_file" || continue
   case $ac_file in
     *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
-        ;;
+	;;
     conftest.$ac_ext )
-        # This is the source file.
-        ;;
+	# This is the source file.
+	;;
     [ab].out )
-        # We found the default executable, but exeext='' is most
-        # certainly right.
-        break;;
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
     *.* )
-        ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-        # FIXME: I believe we export ac_cv_exeext for Libtool,
-        # but it would be cool to find out if it's true.  Does anybody
-        # maintain Libtool? --akim.
-        export ac_cv_exeext
-        break;;
+	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	# FIXME: I believe we export ac_cv_exeext for Libtool,
+	# but it would be cool to find out if it's true.  Does anybody
+	# maintain Libtool? --akim.
+	export ac_cv_exeext
+	break;;
     * )
-        break;;
+	break;;
   esac
 done
 else
@@ -1948,8 +1980,8 @@
   case $ac_file in
     *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-          export ac_cv_exeext
-          break;;
+	  export ac_cv_exeext
+	  break;;
     * ) break;;
   esac
 done
@@ -1974,7 +2006,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2025,7 +2056,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2045,11 +2075,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2062,7 +2102,7 @@
 
 ac_compiler_gnu=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
@@ -2078,7 +2118,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2095,11 +2134,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2112,7 +2161,7 @@
 
 ac_cv_prog_cc_g=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
@@ -2139,7 +2188,6 @@
   ac_cv_prog_cc_stdc=no
 ac_save_CC=$CC
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2167,6 +2215,16 @@
   va_end (v);
   return s;
 }
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};
@@ -2193,11 +2251,21 @@
   CC="$ac_save_CC $ac_arg"
   rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2210,7 +2278,7 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext
+rm -f conftest.err conftest.$ac_objext
 done
 rm -f conftest.$ac_ext conftest.$ac_objext
 CC=$ac_save_CC
@@ -2238,19 +2306,28 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   for ac_declaration in \
-   ''\
-   '#include <stdlib.h>' \
+   '' \
    'extern "C" void std::exit (int) throw (); using std::exit;' \
    'extern "C" void std::exit (int); using std::exit;' \
    'extern "C" void exit (int) throw ();' \
@@ -2258,14 +2335,13 @@
    'void exit (int);'
 do
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdlib.h>
 $ac_declaration
+#include <stdlib.h>
 int
 main ()
 {
@@ -2276,11 +2352,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2293,9 +2379,8 @@
 
 continue
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2312,11 +2397,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2328,7 +2423,7 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 rm -f conftest*
 if test -n "$ac_declaration"; then
@@ -2342,7 +2437,7 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2360,6 +2455,7 @@
 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
 echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
@@ -2376,6 +2472,7 @@
 case $as_dir/ in
   ./ | .// | /cC/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
   /usr/ucb/* ) ;;
   *)
     # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -2383,20 +2480,20 @@
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
-          if test $ac_prog = install &&
-            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-            # AIX install.  It has an incompatible calling convention.
-            :
-          elif test $ac_prog = install &&
-            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-            # program-specific install script used by HP pwplus--don't use.
-            :
-          else
-            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-            break 3
-          fi
-        fi
+	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
       done
     done
     ;;
@@ -2439,7 +2536,7 @@
 
 echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2546,6 +2643,84 @@
   RANLIB="$ac_cv_prog_RANLIB"
 fi
 
+# Extract the first word of "cflow", so it can be a program name with args.
+set dummy cflow; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_CFLOW_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $CFLOW_CMD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CFLOW_CMD="$CFLOW_CMD" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_CFLOW_CMD="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+CFLOW_CMD=$ac_cv_path_CFLOW_CMD
+
+if test -n "$CFLOW_CMD"; then
+  echo "$as_me:$LINENO: result: $CFLOW_CMD" >&5
+echo "${ECHO_T}$CFLOW_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+# Extract the first word of "cscope", so it can be a program name with args.
+set dummy cscope; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_CSCOPE_CMD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $CSCOPE_CMD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_CSCOPE_CMD="$CSCOPE_CMD" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_CSCOPE_CMD="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+CSCOPE_CMD=$ac_cv_path_CSCOPE_CMD
+
+if test -n "$CSCOPE_CMD"; then
+  echo "$as_me:$LINENO: result: $CSCOPE_CMD" >&5
+echo "${ECHO_T}$CSCOPE_CMD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
 
 ################################################################################
 
@@ -2563,7 +2738,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2583,11 +2757,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2600,7 +2784,7 @@
 
 eval "$as_ac_Header=no"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -2623,7 +2807,6 @@
   ac_func_search_save_LIBS=$LIBS
 ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2647,11 +2830,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2663,12 +2856,12 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 if test "$ac_cv_search_opendir" = no; then
   for ac_lib in dir; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
     cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2692,11 +2885,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2709,7 +2912,8 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
   done
 fi
 LIBS=$ac_func_search_save_LIBS
@@ -2730,7 +2934,6 @@
   ac_func_search_save_LIBS=$LIBS
 ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2754,11 +2957,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2770,12 +2983,12 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 if test "$ac_cv_search_opendir" = no; then
   for ac_lib in x; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
     cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2799,11 +3012,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -2816,7 +3039,8 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
   done
 fi
 LIBS=$ac_func_search_save_LIBS
@@ -2858,7 +3082,6 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2869,7 +3092,7 @@
 #else
 # include <assert.h>
 #endif
-                     Syntax error
+		     Syntax error
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -2881,6 +3104,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -2901,7 +3125,6 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2919,6 +3142,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -2965,7 +3189,6 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2976,7 +3199,7 @@
 #else
 # include <assert.h>
 #endif
-                     Syntax error
+		     Syntax error
 _ACEOF
 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
   (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -2988,6 +3211,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -3008,7 +3232,6 @@
   # OK, works on sane cases.  Now check whether non-existent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3026,6 +3249,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -3086,7 +3310,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3107,11 +3330,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3124,12 +3357,11 @@
 
 ac_cv_header_stdc=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3151,7 +3383,6 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3176,7 +3407,6 @@
   :
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3188,9 +3418,9 @@
 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
 #else
 # define ISLOWER(c) \
-                   (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
 #endif
 
@@ -3201,7 +3431,7 @@
   int i;
   for (i = 0; i < 256; i++)
     if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
+	|| toupper (i) != TOUPPER (i))
       exit(2);
   exit (0);
 }
@@ -3226,7 +3456,7 @@
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 fi
@@ -3246,7 +3476,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3273,11 +3502,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3290,7 +3529,7 @@
 
 ac_cv_header_sys_wait_h=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
 echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
@@ -3308,7 +3547,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3329,11 +3567,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3346,7 +3594,7 @@
 
 ac_cv_header_time=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
 echo "${ECHO_T}$ac_cv_header_time" >&6
@@ -3370,7 +3618,7 @@
 
 
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                  inttypes.h stdint.h unistd.h
+		  inttypes.h stdint.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -3379,7 +3627,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3391,11 +3638,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3408,7 +3665,7 @@
 
 eval "$as_ac_Header=no"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -3447,7 +3704,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3458,11 +3714,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3475,7 +3741,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -3483,7 +3749,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3501,6 +3766,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -3520,33 +3786,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -3557,7 +3822,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -3604,7 +3869,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3615,11 +3879,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3632,7 +3906,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -3640,7 +3914,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3658,6 +3931,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -3677,33 +3951,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -3714,7 +3987,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -3755,7 +4028,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3766,11 +4038,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3783,7 +4065,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -3791,7 +4073,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3809,6 +4090,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -3828,33 +4110,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -3865,7 +4146,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -3903,7 +4184,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3914,11 +4194,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -3931,7 +4221,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -3939,7 +4229,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3957,6 +4246,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -3976,33 +4266,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -4013,7 +4302,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -4041,7 +4330,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4104,16 +4392,26 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_c_const=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -4121,7 +4419,7 @@
 
 ac_cv_c_const=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
 echo "${ECHO_T}$ac_cv_c_const" >&6
@@ -4141,7 +4439,6 @@
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4156,11 +4453,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4172,23 +4479,27 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 
 fi
 echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
 echo "${ECHO_T}$ac_cv_c_inline" >&6
+
+
 case $ac_cv_c_inline in
   inline | yes) ;;
-  no)
-cat >>confdefs.h <<\_ACEOF
-#define inline
-_ACEOF
- ;;
-  *)  cat >>confdefs.h <<_ACEOF
-#define inline $ac_cv_c_inline
+  *)
+    case $ac_cv_c_inline in
+      no) ac_val=;;
+      *) ac_val=$ac_cv_c_inline;;
+    esac
+    cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
 _ACEOF
- ;;
+    ;;
 esac
 
 echo "$as_me:$LINENO: checking for off_t" >&5
@@ -4197,7 +4508,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4217,11 +4527,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4234,7 +4554,7 @@
 
 ac_cv_type_off_t=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
 echo "${ECHO_T}$ac_cv_type_off_t" >&6
@@ -4254,7 +4574,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4274,11 +4593,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4291,7 +4620,7 @@
 
 ac_cv_type_pid_t=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
 echo "${ECHO_T}$ac_cv_type_pid_t" >&6
@@ -4311,7 +4640,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4331,11 +4659,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4348,7 +4686,7 @@
 
 ac_cv_type_size_t=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
 echo "${ECHO_T}$ac_cv_type_size_t" >&6
@@ -4368,7 +4706,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4388,11 +4725,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4405,7 +4752,7 @@
 
 ac_cv_type_mode_t=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
 echo "${ECHO_T}$ac_cv_type_mode_t" >&6
@@ -4426,7 +4773,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4445,11 +4791,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4461,7 +4817,6 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4480,11 +4835,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4497,9 +4862,9 @@
 
 ac_cv_member_struct_stat_st_rdev=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5
 echo "${ECHO_T}$ac_cv_member_struct_stat_st_rdev" >&6
@@ -4523,7 +4888,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4542,11 +4906,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4559,7 +4933,7 @@
 
 ac_cv_struct_tm=sys/time.h
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
 echo "${ECHO_T}$ac_cv_struct_tm" >&6
@@ -4596,21 +4970,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -4641,11 +5022,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4658,7 +5049,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -4682,7 +5074,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4699,11 +5090,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4716,7 +5117,8 @@
 
 ac_cv_working_alloca_h=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
 echo "${ECHO_T}$ac_cv_working_alloca_h" >&6
@@ -4734,7 +5136,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4771,11 +5172,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4788,7 +5199,8 @@
 
 ac_cv_func_alloca_works=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
 echo "${ECHO_T}$ac_cv_func_alloca_works" >&6
@@ -4818,7 +5230,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4851,21 +5262,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -4896,11 +5314,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -4913,7 +5341,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -4938,7 +5367,6 @@
   ac_cv_c_stack_direction=0
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4984,7 +5412,7 @@
 ( exit $ac_status )
 ac_cv_c_stack_direction=-1
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
@@ -5006,7 +5434,6 @@
   ac_cv_func_closedir_void=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5046,7 +5473,7 @@
 ( exit $ac_status )
 ac_cv_func_closedir_void=yes
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5
@@ -5077,7 +5504,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5088,11 +5514,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5105,7 +5541,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -5113,7 +5549,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5131,6 +5566,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -5150,33 +5586,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -5187,7 +5622,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -5213,21 +5648,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -5258,11 +5700,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5275,7 +5727,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -5305,9 +5758,9 @@
       /* Some systems only have a dummy stub for fork() */
       int main ()
       {
-        if (fork() < 0)
-          exit (1);
-        exit (0);
+	if (fork() < 0)
+	  exit (1);
+	exit (0);
       }
 _ACEOF
 rm -f conftest$ac_exeext
@@ -5330,7 +5783,7 @@
 ( exit $ac_status )
 ac_cv_func_fork_works=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
@@ -5363,7 +5816,6 @@
   ac_cv_func_vfork_works=cross
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5485,7 +5937,7 @@
 ( exit $ac_status )
 ac_cv_func_vfork_works=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
@@ -5493,7 +5945,7 @@
 
 fi;
 if test "x$ac_cv_func_fork_works" = xcross; then
-  ac_cv_func_vfork_works=ac_cv_func_vfork
+  ac_cv_func_vfork_works=$ac_cv_func_vfork
   { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
 echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
 fi
@@ -5531,7 +5983,6 @@
   ac_cv_func_lstat_dereferences_slashed_symlink=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5543,8 +5994,8 @@
 {
 struct stat sbuf;
      /* Linux will dereference the symlink and fail.
-        That is better in the sense that it means we will not
-        have to compile and use the lstat wrapper.  */
+	That is better in the sense that it means we will not
+	have to compile and use the lstat wrapper.  */
      exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
   ;
   return 0;
@@ -5570,7 +6021,7 @@
 ( exit $ac_status )
 ac_cv_func_lstat_dereferences_slashed_symlink=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 else
   # If the `ln -s' command failed, then we probably don't even
@@ -5591,7 +6042,14 @@
 
 
 if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
-  LIBOBJS="$LIBOBJS lstat.$ac_objext"
+  case $LIBOBJS in
+    "lstat.$ac_objext"   | \
+  *" lstat.$ac_objext"   | \
+    "lstat.$ac_objext "* | \
+  *" lstat.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
+esac
+
 fi
 
 echo "$as_me:$LINENO: checking whether lstat accepts an empty string" >&5
@@ -5603,7 +6061,6 @@
   ac_cv_func_lstat_empty_string_bug=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5639,13 +6096,20 @@
 ( exit $ac_status )
 ac_cv_func_lstat_empty_string_bug=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_lstat_empty_string_bug" >&5
 echo "${ECHO_T}$ac_cv_func_lstat_empty_string_bug" >&6
 if test $ac_cv_func_lstat_empty_string_bug = yes; then
-  LIBOBJS="$LIBOBJS lstat.$ac_objext"
+  case $LIBOBJS in
+    "lstat.$ac_objext"   | \
+  *" lstat.$ac_objext"   | \
+    "lstat.$ac_objext "* | \
+  *" lstat.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;;
+esac
+
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_LSTAT_EMPTY_STRING_BUG 1
@@ -5670,7 +6134,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5681,11 +6144,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5698,7 +6171,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -5706,7 +6179,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5724,6 +6196,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -5743,33 +6216,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -5780,7 +6252,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -5804,7 +6276,6 @@
   ac_cv_func_malloc_0_nonnull=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5844,7 +6315,7 @@
 ( exit $ac_status )
 ac_cv_func_malloc_0_nonnull=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
@@ -5860,7 +6331,14 @@
 #define HAVE_MALLOC 0
 _ACEOF
 
-   LIBOBJS="$LIBOBJS malloc.$ac_objext"
+   case $LIBOBJS in
+    "malloc.$ac_objext"   | \
+  *" malloc.$ac_objext"   | \
+    "malloc.$ac_objext "* | \
+  *" malloc.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;;
+esac
+
 
 cat >>confdefs.h <<\_ACEOF
 #define malloc rpl_malloc
@@ -5879,13 +6357,12 @@
   ac_cv_func_memcmp_working=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-
+$ac_includes_default
 int
 main ()
 {
@@ -5904,12 +6381,12 @@
     int i;
     for (i = 0; i < 4; i++)
       {
-        char *a = foo + i;
-        char *b = bar + i;
-        strcpy (a, "--------01111111");
-        strcpy (b, "--------10000000");
-        if (memcmp (a, b, 16) >= 0)
-          exit (1);
+	char *a = foo + i;
+	char *b = bar + i;
+	strcpy (a, "--------01111111");
+	strcpy (b, "--------10000000");
+	if (memcmp (a, b, 16) >= 0)
+	  exit (1);
       }
     exit (0);
   }
@@ -5938,12 +6415,19 @@
 ( exit $ac_status )
 ac_cv_func_memcmp_working=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
 echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6
-test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+test $ac_cv_func_memcmp_working = no && case $LIBOBJS in
+    "memcmp.$ac_objext"   | \
+  *" memcmp.$ac_objext"   | \
+    "memcmp.$ac_objext "* | \
+  *" memcmp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;;
+esac
+
 
 
 
@@ -5963,7 +6447,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5974,11 +6457,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -5991,7 +6484,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -5999,7 +6492,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6017,6 +6509,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -6036,33 +6529,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -6073,7 +6565,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -6098,21 +6590,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -6143,11 +6642,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6160,7 +6669,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -6181,7 +6691,6 @@
   ac_cv_func_mmap_fixed_mapped=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6289,9 +6798,9 @@
   data2 = (char *) malloc (2 * pagesize);
   if (!data2)
     exit (1);
-  data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+  data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
   if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-                     MAP_PRIVATE | MAP_FIXED, fd, 0L))
+		     MAP_PRIVATE | MAP_FIXED, fd, 0L))
     exit (1);
   for (i = 0; i < pagesize; ++i)
     if (*(data + i) != *(data2 + i))
@@ -6334,7 +6843,7 @@
 ( exit $ac_status )
 ac_cv_func_mmap_fixed_mapped=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
@@ -6357,7 +6866,6 @@
   ac_cv_func_stat_empty_string_bug=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6393,13 +6901,20 @@
 ( exit $ac_status )
 ac_cv_func_stat_empty_string_bug=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
 echo "${ECHO_T}$ac_cv_func_stat_empty_string_bug" >&6
 if test $ac_cv_func_stat_empty_string_bug = yes; then
-  LIBOBJS="$LIBOBJS stat.$ac_objext"
+  case $LIBOBJS in
+    "stat.$ac_objext"   | \
+  *" stat.$ac_objext"   | \
+    "stat.$ac_objext "* | \
+  *" stat.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;;
+esac
+
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_STAT_EMPTY_STRING_BUG 1
@@ -6416,7 +6931,6 @@
   ac_cv_func_strtod=no
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6470,34 +6984,48 @@
 ( exit $ac_status )
 ac_cv_func_strtod=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5
 echo "${ECHO_T}$ac_cv_func_strtod" >&6
 if test $ac_cv_func_strtod = no; then
-  LIBOBJS="$LIBOBJS strtod.$ac_objext"
+  case $LIBOBJS in
+    "strtod.$ac_objext"   | \
+  *" strtod.$ac_objext"   | \
+    "strtod.$ac_objext "* | \
+  *" strtod.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;;
+esac
+
 echo "$as_me:$LINENO: checking for pow" >&5
 echo $ECHO_N "checking for pow... $ECHO_C" >&6
 if test "${ac_cv_func_pow+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define pow to an innocuous variant, in case <limits.h> declares pow.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define pow innocuous_pow
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pow (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef pow
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -6528,11 +7056,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6545,7 +7083,8 @@
 
 ac_cv_func_pow=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_pow" >&5
 echo "${ECHO_T}$ac_cv_func_pow" >&6
@@ -6559,7 +7098,6 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lm  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6583,11 +7121,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -6600,7 +7148,8 @@
 
 ac_cv_lib_m_pow=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5
@@ -6678,7 +7227,7 @@
 echo "${ECHO_T}$LVM1_FALLBACK" >&6
 
 if test x$LVM1_FALLBACK = xyes; then
-	CFLAGS="$CFLAGS -DLVM1_FALLBACK"
+	LVM_DEFS="$LVM_DEFS -DLVM1_FALLBACK"
 fi
 
 ################################################################################
@@ -6704,7 +7253,7 @@
 fi;
 
 if test x$LVM1 = xinternal; then
-	CFLAGS="$CFLAGS -DLVM1_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DLVM1_INTERNAL"
 fi
 
 ################################################################################
@@ -6730,7 +7279,7 @@
 fi;
 
 if test x$POOL = xinternal; then
-	CFLAGS="$CFLAGS -DPOOL_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DPOOL_INTERNAL"
 fi
 
 ################################################################################
@@ -6754,7 +7303,7 @@
 fi;
 
 if test x$CLUSTER = xinternal; then
-	CFLAGS="$CFLAGS -DCLUSTER_LOCKING_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DCLUSTER_LOCKING_INTERNAL"
 fi
 
 ################################################################################
@@ -6780,7 +7329,7 @@
 fi;
 
 if test x$SNAPSHOTS = xinternal; then
-	CFLAGS="$CFLAGS -DSNAPSHOT_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DSNAPSHOT_INTERNAL"
 fi
 
 ################################################################################
@@ -6806,7 +7355,7 @@
 fi;
 
 if test x$MIRRORS = xinternal; then
-	CFLAGS="$CFLAGS -DMIRRORED_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DMIRRORED_INTERNAL"
 fi
 
 ################################################################################
@@ -6836,7 +7385,7 @@
 echo "${ECHO_T}$READLINE" >&6
 
 if test x$READLINE = xyes; then
-	CFLAGS="$CFLAGS -DREADLINE_SUPPORT"
+	LVM_DEFS="$LVM_DEFS -DREADLINE_SUPPORT"
 fi
 
 ################################################################################
@@ -6886,6 +7435,8 @@
 
 if test x$DEBUG = xyes; then
 	COPTIMISE_FLAG=
+else
+	CSCOPE_CMD=
 fi
 
 ################################################################################
@@ -6912,7 +7463,7 @@
 echo "${ECHO_T}$DEVMAPPER" >&6
 
 if test x$DEVMAPPER = xyes; then
-	CFLAGS="$CFLAGS -DDEVMAPPER_SUPPORT"
+	LVM_DEFS="$LVM_DEFS -DDEVMAPPER_SUPPORT"
 fi
 
 ################################################################################
@@ -6927,7 +7478,7 @@
 echo "${ECHO_T}$ODIRECT" >&6
 
 if test x$ODIRECT = xyes; then
-	CFLAGS="$CFLAGS -DO_DIRECT_SUPPORT"
+	LVM_DEFS="$LVM_DEFS -DO_DIRECT_SUPPORT"
 fi
 
 ################################################################################
@@ -6944,7 +7495,7 @@
 echo "${ECHO_T}$CMDLIB" >&6
 
 if test x$CMDLIB = xyes; then
-	CFLAGS="$CFLAGS -DCMDLIB"
+	LVM_DEFS="$LVM_DEFS -DCMDLIB"
 fi
 
 ################################################################################
@@ -6978,7 +7529,7 @@
 fi
 
 if test x$DMEVENTD = xyes; then
-	CFLAGS="$CFLAGS -DDMEVENTD"
+	LVM_DEFS="$LVM_DEFS -DDMEVENTD"
 fi
 ################################################################################
 if [ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ];
@@ -6994,7 +7545,6 @@
 else
     ac_pattern="Autoconf.*'x'"
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7014,7 +7564,6 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7044,7 +7593,6 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7071,11 +7619,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7088,7 +7646,7 @@
 
 ac_cv_type_signal=int
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
 echo "${ECHO_T}$ac_cv_type_signal" >&6
@@ -7108,21 +7666,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -7153,11 +7718,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7170,7 +7745,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -7185,21 +7761,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define _doprnt innocuous__doprnt
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef _doprnt
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -7230,11 +7813,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7247,7 +7840,8 @@
 
 ac_cv_func__doprnt=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
 echo "${ECHO_T}$ac_cv_func__doprnt" >&6
@@ -7275,21 +7869,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -7320,11 +7921,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7337,7 +7948,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -7364,7 +7976,6 @@
   ac_func_search_save_LIBS=$LIBS
 ac_cv_search_tgetent=no
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7388,11 +7999,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7404,12 +8025,12 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 if test "$ac_cv_search_tgetent" = no; then
   for ac_lib in ncurses curses termcap termlib; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
     cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7433,11 +8054,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7450,7 +8081,8 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
   done
 fi
 LIBS=$ac_func_search_save_LIBS
@@ -7494,7 +8126,6 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7518,11 +8149,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7535,7 +8176,8 @@
 
 ac_cv_lib_dl_dlopen=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
@@ -7548,7 +8190,7 @@
 
 
 if [ "x$HAVE_LIBDL" = xyes ]; then
-	CFLAGS="$CFLAGS -DHAVE_LIBDL"
+	LVM_DEFS="$LVM_DEFS -DHAVE_LIBDL"
 	LIBS="-ldl $LIBS"
 else
 	HAVE_LIBDL=no
@@ -7567,6 +8209,85 @@
 
 ################################################################################
 if test x$SELINUX = xyes; then
+	echo "$as_me:$LINENO: checking for sepol_check_context function" >&5
+echo $ECHO_N "checking for sepol_check_context function... $ECHO_C" >&6
+	echo "$as_me:$LINENO: checking for sepol_check_context in -lsepol" >&5
+echo $ECHO_N "checking for sepol_check_context in -lsepol... $ECHO_C" >&6
+if test "${ac_cv_lib_sepol_sepol_check_context+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsepol  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sepol_check_context ();
+int
+main ()
+{
+sepol_check_context ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_sepol_sepol_check_context=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_sepol_sepol_check_context=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_sepol_sepol_check_context" >&5
+echo "${ECHO_T}$ac_cv_lib_sepol_sepol_check_context" >&6
+if test $ac_cv_lib_sepol_sepol_check_context = yes; then
+  HAVE_SEPOL=yes
+else
+  HAVE_SEPOL=no
+fi
+
+	echo "$as_me:$LINENO: result: $HAVE_SEPOL" >&5
+echo "${ECHO_T}$HAVE_SEPOL" >&6
+
+	if test x$HAVE_SEPOL = xyes; then
+		LIBS="-lsepol $LIBS"
+	fi
+
 	echo "$as_me:$LINENO: checking for is_selinux_enabled function" >&5
 echo $ECHO_N "checking for is_selinux_enabled function... $ECHO_C" >&6
 	echo "$as_me:$LINENO: checking for is_selinux_enabled in -lselinux" >&5
@@ -7577,7 +8298,6 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lselinux  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7601,11 +8321,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7618,7 +8348,8 @@
 
 ac_cv_lib_selinux_is_selinux_enabled=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_is_selinux_enabled" >&5
@@ -7633,7 +8364,7 @@
 echo "${ECHO_T}$HAVE_SELINUX" >&6
 
 	if test x$HAVE_SELINUX = xyes; then
-		CFLAGS="$CFLAGS -DHAVE_SELINUX"
+		LVM_DEFS="$LVM_DEFS -DHAVE_SELINUX"
 		LIBS="-lselinux $LIBS"
 	else
 		{ echo "$as_me:$LINENO: WARNING: Disabling selinux" >&5
@@ -7659,7 +8390,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7670,11 +8400,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7687,7 +8427,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -7695,7 +8435,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7713,6 +8452,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -7732,33 +8472,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -7769,7 +8508,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -7779,7 +8518,7 @@
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
- CFLAGS="$CFLAGS -DHAVE_GETOPTLONG"
+ LVM_DEFS="$LVM_DEFS -DHAVE_GETOPTLONG"
 fi
 
 done
@@ -7796,7 +8535,6 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lreadline  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7820,11 +8558,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7837,7 +8585,8 @@
 
 ac_cv_lib_readline_readline=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
@@ -7874,21 +8623,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define rl_completion_matches to an innocuous variant, in case <limits.h> declares rl_completion_matches.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define rl_completion_matches innocuous_rl_completion_matches
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char rl_completion_matches (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef rl_completion_matches
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -7919,11 +8675,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -7936,12 +8702,13 @@
 
 ac_cv_func_rl_completion_matches=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: $ac_cv_func_rl_completion_matches" >&5
 echo "${ECHO_T}$ac_cv_func_rl_completion_matches" >&6
 if test $ac_cv_func_rl_completion_matches = yes; then
-  CFLAGS="$CFLAGS -DHAVE_RL_COMPLETION_MATCHES"
+  LVM_DEFS="$LVM_DEFS -DHAVE_RL_COMPLETION_MATCHES"
 fi
 
 
@@ -8058,7 +8825,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8069,11 +8835,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8086,7 +8862,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -8094,7 +8870,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8112,6 +8887,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -8131,33 +8907,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -8168,7 +8943,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -8216,7 +8991,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8227,11 +9001,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8244,7 +9028,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -8252,7 +9036,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8270,6 +9053,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -8289,33 +9073,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -8326,7 +9109,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -8359,21 +9142,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -8404,11 +9194,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8421,7 +9221,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -8446,7 +9247,6 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsun  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8470,11 +9270,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8487,7 +9297,8 @@
 
 ac_cv_lib_sun_getmntent=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_sun_getmntent" >&5
@@ -8503,7 +9314,6 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lseq  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8527,11 +9337,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8544,7 +9364,8 @@
 
 ac_cv_lib_seq_getmntent=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_seq_getmntent" >&5
@@ -8560,7 +9381,6 @@
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgen  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8584,11 +9404,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8601,7 +9431,8 @@
 
 ac_cv_lib_gen_getmntent=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
 echo "$as_me:$LINENO: result: $ac_cv_lib_gen_getmntent" >&5
@@ -8624,21 +9455,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -8669,11 +9507,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8686,7 +9534,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -8718,7 +9567,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8729,11 +9577,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8746,7 +9604,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -8754,7 +9612,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8772,6 +9629,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -8791,33 +9649,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -8828,7 +9685,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -8852,7 +9709,6 @@
  for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do
   for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8870,19 +9726,29 @@
 main ()
 {
 extern int select ($ac_arg1,
-                                            $ac_arg234, $ac_arg234, $ac_arg234,
-                                            $ac_arg5);
+					    $ac_arg234, $ac_arg234, $ac_arg234,
+					    $ac_arg5);
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8894,7 +9760,7 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
   done
  done
 done
@@ -8947,7 +9813,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -8958,11 +9823,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -8975,7 +9850,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -8983,7 +9858,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9001,6 +9875,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -9020,33 +9895,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -9057,7 +9931,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -9086,21 +9960,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -9131,11 +10012,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9148,7 +10039,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -9185,7 +10077,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9196,11 +10087,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9213,7 +10114,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -9221,7 +10122,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9239,6 +10139,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -9258,33 +10159,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -9295,7 +10195,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -9324,21 +10224,28 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
+
+#undef $ac_func
+
 /* Override any gcc2 internal prototype to avoid an error.  */
 #ifdef __cplusplus
 extern "C"
@@ -9369,11 +10276,21 @@
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9386,7 +10303,8 @@
 
 eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -9422,7 +10340,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9433,11 +10350,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9450,7 +10377,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -9458,7 +10385,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9476,6 +10402,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -9495,33 +10422,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -9532,7 +10458,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -9571,7 +10497,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9582,11 +10507,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9599,7 +10534,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -9607,7 +10542,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9625,6 +10559,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -9644,33 +10579,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -9681,7 +10615,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -9720,7 +10654,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9731,11 +10664,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9748,7 +10691,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -9756,7 +10699,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9774,6 +10716,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -9793,33 +10736,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -9830,7 +10772,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -9869,7 +10811,6 @@
 echo "$as_me:$LINENO: checking $ac_header usability" >&5
 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9880,11 +10821,21 @@
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -9897,7 +10848,7 @@
 
 ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
 echo "${ECHO_T}$ac_header_compiler" >&6
 
@@ -9905,7 +10856,6 @@
 echo "$as_me:$LINENO: checking $ac_header presence" >&5
 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -9923,6 +10873,7 @@
   (exit $ac_status); } >/dev/null; then
   if test -s conftest.err; then
     ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
   else
     ac_cpp_err=
   fi
@@ -9942,33 +10893,32 @@
 echo "${ECHO_T}$ac_header_preproc" >&6
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
     (
       cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf at gnu.org. ##
-## ------------------------------------ ##
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
 _ASBOX
     ) |
       sed "s/^/$as_me: WARNING:     /" >&2
@@ -9979,7 +10929,7 @@
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -10042,7 +10992,7 @@
 
 
 if test x$MODPROBE_CMD != x; then
-	CFLAGS="$CFLAGS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
+	LVM_DEFS="$LVM_DEFS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
 fi
 
 ################################################################################
@@ -10088,6 +11038,9 @@
 
 
 
+
+
+
 ################################################################################
                                                                                                                                                                                                                                                 ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile dmeventd/Makefile dmeventd/mirror/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/snapshot/Makefile man/Makefile po/Makefile tools/Makefile tools/version.h tools/fsadm/Makefile test/mm/Makefile test/device/Makefile test/format1/Makefile test/regex/Makefile test/filters/Makefile"
 cat >confcache <<\_ACEOF
@@ -10118,13 +11071,13 @@
       # `set' does not quote correctly, so add quotes (double-quote
       # substitution turns \\\\ into \\, and sed turns \\ into \).
       sed -n \
-        "s/'/'\\\\''/g;
-    	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
       ;;
     *)
       # `set' quotes correctly as required by POSIX, so do not add quotes.
       sed -n \
-        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
       ;;
     esac;
 } |
@@ -10154,13 +11107,13 @@
 # trailing colons and then remove the whole line if VPATH becomes empty
 # (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[ 	]*VPATH[ 	]*=/{
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
 s/:*\$(srcdir):*/:/;
 s/:*\${srcdir}:*/:/;
 s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ 	]*\):*/\1/;
+s/^\([^=]*=[	 ]*\):*/\1/;
 s/:*$//;
-s/^[^=]*=[ 	]*$//;
+s/^[^=]*=[	 ]*$//;
 }'
 fi
 
@@ -10174,13 +11127,13 @@
 cat >confdef2opt.sed <<\_ACEOF
 t clear
 : clear
-s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	(][^ 	(]*([^)]*)\)[ 	]*\(.*\),-D\1=\2,g
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\),-D\1=\2,g
 t quote
-s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\(.*\),-D\1=\2,g
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\),-D\1=\2,g
 t quote
 d
 : quote
-s,[ 	`~#$^&*(){}\\|;'"<>?],\\&,g
+s,[	 `~#$^&*(){}\\|;'"<>?],\\&,g
 s,\[,\\&,g
 s,\],\\&,g
 s,\$,$$,g
@@ -10202,7 +11155,7 @@
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
   ac_i=`echo "$ac_i" |
-         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
   # 2. Add them.
   ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
   ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
@@ -10246,9 +11199,10 @@
 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
   set -o posix
 fi
+DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
@@ -10267,7 +11221,7 @@
   LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
     $as_unset $as_var
@@ -10446,16 +11400,17 @@
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
+  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
 as_executable_p="test -f"
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
 # IFS
@@ -10482,7 +11437,7 @@
 cat >&5 <<_CSEOF
 
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
+generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -10526,7 +11481,7 @@
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
   --file=FILE[:TEMPLATE]
-                   instantiate the configuration file FILE
+		   instantiate the configuration file FILE
 
 Configuration files:
 $config_files
@@ -10537,11 +11492,10 @@
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.57,
+configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 srcdir=$srcdir
@@ -10774,6 +11728,8 @@
 s, at SET_MAKE@,$SET_MAKE,;t t
 s, at RANLIB@,$RANLIB,;t t
 s, at ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s, at CFLOW_CMD@,$CFLOW_CMD,;t t
+s, at CSCOPE_CMD@,$CSCOPE_CMD,;t t
 s, at CPP@,$CPP,;t t
 s, at EGREP@,$EGREP,;t t
 s, at ALLOCA@,$ALLOCA,;t t
@@ -10789,6 +11745,7 @@
 s, at MIRRORS@,$MIRRORS,;t t
 s, at OWNER@,$OWNER,;t t
 s, at GROUP@,$GROUP,;t t
+s, at LVM_DEFS@,$LVM_DEFS,;t t
 s, at COPTIMISE_FLAG@,$COPTIMISE_FLAG,;t t
 s, at CLDFLAGS@,$CLDFLAGS,;t t
 s, at CLDWHOLEARCHIVE@,$CLDWHOLEARCHIVE,;t t
@@ -10841,9 +11798,9 @@
       (echo ':t
   /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
       if test -z "$ac_sed_cmds"; then
-  	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
       else
-  	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
       fi
       ac_sed_frag=`expr $ac_sed_frag + 1`
       ac_beg=$ac_end
@@ -10861,21 +11818,21 @@
   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
   case $ac_file in
   - | *:- | *:-:* ) # input from stdin
-        cat >$tmp/stdin
-        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
   *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
   * )   ac_file_in=$ac_file.in ;;
   esac
 
   # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
   ac_dir=`(dirname "$ac_file") 2>/dev/null ||
 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$ac_file" : 'X\(//\)[^/]' \| \
-         X"$ac_file" : 'X\(//\)$' \| \
-         X"$ac_file" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$ac_file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
   	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -10891,10 +11848,10 @@
       as_dirs="$as_dir $as_dirs"
       as_dir=`(dirname "$as_dir") 2>/dev/null ||
 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$as_dir" : 'X\(//\)[^/]' \| \
-         X"$as_dir" : 'X\(//\)$' \| \
-         X"$as_dir" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
 echo X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
   	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -10932,12 +11889,45 @@
     ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
     ac_top_srcdir=$ac_top_builddir$srcdir ;;
 esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
 
 
   case $INSTALL in
@@ -10959,7 +11949,7 @@
     configure_input="$ac_file.  "
   fi
   configure_input=$configure_input"Generated from `echo $ac_file_in |
-                                     sed 's,.*/,,'` by configure."
+				     sed 's,.*/,,'` by configure."
 
   # First look for the input files in the build tree, otherwise in the
   # src tree.
@@ -10968,24 +11958,24 @@
       case $f in
       -) echo $tmp/stdin ;;
       [\\/$]*)
-         # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
-         echo $f;;
+	 echo "$f";;
       *) # Relative
-         if test -f "$f"; then
-           # Build tree
-           echo $f
-         elif test -f "$srcdir/$f"; then
-           # Source tree
-           echo $srcdir/$f
-         else
-           # /dev/null tree
-           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
 echo "$as_me: error: cannot find input file: $f" >&2;}
    { (exit 1); exit 1; }; }
-         fi;;
+	 fi;;
       esac
     done` || { (exit 1); exit 1; }
 _ACEOF

Modified: lvm2/trunk/configure.in
==============================================================================
--- lvm2/trunk/configure.in	(original)
+++ lvm2/trunk/configure.in	Fri May  5 20:27:43 2006
@@ -65,6 +65,8 @@
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_PROG_RANLIB
+AC_PATH_PROG(CFLOW_CMD, cflow)
+AC_PATH_PROG(CSCOPE_CMD, cscope)
 
 ################################################################################
 dnl -- Checks for header files.
@@ -150,7 +152,7 @@
 AC_MSG_RESULT($LVM1_FALLBACK)
 
 if test x$LVM1_FALLBACK = xyes; then
-	CFLAGS="$CFLAGS -DLVM1_FALLBACK"
+	LVM_DEFS="$LVM_DEFS -DLVM1_FALLBACK"
 fi
 
 ################################################################################
@@ -170,7 +172,7 @@
 fi;
 
 if test x$LVM1 = xinternal; then
-	CFLAGS="$CFLAGS -DLVM1_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DLVM1_INTERNAL"
 fi
 
 ################################################################################
@@ -190,7 +192,7 @@
 fi;
 
 if test x$POOL = xinternal; then
-	CFLAGS="$CFLAGS -DPOOL_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DPOOL_INTERNAL"
 fi
 
 ################################################################################
@@ -209,7 +211,7 @@
 fi;
 
 if test x$CLUSTER = xinternal; then
-	CFLAGS="$CFLAGS -DCLUSTER_LOCKING_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DCLUSTER_LOCKING_INTERNAL"
 fi
 
 ################################################################################
@@ -229,7 +231,7 @@
 fi;
 
 if test x$SNAPSHOTS = xinternal; then
-	CFLAGS="$CFLAGS -DSNAPSHOT_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DSNAPSHOT_INTERNAL"
 fi
 
 ################################################################################
@@ -249,7 +251,7 @@
 fi;
 
 if test x$MIRRORS = xinternal; then
-	CFLAGS="$CFLAGS -DMIRRORED_INTERNAL"
+	LVM_DEFS="$LVM_DEFS -DMIRRORED_INTERNAL"
 fi
 
 ################################################################################
@@ -267,7 +269,7 @@
 AC_MSG_RESULT($READLINE)
 
 if test x$READLINE = xyes; then
-	CFLAGS="$CFLAGS -DREADLINE_SUPPORT"
+	LVM_DEFS="$LVM_DEFS -DREADLINE_SUPPORT"
 fi
 
 ################################################################################
@@ -305,6 +307,8 @@
 dnl -- Normally turn off optimisation for debug builds
 if test x$DEBUG = xyes; then
 	COPTIMISE_FLAG=
+else
+	CSCOPE_CMD=
 fi
 
 ################################################################################
@@ -323,7 +327,7 @@
 AC_MSG_RESULT($DEVMAPPER)
 
 if test x$DEVMAPPER = xyes; then
-	CFLAGS="$CFLAGS -DDEVMAPPER_SUPPORT"
+	LVM_DEFS="$LVM_DEFS -DDEVMAPPER_SUPPORT"
 fi
 
 ################################################################################
@@ -334,7 +338,7 @@
 AC_MSG_RESULT($ODIRECT)
 
 if test x$ODIRECT = xyes; then
-	CFLAGS="$CFLAGS -DO_DIRECT_SUPPORT"
+	LVM_DEFS="$LVM_DEFS -DO_DIRECT_SUPPORT"
 fi
 
 ################################################################################
@@ -345,7 +349,7 @@
 AC_MSG_RESULT($CMDLIB)
 
 if test x$CMDLIB = xyes; then
-	CFLAGS="$CFLAGS -DCMDLIB"
+	LVM_DEFS="$LVM_DEFS -DCMDLIB"
 fi
 
 ################################################################################
@@ -370,7 +374,7 @@
 fi
 
 if test x$DMEVENTD = xyes; then
-	CFLAGS="$CFLAGS -DDMEVENTD"
+	LVM_DEFS="$LVM_DEFS -DDMEVENTD"
 fi
 ################################################################################
 dnl -- Mess with default exec_prefix
@@ -407,7 +411,7 @@
 AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no)
 
 if [[ "x$HAVE_LIBDL" = xyes ]]; then
-	CFLAGS="$CFLAGS -DHAVE_LIBDL"
+	LVM_DEFS="$LVM_DEFS -DHAVE_LIBDL"
 	LIBS="-ldl $LIBS"
 else
 	HAVE_LIBDL=no
@@ -424,14 +428,22 @@
 fi
 
 ################################################################################
-dnl -- Check for is_selinux_enabled
+dnl -- Check for selinux
 if test x$SELINUX = xyes; then
+	AC_MSG_CHECKING(for sepol_check_context function)
+	AC_CHECK_LIB(sepol, sepol_check_context, HAVE_SEPOL=yes, HAVE_SEPOL=no)
+	AC_MSG_RESULT($HAVE_SEPOL)
+
+	if test x$HAVE_SEPOL = xyes; then
+		LIBS="-lsepol $LIBS"
+	fi
+
 	AC_MSG_CHECKING(for is_selinux_enabled function)
 	AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no)
 	AC_MSG_RESULT($HAVE_SELINUX)
 
 	if test x$HAVE_SELINUX = xyes; then
-		CFLAGS="$CFLAGS -DHAVE_SELINUX"
+		LVM_DEFS="$LVM_DEFS -DHAVE_SELINUX"
 		LIBS="-lselinux $LIBS"
 	else
 		AC_MSG_WARN(Disabling selinux)
@@ -440,7 +452,7 @@
 
 ################################################################################
 dnl -- Check for getopt
-AC_CHECK_HEADERS(getopt.h, CFLAGS="$CFLAGS -DHAVE_GETOPTLONG")
+AC_CHECK_HEADERS(getopt.h, LVM_DEFS="$LVM_DEFS -DHAVE_GETOPTLONG")
 
 ################################################################################
 dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
@@ -455,7 +467,7 @@
 package as well (which may be called readline-devel or something similar).
 )
 	)
-	AC_CHECK_FUNC(rl_completion_matches, CFLAGS="$CFLAGS -DHAVE_RL_COMPLETION_MATCHES")
+	AC_CHECK_FUNC(rl_completion_matches, LVM_DEFS="$LVM_DEFS -DHAVE_RL_COMPLETION_MATCHES")
 		
 fi
 
@@ -536,7 +548,7 @@
 AC_PATH_PROG(MODPROBE_CMD, modprobe)
 
 if test x$MODPROBE_CMD != x; then
-	CFLAGS="$CFLAGS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
+	LVM_DEFS="$LVM_DEFS -DMODPROBE_CMD=\\\"$MODPROBE_CMD\\\""
 fi
 
 ################################################################################
@@ -556,6 +568,7 @@
 AC_SUBST(OWNER)
 AC_SUBST(GROUP)
 AC_SUBST(CFLAGS)
+AC_SUBST(LVM_DEFS)
 AC_SUBST(COPTIMISE_FLAG)
 AC_SUBST(CLDFLAGS)
 AC_SUBST(CLDWHOLEARCHIVE)
@@ -581,6 +594,8 @@
 AC_SUBST(CLUSTER)
 AC_SUBST(FSADM)
 AC_SUBST(DMEVENTD)
+AC_SUBST(CFLOW_CMD)
+AC_SUBST(CSCOPE_CMD)
 
 ################################################################################
 dnl -- First and last lines should not contain files to generate in order to 

Modified: lvm2/trunk/daemons/clvmd/Makefile.in
==============================================================================
--- lvm2/trunk/daemons/clvmd/Makefile.in	(original)
+++ lvm2/trunk/daemons/clvmd/Makefile.in	Fri May  5 20:27:43 2006
@@ -35,28 +35,28 @@
 endif
 
 ifeq ("@DEBUG@", "yes")
-	CFLAGS += -DDEBUG
+	DEFS += -DDEBUG
 endif
 
 ifeq ("$(GULM)", "yes")
 	SOURCES += clvmd-gulm.c tcp-comms.c
 	LMLIBS += -lccs -lgulm
-	CFLAGS += -DUSE_GULM
+	DEFS += -DUSE_GULM
 endif
 
 ifeq ("$(CMAN)", "yes")
 	SOURCES += clvmd-cman.c
-	LMLIBS += -ldlm
-	CFLAGS += -DUSE_CMAN
+	LMLIBS += -ldlm -lcman
+	DEFS += -DUSE_CMAN
 endif
 
 TARGETS = \
 	clvmd
 
-LVMLIBS = -llvm
+LVMLIBS = -llvm -lpthread
 
 ifeq ("@DMEVENTD@", "yes")
-	LVMLIBS += -ldevmapper-event -lpthread
+	LVMLIBS += -ldevmapper-event
 endif
  
 ifeq ("@DEVMAPPER@", "yes")
@@ -65,7 +65,8 @@
 
 LIBS += -lpthread
 
-CFLAGS += -D_REENTRANT -fno-strict-aliasing
+DEFS += -D_REENTRANT
+CFLAGS += -fno-strict-aliasing
 
 include $(top_srcdir)/make.tmpl
 

Modified: lvm2/trunk/daemons/clvmd/clvmd-cman.c
==============================================================================
--- lvm2/trunk/daemons/clvmd/clvmd-cman.c	(original)
+++ lvm2/trunk/daemons/clvmd/clvmd-cman.c	Fri May  5 20:27:43 2006
@@ -46,19 +46,23 @@
 
 #define LOCKSPACE_NAME "clvmd"
 
-static int cluster_sock;
 static int num_nodes;
-static struct cl_cluster_node *nodes = NULL;
+static struct cman_node *nodes = NULL;
+static struct cman_node this_node;
 static int count_nodes; /* size of allocated nodes array */
 static int max_updown_nodes = 50;	/* Current size of the allocated array */
 /* Node up/down status, indexed by nodeid */
 static int *node_updown = NULL;
 static dlm_lshandle_t *lockspace;
+static cman_handle_t c_handle;
 
 static void count_clvmds_running(void);
 static void get_members(void);
 static int nodeid_from_csid(char *csid);
 static int name_from_nodeid(int nodeid, char *name);
+static void event_callback(cman_handle_t handle, void *private, int reason, int arg);
+static void data_callback(cman_handle_t handle, void *private,
+			  char *buf, int len, uint8_t port, int nodeid);
 
 struct lock_wait {
 	pthread_cond_t cond;
@@ -68,30 +72,23 @@
 
 static int _init_cluster(void)
 {
-	struct sockaddr_cl saddr;
-	int port = CLUSTER_PORT_CLVMD;
-
 	/* Open the cluster communication socket */
-	cluster_sock = socket(AF_CLUSTER, SOCK_DGRAM, CLPROTO_CLIENT);
-	if (cluster_sock == -1) {
-		/* Don't print an error here because we could be just probing for CMAN */
+	c_handle = cman_init(NULL);
+	if (!c_handle) {
+		syslog(LOG_ERR, "Can't open cluster manager socket: %m");
 		return -1;
 	}
-	/* Set Close-on-exec */
-	fcntl(cluster_sock, F_SETFD, 1);
 
-	/* Bind to our port number on the cluster.
-	   Writes to this will block if the cluster loses quorum */
-	saddr.scl_family = AF_CLUSTER;
-	saddr.scl_port = port;
-
-	if (bind
-	    (cluster_sock, (struct sockaddr *) &saddr,
-	     sizeof(struct sockaddr_cl))) {
+	if (cman_start_recv_data(c_handle, data_callback, CLUSTER_PORT_CLVMD)) {
 		syslog(LOG_ERR, "Can't bind cluster socket: %m");
 		return -1;
 	}
 
+	if (cman_start_notification(c_handle, event_callback)) {
+		syslog(LOG_ERR, "Can't start cluster event listening");
+		return -1;
+	}
+
 	/* Get the cluster members list */
 	get_members();
 	count_clvmds_running();
@@ -114,63 +111,46 @@
 
 static int _get_main_cluster_fd()
 {
-	return cluster_sock;
+	return cman_get_fd(c_handle);
 }
 
 static int _get_num_nodes()
 {
-	return num_nodes;
+	int i;
+	int nnodes = 0;
+
+	/* return number of ACTIVE nodes */
+	for (i=0; i<num_nodes; i++) {
+		if (nodes[i].cn_member)
+			nnodes++;
+	}
+	return nnodes;
 }
 
 /* send_message with the fd check removed */
 static int _cluster_send_message(void *buf, int msglen, char *csid, const char *errtext)
 {
-	struct iovec iov[2];
-	struct msghdr msg;
-	struct sockaddr_cl saddr;
-	int len = 0;
-
-	msg.msg_control = NULL;
-	msg.msg_controllen = 0;
-	msg.msg_iovlen = 1;
-	msg.msg_iov = iov;
-	msg.msg_flags = 0;
-	iov[0].iov_len = msglen;
-	iov[0].iov_base = buf;
-
-	saddr.scl_family = AF_CLUSTER;
-	saddr.scl_port = CLUSTER_PORT_CLVMD;
-	if (csid) {
-		msg.msg_name = &saddr;
-		msg.msg_namelen = sizeof(saddr);
-		memcpy(&saddr.scl_nodeid, csid, CMAN_MAX_CSID_LEN);
-	} else {		/* Cluster broadcast */
+	int nodeid = 0;
 
-		msg.msg_name = NULL;
-		msg.msg_namelen = 0;
-	}
+	if (csid)
+		memcpy(&nodeid, csid, CMAN_MAX_CSID_LEN);
 
-	do {
-		len = sendmsg(cluster_sock, &msg, 0);
-		if (len < 0 && errno != EAGAIN)
+	if (cman_send_data(c_handle, buf, msglen, 0, CLUSTER_PORT_CLVMD, nodeid) <= 0)
+	{
 			log_error(errtext);
-
-	} while (len == -1 && errno == EAGAIN);
-	return len;
+	}
+	return msglen;
 }
 
 static void _get_our_csid(char *csid)
 {
-	int i;
-	memset(csid, 0, CMAN_MAX_CSID_LEN);
-
-	for (i = 0; i < num_nodes; i++) {
-		if (nodes[i].us)
-			memcpy(csid, &nodes[i].node_id, CMAN_MAX_CSID_LEN);
+	if (this_node.cn_nodeid == 0) {
+		cman_get_node(c_handle, 0, &this_node);
 	}
+	memcpy(csid, &this_node.cn_nodeid, CMAN_MAX_CSID_LEN);
 }
 
-/* Call a callback routine for each node that known (down mean not running a clvmd) */
+/* Call a callback routine for each node is that known (down means not running a clvmd) */
 static int _cluster_do_node_callback(struct local_client *client,
 			     void (*callback) (struct local_client *, char *,
 					       int))
@@ -179,8 +159,8 @@
 	int somedown = 0;
 
 	for (i = 0; i < _get_num_nodes(); i++) {
-		callback(client, (char *)&nodes[i].node_id, node_updown[nodes[i].node_id]);
-		if (!node_updown[nodes[i].node_id])
+		callback(client, (char *)&nodes[i].cn_nodeid, node_updown[nodes[i].cn_nodeid]);
+		if (!node_updown[nodes[i].cn_nodeid])
 			somedown = -1;
 	}
 	return somedown;
@@ -188,78 +168,63 @@
 
 /* Process OOB message from the cluster socket,
    this currently just means that a node has stopped listening on our port */
-static void process_oob_msg(char *buf, int len, int nodeid)
+static void event_callback(cman_handle_t handle, void *private, int reason, int arg)
 {
-	char namebuf[256];
-	switch (buf[0]) {
-        case CLUSTER_OOB_MSG_PORTCLOSED:
-		name_from_nodeid(nodeid, namebuf);
+	char namebuf[MAX_CLUSTER_NAME_LEN];
+
+	switch (reason) {
+        case CMAN_REASON_PORTCLOSED:
+		name_from_nodeid(arg, namebuf);
 		log_notice("clvmd on node %s has died\n", namebuf);
-		DEBUGLOG("Got OOB message, removing node %s\n", namebuf);
+		DEBUGLOG("Got port closed message, removing node %s\n", namebuf);
 
-		node_updown[nodeid] = 0;
+		node_updown[arg] = 0;
 		break;
 
-	case CLUSTER_OOB_MSG_STATECHANGE:
-		DEBUGLOG("Got OOB message, Cluster state change\n");
+	case CMAN_REASON_STATECHANGE:
+		DEBUGLOG("Got state change message, re-reading members list\n");
 		get_members();
 		break;
+
+#if defined(LIBCMAN_VERSION) && LIBCMAN_VERSION >= 2
+	case CMAN_REASON_PORTOPENED:
+		/* Ignore this, wait for startup message from clvmd itself */
+		break;
+
+	case CMAN_REASON_TRY_SHUTDOWN:
+		DEBUGLOG("Got try shutdown, sending OK\n");
+		cman_replyto_shutdown(c_handle, 1);
+		break;
+#endif
 	default:
 		/* ERROR */
-		DEBUGLOG("Got unknown OOB message: %d\n", buf[0]);
+		DEBUGLOG("Got unknown event callback message: %d\n", reason);
+		break;
 	}
 }
 
-static int _cluster_fd_callback(struct local_client *client, char *buf, int len, char *csid,
+static struct local_client *cman_client;
+static int _cluster_fd_callback(struct local_client *fd, char *buf, int len, char *csid,
 			struct local_client **new_client)
 {
-	struct iovec iov[2];
-	struct msghdr msg;
-	struct sockaddr_cl saddr;
+
+	/* Save this for data_callback */
+	cman_client = fd;
 
 	/* We never return a new client */
 	*new_client = NULL;
 
-	msg.msg_control = NULL;
-	msg.msg_controllen = 0;
-	msg.msg_iovlen = 1;
-	msg.msg_iov = iov;
-	msg.msg_name = &saddr;
-	msg.msg_flags = 0;
-	msg.msg_namelen = sizeof(saddr);
-	iov[0].iov_len = len;
-	iov[0].iov_base = buf;
-
-	len = recvmsg(cluster_sock, &msg, MSG_OOB | O_NONBLOCK);
-	if (len < 0 && errno == EAGAIN)
-		return len;
-
-	DEBUGLOG("Read on cluster socket, len = %d\n", len);
-
-	/* A real error */
-	if (len < 0) {
-		log_error("read error on cluster socket: %m");
-		return 0;
-	}
+	return cman_dispatch(c_handle, 0);
+}
 
-	/* EOF - we have left the cluster */
-	if (len == 0)
-		return 0;
 
-	/* Is it OOB? probably a node gone down */
-	if (msg.msg_flags & MSG_OOB) {
-		process_oob_msg(iov[0].iov_base, len, saddr.scl_nodeid);
-
-		/* Tell the upper layer to ignore this message */
-		len = -1;
-		errno = EAGAIN;
-	}
-	else {
-		memcpy(csid, &saddr.scl_nodeid, sizeof(saddr.scl_nodeid));
-		/* Send it back to clvmd */
-		process_message(client, buf, len, csid);
-	}
-	return len;
+static void data_callback(cman_handle_t handle, void *private,
+			  char *buf, int len, uint8_t port, int nodeid)
+{
+	/* Ignore looped back messages */
+	if (nodeid == this_node.cn_nodeid)
+		return;
+	process_message(cman_client, buf, len, (char *)&nodeid);
 }
 
 static void _add_up_node(char *csid)
@@ -290,19 +255,15 @@
 {
 	unlock_all();
 	dlm_release_lockspace(LOCKSPACE_NAME, lockspace, 1);
-	close(cluster_sock);
+	cman_finish(c_handle);
 }
 
 static int is_listening(int nodeid)
 {
-	struct cl_listen_request rq;
 	int status;
 
-	rq.port = CLUSTER_PORT_CLVMD;
-	rq.nodeid = nodeid;
-
 	do {
-		status = ioctl(cluster_sock, SIOCCLUSTER_ISLISTENING, &rq);
+		status = cman_is_listening(c_handle, nodeid, CLUSTER_PORT_CLVMD);
 		if (status < 0 && errno == EBUSY) {	/* Don't busywait */
 			sleep(1);
 			errno = EBUSY;	/* In case sleep trashes it */
@@ -320,19 +281,22 @@
 	int i;
 
 	for (i = 0; i < num_nodes; i++) {
-		node_updown[nodes[i].node_id] = is_listening(nodes[i].node_id);
+		node_updown[nodes[i].cn_nodeid] = is_listening(nodes[i].cn_nodeid);
 	}
 }
 
 /* Get a list of active cluster members */
 static void get_members()
 {
-	struct cl_cluster_nodelist nodelist;
+	int retnodes;
+	int status;
 
-	num_nodes = ioctl(cluster_sock, SIOCCLUSTER_GETMEMBERS, 0);
+	num_nodes = cman_get_node_count(c_handle);
 	if (num_nodes == -1) {
 		log_error("Unable to get node count");
-	} else {
+		return;
+	}
+
 	        /* Not enough room for new nodes list ? */
 	        if (num_nodes > count_nodes && nodes) {
 			free(nodes);
@@ -341,28 +305,19 @@
 
 		if (nodes == NULL) {
 		        count_nodes = num_nodes + 10; /* Overallocate a little */
-		        nodes = malloc(count_nodes * sizeof(struct cl_cluster_node));
+		nodes = malloc(count_nodes * sizeof(struct cman_node));
 			if (!nodes) {
 			        log_error("Unable to allocate nodes array\n");
 				exit(5);
 			}
 		}
-		nodelist.max_members = count_nodes;
-		nodelist.nodes = nodes;
 
-		num_nodes = ioctl(cluster_sock, SIOCCLUSTER_GETMEMBERS, &nodelist);
-		if (num_nodes <= 0) {
+	status = cman_get_nodes(c_handle, count_nodes, &retnodes, nodes);
+	if (status < 0) {
 		        log_error("Unable to get node details");
 			exit(6);
 		}
 
-		/* Sanity check struct */
-		if (nodes[0].size != sizeof(struct cl_cluster_node)) {
-			log_error
-			    ("sizeof(cl_cluster_node) does not match size returned from the kernel: aborting\n");
-			exit(10);
-		}
-
 		if (node_updown == NULL) {
 			node_updown =
 			    (int *) malloc(sizeof(int) *
@@ -371,7 +326,6 @@
 			       sizeof(int) * max(num_nodes, max_updown_nodes));
 		}
 	}
-}
 
 /* Convert a node name to a CSID */
 static int _csid_from_name(char *csid, char *name)
@@ -379,8 +333,8 @@
 	int i;
 
 	for (i = 0; i < num_nodes; i++) {
-		if (strcmp(name, nodes[i].name) == 0) {
-			memcpy(csid, &nodes[i].node_id, CMAN_MAX_CSID_LEN);
+		if (strcmp(name, nodes[i].cn_name) == 0) {
+			memcpy(csid, &nodes[i].cn_nodeid, CMAN_MAX_CSID_LEN);
 			return 0;
 		}
 	}
@@ -393,8 +347,8 @@
 	int i;
 
 	for (i = 0; i < num_nodes; i++) {
-		if (memcmp(csid, &nodes[i].node_id, CMAN_MAX_CSID_LEN) == 0) {
-			strcpy(name, nodes[i].name);
+		if (memcmp(csid, &nodes[i].cn_nodeid, CMAN_MAX_CSID_LEN) == 0) {
+			strcpy(name, nodes[i].cn_name);
 			return 0;
 		}
 	}
@@ -409,8 +363,8 @@
 	int i;
 
 	for (i = 0; i < num_nodes; i++) {
-		if (nodeid == nodes[i].node_id) {
-			strcpy(name, nodes[i].name);
+		if (nodeid == nodes[i].cn_nodeid) {
+			strcpy(name, nodes[i].cn_name);
 			return 0;
 		}
 	}
@@ -431,7 +385,7 @@
 
 static int _is_quorate()
 {
-	return ioctl(cluster_sock, SIOCCLUSTER_ISQUORATE, 0);
+	return cman_is_quorate(c_handle);
 }
 
 static void sync_ast_routine(void *arg)

Modified: lvm2/trunk/daemons/clvmd/clvmd-comms.h
==============================================================================
--- lvm2/trunk/daemons/clvmd/clvmd-comms.h	(original)
+++ lvm2/trunk/daemons/clvmd/clvmd-comms.h	Fri May  5 20:27:43 2006
@@ -56,15 +56,19 @@
 #endif
 
 #ifdef USE_CMAN
-#  include "cnxman-socket.h"
+#  include <netinet/in.h>
+#  include "libcman.h"
 #  define CMAN_MAX_CSID_LEN 4
 #  ifndef MAX_CSID_LEN
 #    define MAX_CSID_LEN CMAN_MAX_CSID_LEN
 #  endif
 #  undef MAX_CLUSTER_MEMBER_NAME_LEN
-#  define MAX_CLUSTER_MEMBER_NAME_LEN	CMAN_MAX_CLUSTER_MEMBER_NAME_LEN
+#  define MAX_CLUSTER_MEMBER_NAME_LEN   CMAN_MAX_NODENAME_LEN
+#  define CMAN_MAX_CLUSTER_MESSAGE 1500
+#  define CLUSTER_PORT_CLVMD 11
 struct cluster_ops *init_cman_cluster(void);
 #endif
 
 
+
 #endif

Modified: lvm2/trunk/daemons/clvmd/clvmd.c
==============================================================================
--- lvm2/trunk/daemons/clvmd/clvmd.c	(original)
+++ lvm2/trunk/daemons/clvmd/clvmd.c	Fri May  5 20:27:43 2006
@@ -247,7 +247,7 @@
 	if ((clops = init_cman_cluster())) {
 		max_csid_len = CMAN_MAX_CSID_LEN;
 		max_cluster_message = CMAN_MAX_CLUSTER_MESSAGE;
-		max_cluster_member_name_len = CMAN_MAX_CLUSTER_MEMBER_NAME_LEN;
+		max_cluster_member_name_len = CMAN_MAX_NODENAME_LEN;
 		syslog(LOG_NOTICE, "Cluster LVM daemon started - connected to CMAN");
 	}
 #endif
@@ -509,6 +509,7 @@
 		int quorate = clops->is_quorate();
 
 		/* Wait on the cluster FD and all local sockets/pipes */
+		local_client_head.fd = clops->get_main_cluster_fd();
 		FD_ZERO(&in);
 		for (thisfd = &local_client_head; thisfd != NULL;
 		     thisfd = thisfd->next) {

Modified: lvm2/trunk/daemons/clvmd/lvm-functions.c
==============================================================================
--- lvm2/trunk/daemons/clvmd/lvm-functions.c	(original)
+++ lvm2/trunk/daemons/clvmd/lvm-functions.c	Fri May  5 20:27:43 2006
@@ -303,6 +303,9 @@
 		}
 	}
 
+	if (lock_flags & LCK_PARTIAL_MODE)
+		init_partial(1);
+
 	switch (command) {
 	case LCK_LV_EXCLUSIVE:
 		status = do_activate_lv(resource, lock_flags, LKM_EXMODE);
@@ -331,6 +334,9 @@
 		break;
 	}
 
+	if (lock_flags & LCK_PARTIAL_MODE)
+		init_partial(0);
+
 	/* clean the pool for another command */
 	dm_pool_empty(cmd->mem);
 

Modified: lvm2/trunk/dmeventd/mirror/Makefile.in
==============================================================================
--- lvm2/trunk/dmeventd/mirror/Makefile.in	(original)
+++ lvm2/trunk/dmeventd/mirror/Makefile.in	Fri May  5 20:27:43 2006
@@ -16,7 +16,7 @@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
 
-CFLAGS += -I${top_srcdir}/tools -I${top_srcdir}/include
+INCLUDES += -I${top_srcdir}/tools
 CLDFLAGS += -L${top_srcdir}/tools -ldevmapper -llvm2cmd
 
 SOURCES = dmeventd_mirror.c
@@ -32,5 +32,5 @@
 install: libdevmapper-event-lvm2mirror.$(LIB_SUFFIX)
 	$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) $< \
 		$(libdir)/$<.$(LIB_VERSION)
-	$(LN_S) -f $(libdir)/$<.$(LIB_VERSION) $(libdir)/$<
+	$(LN_S) -f $<.$(LIB_VERSION) $(libdir)/$<
 

Modified: lvm2/trunk/include/Makefile.in
==============================================================================
--- lvm2/trunk/include/Makefile.in	(original)
+++ lvm2/trunk/include/Makefile.in	Fri May  5 20:27:43 2006
@@ -41,3 +41,5 @@
 
 install_cluster:
 
+cflow:
+

Modified: lvm2/trunk/lib/Makefile.in
==============================================================================
--- lvm2/trunk/lib/Makefile.in	(original)
+++ lvm2/trunk/lib/Makefile.in	Fri May  5 20:27:43 2006
@@ -38,6 +38,7 @@
 	commands/toolcontext.c \
 	config/config.c \
 	datastruct/btree.c \
+	datastruct/list.c \
 	datastruct/str_list.c \
 	device/dev-cache.c \
 	device/dev-io.c \
@@ -141,5 +142,14 @@
 
 $(SUBDIRS): $(LIB_STATIC)
 
+CLEAN_TARGETS += liblvm.cflow
+
 include $(top_srcdir)/make.tmpl
 
+liblvm.cflow: $(SOURCES)
+	set -e; (echo -n "SOURCES += "; \
+		 echo $(SOURCES) | \
+		 sed "s/^/ /;s/ / $(top_srcdir)\/lib\//g;s/$$//"; \
+		 ) > $@
+
+cflow: liblvm.cflow

Modified: lvm2/trunk/lib/activate/activate.c
==============================================================================
--- lvm2/trunk/lib/activate/activate.c	(original)
+++ lvm2/trunk/lib/activate/activate.c	Fri May  5 20:27:43 2006
@@ -95,12 +95,12 @@
 {
 	return 0;
 }
-int lv_snapshot_percent(struct logical_volume *lv, float *percent)
+int lv_snapshot_percent(const struct logical_volume *lv, float *percent)
 {
 	return 0;
 }
-int lv_mirror_percent(struct logical_volume *lv, int wait, float *percent,
-		      uint32_t *event_nr)
+int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv,
+		      int wait, float *percent, uint32_t *event_nr)
 {
 	return 0;
 }
@@ -407,7 +407,7 @@
 /*
  * Returns 1 if percent set, else 0 on failure.
  */
-int lv_snapshot_percent(struct logical_volume *lv, float *percent)
+int lv_snapshot_percent(const struct logical_volume *lv, float *percent)
 {
 	int r;
 	struct dev_manager *dm;
@@ -427,8 +427,8 @@
 }
 
 /* FIXME Merge with snapshot_percent */
-int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv, int wait, float *percent,
-		      uint32_t *event_nr)
+int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv,
+		      int wait, float *percent, uint32_t *event_nr)
 {
 	int r;
 	struct dev_manager *dm;

Modified: lvm2/trunk/lib/activate/activate.h
==============================================================================
--- lvm2/trunk/lib/activate/activate.h	(original)
+++ lvm2/trunk/lib/activate/activate.h	Fri May  5 20:27:43 2006
@@ -70,9 +70,9 @@
 /*
  * Returns 1 if percent has been set, else 0.
  */
-int lv_snapshot_percent(struct logical_volume *lv, float *percent);
-int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv, int wait, float *percent,
-		      uint32_t *event_nr);
+int lv_snapshot_percent(const struct logical_volume *lv, float *percent);
+int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv,
+		      int wait, float *percent, uint32_t *event_nr);
 
 /*
  * Return number of LVs in the VG that are active.

Modified: lvm2/trunk/lib/activate/dev_manager.c
==============================================================================
--- lvm2/trunk/lib/activate/dev_manager.c	(original)
+++ lvm2/trunk/lib/activate/dev_manager.c	Fri May  5 20:27:43 2006
@@ -85,7 +85,7 @@
 	return _build_dlid(dm->mem, lvid, layer);
 }
 
-static inline int _read_only_lv(struct logical_volume *lv)
+static int _read_only_lv(struct logical_volume *lv)
 {
 	return (!(lv->vg->status & LVM_WRITE) || !(lv->status & LVM_WRITE));
 }
@@ -432,7 +432,8 @@
 }
 
 int dev_manager_snapshot_percent(struct dev_manager *dm,
-				 struct logical_volume *lv, float *percent)
+				 const struct logical_volume *lv,
+				 float *percent)
 {
 	char *name;
 	const char *dlid;

Modified: lvm2/trunk/lib/activate/dev_manager.h
==============================================================================
--- lvm2/trunk/lib/activate/dev_manager.h	(original)
+++ lvm2/trunk/lib/activate/dev_manager.h	Fri May  5 20:27:43 2006
@@ -41,7 +41,8 @@
 		     const struct logical_volume *lv,
 		     int mknodes, int with_open_count, struct dm_info *info);
 int dev_manager_snapshot_percent(struct dev_manager *dm,
-				 struct logical_volume *lv, float *percent);
+				 const struct logical_volume *lv,
+				 float *percent);
 int dev_manager_mirror_percent(struct dev_manager *dm,
 			       struct logical_volume *lv, int wait,
 			       float *percent, uint32_t *event_nr);

Modified: lvm2/trunk/lib/cache/lvmcache.c
==============================================================================
--- lvm2/trunk/lib/cache/lvmcache.c	(original)
+++ lvm2/trunk/lib/cache/lvmcache.c	Fri May  5 20:27:43 2006
@@ -86,7 +86,8 @@
 	return _vgs_locked;
 }
 
-struct lvmcache_vginfo *vginfo_from_vgname(const char *vgname)
+/* If vgid supplied, require a match. */
+struct lvmcache_vginfo *vginfo_from_vgname(const char *vgname, const char *vgid)
 {
 	struct lvmcache_vginfo *vginfo;
 
@@ -96,10 +97,16 @@
 	if (!(vginfo = dm_hash_lookup(_vgname_hash, vgname)))
 		return NULL;
 
+	if (vgid)
+		do 
+			if (!strncmp(vgid, vginfo->vgid, ID_LEN))
+				return vginfo;
+		while ((vginfo = vginfo->next));
+
 	return vginfo;
 }
 
-const struct format_type *fmt_from_vgname(const char *vgname)
+const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid)
 {
 	struct lvmcache_vginfo *vginfo;
 	struct lvmcache_info *info;
@@ -107,8 +114,9 @@
 	struct list *devh, *tmp;
 	struct list devs;
 	struct device_list *devl;
+	char vgid_found[ID_LEN + 1];
 
-	if (!(vginfo = vginfo_from_vgname(vgname)))
+	if (!(vginfo = vginfo_from_vgname(vgname, vgid)))
 		return NULL;
 
 	/* This function is normally called before reading metadata so
@@ -120,6 +128,8 @@
 		list_add(&devs, &devl->list);
 	}
 
+	memcpy(vgid_found, vginfo->vgid, sizeof(vgid_found));
+
 	list_iterate_safe(devh, tmp, &devs) {
 		devl = list_item(devh, struct device_list);
 		label_read(devl->dev, &label);
@@ -127,6 +137,11 @@
 		dm_free(devl);
 	}
 
+	/* If vginfo changed, caller needs to rescan */
+	if (!(vginfo = vginfo_from_vgname(vgname, vgid_found)) ||
+	    strncmp(vginfo->vgid, vgid_found, ID_LEN))
+		return NULL;
+
 	return vginfo->fmt;
 }
 
@@ -148,6 +163,19 @@
 	return vginfo;
 }
 
+const char *vgname_from_vgid(struct dm_pool *mem, const char *vgid)
+{
+	struct lvmcache_vginfo *vginfo;
+
+	if ((vginfo = vginfo_from_vgid(vgid))) {
+		if (mem)
+			return dm_pool_strdup(mem, vginfo->vgname);
+		return vginfo->vgname;
+	}
+
+	return NULL;
+}
+
 struct lvmcache_info *info_from_pvid(const char *pvid)
 {
 	struct lvmcache_info *info;
@@ -232,10 +260,33 @@
 	return r;
 }
 
+struct list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan)
+{
+	struct list *vgids;
+	struct lvmcache_vginfo *vginfo;
+
+	lvmcache_label_scan(cmd, full_scan);
+
+	if (!(vgids = str_list_create(cmd->mem))) {
+		log_error("vgids list allocation failed");
+		return NULL;
+	}
+
+	list_iterate_items(vginfo, &_vginfos) {
+		if (!str_list_add(cmd->mem, vgids, 
+				  dm_pool_strdup(cmd->mem, vginfo->vgid))) {
+			log_error("strlist allocation failed");
+			return NULL;
+		}
+	}
+
+	return vgids;
+}
+
 struct list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan)
 {
 	struct list *vgnames;
-	struct lvmcache_vginfo *vgi;
+	struct lvmcache_vginfo *vginfo;
 
 	lvmcache_label_scan(cmd, full_scan);
 
@@ -244,9 +295,9 @@
 		return NULL;
 	}
 
-	list_iterate_items(vgi, &_vginfos) {
+	list_iterate_items(vginfo, &_vginfos) {
 		if (!str_list_add(cmd->mem, vgnames, 
-				  dm_pool_strdup(cmd->mem, vgi->vgname))) {
+				  dm_pool_strdup(cmd->mem, vginfo->vgname))) {
 			log_error("strlist allocation failed");
 			return NULL;
 		}
@@ -297,7 +348,7 @@
 	return NULL;
 }
 
-static void _drop_vginfo(struct lvmcache_info *info)
+static int _drop_vginfo(struct lvmcache_info *info)
 {
 	if (!list_empty(&info->list)) {
 		list_del(&info->list);
@@ -306,8 +357,18 @@
 
 	if (info->vginfo && list_empty(&info->vginfo->infos)) {
 		dm_hash_remove(_vgname_hash, info->vginfo->vgname);
+		if (info->vginfo->next) {
+                	if (!dm_hash_insert(_vgname_hash, info->vginfo->vgname, info->vginfo->next)) {
+                        	log_error("vg hash re-insertion failed: %s",
+					  info->vginfo->vgname);
+                        	return 0;
+			}
+                }
+
 		if (info->vginfo->vgname)
 			dm_free(info->vginfo->vgname);
+		if (info->vginfo->creation_host)
+			dm_free(info->vginfo->creation_host);
 		if (*info->vginfo->vgid)
 			dm_hash_remove(_vgid_hash, info->vginfo->vgid);
 		list_del(&info->vginfo->list);
@@ -315,6 +376,8 @@
 	}
 
 	info->vginfo = NULL;
+
+	return 1;
 }
 
 /* Unused
@@ -350,36 +413,129 @@
 
 static int _lvmcache_update_vgid(struct lvmcache_info *info, const char *vgid)
 {
-	if (!vgid || !info->vginfo || !strncmp(info->vginfo->vgid, vgid,
-					       sizeof(info->vginfo->vgid)))
+	if (!vgid || !info->vginfo ||
+	    !strncmp(info->vginfo->vgid, vgid, ID_LEN))
 		return 1;
 
 	if (info->vginfo && *info->vginfo->vgid)
 		dm_hash_remove(_vgid_hash, info->vginfo->vgid);
-	if (!vgid)
+	if (!vgid) {
+		log_debug("lvmcache: %s: clearing VGID", dev_name(info->dev));
 		return 1;
+	}
 
-	strncpy(info->vginfo->vgid, vgid, sizeof(info->vginfo->vgid));
-	info->vginfo->vgid[sizeof(info->vginfo->vgid) - 1] = '\0';
+	strncpy(info->vginfo->vgid, vgid, ID_LEN);
+	info->vginfo->vgid[ID_LEN] = '\0';
 	if (!dm_hash_insert(_vgid_hash, info->vginfo->vgid, info->vginfo)) {
 		log_error("_lvmcache_update: vgid hash insertion failed: %s",
 			  info->vginfo->vgid);
 		return 0;
 	}
 
+	log_debug("lvmcache: %s: setting %s VGID to %s", dev_name(info->dev),
+		  info->vginfo->vgname, info->vginfo->vgid);
+
 	return 1;
 }
 
-int lvmcache_update_vgname(struct lvmcache_info *info, const char *vgname)
+static int _insert_vginfo(struct lvmcache_vginfo *new_vginfo, const char *vgid,
+			  uint32_t vgstatus, const char *creation_host,
+			  struct lvmcache_vginfo *primary_vginfo)
+{
+	struct lvmcache_vginfo *last_vginfo = primary_vginfo;
+	char uuid_primary[64], uuid_new[64];
+	int use_new = 0;
+	
+	/* Pre-existing VG takes precedence. Unexported VG takes precedence. */
+	if (primary_vginfo) {
+		if (!id_write_format((struct id *)vgid, uuid_new, sizeof(uuid_new)))
+			return_0;
+
+		if (!id_write_format((struct id *)&primary_vginfo->vgid, uuid_primary,
+				     sizeof(uuid_primary)))
+			return_0;
+
+		/*
+		 * If   Primary not exported, new exported => keep
+		 * Else Primary exported, new not exported => change
+		 * Else Primary has hostname for this machine => keep
+		 * Else Primary has no hostname, new has one => change
+		 * Else New has hostname for this machine => change
+		 * Else Keep primary.
+		 */
+		if (!(primary_vginfo->status & EXPORTED_VG) &&
+		    (vgstatus & EXPORTED_VG))
+			log_error("WARNING: Duplicate VG name %s: "
+				  "Existing %s takes precedence over "
+				  "exported %s", new_vginfo->vgname,
+				  uuid_primary, uuid_new);
+		else if ((primary_vginfo->status & EXPORTED_VG) &&
+			   !(vgstatus & EXPORTED_VG)) {
+			log_error("WARNING: Duplicate VG name %s: "
+				  "%s takes precedence over exported %s",
+				  new_vginfo->vgname, uuid_new,
+				  uuid_primary);
+			use_new = 1;
+		} else if (primary_vginfo->creation_host &&
+			   !strcmp(primary_vginfo->creation_host,
+				   primary_vginfo->fmt->cmd->hostname))
+			log_error("WARNING: Duplicate VG name %s: "
+				  "Existing %s (created here) takes precedence "
+				  "over %s", new_vginfo->vgname, uuid_primary,
+				  uuid_new);
+		else if (!primary_vginfo->creation_host && creation_host) {
+			log_error("WARNING: Duplicate VG name %s: "
+				  "%s (with creation_host) takes precedence over %s",
+				  new_vginfo->vgname, uuid_new,
+				  uuid_primary);
+			use_new = 1;
+		} else if (creation_host &&
+			   !strcmp(creation_host,
+				   primary_vginfo->fmt->cmd->hostname)) {
+			log_error("WARNING: Duplicate VG name %s: "
+				  "%s (created here) takes precedence over %s",
+				  new_vginfo->vgname, uuid_new,
+				  uuid_primary);
+			use_new = 1;
+		}
+
+		if (!use_new) {
+			while (last_vginfo->next)
+				last_vginfo = last_vginfo->next;
+			last_vginfo->next = new_vginfo;
+			return 1;
+		}
+
+		dm_hash_remove(_vgname_hash, primary_vginfo->vgname);
+	}
+
+	if (!dm_hash_insert(_vgname_hash, new_vginfo->vgname, new_vginfo)) {
+		log_error("cache_update: vg hash insertion failed: %s",
+		  	new_vginfo->vgname);
+		return 0;
+	}
+
+	if (primary_vginfo)
+		new_vginfo->next = primary_vginfo;
+
+	return 1;
+}
+
+static int _lvmcache_update_vgname(struct lvmcache_info *info,
+				   const char *vgname, const char *vgid,
+				   uint32_t vgstatus, const char *creation_host)
 {
-	struct lvmcache_vginfo *vginfo;
+	struct lvmcache_vginfo *vginfo, *primary_vginfo;
+	// struct lvmcache_vginfo  *old_vginfo, *next;
 
 	/* If vgname is NULL and we don't already have a vgname, 
 	 * assume ORPHAN - we want every entry to have a vginfo
 	 * attached for scanning reasons.
 	 */
-	if (!vgname && !info->vginfo)
+	if (!vgname && !info->vginfo) {
 		vgname = ORPHAN;
+		vgid = ORPHAN;
+	}
 
 	if (!vgname || (info->vginfo && !strcmp(info->vginfo->vgname, vgname)))
 		return 1;
@@ -388,7 +544,43 @@
 	_drop_vginfo(info);
 
 	/* Get existing vginfo or create new one */
-	if (!(vginfo = vginfo_from_vgname(vgname))) {
+	if (!(vginfo = vginfo_from_vgname(vgname, vgid))) {
+/*** FIXME - vginfo ends up duplicated instead of renamed.
+		// Renaming?  This lookup fails.
+		if ((vginfo = vginfo_from_vgid(vgid))) {
+			next = vginfo->next;
+			old_vginfo = vginfo_from_vgname(vginfo->vgname, NULL);
+			if (old_vginfo == vginfo) {
+				dm_hash_remove(_vgname_hash, old_vginfo->vgname);
+				if (old_vginfo->next) {
+					if (!dm_hash_insert(_vgname_hash, old_vginfo->vgname, old_vginfo->next)) {
+                        			log_error("vg hash re-insertion failed: %s",
+							  old_vginfo->vgname);
+                        			return 0;
+					}
+				}
+			} else do {
+				if (old_vginfo->next == vginfo) {
+					old_vginfo->next = vginfo->next;
+					break;
+				}
+			} while ((old_vginfo = old_vginfo->next));
+			vginfo->next = NULL;
+
+			dm_free(vginfo->vgname);
+			if (!(vginfo->vgname = dm_strdup(vgname))) {
+				log_error("cache vgname alloc failed for %s", vgname);
+				return 0;
+			}
+
+			// Rename so can assume new name does not already exist 
+			if (!dm_hash_insert(_vgname_hash, vginfo->vgname, vginfo->next)) {
+				log_error("vg hash re-insertion failed: %s",
+					  vginfo->vgname);
+                      		return 0;
+			}
+		} else {
+***/
 		if (!(vginfo = dm_malloc(sizeof(*vginfo)))) {
 			log_error("lvmcache_update_vgname: list alloc failed");
 			return 0;
@@ -400,9 +592,9 @@
 			return 0;
 		}
 		list_init(&vginfo->infos);
-		if (!dm_hash_insert(_vgname_hash, vginfo->vgname, vginfo)) {
-			log_error("cache_update: vg hash insertion failed: %s",
-				  vginfo->vgname);
+			primary_vginfo = vginfo_from_vgname(vgname, NULL);
+		if (!_insert_vginfo(vginfo, vgid, vgstatus, creation_host,
+				    primary_vginfo)) {
 			dm_free(vginfo->vgname);
 			dm_free(vginfo);
 			return 0;
@@ -412,6 +604,9 @@
 			list_add(&_vginfos, &vginfo->list);
 		else
 			list_add_h(&_vginfos, &vginfo->list);
+/***
+		}
+***/
 	}
 
 	info->vginfo = vginfo;
@@ -420,8 +615,59 @@
 	/* FIXME Check consistency of list! */
 	vginfo->fmt = info->fmt;
 
-	log_debug("lvmcache: %s now %s%s", dev_name(info->dev),
-		  *vgname ? "in VG " : "orphaned", vgname);
+	log_debug("lvmcache: %s: now %s%s%s%s%s", dev_name(info->dev),
+		  *vgname ? "in VG " : "orphaned", vgname,
+		  vginfo->vgid[0] ? " (" : "",
+		  vginfo->vgid[0] ? vginfo->vgid : "",
+		  vginfo->vgid[0] ? ")" : "");
+
+	return 1;
+}
+
+static int _lvmcache_update_vgstatus(struct lvmcache_info *info, uint32_t vgstatus,
+				     const char *creation_host)
+{
+	if (!info || !info->vginfo)
+		return 1;
+
+	if ((info->vginfo->status & EXPORTED_VG) != (vgstatus & EXPORTED_VG))
+		log_debug("lvmcache: %s: VG %s %s exported",
+			  dev_name(info->dev), info->vginfo->vgname,
+			  vgstatus & EXPORTED_VG ? "now" : "no longer");
+
+	info->vginfo->status = vgstatus;
+
+	if (!creation_host)
+		return 1;
+
+	if (info->vginfo->creation_host && !strcmp(creation_host,
+						   info->vginfo->creation_host))
+		return 1;
+
+	if (info->vginfo->creation_host)
+		dm_free(info->vginfo->creation_host);
+
+	if (!(info->vginfo->creation_host = dm_strdup(creation_host))) {
+		log_error("cache creation host alloc failed for %s",
+			  creation_host);
+		return 0;
+	}
+
+	log_debug("lvmcache: %s: VG %s: Set creation host to %s.",
+		  dev_name(info->dev), info->vginfo->vgname, creation_host);
+
+	return 1;
+}
+
+int lvmcache_update_vgname_and_id(struct lvmcache_info *info,
+				  const char *vgname, const char *vgid,
+				  uint32_t vgstatus, const char *creation_host)
+{
+	if (!_lvmcache_update_vgname(info, vgname, vgid, vgstatus,
+				     creation_host) ||
+	    !_lvmcache_update_vgid(info, vgid) ||
+	    !_lvmcache_update_vgstatus(info, vgstatus, creation_host))
+		return_0;
 
 	return 1;
 }
@@ -431,20 +677,17 @@
 	struct pv_list *pvl;
 	struct lvmcache_info *info;
 	char pvid_s[ID_LEN + 1];
-	int vgid_updated = 0;
 
 	pvid_s[sizeof(pvid_s) - 1] = '\0';
 
 	list_iterate_items(pvl, &vg->pvs) {
 		strncpy(pvid_s, (char *) &pvl->pv->id, sizeof(pvid_s) - 1);
 		/* FIXME Could pvl->pv->dev->pvid ever be different? */
-		if ((info = info_from_pvid(pvid_s))) {
-			lvmcache_update_vgname(info, vg->name);
-			if (!vgid_updated) {
-				_lvmcache_update_vgid(info, (char *) &vg->id);
-				vgid_updated = 1;
-			}
-		}
+		if ((info = info_from_pvid(pvid_s)) &&
+		    !lvmcache_update_vgname_and_id(info, vg->name,
+						   (char *) &vg->id,
+						   vg->status, NULL))
+			return_0;
 	}
 
 	return 1;
@@ -452,7 +695,8 @@
 
 struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
 				   struct device *dev,
-				   const char *vgname, const char *vgid)
+				   const char *vgname, const char *vgid,
+				   uint32_t vgstatus)
 {
 	struct label *label;
 	struct lvmcache_info *existing, *info;
@@ -548,7 +792,7 @@
 		return NULL;
 	}
 
-	if (!lvmcache_update_vgname(info, vgname)) {
+	if (!lvmcache_update_vgname_and_id(info, vgname, vgid, vgstatus, NULL)) {
 		if (!existing) {
 			dm_hash_remove(_pvid_hash, pvid_s);
 			strcpy(info->dev->pvid, "");
@@ -558,10 +802,6 @@
 		return NULL;
 	}
 
-	if (!_lvmcache_update_vgid(info, vgid))
-		/* Non-critical */
-		stack;
-
 	return info;
 }
 
@@ -576,9 +816,16 @@
 
 static void _lvmcache_destroy_vgnamelist(struct lvmcache_vginfo *vginfo)
 {
-	if (vginfo->vgname)
-		dm_free(vginfo->vgname);
-	dm_free(vginfo);
+	struct lvmcache_vginfo *next;
+
+	do {
+		next = vginfo->next;
+		if (vginfo->vgname)
+			dm_free(vginfo->vgname);
+		if (vginfo->creation_host)
+			dm_free(vginfo->creation_host);
+		dm_free(vginfo);
+	} while ((vginfo = next));
 }
 
 static void _lvmcache_destroy_lockname(int present)

Modified: lvm2/trunk/lib/cache/lvmcache.h
==============================================================================
--- lvm2/trunk/lib/cache/lvmcache.h	(original)
+++ lvm2/trunk/lib/cache/lvmcache.h	Fri May  5 20:27:43 2006
@@ -33,15 +33,20 @@
 struct format_type;
 struct volume_group;
 
+/* One per VG */
 struct lvmcache_vginfo {
 	struct list list;	/* Join these vginfos together */
 	struct list infos;	/* List head for lvmcache_infos */
 	const struct format_type *fmt;
 	char *vgname;		/* "" == orphan */
+	uint32_t status;
 	char vgid[ID_LEN + 1];
 	char _padding[7];
+	struct lvmcache_vginfo *next; /* Another VG with same name? */
+	char *creation_host;
 };
 
+/* One per device */
 struct lvmcache_info {
 	struct list list;	/* Join VG members together */
 	struct list mdas;	/* list head for metadata areas */
@@ -64,21 +69,26 @@
 /* Add/delete a device */
 struct lvmcache_info *lvmcache_add(struct labeller *labeller, const char *pvid,
 				   struct device *dev,
-				   const char *vgname, const char *vgid);
+				   const char *vgname, const char *vgid,
+				   uint32_t vgstatus);
 void lvmcache_del(struct lvmcache_info *info);
 
 /* Update things */
-int lvmcache_update_vgname(struct lvmcache_info *info, const char *vgname);
+int lvmcache_update_vgname_and_id(struct lvmcache_info *info,
+				  const char *vgname, const char *vgid,
+				  uint32_t vgstatus, const char *hostname);
 int lvmcache_update_vg(struct volume_group *vg);
 
 void lvmcache_lock_vgname(const char *vgname, int read_only);
 void lvmcache_unlock_vgname(const char *vgname);
 
 /* Queries */
-const struct format_type *fmt_from_vgname(const char *vgname);
-struct lvmcache_vginfo *vginfo_from_vgname(const char *vgname);
+const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid);
+struct lvmcache_vginfo *vginfo_from_vgname(const char *vgname,
+					   const char *vgid);
 struct lvmcache_vginfo *vginfo_from_vgid(const char *vgid);
 struct lvmcache_info *info_from_pvid(const char *pvid);
+const char *vgname_from_vgid(struct dm_pool *mem, const char *vgid);
 struct device *device_from_pvid(struct cmd_context *cmd, struct id *pvid);
 int vgs_locked(void);
 int vgname_is_locked(const char *vgname);
@@ -87,4 +97,8 @@
 /* Set full_scan to 1 to reread every filtered device label */
 struct list *lvmcache_get_vgnames(struct cmd_context *cmd, int full_scan);
 
+/* Returns list of struct str_lists containing pool-allocated copy of vgids */
+/* Set full_scan to 1 to reread every filtered device label */
+struct list *lvmcache_get_vgids(struct cmd_context *cmd, int full_scan);
+
 #endif

Modified: lvm2/trunk/lib/commands/toolcontext.c
==============================================================================
--- lvm2/trunk/lib/commands/toolcontext.c	(original)
+++ lvm2/trunk/lib/commands/toolcontext.c	Fri May  5 20:27:43 2006
@@ -657,7 +657,7 @@
 				return 0;
 			}
 			if (!(lib = load_shared_library(cmd->cft, cv->v.str,
-							"format"))) {
+							"format", 0))) {
 				stack;
 				return 0;
 			}
@@ -753,7 +753,7 @@
 				return 0;
 			}
 			if (!(lib = load_shared_library(cmd->cft, cv->v.str,
-							"segment type"))) {
+							"segment type", 0))) {
 				stack;
 				return 0;
 			}

Modified: lvm2/trunk/lib/datastruct/btree.c
==============================================================================
--- lvm2/trunk/lib/datastruct/btree.c	(original)
+++ lvm2/trunk/lib/datastruct/btree.c	Fri May  5 20:27:43 2006
@@ -107,7 +107,7 @@
 	return ((struct node *) it)->data;
 }
 
-static inline struct node *_left(struct node *n)
+static struct node *_left(struct node *n)
 {
 	while (n->l)
 		n = n->l;

Added: lvm2/trunk/lib/datastruct/list.c
==============================================================================
--- (empty file)
+++ lvm2/trunk/lib/datastruct/list.c	Fri May  5 20:27:43 2006
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "lib.h"
+
+/*
+ * Initialise a list before use.
+ * The list head's next and previous pointers point back to itself.
+ */
+void list_init(struct list *head)
+{
+	head->n = head->p = head;
+}
+
+/*
+ * Insert an element before 'head'.
+ * If 'head' is the list head, this adds an element to the end of the list.
+ */
+void list_add(struct list *head, struct list *elem)
+{
+	assert(head->n);
+
+	elem->n = head;
+	elem->p = head->p;
+
+	head->p->n = elem;
+	head->p = elem;
+}
+
+/*
+ * Insert an element after 'head'.
+ * If 'head' is the list head, this adds an element to the front of the list.
+ */
+void list_add_h(struct list *head, struct list *elem)
+{
+	assert(head->n);
+
+	elem->n = head->n;
+	elem->p = head;
+
+	head->n->p = elem;
+	head->n = elem;
+}
+
+/*
+ * Delete an element from its list.
+ * Note that this doesn't change the element itself - it may still be safe
+ * to follow its pointers.
+ */
+void list_del(struct list *elem)
+{
+	elem->n->p = elem->p;
+	elem->p->n = elem->n;
+}
+
+/*
+ * Is the list empty?
+ */
+int list_empty(struct list *head)
+{
+	return head->n == head;
+}
+
+/*
+ * Is this the first element of the list?
+ */
+int list_start(struct list *head, struct list *elem)
+{
+	return elem->p == head;
+}
+
+/*
+ * Is this the last element of the list?
+ */
+int list_end(struct list *head, struct list *elem)
+{
+	return elem->n == head;
+}
+
+/*
+ * Return first element of the list or NULL if empty
+ */
+struct list *list_first(struct list *head)
+{
+	return (list_empty(head) ? NULL : head->n);
+}
+
+/*
+ * Return last element of the list or NULL if empty
+ */
+struct list *list_last(struct list *head)
+{
+	return (list_empty(head) ? NULL : head->p);
+}
+
+/*
+ * Return the previous element of the list, or NULL if we've reached the start.
+ */
+struct list *list_prev(struct list *head, struct list *elem)
+{
+	return (list_start(head, elem) ? NULL : elem->p);
+}
+
+/*
+ * Return the next element of the list, or NULL if we've reached the end.
+ */
+struct list *list_next(struct list *head, struct list *elem)
+{
+	return (list_end(head, elem) ? NULL : elem->n);
+}
+
+/*
+ * Return the number of elements in a list by walking it.
+ */
+unsigned int list_size(const struct list *head)
+{
+	unsigned int s = 0;
+	const struct list *v;
+
+	list_iterate(v, head)
+	    s++;
+
+	return s;
+}

Modified: lvm2/trunk/lib/datastruct/list.h
==============================================================================
--- lvm2/trunk/lib/datastruct/list.h	(original)
+++ lvm2/trunk/lib/datastruct/list.h	Fri May  5 20:27:43 2006
@@ -33,107 +33,61 @@
  * The list head's next and previous pointers point back to itself.
  */
 #define LIST_INIT(name)	struct list name = { &(name), &(name) }
-static inline void list_init(struct list *head)
-{
-	head->n = head->p = head;
-}
+void list_init(struct list *head);
 
 /*
  * Insert an element before 'head'.
  * If 'head' is the list head, this adds an element to the end of the list.
  */
-static inline void list_add(struct list *head, struct list *elem)
-{
-	assert(head->n);
-
-	elem->n = head;
-	elem->p = head->p;
-
-	head->p->n = elem;
-	head->p = elem;
-}
+void list_add(struct list *head, struct list *elem);
 
 /*
  * Insert an element after 'head'.
  * If 'head' is the list head, this adds an element to the front of the list.
  */
-static inline void list_add_h(struct list *head, struct list *elem)
-{
-	assert(head->n);
-
-	elem->n = head->n;
-	elem->p = head;
-
-	head->n->p = elem;
-	head->n = elem;
-}
+void list_add_h(struct list *head, struct list *elem);
 
 /*
  * Delete an element from its list.
  * Note that this doesn't change the element itself - it may still be safe
  * to follow its pointers.
  */
-static inline void list_del(struct list *elem)
-{
-	elem->n->p = elem->p;
-	elem->p->n = elem->n;
-}
+void list_del(struct list *elem);
 
 /*
  * Is the list empty?
  */
-static inline int list_empty(struct list *head)
-{
-	return head->n == head;
-}
+int list_empty(struct list *head);
 
 /*
  * Is this the first element of the list?
  */
-static inline int list_start(struct list *head, struct list *elem)
-{
-	return elem->p == head;
-}
+int list_start(struct list *head, struct list *elem);
 
 /*
  * Is this the last element of the list?
  */
-static inline int list_end(struct list *head, struct list *elem)
-{
-	return elem->n == head;
-}
+int list_end(struct list *head, struct list *elem);
 
 /*
  * Return first element of the list or NULL if empty
  */
-static inline struct list *list_first(struct list *head)
-{
-	return (list_empty(head) ? NULL : head->n);
-}
+struct list *list_first(struct list *head);
 
 /*
  * Return last element of the list or NULL if empty
  */
-static inline struct list *list_last(struct list *head)
-{
-	return (list_empty(head) ? NULL : head->p);
-}
+struct list *list_last(struct list *head);
 
 /*
  * Return the previous element of the list, or NULL if we've reached the start.
  */
-static inline struct list *list_prev(struct list *head, struct list *elem)
-{
-	return (list_start(head, elem) ? NULL : elem->p);
-}
+struct list *list_prev(struct list *head, struct list *elem);
 
 /*
  * Return the next element of the list, or NULL if we've reached the end.
  */
-static inline struct list *list_next(struct list *head, struct list *elem)
-{
-	return (list_end(head, elem) ? NULL : elem->n);
-}
+struct list *list_next(struct list *head, struct list *elem);
 
 /*
  * Given the address v of an instance of 'struct list' called 'head' 
@@ -244,15 +198,6 @@
 /*
  * Return the number of elements in a list by walking it.
  */
-static inline unsigned int list_size(const struct list *head)
-{
-	unsigned int s = 0;
-	const struct list *v;
-
-	list_iterate(v, head)
-	    s++;
-
-	return s;
-}
+unsigned int list_size(const struct list *head);
 
 #endif

Modified: lvm2/trunk/lib/device/dev-cache.c
==============================================================================
--- lvm2/trunk/lib/device/dev-cache.c	(original)
+++ lvm2/trunk/lib/device/dev-cache.c	Fri May  5 20:27:43 2006
@@ -479,7 +479,7 @@
 		log_err("Device '%s' has been left open.", dev_name(dev));
 }
 
-static inline void _check_for_open_devices(void)
+static void _check_for_open_devices(void)
 {
 	dm_hash_iter(_cache.names, (dm_hash_iterate_fn) _check_closed);
 }
@@ -664,7 +664,7 @@
 	dm_free(iter);
 }
 
-static inline struct device *_iter_next(struct dev_iter *iter)
+static struct device *_iter_next(struct dev_iter *iter)
 {
 	struct device *d = btree_get_data(iter->current);
 	iter->current = btree_next(iter->current);
@@ -682,3 +682,14 @@
 
 	return NULL;
 }
+
+int dev_fd(struct device *dev)
+{
+	return dev->fd;
+}
+
+const char *dev_name(const struct device *dev)
+{
+	return (dev) ? list_item(dev->aliases.n, struct str_list)->str :
+	    "unknown device";
+}

Modified: lvm2/trunk/lib/device/device.h
==============================================================================
--- lvm2/trunk/lib/device/device.h	(original)
+++ lvm2/trunk/lib/device/device.h	Fri May  5 20:27:43 2006
@@ -74,10 +74,8 @@
 void dev_close_all(void);
 int dev_test_excl(struct device *dev);
 
-static inline int dev_fd(struct device *dev)
-{
-	return dev->fd;
-}
+int dev_fd(struct device *dev);
+const char *dev_name(const struct device *dev);
 
 int dev_read(struct device *dev, uint64_t offset, size_t len, void *buffer);
 int dev_write(struct device *dev, uint64_t offset, size_t len, void *buffer);
@@ -88,12 +86,6 @@
 struct device *dev_create_file(const char *filename, struct device *dev,
 			       struct str_list *alias, int use_malloc);
 
-static inline const char *dev_name(const struct device *dev)
-{
-	return (dev) ? list_item(dev->aliases.n, struct str_list)->str :
-	    "unknown device";
-}
-
 /* Return a valid device name from the alias list; NULL otherwise */
 const char *dev_name_confirmed(struct device *dev, int quiet);
 

Modified: lvm2/trunk/lib/error/errseg.c
==============================================================================
--- lvm2/trunk/lib/error/errseg.c	(original)
+++ lvm2/trunk/lib/error/errseg.c	Fri May  5 20:27:43 2006
@@ -24,12 +24,12 @@
 #include "lvm-string.h"
 #include "activate.h"
 
-static const char *_name(const struct lv_segment *seg)
+static const char *_errseg_name(const struct lv_segment *seg)
 {
 	return seg->segtype->name;
 }
 
-static int _merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
+static int _errseg_merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
 {
 	seg1->len += seg2->len;
 	seg1->area_len += seg2->area_len;
@@ -38,7 +38,7 @@
 }
 
 #ifdef DEVMAPPER_SUPPORT
-static int _add_target_line(struct dev_manager *dm, struct dm_pool *mem,
+static int _errseg_add_target_line(struct dev_manager *dm, struct dm_pool *mem,
 				struct config_tree *cft, void **target_state,
 				struct lv_segment *seg,
 				struct dm_tree_node *node, uint64_t len,
@@ -47,34 +47,34 @@
 	return dm_tree_node_add_error_target(node, len);
 }
 
-static int _target_present(void)
+static int _errseg_target_present(void)
 {
-	static int checked = 0;
-	static int present = 0;
+	static int _errseg_checked = 0;
+	static int _errseg_present = 0;
 
 	/* Reported truncated in older kernels */
-	if (!checked &&
+	if (!_errseg_checked &&
 	    (target_present("error", 0) || target_present("erro", 0)))
-		present = 1;
+		_errseg_present = 1;
 
-	checked = 1;
-	return present;
+	_errseg_checked = 1;
+	return _errseg_present;
 }
 #endif
 
-static void _destroy(const struct segment_type *segtype)
+static void _errseg_destroy(const struct segment_type *segtype)
 {
 	dm_free((void *) segtype);
 }
 
 static struct segtype_handler _error_ops = {
-	name:_name,
-	merge_segments:_merge_segments,
+	name:_errseg_name,
+	merge_segments:_errseg_merge_segments,
 #ifdef DEVMAPPER_SUPPORT
-	add_target_line:_add_target_line,
-	target_present:_target_present,
+	add_target_line:_errseg_add_target_line,
+	target_present:_errseg_target_present,
 #endif
-	destroy:_destroy,
+	destroy:_errseg_destroy,
 };
 
 struct segment_type *init_error_segtype(struct cmd_context *cmd)

Modified: lvm2/trunk/lib/filters/filter-composite.c
==============================================================================
--- lvm2/trunk/lib/filters/filter-composite.c	(original)
+++ lvm2/trunk/lib/filters/filter-composite.c	Fri May  5 20:27:43 2006
@@ -33,7 +33,7 @@
 	return 1;
 }
 
-static void _destroy(struct dev_filter *f)
+static void _composite_destroy(struct dev_filter *f)
 {
 	struct dev_filter **filters = (struct dev_filter **) f->private;
 
@@ -70,7 +70,7 @@
 	}
 
 	cft->passes_filter = _and_p;
-	cft->destroy = _destroy;
+	cft->destroy = _composite_destroy;
 	cft->private = filters_copy;
 
 	return cft;

Modified: lvm2/trunk/lib/filters/filter-persistent.c
==============================================================================
--- lvm2/trunk/lib/filters/filter-persistent.c	(original)
+++ lvm2/trunk/lib/filters/filter-persistent.c	Fri May  5 20:27:43 2006
@@ -217,7 +217,7 @@
 	return (l == PF_BAD_DEVICE) ? 0 : 1;
 }
 
-static void _destroy(struct dev_filter *f)
+static void _persistent_destroy(struct dev_filter *f)
 {
 	struct pfilter *pf = (struct pfilter *) f->private;
 
@@ -258,7 +258,7 @@
 	}
 
 	f->passes_filter = _lookup_p;
-	f->destroy = _destroy;
+	f->destroy = _persistent_destroy;
 	f->private = pf;
 
 	return f;

Modified: lvm2/trunk/lib/filters/filter-regex.c
==============================================================================
--- lvm2/trunk/lib/filters/filter-regex.c	(original)
+++ lvm2/trunk/lib/filters/filter-regex.c	Fri May  5 20:27:43 2006
@@ -191,7 +191,7 @@
 	return !rejected;
 }
 
-static void _destroy(struct dev_filter *f)
+static void _regex_destroy(struct dev_filter *f)
 {
 	struct rfilter *rf = (struct rfilter *) f->private;
 	dm_pool_destroy(rf->mem);
@@ -226,7 +226,7 @@
 	}
 
 	f->passes_filter = _accept_p;
-	f->destroy = _destroy;
+	f->destroy = _regex_destroy;
 	f->private = rf;
 	return f;
 

Modified: lvm2/trunk/lib/filters/filter-sysfs.c
==============================================================================
--- lvm2/trunk/lib/filters/filter-sysfs.c	(original)
+++ lvm2/trunk/lib/filters/filter-sysfs.c	Fri May  5 20:27:43 2006
@@ -88,7 +88,7 @@
 	return ds;
 }
 
-static inline unsigned _hash_dev(dev_t dev)
+static unsigned _hash_dev(dev_t dev)
 {
 	return (major(dev) ^ minor(dev)) & (SET_BUCKETS - 1);
 }

Modified: lvm2/trunk/lib/format1/disk-rep.c
==============================================================================
--- lvm2/trunk/lib/format1/disk-rep.c	(original)
+++ lvm2/trunk/lib/format1/disk-rep.c	Fri May  5 20:27:43 2006
@@ -223,11 +223,11 @@
 	return 1;
 }
 
-static int _read_vgd(struct disk_list *data)
+int read_vgd(struct device *dev, struct vg_disk *vgd, struct pv_disk *pvd)
 {
-	struct vg_disk *vgd = &data->vgd;
-	uint64_t pos = data->pvd.vg_on_disk.base;
-	if (!dev_read(data->dev, pos, sizeof(*vgd), vgd))
+	uint64_t pos = pvd->vg_on_disk.base;
+
+	if (!dev_read(dev, pos, sizeof(*vgd), vgd))
 		fail;
 
 	_xlate_vgd(vgd);
@@ -269,7 +269,7 @@
 	return 1;
 }
 
-static inline int _check_lvd(struct lv_disk *lvd)
+static int _check_lvd(struct lv_disk *lvd)
 {
 	return !(lvd->lv_name[0] == '\0');
 }
@@ -319,13 +319,31 @@
 	return 1;
 }
 
+static void __update_lvmcache(const struct format_type *fmt,
+			      struct disk_list *dl,
+			      struct device *dev, const char *vgid,
+			      int exported)
+{
+	struct lvmcache_info *info;
+
+	if (!(info = lvmcache_add(fmt->labeller, dl->pvd.pv_uuid, dev,
+				  dl->pvd.vg_name, vgid,
+				  exported ? EXPORTED_VG : 0))) {
+		stack;
+		return;
+	}
+
+	info->device_size = xlate32(dl->pvd.pv_size) << SECTOR_SHIFT;
+	list_init(&info->mdas);
+	info->status &= ~CACHE_INVALID;
+}
+
 static struct disk_list *__read_disk(const struct format_type *fmt,
 				     struct device *dev, struct dm_pool *mem,
 				     const char *vg_name)
 {
-	struct disk_list *dl = dm_pool_alloc(mem, sizeof(*dl));
+	struct disk_list *dl = dm_pool_zalloc(mem, sizeof(*dl));
 	const char *name = dev_name(dev);
-	struct lvmcache_info *info;
 
 	if (!dl) {
 		stack;
@@ -342,41 +360,32 @@
 		goto bad;
 	}
 
-	if (!(info = lvmcache_add(fmt->labeller, dl->pvd.pv_uuid, dev,
-				  dl->pvd.vg_name, NULL)))
-		stack;
-	else {
-		info->device_size = xlate32(dl->pvd.pv_size) << SECTOR_SHIFT;
-		list_init(&info->mdas);
-		info->status &= ~CACHE_INVALID;
-	}
-
 	/*
 	 * is it an orphan ?
 	 */
 	if (!*dl->pvd.vg_name) {
 		log_very_verbose("%s is not a member of any format1 VG", name);
 
-		/* Update VG cache */
-		/* vgcache_add(dl->pvd.vg_name, NULL, dev, fmt); */
-
+		__update_lvmcache(fmt, dl, dev, NULL, 0);
 		return (vg_name) ? NULL : dl;
 	}
 
-	if (!_read_vgd(dl)) {
+	if (!read_vgd(dl->dev, &dl->vgd, &dl->pvd)) {
 		log_error("Failed to read VG data from PV (%s)", name);
+		__update_lvmcache(fmt, dl, dev, NULL, 0);
 		goto bad;
 	}
 
-	/* Update VG cache with what we found */
-	/* vgcache_add(dl->pvd.vg_name, dl->vgd.vg_uuid, dev, fmt); */
-
 	if (vg_name && strcmp(vg_name, dl->pvd.vg_name)) {
 		log_very_verbose("%s is not a member of the VG %s",
 				 name, vg_name);
+		__update_lvmcache(fmt, dl, dev, NULL, 0);
 		goto bad;
 	}
 
+	__update_lvmcache(fmt, dl, dev, dl->vgd.vg_uuid,
+			  dl->vgd.vg_status & VG_EXPORTED);
+
 	if (!_read_uuids(dl)) {
 		log_error("Failed to read PV uuid list from %s", name);
 		goto bad;
@@ -461,7 +470,7 @@
 	struct lvmcache_info *info;
 
 	/* Fast path if we already saw this VG and cached the list of PVs */
-	if (vg_name && (vginfo = vginfo_from_vgname(vg_name)) &&
+	if (vg_name && (vginfo = vginfo_from_vgname(vg_name, NULL)) &&
 	    vginfo->infos.n) {
 		list_iterate_items(info, &vginfo->infos) {
 			dev = info->dev;

Modified: lvm2/trunk/lib/format1/disk-rep.h
==============================================================================
--- lvm2/trunk/lib/format1/disk-rep.h	(original)
+++ lvm2/trunk/lib/format1/disk-rep.h	Fri May  5 20:27:43 2006
@@ -204,7 +204,8 @@
  */
 int import_pv(struct dm_pool *mem, struct device *dev,
 	      struct volume_group *vg,
-	      struct physical_volume *pv, struct pv_disk *pvd);
+	      struct physical_volume *pv, struct pv_disk *pvd,
+	      struct vg_disk *vgd);
 int export_pv(struct cmd_context *cmd, struct dm_pool *mem,
 	      struct volume_group *vg,
 	      struct pv_disk *pvd, struct physical_volume *pv);
@@ -237,6 +238,7 @@
 
 void export_pv_act(struct list *pvds);
 int munge_pvd(struct device *dev, struct pv_disk *pvd);
+int read_vgd(struct device *dev, struct vg_disk *vgd, struct pv_disk *pvd);
 
 /* blech */
 int get_free_vg_number(struct format_instance *fid, struct dev_filter *filter,

Modified: lvm2/trunk/lib/format1/format1.c
==============================================================================
--- lvm2/trunk/lib/format1/format1.c	(original)
+++ lvm2/trunk/lib/format1/format1.c	Fri May  5 20:27:43 2006
@@ -173,7 +173,7 @@
 	return NULL;
 }
 
-static struct volume_group *_vg_read(struct format_instance *fid,
+static struct volume_group *_format1_vg_read(struct format_instance *fid,
 				     const char *vg_name,
 				     struct metadata_area *mda)
 {
@@ -264,7 +264,7 @@
 	return 1;
 }
 
-static int _vg_write(struct format_instance *fid, struct volume_group *vg,
+static int _format1_vg_write(struct format_instance *fid, struct volume_group *vg,
 		     struct metadata_area *mda)
 {
 	struct dm_pool *mem = dm_pool_create("lvm1 vg_write", 1024 * 10);
@@ -287,7 +287,7 @@
 	return r;
 }
 
-static int _pv_read(const struct format_type *fmt, const char *pv_name,
+static int _format1_pv_read(const struct format_type *fmt, const char *pv_name,
 		    struct physical_volume *pv, struct list *mdas)
 {
 	struct dm_pool *mem = dm_pool_create("lvm1 pv_read", 1024);
@@ -312,7 +312,7 @@
 		goto out;
 	}
 
-	if (!import_pv(fmt->cmd->mem, dl->dev, NULL, pv, &dl->pvd)) {
+	if (!import_pv(fmt->cmd->mem, dl->dev, NULL, pv, &dl->pvd, &dl->vgd)) {
 		stack;
 		goto out;
 	}
@@ -326,7 +326,7 @@
 	return r;
 }
 
-static int _pv_setup(const struct format_type *fmt,
+static int _format1_pv_setup(const struct format_type *fmt,
 		     uint64_t pe_start, uint32_t extent_count,
 		     uint32_t extent_size,
 		     int pvmetadatacopies,
@@ -364,7 +364,7 @@
 	return 1;
 }
 
-static int _lv_setup(struct format_instance *fid, struct logical_volume *lv)
+static int _format1_lv_setup(struct format_instance *fid, struct logical_volume *lv)
 {
 	uint64_t max_size = UINT_MAX;
 
@@ -386,7 +386,7 @@
 	return 1;
 }
 
-static int _pv_write(const struct format_type *fmt, struct physical_volume *pv,
+static int _format1_pv_write(const struct format_type *fmt, struct physical_volume *pv,
 		     struct list *mdas, int64_t sector)
 {
 	struct dm_pool *mem;
@@ -396,7 +396,7 @@
 	struct lvmcache_info *info;
 
 	if (!(info = lvmcache_add(fmt->labeller, (char *) &pv->id, pv->dev,
-				  pv->vg_name, NULL))) {
+				  pv->vg_name, NULL, 0))) {
 		stack;
 		return 0;
 	}
@@ -449,7 +449,7 @@
 	return 0;
 }
 
-static int _vg_setup(struct format_instance *fid, struct volume_group *vg)
+static int _format1_vg_setup(struct format_instance *fid, struct volume_group *vg)
 {
 	/* just check max_pv and max_lv */
 	if (!vg->max_lv || vg->max_lv >= MAX_LV)
@@ -484,7 +484,7 @@
 	return 1;
 }
 
-static int _segtype_supported (struct format_instance *fid, 
+static int _format1_segtype_supported(struct format_instance *fid, 
 			       struct segment_type *segtype)
 {
 	if (!(segtype->flags & SEG_FORMAT1_SUPPORT)) {
@@ -496,12 +496,13 @@
 }
 
 static struct metadata_area_ops _metadata_format1_ops = {
-	vg_read:_vg_read,
-	vg_write:_vg_write,
+	vg_read:_format1_vg_read,
+	vg_write:_format1_vg_write,
 };
 
-static struct format_instance *_create_instance(const struct format_type *fmt,
+static struct format_instance *_format1_create_instance(const struct format_type *fmt,
 						const char *vgname,
+						const char *vgid,
 						void *private)
 {
 	struct format_instance *fid;
@@ -529,26 +530,26 @@
 	return fid;
 }
 
-static void _destroy_instance(struct format_instance *fid)
+static void _format1_destroy_instance(struct format_instance *fid)
 {
 	return;
 }
 
-static void _destroy(const struct format_type *fmt)
+static void _format1_destroy(const struct format_type *fmt)
 {
 	dm_free((void *) fmt);
 }
 
 static struct format_handler _format1_ops = {
-	pv_read:_pv_read,
-	pv_setup:_pv_setup,
-	pv_write:_pv_write,
-	lv_setup:_lv_setup,
-	vg_setup:_vg_setup,
-	segtype_supported:_segtype_supported,
-	create_instance:_create_instance,
-	destroy_instance:_destroy_instance,
-	destroy:_destroy,
+	pv_read:_format1_pv_read,
+	pv_setup:_format1_pv_setup,
+	pv_write:_format1_pv_write,
+	lv_setup:_format1_lv_setup,
+	vg_setup:_format1_vg_setup,
+	segtype_supported:_format1_segtype_supported,
+	create_instance:_format1_create_instance,
+	destroy_instance:_format1_destroy_instance,
+	destroy:_format1_destroy,
 };
 
 #ifdef LVM1_INTERNAL

Modified: lvm2/trunk/lib/format1/import-export.c
==============================================================================
--- lvm2/trunk/lib/format1/import-export.c	(original)
+++ lvm2/trunk/lib/format1/import-export.c	Fri May  5 20:27:43 2006
@@ -49,7 +49,8 @@
 
 int import_pv(struct dm_pool *mem, struct device *dev,
 	      struct volume_group *vg,
-	      struct physical_volume *pv, struct pv_disk *pvd)
+	      struct physical_volume *pv, struct pv_disk *pvd,
+	      struct vg_disk *vgd)
 {
 	memset(pv, 0, sizeof(*pv));
 	memcpy(&pv->id, pvd->pv_uuid, ID_LEN);
@@ -60,6 +61,8 @@
 		return 0;
 	}
 
+	memcpy(&pv->vgid, vgd->vg_uuid, sizeof(vg->id));
+
 	/* Store system_id from first PV if PV belongs to a VG */
 	if (vg && !*vg->system_id)
 		strncpy(vg->system_id, pvd->system_id, NAME_LEN);
@@ -426,7 +429,7 @@
 			return 0;
 		}
 
-		if (!import_pv(mem, dl->dev, vg, pvl->pv, &dl->pvd)) {
+		if (!import_pv(mem, dl->dev, vg, pvl->pv, &dl->pvd, &dl->vgd)) {
 			stack;
 			return 0;
 		}

Modified: lvm2/trunk/lib/format1/layout.c
==============================================================================
--- lvm2/trunk/lib/format1/layout.c	(original)
+++ lvm2/trunk/lib/format1/layout.c	Fri May  5 20:27:43 2006
@@ -19,16 +19,18 @@
 /*
  * Only works with powers of 2.
  */
-static inline uint32_t _round_up(uint32_t n, uint32_t size)
+static uint32_t _round_up(uint32_t n, uint32_t size)
 {
 	size--;
 	return (n + size) & ~size;
 }
 
-static inline uint32_t _div_up(uint32_t n, uint32_t size)
+/* Unused.
+static uint32_t _div_up(uint32_t n, uint32_t size)
 {
 	return _round_up(n, size) / size;
 }
+*/
 
 /*
  * Each chunk of metadata should be aligned to

Modified: lvm2/trunk/lib/format1/lvm1-label.c
==============================================================================
--- lvm2/trunk/lib/format1/lvm1-label.c	(original)
+++ lvm2/trunk/lib/format1/lvm1-label.c	Fri May  5 20:27:43 2006
@@ -30,7 +30,7 @@
 		op);
 }
 
-static int _can_handle(struct labeller *l, char *buf, uint64_t sector)
+static int _lvm1_can_handle(struct labeller *l, char *buf, uint64_t sector)
 {
 	struct pv_disk *pvd = (struct pv_disk *) buf;
 	uint32_t version;
@@ -48,21 +48,30 @@
 	return 0;
 }
 
-static int _write(struct label *label, char *buf)
+static int _lvm1_write(struct label *label, char *buf)
 {
 	_not_supported("write");
 	return 0;
 }
 
-static int _read(struct labeller *l, struct device *dev, char *buf,
+static int _lvm1_read(struct labeller *l, struct device *dev, char *buf,
 		 struct label **label)
 {
 	struct pv_disk *pvd = (struct pv_disk *) buf;
+	struct vg_disk vgd;
 	struct lvmcache_info *info;
+	const char *vgid = NULL;
+	int exported = 0;
 
 	munge_pvd(dev, pvd);
 
-	if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL))) {
+	if (*pvd->vg_name && read_vgd(dev, &vgd, pvd)) {
+		vgid = vgd.vg_uuid;
+		exported = pvd->pv_status & VG_EXPORTED;
+	}
+
+	if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, vgid,
+				  exported))) {
 		stack;
 		return 0;
 	}
@@ -76,31 +85,31 @@
 	return 1;
 }
 
-static int _initialise_label(struct labeller *l, struct label *label)
+static int _lvm1_initialise_label(struct labeller *l, struct label *label)
 {
 	strcpy(label->type, "LVM1");
 
 	return 1;
 }
 
-static void _destroy_label(struct labeller *l, struct label *label)
+static void _lvm1_destroy_label(struct labeller *l, struct label *label)
 {
 	return;
 }
 
-static void _destroy(struct labeller *l)
+static void _lvm1_destroy(struct labeller *l)
 {
 	dm_free(l);
 }
 
 struct label_ops _lvm1_ops = {
-	can_handle:_can_handle,
-	write:_write,
-	read:_read,
-	verify:_can_handle,
-	initialise_label:_initialise_label,
-	destroy_label:_destroy_label,
-	destroy:_destroy
+	can_handle:_lvm1_can_handle,
+	write:_lvm1_write,
+	read:_lvm1_read,
+	verify:_lvm1_can_handle,
+	initialise_label:_lvm1_initialise_label,
+	destroy_label:_lvm1_destroy_label,
+	destroy:_lvm1_destroy
 };
 
 struct labeller *lvm1_labeller_create(struct format_type *fmt)

Modified: lvm2/trunk/lib/format_pool/disk_rep.c
==============================================================================
--- lvm2/trunk/lib/format_pool/disk_rep.c	(original)
+++ lvm2/trunk/lib/format_pool/disk_rep.c	Fri May  5 20:27:43 2006
@@ -98,7 +98,7 @@
 	log_debug("Calculated uuid %s for %s", uuid, pd->pl_pool_name);
 
 	if (!(info = lvmcache_add(l, (char *) &pvid, dev, pd->pl_pool_name,
-				  (char *) &vgid))) {
+				  (char *) &vgid, 0))) {
 		stack;
 		return 0;
 	}
@@ -314,7 +314,7 @@
 		/*
 		 * If the cache scanning doesn't work, this will never work
 		 */
-		if (vg_name && (vginfo = vginfo_from_vgname(vg_name)) &&
+		if (vg_name && (vginfo = vginfo_from_vgname(vg_name, NULL)) &&
 		    vginfo->infos.n) {
 
 			if (_read_vg_pds(fmt, mem, vginfo, pdhead, &totaldevs)) {

Modified: lvm2/trunk/lib/format_pool/format_pool.c
==============================================================================
--- lvm2/trunk/lib/format_pool/format_pool.c	(original)
+++ lvm2/trunk/lib/format_pool/format_pool.c	Fri May  5 20:27:43 2006
@@ -169,7 +169,7 @@
 	return vg;
 }
 
-static struct volume_group *_vg_read(struct format_instance *fid,
+static struct volume_group *_pool_vg_read(struct format_instance *fid,
 				     const char *vg_name,
 				     struct metadata_area *mda)
 {
@@ -206,7 +206,7 @@
 	return vg;
 }
 
-static int _pv_setup(const struct format_type *fmt,
+static int _pool_pv_setup(const struct format_type *fmt,
 		     uint64_t pe_start, uint32_t extent_count,
 		     uint32_t extent_size,
 		     int pvmetadatacopies,
@@ -216,7 +216,7 @@
 	return 1;
 }
 
-static int _pv_read(const struct format_type *fmt, const char *pv_name,
+static int _pool_pv_read(const struct format_type *fmt, const char *pv_name,
 		    struct physical_volume *pv, struct list *mdas)
 {
 	struct dm_pool *mem = dm_pool_create("pool pv_read", 1024);
@@ -262,12 +262,13 @@
 
 /* *INDENT-OFF* */
 static struct metadata_area_ops _metadata_format_pool_ops = {
-	vg_read:_vg_read,
+	vg_read:_pool_vg_read,
 };
 /* *INDENT-ON* */
 
-static struct format_instance *_create_instance(const struct format_type *fmt,
+static struct format_instance *_pool_create_instance(const struct format_type *fmt,
 						const char *vgname,
+						const char *vgid,
 						void *private)
 {
 	struct format_instance *fid;
@@ -297,23 +298,23 @@
 	return fid;
 }
 
-static void _destroy_instance(struct format_instance *fid)
+static void _pool_destroy_instance(struct format_instance *fid)
 {
 	return;
 }
 
-static void _destroy(const struct format_type *fmt)
+static void _pool_destroy(const struct format_type *fmt)
 {
 	dm_free((void *) fmt);
 }
 
 /* *INDENT-OFF* */
 static struct format_handler _format_pool_ops = {
-	pv_read:_pv_read,
-	pv_setup:_pv_setup,
-	create_instance:_create_instance,
-	destroy_instance:_destroy_instance,
-	destroy:_destroy,
+	pv_read:_pool_pv_read,
+	pv_setup:_pool_pv_setup,
+	create_instance:_pool_create_instance,
+	destroy_instance:_pool_destroy_instance,
+	destroy:_pool_destroy,
 };
 /* *INDENT-ON */
 

Modified: lvm2/trunk/lib/format_pool/import_export.c
==============================================================================
--- lvm2/trunk/lib/format_pool/import_export.c	(original)
+++ lvm2/trunk/lib/format_pool/import_export.c	Fri May  5 20:27:43 2006
@@ -165,6 +165,7 @@
 		log_error("Unable to duplicate vg_name string");
 		return 0;
 	}
+	memcpy(&pv->vgid, &vg->id, sizeof(vg->id));
 	pv->status = 0;
 	pv->size = pd->pl_blocks;
 	pv->pe_size = POOL_PE_SIZE;

Modified: lvm2/trunk/lib/format_pool/pool_label.c
==============================================================================
--- lvm2/trunk/lib/format_pool/pool_label.c	(original)
+++ lvm2/trunk/lib/format_pool/pool_label.c	Fri May  5 20:27:43 2006
@@ -23,13 +23,13 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-static void _not_supported(const char *op)
+static void _pool_not_supported(const char *op)
 {
 	log_error("The '%s' operation is not supported for the pool labeller.",
 		  op);
 }
 
-static int _can_handle(struct labeller *l, char *buf, uint64_t sector)
+static int _pool_can_handle(struct labeller *l, char *buf, uint64_t sector)
 {
 
 	struct pool_disk pd;
@@ -50,13 +50,13 @@
 	return 0;
 }
 
-static int _write(struct label *label, char *buf)
+static int _pool_write(struct label *label, char *buf)
 {
-	_not_supported("write");
+	_pool_not_supported("write");
 	return 0;
 }
 
-static int _read(struct labeller *l, struct device *dev, char *buf,
+static int _pool_read(struct labeller *l, struct device *dev, char *buf,
 		 struct label **label)
 {
 	struct pool_list pl;
@@ -64,31 +64,31 @@
 	return read_pool_label(&pl, l, dev, buf, label);
 }
 
-static int _initialise_label(struct labeller *l, struct label *label)
+static int _pool_initialise_label(struct labeller *l, struct label *label)
 {
 	strcpy(label->type, "POOL");
 
 	return 1;
 }
 
-static void _destroy_label(struct labeller *l, struct label *label)
+static void _pool_destroy_label(struct labeller *l, struct label *label)
 {
 	return;
 }
 
-static void _destroy(struct labeller *l)
+static void _label_pool_destroy(struct labeller *l)
 {
 	dm_free(l);
 }
 
 struct label_ops _pool_ops = {
-      can_handle:_can_handle,
-      write:_write,
-      read:_read,
-      verify:_can_handle,
-      initialise_label:_initialise_label,
-      destroy_label:_destroy_label,
-      destroy:_destroy
+      can_handle:_pool_can_handle,
+      write:_pool_write,
+      read:_pool_read,
+      verify:_pool_can_handle,
+      initialise_label:_pool_initialise_label,
+      destroy_label:_pool_destroy_label,
+      destroy:_label_pool_destroy
 };
 
 struct labeller *pool_labeller_create(struct format_type *fmt)

Modified: lvm2/trunk/lib/format_text/archive.c
==============================================================================
--- lvm2/trunk/lib/format_text/archive.c	(original)
+++ lvm2/trunk/lib/format_text/archive.c	Fri May  5 20:27:43 2006
@@ -87,7 +87,7 @@
 	return 1;
 }
 
-static void _insert_file(struct list *head, struct archive_file *b)
+static void _insert_archive_file(struct list *head, struct archive_file *b)
 {
 	struct archive_file *bf = NULL;
 
@@ -107,7 +107,7 @@
 	list_add_h(&bf->list, &b->list);
 }
 
-static char *_join(struct dm_pool *mem, const char *dir, const char *name)
+static char *_join_file_to_dir(struct dm_pool *mem, const char *dir, const char *name)
 {
 	if (!dm_pool_begin_object(mem, 32) ||
 	    !dm_pool_grow_object(mem, dir, strlen(dir)) ||
@@ -161,7 +161,7 @@
 		if (strcmp(vgname, vgname_found))
 			continue;
 
-		if (!(path = _join(mem, dir, dirent[i]->d_name))) {
+		if (!(path = _join_file_to_dir(mem, dir, dirent[i]->d_name))) {
 			stack;
 			goto out;
 		}
@@ -181,7 +181,7 @@
 		/*
 		 * Insert it to the correct part of the list.
 		 */
-		_insert_file(results, af);
+		_insert_archive_file(results, af);
 	}
 
       out:
@@ -207,8 +207,8 @@
 	/* Convert retain_days into the time after which we must retain */
 	retain_time = time(NULL) - (time_t) retain_days *SECS_PER_DAY;
 
-	/* Assume list is ordered oldest first (by index) */
-	list_iterate_items(bf, archives) {
+	/* Assume list is ordered newest first (by index) */
+	list_iterate_back_items(bf, archives) {
 		/* Get the mtime of the file and unlink if too old */
 		if (stat(bf->path, &sb)) {
 			log_sys_error("stat", bf->path);
@@ -311,7 +311,7 @@
 
 	if (!(context = create_text_context(cmd, af->path, NULL)) ||
 	    !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, NULL,
-							 context))) {
+							 NULL, context))) {
 		log_error("Couldn't create text instance object.");
 		return;
 	}
@@ -360,7 +360,7 @@
 {
 	struct archive_file af;
 
-	if (!(af.path = _join(cmd->mem, dir, vgname))) {
+	if (!(af.path = _join_file_to_dir(cmd->mem, dir, vgname))) {
 		stack;
 		return 0;
 	}

Modified: lvm2/trunk/lib/format_text/archiver.c
==============================================================================
--- lvm2/trunk/lib/format_text/archiver.c	(original)
+++ lvm2/trunk/lib/format_text/archiver.c	Fri May  5 20:27:43 2006
@@ -257,7 +257,7 @@
 	if (!(context = create_text_context(cmd, file,
 					    cmd->cmd_line)) ||
 	    !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, NULL,
-							 context))) {
+							 NULL, context))) {
 		log_error("Couldn't create text format object.");
 		return NULL;
 	}
@@ -286,7 +286,7 @@
 
 	/* Attempt to write out using currently active format */
 	if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, vg->name,
-						       NULL))) {
+						       NULL, NULL))) {
 		log_error("Failed to allocate format instance");
 		return 0;
 	}
@@ -365,7 +365,7 @@
 
 	if (!(context = create_text_context(cmd, file, desc)) ||
 	    !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, NULL,
-							 context))) {
+							 NULL, context))) {
 		log_error("Couldn't create backup object.");
 		return 0;
 	}

Modified: lvm2/trunk/lib/format_text/export.c
==============================================================================
--- lvm2/trunk/lib/format_text/export.c	(original)
+++ lvm2/trunk/lib/format_text/export.c	Fri May  5 20:27:43 2006
@@ -354,8 +354,7 @@
  * Get the pv%d name from the formatters hash
  * table.
  */
-static inline const char *_get_pv_name(struct formatter *f,
-				       struct physical_volume *pv)
+static const char *_get_pv_name(struct formatter *f, struct physical_volume *pv)
 {
 	return (pv) ? (const char *)
 	    dm_hash_lookup(f->pv_names, dev_name(pv->dev)) : "Missing";

Modified: lvm2/trunk/lib/format_text/format-text.c
==============================================================================
--- lvm2/trunk/lib/format_text/format-text.c	(original)
+++ lvm2/trunk/lib/format_text/format-text.c	Fri May  5 20:27:43 2006
@@ -39,8 +39,9 @@
 #define FMT_TEXT_NAME "lvm2"
 #define FMT_TEXT_ALIAS "text"
 
-static struct format_instance *_create_text_instance(const struct format_type
+static struct format_instance *_text_create_text_instance(const struct format_type
 						     *fmt, const char *vgname,
+						     const char *vgid,
 						     void *context);
 
 struct text_fid_context {
@@ -68,7 +69,7 @@
  * NOTE: Currently there can be only one vg per text file.
  */
 
-static int _vg_setup(struct format_instance *fid, struct volume_group *vg)
+static int _text_vg_setup(struct format_instance *fid, struct volume_group *vg)
 {
 	if (vg->extent_size & (vg->extent_size - 1)) {
 		log_error("Extent size must be power of 2");
@@ -78,7 +79,7 @@
 	return 1;
 }
 
-static int _lv_setup(struct format_instance *fid, struct logical_volume *lv)
+static int _text_lv_setup(struct format_instance *fid, struct logical_volume *lv)
 {
 /******** FIXME Any LV size restriction? 
 	uint64_t max_size = UINT_MAX;
@@ -219,7 +220,7 @@
 
       error:
 	if ((info = info_from_pvid(dev_area->dev->pvid)))
-		lvmcache_update_vgname(info, ORPHAN);
+		lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN, 0, NULL);
 
 	return NULL;
 }
@@ -858,9 +859,11 @@
 				}
 
 				/* FIXME stat file to see if it's changed */
-				fid = _create_text_instance(fmt, NULL, NULL);
+				fid = _text_create_text_instance(fmt, NULL, NULL,
+							    NULL);
 				if ((vg = _vg_read_file_name(fid, vgname,
 							     path)))
+					/* FIXME Store creation host in vg */
 					lvmcache_update_vg(vg);
 			}
 
@@ -871,65 +874,99 @@
 	return 1;
 }
 
-int vgname_from_mda(const struct format_type *fmt, struct device_area *dev_area,
-		    char *buf, uint32_t size)
+const char *vgname_from_mda(const struct format_type *fmt,
+			    struct device_area *dev_area, struct id *vgid,
+			    uint32_t *vgstatus, char **creation_host)
 {
 	struct raw_locn *rlocn;
 	struct mda_header *mdah;
-	unsigned int len;
-	int r = 0;
+	uint32_t wrap = 0;
+	const char *vgname = NULL;
+	unsigned int len = 0;
+	char buf[NAME_LEN + 1];
+        char uuid[64];
 
 	if (!dev_open(dev_area->dev)) {
 		stack;
-		return 0;
+		return NULL;
 	}
 
-	if (!(mdah = _raw_read_mda_header(fmt, dev_area))) {
-		stack;
-		goto out;
-	}
+	if (!(mdah = _raw_read_mda_header(fmt, dev_area)))
+		goto_out;
 
+	/* FIXME Cope with returning a list */
 	rlocn = mdah->raw_locns;
 
-	while (rlocn->offset) {
-		if (!dev_read(dev_area->dev, dev_area->start + rlocn->offset,
-			      size, buf)) {
-			stack;
-			goto out;
-		}
-		len = 0;
-		while (buf[len] && !isspace(buf[len]) && buf[len] != '{' &&
-		       len < (size - 1))
-			len++;
-		buf[len] = '\0';
+	/* Do quick check for a vgname */
+	if (!dev_read(dev_area->dev, dev_area->start + rlocn->offset,
+		      NAME_LEN, buf))
+		goto_out;
 
-		/* Ignore this entry if the characters aren't permissible */
-		if (!validate_name(buf)) {
-			stack;
-			goto out;
-		}
+	while (buf[len] && !isspace(buf[len]) && buf[len] != '{' &&
+	       len < (NAME_LEN - 1))
+		len++;
 
-		r = 1;
-		break;
+	buf[len] = '\0';
 
-		/* FIXME Cope with returning a list */
-		rlocn++;
+	/* Ignore this entry if the characters aren't permissible */
+	if (!validate_name(buf))
+		goto_out;
+
+	/* We found a VG - now check the metadata */
+	if (rlocn->offset + rlocn->size > mdah->size)
+		wrap = (uint32_t) ((rlocn->offset + rlocn->size) - mdah->size);
+
+	if (wrap > rlocn->offset) {
+		log_error("%s: metadata too large for circular buffer",
+			  dev_name(dev_area->dev));
+		goto out;
+	}
+
+	/* FIXME 64-bit */
+	if (!(vgname = text_vgname_import(fmt, dev_area->dev,
+					  (off_t) (dev_area->start +
+						   rlocn->offset),
+					  (uint32_t) (rlocn->size - wrap),
+					  (off_t) (dev_area->start +
+						   MDA_HEADER_SIZE),
+					  wrap, calc_crc, rlocn->checksum,
+					  vgid, vgstatus, creation_host)))
+		goto_out;
+
+	/* Ignore this entry if the characters aren't permissible */
+	if (!validate_name(vgname)) {
+		stack;
+		vgname = NULL;
+		goto out;
+	}
+
+	if (!id_write_format(vgid, uuid, sizeof(uuid))) {
+		stack;
+		vgname = NULL;
+		goto out;
 	}
 
+	log_debug("%s: Found metadata at %" PRIu64 " size %" PRIu64
+		  " for %s (%s)", 
+		  dev_name(dev_area->dev), dev_area->start + rlocn->offset,
+		  rlocn->size, vgname, uuid);
+
       out:
 	if (!dev_close(dev_area->dev))
 		stack;
 
-	return r;
+	return vgname;
 }
 
 static int _scan_raw(const struct format_type *fmt)
 {
 	struct raw_list *rl;
 	struct list *raw_list;
-	char vgnamebuf[NAME_LEN + 2];
+	const char *vgname;
 	struct volume_group *vg;
 	struct format_instance fid;
+	struct id vgid;
+	uint32_t vgstatus;
 
 	raw_list = &((struct mda_lists *) fmt->private)->raws;
 
@@ -938,9 +975,9 @@
 
 	list_iterate_items(rl, raw_list) {
 		/* FIXME We're reading mdah twice here... */
-		if (vgname_from_mda(fmt, &rl->dev_area, vgnamebuf,
-				    sizeof(vgnamebuf))) {
-			if ((vg = _vg_read_raw_area(&fid, vgnamebuf,
+		if ((vgname = vgname_from_mda(fmt, &rl->dev_area, &vgid, &vgstatus,
+					      NULL))) {
+			if ((vg = _vg_read_raw_area(&fid, vgname,
 						    &rl->dev_area, 0)))
 				lvmcache_update_vg(vg);
 		}
@@ -949,7 +986,7 @@
 	return 1;
 }
 
-static int _scan(const struct format_type *fmt)
+static int _text_scan(const struct format_type *fmt)
 {
 	return (_scan_file(fmt) & _scan_raw(fmt));
 }
@@ -1095,7 +1132,7 @@
 
 /* Only for orphans */
 /* Set label_sector to -1 if rewriting existing label into same sector */
-static int _pv_write(const struct format_type *fmt, struct physical_volume *pv,
+static int _text_pv_write(const struct format_type *fmt, struct physical_volume *pv,
 		     struct list *mdas, int64_t label_sector)
 {
 	struct label *label;
@@ -1109,7 +1146,7 @@
 	/* FIXME Test mode don't update cache? */
 
 	if (!(info = lvmcache_add(fmt->labeller, (char *) &pv->id, pv->dev,
-				  ORPHAN, NULL))) {
+				  ORPHAN, NULL, 0))) {
 		stack;
 		return 0;
 	}
@@ -1220,7 +1257,7 @@
 	return 1;
 }
 
-static int _pv_read(const struct format_type *fmt, const char *pv_name,
+static int _text_pv_read(const struct format_type *fmt, const char *pv_name,
 		    struct physical_volume *pv, struct list *mdas)
 {
 	struct label *label;
@@ -1245,7 +1282,7 @@
 	/* Have we already cached vgname? */
 	if (info->vginfo && info->vginfo->vgname && *info->vginfo->vgname &&
 	    get_pv_from_vg_by_id(info->fmt, info->vginfo->vgname,
-				 info->dev->pvid, pv)) {
+				 info->vginfo->vgid, info->dev->pvid, pv)) {
 		return 1;
 	}
 
@@ -1256,6 +1293,7 @@
 		if (info->vginfo && info->vginfo->vgname &&
 		    *info->vginfo->vgname &&
 		    get_pv_from_vg_by_id(info->fmt, info->vginfo->vgname,
+					 info->vginfo->vgid,
 					 info->dev->pvid, pv)) {
 			return 1;
 		}
@@ -1301,7 +1339,7 @@
 	return 1;
 }
 
-static void _destroy_instance(struct format_instance *fid)
+static void _text_destroy_instance(struct format_instance *fid)
 {
 	return;
 }
@@ -1326,7 +1364,7 @@
 	}
 }
 
-static void _destroy(const struct format_type *fmt)
+static void _text_destroy(const struct format_type *fmt)
 {
 	if (fmt->private) {
 		_free_dirs(&((struct mda_lists *) fmt->private)->dirs);
@@ -1363,7 +1401,7 @@
 };
 
 /* pvmetadatasize in sectors */
-static int _pv_setup(const struct format_type *fmt,
+static int _text_pv_setup(const struct format_type *fmt,
 		     uint64_t pe_start, uint32_t extent_count,
 		     uint32_t extent_size,
 		     int pvmetadatacopies,
@@ -1380,7 +1418,7 @@
 	/* FIXME if vg, adjust start/end of pe area to avoid mdas! */
 
 	/* FIXME Cope with pvchange */
-	/* FIXME Merge code with _create_text_instance */
+	/* FIXME Merge code with _text_create_text_instance */
 
 	/* If new vg, add any further mdas on this PV to the fid's mda list */
 	if (vg) {
@@ -1448,8 +1486,9 @@
 }
 
 /* NULL vgname means use only the supplied context e.g. an archive file */
-static struct format_instance *_create_text_instance(const struct format_type
+static struct format_instance *_text_create_text_instance(const struct format_type
 						     *fmt, const char *vgname,
+						     const char *vgid,
 						     void *context)
 {
 	struct format_instance *fid;
@@ -1535,7 +1574,7 @@
 
 		/* Scan PVs in VG for any further MDAs */
 		lvmcache_label_scan(fmt->cmd, 0);
-		if (!(vginfo = vginfo_from_vgname(vgname))) {
+		if (!(vginfo = vginfo_from_vgname(vgname, vgid))) {
 			stack;
 			goto out;
 		}
@@ -1569,7 +1608,6 @@
 
       out:
 	return fid;
-
 }
 
 void *create_text_context(struct cmd_context *cmd, const char *path,
@@ -1618,15 +1656,15 @@
 }
 
 static struct format_handler _text_handler = {
-	scan:_scan,
-	pv_read:_pv_read,
-	pv_setup:_pv_setup,
-	pv_write:_pv_write,
-	vg_setup:_vg_setup,
-	lv_setup:_lv_setup,
-	create_instance:_create_text_instance,
-	destroy_instance:_destroy_instance,
-	destroy:_destroy
+	scan:_text_scan,
+	pv_read:_text_pv_read,
+	pv_setup:_text_pv_setup,
+	pv_write:_text_pv_write,
+	vg_setup:_text_vg_setup,
+	lv_setup:_text_lv_setup,
+	create_instance:_text_create_text_instance,
+	destroy_instance:_text_destroy_instance,
+	destroy:_text_destroy
 };
 
 static int _add_dir(const char *dir, struct list *dir_list)

Modified: lvm2/trunk/lib/format_text/format-text.h
==============================================================================
--- lvm2/trunk/lib/format_text/format-text.h	(original)
+++ lvm2/trunk/lib/format_text/format-text.h	Fri May  5 20:27:43 2006
@@ -54,7 +54,8 @@
 	    struct device *dev, uint64_t start, uint64_t size);
 void del_mdas(struct list *mdas);
 
-int vgname_from_mda(const struct format_type *fmt, struct device_area *dev_area,
-		    char *buf, uint32_t size);
+const char *vgname_from_mda(const struct format_type *fmt,
+			    struct device_area *dev_area, struct id *vgid,
+			    uint32_t *vgstatus, char **creation_host);
 
 #endif

Modified: lvm2/trunk/lib/format_text/import-export.h
==============================================================================
--- lvm2/trunk/lib/format_text/import-export.h	(original)
+++ lvm2/trunk/lib/format_text/import-export.h	Fri May  5 20:27:43 2006
@@ -47,6 +47,10 @@
 					 struct config_tree * cf);
 	void (*read_desc) (struct dm_pool * mem, struct config_tree * cf,
 			   time_t *when, char **desc);
+	const char *(*read_vgname) (const struct format_type *fmt,
+				    struct config_tree *cft,
+				    struct id *vgid, uint32_t *vgstatus,
+				    char **creation_host);
 };
 
 struct text_vg_version_ops *text_vg_vsn1_init(void);
@@ -70,5 +74,12 @@
 				       checksum_fn_t checksum_fn,
 				       uint32_t checksum,
 				       time_t *when, char **desc);
+const char *text_vgname_import(const struct format_type *fmt,
+			       struct device *dev,
+                               off_t offset, uint32_t size,
+                               off_t offset2, uint32_t size2,
+                               checksum_fn_t checksum_fn, uint32_t checksum,
+                               struct id *vgid, uint32_t *vgstatus,
+			       char **creation_host);
 
 #endif

Modified: lvm2/trunk/lib/format_text/import.c
==============================================================================
--- lvm2/trunk/lib/format_text/import.c	(original)
+++ lvm2/trunk/lib/format_text/import.c	Fri May  5 20:27:43 2006
@@ -23,6 +23,53 @@
 /* FIXME Use tidier inclusion method */
 static struct text_vg_version_ops *(_text_vsn_list[2]);
 
+const char *text_vgname_import(const struct format_type *fmt,
+			       struct device *dev,
+			       off_t offset, uint32_t size,
+			       off_t offset2, uint32_t size2,
+			       checksum_fn_t checksum_fn, uint32_t checksum,
+			       struct id *vgid, uint32_t *vgstatus,
+			       char **creation_host)
+{
+	struct config_tree *cft;
+	struct text_vg_version_ops **vsn;
+	const char *vgname;
+
+	static int _text_import_initialised = 0;
+
+	if (!_text_import_initialised) {
+		_text_vsn_list[0] = text_vg_vsn1_init();
+		_text_vsn_list[1] = NULL;
+		_text_import_initialised = 1;
+	}
+
+	if (!(cft = create_config_tree(NULL)))
+		goto_out;
+
+	if ((!dev && !read_config_file(cft)) ||
+	    (dev && !read_config_fd(cft, dev, offset, size,
+				    offset2, size2, checksum_fn, checksum)))
+		goto_out;
+
+	/* 
+	 * Find a set of version functions that can read this file
+	 */
+	for (vsn = &_text_vsn_list[0]; *vsn; vsn++) {
+		if (!(*vsn)->check_version(cft))
+			continue;
+
+		if (!(vgname = (*vsn)->read_vgname(fmt, cft, vgid, vgstatus,
+						   creation_host)))
+			goto_out;
+
+		break;
+	}
+
+      out:
+	destroy_config_tree(cft);
+	return vgname;
+}
+
 struct volume_group *text_vg_import_fd(struct format_instance *fid,
 				       const char *file,
 				       struct device *dev,
@@ -36,12 +83,12 @@
 	struct config_tree *cft;
 	struct text_vg_version_ops **vsn;
 
-	static int _initialised = 0;
+	static int _text_vg_import_initialised = 0;
 
-	if (!_initialised) {
+	if (!_text_vg_import_initialised) {
 		_text_vsn_list[0] = text_vg_vsn1_init();
 		_text_vsn_list[1] = NULL;
-		_initialised = 1;
+		_text_vg_import_initialised = 1;
 	}
 
 	*desc = NULL;

Modified: lvm2/trunk/lib/format_text/import_vsn1.c
==============================================================================
--- lvm2/trunk/lib/format_text/import_vsn1.c	(original)
+++ lvm2/trunk/lib/format_text/import_vsn1.c	Fri May  5 20:27:43 2006
@@ -167,6 +167,8 @@
 		return 0;
 	}
 
+	memcpy(&pv->vgid, &vg->id, sizeof(vg->id));
+
 	if (!(cn = find_config_node(pvn, "status"))) {
 		log_error("Couldn't find status flags for physical volume.");
 		return 0;
@@ -798,10 +800,59 @@
 	*when = u;
 }
 
+static const char *_read_vgname(const struct format_type *fmt,
+				struct config_tree *cft, struct id *vgid,
+				uint32_t *vgstatus, char **creation_host)
+{
+	struct config_node *vgn, *cn;
+	struct dm_pool *mem = fmt->cmd->mem;
+	char *vgname;
+	int old_suppress;
+
+	old_suppress = log_suppress(2);
+	*creation_host = dm_pool_strdup(mem,
+					find_config_str(cft->root,
+						        "creation_host", ""));
+	log_suppress(old_suppress);
+
+	/* skip any top-level values */
+	for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib) ;
+
+	if (!vgn) {
+		log_error("Couldn't find volume group in file.");
+		return 0;
+	}
+
+	if (!(vgname = dm_pool_strdup(mem, vgn->key)))
+		return_0;
+
+	vgn = vgn->child;
+
+	if (!_read_id(vgid, vgn, "id")) {
+		log_error("Couldn't read uuid for volume group %s.", vgname);
+		return 0;
+	}
+
+	if (!(cn = find_config_node(vgn, "status"))) {
+		log_error("Couldn't find status flags for volume group %s.",
+			  vgname);
+		return 0;
+	}
+
+	if (!(read_flags(vgstatus, VG_FLAGS, cn->v))) {
+		log_error("Couldn't read status flags for volume group %s.",
+			  vgname);
+		return 0;
+	}
+
+	return vgname;
+}
+
 static struct text_vg_version_ops _vsn1_ops = {
 	check_version:_check_version,
 	read_vg:_read_vg,
-	read_desc:_read_desc
+	read_desc:_read_desc,
+	read_vgname:_read_vgname
 };
 
 struct text_vg_version_ops *text_vg_vsn1_init(void)

Modified: lvm2/trunk/lib/format_text/text_label.c
==============================================================================
--- lvm2/trunk/lib/format_text/text_label.c	(original)
+++ lvm2/trunk/lib/format_text/text_label.c	Fri May  5 20:27:43 2006
@@ -23,7 +23,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-static int _can_handle(struct labeller *l, char *buf, uint64_t sector)
+static int _text_can_handle(struct labeller *l, char *buf, uint64_t sector)
 {
 	struct label_header *lh = (struct label_header *) buf;
 
@@ -33,7 +33,7 @@
 	return 0;
 }
 
-static int _write(struct label *label, char *buf)
+static int _text_write(struct label *label, char *buf)
 {
 	struct label_header *lh = (struct label_header *) buf;
 	struct pv_header *pvhdr;
@@ -179,14 +179,14 @@
 	}
 }
 
-static int _initialise_label(struct labeller *l, struct label *label)
+static int _text_initialise_label(struct labeller *l, struct label *label)
 {
 	strncpy(label->type, LVM2_LABEL, sizeof(label->type));
 
 	return 1;
 }
 
-static int _read(struct labeller *l, struct device *dev, char *buf,
+static int _text_read(struct labeller *l, struct device *dev, char *buf,
 		 struct label **label)
 {
 	struct label_header *lh = (struct label_header *) buf;
@@ -195,13 +195,16 @@
 	struct disk_locn *dlocn_xl;
 	uint64_t offset;
 	struct metadata_area *mda;
-	char vgnamebuf[NAME_LEN + 2];
+	struct id vgid;
 	struct mda_context *mdac;
+	const char *vgname;
+	uint32_t vgstatus;
+	char *creation_host;
 
 	pvhdr = (struct pv_header *) ((void *) buf + xlate32(lh->offset_xl));
 
-	if (!(info = lvmcache_add(l, pvhdr->pv_uuid, dev, NULL, NULL)))
-		return 0;
+	if (!(info = lvmcache_add(l, pvhdr->pv_uuid, dev, NULL, NULL, 0)))
+		return_0;
 	*label = info->label;
 
 	info->device_size = xlate64(pvhdr->device_size_xl);
@@ -232,10 +235,12 @@
 
 	list_iterate_items(mda, &info->mdas) {
 		mdac = (struct mda_context *) mda->metadata_locn;
-		if (vgname_from_mda(info->fmt, &mdac->area, vgnamebuf,
-				    sizeof(vgnamebuf))) {
-			lvmcache_update_vgname(info, vgnamebuf);
-		}
+		if ((vgname = vgname_from_mda(info->fmt, &mdac->area, 
+					      &vgid, &vgstatus, &creation_host)) &&
+		    !lvmcache_update_vgname_and_id(info, vgname,
+						   (char *) &vgid, vgstatus,
+						   creation_host))
+			return_0;
 	}
 
 	info->status &= ~CACHE_INVALID;
@@ -243,7 +248,7 @@
 	return 1;
 }
 
-static void _destroy_label(struct labeller *l, struct label *label)
+static void _text_destroy_label(struct labeller *l, struct label *label)
 {
 	struct lvmcache_info *info = (struct lvmcache_info *) label->info;
 
@@ -253,19 +258,19 @@
 		del_das(&info->das);
 }
 
-static void _destroy(struct labeller *l)
+static void _fmt_text_destroy(struct labeller *l)
 {
 	dm_free(l);
 }
 
 struct label_ops _text_ops = {
-	can_handle:_can_handle,
-	write:_write,
-	read:_read,
-	verify:_can_handle,
-	initialise_label:_initialise_label,
-	destroy_label:_destroy_label,
-	destroy:_destroy
+	can_handle:_text_can_handle,
+	write:_text_write,
+	read:_text_read,
+	verify:_text_can_handle,
+	initialise_label:_text_initialise_label,
+	destroy_label:_text_destroy_label,
+	destroy:_fmt_text_destroy
 };
 
 struct labeller *text_labeller_create(const struct format_type *fmt)

Modified: lvm2/trunk/lib/label/label.c
==============================================================================
--- lvm2/trunk/lib/label/label.c	(original)
+++ lvm2/trunk/lib/label/label.c	Fri May  5 20:27:43 2006
@@ -117,15 +117,6 @@
 	int found = 0;
 	char readbuf[LABEL_SCAN_SIZE];
 
-	if (!dev_open(dev)) {
-		stack;
-
-		if ((info = info_from_pvid(dev->pvid)))
-			lvmcache_update_vgname(info, ORPHAN);
-
-		return NULL;
-	}
-
 	if (!dev_read(dev, UINT64_C(0), LABEL_SCAN_SIZE, readbuf)) {
 		log_debug("%s: Failed to read label area", dev_name(dev));
 		goto out;
@@ -184,13 +175,11 @@
       out:
 	if (!found) {
 		if ((info = info_from_pvid(dev->pvid)))
-			lvmcache_update_vgname(info, ORPHAN);
+			lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN,
+						      0, NULL);
 		log_very_verbose("%s: No label detected", dev_name(dev));
 	}
 
-	if (!dev_close(dev))
-		stack;
-
 	return r;
 }
 
@@ -272,16 +261,29 @@
 	char buf[LABEL_SIZE];
 	struct labeller *l;
 	uint64_t sector;
-	int r;
+	struct lvmcache_info *info;
+	int r = 0;
 
-	if (!(l = _find_labeller(dev, buf, &sector))) {
+	if (!dev_open(dev)) {
 		stack;
-		return 0;
+
+		if ((info = info_from_pvid(dev->pvid)))
+			lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN,
+						      0, NULL);
+
+		goto out;
 	}
 
+	if (!(l = _find_labeller(dev, buf, &sector)))
+		goto_out;
+
 	if ((r = (l->ops->read)(l, dev, buf, result)) && result && *result)
 		(*result)->sector = sector;
 
+      out:
+	if (!dev_close(dev))
+		stack;
+
 	return r;
 }
 
@@ -335,18 +337,35 @@
 	return r;
 }
 
+/* Unused */
 int label_verify(struct device *dev)
 {
 	struct labeller *l;
 	char buf[LABEL_SIZE];
 	uint64_t sector;
+	struct lvmcache_info *info;
+	int r = 0;
 
-	if (!(l = _find_labeller(dev, buf, &sector))) {
+	if (!dev_open(dev)) {
 		stack;
-		return 0;
+
+		if ((info = info_from_pvid(dev->pvid)))
+			lvmcache_update_vgname_and_id(info, ORPHAN, ORPHAN,
+						      0, NULL);
+
+		goto out;
 	}
 
-	return ((l->ops->verify) ? l->ops->verify(l, buf, sector) : 1);
+	if (!(l = _find_labeller(dev, buf, &sector)))
+		goto_out;
+
+	r = l->ops->verify ? l->ops->verify(l, buf, sector) : 1;
+
+      out:
+	if (!dev_close(dev))
+		stack;
+
+	return r;
 }
 
 void label_destroy(struct label *label)

Modified: lvm2/trunk/lib/locking/cluster_locking.c
==============================================================================
--- lvm2/trunk/lib/locking/cluster_locking.c	(original)
+++ lvm2/trunk/lib/locking/cluster_locking.c	Fri May  5 20:27:43 2006
@@ -330,6 +330,9 @@
 	args[0] = flags & 0x7F; /* Maskoff lock flags */
 	args[1] = flags & 0xC0; /* Bitmap flags */
 
+	if (partial_mode())
+		args[1] |= LCK_PARTIAL_MODE;
+
 	/*
 	 * VG locks are just that: locks, and have no side effects
 	 * so we only need to do them on the local node because all

Modified: lvm2/trunk/lib/locking/external_locking.c
==============================================================================
--- lvm2/trunk/lib/locking/external_locking.c	(original)
+++ lvm2/trunk/lib/locking/external_locking.c	Fri May  5 20:27:43 2006
@@ -72,7 +72,7 @@
 	libname = find_config_str(cft->root, "global/locking_library",
 				  DEFAULT_LOCKING_LIB);
 
-	if (!(_locking_lib = load_shared_library(cft, libname, "locking"))) {
+	if (!(_locking_lib = load_shared_library(cft, libname, "locking", 1))) {
 		stack;
 		return 0;
 	}

Modified: lvm2/trunk/lib/locking/locking.c
==============================================================================
--- lvm2/trunk/lib/locking/locking.c	(original)
+++ lvm2/trunk/lib/locking/locking.c	Fri May  5 20:27:43 2006
@@ -102,7 +102,7 @@
 		_unblock_signals();
 }
 
-static inline void _update_vg_lock_count(int flags)
+static void _update_vg_lock_count(int flags)
 {
 	if ((flags & LCK_SCOPE_MASK) != LCK_VG)
 		return;

Modified: lvm2/trunk/lib/locking/locking.h
==============================================================================
--- lvm2/trunk/lib/locking/locking.h	(original)
+++ lvm2/trunk/lib/locking/locking.h	Fri May  5 20:27:43 2006
@@ -68,6 +68,11 @@
 #define LCK_CLUSTER_VG	0x00000080	/* VG is clustered */
 
 /*
+ * Additional lock bits for cluster communication
+ */
+#define LCK_PARTIAL_MODE	0x00000001	/* Running in partial mode */
+
+/*
  * Common combinations
  */
 #define LCK_VG_READ		(LCK_VG | LCK_READ | LCK_HOLD)

Modified: lvm2/trunk/lib/log/log.c
==============================================================================
--- lvm2/trunk/lib/log/log.c	(original)
+++ lvm2/trunk/lib/log/log.c	Fri May  5 20:27:43 2006
@@ -90,9 +90,13 @@
 	_syslog = 1;
 }
 
-void log_suppress(int suppress)
+int log_suppress(int suppress)
 {
+	int old_suppress = _log_suppress;
+
 	_log_suppress = suppress;
+
+	return old_suppress;
 }
 
 void release_log_memory(void)
@@ -253,6 +257,9 @@
 	const char *message;
 	const char *trformat;		/* Translated format string */
 
+	if (_log_suppress == 2)
+		return;
+
 	trformat = _(format);
 
 	if (_lvm2_log_fn) {

Modified: lvm2/trunk/lib/log/log.h
==============================================================================
--- lvm2/trunk/lib/log/log.h	(original)
+++ lvm2/trunk/lib/log/log.h	Fri May  5 20:27:43 2006
@@ -86,8 +86,9 @@
 int lockingfailed(void);
 int security_level(void);
 
-/* Suppress messages to stdout/stderr */
-void log_suppress(int suppress);
+/* Suppress messages to stdout/stderr (1) or everywhere (2) */
+/* Returns previous setting */
+int log_suppress(int suppress);
 
 /* Suppress messages to syslog */
 void syslog_suppress(int suppress);

Modified: lvm2/trunk/lib/metadata/metadata.c
==============================================================================
--- lvm2/trunk/lib/metadata/metadata.c	(original)
+++ lvm2/trunk/lib/metadata/metadata.c	Fri May  5 20:27:43 2006
@@ -71,6 +71,8 @@
 		return 0;
 	}
 
+	memcpy(&pv->vgid, &vg->id, sizeof(vg->id));
+
 	/* Units of 512-byte sectors */
 	pv->pe_size = vg->extent_size;
 
@@ -143,13 +145,14 @@
 }
 
 int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
-			 const char *id, struct physical_volume *pv)
+			 const char *vgid, const char *pvid,
+			 struct physical_volume *pv)
 {
 	struct volume_group *vg;
 	struct pv_list *pvl;
 	int consistent = 0;
 
-	if (!(vg = vg_read(fmt->cmd, vg_name, &consistent))) {
+	if (!(vg = vg_read(fmt->cmd, vg_name, vgid, &consistent))) {
 		log_error("get_pv_from_vg_by_id: vg_read failed to read VG %s",
 			  vg_name);
 		return 0;
@@ -160,7 +163,7 @@
 			  vg_name);
 
 	list_iterate_items(pvl, &vg->pvs) {
-		if (id_equal(&pvl->pv->id, (const struct id *) id)) {
+		if (id_equal(&pvl->pv->id, (const struct id *) pvid)) {
 			if (!_copy_pv(pv, pvl->pv)) {
 				stack;
 				return 0;
@@ -239,7 +242,7 @@
 	/* is this vg name already in use ? */
 	old_partial = partial_mode();
 	init_partial(1);
-	if (vg_read(cmd, vg_name, &consistent)) {
+	if (vg_read(cmd, vg_name, NULL, &consistent)) {
 		log_err("A volume group called '%s' already exists.", vg_name);
 		goto bad;
 	}
@@ -286,7 +289,7 @@
 	list_init(&vg->tags);
 
 	if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, vg_name,
-						       NULL))) {
+						       NULL, NULL))) {
 		log_error("Failed to create format instance");
 		goto bad;
 	}
@@ -496,7 +499,7 @@
 				  uint64_t pvmetadatasize, struct list *mdas)
 {
 	struct dm_pool *mem = fmt->cmd->mem;
-	struct physical_volume *pv = dm_pool_alloc(mem, sizeof(*pv));
+	struct physical_volume *pv = dm_pool_zalloc(mem, sizeof(*pv));
 
 	if (!pv) {
 		stack;
@@ -862,7 +865,7 @@
 	struct volume_group *vg;
 	struct physical_volume *pv;
 
-	if (!(vginfo = vginfo_from_vgname(ORPHAN))) {
+	if (!(vginfo = vginfo_from_vgname(ORPHAN, NULL))) {
 		stack;
 		return NULL;
 	}
@@ -907,6 +910,7 @@
  */
 static struct volume_group *_vg_read(struct cmd_context *cmd,
 				     const char *vgname,
+				     const char *vgid,
 				     int *consistent, int precommitted)
 {
 	struct format_instance *fid;
@@ -928,15 +932,15 @@
 
 	/* Find the vgname in the cache */
 	/* If it's not there we must do full scan to be completely sure */
-	if (!(fmt = fmt_from_vgname(vgname))) {
+	if (!(fmt = fmt_from_vgname(vgname, vgid))) {
 		lvmcache_label_scan(cmd, 0);
-		if (!(fmt = fmt_from_vgname(vgname))) {
+		if (!(fmt = fmt_from_vgname(vgname, vgid))) {
 			if (memlock()) {
 				stack;
 				return NULL;
 			}
 			lvmcache_label_scan(cmd, 2);
-			if (!(fmt = fmt_from_vgname(vgname))) {
+			if (!(fmt = fmt_from_vgname(vgname, vgid))) {
 				stack;
 				return NULL;
 			}
@@ -947,7 +951,7 @@
 		use_precommitted = 0;
 
 	/* create format instance with appropriate metadata area */
-	if (!(fid = fmt->ops->create_instance(fmt, vgname, NULL))) {
+	if (!(fid = fmt->ops->create_instance(fmt, vgname, vgid, NULL))) {
 		log_error("Failed to create format instance");
 		return NULL;
 	}
@@ -978,7 +982,7 @@
 		inconsistent = 0;
 
 		lvmcache_label_scan(cmd, 2);
-		if (!(fmt = fmt_from_vgname(vgname))) {
+		if (!(fmt = fmt_from_vgname(vgname, vgid))) {
 			stack;
 			return NULL;
 		}
@@ -987,7 +991,7 @@
 			use_precommitted = 0;
 
 		/* create format instance with appropriate metadata area */
-		if (!(fid = fmt->ops->create_instance(fmt, vgname, NULL))) {
+		if (!(fid = fmt->ops->create_instance(fmt, vgname, vgid, NULL))) {
 			log_error("Failed to create format instance");
 			return NULL;
 		}
@@ -1069,12 +1073,12 @@
 }
 
 struct volume_group *vg_read(struct cmd_context *cmd, const char *vgname,
-			     int *consistent)
+			     const char *vgid, int *consistent)
 {
 	struct volume_group *vg;
 	struct lv_list *lvl;
 
-	if (!(vg = _vg_read(cmd, vgname, consistent, 0)))
+	if (!(vg = _vg_read(cmd, vgname, vgid, consistent, 0)))
 		return NULL;
 
 	if (!check_pv_segments(vg)) {
@@ -1112,7 +1116,7 @@
 	/* Is corresponding vgname already cached? */
 	if ((vginfo = vginfo_from_vgid(vgid)) &&
 	    vginfo->vgname && *vginfo->vgname) {
-		if ((vg = _vg_read(cmd, vginfo->vgname,
+		if ((vg = _vg_read(cmd, vginfo->vgname, vgid,
 				   &consistent, precommitted)) &&
 		    !strncmp(vg->id.uuid, vgid, ID_LEN)) {
 			if (!consistent) {
@@ -1143,7 +1147,7 @@
 		if (!vgname || !*vgname)
 			continue;	// FIXME Unnecessary? 
 		consistent = 0;
-		if ((vg = _vg_read(cmd, vgname, &consistent,
+		if ((vg = _vg_read(cmd, vgname, vgid, &consistent,
 				   precommitted)) &&
 		    !strncmp(vg->id.uuid, vgid, ID_LEN)) {
 			if (!consistent) {
@@ -1245,13 +1249,18 @@
 	return lvmcache_get_vgnames(cmd, full_scan);
 }
 
+struct list *get_vgids(struct cmd_context *cmd, int full_scan)
+{
+	return lvmcache_get_vgids(cmd, full_scan);
+}
+
 struct list *get_pvs(struct cmd_context *cmd)
 {
 	struct str_list *strl;
 	struct list *results;
-	const char *vgname;
+	const char *vgname, *vgid;
 	struct list *pvh, *tmp;
-	struct list *vgnames;
+	struct list *vgids;
 	struct volume_group *vg;
 	int consistent = 0;
 	int old_partial;
@@ -1267,7 +1276,7 @@
 	list_init(results);
 
 	/* Get list of VGs */
-	if (!(vgnames = get_vgs(cmd, 0))) {
+	if (!(vgids = get_vgids(cmd, 0))) {
 		log_error("get_pvs: get_vgs failed");
 		return NULL;
 	}
@@ -1278,12 +1287,16 @@
 	old_pvmove = pvmove_mode();
 	init_partial(1);
 	init_pvmove(1);
-	list_iterate_items(strl, vgnames) {
-		vgname = strl->str;
-		if (!vgname)
+	list_iterate_items(strl, vgids) {
+		vgid = strl->str;
+		if (!vgid)
 			continue;	/* FIXME Unnecessary? */
 		consistent = 0;
-		if (!(vg = vg_read(cmd, vgname, &consistent))) {
+		if (!(vgname = vgname_from_vgid(NULL, vgid))) {
+			stack;
+			continue;
+		}
+		if (!(vg = vg_read(cmd, vgname, vgid, &consistent))) {
 			stack;
 			continue;
 		}

Modified: lvm2/trunk/lib/metadata/metadata.h
==============================================================================
--- lvm2/trunk/lib/metadata/metadata.h	(original)
+++ lvm2/trunk/lib/metadata/metadata.h	Fri May  5 20:27:43 2006
@@ -23,9 +23,9 @@
 
 #include "ctype.h"
 #include "dev-cache.h"
+#include "lvm-string.h"
 #include "uuid.h"
 
-#define NAME_LEN 128
 #define MAX_STRIPES 128
 #define SECTOR_SHIFT 9L
 #define SECTOR_SIZE ( 1L << SECTOR_SHIFT )
@@ -122,6 +122,7 @@
 	struct device *dev;
 	const struct format_type *fmt;
 	const char *vg_name;
+	struct id vgid;
 
 	uint32_t status;
 	uint64_t size;
@@ -385,6 +386,7 @@
 	 */
 	struct format_instance *(*create_instance) (const struct format_type *
 						    fmt, const char *vgname,
+						    const char *vgid,
 						    void *context);
 
 	/*
@@ -406,7 +408,7 @@
 int vg_commit(struct volume_group *vg);
 int vg_revert(struct volume_group *vg);
 struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name,
-			     int *consistent);
+			     const char *vgid, int *consistent);
 struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
 				struct list *mdas, uint64_t *label_sector,
 				int warnings);
@@ -414,6 +416,7 @@
 
 /* Set full_scan to 1 to re-read every (filtered) device label */
 struct list *get_vgs(struct cmd_context *cmd, int full_scan);
+struct list *get_vgids(struct cmd_context *cmd, int full_scan);
 
 int pv_write(struct cmd_context *cmd, struct physical_volume *pv,
 	     struct list *mdas, int64_t label_sector);
@@ -481,7 +484,8 @@
 struct physical_volume *find_pv_in_vg_by_uuid(struct volume_group *vg,
 					      struct id *id);
 int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
-			 const char *id, struct physical_volume *pv);
+			 const char *vgid, const char *pvid,
+			 struct physical_volume *pv);
 
 /* Find an LV within a given VG */
 struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name);
@@ -538,11 +542,16 @@
  */
 int lv_is_origin(const struct logical_volume *lv);
 int lv_is_cow(const struct logical_volume *lv);
+int lv_is_visible(const struct logical_volume *lv);
 
 int pv_is_in_vg(struct volume_group *vg, struct physical_volume *pv);
 
+/* Given a cow LV, return return the snapshot lv_segment that uses it */
 struct lv_segment *find_cow(const struct logical_volume *lv);
 
+/* Given a cow LV, return its origin */
+struct logical_volume *origin_from_cow(const struct logical_volume *lv);
+
 int vg_add_snapshot(struct format_instance *fid, const char *name,
 		    struct logical_volume *origin, struct logical_volume *cow,
 		    union lvid *lvid, uint32_t extent_count,
@@ -603,29 +612,4 @@
 char *generate_lv_name(struct volume_group *vg, const char *format,
 		       char *buffer, size_t len);
 
-static inline int validate_name(const char *n)
-{
-	register char c;
-	register int len = 0;
-
-	if (!n || !*n)
-		return 0;
-
-	/* Hyphen used as VG-LV separator - ambiguity if LV starts with it */
-	if (*n == '-')
-		return 0;
-
-	if (!strcmp(n, ".") || !strcmp(n, ".."))
-		return 0;
-
-	while ((len++, c = *n++))
-		if (!isalnum(c) && c != '.' && c != '_' && c != '-' && c != '+')
-			return 0;
-
-	if (len > NAME_LEN)
-		return 0;
-
-	return 1;
-}
-
 #endif

Modified: lvm2/trunk/lib/metadata/snapshot_manip.c
==============================================================================
--- lvm2/trunk/lib/metadata/snapshot_manip.c	(original)
+++ lvm2/trunk/lib/metadata/snapshot_manip.c	Fri May  5 20:27:43 2006
@@ -28,12 +28,26 @@
 	return lv->snapshot ? 1 : 0;
 }
 
+int lv_is_visible(const struct logical_volume *lv)
+{
+	if (lv_is_cow(lv))
+		return lv_is_visible(find_cow(lv)->lv);
+
+	return lv->status & VISIBLE_LV ? 1 : 0;
+}
+
 /* Given a cow LV, return the snapshot lv_segment that uses it */
 struct lv_segment *find_cow(const struct logical_volume *lv)
 {
 	return lv->snapshot;
 }
 
+/* Given a cow LV, return its origin */
+struct logical_volume *origin_from_cow(const struct logical_volume *lv)
+{
+	return lv->snapshot->origin;
+}
+
 int vg_add_snapshot(struct format_instance *fid, const char *name,
 		    struct logical_volume *origin,
 		    struct logical_volume *cow, union lvid *lvid,

Modified: lvm2/trunk/lib/mirror/mirrored.c
==============================================================================
--- lvm2/trunk/lib/mirror/mirrored.c	(original)
+++ lvm2/trunk/lib/mirror/mirrored.c	Fri May  5 20:27:43 2006
@@ -43,12 +43,12 @@
 	uint32_t default_region_size;
 };
 
-static const char *_name(const struct lv_segment *seg)
+static const char *_mirrored_name(const struct lv_segment *seg)
 {
 	return seg->segtype->name;
 }
 
-static void _display(const struct lv_segment *seg)
+static void _mirrored_display(const struct lv_segment *seg)
 {
 	const char *size;
 	uint32_t s;
@@ -73,7 +73,7 @@
 	log_print(" ");
 }
 
-static int _text_import_area_count(struct config_node *sn, uint32_t *area_count)
+static int _mirrored_text_import_area_count(struct config_node *sn, uint32_t *area_count)
 {
 	if (!get_config_uint32(sn, "mirror_count", area_count)) {
 		log_error("Couldn't read 'mirror_count' for "
@@ -84,7 +84,7 @@
 	return 1;
 }
 
-static int _text_import(struct lv_segment *seg, const struct config_node *sn,
+static int _mirrored_text_import(struct lv_segment *seg, const struct config_node *sn,
 			struct dm_hash_table *pv_hash)
 {
 	const struct config_node *cn;
@@ -139,7 +139,7 @@
 	return text_import_areas(seg, sn, cn, pv_hash, MIRROR_IMAGE);
 }
 
-static int _text_export(const struct lv_segment *seg, struct formatter *f)
+static int _mirrored_text_export(const struct lv_segment *seg, struct formatter *f)
 {
 	outf(f, "mirror_count = %u", seg->area_count);
 	if (seg->status & PVMOVE)
@@ -154,7 +154,7 @@
 }
 
 #ifdef DEVMAPPER_SUPPORT
-static struct mirror_state *_init_target(struct dm_pool *mem,
+static struct mirror_state *_mirrored_init_target(struct dm_pool *mem,
 					 struct config_tree *cft)
 {
 	struct mirror_state *mirr_state;
@@ -172,7 +172,7 @@
 	return mirr_state;
 }
 
-static int _target_percent(void **target_state, struct dm_pool *mem,
+static int _mirrored_target_percent(void **target_state, struct dm_pool *mem,
 			   struct config_tree *cft, struct lv_segment *seg,
 			   char *params, uint64_t *total_numerator,
 			   uint64_t *total_denominator, float *percent)
@@ -184,7 +184,7 @@
 	char *pos = params;
 
 	if (!*target_state)
-		*target_state = _init_target(mem, cft);
+		*target_state = _mirrored_init_target(mem, cft);
 
 	mirr_state = *target_state;
 
@@ -251,7 +251,7 @@
 	return dm_tree_node_add_mirror_target_log(node, region_size, clustered, log_dlid, area_count, log_flags);
 }
 
-static int _add_target_line(struct dev_manager *dm, struct dm_pool *mem,
+static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem,
                                 struct config_tree *cft, void **target_state,
                                 struct lv_segment *seg,
                                 struct dm_tree_node *node, uint64_t len,
@@ -265,7 +265,7 @@
 	int r;
 
 	if (!*target_state)
-		*target_state = _init_target(mem, cft);
+		*target_state = _mirrored_init_target(mem, cft);
 
 	mirr_state = *target_state;
 
@@ -322,16 +322,16 @@
 	return add_areas_line(dm, seg, node, start_area, area_count);
 }
 
-static int _target_present(void)
+static int _mirrored_target_present(void)
 {
-	static int checked = 0;
-	static int present = 0;
+	static int _mirrored_checked = 0;
+	static int _mirrored_present = 0;
 	uint32_t maj, min, patchlevel;
 	unsigned maj2, min2, patchlevel2;
         char vsn[80];
 
-	if (!checked) {
-		present = target_present("mirror", 1);
+	if (!_mirrored_checked) {
+		_mirrored_present = target_present("mirror", 1);
 
 		/*
 		 * block_on_error available with mirror target >= 1.1
@@ -348,9 +348,9 @@
 			_block_on_error_available = 1;
 	}
 
-	checked = 1;
+	_mirrored_checked = 1;
 
-	return present;
+	return _mirrored_present;
 }
 
 #ifdef DMEVENTD
@@ -436,27 +436,27 @@
 #endif /* DMEVENTD */
 #endif /* DEVMAPPER_SUPPORT */
 
-static void _destroy(const struct segment_type *segtype)
+static void _mirrored_destroy(const struct segment_type *segtype)
 {
 	dm_free((void *) segtype);
 }
 
 static struct segtype_handler _mirrored_ops = {
-	name:_name,
-	display:_display,
-	text_import_area_count:_text_import_area_count,
-	text_import:_text_import,
-	text_export:_text_export,
+	name:_mirrored_name,
+	display:_mirrored_display,
+	text_import_area_count:_mirrored_text_import_area_count,
+	text_import:_mirrored_text_import,
+	text_export:_mirrored_text_export,
 #ifdef DEVMAPPER_SUPPORT
-	add_target_line:_add_target_line,
-	target_percent:_target_percent,
-	target_present:_target_present,
+	add_target_line:_mirrored_add_target_line,
+	target_percent:_mirrored_target_percent,
+	target_present:_mirrored_target_present,
 #ifdef DMEVENTD
 	target_register_events:_target_register_events,
 	target_unregister_events:_target_unregister_events,
 #endif
 #endif
-	destroy:_destroy,
+	destroy:_mirrored_destroy,
 };
 
 #ifdef MIRRORED_INTERNAL

Modified: lvm2/trunk/lib/misc/lvm-string.c
==============================================================================
--- lvm2/trunk/lib/misc/lvm-string.c	(original)
+++ lvm2/trunk/lib/misc/lvm-string.c	Fri May  5 20:27:43 2006
@@ -208,3 +208,27 @@
 	return 1;
 }
 
+int validate_name(const char *n)
+{
+	register char c;
+	register int len = 0;
+
+	if (!n || !*n)
+		return 0;
+
+	/* Hyphen used as VG-LV separator - ambiguity if LV starts with it */
+	if (*n == '-')
+		return 0;
+
+	if (!strcmp(n, ".") || !strcmp(n, ".."))
+		return 0;
+
+	while ((len++, c = *n++))
+		if (!isalnum(c) && c != '.' && c != '_' && c != '-' && c != '+')
+			return 0;
+
+	if (len > NAME_LEN)
+		return 0;
+
+	return 1;
+}

Modified: lvm2/trunk/lib/misc/lvm-string.h
==============================================================================
--- lvm2/trunk/lib/misc/lvm-string.h	(original)
+++ lvm2/trunk/lib/misc/lvm-string.h	Fri May  5 20:27:43 2006
@@ -19,6 +19,8 @@
 #include <stdio.h>
 #include <stdarg.h>
 
+#define NAME_LEN 128
+
 struct pool;
 
 /*
@@ -40,4 +42,6 @@
 int split_dm_name(struct dm_pool *mem, const char *dmname,
                   char **vgname, char **lvname, char **layer);
 
+int validate_name(const char *n);
+
 #endif

Modified: lvm2/trunk/lib/misc/sharedlib.c
==============================================================================
--- lvm2/trunk/lib/misc/sharedlib.c	(original)
+++ lvm2/trunk/lib/misc/sharedlib.c	Fri May  5 20:27:43 2006
@@ -38,7 +38,7 @@
 }
 
 void *load_shared_library(struct config_tree *cft, const char *libname,
-			  const char *desc)
+			  const char *desc, int silent)
 {
 	char path[PATH_MAX];
 	void *library;
@@ -47,8 +47,14 @@
 
 	log_very_verbose("Opening shared %s library %s", desc, path);
 
-	if (!(library = dlopen(path, RTLD_LAZY)))
-		log_error("Unable to open external %s library %s", desc, path);
+	if (!(library = dlopen(path, RTLD_LAZY))) {
+		if (silent && ignorelockingfailure())
+			log_verbose("Unable to open external %s library %s",
+				    desc, path);
+		else
+			log_error("Unable to open external %s library %s",
+				  desc, path);
+	}
 
 	return library;
 }

Modified: lvm2/trunk/lib/misc/sharedlib.h
==============================================================================
--- lvm2/trunk/lib/misc/sharedlib.h	(original)
+++ lvm2/trunk/lib/misc/sharedlib.h	Fri May  5 20:27:43 2006
@@ -19,4 +19,4 @@
 void get_shared_library_path(struct config_tree *cft, const char *libname,
 			     char *path, int path_len);
 void *load_shared_library(struct config_tree *cf, const char *libname,
-			  const char *what);
+			  const char *what, int silent);

Modified: lvm2/trunk/lib/mm/memlock.c
==============================================================================
--- lvm2/trunk/lib/mm/memlock.c	(original)
+++ lvm2/trunk/lib/mm/memlock.c	Fri May  5 20:27:43 2006
@@ -90,7 +90,7 @@
 }
 
 /* Stop memory getting swapped out */
-static void _lock_memory(void)
+static void _lock_mem(void)
 {
 #ifdef MCL_CURRENT
 	if (mlockall(MCL_CURRENT | MCL_FUTURE))
@@ -109,7 +109,7 @@
 				  _default_priority, strerror(errno));
 }
 
-static void _unlock_memory(void)
+static void _unlock_mem(void)
 {
 #ifdef MCL_CURRENT
 	if (munlockall())
@@ -126,14 +126,14 @@
 void memlock_inc(void)
 {
 	if (!_memlock_count++)
-		_lock_memory();
+		_lock_mem();
 	log_debug("memlock_count inc to %d", _memlock_count);
 }
 
 void memlock_dec(void)
 {
 	if (_memlock_count && (!--_memlock_count))
-		_unlock_memory();
+		_unlock_mem();
 	log_debug("memlock_count dec to %d", _memlock_count);
 }
 

Modified: lvm2/trunk/lib/regex/matcher.c
==============================================================================
--- lvm2/trunk/lib/regex/matcher.c	(original)
+++ lvm2/trunk/lib/regex/matcher.c	Fri May  5 20:27:43 2006
@@ -166,7 +166,7 @@
 	}
 }
 
-static inline struct dfa_state *_create_dfa_state(struct dm_pool *mem)
+static struct dfa_state *_create_dfa_state(struct dm_pool *mem)
 {
 	return dm_pool_zalloc(mem, sizeof(struct dfa_state));
 }
@@ -337,8 +337,7 @@
 	return NULL;
 }
 
-static inline struct dfa_state *_step_matcher(int c,
-					      struct dfa_state *cs, int *r)
+static struct dfa_state *_step_matcher(int c, struct dfa_state *cs, int *r)
 {
 	if (!(cs = cs->lookup[(unsigned char) c]))
 		return NULL;

Modified: lvm2/trunk/lib/regex/parse_rx.c
==============================================================================
--- lvm2/trunk/lib/regex/parse_rx.c	(original)
+++ lvm2/trunk/lib/regex/parse_rx.c	Fri May  5 20:27:43 2006
@@ -38,7 +38,7 @@
  * Get the next token from the regular expression.
  * Returns: 1 success, 0 end of input, -1 error.
  */
-static int _get_token(struct parse_sp *ps)
+static int _rx_get_token(struct parse_sp *ps)
 {
 	int neg = 0, range = 0;
 	char c, lc = 0;
@@ -230,17 +230,17 @@
 		}
 
 		dm_bit_copy(n->charset, ps->charset);
-		_get_token(ps);	/* match charset */
+		_rx_get_token(ps);	/* match charset */
 		break;
 
 	case '(':
-		_get_token(ps);	/* match '(' */
+		_rx_get_token(ps);	/* match '(' */
 		n = _or_term(ps);
 		if (ps->type != ')') {
 			log_error("missing ')' in regular expression");
 			return 0;
 		}
-		_get_token(ps);	/* match ')' */
+		_rx_get_token(ps);	/* match ')' */
 		break;
 
 	default:
@@ -280,7 +280,7 @@
 			return NULL;
 		}
 
-		_get_token(ps);
+		_rx_get_token(ps);
 		l = n;
 	}
 
@@ -316,7 +316,7 @@
 	if (ps->type != '|')
 		return l;
 
-	_get_token(ps);		/* match '|' */
+	_rx_get_token(ps);		/* match '|' */
 
 	if (!(r = _or_term(ps))) {
 		log_error("Badly formed 'or' expression");
@@ -344,7 +344,7 @@
 	ps->charset = dm_bitset_create(mem, 256);
 	ps->cursor = begin;
 	ps->rx_end = end;
-	_get_token(ps);		/* load the first token */
+	_rx_get_token(ps);		/* load the first token */
 
 	if (!(r = _or_term(ps))) {
 		log_error("Parse error in regex");

Modified: lvm2/trunk/lib/regex/ttree.c
==============================================================================
--- lvm2/trunk/lib/regex/ttree.c	(original)
+++ lvm2/trunk/lib/regex/ttree.c	Fri May  5 20:27:43 2006
@@ -59,7 +59,7 @@
 	return *c ? (*c)->data : NULL;
 }
 
-static struct node *_node(struct dm_pool *mem, unsigned int k)
+static struct node *_tree_node(struct dm_pool *mem, unsigned int k)
 {
 	struct node *n = dm_pool_zalloc(mem, sizeof(*n));
 
@@ -86,7 +86,7 @@
 		count++;
 
 		while (count--) {
-			if (!(*c = _node(tt->mem, k))) {
+			if (!(*c = _tree_node(tt->mem, k))) {
 				stack;
 				return 0;
 			}

Modified: lvm2/trunk/lib/report/report.c
==============================================================================
--- lvm2/trunk/lib/report/report.c	(original)
+++ lvm2/trunk/lib/report/report.c	Fri May  5 20:27:43 2006
@@ -324,7 +324,6 @@
 	const struct logical_volume *lv = (const struct logical_volume *) data;
 	struct lvinfo info;
 	char *repstr;
-	struct lv_segment *snap_seg;
 	float snap_percent;
 
 	if (!(repstr = dm_pool_zalloc(rh->mem, 7))) {
@@ -344,7 +343,7 @@
 		repstr[0] = 'v';
 	else if (lv_is_origin(lv))
 		repstr[0] = 'o';
-	else if (find_cow(lv))
+	else if (lv_is_cow(lv))
 		repstr[0] = 's';
 	else
 		repstr[0] = '-';
@@ -377,8 +376,8 @@
 			repstr[4] = 'd';	/* Inactive without table */
 
 		/* Snapshot dropped? */
-		if (info.live_table && (snap_seg = find_cow(lv)) &&
-		    (!lv_snapshot_percent(snap_seg->cow, &snap_percent) ||
+		if (info.live_table && lv_is_cow(lv) &&
+		    (!lv_snapshot_percent(lv, &snap_percent) ||
 		     snap_percent < 0 || snap_percent >= 100)) {
 			repstr[0] = toupper(repstr[0]);
 			if (info.suspended)
@@ -491,10 +490,9 @@
 			const void *data)
 {
 	const struct logical_volume *lv = (const struct logical_volume *) data;
-	struct lv_segment *snap_seg;
 
-	if ((snap_seg = find_cow(lv)))
-		return _string_disp(rh, field, &snap_seg->origin->name);
+	if (lv_is_cow(lv))
+		return _string_disp(rh, field, &origin_from_cow(lv)->name);
 
 	field->report_string = "";
 	field->sort_value = (const void *) field->report_string;
@@ -527,8 +525,7 @@
 	char *repstr;
 	size_t len;
 
-	/* FIXME Remove need for snapshot special case */
-	if (lv->status & VISIBLE_LV || lv_is_cow(lv)) {
+	if (lv_is_visible(lv)) {
 		repstr = lv->name;
 		return _string_disp(rh, field, &repstr);
 	}
@@ -667,11 +664,10 @@
 			   const void *data)
 {
 	const struct lv_segment *seg = (const struct lv_segment *) data;
-	struct lv_segment *snap_seg;
 	uint64_t size;
 
-	if ((snap_seg = find_cow(seg->lv)))
-		size = (uint64_t) snap_seg->chunk_size;
+	if (lv_is_cow(seg->lv))
+		size = (uint64_t) find_cow(seg->lv)->chunk_size;
 	else
 		size = 0;
 
@@ -840,7 +836,6 @@
 			   const void *data)
 {
 	const struct logical_volume *lv = (const struct logical_volume *) data;
-	struct lv_segment *snap_seg;
 	struct lvinfo info;
 	float snap_percent;
 	uint64_t *sortval;
@@ -851,16 +846,15 @@
 		return 0;
 	}
 
-	if (!(snap_seg = find_cow(lv)) ||
-	    (lv_info(lv->vg->cmd, snap_seg->cow, &info, 0) && !info.exists)) {
+	if (!lv_is_cow(lv) ||
+	    (lv_info(lv->vg->cmd, lv, &info, 0) && !info.exists)) {
 		field->report_string = "";
 		*sortval = UINT64_C(0);
 		field->sort_value = sortval;
 		return 1;
 	}
 
-	if (!lv_snapshot_percent(snap_seg->cow, &snap_percent)
-	    || snap_percent < 0) {
+	if (!lv_snapshot_percent(lv, &snap_percent) || snap_percent < 0) {
 		field->report_string = "100.00";
 		*sortval = UINT64_C(100);
 		field->sort_value = sortval;

Modified: lvm2/trunk/lib/snapshot/snapshot.c
==============================================================================
--- lvm2/trunk/lib/snapshot/snapshot.c	(original)
+++ lvm2/trunk/lib/snapshot/snapshot.c	Fri May  5 20:27:43 2006
@@ -21,12 +21,12 @@
 #include "config.h"
 #include "activate.h"
 
-static const char *_name(const struct lv_segment *seg)
+static const char *_snap_name(const struct lv_segment *seg)
 {
 	return seg->segtype->name;
 }
 
-static int _text_import(struct lv_segment *seg, const struct config_node *sn,
+static int _snap_text_import(struct lv_segment *seg, const struct config_node *sn,
 			struct dm_hash_table *pv_hash)
 {
 	uint32_t chunk_size;
@@ -77,7 +77,7 @@
 	return 1;
 }
 
-static int _text_export(const struct lv_segment *seg, struct formatter *f)
+static int _snap_text_export(const struct lv_segment *seg, struct formatter *f)
 {
 	outf(f, "chunk_size = %u", seg->chunk_size);
 	outf(f, "origin = \"%s\"", seg->origin->name);
@@ -87,7 +87,7 @@
 }
 
 #ifdef DEVMAPPER_SUPPORT
-static int _target_percent(void **target_state, struct dm_pool *mem,
+static int _snap_target_percent(void **target_state, struct dm_pool *mem,
 			   struct config_tree *cft, struct lv_segment *seg,
 			   char *params, uint64_t *total_numerator,
 			   uint64_t *total_denominator, float *percent)
@@ -109,35 +109,35 @@
 	return 1;
 }
 
-static int _target_present(void)
+static int _snap_target_present(void)
 {
-	static int checked = 0;
-	static int present = 0;
+	static int _snap_checked = 0;
+	static int _snap_present = 0;
 
-	if (!checked)
-		present = target_present("snapshot", 1) &&
+	if (!_snap_checked)
+		_snap_present = target_present("snapshot", 1) &&
 		    target_present("snapshot-origin", 0);
 
-	checked = 1;
+	_snap_checked = 1;
 
-	return present;
+	return _snap_present;
 }
 #endif
 
-static void _destroy(const struct segment_type *segtype)
+static void _snap_destroy(const struct segment_type *segtype)
 {
 	dm_free((void *) segtype);
 }
 
 static struct segtype_handler _snapshot_ops = {
-	name:_name,
-	text_import:_text_import,
-	text_export:_text_export,
+	name:_snap_name,
+	text_import:_snap_text_import,
+	text_export:_snap_text_export,
 #ifdef DEVMAPPER_SUPPORT
-	target_percent:_target_percent,
-	target_present:_target_present,
+	target_percent:_snap_target_percent,
+	target_present:_snap_target_present,
 #endif
-	destroy:_destroy,
+	destroy:_snap_destroy,
 };
 
 #ifdef SNAPSHOT_INTERNAL

Modified: lvm2/trunk/lib/striped/striped.c
==============================================================================
--- lvm2/trunk/lib/striped/striped.c	(original)
+++ lvm2/trunk/lib/striped/striped.c	Fri May  5 20:27:43 2006
@@ -26,12 +26,12 @@
 #include "activate.h"
 #include "pv_alloc.h"
 
-static const char *_name(const struct lv_segment *seg)
+static const char *_striped_name(const struct lv_segment *seg)
 {
 	return (seg->area_count == 1) ? "linear" : seg->segtype->name;
 }
 
-static void _display(const struct lv_segment *seg)
+static void _striped_display(const struct lv_segment *seg)
 {
 	uint32_t s;
 
@@ -49,7 +49,7 @@
 	log_print(" ");
 }
 
-static int _text_import_area_count(struct config_node *sn, uint32_t *area_count)
+static int _striped_text_import_area_count(struct config_node *sn, uint32_t *area_count)
 {
 	if (!get_config_uint32(sn, "stripe_count", area_count)) {
 		log_error("Couldn't read 'stripe_count' for "
@@ -60,7 +60,7 @@
 	return 1;
 }
 
-static int _text_import(struct lv_segment *seg, const struct config_node *sn,
+static int _striped_text_import(struct lv_segment *seg, const struct config_node *sn,
 			struct dm_hash_table *pv_hash)
 {
 	struct config_node *cn;
@@ -83,7 +83,7 @@
 	return text_import_areas(seg, sn, cn, pv_hash, 0);
 }
 
-static int _text_export(const struct lv_segment *seg, struct formatter *f)
+static int _striped_text_export(const struct lv_segment *seg, struct formatter *f)
 {
 
 	outf(f, "stripe_count = %u%s", seg->area_count,
@@ -99,7 +99,7 @@
 /*
  * Test whether two segments could be merged by the current merging code
  */
-static int _segments_compatible(struct lv_segment *first,
+static int _striped_segments_compatible(struct lv_segment *first,
 				struct lv_segment *second)
 {
 	uint32_t width;
@@ -132,11 +132,11 @@
 	return 1;
 }
 
-static int _merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
+static int _striped_merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
 {
 	uint32_t s;
 
-	if (!_segments_compatible(seg1, seg2))
+	if (!_striped_segments_compatible(seg1, seg2))
 		return 0;
 
 	seg1->len += seg2->len;
@@ -151,7 +151,7 @@
 }
 
 #ifdef DEVMAPPER_SUPPORT
-static int _add_target_line(struct dev_manager *dm, struct dm_pool *mem,
+static int _striped_add_target_line(struct dev_manager *dm, struct dm_pool *mem,
                                 struct config_tree *cft, void **target_state,
                                 struct lv_segment *seg,
                                 struct dm_tree_node *node, uint64_t len,
@@ -172,37 +172,38 @@
 	return add_areas_line(dm, seg, node, 0u, seg->area_count);
 }
 
-static int _target_present(void)
+static int _striped_target_present(void)
 {
-	static int checked = 0;
-	static int present = 0;
+	static int _striped_checked = 0;
+	static int _striped_present = 0;
 
-	if (!checked)
-		present = target_present("linear", 0) &&
+	if (!_striped_checked)
+		_striped_present = target_present("linear", 0) &&
 			  target_present("striped", 0);
 
-	checked = 1;
-	return present;
+	_striped_checked = 1;
+
+	return _striped_present;
 }
 #endif
 
-static void _destroy(const struct segment_type *segtype)
+static void _striped_destroy(const struct segment_type *segtype)
 {
 	dm_free((void *) segtype);
 }
 
 static struct segtype_handler _striped_ops = {
-	name:_name,
-	display:_display,
-	text_import_area_count:_text_import_area_count,
-	text_import:_text_import,
-	text_export:_text_export,
-	merge_segments:_merge_segments,
+	name:_striped_name,
+	display:_striped_display,
+	text_import_area_count:_striped_text_import_area_count,
+	text_import:_striped_text_import,
+	text_export:_striped_text_export,
+	merge_segments:_striped_merge_segments,
 #ifdef DEVMAPPER_SUPPORT
-	add_target_line:_add_target_line,
-	target_present:_target_present,
+	add_target_line:_striped_add_target_line,
+	target_present:_striped_target_present,
 #endif
-	destroy:_destroy,
+	destroy:_striped_destroy,
 };
 
 struct segment_type *init_striped_segtype(struct cmd_context *cmd)

Modified: lvm2/trunk/lib/zero/zero.c
==============================================================================
--- lvm2/trunk/lib/zero/zero.c	(original)
+++ lvm2/trunk/lib/zero/zero.c	Fri May  5 20:27:43 2006
@@ -24,12 +24,12 @@
 #include "lvm-string.h"
 #include "activate.h"
 
-static const char *_name(const struct lv_segment *seg)
+static const char *_zero_name(const struct lv_segment *seg)
 {
 	return seg->segtype->name;
 }
 
-static int _merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
+static int _zero_merge_segments(struct lv_segment *seg1, struct lv_segment *seg2)
 {
 	seg1->len += seg2->len;
 	seg1->area_len += seg2->area_len;
@@ -38,7 +38,7 @@
 }
 
 #ifdef DEVMAPPER_SUPPORT
-static int _add_target_line(struct dev_manager *dm, struct dm_pool *mem,
+static int _zero_add_target_line(struct dev_manager *dm, struct dm_pool *mem,
                                 struct config_tree *cft, void **target_state,
                                 struct lv_segment *seg,
                                 struct dm_tree_node *node, uint64_t len,
@@ -47,32 +47,33 @@
 	return dm_tree_node_add_zero_target(node, len);
 }
 
-static int _target_present(void)
+static int _zero_target_present(void)
 {
-	static int checked = 0;
-	static int present = 0;
+	static int _zero_checked = 0;
+	static int _zero_present = 0;
 
-	if (!checked)
-		present = target_present("zero", 0);
+	if (!_zero_checked)
+		_zero_present = target_present("zero", 0);
 
-	checked = 1;
-	return present;
+	_zero_checked = 1;
+
+	return _zero_present;
 }
 #endif
 
-static void _destroy(const struct segment_type *segtype)
+static void _zero_destroy(const struct segment_type *segtype)
 {
 	dm_free((void *) segtype);
 }
 
 static struct segtype_handler _zero_ops = {
-	name:_name,
-	merge_segments:_merge_segments,
+	name:_zero_name,
+	merge_segments:_zero_merge_segments,
 #ifdef DEVMAPPER_SUPPORT
-	add_target_line:_add_target_line,
-	target_present:_target_present,
+	add_target_line:_zero_add_target_line,
+	target_present:_zero_target_present,
 #endif
-	destroy:_destroy,
+	destroy:_zero_destroy,
 };
 
 struct segment_type *init_zero_segtype(struct cmd_context *cmd)

Modified: lvm2/trunk/make.tmpl.in
==============================================================================
--- lvm2/trunk/make.tmpl.in	(original)
+++ lvm2/trunk/make.tmpl.in	Fri May  5 20:27:43 2006
@@ -24,7 +24,7 @@
 MSGFMT = @MSGFMT@
 LN_S = @LN_S@
 LIBS = @LIBS@
-CFLAGS += @DEFS@
+DEFS += @DEFS@ @LVM_DEFS@
 CFLAGS += @CFLAGS@
 CLDFLAGS += @CLDFLAGS@
 LDDEPS += @LDDEPS@
@@ -54,7 +54,7 @@
 MAKEFLAGS = @JOBS@
 endif
 
-SUFFIXES = .c .d .o .so .a .po .pot .mo .dylib
+.SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib
 
 CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -D_FILE_OFFSET_BITS=64
 
@@ -63,18 +63,19 @@
 CFLAGS += @COPTIMISE_FLAG@
 
 ifeq ("@DEBUG@", "yes")
-  CFLAGS += -g -fno-omit-frame-pointer -DDEBUG
-  CFLAGS += -DDEBUG_MEM
+  CFLAGS += -g -fno-omit-frame-pointer
+  DEFS += -DDEBUG
+  DEFS += -DDEBUG_MEM
 endif
 
 ifeq ("@INTL@", "yes")
-  CFLAGS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
+  DEFS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
 endif
 
 LDFLAGS += -L$(top_srcdir)/lib -L$(libdir)
 
-#CFLAGS += -DDEBUG_POOL
-#CFLAGS += -DBOUNDS_CHECK
+#DEFS += -DDEBUG_POOL
+#DEFS += -DBOUNDS_CHECK
 
 #CFLAGS += -pg
 #LDFLAGS += -pg
@@ -98,13 +99,14 @@
 OBJECTS = $(SOURCES:%.c=%.o)
 POTFILES = $(SOURCES:%.c=%.pot)
 
-.PHONY: all install install_cluster pofile distclean clean
+.PHONY: all install install_cluster pofile distclean clean cflow
 .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
-.PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster)
+.PHONY: $(SUBDIRS.pofile) $(SUBDIRS.install_cluster) $(SUBDIRS.cflow)
 
 SUBDIRS.install := $(SUBDIRS:=.install)
 SUBDIRS.install_cluster := $(SUBDIRS:=.install_cluster)
 SUBDIRS.pofile := $(SUBDIRS:=.pofile)
+SUBDIRS.cflow := $(SUBDIRS:=.cflow)
 SUBDIRS.clean := $(SUBDIRS:=.clean)
 SUBDIRS.distclean := $(SUBDIRS:=.distclean)
 
@@ -137,17 +139,24 @@
 	$(MAKE) -C $(@:.pofile=) pofile
 endif
 
+ifneq ("@CFLOW_CMD@", "")
+cflow: $(SUBDIRS.cflow)
+
+$(SUBDIRS.cflow):
+	$(MAKE) -C $(@:.cflow=) cflow
+endif
+
 $(TARGETS): $(OBJECTS)
 
 %.o: %.c
-	$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
+	$(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $< -o $@
 
 %.pot: %.c Makefile
 	$(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
-		$(CFLAGS) $< > $@
+		$(DEFS) $(CFLAGS) $< > $@
 
 %.so: %.o
-	$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
+	$(CC) -c $(INCLUDES) $(DEFS) $(CFLAGS) $< -o $@
 
 ifeq ("@LIB_SUFFIX@","so")
 $(LIB_SHARED): $(OBJECTS) $(LDDEPS)
@@ -173,7 +182,7 @@
 	set -e; \
 	FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
 	DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
-	$(CC) -MM $(INCLUDES) $(CFLAGS) $< | \
+	$(CC) -MM $(INCLUDES) $(DEFS) $(CFLAGS) $< | \
 	sed "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" > $@; \
 	[ -s $@ ] || $(RM) $@
 

Modified: lvm2/trunk/man/vgchange.8
==============================================================================
--- lvm2/trunk/man/vgchange.8	(original)
+++ lvm2/trunk/man/vgchange.8	Fri May  5 20:27:43 2006
@@ -17,6 +17,8 @@
 .RB [ \-l | \-\-logicalvolume
 .IR MaxLogicalVolumes ]
 .RB [ \-P | \-\-partial]
+.RB [ \-s | \-\-physicalextentsize
+.IR PhysicalExtentSize [ \fBkKmMgGtT\fR ]]
 .RB [ -t | \-\-test]
 .RB [ \-v | \-\-verbose]
 .RB [ \-\-version ]
@@ -59,6 +61,27 @@
 Changes the maximum logical volume number of an existing inactive
 volume group.
 .TP
+.BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize\fR[\fBkKmMgGtT\fR]
+Changes the physical extent size on physical volumes of this volume group.
+A size suffix (k for kilobytes up to t for terabytes) is optional, megabytes
+is the default if no suffix is present.
+The default is 4 MB and it must be at least 1 KB and a power of 2.
+ 
+Before increasing the physical extent size, you might need to use lvresize,
+pvresize and/or pvmove so that everything fits.  For example, every
+contiguous range of extents used in a logical volume must start and 
+end on an extent boundary.
+ 
+If the volume group metadata uses lvm1 format, extents can vary in size from
+8KB to 16GB and there is a limit of 65534 extents in each logical volume.  The
+default of 4 MB leads to a maximum logical volume size of around 256GB.
+ 
+If the volume group metadata uses lvm2 format those restrictions do not apply,
+but having a large number of extents will slow down the tools but have no
+impact on I/O performance to the logical volume.  The smallest PE is 1KB.
+ 
+The 2.4 kernel has a limitation of 2TB per block device.
+.TP
 .BR \-x ", " \-\-resizeable { y | n }
 Enables or disables the extension/reduction of this volume group
 with/by physical volumes.

Modified: lvm2/trunk/man/vgcreate.8
==============================================================================
--- lvm2/trunk/man/vgcreate.8	(original)
+++ lvm2/trunk/man/vgcreate.8	Fri May  5 20:27:43 2006
@@ -59,17 +59,22 @@
 .BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize\fR[\fBkKmMgGtT\fR]
 Sets the physical extent size on physical volumes of this volume group.
 A size suffix (k for kilobytes up to t for terabytes) is optional, megabytes
-is the default if no suffix is present.  Values can be from 8 KB to 16 GB in
-powers of 2.  The default is 4 MB.
+is the default if no suffix is present.  
+The default is 4 MB and it must be at least 1 KB and a power of 2.
+
 Once this value has been set, it is difficult to change it without recreating
 the volume group which would involve backing up and restoring data on any 
-logical volumes.
-If the volume group metadata uses lvm1 format, there is a limit of 65534
-extents in each logical volume, so the default of 4 MB leads to a maximum 
-logical volume size of around 256GB.
-If the volume group metadata uses lvm2 format there is no such restriction,
-although having a large number of extents will slow down
-the tools but have no impact on I/O performance to the logical volume.
+logical volumes.  However, if no extents need moving for the new
+value to apply, it can be altered using vgchange \-s.
+
+If the volume group metadata uses lvm1 format, extents can vary in size from
+8KB to 16GB and there is a limit of 65534 extents in each logical volume.  The
+default of 4 MB leads to a maximum logical volume size of around 256GB.  
+
+If the volume group metadata uses lvm2 format those restrictions do not apply,
+but having a large number of extents will slow down the tools but have no
+impact on I/O performance to the logical volume.  The smallest PE is 1KB.
+
 The 2.4 kernel has a limitation of 2TB per block device.
 .SH EXAMPLES
 To create a volume group named

Modified: lvm2/trunk/tools/Makefile.in
==============================================================================
--- lvm2/trunk/tools/Makefile.in	(original)
+++ lvm2/trunk/tools/Makefile.in	Fri May  5 20:27:43 2006
@@ -86,7 +86,7 @@
 
 LVMLIBS = -llvm
 
-CLEAN_TARGETS = liblvm2cmd.so liblvm2cmd.a lvm lvm.static
+CLEAN_TARGETS = liblvm2cmd.so liblvm2cmd.a lvm lvm.static lvm.cflow lvm.xref lvm.tree lvm.rxref lvm.rtree
 
 ifeq ("@CMDLIB@", "yes")
 	TARGETS += liblvm2cmd.so
@@ -101,7 +101,7 @@
 	LVMLIBS += -ldevmapper
 endif
 
-CFLAGS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
+DEFS += -DLVM_SHARED_PATH=\"$(exec_prefix)/sbin/lvm\"
 
 include $(top_srcdir)/make.tmpl
 
@@ -125,6 +125,23 @@
 .PHONY: install_cmdlib_dynamic install_cmdlib_static \
 	install_tools_dynamic install_tools_static
 
+ifneq ("@CFLOW_CMD@", "")
+CFLOW_FLAGS += --cpp="$(CC) -E"
+.PHONY: lvm.cflow
+-include $(top_srcdir)/lib/liblvm.cflow
+lvm.cflow: $(SOURCES)
+	@CFLOW_CMD@ -o$@ $(CFLOW_FLAGS) $(INCLUDES) $(DEFS) $(SOURCES)
+lvm.rxref: $(SOURCES)
+	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" -r --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
+lvm.xref: $(SOURCES)
+	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" --omit-arguments -x $(INCLUDES) $(DEFS) $(SOURCES)
+lvm.rtree: $(SOURCES)
+	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" -r --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
+lvm.tree: $(SOURCES)
+	@CFLOW_CMD@ -o$@ --cpp="$(CC) -E" --omit-arguments -T -b $(INCLUDES) $(DEFS) $(SOURCES)
+cflow: lvm.cflow lvm.xref lvm.tree lvm.rtree lvm.rxref
+endif
+
 install_cmdlib_dynamic: liblvm2cmd.so
 	$(INSTALL) -D $(OWNER) $(GROUP) $(STRIP) liblvm2cmd.so \
 		$(libdir)/liblvm2cmd.so.$(LIB_VERSION)

Modified: lvm2/trunk/tools/commands.h
==============================================================================
--- lvm2/trunk/tools/commands.h	(original)
+++ lvm2/trunk/tools/commands.h	Fri May  5 20:27:43 2006
@@ -80,17 +80,26 @@
 
 xx(lvconvert,
    "Change logical volume layout",
-   "lvconvert " "\n"
+   "lvconvert "
+   "[-m|--mirrors Mirrors]\n"
    "\t[--alloc AllocationPolicy]\n"
    "\t[-d|--debug]\n"
    "\t[-h|-?|--help]\n"
-   "\t[-m|--mirrors Mirrors]\n"
-   "\t[-R|--regionsize MirrorLogRegionSize]\n"
    "\t[-v|--verbose]\n"
    "\t[--version]" "\n"
-   "\tLogicalVolume[Path] [PhysicalVolume[Path]...]\n",
+   "\tLogicalVolume[Path] [PhysicalVolume[Path]...]\n\n"
 
-   alloc_ARG, mirrors_ARG, regionsize_ARG, test_ARG)
+   "lvconvert "
+   "[-s|--snapshot]\n"
+   "\t[-c|--chunksize]\n"
+   "\t[-d|--debug]\n"
+   "\t[-h|-?|--help]\n"
+   "\t[-v|--verbose]\n"
+   "\t[-Z|--zero {y|n}]\n"
+   "\t[--version]" "\n"
+   "\tOriginalLogicalVolume[Path] SnapshotLogicalVolume[Path]\n",
+
+   alloc_ARG, chunksize_ARG, mirrors_ARG, snapshot_ARG, test_ARG, zero_ARG)
 
 xx(lvcreate,
    "Create a logical volume",
@@ -512,6 +521,7 @@
    "\t[--nosuffix]\n"
    "\t[-o|--options [+]Field[,Field]]\n"
    "\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
+   "\t[-P|--partial] " "\n"
    "\t[--segments]\n"
    "\t[--separator Separator]\n"
    "\t[--unbuffered]\n"
@@ -521,8 +531,8 @@
    "\t[PhysicalVolume [PhysicalVolume...]]\n",
    
    aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
-   nolocking_ARG, nosuffix_ARG, options_ARG, segments_ARG, separator_ARG,
-   sort_ARG, unbuffered_ARG, units_ARG)
+   nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, segments_ARG,
+   separator_ARG, sort_ARG, unbuffered_ARG, units_ARG)
 
 xx(pvscan,
    "List all physical volumes",

Modified: lvm2/trunk/tools/lvconvert.c
==============================================================================
--- lvm2/trunk/tools/lvconvert.c	(original)
+++ lvm2/trunk/tools/lvconvert.c	Fri May  5 20:27:43 2006
@@ -16,10 +16,20 @@
 #include "lv_alloc.h"
 
 struct lvconvert_params {
+	int snapshot;
+	int zero;
+
+	const char *origin;
 	const char *lv_name;
+	const char *vg_name;
+
+	uint32_t chunk_size;
+	uint32_t region_size;
+
 	uint32_t mirrors;
 	sign_t mirrors_sign;
-	uint32_t region_size;
+
+	struct segment_type *segtype;
 
 	alloc_policy_t alloc;
 
@@ -28,52 +38,165 @@
 	struct list *pvh;
 };
 
+static int _lvconvert_name_params(struct lvconvert_params *lp,
+				  struct cmd_context *cmd,
+				  int *pargc, char ***pargv)
+{
+	char *ptr;
+	const char *vg_name = NULL;
+
+	if (lp->snapshot) {
+		if (!*pargc) {
+			log_error("Please specify a logical volume to act as "
+				  "the snapshot origin.");
+			return 0;
+		}
+
+		lp->origin = *pargv[0];
+		(*pargv)++, (*pargc)--;
+		if (!(lp->vg_name = extract_vgname(cmd, lp->origin))) {
+			log_error("The origin name should include the "
+				  "volume group.");
+			return 0;
+		}
+
+		/* Strip the volume group from the origin */
+		if ((ptr = strrchr(lp->origin, (int) '/')))
+			lp->origin = ptr + 1;
+	}
+
+	if (!*pargc) {
+		log_error("Please provide logical volume path");
+		return 0;
+	}
+
+	lp->lv_name = (*pargv)[0];
+	(*pargv)++, (*pargc)--;
+
+	if (strchr(lp->lv_name, '/') &&
+	    (vg_name = extract_vgname(cmd, lp->lv_name)) &&
+	    lp->vg_name && strcmp(vg_name, lp->vg_name)) {
+		log_error("Please use a single volume group name "
+			  "(\"%s\" or \"%s\")", vg_name, lp->vg_name);
+		return 0;
+	}
+
+	if (!lp->vg_name)
+		lp->vg_name = vg_name;
+
+	if (!validate_name(lp->vg_name)) {
+		log_error("Please provide a valid volume group name");
+		return 0;
+	}
+
+	if ((ptr = strrchr(lp->lv_name, '/')))
+		lp->lv_name = ptr + 1;
+
+	if (!apply_lvname_restrictions(lp->lv_name))
+		return_0;
+
+	return 1;
+}
+
 static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
 			int argc, char **argv)
 {
 	memset(lp, 0, sizeof(*lp));
 
+	if (arg_count(cmd, mirrors_ARG) + arg_count(cmd, snapshot_ARG) != 1) {
+		log_error("Exactly one of --mirrors or --snapshot arguments "
+			  "required.");
+		return 0;
+	}
+
+	if (arg_count(cmd, snapshot_ARG))
+		lp->snapshot = 1;
+
+	if (arg_count(cmd, mirrors_ARG)) {
+		lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0);
+		lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, 0);
+	}
+
 	lp->alloc = ALLOC_INHERIT;
 	if (arg_count(cmd, alloc_ARG))
 		lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG,
 							    lp->alloc);
 
-	if (!arg_count(cmd, mirrors_ARG)) {
-		log_error("--mirrors argument required");
-		return 0;
-	}
+	if (lp->snapshot) {
+		if (arg_count(cmd, regionsize_ARG)) {
+			log_error("--regionsize is only available with mirrors");
+			return 0;
+		}
+
+		if (arg_sign_value(cmd, chunksize_ARG, 0) == SIGN_MINUS) {
+			log_error("Negative chunk size is invalid");
+			return 0;
+		}
+		lp->chunk_size = 2 * arg_uint_value(cmd, chunksize_ARG, 8);
+		if (lp->chunk_size < 8 || lp->chunk_size > 1024 ||
+		    (lp->chunk_size & (lp->chunk_size - 1))) {
+			log_error("Chunk size must be a power of 2 in the "
+				  "range 4K to 512K");
+			return 0;
+		}
+		log_verbose("Setting chunksize to %d sectors.", lp->chunk_size);
 
-	lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0);
-	lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, 0);
+		if (!(lp->segtype = get_segtype_from_string(cmd, "snapshot")))
+			return_0;
 
-	/*
-	 * --regionsize is only valid when converting an LV into a mirror.
-	 * This is checked when we know the state of the LV being converted.
-	 */
-	if (arg_count(cmd, regionsize_ARG)) {
-		if (arg_sign_value(cmd, regionsize_ARG, 0) == SIGN_MINUS) {
-			log_error("Negative regionsize is invalid");
+		lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
+						(lp->segtype->flags &
+						 SEG_CANNOT_BE_ZEROED) ?
+						"n" : "y"), "n");
+
+	} else {	/* Mirrors */
+		if (arg_count(cmd, chunksize_ARG)) {
+			log_error("--chunksize is only available with "
+				  "snapshots");
 			return 0;
 		}
-		lp->region_size = 2 * arg_uint_value(cmd, regionsize_ARG, 0);
-	} else
-		lp->region_size = 2 * find_config_int(cmd->cft->root,
-					"activation/mirror_region_size",
-					DEFAULT_MIRROR_REGION_SIZE);
 
-	if (lp->region_size & (lp->region_size - 1)) {
-		log_error("Region size (%" PRIu32 ") must be a power of 2",
-			  lp->region_size);
-		return 0;
+		if (arg_count(cmd, zero_ARG)) {
+			log_error("--zero is only available with snapshots");
+			return 0;
+		}
+
+		/*
+	 	 * --regionsize is only valid if converting an LV into a mirror.
+	 	 * Checked when we know the state of the LV being converted.
+	 	 */
+		if (arg_count(cmd, regionsize_ARG)) {
+			if (arg_sign_value(cmd, regionsize_ARG, 0) ==
+				    SIGN_MINUS) {
+				log_error("Negative regionsize is invalid");
+				return 0;
+			}
+			lp->region_size = 2 * arg_uint_value(cmd,
+							     regionsize_ARG, 0);
+		} else
+			lp->region_size = 2 * find_config_int(cmd->cft->root,
+						"activation/mirror_region_size",
+						DEFAULT_MIRROR_REGION_SIZE);
+	
+		if (lp->region_size & (lp->region_size - 1)) {
+			log_error("Region size (%" PRIu32
+				  ") must be a power of 2", lp->region_size);
+			return 0;
+		}
+
+		if (!(lp->segtype = get_segtype_from_string(cmd, "striped")))
+			return_0;
 	}
 
-	if (!argc) {
-		log_error("Please give logical volume path");
+	if (activation() && lp->segtype->ops->target_present &&
+	    !lp->segtype->ops->target_present()) {
+		log_error("%s: Required device-mapper target(s) not "
+			  "detected in your kernel", lp->segtype->name);
 		return 0;
 	}
 
-	lp->lv_name = argv[0];
-	argv++, argc--;
+	if (!_lvconvert_name_params(lp, cmd, &argc, &argv))
+		return_0;
 
 	lp->pv_count = argc;
 	lp->pvs = argv;
@@ -89,7 +212,6 @@
 	struct alloc_handle *ah = NULL;
 	struct logical_volume *log_lv;
 	struct list *parallel_areas;
-	struct segment_type *segtype;
 
 	seg = first_seg(lv);
 	existing_mirrors = seg->area_count;
@@ -121,10 +243,9 @@
 			return 1;
 		}
 
-		if (!remove_mirror_images(seg, 1, lp->pv_count ? lp->pvh : NULL, 1)) {
-			stack;
-			return 0;
-		}
+		if (!remove_mirror_images(seg, 1,
+					  lp->pv_count ? lp->pvh : NULL, 1))
+			return_0;
 	} else {		/* mirrors > 1 */
 		if ((lv->status & MIRRORED)) {
 			if (list_size(&lv->segments) != 1) {
@@ -149,10 +270,10 @@
 				return 0;
 			} else {
 				/* Reduce number of mirrors */
-				if (!remove_mirror_images(seg, lp->mirrors, lp->pv_count ? lp->pvh : NULL, 0)) {
-					stack;
-					return 0;
-				}
+				if (!remove_mirror_images(seg, lp->mirrors,
+							  lp->pv_count ?
+							  lp->pvh : NULL, 0))
+					return_0;
 			}
 		} else {
 			/* Make existing LV into mirror set */
@@ -166,22 +287,16 @@
 				}
 			}
 
-			if (!(parallel_areas = build_parallel_areas_from_lv(cmd, lv))) {
-				stack;
-				return 0;
-			}
-
-			segtype = get_segtype_from_string(cmd, "striped");
+			if (!(parallel_areas = build_parallel_areas_from_lv(cmd, lv)))
+				return_0;
 
-			if (!(ah = allocate_extents(lv->vg, NULL, segtype, 1,
-						    lp->mirrors - 1, 1,
+			if (!(ah = allocate_extents(lv->vg, NULL, lp->segtype,
+						    1, lp->mirrors - 1, 1,
 						    lv->le_count * (lp->mirrors - 1),
 						    NULL, 0, 0, lp->pvh,
 						    lp->alloc,
-						    parallel_areas))) {
-				stack;
-				return 0;
-			}
+						    parallel_areas)))
+				return_0;
 
 			lp->region_size = adjusted_mirror_region_size(lv->vg->extent_size,
 								      lv->le_count,
@@ -195,20 +310,17 @@
 			}
 
 			if (!create_mirror_layers(ah, 1, lp->mirrors, lv,
-						  segtype, 0, lp->region_size,
-						  log_lv)) {
-				stack;
-				return 0;
-			}
+						  lp->segtype, 0,
+						  lp->region_size,
+						  log_lv))
+				return_0;
 		}
 	}
 
 	log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
 
-	if (!vg_write(lv->vg)) {
-		stack;
-		return 0;
-	}
+	if (!vg_write(lv->vg))
+		return_0;
 
 	backup(lv->vg);
 
@@ -235,6 +347,68 @@
 	return 1;
 }
 
+static int lvconvert_snapshot(struct cmd_context *cmd,
+			      struct logical_volume *lv,
+			      struct lvconvert_params *lp)
+{
+	struct logical_volume *org;
+
+	if (!(org = find_lv(lv->vg, lp->origin))) {
+		log_error("Couldn't find origin volume '%s'.", lp->origin);
+		return 0;
+	}
+
+	if (org->status & (LOCKED|PVMOVE) || lv_is_cow(org)) {
+		log_error("Unable to create a snapshot of a %s LV.",
+			  org->status & LOCKED ? "locked" :
+			  org->status & PVMOVE ? "pvmove" : "snapshot");
+		return 0;
+	}
+
+	if (!lp->zero)
+		log_error("WARNING: \"%s\" not zeroed", lv->name);
+	else if (!zero_lv(cmd, lv)) {
+			log_error("Aborting. Failed to wipe snapshot "
+				  "exception store.");
+			return 0;
+	}
+
+	if (!deactivate_lv(cmd, lv)) {
+		log_error("Couldn't deactivate LV %s.", lv->name);
+		return 0;
+	}
+
+	if (!vg_add_snapshot(lv->vg->fid, NULL, org, lv, NULL, org->le_count,
+			     lp->chunk_size)) {
+		log_error("Couldn't create snapshot.");
+		return 0;
+	}
+
+	/* store vg on disk(s) */
+	if (!vg_write(lv->vg))
+		return_0;
+
+	backup(lv->vg);
+
+	if (!suspend_lv(cmd, org)) {
+		log_error("Failed to suspend origin %s", org->name);
+		vg_revert(lv->vg);
+		return 0;
+	}
+
+	if (!vg_commit(lv->vg))
+		return_0;
+
+	if (!resume_lv(cmd, org)) {
+		log_error("Problem reactivating origin %s", org->name);
+		return 0;
+	}
+
+	log_print("Logical volume %s converted to snapshot.", lv->name);
+
+	return 1;
+}
+
 static int lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv,
 			    void *handle)
 {
@@ -267,6 +441,11 @@
 			return ECMD_FAILED;
 		if (!lvconvert_mirrors(cmd, lv, lp))
 			return ECMD_FAILED;
+	} else if (lp->snapshot) {
+		if (!archive(lv->vg))
+			return ECMD_FAILED;
+		if (!lvconvert_snapshot(cmd, lv, lp))
+			return ECMD_FAILED;
 	}
 
 	return ECMD_PROCESSED;
@@ -274,8 +453,6 @@
 
 int lvconvert(struct cmd_context * cmd, int argc, char **argv)
 {
-	const char *vg_name;
-	char *st;
 	int consistent = 1;
 	struct volume_group *vg;
 	struct lv_list *lvl;
@@ -287,41 +464,31 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	vg_name = extract_vgname(cmd, lp.lv_name);
-
-	if (!validate_name(vg_name)) {
-		log_error("Please provide a valid volume group name");
-		return EINVALID_CMD_LINE;
-	}
-
-	if ((st = strrchr(lp.lv_name, '/')))
-		lp.lv_name = st + 1;
-
-	log_verbose("Checking for existing volume group \"%s\"", vg_name);
+	log_verbose("Checking for existing volume group \"%s\"", lp.vg_name);
 
-	if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
-		log_error("Can't get lock for %s", vg_name);
+	if (!lock_vol(cmd, lp.vg_name, LCK_VG_WRITE)) {
+		log_error("Can't get lock for %s", lp.vg_name);
 		return ECMD_FAILED;
 	}
 
-	if (!(vg = vg_read(cmd, vg_name, &consistent))) {
-		log_error("Volume group \"%s\" doesn't exist", vg_name);
+	if (!(vg = vg_read(cmd, lp.vg_name, NULL, &consistent))) {
+		log_error("Volume group \"%s\" doesn't exist", lp.vg_name);
 		goto error;
 	}
 
 	if (vg->status & EXPORTED_VG) {
-		log_error("Volume group \"%s\" is exported", vg_name);
+		log_error("Volume group \"%s\" is exported", lp.vg_name);
 		goto error;
 	}
 
 	if (!(vg->status & LVM_WRITE)) {
-		log_error("Volume group \"%s\" is read-only", vg_name);
+		log_error("Volume group \"%s\" is read-only", lp.vg_name);
 		goto error;
 	}
 
 	if (!(lvl = find_lv_in_vg(vg, lp.lv_name))) {
 		log_error("Logical volume \"%s\" not found in "
-			  "volume group \"%s\"", lp.lv_name, vg_name);
+			  "volume group \"%s\"", lp.lv_name, lp.vg_name);
 		goto error;
 	}
 
@@ -337,6 +504,6 @@
 	ret = lvconvert_single(cmd, lvl->lv, &lp);
 
 error:
-	unlock_vg(cmd, vg_name);
+	unlock_vg(cmd, lp.vg_name);
 	return ret;
 }

Modified: lvm2/trunk/tools/lvcreate.c
==============================================================================
--- lvm2/trunk/tools/lvcreate.c	(original)
+++ lvm2/trunk/tools/lvcreate.c	Fri May  5 20:27:43 2006
@@ -50,8 +50,9 @@
 	char **pvs;
 };
 
-static int _read_name_params(struct lvcreate_params *lp,
-			     struct cmd_context *cmd, int *pargc, char ***pargv)
+static int _lvcreate_name_params(struct lvcreate_params *lp,
+				 struct cmd_context *cmd,
+				 int *pargc, char ***pargv)
 {
 	int argc = *pargc;
 	char **argv = *pargv, *ptr;
@@ -260,8 +261,8 @@
 	return 1;
 }
 
-static int _read_params(struct lvcreate_params *lp, struct cmd_context *cmd,
-			int argc, char **argv)
+static int _lvcreate_params(struct lvcreate_params *lp, struct cmd_context *cmd,
+			    int argc, char **argv)
 {
 	int contiguous;
 
@@ -352,7 +353,7 @@
 		return 0;
 	}
 
-	if (!_read_name_params(lp, cmd, &argc, &argv) ||
+	if (!_lvcreate_name_params(lp, cmd, &argc, &argv) ||
 	    !_read_size_params(lp, cmd, &argc, &argv) ||
 	    !_read_stripe_params(lp, cmd, &argc, &argv) ||
 	    !_read_mirror_params(lp, cmd, &argc, &argv)) {
@@ -444,7 +445,7 @@
 	/* does VG exist? */
 	log_verbose("Finding volume group \"%s\"", lp->vg_name);
 
-	if (!(vg = vg_read(cmd, lp->vg_name, &consistent))) {
+	if (!(vg = vg_read(cmd, lp->vg_name, NULL, &consistent))) {
 		log_error("Volume group \"%s\" doesn't exist", lp->vg_name);
 		return 0;
 	}
@@ -755,7 +756,7 @@
 
 	memset(&lp, 0, sizeof(lp));
 
-	if (!_read_params(&lp, cmd, argc, argv))
+	if (!_lvcreate_params(&lp, cmd, argc, argv))
 		return EINVALID_CMD_LINE;
 
 	if (!lock_vol(cmd, lp.vg_name, LCK_VG_WRITE)) {

Modified: lvm2/trunk/tools/lvdisplay.c
==============================================================================
--- lvm2/trunk/tools/lvdisplay.c	(original)
+++ lvm2/trunk/tools/lvdisplay.c	Fri May  5 20:27:43 2006
@@ -18,8 +18,7 @@
 static int _lvdisplay_single(struct cmd_context *cmd, struct logical_volume *lv,
 			     void *handle)
 {
-	if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
-	    !(lv_is_cow(lv)))
+	if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
 		return ECMD_PROCESSED;
 
 	if (arg_count(cmd, colon_ARG))

Modified: lvm2/trunk/tools/lvremove.c
==============================================================================
--- lvm2/trunk/tools/lvremove.c	(original)
+++ lvm2/trunk/tools/lvremove.c	Fri May  5 20:27:43 2006
@@ -83,7 +83,7 @@
 	}
 
 	if (lv_is_cow(lv)) {
-		origin = find_cow(lv)->origin;
+		origin = origin_from_cow(lv);
 		log_verbose("Removing snapshot %s", lv->name);
 		if (!vg_remove_snapshot(lv)) {
 			stack;

Modified: lvm2/trunk/tools/lvrename.c
==============================================================================
--- lvm2/trunk/tools/lvrename.c	(original)
+++ lvm2/trunk/tools/lvrename.c	Fri May  5 20:27:43 2006
@@ -106,7 +106,7 @@
 		return ECMD_FAILED;
 	}
 
-	if (!(vg = vg_read(cmd, vg_name, &consistent))) {
+	if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
 		log_error("Volume group \"%s\" doesn't exist", vg_name);
 		goto error;
 	}

Modified: lvm2/trunk/tools/lvresize.c
==============================================================================
--- lvm2/trunk/tools/lvresize.c	(original)
+++ lvm2/trunk/tools/lvresize.c	Fri May  5 20:27:43 2006
@@ -45,8 +45,8 @@
 	char **argv;
 };
 
-static int _read_params(struct cmd_context *cmd, int argc, char **argv,
-			struct lvresize_params *lp)
+static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
+			    struct lvresize_params *lp)
 {
 	const char *cmd_name;
 	char *st;
@@ -116,7 +116,6 @@
 {
 	struct volume_group *vg;
 	struct logical_volume *lv;
-	struct lv_segment *snap_seg;
 	struct lvinfo info;
 	uint32_t stripesize_extents = 0;
 	uint32_t seg_stripes = 0, seg_stripesize = 0, seg_size = 0;
@@ -134,7 +133,7 @@
 	char size_buf[SIZE_BUF];
 	char lv_path[PATH_MAX];
 
-	if (!(vg = vg_read(cmd, lp->vg_name, &consistent))) {
+	if (!(vg = vg_read(cmd, lp->vg_name, NULL, &consistent))) {
 		log_error("Volume group %s doesn't exist", lp->vg_name);
 		return ECMD_FAILED;
 	}
@@ -521,8 +520,8 @@
 	backup(vg);
 
 	/* If snapshot, must suspend all associated devices */
-	if ((snap_seg = find_cow(lv)))
-		lock_lv = snap_seg->origin;
+	if (lv_is_cow(lv))
+		lock_lv = origin_from_cow(lv);
 	else
 		lock_lv = lv;
 
@@ -562,7 +561,7 @@
 
 	memset(&lp, 0, sizeof(lp));
 
-	if (!_read_params(cmd, argc, argv, &lp))
+	if (!_lvresize_params(cmd, argc, argv, &lp))
 		return EINVALID_CMD_LINE;
 
 	log_verbose("Finding volume group %s", lp.vg_name);

Modified: lvm2/trunk/tools/lvscan.c
==============================================================================
--- lvm2/trunk/tools/lvscan.c	(original)
+++ lvm2/trunk/tools/lvscan.c	Fri May  5 20:27:43 2006
@@ -27,9 +27,7 @@
 
 	const char *active_str, *snapshot_str;
 
-	/* FIXME Avoid snapshot special-case */
-	if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
-	    !(lv_is_cow(lv)))
+	if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
 		return ECMD_PROCESSED;
 
 	inkernel = lv_info(cmd, lv, &info, 1) && info.exists;
@@ -43,10 +41,9 @@
 					snap_active = 0;
 		}
 		snap_seg = NULL;
-	} else if ((snap_seg = find_cow(lv))) {
+	} else if (lv_is_cow(lv)) {
 		if (inkernel &&
-		    (snap_active = lv_snapshot_percent(snap_seg->cow,
-						       &snap_percent)))
+		    (snap_active = lv_snapshot_percent(lv, &snap_percent)))
 			if (snap_percent < 0 || snap_percent >= 100)
 				snap_active = 0;
 	}

Modified: lvm2/trunk/tools/pvchange.c
==============================================================================
--- lvm2/trunk/tools/pvchange.c	(original)
+++ lvm2/trunk/tools/pvchange.c	Fri May  5 20:27:43 2006
@@ -60,7 +60,7 @@
 			return 0;
 		}
 
-		if (!(vg = vg_read(cmd, pv->vg_name, &consistent))) {
+		if (!(vg = vg_read(cmd, pv->vg_name, NULL, &consistent))) {
 			unlock_vg(cmd, pv->vg_name);
 			log_error("Unable to find volume group of \"%s\"",
 				  pv_name);

Modified: lvm2/trunk/tools/pvmove.c
==============================================================================
--- lvm2/trunk/tools/pvmove.c	(original)
+++ lvm2/trunk/tools/pvmove.c	Fri May  5 20:27:43 2006
@@ -62,7 +62,7 @@
 		return NULL;
 	}
 
-	if (!(vg = vg_read(cmd, vgname, &consistent)) || !consistent) {
+	if (!(vg = vg_read(cmd, vgname, NULL, &consistent)) || !consistent) {
 		log_error("Volume group \"%s\" doesn't exist", vgname);
 		unlock_vg(cmd, vgname);
 		return NULL;

Modified: lvm2/trunk/tools/pvremove.c
==============================================================================
--- lvm2/trunk/tools/pvremove.c	(original)
+++ lvm2/trunk/tools/pvremove.c	Fri May  5 20:27:43 2006
@@ -33,9 +33,14 @@
 		return 0;
 	}
 
-	/* is there a pv here already */
-	if (!(pv = pv_read(cmd, name, NULL, NULL, 1)))
-		return 1;
+	/* Is there a pv here already? */
+	/* If not, this is an error unless you used -f. */
+	if (!(pv = pv_read(cmd, name, NULL, NULL, 1))) {
+		if (arg_count(cmd, force_ARG))
+			return 1;
+		else
+			return 0;
+	}
 
 	/* orphan ? */
 	if (!pv->vg_name[0])

Modified: lvm2/trunk/tools/pvresize.c
==============================================================================
--- lvm2/trunk/tools/pvresize.c	(original)
+++ lvm2/trunk/tools/pvresize.c	Fri May  5 20:27:43 2006
@@ -70,7 +70,7 @@
 			return ECMD_FAILED;
 		}
 
-		if (!(vg = vg_read(cmd, vg_name, &consistent))) {
+		if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
 			unlock_vg(cmd, vg_name);
 			log_error("Unable to find volume group of \"%s\"",
 				  pv_name);

Modified: lvm2/trunk/tools/reporter.c
==============================================================================
--- lvm2/trunk/tools/reporter.c	(original)
+++ lvm2/trunk/tools/reporter.c	Fri May  5 20:27:43 2006
@@ -35,9 +35,7 @@
 static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv,
 		       void *handle)
 {
-	/* FIXME Avoid snapshot special-case */
-	if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
-	    !(lv_is_cow(lv)))
+	if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
 		return ECMD_PROCESSED;
 
 	if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL))
@@ -67,7 +65,7 @@
 		return ECMD_FAILED;
 	}
 
-	if (!(vg = vg_read(cmd, pv->vg_name, &consistent))) {
+	if (!(vg = vg_read(cmd, pv->vg_name, NULL, &consistent))) {
 		log_error("Can't read %s: skipping", pv->vg_name);
 		unlock_vg(cmd, pv->vg_name);
 		return ECMD_FAILED;
@@ -83,9 +81,7 @@
 static int _lvsegs_single(struct cmd_context *cmd, struct logical_volume *lv,
 			  void *handle)
 {
-	/* FIXME Avoid snapshot special-case */
-	if (!arg_count(cmd, all_ARG) && !(lv->status & VISIBLE_LV) &&
-	    !(lv_is_cow(lv)))
+	if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
 		return ECMD_PROCESSED;
 
 	return process_each_segment_in_lv(cmd, lv, handle, _segs_single);
@@ -110,7 +106,7 @@
 			return ECMD_FAILED;
 		}
 
-		if (!(vg = vg_read(cmd, pv->vg_name, &consistent))) {
+		if (!(vg = vg_read(cmd, pv->vg_name, (char *)&pv->vgid, &consistent))) {
 			log_error("Can't read %s: skipping", pv->vg_name);
 			unlock_vg(cmd, pv->vg_name);
 			return ECMD_FAILED;

Modified: lvm2/trunk/tools/toollib.c
==============================================================================
--- lvm2/trunk/tools/toollib.c	(original)
+++ lvm2/trunk/tools/toollib.c	Fri May  5 20:27:43 2006
@@ -19,6 +19,62 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 
+/* Command line args */
+unsigned int arg_count(struct cmd_context *cmd, int a)
+{
+	return cmd->args[a].count;
+}
+
+const char *arg_value(struct cmd_context *cmd, int a)
+{
+	return cmd->args[a].value;
+}
+
+const char *arg_str_value(struct cmd_context *cmd, int a, const char *def)
+{
+	return arg_count(cmd, a) ? cmd->args[a].value : def;
+}
+
+int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def)
+{
+	return arg_count(cmd, a) ? cmd->args[a].i_value : def;
+}
+
+uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def)
+{
+	return arg_count(cmd, a) ? cmd->args[a].ui_value : def;
+}
+
+int64_t arg_int64_value(struct cmd_context *cmd, int a, const uint64_t def)
+{
+	return arg_count(cmd, a) ? cmd->args[a].i64_value : def;
+}
+
+uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def)
+{
+	return arg_count(cmd, a) ? cmd->args[a].ui64_value : def;
+}
+
+const void *arg_ptr_value(struct cmd_context *cmd, int a, const void *def)
+{
+	return arg_count(cmd, a) ? cmd->args[a].ptr : def;
+}
+
+sign_t arg_sign_value(struct cmd_context *cmd, int a, const sign_t def)
+{
+	return arg_count(cmd, a) ? cmd->args[a].sign : def;
+}
+
+int arg_count_increment(struct cmd_context *cmd, int a)
+{
+	return cmd->args[a].count++;
+}
+
+const char *command_name(struct cmd_context *cmd)
+{
+	return cmd->command->name;
+}
+
 /*
  * Metadata iteration functions
  */
@@ -241,7 +297,7 @@
 			consistent = 1;
 		else
 			consistent = 0;
-		if (!(vg = vg_read(cmd, vgname, &consistent)) || !consistent) {
+		if (!(vg = vg_read(cmd, vgname, NULL, &consistent)) || !consistent) {
 			unlock_vg(cmd, vgname);
 			if (!vg)
 				log_error("Volume group \"%s\" "
@@ -250,7 +306,6 @@
 				log_error("Volume group \"%s\" "
 					  "inconsistent", vgname);
 			if (!vg || !(vg = recover_vg(cmd, vgname, lock_type))) {
-				unlock_vg(cmd, vgname);
 				if (ret_max < ECMD_FAILED)
 					ret_max = ECMD_FAILED;
 				continue;
@@ -332,6 +387,7 @@
 }
 
 static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
+			   const char *vgid,
 			   struct list *tags, struct list *arg_vgnames,
 			   int lock_type, int consistent, void *handle,
 			   int ret_max,
@@ -349,7 +405,7 @@
 	}
 
 	log_verbose("Finding volume group \"%s\"", vg_name);
-	vg = vg_read(cmd, vg_name, &consistent);
+	vg = vg_read(cmd, vg_name, vgid, &consistent);
 
 	if (!list_empty(tags)) {
 		/* Only process if a tag matches or it's on arg_vgnames */
@@ -381,10 +437,10 @@
 	int ret_max = 0;
 
 	struct str_list *sl;
-	struct list *vgnames;
+	struct list *vgnames, *vgids;
 	struct list arg_vgnames, tags;
 
-	const char *vg_name;
+	const char *vg_name, *vgid;
 	char *dev_dir = cmd->dev_dir;
 
 	list_init(&tags);
@@ -434,19 +490,30 @@
 
 	if (!argc || !list_empty(&tags)) {
 		log_verbose("Finding all volume groups");
-		if (!(vgnames = get_vgs(cmd, 0)) || list_empty(vgnames)) {
+		if (!(vgids = get_vgids(cmd, 0)) || list_empty(vgids)) {
 			log_error("No volume groups found");
 			return ret_max;
 		}
-	}
-
-	list_iterate_items(sl, vgnames) {
-		vg_name = sl->str;
-		if (!vg_name || !*vg_name)
-			continue;	/* FIXME Unnecessary? */
-		ret_max = _process_one_vg(cmd, vg_name, &tags, &arg_vgnames,
-					  lock_type, consistent, handle,
-					  ret_max, process_single);
+		list_iterate_items(sl, vgids) {
+			vgid = sl->str;
+			if (!vgid || !(vg_name = vgname_from_vgid(cmd->mem, vgid)) ||
+			    !*vg_name)
+				continue;
+			ret_max = _process_one_vg(cmd, vg_name, vgid, &tags,
+						  &arg_vgnames,
+					  	  lock_type, consistent, handle,
+					  	  ret_max, process_single);
+		}
+	} else {
+		list_iterate_items(sl, vgnames) {
+			vg_name = sl->str;
+			if (!vg_name || !*vg_name)
+				continue;	/* FIXME Unnecessary? */
+			ret_max = _process_one_vg(cmd, vg_name, NULL, &tags,
+						  &arg_vgnames,
+					  	  lock_type, consistent, handle,
+					  	  ret_max, process_single);
+		}
 	}
 
 	return ret_max;
@@ -582,7 +649,7 @@
 		if (!list_empty(&tags) && (vgnames = get_vgs(cmd, 0)) &&
 		    !list_empty(vgnames)) {
 			list_iterate_items(sll, vgnames) {
-				vg = vg_read(cmd, sll->str, &consistent);
+				vg = vg_read(cmd, sll->str, NULL, &consistent);
 				if (!consistent)
 					continue;
 				ret = process_each_pv_in_vg(cmd, vg, &tags,
@@ -967,7 +1034,7 @@
 		return NULL;
 	}
 
-	return vg_read(cmd, vgname, &consistent);
+	return vg_read(cmd, vgname, NULL, &consistent);
 }
 
 int apply_lvname_restrictions(const char *name)
@@ -1046,7 +1113,7 @@
 	 * <clausen> also, more than 4k
 	 * <clausen> say, reiserfs puts it's superblock 32k in, IIRC
 	 * <ejt_> k, I'll drop a fixme to that effect
-	 *           (I know the device is at least 4k, but not 32k)
+	 *	   (I know the device is at least 4k, but not 32k)
 	 */
 	if (!(name = dm_pool_alloc(cmd->mem, PATH_MAX))) {
 		log_error("Name allocation failed - device not zeroed");

Modified: lvm2/trunk/tools/tools.h
==============================================================================
--- lvm2/trunk/tools/tools.h	(original)
+++ lvm2/trunk/tools/tools.h	Fri May  5 20:27:43 2006
@@ -138,67 +138,18 @@
 char yes_no_prompt(const char *prompt, ...);
 
 /* we use the enums to access the switches */
-static inline unsigned int arg_count(struct cmd_context *cmd, int a)
-{
-	return cmd->args[a].count;
-}
+unsigned int arg_count(struct cmd_context *cmd, int a);
+const char *arg_value(struct cmd_context *cmd, int a);
+const char *arg_str_value(struct cmd_context *cmd, int a, const char *def);
+int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def); 
+uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def);
+int64_t arg_int64_value(struct cmd_context *cmd, int a, const uint64_t def);
+uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def);
+const void *arg_ptr_value(struct cmd_context *cmd, int a, const void *def);
+sign_t arg_sign_value(struct cmd_context *cmd, int a, const sign_t def);
+int arg_count_increment(struct cmd_context *cmd, int a);
 
-static inline const char *arg_value(struct cmd_context *cmd, int a)
-{
-	return cmd->args[a].value;
-}
-
-static inline const char *arg_str_value(struct cmd_context *cmd, int a,
-					const char *def)
-{
-	return arg_count(cmd, a) ? cmd->args[a].value : def;
-}
-
-static inline int32_t arg_int_value(struct cmd_context *cmd, int a,
-					  const int32_t def)
-{
-	return arg_count(cmd, a) ? cmd->args[a].i_value : def;
-}
-
-static inline uint32_t arg_uint_value(struct cmd_context *cmd, int a,
-					    const uint32_t def)
-{
-	return arg_count(cmd, a) ? cmd->args[a].ui_value : def;
-}
-
-static inline int64_t arg_int64_value(struct cmd_context *cmd, int a,
-					    const uint64_t def)
-{
-	return arg_count(cmd, a) ? cmd->args[a].i64_value : def;
-}
-
-static inline uint64_t arg_uint64_value(struct cmd_context *cmd, int a,
-					      const uint64_t def)
-{
-	return arg_count(cmd, a) ? cmd->args[a].ui64_value : def;
-}
-
-static inline const void *arg_ptr_value(struct cmd_context *cmd, int a,
-					const void *def)
-{
-	return arg_count(cmd, a) ? cmd->args[a].ptr : def;
-}
-
-static inline sign_t arg_sign_value(struct cmd_context *cmd, int a,
-					  const sign_t def)
-{
-	return arg_count(cmd, a) ? cmd->args[a].sign : def;
-}
-
-static inline int arg_count_increment(struct cmd_context *cmd, int a)
-{
-	return cmd->args[a].count++;
-}
-
-static inline const char *command_name(struct cmd_context *cmd)
-{
-	return cmd->command->name;
-}
+const char *command_name(struct cmd_context *cmd);
 
 int pvmove_poll(struct cmd_context *cmd, const char *pv, unsigned background);
 

Modified: lvm2/trunk/tools/vgchange.c
==============================================================================
--- lvm2/trunk/tools/vgchange.c	(original)
+++ lvm2/trunk/tools/vgchange.c	Fri May  5 20:27:43 2006
@@ -198,7 +198,7 @@
 
 	if (clustered) {
         	list_iterate_items(lvl, &vg->lvs) {
-                	if (lvl->lv->origin_count || lvl->lv->snapshot) {
+                	if (lv_is_origin(lvl->lv) || lv_is_cow(lvl->lv)) {
 				log_error("Volume group %s contains snapshots "
 					  "that are not yet supported.",
 					  vg->name);

Modified: lvm2/trunk/tools/vgexport.c
==============================================================================
--- lvm2/trunk/tools/vgexport.c	(original)
+++ lvm2/trunk/tools/vgexport.c	Fri May  5 20:27:43 2006
@@ -19,6 +19,9 @@
 			   struct volume_group *vg, int consistent,
 			   void *handle)
 {
+	struct pv_list *pvl;
+	struct physical_volume *pv;
+
 	if (!vg) {
 		log_error("Unable to find volume group \"%s\"", vg_name);
 		goto error;
@@ -50,6 +53,11 @@
 
 	vg->status |= EXPORTED_VG;
 
+	list_iterate_items(pvl, &vg->pvs) {
+		pv = pvl->pv;
+		pv->status |= EXPORTED_VG;
+	}
+
 	if (!vg_write(vg) || !vg_commit(vg))
 		goto error;
 

Modified: lvm2/trunk/tools/vgextend.c
==============================================================================
--- lvm2/trunk/tools/vgextend.c	(original)
+++ lvm2/trunk/tools/vgextend.c	Fri May  5 20:27:43 2006
@@ -48,7 +48,7 @@
 		goto error;
 	}
 
-	if (!(vg = vg_read(cmd, vg_name, &consistent)) || !consistent) {
+	if (!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent) {
 		log_error("Volume group \"%s\" not found.", vg_name);
 		goto error;
 	}

Modified: lvm2/trunk/tools/vgimport.c
==============================================================================
--- lvm2/trunk/tools/vgimport.c	(original)
+++ lvm2/trunk/tools/vgimport.c	Fri May  5 20:27:43 2006
@@ -19,6 +19,9 @@
 			   struct volume_group *vg, int consistent,
 			   void *handle)
 {
+	struct pv_list *pvl;
+	struct physical_volume *pv;
+
 	if (!vg || !consistent) {
 		log_error("Unable to find exported volume group \"%s\"",
 			  vg_name);
@@ -40,6 +43,11 @@
 
 	vg->status &= ~EXPORTED_VG;
 
+	list_iterate_items(pvl, &vg->pvs) {
+		pv = pvl->pv;
+		pv->status &= ~EXPORTED_VG;
+	}
+
 	if (!vg_write(vg) || !vg_commit(vg))
 		goto error;
 

Modified: lvm2/trunk/tools/vgmerge.c
==============================================================================
--- lvm2/trunk/tools/vgmerge.c	(original)
+++ lvm2/trunk/tools/vgmerge.c	Fri May  5 20:27:43 2006
@@ -35,7 +35,7 @@
 		return ECMD_FAILED;
 	}
 
-	if (!(vg_to = vg_read(cmd, vg_name_to, &consistent)) || !consistent) {
+	if (!(vg_to = vg_read(cmd, vg_name_to, NULL, &consistent)) || !consistent) {
 		log_error("Volume group \"%s\" doesn't exist", vg_name_to);
 		unlock_vg(cmd, vg_name_to);
 		return ECMD_FAILED;
@@ -61,7 +61,7 @@
 	}
 
 	consistent = 1;
-	if (!(vg_from = vg_read(cmd, vg_name_from, &consistent)) || !consistent) {
+	if (!(vg_from = vg_read(cmd, vg_name_from, NULL, &consistent)) || !consistent) {
 		log_error("Volume group \"%s\" doesn't exist", vg_name_from);
 		goto error;
 	}

Modified: lvm2/trunk/tools/vgreduce.c
==============================================================================
--- lvm2/trunk/tools/vgreduce.c	(original)
+++ lvm2/trunk/tools/vgreduce.c	Fri May  5 20:27:43 2006
@@ -432,7 +432,7 @@
 		return ECMD_FAILED;
 	}
 
-	if ((!(vg = vg_read(cmd, vg_name, &consistent)) || !consistent) &&
+	if ((!(vg = vg_read(cmd, vg_name, NULL, &consistent)) || !consistent) &&
 	    !arg_count(cmd, removemissing_ARG)) {
 		log_error("Volume group \"%s\" doesn't exist", vg_name);
 		unlock_vg(cmd, vg_name);
@@ -449,7 +449,7 @@
 
 		init_partial(1);
 		consistent = 0;
-		if (!(vg = vg_read(cmd, vg_name, &consistent))) {
+		if (!(vg = vg_read(cmd, vg_name, NULL, &consistent))) {
 			log_error("Volume group \"%s\" not found", vg_name);
 			unlock_vg(cmd, vg_name);
 			return ECMD_FAILED;

Modified: lvm2/trunk/tools/vgrename.c
==============================================================================
--- lvm2/trunk/tools/vgrename.c	(original)
+++ lvm2/trunk/tools/vgrename.c	Fri May  5 20:27:43 2006
@@ -19,12 +19,15 @@
 {
 	char *dev_dir;
 	unsigned int length;
+	struct id id;
 	int consistent = 1;
-
-	char *vg_name_old, *vg_name_new;
-
+	int match = 0;
+	int found_id = 0;
+	struct list *vgids;
+	struct str_list *sl;
+	char *vg_name_new;
+	const char *vgid = NULL, *vg_name, *vg_name_old;
 	char old_path[NAME_LEN], new_path[NAME_LEN];
-
 	struct volume_group *vg_old, *vg_new;
 
 	if (argc != 2) {
@@ -64,23 +67,50 @@
 
 	log_verbose("Checking for existing volume group \"%s\"", vg_name_old);
 
-	if (!lock_vol(cmd, vg_name_old, LCK_VG_WRITE)) {
-		log_error("Can't get lock for %s", vg_name_old);
+	/* Avoid duplicates */
+	if (!(vgids = get_vgids(cmd, 0)) || list_empty(vgids)) {
+		log_error("No complete volume groups found");
 		return ECMD_FAILED;
 	}
 
-	if (!(vg_old = vg_read(cmd, vg_name_old, &consistent)) || !consistent) {
-		log_error("Volume group \"%s\" doesn't exist", vg_name_old);
-		unlock_vg(cmd, vg_name_old);
+	list_iterate_items(sl, vgids) {
+		vgid = sl->str;
+		if (!vgid || !(vg_name = vgname_from_vgid(NULL, vgid)) || !*vg_name)
+			continue;
+		if (!strcmp(vg_name, vg_name_old)) {
+			if (match) {
+				log_error("Found more than one VG called %s. "
+					  "Please supply VG uuid.", vg_name_old);
+				return ECMD_FAILED;
+			}
+			match = 1;
+		}
+	}
+
+	log_suppress(2);
+	found_id = id_read_format(&id, vg_name_old);
+	log_suppress(0);
+	if (found_id && (vg_name = vgname_from_vgid(cmd->mem, id.uuid))) {
+		vg_name_old = vg_name;
+		vgid = id.uuid;
+	} else
+		vgid = NULL;
+
+	if (!lock_vol(cmd, vg_name_old, LCK_VG_WRITE)) {
+		log_error("Can't get lock for %s", vg_name_old);
 		return ECMD_FAILED;
 	}
 
-	if (vg_old->status & EXPORTED_VG) {
+	if (!(vg_old = vg_read(cmd, vg_name_old, vgid, &consistent)) || !consistent) {
+		log_error("Volume group %s %s%s%snot found.", vg_name_old,
+		vgid ? "(" : "", vgid ? vgid : "", vgid ? ") " : "");
 		unlock_vg(cmd, vg_name_old);
-		log_error("Volume group \"%s\" is exported", vg_old->name);
 		return ECMD_FAILED;
 	}
 
+	if (vg_old->status & EXPORTED_VG)
+		log_info("Volume group \"%s\" is exported", vg_old->name);
+
 	if (!(vg_old->status & LVM_WRITE)) {
 		unlock_vg(cmd, vg_name_old);
 		log_error("Volume group \"%s\" is read-only", vg_old->name);
@@ -104,7 +134,7 @@
 	}
 
 	consistent = 0;
-	if ((vg_new = vg_read(cmd, vg_name_new, &consistent))) {
+	if ((vg_new = vg_read(cmd, vg_name_new, NULL, &consistent))) {
 		log_error("New volume group \"%s\" already exists",
 			  vg_name_new);
 		goto error;
@@ -146,6 +176,10 @@
 	log_print("Volume group \"%s\" successfully renamed to \"%s\"",
 		  vg_name_old, vg_name_new);
 
+	/* FIXME lvmcache corruption - vginfo duplicated instead of renamed */
+        persistent_filter_wipe(cmd->filter);
+        lvmcache_destroy();
+
 	return ECMD_PROCESSED;
 
       error:

Modified: lvm2/trunk/tools/vgsplit.c
==============================================================================
--- lvm2/trunk/tools/vgsplit.c	(original)
+++ lvm2/trunk/tools/vgsplit.c	Fri May  5 20:27:43 2006
@@ -190,7 +190,7 @@
 		return ECMD_FAILED;
 	}
 
-	if (!(vg_from = vg_read(cmd, vg_name_from, &consistent)) || !consistent) {
+	if (!(vg_from = vg_read(cmd, vg_name_from, NULL, &consistent)) || !consistent) {
 		log_error("Volume group \"%s\" doesn't exist", vg_name_from);
 		unlock_vg(cmd, vg_name_from);
 		return ECMD_FAILED;
@@ -216,7 +216,7 @@
 	}
 
 	consistent = 0;
-	if ((vg_to = vg_read(cmd, vg_name_to, &consistent))) {
+	if ((vg_to = vg_read(cmd, vg_name_to, NULL, &consistent))) {
 		/* FIXME Remove this restriction */
 		log_error("Volume group \"%s\" already exists", vg_name_to);
 		goto error;
@@ -287,7 +287,7 @@
 
 	/* Remove EXPORTED flag from new VG */
 	consistent = 1;
-	if (!(vg_to = vg_read(cmd, vg_name_to, &consistent)) || !consistent) {
+	if (!(vg_to = vg_read(cmd, vg_name_to, NULL, &consistent)) || !consistent) {
 		log_error("Volume group \"%s\" became inconsistent: please "
 			  "fix manually", vg_name_to);
 		goto error;



More information about the pkg-lvm-commits mailing list