diff --git a/BUILD.bazel b/BUILD.bazel index 0e2e66edd2..f8815bbb8a 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -29,7 +29,6 @@ COPTS = [ "-D__STDC_FORMAT_MACROS", "-D__STDC_LIMIT_MACROS", "-D__STDC_CONSTANT_MACROS", - "-DGFLAGS_NS=google", ] + select({ "//bazel/config:brpc_with_glog": ["-DBRPC_WITH_GLOG=1"], "//conditions:default": ["-DBRPC_WITH_GLOG=0"], @@ -104,6 +103,11 @@ genrule( "//conditions:default": "0", }) + """ + +#ifndef GFLAGS_NS +#define GFLAGS_NS google +#endif + #endif // BUTIL_CONFIG_H EOF """, diff --git a/config.h.in b/config.h.in index 4f26e57775..b28fee4779 100644 --- a/config.h.in +++ b/config.h.in @@ -21,4 +21,8 @@ #endif #cmakedefine BRPC_WITH_GLOG @WITH_GLOG_VAL@ +#ifndef GFLAGS_NS +#define GFLAGS_NS google +#endif + #endif // BUTIL_CONFIG_H diff --git a/config_brpc.sh b/config_brpc.sh index 2563b0e28e..5af2c67f50 100755 --- a/config_brpc.sh +++ b/config_brpc.sh @@ -493,7 +493,7 @@ fi append_to_output "CPPFLAGS=${CPPFLAGS}" append_to_output "# without the flag, linux+arm64 may crash due to folding on TLS. ifeq (\$(CC),gcc) - ifeq (\$(shell uname -p),aarch64) + ifeq (\$(shell uname -p),aarch64) CPPFLAGS+=-fno-gcse endif endif @@ -585,6 +585,10 @@ cat << EOF > src/butil/config.h #endif #define BRPC_WITH_GLOG $WITH_GLOG +#ifndef GFLAGS_NS +#define GFLAGS_NS google +#endif + #endif // BUTIL_CONFIG_H EOF diff --git a/example/BUILD.bazel b/example/BUILD.bazel index afc525a331..b38cd5a156 100644 --- a/example/BUILD.bazel +++ b/example/BUILD.bazel @@ -28,7 +28,6 @@ COPTS = [ "-fPIC", "-Wno-unused-parameter", "-fno-omit-frame-pointer", - "-DGFLAGS_NS=google", ] + select({ "//bazel/config:brpc_with_glog": ["-DBRPC_WITH_GLOG=1"], "//conditions:default": ["-DBRPC_WITH_GLOG=0"], diff --git a/test/BUILD.bazel b/test/BUILD.bazel index 3c4242da22..9817b45f10 100644 --- a/test/BUILD.bazel +++ b/test/BUILD.bazel @@ -29,7 +29,6 @@ COPTS = [ "-fPIC", "-Wno-unused-parameter", "-fno-omit-frame-pointer", - "-DGFLAGS_NS=google", "-fno-access-control", "-DBAZEL_TEST=1", "-DBVAR_NOT_LINK_DEFAULT_VARIABLES",