Wed Aug 15 07:35:51 2007 Google Inc. <opensource@google.com>
* google-gflags: version 0.6
* Deal correctly with case that libpthread is not linked in (csilvers)
* Update Makefile/tests so we pass "make distcheck" (csilvers)
* Document and test that last assignment to a flag wins (wan)
git-svn-id: https://gflags.googlecode.com/svn/trunk@17 6586e3c6-dcc4-952a-343f-ff74eb82781d
diff --git a/ChangeLog b/ChangeLog
index 48f6cb5..7efd7ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,17 +1,24 @@
-Wed Dec 13 12:37:19 2006 Google Inc. <opensource@google.com>
+Wed Aug 15 07:35:51 2007 Google Inc. <opensource@google.com>
- * google-gflags: initial release:
- The gflags package contains a library that implements commandline
- flags processing. As such it's a replacement for getopt(). It
- has increased flexibility, including built-in support for C++
- types like string, and the ability to define flags in the source
- file in which they're used.
+ * google-gflags: version 0.6
+ * Deal correctly with case that libpthread is not linked in (csilvers)
+ * Update Makefile/tests so we pass "make distcheck" (csilvers)
+ * Document and test that last assignment to a flag wins (wan)
-Mon Jan 22 15:33:06 2007 Google Inc. <opensource@google.com>
+Tue Jun 12 15:23:42 2007 Google Inc. <opensource@google.com>
- * google-gflags: version 0.2
- * added support for python commandlineflags, as well as c++
- * gflags2man, a script to turn flags into a man page (dchristian)
+ * google-gflags: version 0.5
+ * Include all m4 macros in the distribution (csilvers)
+ * Python: Fix broken data_files field in setup.py (sidlon)
+ * Python: better string serliaizing and unparsing (abo, csimmons)
+ * Fix checks for NaN and inf to work with Mac OS X (csilvers)
+
+Thu Apr 19 15:15:07 2007 Google Inc. <opensource@google.com>
+
+ * google-gflags: version 0.4
+ * Remove is_default from GetCommandLineFlagInfo (csilvers)
+ * Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
+ * A few doc typo cleanups (csilvers)
Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com>
@@ -21,17 +28,17 @@
* Make docs a bit prettier (csilvers)
* Actually include the python files in the distribution! :-/ (csilvers)
-Thu Apr 19 15:15:07 2007 Google Inc. <opensource@google.com>
+Mon Jan 22 15:33:06 2007 Google Inc. <opensource@google.com>
- * google-gflags: version 0.4
- * Remove is_default from GetCommandLineFlagInfo (csilvers)
- * Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
- * A few doc typo cleanups (csilvers)
+ * google-gflags: version 0.2
+ * added support for python commandlineflags, as well as c++
+ * gflags2man, a script to turn flags into a man page (dchristian)
-Tue Jun 12 15:23:42 2007 Google Inc. <opensource@google.com>
+Wed Dec 13 12:37:19 2006 Google Inc. <opensource@google.com>
- * google-gflags: version 0.5
- * Include all m4 macros in the distribution (csilvers)
- * Python: Fix broken data_files field in setup.py (sidlon)
- * Python: better string serliaizing and unparsing (abo, csimmons)
- * Fix checks for NaN and inf to work with Mac OS X (csilvers)
+ * google-gflags: initial release:
+ The gflags package contains a library that implements commandline
+ flags processing. As such it's a replacement for getopt(). It
+ has increased flexibility, including built-in support for C++
+ types like string, and the ability to define flags in the source
+ file in which they're used.
diff --git a/Makefile.am b/Makefile.am
index 75249fc..577e9ee 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,7 +31,7 @@
## TESTS_ENVIRONMENT sets environment variables for when you run unittest,
## but it only seems to take effect for *binary* unittests (argh!)
TESTS =
-TESTS_ENVIRONMENT =
+TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)"
check_SCRIPTS =
# Every time you add a unittest to check_SCRIPTS, add it here too
noinst_SCRIPTS =
@@ -53,10 +53,16 @@
gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS)
+# Also make sure this works when we don't link in pthreads
+TESTS += gflags_nothreads_unittest
+gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES)
+gflags_nothreads_unittest_LDADD = libgflags.la
+
check_SCRIPTS += gflags_unittest_sh
noinst_SCRIPTS += src/gflags_unittest.sh
+dist_noinst_DATA = $(top_srcdir)/src/gflags_unittest_flagfile
gflags_unittest_sh: gflags_unittest
- $(top_srcdir)/src/gflags_unittest.sh $(PWD)/$<
+ $(top_srcdir)/src/gflags_unittest.sh $(PWD)/$< $(top_srcdir)
# These aren't part of the c++ source, but we want them to be distributed
PYTHON = python/setup.py \
diff --git a/Makefile.in b/Makefile.in
index ac7b793..e3af0ec 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -42,9 +42,9 @@
host_triplet = @host@
noinst_PROGRAMS = $(am__EXEEXT_1)
DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
- $(googleinclude_HEADERS) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(top_srcdir)/configure \
- $(top_srcdir)/src/config.h.in \
+ $(dist_noinst_DATA) $(googleinclude_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/configure $(top_srcdir)/src/config.h.in \
$(top_srcdir)/src/google/gflags.h.in AUTHORS COPYING ChangeLog \
INSTALL NEWS compile config.guess config.sub depcomp \
install-sh ltmain.sh missing mkinstalldirs
@@ -78,8 +78,14 @@
am_libgflags_la_OBJECTS = $(am__objects_1) libgflags_la-gflags.lo \
libgflags_la-gflags_reporting.lo
libgflags_la_OBJECTS = $(am_libgflags_la_OBJECTS)
-am__EXEEXT_1 = gflags_unittest$(EXEEXT)
+am__EXEEXT_1 = gflags_unittest$(EXEEXT) \
+ gflags_nothreads_unittest$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
+am__objects_2 = $(am__objects_1) gflags_unittest.$(OBJEXT)
+am_gflags_nothreads_unittest_OBJECTS = $(am__objects_2)
+gflags_nothreads_unittest_OBJECTS = \
+ $(am_gflags_nothreads_unittest_OBJECTS)
+gflags_nothreads_unittest_DEPENDENCIES = libgflags.la
am_gflags_unittest_OBJECTS = $(am__objects_1) \
gflags_unittest-gflags_unittest.$(OBJEXT)
gflags_unittest_OBJECTS = $(am_gflags_unittest_OBJECTS)
@@ -104,10 +110,13 @@
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libgflags_la_SOURCES) $(gflags_unittest_SOURCES)
-DIST_SOURCES = $(libgflags_la_SOURCES) $(gflags_unittest_SOURCES)
+SOURCES = $(libgflags_la_SOURCES) $(gflags_nothreads_unittest_SOURCES) \
+ $(gflags_unittest_SOURCES)
+DIST_SOURCES = $(libgflags_la_SOURCES) \
+ $(gflags_nothreads_unittest_SOURCES) \
+ $(gflags_unittest_SOURCES)
dist_docDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(dist_doc_DATA)
+DATA = $(dist_doc_DATA) $(dist_noinst_DATA)
googleincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(googleinclude_HEADERS)
ETAGS = etags
@@ -186,7 +195,7 @@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
-ac_cv___attribute__ = @ac_cv___attribute__@
+ac_cv___attribute__unused = @ac_cv___attribute__unused@
ac_cv_have___uint16 = @ac_cv_have___uint16@
ac_cv_have_inttypes_h = @ac_cv_have_inttypes_h@
ac_cv_have_stdint_h = @ac_cv_have_stdint_h@
@@ -247,8 +256,10 @@
doc/designstyle.css doc/gflags.html
lib_LTLIBRARIES = libgflags.la
-TESTS = gflags_unittest
-TESTS_ENVIRONMENT =
+
+# Also make sure this works when we don't link in pthreads
+TESTS = gflags_unittest gflags_nothreads_unittest
+TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)"
check_SCRIPTS = gflags_unittest_sh
# Every time you add a unittest to check_SCRIPTS, add it here too
noinst_SCRIPTS = src/gflags_unittest.sh
@@ -264,6 +275,9 @@
gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS)
+gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES)
+gflags_nothreads_unittest_LDADD = libgflags.la
+dist_noinst_DATA = $(top_srcdir)/src/gflags_unittest_flagfile
# These aren't part of the c++ source, but we want them to be distributed
PYTHON = python/setup.py \
@@ -366,6 +380,9 @@
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
+gflags_nothreads_unittest$(EXEEXT): $(gflags_nothreads_unittest_OBJECTS) $(gflags_nothreads_unittest_DEPENDENCIES)
+ @rm -f gflags_nothreads_unittest$(EXEEXT)
+ $(CXXLINK) $(gflags_nothreads_unittest_LDFLAGS) $(gflags_nothreads_unittest_OBJECTS) $(gflags_nothreads_unittest_LDADD) $(LIBS)
gflags_unittest$(EXEEXT): $(gflags_unittest_OBJECTS) $(gflags_unittest_DEPENDENCIES)
@rm -f gflags_unittest$(EXEEXT)
$(CXXLINK) $(gflags_unittest_LDFLAGS) $(gflags_unittest_OBJECTS) $(gflags_unittest_LDADD) $(LIBS)
@@ -377,6 +394,7 @@
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gflags_unittest-gflags_unittest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gflags_unittest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_la-gflags.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_la-gflags_reporting.Plo@am__quote@
@@ -415,6 +433,20 @@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgflags_la_CXXFLAGS) $(CXXFLAGS) -c -o libgflags_la-gflags_reporting.lo `test -f 'src/gflags_reporting.cc' || echo '$(srcdir)/'`src/gflags_reporting.cc
+gflags_unittest.o: src/gflags_unittest.cc
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest.o -MD -MP -MF "$(DEPDIR)/gflags_unittest.Tpo" -c -o gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest.cc' object='gflags_unittest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc
+
+gflags_unittest.obj: src/gflags_unittest.cc
+@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest.obj -MD -MP -MF "$(DEPDIR)/gflags_unittest.Tpo" -c -o gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi`; \
+@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='src/gflags_unittest.cc' object='gflags_unittest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gflags_unittest.obj `if test -f 'src/gflags_unittest.cc'; then $(CYGPATH_W) 'src/gflags_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/src/gflags_unittest.cc'; fi`
+
gflags_unittest-gflags_unittest.o: src/gflags_unittest.cc
@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gflags_unittest_CXXFLAGS) $(CXXFLAGS) -MT gflags_unittest-gflags_unittest.o -MD -MP -MF "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" -c -o gflags_unittest-gflags_unittest.o `test -f 'src/gflags_unittest.cc' || echo '$(srcdir)/'`src/gflags_unittest.cc; \
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo" "$(DEPDIR)/gflags_unittest-gflags_unittest.Po"; else rm -f "$(DEPDIR)/gflags_unittest-gflags_unittest.Tpo"; exit 1; fi
@@ -829,7 +861,7 @@
uninstall-libLTLIBRARIES
gflags_unittest_sh: gflags_unittest
- $(top_srcdir)/src/gflags_unittest.sh $(PWD)/$<
+ $(top_srcdir)/src/gflags_unittest.sh $(PWD)/$< $(top_srcdir)
rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
@cd packages && ./rpm.sh ${PACKAGE} ${VERSION}
diff --git a/autogen.sh b/autogen.sh
index 4d53592..bae2dd0 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Before using, you should figure out all the .m4 macros that your
-# configure.m4 script needs and make sure they exist in the autoconf/
+# configure.m4 script needs and make sure they exist in the m4/
# directory.
#
# These are the files that this script might edit:
diff --git a/configure b/configure
index b129282..7f7da2a 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for gflags 0.5.
+# Generated by GNU Autoconf 2.59 for gflags 0.6.
#
# Report bugs to <opensource@google.com>.
#
@@ -423,8 +423,8 @@
# Identity of this package.
PACKAGE_NAME='gflags'
PACKAGE_TARNAME='gflags'
-PACKAGE_VERSION='0.5'
-PACKAGE_STRING='gflags 0.5'
+PACKAGE_VERSION='0.6'
+PACKAGE_STRING='gflags 0.6'
PACKAGE_BUGREPORT='opensource@google.com'
ac_unique_file="README"
@@ -465,7 +465,7 @@
# include <unistd.h>
#endif"
-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 INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBTOOL_DEPS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS ac_google_start_namespace ac_google_end_namespace ac_google_namespace ac_cv___attribute__ ac_cv_have_stdint_h ac_cv_have_systypes_h ac_cv_have_inttypes_h ac_cv_have_uint16_t ac_cv_have_u_int16_t ac_cv_have___uint16 LIBOBJS 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 INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBTOOL_DEPS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS ac_google_start_namespace ac_google_end_namespace ac_google_namespace ac_cv___attribute__unused ac_cv_have_stdint_h ac_cv_have_systypes_h ac_cv_have_inttypes_h ac_cv_have_uint16_t ac_cv_have_u_int16_t ac_cv_have___uint16 LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -954,7 +954,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gflags 0.5 to adapt to many kinds of systems.
+\`configure' configures gflags 0.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1020,7 +1020,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gflags 0.5:";;
+ short | recursive ) echo "Configuration of gflags 0.6:";;
esac
cat <<\_ACEOF
@@ -1163,7 +1163,7 @@
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-gflags configure 0.5
+gflags configure 0.6
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1177,7 +1177,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gflags $as_me 0.5, which was
+It was created by gflags $as_me 0.6, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1823,7 +1823,7 @@
# Define the identity of the package.
PACKAGE='gflags'
- VERSION='0.5'
+ VERSION='0.6'
cat >>confdefs.h <<_ACEOF
@@ -19630,6 +19630,13 @@
echo "$as_me:$LINENO: result: $ac_cv___attribute__" >&5
echo "${ECHO_T}$ac_cv___attribute__" >&6
+# We only care about __attribute__ ((unused))
+if test x"$ac_cv___attribute__" = x"yes"; then
+ ac_cv___attribute__unused="__attribute__ ((unused))"
+else
+ ac_cv___attribute__unused=
+fi
+
@@ -19985,10 +19992,12 @@
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: must compile with cc_r
- # Extract the first word of "cc_r", so it can be a program name with args.
-set dummy cc_r; ac_word=$2
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ for ac_prog in xlc_r cc_r
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; 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_prog_PTHREAD_CC+set}" = set; then
@@ -20004,14 +20013,13 @@
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_prog_PTHREAD_CC="cc_r"
+ ac_cv_prog_PTHREAD_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
- test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}"
fi
fi
PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
@@ -20023,17 +20031,26 @@
echo "${ECHO_T}no" >&6
fi
+ test -n "$PTHREAD_CC" && break
+done
+test -n "$PTHREAD_CC" || PTHREAD_CC="${CC}"
+
+ else
+ PTHREAD_CC=$CC
+ fi
# The next part tries to detect GCC inconsistency with -shared on some
# architectures and systems. The problem is that in certain
# configurations, when -shared is specified, GCC "forgets" to
# internally use various flags which are still necessary.
- # First, check whether caller wants us to skip -shared checks
- # this is useful
echo "$as_me:$LINENO: checking whether to check for GCC pthread/shared inconsistencies" >&5
echo $ECHO_N "checking whether to check for GCC pthread/shared inconsistencies... $ECHO_C" >&6
- if test x"$GCC" != xyes; then
+ check_inconsistencies=yes
+ case "${host_cpu}-${host_os}" in
+ *-darwin*) check_inconsistencies=no ;;
+ esac
+ if test x"$GCC" != xyes -o "x$check_inconsistencies" != xyes ; then
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
else
@@ -20926,7 +20943,7 @@
} >&5
cat >&5 <<_CSEOF
-This file was extended by gflags $as_me 0.5, which was
+This file was extended by gflags $as_me 0.6, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20989,7 +21006,7 @@
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-gflags config.status 0.5
+gflags config.status 0.6
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -21261,7 +21278,7 @@
s,@ac_google_start_namespace@,$ac_google_start_namespace,;t t
s,@ac_google_end_namespace@,$ac_google_end_namespace,;t t
s,@ac_google_namespace@,$ac_google_namespace,;t t
-s,@ac_cv___attribute__@,$ac_cv___attribute__,;t t
+s,@ac_cv___attribute__unused@,$ac_cv___attribute__unused,;t t
s,@ac_cv_have_stdint_h@,$ac_cv_have_stdint_h,;t t
s,@ac_cv_have_systypes_h@,$ac_cv_have_systypes_h,;t t
s,@ac_cv_have_inttypes_h@,$ac_cv_have_inttypes_h,;t t
diff --git a/configure.ac b/configure.ac
index d6326b6..0e363a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
# make sure we're interpreted by some minimal autoconf
AC_PREREQ(2.57)
-AC_INIT(gflags, 0.5, opensource@google.com)
+AC_INIT(gflags, 0.6, opensource@google.com)
# The argument here is just something that should be in the current directory
# (for sanity checking)
AC_CONFIG_SRCDIR(README)
@@ -38,6 +38,13 @@
AC_CHECK_FUNCS(strtoq)
AX_C___ATTRIBUTE__
+# We only care about __attribute__ ((unused))
+if test x"$ac_cv___attribute__" = x"yes"; then
+ ac_cv___attribute__unused="__attribute__ ((unused))"
+else
+ ac_cv___attribute__unused=
+fi
+
ACX_PTHREAD
# Find out what namespace 'normal' STL code lives in, and also what namespace
@@ -49,7 +56,7 @@
AC_SUBST(ac_google_start_namespace)
AC_SUBST(ac_google_end_namespace)
AC_SUBST(ac_google_namespace)
-AC_SUBST(ac_cv___attribute__)
+AC_SUBST(ac_cv___attribute__unused)
AC_SUBST(ac_cv_have_stdint_h)
AC_SUBST(ac_cv_have_systypes_h)
AC_SUBST(ac_cv_have_inttypes_h)
diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4
index 919b912..f5db4f0 100644
--- a/m4/acx_pthread.m4
+++ b/m4/acx_pthread.m4
@@ -1,5 +1,5 @@
# This was retrieved from
-# http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/common/acx_pthread.m4?rev=1220
+# http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/common/acx_pthread.m4?rev=1227
# See also (perhaps for new versions?)
# http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/common/acx_pthread.m4
@@ -48,7 +48,7 @@
dnl
dnl @category InstalledPackages
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
-dnl @version 2005-06-15
+dnl @version 2006-05-29
dnl @license GPLWithACException
dnl
dnl Checks for GCC shared/pthread inconsistency based on work by
@@ -224,19 +224,24 @@
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: must compile with cc_r
- AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
# The next part tries to detect GCC inconsistency with -shared on some
# architectures and systems. The problem is that in certain
# configurations, when -shared is specified, GCC "forgets" to
# internally use various flags which are still necessary.
- # First, check whether caller wants us to skip -shared checks
- # this is useful
AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
- if test x"$GCC" != xyes; then
+ check_inconsistencies=yes
+ case "${host_cpu}-${host_os}" in
+ *-darwin*) check_inconsistencies=no ;;
+ esac
+ if test x"$GCC" != xyes -o "x$check_inconsistencies" != xyes ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
diff --git a/packages/deb/changelog b/packages/deb/changelog
index 571c73b..da02a1e 100644
--- a/packages/deb/changelog
+++ b/packages/deb/changelog
@@ -1,3 +1,16 @@
+google-gflags (0.6-2) unstable; urgency=low
+
+ * Somehow 0.6-1 was missing the lib* control files, so the .deb produced
+ was empty. Fix that to get an actual valid .deb file.
+
+ -- Google Inc. <opensource@google.com> Wed, 15 Aug 2007 12:32:01 -0700
+
+google-gflags (0.6-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Google Inc. <opensource@google.com> Wed, 15 Aug 2007 07:35:51 -0700
+
google-gflags (0.5-1) unstable; urgency=low
* New upstream release.
diff --git a/python/setup.py b/python/setup.py
index 25660d0..8af83a2 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -32,7 +32,7 @@
from distutils.core import setup
setup(name='gflags',
- version='0.5',
+ version='0.6',
description='Google Commandline Flags Module',
license='BSD',
author='Google Inc.',
diff --git a/src/gflags.cc b/src/gflags.cc
index 54956a3..1210434 100644
--- a/src/gflags.cc
+++ b/src/gflags.cc
@@ -367,27 +367,20 @@
const char* CommandLineFlag::CleanFileName() const {
// Compute top-level directory & file that this appears in
- // search full path backwards. Set kMaxSlashes = 5,
- // as the current code has <= 4 levels of dirs.
- // E.g. .../froogle/wrapping/autowrap/clustering/*.cc
- // Also, stop going backwards at "/google3/"; and skip by the first slash.
+ // search full path backwards.
+ // Stop going backwards at kGoogle; and skip by the first slash.
// E.g.
// filename_where_defined = "froogle/wrapping/autowrap/clustering/**.cc"
// filename_where_defined = "file/util/fileutil.cc"
- static const int kMaxSlashes = 5; // one more than max dir levels
static const char kGoogle[] = ""; // can set this to whatever
if (sizeof(kGoogle)-1 == 0) // no prefix to strip
return filename();
const char* clean_name = filename() + strlen(filename()) - 1;
- int slashes = 0;
while ( clean_name > filename() ) {
if (*clean_name == PATH_SEPARATOR) {
- ++slashes;
- if (slashes == kMaxSlashes) {
- break; // no dirs now are deeper than this
- } else if (strncmp(clean_name, kGoogle, sizeof(kGoogle)-1) == 0) {
+ if (strncmp(clean_name, kGoogle, sizeof(kGoogle)-1) == 0) {
// ".../google/base/logging.cc" ==> "base/logging.cc"
clean_name += sizeof(kGoogle)-1; // past "/google/"
break;
@@ -486,6 +479,7 @@
pthread_mutex_t lock_;
static FlagRegistry* global_registry_; // a singleton registry
static pthread_once_t global_registry_once_;
+ static int global_registry_once_nothreads_; // when we don't link pthreads
static void InitGlobalRegistry();
@@ -636,13 +630,21 @@
// Get the singleton FlagRegistry object
FlagRegistry* FlagRegistry::global_registry_ = NULL;
pthread_once_t FlagRegistry::global_registry_once_ = PTHREAD_ONCE_INIT;
+int FlagRegistry::global_registry_once_nothreads_ = 0;
void FlagRegistry::InitGlobalRegistry() {
global_registry_ = new FlagRegistry;
}
+// We want to use pthread_once here, for safety, but have to worry about
+// whether libpthread is linked in or not.
FlagRegistry* FlagRegistry::GlobalRegistry() {
- pthread_once(&global_registry_once_, &FlagRegistry::InitGlobalRegistry);
+ if (pthread_once) { // means we're running with pthreads
+ pthread_once(&global_registry_once_, &FlagRegistry::InitGlobalRegistry);
+ } else { // not running with pthreads: we're the only thread
+ if (global_registry_once_nothreads_++ == 0)
+ InitGlobalRegistry();
+ }
return global_registry_;
}
diff --git a/src/gflags_unittest.cc b/src/gflags_unittest.cc
index b594581..3ec0333 100644
--- a/src/gflags_unittest.cc
+++ b/src/gflags_unittest.cc
@@ -46,9 +46,16 @@
using std::vector;
using std::string;
+// Returns the number of elements in an array. We don't use the safer
+// version in base/basictypes.h as commandlineflags is open-sourced.
+#define GET_ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr)))
+
DECLARE_string(tryfromenv); // in commandlineflags.cc
DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files");
+DEFINE_string(srcdir, google::StringFromEnv("SRCDIR", "."),
+ "Source-dir root, needed to find gflags_unittest_flagfile");
+
DEFINE_bool(test_bool, false, "tests bool-ness");
DEFINE_int32(test_int32, -1, "");
@@ -964,7 +971,7 @@
r = ReadFromFlagsFile(filename, GetArgv0(), true);
EXPECT_EQ(true, r);
EXPECT_EQ(-10, FLAGS_test_int32);
-} // unnamed namespace
+}
TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) {
FLAGS_test_int32 = -20;
@@ -985,13 +992,114 @@
EXPECT_EQ("pre-set", FLAGS_test_tryfromenv);
}
+// The following test case verifies that ParseCommandLineFlags() and
+// ParseCommandLineNonHelpFlags() uses the last definition of a flag
+// in case it's defined more than once.
+
+DEFINE_int32(test_flag, -1, "used for testing commandlineflags.cc");
+
+// Returns the definition of the --flagfile flag to be used in the tests.
+const char* GetFlagFileFlag() {
+ static const string flagfile_flag = string("--flagfile=")
+ + FLAGS_srcdir + "/src/gflags_unittest_flagfile";
+
+ return flagfile_flag.c_str();
+}
+
+// Parses and returns the --test_flag flag.
+// If with_help is true, calls ParseCommandLineFlags; otherwise calls
+// ParseCommandLineNonHelpFlags.
+int32 ParseTestFlag(bool with_help, int argc, const char** const_argv) {
+ FlagSaver fs; // Restores the flags before returning.
+
+ // Makes a copy of the input array s.t. it can be reused
+ // (ParseCommandLineFlags() will alter the array).
+ char** const argv_save = new char*[argc + 1];
+ char** argv = argv_save;
+ memcpy(argv, const_argv, sizeof(*argv)*(argc + 1));
+
+ if (with_help) {
+ ParseCommandLineFlags(&argc, &argv, true);
+ } else {
+ ParseCommandLineNonHelpFlags(&argc, &argv, true);
+ }
+
+ delete[] argv_save;
+ return FLAGS_test_flag;
+}
+
+TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
+ WhenFlagIsDefinedTwiceOnCommandLine) {
+ const char* argv[] = {
+ "my_test",
+ "--test_flag=1",
+ "--test_flag=2",
+ NULL,
+ };
+
+ EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
+ EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
+}
+
+TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
+ WhenFlagIsDefinedTwiceInFlagFile) {
+ const char* argv[] = {
+ "my_test",
+ GetFlagFileFlag(),
+ NULL,
+ };
+
+ EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
+ EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
+}
+
+TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
+ WhenFlagIsDefinedInCommandLineAndThenFlagFile) {
+ const char* argv[] = {
+ "my_test",
+ "--test_flag=0",
+ GetFlagFileFlag(),
+ NULL,
+ };
+
+ EXPECT_EQ(2, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
+ EXPECT_EQ(2, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
+}
+
+TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
+ WhenFlagIsDefinedInFlagFileAndThenCommandLine) {
+ const char* argv[] = {
+ "my_test",
+ GetFlagFileFlag(),
+ "--test_flag=3",
+ NULL,
+ };
+
+ EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
+ EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
+}
+
+TEST(ParseCommandLineFlagsUsesLastDefinitionTest,
+ WhenFlagIsDefinedInCommandLineAndFlagFileAndThenCommandLine) {
+ const char* argv[] = {
+ "my_test",
+ "--test_flag=0",
+ GetFlagFileFlag(),
+ "--test_flag=3",
+ NULL,
+ };
+
+ EXPECT_EQ(3, ParseTestFlag(true, GET_ARRAY_SIZE(argv) - 1, argv));
+ EXPECT_EQ(3, ParseTestFlag(false, GET_ARRAY_SIZE(argv) - 1, argv));
+}
+
static int Main(int argc, char **argv) {
// We need to call SetArgv before InitGoogle, so our "test" argv will
// win out over this executable's real argv. That makes running this
// test with a real --help flag kinda annoying, unfortunately.
const char* test_argv[] = { "/test/argv/for/gflags_unittest",
"argv 2", "3rd argv", "argv #4" };
- SetArgv(sizeof(test_argv)/sizeof(*test_argv), test_argv);
+ SetArgv(GET_ARRAY_SIZE(test_argv), test_argv);
// The first arg is the usage message, also important for testing.
string usage_message = (string(GetArgv0()) +
diff --git a/src/gflags_unittest.sh b/src/gflags_unittest.sh
index 68dc353..76d63b3 100755
--- a/src/gflags_unittest.sh
+++ b/src/gflags_unittest.sh
@@ -38,12 +38,13 @@
if [ -z "$1" ]
then
- echo "USAGE: $0 <unittest exe> [tmpdir]"
+ echo "USAGE: $0 <unittest exe> [top_srcdir] [tmpdir]"
exit 1
fi
EXE=$1
-TMPDIR=${2:-/tmp/gflags}
+SRCDIR=${2:-./}
+TMPDIR=${3:-/tmp/gflags}
# $1: line-number $2: expected return code. $3: substring of expected output.
# $4: a substring you *don't* expect to find in the output. $5+ flags
@@ -57,7 +58,8 @@
local unexpected_output="$1"
shift
- $EXE "$@" > "$TMPDIR/test.$line_number" 2>&1
+ # We always add --srcdir=$SRCDIR because it's needed for correctness
+ $EXE --srcdir="$SRCDIR" "$@" > "$TMPDIR/test.$line_number" 2>&1
local actual_rc=$?
if [ $actual_rc != $expected_rc ]; then
echo "Test on line $line_number failed:" \
diff --git a/src/gflags_unittest_flagfile b/src/gflags_unittest_flagfile
new file mode 100644
index 0000000..f4fa0c4
--- /dev/null
+++ b/src/gflags_unittest_flagfile
@@ -0,0 +1,2 @@
+--test_flag=1
+--test_flag=2
diff --git a/src/google/gflags.h.in b/src/google/gflags.h.in
index 5b9519e..8dc257a 100644
--- a/src/google/gflags.h.in
+++ b/src/google/gflags.h.in
@@ -197,9 +197,6 @@
// usage example above, the compiler would complain that it's an
// unused variable.
-// This is a trick to work with autoconf, which sets a var to "yes" or "no"
-#define HAVE___ATTRIBUTE__yes 1 // will only be referenced if autoconf says yes
-
class FlagSaver {
public:
FlagSaver();
@@ -210,19 +207,14 @@
FlagSaver(const FlagSaver&); // no copying!
void operator=(const FlagSaver&);
-}
-// swig seems to have trouble with __attribute__ for some reason
-#if !defined SWIG && defined HAVE___ATTRIBUTE__@ac_cv___attribute__@
-__attribute__ ((unused))
-#endif
-;
+} @ac_cv___attribute__unused@;
// --------------------------------------------------------------------
// Some deprecated or hopefully-soon-to-be-deprecated functions.
// This is often used for logging. TODO(csilvers): figure out a better way
extern std::string CommandlineFlagsIntoString();
-// DEPRECATED. Usually where this is used, a FlagSaver should be used instead.
+// Usually where this is used, a FlagSaver should be used instead.
extern bool ReadFlagsFromString(const std::string& flagfilecontents,
const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE
@@ -263,6 +255,8 @@
// Looks for flags in argv and parses them. Rearranges argv to put
// flags first, or removes them entirely if remove_flags is true.
+// If a flag is defined more than once in the command line or flag
+// file, the last definition is used.
// See top-of-file for more details on this function.
#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead.
extern uint32 ParseCommandLineFlags(int *argc, char*** argv,
@@ -277,6 +271,8 @@
// e.g. SetCommandLineOptionWithMode calls) between the time of
// command line parsing and the time of dumping help information for
// the flags as a result of command line parsing.
+// If a flag is defined more than once in the command line or flag
+// file, the last definition is used.
extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv,
bool remove_flags);
// This is actually defined in commandlineflags_reporting.cc.
@@ -360,7 +356,7 @@
new (dfl_##name.store) namespc type(value)); \
namespc type& FLAGS_##name = \
*(reinterpret_cast<namespc type*>(cur_##name.store)); \
- char FLAGS_no##name; \
+ char FLAGS_no##name @ac_cv___attribute__unused@; \
} \
using Flag_Names_##type::FLAGS_##name