Tue Aug 19 16:15:48 2008 Google Inc. <opensource@google.com>
* google-gflags: version 1.0rc1
* Move #include files from google/ to gflags/ (csilvers)
* Small optimizations to reduce binary (library) size (jyrki)
* BUGFIX: forgot a std:: in one of the .h files (csilvers)
* Speed up locking by making sure calls are inlined (ajenjo)
* 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers)
* PORTABILITY: fix Makefile to work with Cygwin (ajenjo)
* PORTABILITY: fix code to compile under Visual Studio (ajenjo)
* PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers)
git-svn-id: https://gflags.googlecode.com/svn/trunk@25 6586e3c6-dcc4-952a-343f-ff74eb82781d
diff --git a/ChangeLog b/ChangeLog
index 24d9931..f9f7102 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Tue Aug 19 16:15:48 2008 Google Inc. <opensource@google.com>
+
+ * google-gflags: version 1.0rc1
+ * Move #include files from google/ to gflags/ (csilvers)
+ * Small optimizations to reduce binary (library) size (jyrki)
+ * BUGFIX: forgot a std:: in one of the .h files (csilvers)
+ * Speed up locking by making sure calls are inlined (ajenjo)
+ * 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers)
+ * PORTABILITY: fix Makefile to work with Cygwin (ajenjo)
+ * PORTABILITY: fix code to compile under Visual Studio (ajenjo)
+ * PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers)
+
Mon Jul 21 23:01:38 2008 Google Inc. <opensource@google.com>
* google-gflags: version 0.9
diff --git a/Makefile.am b/Makefile.am
index 71c7c2b..f4f30c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,14 +1,9 @@
-## This is a boilerplate file for Google opensource projects.
-## To make it useful, replace <<TEXT>> with actual text for your project.
-## Also, look at comments with "## double hashes" to see if any are worth
-## uncommenting or modifying.
-
## Process this file with automake to produce Makefile.in
# Make sure that when we re-make ./configure, we get the macros we need
ACLOCAL_AMFLAGS = -I m4
-# This is so we can #include <google/foo>
+# This is so we can #include <gflags/foo>
AM_CPPFLAGS = -I$(top_srcdir)/src
# This is mostly based on configure options
@@ -19,9 +14,13 @@
AM_CXXFLAGS += -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
endif
-googleincludedir = $(includedir)/google
+gflagsincludedir = $(includedir)/gflags
## The .h files you want to install (that is, .h files that people
## who install this package can include in their own applications.)
+gflagsinclude_HEADERS = src/gflags/gflags.h src/gflags/gflags_completions.h
+
+# This is for backwards compatibility only.
+googleincludedir = $(includedir)/google
googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h
bin_SCRIPTS = src/gflags_completions.sh
@@ -51,30 +50,30 @@
## vvvv RULES TO MAKE THE LIBRARIES, BINARIES, AND UNITTESTS
lib_LTLIBRARIES += libgflags.la
-libgflags_la_SOURCES = $(googleinclude_HEADERS) src/config.h \
+libgflags_la_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags.cc src/gflags_reporting.cc \
src/gflags_completions.cc
libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG
libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS)
libgflags_la_LIBADD = $(PTHREAD_LIBS)
-TESTS += gflags_unittest
-gflags_unittest_SOURCES = $(googleinclude_HEADERS) src/config.h \
+TESTS += gflags_unittest$(EXEEXT)
+gflags_unittest_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest.cc
gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
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
+TESTS += gflags_nothreads_unittest$(EXEEXT)
gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES)
gflags_nothreads_unittest_LDADD = libgflags.la
# We also want to test that things work properly when the file that
# holds main() has a name ending with -main or _main. To keep the
# Makefile small :-), we test the no-threads version of these.
-TESTS += gflags_unittest2
-gflags_unittest2_SOURCES = $(googleinclude_HEADERS) src/config.h \
+TESTS += gflags_unittest2$(EXEEXT)
+gflags_unittest2_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest-main.cc
gflags_unittest2_LDADD = libgflags.la
src/gflags_unittest-main.cc: src/gflags_unittest.cc
@@ -82,8 +81,8 @@
cp -p src/gflags_unittest.cc src/gflags_unittest-main.cc
CLEANFILES += src/gflags_unittest-main.cc
-TESTS += gflags_unittest3
-gflags_unittest3_SOURCES = $(googleinclude_HEADERS) src/config.h \
+TESTS += gflags_unittest3$(EXEEXT)
+gflags_unittest3_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest_main.cc
gflags_unittest3_LDADD = libgflags.la
src/gflags_unittest_main.cc: src/gflags_unittest.cc
@@ -91,12 +90,18 @@
cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc
CLEANFILES += src/gflags_unittest_main.cc
-
+# Some buggy sh's ignore "" instead of treating it as a positional
+# parameter. Since we use "" in this script, we prefer bash if we
+# can. If there's no bash, we fall back to sh.
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 gflags_unittest2 gflags_unittest3
- $(top_srcdir)/src/gflags_unittest.sh $(PWD)/$< $(top_srcdir)
+dist_noinst_DATA = src/gflags_unittest_flagfile
+gflags_unittest_sh: gflags_unittest$(EXEEXT) \
+ gflags_unittest2$(EXEEXT) \
+ gflags_unittest3$(EXEEXT)
+ bash --version >/dev/null && export SH=bash || export SH=sh; \
+ $$SH "$(top_srcdir)/src/gflags_unittest.sh" "$(PWD)/gflags_unittest" \
+ "$(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 b353fca..f89964a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -45,11 +45,12 @@
@GCC_TRUE@am__append_1 = -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
noinst_PROGRAMS = $(am__EXEEXT_1)
DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
- $(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 \
- $(top_srcdir)/src/google/gflags_completions.h.in AUTHORS \
+ $(dist_noinst_DATA) $(gflagsinclude_HEADERS) \
+ $(googleinclude_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/configure \
+ $(top_srcdir)/src/config.h.in \
+ $(top_srcdir)/src/gflags/gflags.h.in \
+ $(top_srcdir)/src/gflags/gflags_completions.h.in AUTHORS \
COPYING ChangeLog INSTALL NEWS compile config.guess config.sub \
depcomp install-sh ltmain.sh missing mkinstalldirs
subdir = .
@@ -65,8 +66,8 @@
configure.lineno configure.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/config.h
-CONFIG_CLEAN_FILES = src/google/gflags.h \
- src/google/gflags_completions.h
+CONFIG_CLEAN_FILES = src/gflags/gflags.h \
+ src/gflags/gflags_completions.h
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -74,7 +75,8 @@
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
- "$(DESTDIR)$(docdir)" "$(DESTDIR)$(googleincludedir)"
+ "$(DESTDIR)$(docdir)" "$(DESTDIR)$(gflagsincludedir)" \
+ "$(DESTDIR)$(googleincludedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
@@ -135,8 +137,9 @@
$(gflags_unittest3_SOURCES)
dist_docDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_doc_DATA) $(dist_noinst_DATA)
+gflagsincludeHEADERS_INSTALL = $(INSTALL_HEADER)
googleincludeHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(googleinclude_HEADERS)
+HEADERS = $(gflagsinclude_HEADERS) $(googleinclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -216,7 +219,7 @@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_cv___attribute__unused = @ac_cv___attribute__unused@
-ac_cv_have___uint16 = @ac_cv_have___uint16@
+ac_cv_have___int16 = @ac_cv_have___int16@
ac_cv_have_inttypes_h = @ac_cv_have_inttypes_h@
ac_cv_have_stdint_h = @ac_cv_have_stdint_h@
ac_cv_have_systypes_h = @ac_cv_have_systypes_h@
@@ -267,11 +270,15 @@
# Make sure that when we re-make ./configure, we get the macros we need
ACLOCAL_AMFLAGS = -I m4
-# This is so we can #include <google/foo>
+# This is so we can #include <gflags/foo>
AM_CPPFLAGS = -I$(top_srcdir)/src
# This is mostly based on configure options
AM_CXXFLAGS = $(am__append_1)
+gflagsincludedir = $(includedir)/gflags
+gflagsinclude_HEADERS = src/gflags/gflags.h src/gflags/gflags_completions.h
+
+# This is for backwards compatibility only.
googleincludedir = $(includedir)/google
googleinclude_HEADERS = src/google/gflags.h src/google/gflags_completions.h
bin_SCRIPTS = src/gflags_completions.sh
@@ -286,22 +293,26 @@
# We also want to test that things work properly when the file that
# holds main() has a name ending with -main or _main. To keep the
# Makefile small :-), we test the no-threads version of these.
-TESTS = gflags_unittest gflags_nothreads_unittest gflags_unittest2 \
- gflags_unittest3
+TESTS = gflags_unittest$(EXEEXT) gflags_nothreads_unittest$(EXEEXT) \
+ gflags_unittest2$(EXEEXT) gflags_unittest3$(EXEEXT)
TESTS_ENVIRONMENT = SRCDIR="$(top_srcdir)"
+
+# Some buggy sh's ignore "" instead of treating it as a positional
+# parameter. Since we use "" in this script, we prefer bash if we
+# can. If there's no bash, we fall back to sh.
check_SCRIPTS = gflags_unittest_sh
# Every time you add a unittest to check_SCRIPTS, add it here too
noinst_SCRIPTS = src/gflags_unittest.sh
# Used for auto-generated source files
CLEANFILES = src/gflags_unittest-main.cc src/gflags_unittest_main.cc
-libgflags_la_SOURCES = $(googleinclude_HEADERS) src/config.h \
+libgflags_la_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags.cc src/gflags_reporting.cc \
src/gflags_completions.cc
libgflags_la_CXXFLAGS = $(PTHREAD_CFLAGS) -DNDEBUG
libgflags_la_LDFLAGS = $(PTHREAD_CFLAGS)
libgflags_la_LIBADD = $(PTHREAD_LIBS)
-gflags_unittest_SOURCES = $(googleinclude_HEADERS) src/config.h \
+gflags_unittest_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest.cc
gflags_unittest_CXXFLAGS = $(PTHREAD_CFLAGS)
@@ -309,15 +320,15 @@
gflags_unittest_LDADD = libgflags.la $(PTHREAD_LIBS)
gflags_nothreads_unittest_SOURCES = $(gflags_unittest_SOURCES)
gflags_nothreads_unittest_LDADD = libgflags.la
-gflags_unittest2_SOURCES = $(googleinclude_HEADERS) src/config.h \
+gflags_unittest2_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest-main.cc
gflags_unittest2_LDADD = libgflags.la
-gflags_unittest3_SOURCES = $(googleinclude_HEADERS) src/config.h \
+gflags_unittest3_SOURCES = $(gflagsinclude_HEADERS) src/config.h \
src/gflags_unittest_main.cc
gflags_unittest3_LDADD = libgflags.la
-dist_noinst_DATA = $(top_srcdir)/src/gflags_unittest_flagfile
+dist_noinst_DATA = src/gflags_unittest_flagfile
# These aren't part of the c++ source, but we want them to be distributed
PYTHON = python/setup.py \
@@ -382,9 +393,9 @@
distclean-hdr:
-rm -f src/config.h src/stamp-h1
-src/google/gflags.h: $(top_builddir)/config.status $(top_srcdir)/src/google/gflags.h.in
+src/gflags/gflags.h: $(top_builddir)/config.status $(top_srcdir)/src/gflags/gflags.h.in
cd $(top_builddir) && $(SHELL) ./config.status $@
-src/google/gflags_completions.h: $(top_builddir)/config.status $(top_srcdir)/src/google/gflags_completions.h.in
+src/gflags/gflags_completions.h: $(top_builddir)/config.status $(top_srcdir)/src/gflags/gflags_completions.h.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@@ -592,6 +603,23 @@
echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \
rm -f "$(DESTDIR)$(docdir)/$$f"; \
done
+install-gflagsincludeHEADERS: $(gflagsinclude_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(gflagsincludedir)" || $(mkdir_p) "$(DESTDIR)$(gflagsincludedir)"
+ @list='$(gflagsinclude_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(gflagsincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(gflagsincludedir)/$$f'"; \
+ $(gflagsincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(gflagsincludedir)/$$f"; \
+ done
+
+uninstall-gflagsincludeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(gflagsinclude_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(gflagsincludedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(gflagsincludedir)/$$f"; \
+ done
install-googleincludeHEADERS: $(googleinclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(googleincludedir)" || $(mkdir_p) "$(DESTDIR)$(googleincludedir)"
@@ -734,7 +762,7 @@
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
- $(mkdir_p) $(distdir)/doc $(distdir)/m4 $(distdir)/packages $(distdir)/packages/rpm $(distdir)/python $(distdir)/src $(distdir)/src/google
+ $(mkdir_p) $(distdir)/doc $(distdir)/m4 $(distdir)/packages $(distdir)/packages/rpm $(distdir)/python $(distdir)/src $(distdir)/src/gflags $(distdir)/src/google
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
@@ -865,7 +893,7 @@
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \
$(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(googleincludedir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(docdir)" "$(DESTDIR)$(gflagsincludedir)" "$(DESTDIR)$(googleincludedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -915,7 +943,8 @@
info-am:
-install-data-am: install-dist_docDATA install-googleincludeHEADERS
+install-data-am: install-dist_docDATA install-gflagsincludeHEADERS \
+ install-googleincludeHEADERS
install-exec-am: install-binSCRIPTS install-libLTLIBRARIES
@@ -946,8 +975,8 @@
ps-am:
uninstall-am: uninstall-binSCRIPTS uninstall-dist_docDATA \
- uninstall-googleincludeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
+ uninstall-gflagsincludeHEADERS uninstall-googleincludeHEADERS \
+ uninstall-info-am uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
clean clean-generic clean-libLTLIBRARIES clean-libtool \
@@ -958,13 +987,14 @@
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-binSCRIPTS install-data \
install-data-am install-dist_docDATA install-exec \
- install-exec-am install-googleincludeHEADERS install-info \
- install-info-am install-libLTLIBRARIES install-man \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-binSCRIPTS uninstall-dist_docDATA \
+ install-exec-am install-gflagsincludeHEADERS \
+ install-googleincludeHEADERS install-info install-info-am \
+ install-libLTLIBRARIES install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binSCRIPTS \
+ uninstall-dist_docDATA uninstall-gflagsincludeHEADERS \
uninstall-googleincludeHEADERS uninstall-info-am \
uninstall-libLTLIBRARIES
@@ -974,8 +1004,12 @@
src/gflags_unittest_main.cc: src/gflags_unittest.cc
rm -f src/gflags_unittest_main.cc
cp -p src/gflags_unittest.cc src/gflags_unittest_main.cc
-gflags_unittest_sh: gflags_unittest gflags_unittest2 gflags_unittest3
- $(top_srcdir)/src/gflags_unittest.sh $(PWD)/$< $(top_srcdir)
+gflags_unittest_sh: gflags_unittest$(EXEEXT) \
+ gflags_unittest2$(EXEEXT) \
+ gflags_unittest3$(EXEEXT)
+ bash --version >/dev/null && export SH=bash || export SH=sh; \
+ $$SH "$(top_srcdir)/src/gflags_unittest.sh" "$(PWD)/gflags_unittest" \
+ "$(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 bae2dd0..c595d49 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -15,11 +15,41 @@
set -ex
rm -rf autom4te.cache
-aclocal --force -I m4
-grep -q LIBTOOL configure.ac && libtoolize -c -f
+trap 'rm -f aclocal.m4.tmp' EXIT
+
+# Use version 1.9 of aclocal and automake if available.
+ACLOCAL=aclocal-1.9
+if test -z `which "$ACLOCAL"`; then
+ ACLOCAL=aclocal
+fi
+
+AUTOMAKE=automake-1.9
+if test -z `which "$AUTOMAKE"`; then
+ AUTOMAKE=automake
+fi
+
+# glibtoolize is used for Mac OS X
+LIBTOOLIZE=libtoolize
+if test -z `which "$LIBTOOLIZE"`; then
+ LIBTOOLIZE=glibtoolize
+fi
+
+# aclocal tries to overwrite aclocal.m4 even if the contents haven't
+# changed, which is annoying when the file is not open for edit (in
+# p4). We work around this by writing to a temp file and just
+# updating the timestamp if the file hasn't change.
+"$ACLOCAL" --force -I m4 --output=aclocal.m4.tmp
+if cmp aclocal.m4.tmp aclocal.m4; then
+ touch aclocal.m4 # pretend that we regenerated the file
+ rm -f aclocal.m4.tmp
+else
+ mv aclocal.m4.tmp aclocal.m4 # we did set -e above, so we die if this fails
+fi
+
+grep -q LIBTOOL configure.ac && "$LIBTOOLIZE" -c -f
autoconf -f -W all,no-obsolete
autoheader -f -W all
-automake -a -c -f -W all
+"$AUTOMAKE" -a -c -f -W all
rm -rf autom4te.cache
exit 0
diff --git a/configure b/configure
index 29b59c0..db958d3 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.9.
+# Generated by GNU Autoconf 2.59 for gflags 1.0rc1.
#
# Report bugs to <opensource@google.com>.
#
@@ -423,8 +423,8 @@
# Identity of this package.
PACKAGE_NAME='gflags'
PACKAGE_TARNAME='gflags'
-PACKAGE_VERSION='0.9'
-PACKAGE_STRING='gflags 0.9'
+PACKAGE_VERSION='1.0rc1'
+PACKAGE_STRING='gflags 1.0rc1'
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 GCC_TRUE GCC_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_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 GCC_TRUE GCC_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___int16 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.9 to adapt to many kinds of systems.
+\`configure' configures gflags 1.0rc1 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.9:";;
+ short | recursive ) echo "Configuration of gflags 1.0rc1:";;
esac
cat <<\_ACEOF
@@ -1163,7 +1163,7 @@
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-gflags configure 0.9
+gflags configure 1.0rc1
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.9, which was
+It was created by gflags $as_me 1.0rc1, 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.9'
+ VERSION='1.0rc1'
cat >>confdefs.h <<_ACEOF
@@ -19185,6 +19185,156 @@
+
+for ac_header in fnmatch.h windows.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+ # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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 -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
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+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
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 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); } >/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
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So? What about this header?
+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 compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=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: 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 opensource@google.com ##
+## ------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
# These are the types I need. We look for them in either stdint.h,
# sys/types.h, or inttypes.h, all of which are part of the default-includes.
echo "$as_me:$LINENO: checking for uint16_t" >&5
@@ -19309,9 +19459,9 @@
ac_cv_have_u_int16_t=0
fi
-echo "$as_me:$LINENO: checking for __uint16" >&5
-echo $ECHO_N "checking for __uint16... $ECHO_C" >&6
-if test "${ac_cv_type___uint16+set}" = set; then
+echo "$as_me:$LINENO: checking for __int16" >&5
+echo $ECHO_N "checking for __int16... $ECHO_C" >&6
+if test "${ac_cv_type___int16+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -19324,9 +19474,9 @@
int
main ()
{
-if ((__uint16 *) 0)
+if ((__int16 *) 0)
return 0;
-if (sizeof (__uint16))
+if (sizeof (__int16))
return 0;
;
return 0;
@@ -19353,26 +19503,26 @@
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_cv_type___uint16=yes
+ ac_cv_type___int16=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-ac_cv_type___uint16=no
+ac_cv_type___int16=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-echo "$as_me:$LINENO: result: $ac_cv_type___uint16" >&5
-echo "${ECHO_T}$ac_cv_type___uint16" >&6
-if test $ac_cv_type___uint16 = yes; then
- ac_cv_have___uint16=1
+echo "$as_me:$LINENO: result: $ac_cv_type___int16" >&5
+echo "${ECHO_T}$ac_cv_type___int16" >&6
+if test $ac_cv_type___int16 = yes; then
+ ac_cv_have___int16=1
else
- ac_cv_have___uint16=0
+ ac_cv_have___int16=0
fi
-for ac_func in strtoll
+for ac_func in InitializeCriticalSection
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -19473,7 +19623,109 @@
done
-for ac_func in strtoq
+for ac_func in InterlockedCompareExchange
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* 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"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+ ;
+ 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
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+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
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+for ac_func in strtoll strtoq
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -20617,7 +20869,7 @@
## Check out ../autoconf/ for other macros you can call to do useful stuff
# Write generated configuration file, and also .h files
- ac_config_files="$ac_config_files Makefile src/google/gflags.h src/google/gflags_completions.h"
+ ac_config_files="$ac_config_files Makefile src/gflags/gflags.h src/gflags/gflags_completions.h"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -21009,7 +21261,7 @@
} >&5
cat >&5 <<_CSEOF
-This file was extended by gflags $as_me 0.9, which was
+This file was extended by gflags $as_me 1.0rc1, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21072,7 +21324,7 @@
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-gflags config.status 0.9
+gflags config.status 1.0rc1
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -21183,8 +21435,8 @@
case "$ac_config_target" in
# Handling of arguments.
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "src/google/gflags.h" ) CONFIG_FILES="$CONFIG_FILES src/google/gflags.h" ;;
- "src/google/gflags_completions.h" ) CONFIG_FILES="$CONFIG_FILES src/google/gflags_completions.h" ;;
+ "src/gflags/gflags.h" ) CONFIG_FILES="$CONFIG_FILES src/gflags/gflags.h" ;;
+ "src/gflags/gflags_completions.h" ) CONFIG_FILES="$CONFIG_FILES src/gflags/gflags_completions.h" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
@@ -21353,7 +21605,7 @@
s,@ac_cv_have_inttypes_h@,$ac_cv_have_inttypes_h,;t t
s,@ac_cv_have_uint16_t@,$ac_cv_have_uint16_t,;t t
s,@ac_cv_have_u_int16_t@,$ac_cv_have_u_int16_t,;t t
-s,@ac_cv_have___uint16@,$ac_cv_have___uint16,;t t
+s,@ac_cv_have___int16@,$ac_cv_have___int16,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/configure.ac b/configure.ac
index c0a8e03..ab48ea4 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.9, opensource@google.com)
+AC_INIT(gflags, 1.0rc1, opensource@google.com)
# The argument here is just something that should be in the current directory
# (for sanity checking)
AC_CONFIG_SRCDIR(README)
@@ -28,15 +28,17 @@
AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
+AC_CHECK_HEADERS([fnmatch.h windows.h])
# These are the types I need. We look for them in either stdint.h,
# sys/types.h, or inttypes.h, all of which are part of the default-includes.
AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
-AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0)
+AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0)
-AC_CHECK_FUNCS(strtoll)
-AC_CHECK_FUNCS(strtoq)
+AC_CHECK_FUNCS([InitializeCriticalSection])
+AC_CHECK_FUNCS([InterlockedCompareExchange])
+AC_CHECK_FUNCS([strtoll strtoq])
AX_C___ATTRIBUTE__
# We only care about __attribute__ ((unused))
@@ -63,10 +65,10 @@
AC_SUBST(ac_cv_have_inttypes_h)
AC_SUBST(ac_cv_have_uint16_t)
AC_SUBST(ac_cv_have_u_int16_t)
-AC_SUBST(ac_cv_have___uint16)
+AC_SUBST(ac_cv_have___int16)
## Check out ../autoconf/ for other macros you can call to do useful stuff
# Write generated configuration file, and also .h files
-AC_CONFIG_FILES([Makefile src/google/gflags.h src/google/gflags_completions.h])
+AC_CONFIG_FILES([Makefile src/gflags/gflags.h src/gflags/gflags_completions.h])
AC_OUTPUT
diff --git a/packages/deb/README b/packages/deb/README
deleted file mode 100644
index 57becfd..0000000
--- a/packages/deb/README
+++ /dev/null
@@ -1,7 +0,0 @@
-The list of files here isn't complete. For a step-by-step guide on
-how to set this package up correctly, check out
- http://www.debian.org/doc/maint-guide/
-
-Most of the files that are in this directory are boilerplate.
-However, you may need to change the list of binary-arch dependencies
-in 'rules'.
diff --git a/packages/deb/changelog b/packages/deb/changelog
index 361b387..9fd9e03 100644
--- a/packages/deb/changelog
+++ b/packages/deb/changelog
@@ -1,3 +1,9 @@
+google-gflags (1.0rc1-1) unstable; urgency=low
+
+ * New upstream release.
+
+ -- Google Inc. <opensource@google.com> Tue, 19 Aug 2008 16:15:48 -0700
+
google-gflags (0.9-1) unstable; urgency=low
* New upstream release.
diff --git a/packages/deb/libgoogle-gflags-dev.dirs b/packages/deb/libgoogle-gflags-dev.dirs
index 9fdbd88..99c10c5 100644
--- a/packages/deb/libgoogle-gflags-dev.dirs
+++ b/packages/deb/libgoogle-gflags-dev.dirs
@@ -1,3 +1,4 @@
usr/lib
usr/include
usr/include/google
+usr/include/gflags
diff --git a/packages/deb/libgoogle-gflags-dev.install b/packages/deb/libgoogle-gflags-dev.install
index d81ff20..28c47a7 100644
--- a/packages/deb/libgoogle-gflags-dev.install
+++ b/packages/deb/libgoogle-gflags-dev.install
@@ -1,8 +1,10 @@
usr/include/google/*
+usr/include/gflags/*
usr/lib/lib*.so
usr/lib/lib*.a
usr/lib/*.la
debian/tmp/usr/include/google/*
+debian/tmp/usr/include/gflags/*
debian/tmp/usr/lib/lib*.so
debian/tmp/usr/lib/lib*.a
debian/tmp/usr/lib/*.la
diff --git a/packages/rpm/rpm.spec b/packages/rpm/rpm.spec
index f2259cc..ae5f1e2 100644
--- a/packages/rpm/rpm.spec
+++ b/packages/rpm/rpm.spec
@@ -52,7 +52,13 @@
%files
%defattr(-,root,root)
-%doc AUTHORS COPYING ChangeLog INSTALL NEWS README doc/designstyle.css doc/gflags.html
+## Mark all installed files within /usr/share/doc/{package name} as
+## documentation. This depends on the following two lines appearing in
+## Makefile.am:
+## docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
+## dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README
+%docdir %{prefix}/share/doc/%{NAME}-%{VERSION}
+%{prefix}/share/doc/%{NAME}-%{VERSION}/*
%{prefix}/lib/libgflags.so.0
%{prefix}/lib/libgflags.so.0.0.0
@@ -62,6 +68,7 @@
%defattr(-,root,root)
%{prefix}/include/google
+%{prefix}/include/gflags
%{prefix}/lib/libgflags.a
%{prefix}/lib/libgflags.la
%{prefix}/lib/libgflags.so
diff --git a/src/config.h.in b/src/config.h.in
index 5ee6275..4362e84 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -6,6 +6,15 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* Define to 1 if you have the <fnmatch.h> header file. */
+#undef HAVE_FNMATCH_H
+
+/* Define to 1 if you have the `InitializeCriticalSection' function. */
+#undef HAVE_INITIALIZECRITICALSECTION
+
+/* Define to 1 if you have the `InterlockedCompareExchange' function. */
+#undef HAVE_INTERLOCKEDCOMPAREEXCHANGE
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -45,6 +54,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
/* define if your compiler has __attribute__ */
#undef HAVE___ATTRIBUTE__
diff --git a/src/gflags.cc b/src/gflags.cc
index 3d4881a..893d585 100644
--- a/src/gflags.cc
+++ b/src/gflags.cc
@@ -89,20 +89,34 @@
// are, similarly, mostly hooks into the functionality described above.
#include "config.h"
+// This comes first to ensure we define __STDC_FORMAT_MACROS in time.
+#ifdef HAVE_INTTYPES_H
+#ifndef __STDC_FORMAT_MACROS
+# define __STDC_FORMAT_MACROS 1 // gcc requires this to get PRId64, etc.
+#endif
+#include <inttypes.h>
+#endif // HAVE_INTTYPES_H
#include <stdio.h> // for snprintf
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
+#ifdef HAVE_FNMATCH_H
#include <fnmatch.h>
+#endif // HAVE_FNMATCH_H
+#ifdef HAVE_PTHREAD
#include <pthread.h>
+#endif // HAVE_PTHREAD
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif // HAVE_WINDOWS_H
#include <iostream> // for cerr
#include <string>
#include <map>
#include <vector>
#include <utility> // for pair<>
#include <algorithm>
-#include "google/gflags.h"
+#include "gflags/gflags.h"
#ifndef PATH_SEPARATOR
#define PATH_SEPARATOR '/'
@@ -121,17 +135,31 @@
# define strtouint64 strtoul
#endif
+// If we have inttypes.h, it will have defined PRId32/etc for us. If
+// not, take our best guess.
+#ifndef PRId32
+# define PRId32 "d"
+#endif
+#ifndef PRId64
+# define PRId64 "lld"
+#endif
+#ifndef PRIu64
+# define PRIu64 "llu"
+#endif
+
using std::string;
using std::map;
using std::vector;
using std::pair;
using std::cerr;
+using std::sort;
// Special flags, type 1: the 'recursive' flags. They set another flag's val.
DEFINE_string(flagfile, "",
"load flags from file");
DEFINE_string(fromenv, "",
- "set flags from the environment [use 'export FLAGS_flag1=value']");
+ "set flags from the environment"
+ " [use 'export FLAGS_flag1=value']");
DEFINE_string(tryfromenv, "",
"set flags from the environment if present");
@@ -147,7 +175,7 @@
// The help message indicating that the commandline flag has been
// 'stripped'. It will not show up when doing "-help" and its
// variants. The flag is stripped if STRIP_FLAG_HELP is set to 1
-// before including google/gflags.h.
+// before including gflags/gflags.h.
// This is used by this file, and also in commandlineflags_reporting.cc
const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001";
@@ -191,9 +219,9 @@
string ToString() const;
private:
- friend class CommandLineFlag; // for many things, including Validate()
- friend class GOOGLE_NAMESPACE::FlagSaverImpl; // calls New()
- friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map
+ friend class CommandLineFlag; // for many things, including Validate()
+ friend class GOOGLE_NAMESPACE::FlagSaverImpl; // calls New()
+ friend class FlagRegistry; // checks value_buffer_ for flags_by_ptr_ map
template <typename T> friend T GetFromEnv(const char*, const char*, T);
friend bool TryParseLocked(const class CommandLineFlag*, FlagValue*,
const char*, string*); // for New(), CopyFrom()
@@ -250,7 +278,7 @@
if (type_ == FV_BOOL) {
const char* kTrue[] = { "1", "t", "true", "y", "yes" };
const char* kFalse[] = { "0", "f", "false", "n", "no" };
- for (int i = 0; i < sizeof(kTrue)/sizeof(*kTrue); ++i) {
+ for (size_t i = 0; i < sizeof(kTrue)/sizeof(*kTrue); ++i) {
if (strcasecmp(value, kTrue[i]) == 0) {
SET_VALUE_AS(bool, true);
return true;
@@ -307,7 +335,7 @@
return true;
}
default: {
- assert(false); // unknown type
+ assert(false); // unknown type
return false;
}
}
@@ -319,13 +347,13 @@
case FV_BOOL:
return VALUE_AS(bool) ? "true" : "false";
case FV_INT32:
- snprintf(intbuf, sizeof(intbuf), "%d", VALUE_AS(int32));
+ snprintf(intbuf, sizeof(intbuf), "%"PRId32, VALUE_AS(int32));
return intbuf;
case FV_INT64:
- snprintf(intbuf, sizeof(intbuf), "%lld", VALUE_AS(int64));
+ snprintf(intbuf, sizeof(intbuf), "%"PRId64, VALUE_AS(int64));
return intbuf;
case FV_UINT64:
- snprintf(intbuf, sizeof(intbuf), "%llu", VALUE_AS(uint64));
+ snprintf(intbuf, sizeof(intbuf), "%"PRIu64, VALUE_AS(uint64));
return intbuf;
case FV_DOUBLE:
snprintf(intbuf, sizeof(intbuf), "%.17g", VALUE_AS(double));
@@ -333,7 +361,8 @@
case FV_STRING:
return VALUE_AS(string);
default:
- assert(false); return ""; // unknown type
+ assert(false);
+ return ""; // unknown type
}
}
@@ -359,7 +388,7 @@
return reinterpret_cast<bool (*)(const char*, const string&)>(
validate_fn_proto)(flagname, VALUE_AS(string));
default:
- assert(false); // unknown type
+ assert(false); // unknown type
return false;
}
}
@@ -372,7 +401,7 @@
case FV_UINT64: return "uint64";
case FV_DOUBLE: return "double";
case FV_STRING: return "string";
- default: assert(false); return ""; // unknown type
+ default: assert(false); return ""; // unknown type
}
}
@@ -386,19 +415,19 @@
case FV_UINT64: return VALUE_AS(uint64) == OTHER_VALUE_AS(x, uint64);
case FV_DOUBLE: return VALUE_AS(double) == OTHER_VALUE_AS(x, double);
case FV_STRING: return VALUE_AS(string) == OTHER_VALUE_AS(x, string);
- default: assert(false); return false; // unknown type
+ default: assert(false); return false; // unknown type
}
}
FlagValue* FlagValue::New() const {
switch (type_) {
- case FV_BOOL: return new FlagValue(new bool, "bool");
- case FV_INT32: return new FlagValue(new int32, "int32");
- case FV_INT64: return new FlagValue(new int64, "int64");
- case FV_UINT64: return new FlagValue(new uint64, "uint64");
- case FV_DOUBLE: return new FlagValue(new double, "double");
+ case FV_BOOL: return new FlagValue(new bool(false), "bool");
+ case FV_INT32: return new FlagValue(new int32(0), "int32");
+ case FV_INT64: return new FlagValue(new int64(0), "int64");
+ case FV_UINT64: return new FlagValue(new uint64(0), "uint64");
+ case FV_DOUBLE: return new FlagValue(new double(0.0), "double");
case FV_STRING: return new FlagValue(new string, "string");
- default: assert(false); return NULL; // assert false
+ default: assert(false); return NULL; // unknown type
}
}
@@ -411,7 +440,7 @@
case FV_UINT64: SET_VALUE_AS(uint64, OTHER_VALUE_AS(x, uint64)); break;
case FV_DOUBLE: SET_VALUE_AS(double, OTHER_VALUE_AS(x, double)); break;
case FV_STRING: SET_VALUE_AS(string, OTHER_VALUE_AS(x, string)); break;
- default: assert(false); // unknown type
+ default: assert(false); // unknown type
}
}
@@ -449,10 +478,12 @@
bool ValidateCurrent() const { return Validate(*current_); }
private:
- friend class FlagRegistry; // for SetFlagLocked() and setting flags_by_ptr_
- friend class GOOGLE_NAMESPACE::FlagSaverImpl; // for cloning the values
+ // for SetFlagLocked() and setting flags_by_ptr_
+ friend class FlagRegistry;
+ friend class GOOGLE_NAMESPACE::FlagSaverImpl; // for cloning the values
friend bool GetCommandLineOption(const char*, string*, bool*);
- friend bool AddFlagValidator(const void*, ValidateFnProto); // set validate_fn
+ // set validate_fn
+ friend bool AddFlagValidator(const void*, ValidateFnProto);
// This copies all the non-const members: modified, processed, defvalue, etc.
void CopyFrom(const CommandLineFlag& src);
@@ -535,10 +566,11 @@
void CommandLineFlag::CopyFrom(const CommandLineFlag& src) {
// Note we only copy the non-const members; others are fixed at construct time
- modified_ = src.modified_;
- current_->CopyFrom(*src.current_);
- defvalue_->CopyFrom(*src.defvalue_);
- validate_fn_proto_ = src.validate_fn_proto_;
+ if (modified_ != src.modified_) modified_ = src.modified_;
+ if (!current_->Equal(*src.current_)) current_->CopyFrom(*src.current_);
+ if (!defvalue_->Equal(*src.defvalue_)) defvalue_->CopyFrom(*src.defvalue_);
+ if (validate_fn_proto_ != src.validate_fn_proto_)
+ validate_fn_proto_ = src.validate_fn_proto_;
}
bool CommandLineFlag::Validate(const FlagValue& value) const {
@@ -565,19 +597,17 @@
}
};
-#define SAFE_PTHREAD(fncall) do { if ((fncall) != 0) abort(); } while (0)
-
class FlagRegistry {
public:
- FlagRegistry() { SAFE_PTHREAD(pthread_mutex_init(&lock_, NULL)); }
- ~FlagRegistry() { SAFE_PTHREAD(pthread_mutex_destroy(&lock_)); }
+ FlagRegistry();
+ ~FlagRegistry();
+
+ void Lock();
+ void Unlock();
// Store a flag in this registry. Takes ownership of the given pointer.
void RegisterFlag(CommandLineFlag* flag);
- void Lock() { SAFE_PTHREAD(pthread_mutex_lock(&lock_)); }
- void Unlock() { SAFE_PTHREAD(pthread_mutex_unlock(&lock_)); }
-
// Returns the flag object for the specified name, or NULL if not found.
CommandLineFlag* FindFlagLocked(const char* name);
@@ -618,12 +648,20 @@
typedef map<const void*, CommandLineFlag*> FlagPtrMap;
FlagPtrMap flags_by_ptr_;
+#if defined(HAVE_PTHREAD)
pthread_mutex_t lock_;
+#elif defined(HAVE_INITIALIZECRITICALSECTION)
+ CRITICAL_SECTION lock_;
+#else
+#error "Need to define a mutual-exclusion object for your system"
+#endif
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
+ // If global_registry_ has not yet been initialized, this function allocates
+ // a new global registry. If InterlockedCompareExchange() is available, it
+ // does so in a thread-safe manner; otherwise, single-threaded execution (or
+ // serialization using pthread_once) is assumed.
static void InitGlobalRegistry();
// Disallow
@@ -631,14 +669,98 @@
FlagRegistry& operator=(const FlagRegistry&);
};
-class FlagRegistryLock {
- public:
- explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); }
- ~FlagRegistryLock() { fr_->Unlock(); }
- private:
- FlagRegistry *const fr_;
-};
+#if defined(HAVE_PTHREAD)
+// The pthread.h header is available. The pthreads library may or may not be
+// linked in with -lpthread. If that library is not linked in, then it is
+// assumed that all operations involving command-line flags will be
+// single-threaded.
+#define SAFE_PTHREAD(fncall) do { if ((fncall) != 0) abort(); } while (0)
+
+inline FlagRegistry::FlagRegistry() {
+ SAFE_PTHREAD(pthread_mutex_init(&lock_, NULL));
+}
+inline FlagRegistry::~FlagRegistry() {
+ SAFE_PTHREAD(pthread_mutex_destroy(&lock_));
+}
+
+inline void FlagRegistry::Lock() {
+ SAFE_PTHREAD(pthread_mutex_lock(&lock_));
+}
+inline void FlagRegistry::Unlock() {
+ SAFE_PTHREAD(pthread_mutex_unlock(&lock_));
+}
+
+// We want to use pthread_once here, for safety, but have to worry about
+// whether libpthread is linked in or not. We declare a weak version of
+// the function, so we'll always compile (if the weak version is the only
+// one that ends up existing, then pthread_once will be equal to NULL).
+#ifdef HAVE___ATTRIBUTE__
+ // __THROW is defined in glibc systems. It means, counter-intuitively,
+ // "This function will never throw an exception." It's an optional
+ // optimization tool, but we may need to use it to match glibc prototypes.
+# ifndef __THROW // I guess we're not on a glibc system
+# define __THROW // __THROW is just an optimization, so ok to make it ""
+# endif
+extern "C" int pthread_once(pthread_once_t *, void (*)(void))
+ __THROW __attribute__((weak));
+#endif
+
+FlagRegistry* FlagRegistry::GlobalRegistry() {
+ if (pthread_once) { // means we're linked with -lpthread
+ static pthread_once_t global_registry_once = PTHREAD_ONCE_INIT;
+ pthread_once(&global_registry_once, &InitGlobalRegistry);
+ } else {
+ // Assume single-threaded execution.
+ InitGlobalRegistry();
+ }
+ return global_registry_;
+}
+
+#elif defined(HAVE_INITIALIZECRITICALSECTION)
+// The Windows version of the thread-safe code uses EnterCriticalSection and
+// LeaveCriticalSection to serialize access to the registry.
+
+#ifndef HAVE_INTERLOCKEDCOMPAREEXCHANGE
+// InitializeCriticalSection is available, but InterlockedCompareExchange
+// is not. On a Windows system both should be available, and on Unix, neither
+// one should be available.
+#error "Please check settings for HAVE_INTERLOCKED... and HAVE_INITIALIZE..."
+#endif // !HAVE_INTERLOCKEDCOMPAREEXCHANGE
+
+inline FlagRegistry::FlagRegistry() { InitializeCriticalSection(&lock_); }
+inline FlagRegistry::~FlagRegistry() { DeleteCriticalSection(&lock_); }
+
+inline void FlagRegistry::Lock() { EnterCriticalSection(&lock_); }
+inline void FlagRegistry::Unlock() { LeaveCriticalSection(&lock_); }
+
+FlagRegistry* FlagRegistry::GlobalRegistry() {
+ InitGlobalRegistry();
+ return global_registry_;
+}
+#endif // !HAVE_PTHREAD && HAVE_INITIALIZECRITICALSECTION
+
+// Get the singleton FlagRegistry object
+FlagRegistry* FlagRegistry::global_registry_ = NULL;
+
+void FlagRegistry::InitGlobalRegistry() {
+ if (!global_registry_) {
+#ifdef HAVE_INTERLOCKEDCOMPAREEXCHANGE
+ FlagRegistry* new_global_registry = new FlagRegistry;
+ if (InterlockedCompareExchangePointer(
+ reinterpret_cast<void* volatile *>(&global_registry_),
+ new_global_registry,
+ NULL) != NULL) {
+ // Some other thread initialized global_registry_ first.
+ delete new_global_registry;
+ }
+#else // !HAVE_INTERLOCKEDCOMPAREEXCHANGE
+ // Assume single-threaded execution, or else that this function call was
+ // serialized using pthread_once.
+ global_registry_ = new FlagRegistry;
+#endif // HAVE_INTERLOCKEDCOMPAREEXCHANGE
+ }
+}
void FlagRegistry::RegisterFlag(CommandLineFlag* flag) {
Lock();
@@ -756,7 +878,7 @@
delete tentative_value;
return false;
} else if (!flag->Validate(*tentative_value)) {
- if (msg){
+ if (msg) {
*msg += (string(kError) + "failed validation of new value "
+ "'" + tentative_value->ToString() + "' for flag '" +
+ flag->name() + "'\n");
@@ -810,46 +932,21 @@
}
default: {
// unknown set_mode
- assert(false); return false;
+ assert(false);
+ return false;
}
}
return true;
}
-// 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. We declare a weak version of
-// the function, so we'll always compile (if the weak version is the only
-// one that ends up existing, then pthread_once will be equal to NULL).
-#ifdef HAVE___ATTRIBUTE__
- // __THROW is defined in glibc systems. It means, counter-intuitively,
- // "This function will never throw an exception." It's an optional
- // optimization tool, but we may need to use it to match glibc prototypes.
-# ifndef __THROW // I guess we're not on a glibc system
-# define __THROW // __THROW is just an optimization, so ok to make it ""
-# endif
-extern "C" int pthread_once(pthread_once_t *, void (*)(void))
- __THROW __attribute__((weak));
-#endif
-
-FlagRegistry* FlagRegistry::GlobalRegistry() {
- 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_;
-}
+class FlagRegistryLock {
+ public:
+ explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); }
+ ~FlagRegistryLock() { fr_->Unlock(); }
+ private:
+ FlagRegistry *const fr_;
+};
// --------------------------------------------------------------------
// CommandLineFlagParser
@@ -915,14 +1012,15 @@
// These are called by ProcessSingleOptionLocked and, similarly, return
// new values if everything went ok, or the empty-string if not.
string ProcessFlagfileLocked(const string& flagval, FlagSettingMode set_mode);
+ // diff fromenv/tryfromenv
string ProcessFromenvLocked(const string& flagval, FlagSettingMode set_mode,
- bool errors_are_fatal); // diff fromenv/tryfromenv
+ bool errors_are_fatal);
private:
FlagRegistry* const registry_;
- map<string, string> error_flags_; // map from name to error message
+ map<string, string> error_flags_; // map from name to error message
// This could be a set<string>, but we reuse the map to minimize the .o size
- map<string, string> undefined_names_; // --name for name that's not registered
+ map<string, string> undefined_names_; // --[flag] name was not registered
};
@@ -932,10 +1030,10 @@
p = strchr(value, ',');
int len;
if (p) {
- len = p - value;
+ len = static_cast<int>(p - value);
p++;
} else {
- len = strlen(value);
+ len = static_cast<int>(strlen(value));
}
if (len == 0) {
@@ -958,13 +1056,13 @@
#define PFATAL(s) do { perror(s); commandlineflags_exitfunc(1); } while (0)
static string ReadFileIntoString(const char* filename) {
- const int bufsize = 8092;
- char buffer[bufsize];
+ const int kBufSize = 8092;
+ char buffer[kBufSize];
string s;
FILE* fp = fopen(filename, "r");
if (!fp) PFATAL(filename);
- int n;
- while ( (n=fread(buffer, 1, bufsize, fp)) > 0 ) {
+ size_t n;
+ while ( (n=fread(buffer, 1, kBufSize, fp)) > 0 ) {
if (ferror(fp)) PFATAL(filename);
s.append(buffer, n);
}
@@ -1019,8 +1117,13 @@
assert(strcmp(flag->type_name(), "bool") != 0);
if (i+1 >= first_nonopt) {
// This flag needs a value, but there is nothing available
- error_flags_[key] = (string(kError) + "flag '" + (*argv)[i] + "'" +
- + " is missing its argument\n");
+ error_flags_[key] = (string(kError) + "flag '" + (*argv)[i] + "'"
+ + " is missing its argument");
+ if (flag->help() && flag->help()[0] > '\001') {
+ // Be useful in case we have a non-stripped description.
+ error_flags_[key] += string("; flag description: ") + flag->help();
+ }
+ error_flags_[key] += "\n";
break; // we treat this as an unrecoverable error
} else {
value = (*argv)[++i]; // read next arg for value
@@ -1052,7 +1155,7 @@
string msg;
vector<string> filename_list;
ParseFlagList(flagval.c_str(), &filename_list); // take a list of filenames
- for (int i = 0; i < filename_list.size(); ++i) {
+ for (size_t i = 0; i < filename_list.size(); ++i) {
const char* file = filename_list[i].c_str();
msg += ProcessOptionsFromStringLocked(ReadFileIntoString(file), set_mode);
}
@@ -1069,7 +1172,7 @@
vector<string> flaglist;
ParseFlagList(flagval.c_str(), &flaglist);
- for (int i = 0; i < flaglist.size(); ++i) {
+ for (size_t i = 0; i < flaglist.size(); ++i) {
const char* flagname = flaglist[i].c_str();
CommandLineFlag* flag = registry_->FindFlagLocked(flagname);
if (flag == NULL) {
@@ -1123,7 +1226,6 @@
} else if (strcmp(flag->name(), "tryfromenv") == 0) {
msg += ProcessFromenvLocked(FLAGS_tryfromenv, set_mode, false);
-
}
return msg;
@@ -1152,7 +1254,7 @@
if (!FLAGS_undefok.empty()) {
vector<string> flaglist;
ParseFlagList(FLAGS_undefok.c_str(), &flaglist);
- for (int i = 0; i < flaglist.size(); ++i)
+ for (size_t i = 0; i < flaglist.size(); ++i)
if (undefined_names_.find(flaglist[i]) != undefined_names_.end()) {
error_flags_[flaglist[i]] = ""; // clear the error message
}
@@ -1161,13 +1263,13 @@
// are ok; we just silently ignore them now, and hope that a future
// parse will pick them up somehow.
if (allow_command_line_reparsing) {
- for (map<string,string>::const_iterator it = undefined_names_.begin();
+ for (map<string, string>::const_iterator it = undefined_names_.begin();
it != undefined_names_.end(); ++it)
error_flags_[it->first] = ""; // clear the error message
}
bool found_error = false;
- for (map<string,string>::const_iterator it = error_flags_.begin();
+ for (map<string, string>::const_iterator it = error_flags_.begin();
it != error_flags_.end(); ++it) {
if (!it->second.empty()) {
fprintf(stderr, "%s", it->second.c_str());
@@ -1190,7 +1292,8 @@
while (*flagfile_contents && isspace(*flagfile_contents))
++flagfile_contents;
line_end = strchr(flagfile_contents, '\n');
- int len = line_end ? line_end-flagfile_contents : strlen(flagfile_contents);
+ size_t len = line_end ? static_cast<size_t>(line_end - flagfile_contents)
+ : strlen(flagfile_contents);
string line(flagfile_contents, len);
// Each line can be one of four things:
@@ -1240,8 +1343,17 @@
space = word + strlen(word);
const string glob(word, space - word);
// We try matching both against the full argv0 and basename(argv0)
- if (fnmatch(glob.c_str(), ProgramInvocationName(), FNM_PATHNAME) == 0 ||
- fnmatch(glob.c_str(), ProgramInvocationShortName(), FNM_PATHNAME) == 0) {
+#ifdef HAVE_FNMATCH_H
+ if (fnmatch(glob.c_str(),
+ ProgramInvocationName(),
+ FNM_PATHNAME) == 0 ||
+ fnmatch(glob.c_str(),
+ ProgramInvocationShortName(),
+ FNM_PATHNAME) == 0) {
+#else // !HAVE_FNMATCH_H
+ if ((glob == ProgramInvocationName()) ||
+ (glob == ProgramInvocationShortName())) {
+#endif // HAVE_FNMATCH_H
flags_are_relevant = true;
}
}
@@ -1393,8 +1505,7 @@
static const char* cmdline = ""; // the entire command-line
static vector<string> argvs;
static uint32 argv_sum = 0;
-static const char* program_usage = "Warning: SetUsageMessage() never called";
-static bool program_usage_set = false;
+static const char* program_usage = NULL;
void SetArgv(int argc, const char** argv) {
static bool called_set_argv = false;
@@ -1407,11 +1518,11 @@
argv0 = strdup(argv[0]); // small memory leak, but fn only called once
assert(argv0);
- string cmdline_string = string(""); // easier than doing strcats
- argvs.clear();
+ string cmdline_string; // easier than doing strcats
for (int i = 0; i < argc; i++) {
- if (i != 0)
+ if (i != 0) {
cmdline_string += " ";
+ }
cmdline_string += argv[i];
argvs.push_back(argv[i]);
}
@@ -1419,7 +1530,6 @@
assert(cmdline);
// Compute a simple sum of all the chars in argv
- argv_sum = 0;
for (const char* c = cmdline; *c; c++)
argv_sum += *c;
}
@@ -1440,17 +1550,18 @@
}
void SetUsageMessage(const string& usage) {
- if (program_usage_set) {
- fprintf(stderr, "ERROR: SetUsageMessage() called more than once\n");
+ if (program_usage != NULL) {
+ fprintf(stderr, "ERROR: SetUsageMessage() called twice\n");
exit(1);
}
-
program_usage = strdup(usage.c_str()); // small memory leak
- program_usage_set = true;
}
const char* ProgramUsage() {
- return program_usage;
+ if (program_usage) {
+ return program_usage;
+ }
+ return "Warning: SetUsageMessage() never called";
}
// --------------------------------------------------------------------
@@ -1600,7 +1711,8 @@
void operator=(const FlagSaverImpl&);
};
-FlagSaver::FlagSaver() : impl_(new FlagSaverImpl(FlagRegistry::GlobalRegistry())) {
+FlagSaver::FlagSaver()
+ : impl_(new FlagSaverImpl(FlagRegistry::GlobalRegistry())) {
impl_->SaveFromRegistry();
}
@@ -1629,7 +1741,7 @@
const vector<CommandLineFlagInfo>& flags) {
vector<CommandLineFlagInfo>::const_iterator i;
- int retval_space = 0;
+ size_t retval_space = 0;
for (i = flags.begin(); i != flags.end(); ++i) {
// An (over)estimate of how much space it will take to print this flag
retval_space += i->name.length() + i->current_value.length() + 5;
@@ -1654,7 +1766,7 @@
}
bool ReadFlagsFromString(const string& flagfilecontents,
- const char* prog_name, // TODO(csilvers): nix this
+ const char* /*prog_name*/, // TODO(csilvers): nix this
bool errors_are_fatal) {
FlagRegistry* const registry = FlagRegistry::GlobalRegistry();
FlagSaverImpl saved_states(registry);
@@ -1844,7 +1956,7 @@
// dlopen, to get the new flags. But you have to explicitly
// Allow() it; otherwise, you get the normal default behavior
// of unrecognized flags calling a fatal error.
-// TODO(csilvers): this isn't used. Just delete it?
+// TODO(csilvers): this isn't used. Just delete it?
// --------------------------------------------------------------------
void AllowCommandLineReparsing() {
@@ -1854,7 +1966,7 @@
uint32 ReparseCommandLineNonHelpFlags() {
// We make a copy of argc and argv to pass in
const vector<string>& argvs = GetArgvs();
- int tmp_argc = argvs.size();
+ int tmp_argc = static_cast<int>(argvs.size());
char** tmp_argv = new char* [tmp_argc + 1];
for (int i = 0; i < tmp_argc; ++i)
tmp_argv[i] = strdup(argvs[i].c_str()); // TODO(csilvers): don't dup
diff --git a/src/google/gflags.h.in b/src/gflags/gflags.h.in
similarity index 98%
rename from src/google/gflags.h.in
rename to src/gflags/gflags.h.in
index b6f4e69..12a989a 100644
--- a/src/google/gflags.h.in
+++ b/src/gflags/gflags.h.in
@@ -103,11 +103,11 @@
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
-#elif @ac_cv_have___uint16@ // the windows (vc7) format
+#elif @ac_cv_have___int16@ // the windows (vc7) format
typedef __int32 int32;
-typedef __uint32 uint32;
+typedef unsigned __int32 uint32;
typedef __int64 int64;
-typedef __uint64 uint64;
+typedef unsigned __int64 uint64;
#else
#error Do not know how to define a 32-bit integer quantity on your system
#endif
@@ -504,7 +504,7 @@
#define DEFINE_string(name, val, txt) \
namespace fLS { \
static union { void* align; char s[sizeof(std::string)]; } s_##name[2]; \
- const string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \
+ const std::string* const FLAGS_no##name = new (s_##name[0].s) std::string(val); \
static @ac_google_namespace@::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) std::string(*FLAGS_no##name)); \
diff --git a/src/google/gflags_completions.h.in b/src/gflags/gflags_completions.h.in
similarity index 100%
rename from src/google/gflags_completions.h.in
rename to src/gflags/gflags_completions.h.in
diff --git a/src/gflags_completions.cc b/src/gflags_completions.cc
index a573cfa..cc75b2f 100644
--- a/src/gflags_completions.cc
+++ b/src/gflags_completions.cc
@@ -56,7 +56,7 @@
#include <utility>
#include <vector>
-#include "google/gflags.h"
+#include "gflags/gflags.h"
using std::set;
using std::string;
@@ -145,7 +145,7 @@
const string &footer,
bool long_output_format,
int *remaining_line_limit,
- int *completion_elements_added,
+ size_t *completion_elements_added,
vector<string> *completions);
// (helpers for #5)
@@ -424,7 +424,7 @@
all_matches.begin();
it != all_matches.end();
++it) {
- //VLOG(2) << "Examinging match '" << (*it)->name << "'";
+ //VLOG(2) << "Examining match '" << (*it)->name << "'";
//VLOG(7) << " filename: '" << (*it)->filename << "'";
string::size_type pos = string::npos;
if (!package_dir.empty())
@@ -507,6 +507,17 @@
string header;
string footer;
set<const CommandLineFlagInfo *> *group;
+
+ int SizeInLines() const {
+ int size_in_lines = static_cast<int>(group->size()) + 1;
+ if (!header.empty()) {
+ size_in_lines++;
+ }
+ if (!footer.empty()) {
+ size_in_lines++;
+ }
+ return size_in_lines;
+ }
};
// 4) Finalize and trim output flag set
@@ -533,45 +544,47 @@
if (lines_so_far < max_desired_lines &&
!notable_flags->perfect_match_flag.empty()) {
perfect_match_found = true;
- lines_so_far += notable_flags->perfect_match_flag.size() + 2; // no header
DisplayInfoGroup group =
- { "", "==========", ¬able_flags->perfect_match_flag };
+ { string(),
+ "==========",
+ ¬able_flags->perfect_match_flag };
+ lines_so_far += group.SizeInLines();
output_groups.push_back(group);
}
if (lines_so_far < max_desired_lines &&
!notable_flags->module_flags.empty()) {
- lines_so_far += notable_flags->module_flags.size() + 3;
DisplayInfoGroup group = {
"-* Matching module flags *-",
"===========================",
¬able_flags->module_flags };
+ lines_so_far += group.SizeInLines();
output_groups.push_back(group);
}
if (lines_so_far < max_desired_lines &&
!notable_flags->package_flags.empty()) {
- lines_so_far += notable_flags->package_flags.size() + 3;
DisplayInfoGroup group = {
"-* Matching package flags *-",
"============================",
¬able_flags->package_flags };
+ lines_so_far += group.SizeInLines();
output_groups.push_back(group);
}
if (lines_so_far < max_desired_lines &&
!notable_flags->most_common_flags.empty()) {
- lines_so_far += notable_flags->most_common_flags.size() + 3;
DisplayInfoGroup group = {
"-* Commonly used flags *-",
"=========================",
¬able_flags->most_common_flags };
+ lines_so_far += group.SizeInLines();
output_groups.push_back(group);
}
if (lines_so_far < max_desired_lines &&
!notable_flags->subpackage_flags.empty()) {
- lines_so_far += notable_flags->subpackage_flags.size() + 3;
DisplayInfoGroup group = {
"-* Matching sub-package flags *-",
"================================",
¬able_flags->subpackage_flags };
+ lines_so_far += group.SizeInLines();
output_groups.push_back(group);
}
@@ -579,11 +592,11 @@
if (lines_so_far < max_desired_lines) {
RetrieveUnusedFlags(matching_flags, *notable_flags, &obscure_flags);
if (!obscure_flags.empty()) {
- lines_so_far += obscure_flags.size() + 2; // no footer
DisplayInfoGroup group = {
"-* Other flags *-",
- "",
+ string(),
&obscure_flags };
+ lines_so_far += group.SizeInLines();
output_groups.push_back(group);
}
}
@@ -591,8 +604,8 @@
// Second, go through each of the chosen output groups and output
// as many of those flags as we can, while remaining below our limit
int remaining_lines = max_desired_lines;
- int completions_output = 0;
- int indent = output_groups.size() - 1;
+ size_t completions_output = 0;
+ int indent = static_cast<int>(output_groups.size()) - 1;
for (vector<DisplayInfoGroup>::const_iterator it =
output_groups.begin();
it != output_groups.end();
@@ -646,7 +659,7 @@
const string &footer,
bool long_output_format,
int *remaining_line_limit,
- int *completion_elements_output,
+ size_t *completion_elements_output,
vector<string> *completions) {
if (group.empty()) return;
if (!header.empty()) {
@@ -681,11 +694,12 @@
("'" + info.default_value + "'") :
info.default_value)
+ "] ";
- int remainder = FLAGS_tab_completion_columns - prefix.size();
- string suffix = "";
+ int remainder =
+ FLAGS_tab_completion_columns - static_cast<int>(prefix.size());
+ string suffix;
if (remainder > 0)
suffix =
- (info.description.size() > remainder ?
+ (static_cast<int>(info.description.size()) > remainder ?
(info.description.substr(0, remainder - 3) + "...").c_str() :
info.description.c_str());
return prefix + suffix;
@@ -726,7 +740,7 @@
for (string::size_type newline = output.find('\n');
newline != string::npos;
newline = output.find('\n')) {
- int newline_pos = newline % FLAGS_tab_completion_columns;
+ int newline_pos = static_cast<int>(newline) % FLAGS_tab_completion_columns;
int missing_spaces = FLAGS_tab_completion_columns - newline_pos;
output.replace(newline, 1, line_of_spaces, 1, missing_spaces);
}
diff --git a/src/gflags_reporting.cc b/src/gflags_reporting.cc
index 835036c..e69cbf4 100644
--- a/src/gflags_reporting.cc
+++ b/src/gflags_reporting.cc
@@ -55,8 +55,8 @@
#include <assert.h>
#include <string>
#include <vector>
-#include "google/gflags.h"
-#include "google/gflags_completions.h"
+#include "gflags/gflags.h"
+#include "gflags/gflags_completions.h"
#ifndef PATH_SEPARATOR
#define PATH_SEPARATOR '/'
@@ -97,7 +97,7 @@
static void AddString(const string& s,
string* final_string, int* chars_in_line) {
- const int slen = s.length();
+ const int slen = static_cast<int>(s.length());
if (*chars_in_line + 1 + slen >= kLineLength) { // < 80 chars/line
*final_string += "\n ";
*chars_in_line = 6;
@@ -115,7 +115,7 @@
string main_part = (string(" -") + flag.name +
" (" + flag.description + ')');
const char* c_string = main_part.c_str();
- int chars_left = main_part.length();
+ int chars_left = static_cast<int>(main_part.length());
string final_string = "";
int chars_in_line = 0; // how many chars in current line so far?
while (1) {
@@ -128,7 +128,7 @@
break;
}
if (newline != NULL && newline - c_string < kLineLength - chars_in_line) {
- int n = newline - c_string;
+ int n = static_cast<int>(newline - c_string);
final_string.append(c_string, n);
chars_left -= n + 1;
c_string += n + 1;
@@ -185,9 +185,9 @@
// Simple routine to xml-escape a string: escape & and < only.
static string XMLText(const string& txt) {
string ans = txt;
- for (string::size_type pos = 0; (pos=ans.find("&", pos)) != string::npos; )
+ for (string::size_type pos = 0; (pos = ans.find("&", pos)) != string::npos; )
ans.replace(pos++, 1, "&");
- for (string::size_type pos = 0; (pos=ans.find("<", pos)) != string::npos; )
+ for (string::size_type pos = 0; (pos = ans.find("<", pos)) != string::npos; )
ans.replace(pos++, 1, "<");
return ans;
}
@@ -244,7 +244,7 @@
// Show help for every filename which matches any of the target substrings.
// If substrings is empty, shows help for every file. If a flag's help message
// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' before
-// including google/gflags.h), then this flag will not be displayed by
+// including gflags/gflags.h), then this flag will not be displayed by
// '--help' and its variants.
static void ShowUsageWithFlagsMatching(const char *argv0,
const vector<string> &substrings) {
@@ -253,7 +253,7 @@
vector<CommandLineFlagInfo> flags;
GetAllFlags(&flags); // flags are sorted by filename, then flagname
- string last_filename = ""; // so we know when we're at a new file
+ string last_filename; // so we know when we're at a new file
bool first_directory = true; // controls blank lines between dirs
bool found_match = false; // stays false iff no dir matches restrict
for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin();
@@ -384,7 +384,7 @@
substrings.push_back(string("/") + progname + ".");
substrings.push_back(string("/") + progname + "-main.");
substrings.push_back(string("/") + progname + "_main.");
- string last_package = "";
+ string last_package;
for (vector<CommandLineFlagInfo>::const_iterator flag = flags.begin();
flag != flags.end();
++flag) {
@@ -393,14 +393,14 @@
const string package = Dirname(flag->filename) + "/";
if (package != last_package) {
ShowUsageWithFlagsRestrict(progname, package.c_str());
- if (last_package != "") { // means this isn't our first pkg
+ if (!last_package.empty()) { // means this isn't our first pkg
fprintf(stderr, "WARNING: Multiple packages contain a file=%s\n",
progname);
}
last_package = package;
}
}
- if (last_package == "") { // never found a package to print
+ if (last_package.empty()) { // never found a package to print
fprintf(stderr, "WARNING: Unable to find a package for file=%s\n",
progname);
}
diff --git a/src/gflags_unittest.cc b/src/gflags_unittest.cc
index b322826..079d5ec 100644
--- a/src/gflags_unittest.cc
+++ b/src/gflags_unittest.cc
@@ -42,7 +42,12 @@
#include <math.h> // for isinf() and isnan()
#include <vector>
#include <string>
-#include "google/gflags.h"
+#include "gflags/gflags.h"
+// I don't actually use this header file, but #include it under the
+// old location to make sure that the include-header-forwarding
+// works.
+#include "google/gflags_completions.h"
+void (*unused_fn)() = &GOOGLE_NAMESPACE::HandleCommandLineCompletions;
using std::vector;
using std::string;
@@ -151,6 +156,11 @@
#define EXPECT_GT(val1, val2) EXPECT_OP(>, val1, val2)
#define EXPECT_LT(val1, val2) EXPECT_OP(<, val1, val2)
+// C99 declares isnan and isinf should be macros, so the #ifdef test
+// should be reliable everywhere. Of course, it's not, but these
+// are testing pertty marginal functionality anyway, so it's ok to
+// not-run them even in situations they might, with effort, be made to work.
+#ifdef isnan // Some compilers, like sun's for Solaris 10, don't define this
#define EXPECT_NAN(arg) \
do { \
if (!isnan(arg)) { \
@@ -158,7 +168,11 @@
exit(1); \
} \
} while (0)
+#else
+#define EXPECT_NAN(arg)
+#endif
+#ifdef isinf // Some compilers, like sun's for Solaris 10, don't define this
#define EXPECT_INF(arg) \
do { \
if (!isinf(arg)) { \
@@ -166,6 +180,9 @@
exit(1); \
} \
} while (0)
+#else
+#define EXPECT_INF(arg)
+#endif
#define EXPECT_DOUBLE_EQ(val1, val2) \
do { \
@@ -497,6 +514,7 @@
// Tests that flags can be set to exceptional values.
TEST(SetFlagValueTest, ExceptionalValues) {
+#ifdef isinf // on systems without isinf, inf stuff may not work at all
EXPECT_EQ("test_double set to inf\n",
SetCommandLineOption("test_double", "inf"));
EXPECT_INF(FLAGS_test_double);
@@ -504,6 +522,7 @@
EXPECT_EQ("test_double set to inf\n",
SetCommandLineOption("test_double", "INF"));
EXPECT_INF(FLAGS_test_double);
+#endif
// set some bad values
EXPECT_EQ("",
@@ -512,14 +531,18 @@
SetCommandLineOption("test_double", " "));
EXPECT_EQ("",
SetCommandLineOption("test_double", ""));
+#ifdef isinf
EXPECT_EQ("test_double set to -inf\n",
SetCommandLineOption("test_double", "-inf"));
EXPECT_INF(FLAGS_test_double);
EXPECT_GT(0, FLAGS_test_double);
+#endif
+#ifdef isnan
EXPECT_EQ("test_double set to nan\n",
SetCommandLineOption("test_double", "NaN"));
EXPECT_NAN(FLAGS_test_double);
+#endif
}
// Tests that integer flags can be specified in many ways
diff --git a/src/gflags_unittest.sh b/src/gflags_unittest.sh
index b14064c..52f2cc6 100755
--- a/src/gflags_unittest.sh
+++ b/src/gflags_unittest.sh
@@ -42,13 +42,13 @@
exit 1
fi
-EXE=$1
-SRCDIR=${2:-./}
-TMPDIR=${3:-/tmp/gflags}
+EXE="$1"
+SRCDIR="${2:-./}"
+TMPDIR="${3:-/tmp/gflags}"
# Executables built with the main source file suffixed with "-main" and "_main".
-EXE2=${EXE}2 # eg, gflags_unittest2
-EXE3=${EXE}3 # eg, gflags_unittest3
+EXE2="${EXE}2" # eg, gflags_unittest2
+EXE3="${EXE}3" # eg, gflags_unittest3
# $1: executable
# $2: line-number $3: expected return code. $4: substring of expected output.
@@ -66,7 +66,7 @@
shift
# We always add --srcdir=$SRCDIR because it's needed for correctness
- $executable --srcdir="$SRCDIR" "$@" > "$TMPDIR/test.$line_number" 2>&1
+ "$executable" --srcdir="$SRCDIR" "$@" > "$TMPDIR/test.$line_number" 2>&1
local actual_rc=$?
if [ $actual_rc != $expected_rc ]; then
echo "Test on line $line_number failed:" \
@@ -74,13 +74,13 @@
exit 1;
fi
if [ -n "$expected_output" ] &&
- ! fgrep -q -- "$expected_output" "$TMPDIR/test.$line_number"; then
+ ! fgrep -e "$expected_output" "$TMPDIR/test.$line_number" >/dev/null; then
echo "Test on line $line_number failed:" \
"did not find expected substring '$expected_output'"
exit 1;
fi
if [ -n "$unexpected_output" ] &&
- fgrep -q -- "$unexpected_output" "$TMPDIR/test.$line_number"; then
+ fgrep -e "$unexpected_output" "$TMPDIR/test.$line_number" >/dev/null; then
echo "Test line $line_number failed:" \
"found unexpected substring '$unexpected_output'"
exit 1;
@@ -90,17 +90,17 @@
# $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
Expect() {
- ExpectExe $EXE "$@"
+ ExpectExe "$EXE" "$@"
}
-rm -rf $TMPDIR
-mkdir $TMPDIR || exit 2
+rm -rf "$TMPDIR"
+mkdir "$TMPDIR" || exit 2
# Create a few flagfiles we can use later
-echo "--version" > $TMPDIR/flagfile.1
-echo "--foo=bar" > $TMPDIR/flagfile.2
-echo "--nounused_bool" >> $TMPDIR/flagfile.2
-echo "--flagfile=$TMPDIR/flagfile.2" > $TMPDIR/flagfile.3
+echo "--version" > "$TMPDIR/flagfile.1"
+echo "--foo=bar" > "$TMPDIR/flagfile.2"
+echo "--nounused_bool" >> "$TMPDIR/flagfile.2"
+echo "--flagfile=$TMPDIR/flagfile.2" > "$TMPDIR/flagfile.3"
# Set a few environment variables (useful for --tryfromenv)
export FLAGS_undefok=foo,bar
@@ -131,13 +131,15 @@
Expect $LINENO 1 "/gflags_unittest.cc" "/gflags_reporting.cc" --helpshort
# --helpshort should work if the main source file is suffixed with [_-]main
-ExpectExe $EXE2 $LINENO 1 "/gflags_unittest-main.cc" "/gflags_reporting.cc" \
+ExpectExe "$EXE2" $LINENO 1 "/gflags_unittest-main.cc" "/gflags_reporting.cc" \
--helpshort
-ExpectExe $EXE3 $LINENO 1 "/gflags_unittest_main.cc" "/gflags_reporting.cc" \
+ExpectExe "$EXE3" $LINENO 1 "/gflags_unittest_main.cc" "/gflags_reporting.cc" \
--helpshort
# --helpon needs an argument
-Expect $LINENO 1 "'--helpon' is missing its argument" "" --helpon
+Expect $LINENO 1 \
+ "'--helpon' is missing its argument; flag description: show help on" \
+ "" --helpon
# --helpon argument indicates what file we'll show args from
Expect $LINENO 1 "/gflags.cc" "/gflags_unittest.cc" --helpon=gflags
@@ -183,9 +185,9 @@
# See if we can successfully load our flags from the flagfile
Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" \
- --flagfile=$TMPDIR/flagfile.1
-Expect $LINENO 0 "PASS" "" --flagfile=$TMPDIR/flagfile.2
-Expect $LINENO 0 "PASS" "" --flagfile=$TMPDIR/flagfile.3
+ --flagfile="$TMPDIR/flagfile.1"
+Expect $LINENO 0 "PASS" "" --flagfile="$TMPDIR/flagfile.2"
+Expect $LINENO 0 "PASS" "" --flagfile="$TMPDIR/flagfile.3"
# Also try to load flags from the environment
Expect $LINENO 0 "gflags_unittest" "gflags_unittest.cc" --fromenv=version
diff --git a/src/google/gflags.h b/src/google/gflags.h
new file mode 100644
index 0000000..c1adcb8
--- /dev/null
+++ b/src/google/gflags.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2006, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Header files have moved from the google directory to the gflags
+// directory. This forwarding file is provided only for backwards
+// compatibility. Use gflags/gflags.h in all new code.
+
+#include <gflags/gflags.h>
diff --git a/src/google/gflags_completions.h b/src/google/gflags_completions.h
new file mode 100644
index 0000000..614ef09
--- /dev/null
+++ b/src/google/gflags_completions.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Header files have moved from the google directory to the gflags
+// directory. This forwarding file is provided only for backwards
+// compatibility. Use gflags/gflags_completions.h in all new code.
+
+#include <gflags/gflags_completions.h>