From b30b34afc11581109738eea7fdd5b40d38b825a4 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Wed, 15 Sep 2021 18:47:17 +0000 Subject: [PATCH 1/3] add --with-system-boost configure option for using system-wide boost headers --- builds/posix/make.defaults | 1 + builds/posix/make.rules | 4 ++++ configure.ac | 7 +++++++ src/include/firebird/Message.h | 8 ++++++++ 4 files changed, 20 insertions(+) diff --git a/builds/posix/make.defaults b/builds/posix/make.defaults index 2e5ba29d36e..6100e9eeb3f 100755 --- a/builds/posix/make.defaults +++ b/builds/posix/make.defaults @@ -50,6 +50,7 @@ IsCross=@IS_CROSS@ TOMMATH_BUILD_FLG=@TOMMATH_BUILD@ TOMCRYPT_BUILD_FLG=@TOMCRYPT_BUILD@ RE2_BUILD_FLG=@RE2_BUILD@ +LOCAL_BOOST_FLG=@LOCAL_BOOST@ FB_BUILD=$(GEN_ROOT)/$(TARGET)/firebird ifeq ($(IsCross), Y) diff --git a/builds/posix/make.rules b/builds/posix/make.rules index a075da8a1ff..29872f8c8c0 100644 --- a/builds/posix/make.rules +++ b/builds/posix/make.rules @@ -46,6 +46,10 @@ ifeq ($(RE2_BUILD_FLG),Y) WFLAGS += -I$(ROOT)/extern/re2 endif +ifneq ($(LOCAL_BOOST_FLG),Y) + WFLAGS += -DUSE_SYSTEM_BOOST +endif + ifeq ($(LSB_FLG),Y) WFLAGS += -DLSB_BUILD endif diff --git a/configure.ac b/configure.ac index 3ab8eb0bc4c..ad30b952859 100644 --- a/configure.ac +++ b/configure.ac @@ -560,6 +560,12 @@ AC_ARG_WITH(system-re2, [RE2_BUILD=N]) AC_SUBST(RE2_BUILD) +LOCAL_BOOST=Y +AC_ARG_WITH(system-boost, + [ --with-system-bools use system-wide boost library instead of embedded copy], + [LOCAL_BOOST=N]) +AC_SUBST(LOCAL_BOOST) + dnl Avoid dumb '-g -O2' autoconf's default dnl Debugging information and optimization flags should be set in prefix.$platform file dnl Should be replaced with AC_PROG_GCC_DEFAULT_FLAGS() when available @@ -616,6 +622,7 @@ if test "$LSB_FLG" = "Y"; then AC_SUBST(TOMMATH_BUILD, Y) AC_SUBST(TOMCRYPT_BUILD, Y) AC_SUBST(RE2_BUILD, Y) + AC_SUBST(LOCAL_BOOST, Y) AC_PATH_PROG(CC, lsbcc, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR]) AC_PATH_PROG(CXX, lsbc++, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR]) if test "x$CC" = "x" || test "x$CXX" = "x" ; then diff --git a/src/include/firebird/Message.h b/src/include/firebird/Message.h index 80b8cdb2563..28796f215c8 100644 --- a/src/include/firebird/Message.h +++ b/src/include/firebird/Message.h @@ -25,7 +25,15 @@ #include "ibase.h" #include "./Interface.h" +#if defined USE_SYSTEM_BOOST +#include +#define FB_BOOST_PP_CAT(a,b) BOOST_PP_CAT(a,b) +#define FB_BOOST_PP_SEQ_FOR_EACH_I(macro,data,seq) BOOST_PP_SEQ_FOR_EACH_I(macro,data,seq) +#define FB_BOOST_PP_SEQ_SIZE(req) BOOST_PP_SEQ_SIZE(req) +#define FB_BOOST_PP_TUPLE_ELEM(size,index,tuple) BOOST_PP_TUPLE_ELEM(size,index,tuple) +#else #include "./impl/boost/preprocessor/seq/for_each_i.hpp" +#endif #include #include From 959a48411af3dcf3cefb57b4e54a38dfef46eda0 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 16 Sep 2021 06:53:19 +0000 Subject: [PATCH 2/3] rename USE_SYSTEM_BOOST define to FB_USE_SYSTEM_BOOST avoids potential clashes with third party software which includes firebird/Message.h --- builds/posix/make.rules | 2 +- src/include/firebird/Message.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builds/posix/make.rules b/builds/posix/make.rules index 29872f8c8c0..714622af457 100644 --- a/builds/posix/make.rules +++ b/builds/posix/make.rules @@ -47,7 +47,7 @@ ifeq ($(RE2_BUILD_FLG),Y) endif ifneq ($(LOCAL_BOOST_FLG),Y) - WFLAGS += -DUSE_SYSTEM_BOOST + WFLAGS += -DFB_USE_SYSTEM_BOOST endif ifeq ($(LSB_FLG),Y) diff --git a/src/include/firebird/Message.h b/src/include/firebird/Message.h index 28796f215c8..e8da4ee175f 100644 --- a/src/include/firebird/Message.h +++ b/src/include/firebird/Message.h @@ -25,7 +25,7 @@ #include "ibase.h" #include "./Interface.h" -#if defined USE_SYSTEM_BOOST +#if defined FB_USE_SYSTEM_BOOST #include #define FB_BOOST_PP_CAT(a,b) BOOST_PP_CAT(a,b) #define FB_BOOST_PP_SEQ_FOR_EACH_I(macro,data,seq) BOOST_PP_SEQ_FOR_EACH_I(macro,data,seq) From 6c0a8ce118bb8160f5cdf185bdc640166949e3b1 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 17 Sep 2021 05:34:00 +0000 Subject: [PATCH 3/3] rework --with-system-boost using sed to adjust Message.h The problem with the #ifdef approach is that Message.h is a public header that is shipped to user systems and should not require defines to be usable --- builds/posix/Makefile.in | 5 +++++ builds/posix/make.defaults | 2 +- builds/posix/make.rules | 4 ---- configure.ac | 10 +++++----- src/include/firebird/Message.h | 8 -------- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/builds/posix/Makefile.in b/builds/posix/Makefile.in index 837af8ab2d2..bd6fc1a7c61 100644 --- a/builds/posix/Makefile.in +++ b/builds/posix/Makefile.in @@ -670,6 +670,11 @@ $(INCLUDE_DEST)/ib_util.h : $(SRC_OtherDistribHeaders) mkdir -p $(INCLUDE_DEST) $(CP) $^ $(INCLUDE_DEST)/ +ifeq ($(SYSTEM_BOOST_FLG),Y) +$(INCLUDE_DEST)/firebird/Message.h : $(SRC_ROOT)/include/firebird/Message.h + sed 's,^#include "\./impl/boost/\(.\+\)",#include ,; s/\bFB_BOOST_PP_/BOOST_PP_/g' $< > $@ +endif + $(INCLUDE_DEST)/firebird/%: $(SRC_ROOT)/include/firebird/% mkdir -p $(@D) $(CP) $< $@ diff --git a/builds/posix/make.defaults b/builds/posix/make.defaults index 6100e9eeb3f..09579255846 100755 --- a/builds/posix/make.defaults +++ b/builds/posix/make.defaults @@ -50,7 +50,7 @@ IsCross=@IS_CROSS@ TOMMATH_BUILD_FLG=@TOMMATH_BUILD@ TOMCRYPT_BUILD_FLG=@TOMCRYPT_BUILD@ RE2_BUILD_FLG=@RE2_BUILD@ -LOCAL_BOOST_FLG=@LOCAL_BOOST@ +SYSTEM_BOOST_FLG=@SYSTEM_BOOST@ FB_BUILD=$(GEN_ROOT)/$(TARGET)/firebird ifeq ($(IsCross), Y) diff --git a/builds/posix/make.rules b/builds/posix/make.rules index 714622af457..a075da8a1ff 100644 --- a/builds/posix/make.rules +++ b/builds/posix/make.rules @@ -46,10 +46,6 @@ ifeq ($(RE2_BUILD_FLG),Y) WFLAGS += -I$(ROOT)/extern/re2 endif -ifneq ($(LOCAL_BOOST_FLG),Y) - WFLAGS += -DFB_USE_SYSTEM_BOOST -endif - ifeq ($(LSB_FLG),Y) WFLAGS += -DLSB_BUILD endif diff --git a/configure.ac b/configure.ac index ad30b952859..5dac301374c 100644 --- a/configure.ac +++ b/configure.ac @@ -560,11 +560,11 @@ AC_ARG_WITH(system-re2, [RE2_BUILD=N]) AC_SUBST(RE2_BUILD) -LOCAL_BOOST=Y +SYSTEM_BOOST=N AC_ARG_WITH(system-boost, - [ --with-system-bools use system-wide boost library instead of embedded copy], - [LOCAL_BOOST=N]) -AC_SUBST(LOCAL_BOOST) + [ --with-system-boost use system-wide boost library instead of embedded copy], + [SYSTEM_BOOST=Y]) +AC_SUBST(SYSTEM_BOOST) dnl Avoid dumb '-g -O2' autoconf's default dnl Debugging information and optimization flags should be set in prefix.$platform file @@ -622,7 +622,7 @@ if test "$LSB_FLG" = "Y"; then AC_SUBST(TOMMATH_BUILD, Y) AC_SUBST(TOMCRYPT_BUILD, Y) AC_SUBST(RE2_BUILD, Y) - AC_SUBST(LOCAL_BOOST, Y) + AC_SUBST(SYSTEM_BOOST, N) AC_PATH_PROG(CC, lsbcc, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR]) AC_PATH_PROG(CXX, lsbc++, "", [$PATH$PATH_SEPARATOR/opt/lsb/bin$PATH_SEPARATOR]) if test "x$CC" = "x" || test "x$CXX" = "x" ; then diff --git a/src/include/firebird/Message.h b/src/include/firebird/Message.h index e8da4ee175f..80b8cdb2563 100644 --- a/src/include/firebird/Message.h +++ b/src/include/firebird/Message.h @@ -25,15 +25,7 @@ #include "ibase.h" #include "./Interface.h" -#if defined FB_USE_SYSTEM_BOOST -#include -#define FB_BOOST_PP_CAT(a,b) BOOST_PP_CAT(a,b) -#define FB_BOOST_PP_SEQ_FOR_EACH_I(macro,data,seq) BOOST_PP_SEQ_FOR_EACH_I(macro,data,seq) -#define FB_BOOST_PP_SEQ_SIZE(req) BOOST_PP_SEQ_SIZE(req) -#define FB_BOOST_PP_TUPLE_ELEM(size,index,tuple) BOOST_PP_TUPLE_ELEM(size,index,tuple) -#else #include "./impl/boost/preprocessor/seq/for_each_i.hpp" -#endif #include #include