Commit eb208399 authored by Craig Silverstein's avatar Craig Silverstein

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
parent 2b66a844
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: * google-gflags: version 0.6
The gflags package contains a library that implements commandline * Deal correctly with case that libpthread is not linked in (csilvers)
flags processing. As such it's a replacement for getopt(). It * Update Makefile/tests so we pass "make distcheck" (csilvers)
has increased flexibility, including built-in support for C++ * Document and test that last assignment to a flag wins (wan)
types like string, and the ability to define flags in the source
file in which they're used.
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 * google-gflags: version 0.5
* added support for python commandlineflags, as well as c++ * Include all m4 macros in the distribution (csilvers)
* gflags2man, a script to turn flags into a man page (dchristian) * 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> Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com>
...@@ -21,17 +28,17 @@ Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com> ...@@ -21,17 +28,17 @@ Wed Mar 28 12:15:56 2007 Google Inc. <opensource@google.com>
* Make docs a bit prettier (csilvers) * Make docs a bit prettier (csilvers)
* Actually include the python files in the distribution! :-/ (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 * google-gflags: version 0.2
* Remove is_default from GetCommandLineFlagInfo (csilvers) * added support for python commandlineflags, as well as c++
* Portability fixes: includes, strtoll, gcc4.3 errors (csilvers) * gflags2man, a script to turn flags into a man page (dchristian)
* A few doc typo cleanups (csilvers)
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 * google-gflags: initial release:
* Include all m4 macros in the distribution (csilvers) The gflags package contains a library that implements commandline
* Python: Fix broken data_files field in setup.py (sidlon) flags processing. As such it's a replacement for getopt(). It
* Python: better string serliaizing and unparsing (abo, csimmons) has increased flexibility, including built-in support for C++
* Fix checks for NaN and inf to work with Mac OS X (csilvers) types like string, and the ability to define flags in the source
file in which they're used.
...@@ -31,7 +31,7 @@ lib_LTLIBRARIES = ...@@ -31,7 +31,7 @@ lib_LTLIBRARIES =
## TESTS_ENVIRONMENT sets environment variables for when you run unittest, ## TESTS_ENVIRONMENT sets environment variables for when you run unittest,
## but it only seems to take effect for *binary* unittests (argh!) ## but it only seems to take effect for *binary* unittests (argh!)
TESTS = TESTS =
TESTS_ENVIRONMENT = TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)"
check_SCRIPTS = check_SCRIPTS =
# Every time you add a unittest to check_SCRIPTS, add it here too # Every time you add a unittest to check_SCRIPTS, add it here too
noinst_SCRIPTS = noinst_SCRIPTS =
...@@ -53,10 +53,16 @@ gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) ...@@ -53,10 +53,16 @@ gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS) gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS) 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 check_SCRIPTS += gflags_unittest_sh
noinst_SCRIPTS += src/gflags_unittest.sh noinst_SCRIPTS += src/gflags_unittest.sh
dist_noinst_DATA = $(top_srcdir)/src/gflags_unittest_flagfile
gflags_unittest_sh: gflags_unittest 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 # These aren't part of the c++ source, but we want them to be distributed
PYTHON = python/setup.py \ PYTHON = python/setup.py \
......
...@@ -42,9 +42,9 @@ build_triplet = @build@ ...@@ -42,9 +42,9 @@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
noinst_PROGRAMS = $(am__EXEEXT_1) noinst_PROGRAMS = $(am__EXEEXT_1)
DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \ DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
$(googleinclude_HEADERS) $(srcdir)/Makefile.am \ $(dist_noinst_DATA) $(googleinclude_HEADERS) \
$(srcdir)/Makefile.in $(top_srcdir)/configure \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/src/config.h.in \ $(top_srcdir)/configure $(top_srcdir)/src/config.h.in \
$(top_srcdir)/src/google/gflags.h.in AUTHORS COPYING ChangeLog \ $(top_srcdir)/src/google/gflags.h.in AUTHORS COPYING ChangeLog \
INSTALL NEWS compile config.guess config.sub depcomp \ INSTALL NEWS compile config.guess config.sub depcomp \
install-sh ltmain.sh missing mkinstalldirs install-sh ltmain.sh missing mkinstalldirs
...@@ -78,8 +78,14 @@ am__objects_1 = ...@@ -78,8 +78,14 @@ am__objects_1 =
am_libgflags_la_OBJECTS = $(am__objects_1) libgflags_la-gflags.lo \ am_libgflags_la_OBJECTS = $(am__objects_1) libgflags_la-gflags.lo \
libgflags_la-gflags_reporting.lo libgflags_la-gflags_reporting.lo
libgflags_la_OBJECTS = $(am_libgflags_la_OBJECTS) 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) 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) \ am_gflags_unittest_OBJECTS = $(am__objects_1) \
gflags_unittest-gflags_unittest.$(OBJEXT) gflags_unittest-gflags_unittest.$(OBJEXT)
gflags_unittest_OBJECTS = $(am_gflags_unittest_OBJECTS) gflags_unittest_OBJECTS = $(am_gflags_unittest_OBJECTS)
...@@ -104,10 +110,13 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ ...@@ -104,10 +110,13 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
CCLD = $(CC) CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libgflags_la_SOURCES) $(gflags_unittest_SOURCES) SOURCES = $(libgflags_la_SOURCES) $(gflags_nothreads_unittest_SOURCES) \
DIST_SOURCES = $(libgflags_la_SOURCES) $(gflags_unittest_SOURCES) $(gflags_unittest_SOURCES)
DIST_SOURCES = $(libgflags_la_SOURCES) \
$(gflags_nothreads_unittest_SOURCES) \
$(gflags_unittest_SOURCES)
dist_docDATA_INSTALL = $(INSTALL_DATA) dist_docDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_doc_DATA) DATA = $(dist_doc_DATA) $(dist_noinst_DATA)
googleincludeHEADERS_INSTALL = $(INSTALL_HEADER) googleincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(googleinclude_HEADERS) HEADERS = $(googleinclude_HEADERS)
ETAGS = etags ETAGS = etags
...@@ -186,7 +195,7 @@ ac_ct_CXX = @ac_ct_CXX@ ...@@ -186,7 +195,7 @@ ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@ ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@ ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@ 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___uint16 = @ac_cv_have___uint16@
ac_cv_have_inttypes_h = @ac_cv_have_inttypes_h@ ac_cv_have_inttypes_h = @ac_cv_have_inttypes_h@
ac_cv_have_stdint_h = @ac_cv_have_stdint_h@ ac_cv_have_stdint_h = @ac_cv_have_stdint_h@
...@@ -247,8 +256,10 @@ dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \ ...@@ -247,8 +256,10 @@ dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README \
doc/designstyle.css doc/gflags.html doc/designstyle.css doc/gflags.html
lib_LTLIBRARIES = libgflags.la 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 check_SCRIPTS = gflags_unittest_sh
# Every time you add a unittest to check_SCRIPTS, add it here too # Every time you add a unittest to check_SCRIPTS, add it here too
noinst_SCRIPTS = src/gflags_unittest.sh noinst_SCRIPTS = src/gflags_unittest.sh
...@@ -264,6 +275,9 @@ gflags_unittest_SOURCES = $(googleinclude_HEADERS) src/config.h \ ...@@ -264,6 +275,9 @@ gflags_unittest_SOURCES = $(googleinclude_HEADERS) src/config.h \
gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS) gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS) gflags_unittest_LDFLAGS = $(PTHREAD_CFLAGS)
gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS) 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 # These aren't part of the c++ source, but we want them to be distributed
PYTHON = python/setup.py \ PYTHON = python/setup.py \
...@@ -366,6 +380,9 @@ clean-noinstPROGRAMS: ...@@ -366,6 +380,9 @@ clean-noinstPROGRAMS:
echo " rm -f $$p $$f"; \ echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \ rm -f $$p $$f ; \
done 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) gflags_unittest$(EXEEXT): $(gflags_unittest_OBJECTS) $(gflags_unittest_DEPENDENCIES)
@rm -f gflags_unittest$(EXEEXT) @rm -f gflags_unittest$(EXEEXT)
$(CXXLINK) $(gflags_unittest_LDFLAGS) $(gflags_unittest_OBJECTS) $(gflags_unittest_LDADD) $(LIBS) $(CXXLINK) $(gflags_unittest_LDFLAGS) $(gflags_unittest_OBJECTS) $(gflags_unittest_LDADD) $(LIBS)
...@@ -377,6 +394,7 @@ distclean-compile: ...@@ -377,6 +394,7 @@ distclean-compile:
-rm -f *.tab.c -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-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.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_la-gflags_reporting.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgflags_la-gflags_reporting.Plo@am__quote@
...@@ -415,6 +433,20 @@ libgflags_la-gflags_reporting.lo: src/gflags_reporting.cc ...@@ -415,6 +433,20 @@ libgflags_la-gflags_reporting.lo: src/gflags_reporting.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @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 @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 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@ 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 @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-am: uninstall-dist_docDATA uninstall-googleincludeHEADERS \ ...@@ -829,7 +861,7 @@ uninstall-am: uninstall-dist_docDATA uninstall-googleincludeHEADERS \
uninstall-libLTLIBRARIES uninstall-libLTLIBRARIES
gflags_unittest_sh: gflags_unittest 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 rpm: dist-gzip packages/rpm.sh packages/rpm/rpm.spec
@cd packages && ./rpm.sh ${PACKAGE} ${VERSION} @cd packages && ./rpm.sh ${PACKAGE} ${VERSION}
......
#!/bin/sh #!/bin/sh
# Before using, you should figure out all the .m4 macros that your # 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. # directory.
# #
# These are the files that this script might edit: # These are the files that this script might edit:
......
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # 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>. # Report bugs to <opensource@google.com>.
# #
...@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} ...@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='gflags' PACKAGE_NAME='gflags'
PACKAGE_TARNAME='gflags' PACKAGE_TARNAME='gflags'
PACKAGE_VERSION='0.5' PACKAGE_VERSION='0.6'
PACKAGE_STRING='gflags 0.5' PACKAGE_STRING='gflags 0.6'
PACKAGE_BUGREPORT='opensource@google.com' PACKAGE_BUGREPORT='opensource@google.com'
ac_unique_file="README" ac_unique_file="README"
...@@ -465,7 +465,7 @@ ac_includes_default="\ ...@@ -465,7 +465,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #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='' ac_subst_files=''
# Initialize some variables set by options. # Initialize some variables set by options.
...@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then ...@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # 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. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF 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]... Usage: $0 [OPTION]... [VAR=VALUE]...
...@@ -1020,7 +1020,7 @@ fi ...@@ -1020,7 +1020,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of gflags 0.5:";; short | recursive ) echo "Configuration of gflags 0.6:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
...@@ -1163,7 +1163,7 @@ fi ...@@ -1163,7 +1163,7 @@ fi
test -n "$ac_init_help" && exit 0 test -n "$ac_init_help" && exit 0
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
gflags configure 0.5 gflags configure 0.6
generated by GNU Autoconf 2.59 generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc. Copyright (C) 2003 Free Software Foundation, Inc.
...@@ -1177,7 +1177,7 @@ cat >&5 <<_ACEOF ...@@ -1177,7 +1177,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. 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 generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@ $ $0 $@
...@@ -1823,7 +1823,7 @@ fi ...@@ -1823,7 +1823,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='gflags' PACKAGE='gflags'
VERSION='0.5' VERSION='0.6'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -19630,6 +19630,13 @@ _ACEOF ...@@ -19630,6 +19630,13 @@ _ACEOF
echo "$as_me:$LINENO: result: $ac_cv___attribute__" >&5 echo "$as_me:$LINENO: result: $ac_cv___attribute__" >&5
echo "${ECHO_T}$ac_cv___attribute__" >&6 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 @@ echo "${ECHO_T}${flag}" >&6 ...@@ -19985,10 +19992,12 @@ echo "${ECHO_T}${flag}" >&6
LIBS="$save_LIBS" LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
# More AIX lossage: must compile with cc_r if test x"$GCC" != xyes; then
# Extract the first word of "cc_r", so it can be a program name with args. for ac_prog in xlc_r cc_r
set dummy cc_r; ac_word=$2 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 "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then
...@@ -20004,14 +20013,13 @@ do ...@@ -20004,14 +20013,13 @@ do
test -z "$as_dir" && as_dir=. test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 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 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2 break 2
fi fi
done done
done done
test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}"
fi fi
fi fi
PTHREAD_CC=$ac_cv_prog_PTHREAD_CC PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
...@@ -20023,17 +20031,26 @@ else ...@@ -20023,17 +20031,26 @@ else
echo "${ECHO_T}no" >&6 echo "${ECHO_T}no" >&6
fi 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 # The next part tries to detect GCC inconsistency with -shared on some
# architectures and systems. The problem is that in certain # architectures and systems. The problem is that in certain
# configurations, when -shared is specified, GCC "forgets" to # configurations, when -shared is specified, GCC "forgets" to
# internally use various flags which are still necessary. # 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 "$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 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 "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6 echo "${ECHO_T}no" >&6
else else
...@@ -20926,7 +20943,7 @@ _ASBOX ...@@ -20926,7 +20943,7 @@ _ASBOX
} >&5 } >&5
cat >&5 <<_CSEOF 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 generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -20989,7 +21006,7 @@ _ACEOF ...@@ -20989,7 +21006,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\ ac_cs_version="\\
gflags config.status 0.5 gflags config.status 0.6
configured by $0, generated by GNU Autoconf 2.59, configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
...@@ -21261,7 +21278,7 @@ s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t ...@@ -21261,7 +21278,7 @@ s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t
s,@ac_google_start_namespace@,$ac_google_start_namespace,;t t 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_end_namespace@,$ac_google_end_namespace,;t t
s,@ac_google_namespace@,$ac_google_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_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_systypes_h@,$ac_cv_have_systypes_h,;t t
s,@ac_cv_have_inttypes_h@,$ac_cv_have_inttypes_h,;t t s,@ac_cv_have_inttypes_h@,$ac_cv_have_inttypes_h,;t t
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# make sure we're interpreted by some minimal autoconf # make sure we're interpreted by some minimal autoconf
AC_PREREQ(2.57) 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 # The argument here is just something that should be in the current directory
# (for sanity checking) # (for sanity checking)
AC_CONFIG_SRCDIR(README) AC_CONFIG_SRCDIR(README)
...@@ -38,6 +38,13 @@ AC_CHECK_FUNCS(strtoll) ...@@ -38,6 +38,13 @@ AC_CHECK_FUNCS(strtoll)
AC_CHECK_FUNCS(strtoq) AC_CHECK_FUNCS(strtoq)
AX_C___ATTRIBUTE__ 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 ACX_PTHREAD
# Find out what namespace 'normal' STL code lives in, and also what namespace # Find out what namespace 'normal' STL code lives in, and also what namespace
...@@ -49,7 +56,7 @@ AC_DEFINE_GOOGLE_NAMESPACE(google) ...@@ -49,7 +56,7 @@ AC_DEFINE_GOOGLE_NAMESPACE(google)
AC_SUBST(ac_google_start_namespace) AC_SUBST(ac_google_start_namespace)
AC_SUBST(ac_google_end_namespace) AC_SUBST(ac_google_end_namespace)
AC_SUBST(ac_google_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_stdint_h)
AC_SUBST(ac_cv_have_systypes_h) AC_SUBST(ac_cv_have_systypes_h)
AC_SUBST(ac_cv_have_inttypes_h) AC_SUBST(ac_cv_have_inttypes_h)
......
# This was retrieved from # 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?) # See also (perhaps for new versions?)
# http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/common/acx_pthread.m4 # http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/common/acx_pthread.m4
...@@ -48,7 +48,7 @@ dnl We are also grateful for the helpful feedback of numerous users. ...@@ -48,7 +48,7 @@ dnl We are also grateful for the helpful feedback of numerous users.
dnl dnl
dnl @category InstalledPackages dnl @category InstalledPackages
dnl @author Steven G. Johnson <stevenj@alum.mit.edu> dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
dnl @version 2005-06-15 dnl @version 2006-05-29
dnl @license GPLWithACException dnl @license GPLWithACException
dnl dnl
dnl Checks for GCC shared/pthread inconsistency based on work by dnl Checks for GCC shared/pthread inconsistency based on work by
...@@ -224,19 +224,24 @@ if test "x$acx_pthread_ok" = xyes; then ...@@ -224,19 +224,24 @@ if test "x$acx_pthread_ok" = xyes; then
LIBS="$save_LIBS" LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS" CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
# More AIX lossage: must compile with cc_r if test x"$GCC" != xyes; then
AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) 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 # The next part tries to detect GCC inconsistency with -shared on some
# architectures and systems. The problem is that in certain # architectures and systems. The problem is that in certain
# configurations, when -shared is specified, GCC "forgets" to # configurations, when -shared is specified, GCC "forgets" to
# internally use various flags which are still necessary. # 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]) 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]) AC_MSG_RESULT([no])
else else
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
......
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 google-gflags (0.5-1) unstable; urgency=low
* New upstream release. * New upstream release.
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
from distutils.core import setup from distutils.core import setup
setup(name='gflags', setup(name='gflags',
version='0.5', version='0.6',
description='Google Commandline Flags Module', description='Google Commandline Flags Module',
license='BSD', license='BSD',
author='Google Inc.', author='Google Inc.',
......
...@@ -367,27 +367,20 @@ CommandLineFlag::~CommandLineFlag() { ...@@ -367,27 +367,20 @@ CommandLineFlag::~CommandLineFlag() {
const char* CommandLineFlag::CleanFileName() const { const char* CommandLineFlag::CleanFileName() const {
// Compute top-level directory & file that this appears in // Compute top-level directory & file that this appears in
// search full path backwards. Set kMaxSlashes = 5, // search full path backwards.
// as the current code has <= 4 levels of dirs. // Stop going backwards at kGoogle; and skip by the first slash.
// E.g. .../froogle/wrapping/autowrap/clustering/*.cc
// Also, stop going backwards at "/google3/"; and skip by the first slash.
// E.g. // E.g.
// filename_where_defined = "froogle/wrapping/autowrap/clustering/**.cc" // filename_where_defined = "froogle/wrapping/autowrap/clustering/**.cc"
// filename_where_defined = "file/util/fileutil.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 static const char kGoogle[] = ""; // can set this to whatever
if (sizeof(kGoogle)-1 == 0) // no prefix to strip if (sizeof(kGoogle)-1 == 0) // no prefix to strip
return filename(); return filename();
const char* clean_name = filename() + strlen(filename()) - 1; const char* clean_name = filename() + strlen(filename()) - 1;
int slashes = 0;
while ( clean_name > filename() ) { while ( clean_name > filename() ) {
if (*clean_name == PATH_SEPARATOR) { if (*clean_name == PATH_SEPARATOR) {
++slashes; if (strncmp(clean_name, kGoogle, sizeof(kGoogle)-1) == 0) {
if (slashes == kMaxSlashes) {
break; // no dirs now are deeper than this
} else if (strncmp(clean_name, kGoogle, sizeof(kGoogle)-1) == 0) {
// ".../google/base/logging.cc" ==> "base/logging.cc" // ".../google/base/logging.cc" ==> "base/logging.cc"
clean_name += sizeof(kGoogle)-1; // past "/google/" clean_name += sizeof(kGoogle)-1; // past "/google/"
break; break;
...@@ -486,6 +479,7 @@ class FlagRegistry { ...@@ -486,6 +479,7 @@ class FlagRegistry {
pthread_mutex_t lock_; pthread_mutex_t lock_;
static FlagRegistry* global_registry_; // a singleton registry static FlagRegistry* global_registry_; // a singleton registry
static pthread_once_t global_registry_once_; static pthread_once_t global_registry_once_;
static int global_registry_once_nothreads_; // when we don't link pthreads
static void InitGlobalRegistry(); static void InitGlobalRegistry();
...@@ -636,13 +630,21 @@ bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag, ...@@ -636,13 +630,21 @@ bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag,
// Get the singleton FlagRegistry object // Get the singleton FlagRegistry object
FlagRegistry* FlagRegistry::global_registry_ = NULL; FlagRegistry* FlagRegistry::global_registry_ = NULL;
pthread_once_t FlagRegistry::global_registry_once_ = PTHREAD_ONCE_INIT; pthread_once_t FlagRegistry::global_registry_once_ = PTHREAD_ONCE_INIT;
int FlagRegistry::global_registry_once_nothreads_ = 0;
void FlagRegistry::InitGlobalRegistry() { void FlagRegistry::InitGlobalRegistry() {
global_registry_ = new FlagRegistry; 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() { FlagRegistry* FlagRegistry::GlobalRegistry() {
if (pthread_once) { // means we're running with pthreads
pthread_once(&global_registry_once_, &FlagRegistry::InitGlobalRegistry); 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_; return global_registry_;
} }
......
...@@ -46,9 +46,16 @@ ...@@ -46,9 +46,16 @@
using std::vector; using std::vector;
using std::string; 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 DECLARE_string(tryfromenv); // in commandlineflags.cc
DEFINE_string(test_tmpdir, "/tmp/gflags_unittest", "Dir we use for temp files"); 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_bool(test_bool, false, "tests bool-ness");
DEFINE_int32(test_int32, -1, ""); DEFINE_int32(test_int32, -1, "");
...@@ -964,7 +971,7 @@ TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) { ...@@ -964,7 +971,7 @@ TEST(DeprecatedFunctionsTest, ReadFromFlagsFile) {
r = ReadFromFlagsFile(filename, GetArgv0(), true); r = ReadFromFlagsFile(filename, GetArgv0(), true);
EXPECT_EQ(true, r); EXPECT_EQ(true, r);
EXPECT_EQ(-10, FLAGS_test_int32); EXPECT_EQ(-10, FLAGS_test_int32);
} // unnamed namespace }
TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) { TEST(DeprecatedFunctionsTest, ReadFromFlagsFileFailure) {
FLAGS_test_int32 = -20; FLAGS_test_int32 = -20;
...@@ -985,13 +992,114 @@ TEST(FlagsSetBeforeInitGoogleTest, TryFromEnv) { ...@@ -985,13 +992,114 @@ TEST(FlagsSetBeforeInitGoogleTest, TryFromEnv) {
EXPECT_EQ("pre-set", FLAGS_test_tryfromenv); 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) { static int Main(int argc, char **argv) {
// We need to call SetArgv before InitGoogle, so our "test" argv will // We need to call SetArgv before InitGoogle, so our "test" argv will
// win out over this executable's real argv. That makes running this // win out over this executable's real argv. That makes running this
// test with a real --help flag kinda annoying, unfortunately. // test with a real --help flag kinda annoying, unfortunately.
const char* test_argv[] = { "/test/argv/for/gflags_unittest", const char* test_argv[] = { "/test/argv/for/gflags_unittest",
"argv 2", "3rd argv", "argv #4" }; "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. // The first arg is the usage message, also important for testing.
string usage_message = (string(GetArgv0()) + string usage_message = (string(GetArgv0()) +
......
...@@ -38,12 +38,13 @@ ...@@ -38,12 +38,13 @@
if [ -z "$1" ] if [ -z "$1" ]
then then
echo "USAGE: $0 <unittest exe> [tmpdir]" echo "USAGE: $0 <unittest exe> [top_srcdir] [tmpdir]"
exit 1 exit 1
fi fi
EXE=$1 EXE=$1
TMPDIR=${2:-/tmp/gflags} SRCDIR=${2:-./}
TMPDIR=${3:-/tmp/gflags}
# $1: line-number $2: expected return code. $3: substring of expected output. # $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 # $4: a substring you *don't* expect to find in the output. $5+ flags
...@@ -57,7 +58,8 @@ Expect() { ...@@ -57,7 +58,8 @@ Expect() {
local unexpected_output="$1" local unexpected_output="$1"
shift 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=$? local actual_rc=$?
if [ $actual_rc != $expected_rc ]; then if [ $actual_rc != $expected_rc ]; then
echo "Test on line $line_number failed:" \ echo "Test on line $line_number failed:" \
......
--test_flag=1
--test_flag=2
...@@ -197,9 +197,6 @@ extern std::string SetCommandLineOptionWithMode(const char* name, const char* va ...@@ -197,9 +197,6 @@ extern std::string SetCommandLineOptionWithMode(const char* name, const char* va
// usage example above, the compiler would complain that it's an // usage example above, the compiler would complain that it's an
// unused variable. // 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 { class FlagSaver {
public: public:
FlagSaver(); FlagSaver();
...@@ -210,19 +207,14 @@ class FlagSaver { ...@@ -210,19 +207,14 @@ class FlagSaver {
FlagSaver(const FlagSaver&); // no copying! FlagSaver(const FlagSaver&); // no copying!
void operator=(const FlagSaver&); void operator=(const FlagSaver&);
} } @ac_cv___attribute__unused@;
// swig seems to have trouble with __attribute__ for some reason
#if !defined SWIG && defined HAVE___ATTRIBUTE__@ac_cv___attribute__@
__attribute__ ((unused))
#endif
;
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Some deprecated or hopefully-soon-to-be-deprecated functions. // Some deprecated or hopefully-soon-to-be-deprecated functions.
// This is often used for logging. TODO(csilvers): figure out a better way // This is often used for logging. TODO(csilvers): figure out a better way
extern std::string CommandlineFlagsIntoString(); 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, extern bool ReadFlagsFromString(const std::string& flagfilecontents,
const char* prog_name, const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE bool errors_are_fatal); // uses SET_FLAGS_VALUE
...@@ -263,6 +255,8 @@ extern void SetUsageMessage(const std::string& usage); ...@@ -263,6 +255,8 @@ extern void SetUsageMessage(const std::string& usage);
// Looks for flags in argv and parses them. Rearranges argv to put // Looks for flags in argv and parses them. Rearranges argv to put
// flags first, or removes them entirely if remove_flags is true. // 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. // See top-of-file for more details on this function.
#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. #ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead.
extern uint32 ParseCommandLineFlags(int *argc, char*** argv, extern uint32 ParseCommandLineFlags(int *argc, char*** argv,
...@@ -277,6 +271,8 @@ extern uint32 ParseCommandLineFlags(int *argc, char*** argv, ...@@ -277,6 +271,8 @@ extern uint32 ParseCommandLineFlags(int *argc, char*** argv,
// e.g. SetCommandLineOptionWithMode calls) between the time of // e.g. SetCommandLineOptionWithMode calls) between the time of
// command line parsing and the time of dumping help information for // command line parsing and the time of dumping help information for
// the flags as a result of command line parsing. // 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, extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv,
bool remove_flags); bool remove_flags);
// This is actually defined in commandlineflags_reporting.cc. // This is actually defined in commandlineflags_reporting.cc.
...@@ -360,7 +356,7 @@ class FlagRegisterer { ...@@ -360,7 +356,7 @@ class FlagRegisterer {
new (dfl_##name.store) namespc type(value)); \ new (dfl_##name.store) namespc type(value)); \
namespc type& FLAGS_##name = \ namespc type& FLAGS_##name = \
*(reinterpret_cast<namespc type*>(cur_##name.store)); \ *(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 using Flag_Names_##type::FLAGS_##name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment