From 78d470c7a50d3788bf3f819eba99597aea43674f Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Fri, 12 Jun 2015 15:49:21 -0700 Subject: Make the code independent of config.h Now the Build tool needs to define -DHAVE_ZLIB and -DHAVE-PTHREAD rather than providing a config.h - Make pbconfig.h a manually written file to handle hash conditions according to platform related macros. - Remove #include "config.h" from source code. - Changed the configure.ac and Makefile.am to pass down the macros. - Change cmake to pass down the the macros. Change-Id: I537249d5df8fdeba189706aec436d1ab1104a4dc --- src/Makefile.am | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Makefile.am') diff --git a/src/Makefile.am b/src/Makefile.am index ac6ec6f4..67cd4c57 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,17 +4,25 @@ if HAVE_ZLIB GZCHECKPROGRAMS = zcgzip zcgunzip GZHEADERS = google/protobuf/io/gzip_stream.h GZTESTS = google/protobuf/io/gzip_stream_unittest.sh +ZLIB_DEF = -DHAVE_ZLIB=1 else GZCHECKPROGRAMS = GZHEADERS = GZTESTS = +ZLIB_DEF = +endif + +if HAVE_PTHREAD +PTHREAD_DEF = -DHAVE_PTHREAD=1 +else +PTHREAD_DEF = endif if GCC # These are good warnings to turn on by default -NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare +NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare else -NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) +NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_DEF) $(ZLIB_DEF) endif AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -- cgit v1.2.3