THRIFT-4896 - prevent cpp and c_glib include directories from leaking into other targets (#1821)
- enable the automake `nostdinc` option
- fix up include paths
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 9a3aeda..91801c6 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -21,7 +21,7 @@
# Please see doc/old-thrift-license.txt in the Thrift distribution for
# details.
-AUTOMAKE_OPTIONS = subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects nostdinc
SUBDIRS = src .
if WITH_TESTS
diff --git a/compiler/cpp/src/Makefile.am b/compiler/cpp/src/Makefile.am
index b3139e2..0297708 100644
--- a/compiler/cpp/src/Makefile.am
+++ b/compiler/cpp/src/Makefile.am
@@ -21,7 +21,7 @@
# Please see doc/old-thrift-license.txt in the Thrift distribution for
# details.
-AUTOMAKE_OPTIONS = subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects nostdinc
AM_YFLAGS = -d
diff --git a/compiler/cpp/test/Makefile.am b/compiler/cpp/test/Makefile.am
index 9625834..801f9d8 100644
--- a/compiler/cpp/test/Makefile.am
+++ b/compiler/cpp/test/Makefile.am
@@ -21,7 +21,7 @@
# Please see doc/old-thrift-license.txt in the Thrift distribution for
# details.
-AUTOMAKE_OPTIONS = subdir-objects serial-tests
+AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/compiler/cpp/src
AM_LDFLAGS = $(BOOST_LDFLAGS)
diff --git a/configure.ac b/configure.ac
index 391cdb3..58f9319 100755
--- a/configure.ac
+++ b/configure.ac
@@ -776,7 +776,7 @@
AC_CONFIG_HEADERS(config.h:config.hin)
AC_CONFIG_HEADERS(lib/cpp/src/thrift/config.h:config.hin)
AC_CONFIG_HEADERS(lib/c_glib/src/thrift/config.h:config.hin)
-# gruard against pre defined config.h
+# guard against pre defined config.h
AH_TOP([
#ifndef CONFIG_H
#define CONFIG_H
diff --git a/lib/c_glib/Makefile.am b/lib/c_glib/Makefile.am
index 49b5b23..fd7f93d 100755
--- a/lib/c_glib/Makefile.am
+++ b/lib/c_glib/Makefile.am
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-AUTOMAKE_OPTIONS = serial-tests
+AUTOMAKE_OPTIONS = serial-tests nostdinc
SUBDIRS = . test
pkgconfigdir = $(libdir)/pkgconfig
@@ -59,7 +59,7 @@
src/thrift/c_glib/server/thrift_server.c \
src/thrift/c_glib/server/thrift_simple_server.c
-libthrift_c_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(OPENSSL_INCLUDES)
+libthrift_c_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(OPENSSL_INCLUDES) -I$(top_builddir)/lib/c_glib/src/thrift
libthrift_c_glib_la_LDFLAGS = $(AM_LDFLAGS) $(GLIB_LIBS) $(GOBJECT_LIBS) $(OPENSSL_LDFLAGS) $(OPENSSL_LIBS)
include_thriftdir = $(includedir)/thrift/c_glib
diff --git a/lib/c_glib/test/Makefile.am b/lib/c_glib/test/Makefile.am
index 5e9d2ea..c99e0da 100755
--- a/lib/c_glib/test/Makefile.am
+++ b/lib/c_glib/test/Makefile.am
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects serial-tests
+AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
SUBDIRS =
@@ -36,7 +36,7 @@
gen-c_glib/t_test_thrift_test.h \
gen-c_glib/t_test_thrift_test_types.h
-AM_CPPFLAGS = -I../src -I./gen-c_glib
+AM_CPPFLAGS = -I../src -I./gen-c_glib -I$(top_builddir)/lib/c_glib/src/thrift
AM_CFLAGS = -g -Wall -Wextra -pedantic $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(OPENSSL_INCLUDES) \
@GCOV_CFLAGS@
AM_CXXFLAGS = $(AM_CFLAGS)
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 114ff17..9b5fb4c 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -17,7 +17,7 @@
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects nostdinc
moc__%.cpp: %.h
$(QT5_MOC) $(QT5_CFLAGS) $< -o $@
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
index 5bb9eb7..2a0b9e6 100755
--- a/lib/cpp/test/Makefile.am
+++ b/lib/cpp/test/Makefile.am
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects serial-tests
+AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
BUILT_SOURCES = gen-cpp/AnnotationTest_types.h \
gen-cpp/DebugProtoTest_types.h \
@@ -408,7 +408,7 @@
gen-cpp/ChildService.cpp gen-cpp/ChildService.h gen-cpp/ParentService.cpp gen-cpp/ParentService.h gen-cpp/proc_types.cpp gen-cpp/proc_types.h: processor/proc.thrift
$(THRIFT) --gen cpp:templates,cob_style $<
-AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I.
+AM_CPPFLAGS = $(BOOST_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -I$(top_srcdir)/lib/cpp/src/thrift -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I.
AM_LDFLAGS = $(BOOST_LDFLAGS)
AM_CXXFLAGS = -Wall -Wextra -pedantic
diff --git a/lib/lua/Makefile.am b/lib/lua/Makefile.am
index 5b0f17a..3b272f5 100644
--- a/lib/lua/Makefile.am
+++ b/lib/lua/Makefile.am
@@ -17,7 +17,7 @@
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects nostdinc
SUBDIRS = .
diff --git a/test/c_glib/Makefile.am b/test/c_glib/Makefile.am
index 01ab2ca..98a3734 100755
--- a/test/c_glib/Makefile.am
+++ b/test/c_glib/Makefile.am
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects serial-tests
+AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
noinst_LTLIBRARIES = libtestcglib.la
nodist_libtestcglib_la_SOURCES = \
@@ -61,7 +61,7 @@
AM_CFLAGS = -g -Wall -Wextra $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)
AM_CXXFLAGS = $(AM_CFLAGS)
-AM_CPPFLAGS = -I$(top_srcdir)/lib/c_glib/src -Igen-c_glib
+AM_CPPFLAGS = -I$(top_srcdir)/lib/c_glib/src -Igen-c_glib -I$(top_builddir)/lib/c_glib/src/thrift
AM_LDFLAGS = $(GLIB_LIBS) $(GOBJECT_LIBS) @GCOV_LDFLAGS@
clean-local:
diff --git a/test/cpp/Makefile.am b/test/cpp/Makefile.am
index ebe715e..76ae82b 100755
--- a/test/cpp/Makefile.am
+++ b/test/cpp/Makefile.am
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects serial-tests
+AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
BUILT_SOURCES = gen-cpp/ThriftTest.cpp \
gen-cpp/ThriftTest_types.cpp \
@@ -108,7 +108,7 @@
gen-cpp/StressTest_types.cpp gen-cpp/StressTest_constants.cpp gen-cpp/Service.cpp: $(top_srcdir)/test/StressTest.thrift $(THRIFT)
$(THRIFT) --gen cpp $<
-AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(LIBEVENT_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -Igen-cpp
+AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(LIBEVENT_CPPFLAGS) -I$(top_srcdir)/lib/cpp/src -Igen-cpp -I.
AM_CXXFLAGS = -Wall -Wextra -pedantic -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
AM_LDFLAGS = $(BOOST_LDFLAGS) $(LIBEVENT_LDFLAGS) $(ZLIB_LIBS)
diff --git a/tutorial/c_glib/Makefile.am b/tutorial/c_glib/Makefile.am
index 4dbe655..f376494 100755
--- a/tutorial/c_glib/Makefile.am
+++ b/tutorial/c_glib/Makefile.am
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects serial-tests
+AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
BUILT_SOURCES = \
gen-c_glib/calculator.h \
@@ -24,7 +24,7 @@
gen-c_glib/shared_types.h \
gen-c_glib/tutorial_types.h
-AM_CFLAGS = -g -Wall -Wextra -pedantic $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(OPENSSL_INCLUDES) @GCOV_CFLAGS@
+AM_CFLAGS = -g -Wall -Wextra -pedantic $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) $(OPENSSL_INCLUDES) @GCOV_CFLAGS@ -I$(top_builddir)/lib/c_glib/src/thrift
AM_CPPFLAGS = -I$(top_srcdir)/lib/c_glib/src -Igen-c_glib
AM_LDFLAGS = $(GLIB_LIBS) $(GOBJECT_LIBS) $(OPENSSL_LDFLAGS) $(OPENSSL_LIBS) @GCOV_LDFLAGS@
diff --git a/tutorial/cpp/Makefile.am b/tutorial/cpp/Makefile.am
index 49cf3be..95497d5 100755
--- a/tutorial/cpp/Makefile.am
+++ b/tutorial/cpp/Makefile.am
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-AUTOMAKE_OPTIONS = subdir-objects serial-tests
+AUTOMAKE_OPTIONS = subdir-objects serial-tests nostdinc
BUILT_SOURCES = gen-cpp/shared_types.cpp \
gen-cpp/tutorial_types.cpp