Fix compile with two gflags
Summary: If the system has gflags with both `google` and `gflags` namespaces installed, we try to define GFLAGS as two things. This breaks the compile. Fix: Use `else if` -- try compiling with `google` namespace only if compile with `gflags` failed Test Plan: build_tools/build_detect_platform correctly identifies gflags Reviewers: lgalanis Reviewed By: lgalanis Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D37389
This commit is contained in:
parent
79c21ec0c4
commit
742fa9e316
@ -200,29 +200,19 @@ EOF
|
|||||||
JAVA_LDFLAGS="$JAVA_LDFLAGS -lsnappy"
|
JAVA_LDFLAGS="$JAVA_LDFLAGS -lsnappy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Test whether gflags library is installed
|
# Test whether gflags library is installed
|
||||||
# http://code.google.com/p/gflags/
|
# http://code.google.com/p/gflags/
|
||||||
# check if the namespace is gflags
|
# check if the namespace is gflags
|
||||||
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
|
if echo "#include <gflags/gflags.h>\nusing namespace gflags;\nint main() {}" | \
|
||||||
#include <gflags/gflags.h>
|
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null; then
|
||||||
using namespace gflags;
|
|
||||||
int main() {}
|
|
||||||
EOF
|
|
||||||
if [ "$?" = 0 ]; then
|
|
||||||
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=gflags"
|
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=gflags"
|
||||||
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags"
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags"
|
||||||
fi
|
else
|
||||||
|
if echo "#include <gflags/gflags.h>\nusing namespace google;\nint main() {}" | \
|
||||||
# check if namespace is google
|
$CXX $CFLAGS -x c++ - -o /dev/null ; then
|
||||||
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
|
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=google"
|
||||||
#include <gflags/gflags.h>
|
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags"
|
||||||
using namespace google;
|
fi
|
||||||
int main() {}
|
|
||||||
EOF
|
|
||||||
if [ "$?" = 0 ]; then
|
|
||||||
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=google"
|
|
||||||
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test whether zlib library is installed
|
# Test whether zlib library is installed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user