From 4bdddb9e15bf1b742a070ef34424fffc2284a816 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Fri, 11 Mar 2016 16:36:37 -0800 Subject: [PATCH] folly: fix gflags<->glog configure check ordering Summary:On systems that do not have gflags or glog installed globally, but only locally as static libraries, our configure check failed for glog because we were checking it prior to gflags. glog depends on gflags, but when the libraries are static, there is no explicit dependency information available and the linker fails. This resolves the issue by checking for gflags first; this causes configure to add an implicit `-lgflags` for the subsequent glog tests. Reviewed By: yfeldblum Differential Revision: D3044138 fb-gh-sync-id: 5e07ce52842c6e4cff796560672bf950e2fafe6c shipit-source-id: 5e07ce52842c6e4cff796560672bf950e2fafe6c --- folly/configure.ac | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/folly/configure.ac b/folly/configure.ac index 62c81230..89368066 100644 --- a/folly/configure.ac +++ b/folly/configure.ac @@ -54,29 +54,6 @@ CXXFLAGS="$STD $CXXFLAGS" # Checks for glog and gflags # There are no symbols with C linkage, so we do a try-run -AC_HAVE_LIBRARY([glog],[],[AC_MSG_ERROR( - [Please install google-glog library])]) -AC_CACHE_CHECK( - [for glog viability], - [folly_cv_prog_cc_glog], - [AC_RUN_IFELSE( - [AC_LANG_SOURCE[ - #include - int main(int argc, char** argv) { - google::InitGoogleLogging(argv[0]); - google::ShutdownGoogleLogging(); - return 0; - } - ]], - [folly_cv_prog_cc_glog=yes], - [folly_cv_prog_cc_glog=no] - )] -) - -if test "$folly_cv_prog_cc_glog" != "yes"; then - AC_MSG_ERROR(["libglog invalid, see config.log for details"]) -fi - AC_HAVE_LIBRARY([gflags],[],[AC_MSG_ERROR( [Please install google-gflags library])]) AC_CACHE_CHECK( @@ -100,6 +77,29 @@ if test "$folly_cv_prog_cc_gflags" != "yes"; then AC_MSG_ERROR(["libgflags invalid, see config.log for details"]) fi +AC_HAVE_LIBRARY([glog],[],[AC_MSG_ERROR( + [Please install google-glog library])]) +AC_CACHE_CHECK( + [for glog viability], + [folly_cv_prog_cc_glog], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE[ + #include + int main(int argc, char** argv) { + google::InitGoogleLogging(argv[0]); + google::ShutdownGoogleLogging(); + return 0; + } + ]], + [folly_cv_prog_cc_glog=yes], + [folly_cv_prog_cc_glog=no] + )] +) + +if test "$folly_cv_prog_cc_glog" != "yes"; then + AC_MSG_ERROR(["libglog invalid, see config.log for details"]) +fi + AC_CHECK_LIB(ssl, SSL_ctrl, [], -- 2.34.1