From 6a5ffee0cc731906722dbe1001555e2d6522756b Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Wed, 22 Apr 2015 12:47:50 -0700 Subject: [PATCH] Fix gflags Makefile Summary: `echo` correctly interpretes \n on mac, but not on linux. On linux you have to give it `-e` to interpret \n. Unfortunately, `-e` options is not available on Mac. Go back to old way of checking gflags Test Plan: build_tools/build_detect_platform on mac and linux Reviewers: sdong Subscribers: dhruba Differential Revision: https://reviews.facebook.net/D37515 --- build_tools/build_detect_platform | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/build_tools/build_detect_platform b/build_tools/build_detect_platform index 3711a72b6..dfff5b65c 100755 --- a/build_tools/build_detect_platform +++ b/build_tools/build_detect_platform @@ -203,13 +203,22 @@ EOF # Test whether gflags library is installed # http://code.google.com/p/gflags/ # check if the namespace is gflags - if echo "#include \nusing namespace gflags;\nint main() {}" | \ - $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null; then + $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF + #include + using namespace gflags; + int main() {} +EOF + if [ "$?" = 0 ]; then COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=gflags" PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" else - if echo "#include \nusing namespace google;\nint main() {}" | \ - $CXX $CFLAGS -x c++ - -o /dev/null 2> /dev/null; then + # check if namespace is google + $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF + #include + using namespace google; + int main() {} +EOF + if [ "$?" = 0 ]; then COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=google" PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" fi