diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2015-06-12 15:49:21 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2015-06-16 18:27:36 -0700 |
commit | 78d470c7a50d3788bf3f819eba99597aea43674f (patch) | |
tree | f2d0c53ce1a94234cc4994ea319f1560f44b2f96 /src | |
parent | 4cbb612299eaf8259db25f5dcda46022fbd1db54 (diff) | |
download | protobuf-78d470c7a50d3788bf3f819eba99597aea43674f.tar.gz protobuf-78d470c7a50d3788bf3f819eba99597aea43674f.tar.bz2 protobuf-78d470c7a50d3788bf3f819eba99597aea43674f.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/google/protobuf/io/gzip_stream.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/io/zero_copy_stream_unittest.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/stubs/common.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/stubs/common_unittest.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/testing/zcgunzip.cc | 2 | ||||
-rw-r--r-- | src/google/protobuf/testing/zcgzip.cc | 2 |
7 files changed, 10 insertions, 14 deletions
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) diff --git a/src/google/protobuf/io/gzip_stream.cc b/src/google/protobuf/io/gzip_stream.cc index c9f4ca7f..dd7c036e 100644 --- a/src/google/protobuf/io/gzip_stream.cc +++ b/src/google/protobuf/io/gzip_stream.cc @@ -33,8 +33,6 @@ // This file contains the implementation of classes GzipInputStream and // GzipOutputStream. -#include "config.h" - #if HAVE_ZLIB #include <google/protobuf/io/gzip_stream.h> diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc index dd3d1285..f2e5b629 100644 --- a/src/google/protobuf/io/zero_copy_stream_unittest.cc +++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc @@ -46,8 +46,6 @@ // "parametized tests" so that one set of tests can be used on all the // implementations. -#include "config.h" - #ifdef _MSC_VER #include <io.h> #else diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc index 54e00ccb..22cc5aa1 100644 --- a/src/google/protobuf/stubs/common.cc +++ b/src/google/protobuf/stubs/common.cc @@ -36,8 +36,6 @@ #include <errno.h> #include <vector> -#include "config.h" - #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN // We only need minimal includes #include <windows.h> diff --git a/src/google/protobuf/stubs/common_unittest.cc b/src/google/protobuf/stubs/common_unittest.cc index 5f458e98..f9e2cfd4 100644 --- a/src/google/protobuf/stubs/common_unittest.cc +++ b/src/google/protobuf/stubs/common_unittest.cc @@ -39,8 +39,6 @@ #include <google/protobuf/testing/googletest.h> #include <gtest/gtest.h> -#include "config.h" - namespace google { namespace protobuf { namespace { diff --git a/src/google/protobuf/testing/zcgunzip.cc b/src/google/protobuf/testing/zcgunzip.cc index daf74ff1..c9d085c8 100644 --- a/src/google/protobuf/testing/zcgunzip.cc +++ b/src/google/protobuf/testing/zcgunzip.cc @@ -38,8 +38,6 @@ // Reads gzip stream on standard input and writes decompressed data to standard // output. -#include "config.h" - #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/src/google/protobuf/testing/zcgzip.cc b/src/google/protobuf/testing/zcgzip.cc index a4101999..e910f321 100644 --- a/src/google/protobuf/testing/zcgzip.cc +++ b/src/google/protobuf/testing/zcgzip.cc @@ -38,8 +38,6 @@ // Reads data on standard input and writes compressed gzip stream to standard // output. -#include "config.h" - #include <stdio.h> #include <stdlib.h> #include <fcntl.h> |