THRIFT-3572 Fix "Unable to determine the behavior of a signed right shift"
Client: Build (c_glib)
Patch: Chandler May

This closes #816
diff --git a/.gitignore b/.gitignore
index 5dad747..afcb8d5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -122,6 +122,7 @@
 /lib/c_glib/*.gcda
 /lib/c_glib/*.gcno
 /lib/c_glib/*.loT
+/lib/c_glib/src/thrift/config.h
 /lib/c_glib/test/*.gcno
 /lib/c_glib/test/testwrapper.sh
 /lib/c_glib/test/testwrapper-test*
diff --git a/configure.ac b/configure.ac
index 615c301..7dc5649 100755
--- a/configure.ac
+++ b/configure.ac
@@ -689,6 +689,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
 AH_TOP([
 #ifndef CONFIG_H
diff --git a/lib/c_glib/CMakeLists.txt b/lib/c_glib/CMakeLists.txt
index b409fbe..04bdba7 100644
--- a/lib/c_glib/CMakeLists.txt
+++ b/lib/c_glib/CMakeLists.txt
@@ -62,6 +62,9 @@
 # Install the headers
 install(DIRECTORY "src/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}"
     FILES_MATCHING PATTERN "*.h")
+# Copy config.h file
+install(DIRECTORY "${CMAKE_BINARY_DIR}/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}"
+    FILES_MATCHING PATTERN "*.h")
 
 if(BUILD_TESTING)
     add_subdirectory(test)
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_compact_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_compact_protocol.c
index 1b36904..5ff33b3 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_compact_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_compact_protocol.c
@@ -24,6 +24,8 @@
 #include <thrift/c_glib/protocol/thrift_protocol.h>
 #include <thrift/c_glib/protocol/thrift_compact_protocol.h>
 
+#include <thrift/config.h>
+
 /*
  * *_to_zigzag depend on the fact that the right shift
  * operator on a signed integer is an arithmetic (sign-extending) shift.