Clean up use of Boost and PThread libraries.
authorPeter Griess <pgriess@fb.com>
Mon, 23 Sep 2013 16:47:58 +0000 (09:47 -0700)
committerPeter Griess <pgriess@fb.com>
Tue, 15 Oct 2013 01:46:07 +0000 (18:46 -0700)
Summary:
- Use AM_LDFLAGS rather than AM_CXXFLAGS to link against Boost.
- Link against $(BOOST_REGEX_LIB) in addition to other Boost libs.
- Add $(BOOST_LDFLAGS) to AM_LDFLAGS so that we get the library path
that we configured Boost to use.
- Add -lpthread to AM_LDFLAGS rather than ad-hoc '-lpthread' additions
to various library builds.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: oyamauchi@fb.com

FB internal diff: D998504

folly/Makefile.am
folly/configure.ac
folly/test/Makefile.am

index 77967ebb29120593696c09e41837e7a2071f98da..195ceb9e15e8678692d8f819a099eeda3aec0032 100644 (file)
@@ -112,8 +112,6 @@ libfolly_la_SOURCES = \
        SpookyHashV1.cpp \
        SpookyHashV2.cpp
 
-libfolly_la_LIBADD = $(BOOST_THREAD_LIB) -lpthread
-
 FingerprintTables.cpp: generate_fingerprint_tables
        ./generate_fingerprint_tables
 
@@ -122,7 +120,7 @@ libfollyfingerprint_la_SOURCES = \
 libfollyfingerprint_la_LIBADD = libfolly.la
 
 libfollybenchmark_la_SOURCES = Benchmark.cpp
-libfollybenchmark_la_LIBADD = $(BOOST_REGEX_LIB) -lrt libfolly.la
+libfollybenchmark_la_LIBADD = -lrt libfolly.la
 
 libfollytimeout_queue_la_SOURCES = TimeoutQueue.cpp
 libfollytimeout_queue_la_LIBADD = libfolly.la
index 8d5765c13b40a44251c58b48dbe9c3c109475ad1..eb8a175eb5bb3ac0161dddf42b654ccc89da19ac 100644 (file)
@@ -102,8 +102,8 @@ if test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
    CXX_FLAGS="-std=gnu++0x"
 fi
 
-AC_SUBST(AM_CPPFLAGS, '-I../$(top_srcdir)'" "'-I$(top_srcdir)/io'" "'-I$(top_srcdir)/test'" -lstdc++ $CXX_FLAGS $BOOST_CPPFLAGS")
-AC_SUBST(AM_CXXFLAGS, "$BOOST_THREAD_LIB $BOOST_SYSTEM_LIB")
+AC_SUBST(AM_CPPFLAGS, '-I../$(top_srcdir)'" "'-I$(top_srcdir)/io'" "'-I$(top_srcdir)/test'" $CXX_FLAGS $BOOST_CPPFLAGS")
+AC_SUBST(AM_LDFLAGS, "$BOOST_LDFLAGS $BOOST_THREAD_LIB $BOOST_SYSTEM_LIB $BOOST_REGEX_LIB -lpthread")
 
 AM_CONDITIONAL([HAVE_STD_THREAD], [test "$ac_cv_header_features" = "yes"])
 AM_CONDITIONAL([HAVE_X86_64], [test "$build_cpu" = "x86_64"])
index 478544211e8427080f9d991226c628acdd661782..6ec48124a44de2c1687183e62ad12afab7a2ae7d 100644 (file)
@@ -18,7 +18,6 @@ lib_LTLIBRARIES = libgtestmain.la libgtest.la
 
 libgtestmain_la_CPPFLAGS = -Igtest-1.6.0 -Igtest-1.6.0/src
 libgtestmain_la_SOURCES = gtest-1.6.0/src/gtest-all.cc gtest-1.6.0/src/gtest_main.cc
-libgtestmain_la_LIBADD = -lpthread
 
 libgtest_la_CPPFLAGS = -Igtest-1.6.0 -Igtest-1.6.0/src
 libgtest_la_SOURCES = gtest-1.6.0/src/gtest-all.cc
@@ -115,7 +114,7 @@ endian_test_LDADD = libgtestmain.la $(top_builddir)/libfolly.la
 TESTS += endian_test
 
 rw_spinlock_test_SOURCES = RWSpinLockTest.cpp
-rw_spinlock_test_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la  $(BOOST_THREAD_LIB)
+rw_spinlock_test_LDADD = libgtestmain.la $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la
 TESTS += rw_spinlock_test
 
 synchronized_test_SOURCES = SynchronizedTest.cpp
@@ -127,7 +126,7 @@ concurrent_skiplist_test_LDADD = libgtest.la $(top_builddir)/libfolly.la
 TESTS += concurrent_skiplist_test
 
 concurrent_skiplist_benchmark_SOURCES = ConcurrentSkipListBenchmark.cpp
-concurrent_skiplist_benchmark_LDADD = $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la $(BOOST_SYSTEM_LIB)
+concurrent_skiplist_benchmark_LDADD = $(top_builddir)/libfollybenchmark.la $(top_builddir)/libfolly.la
 noinst_PROGRAMS += concurrent_skiplist_benchmark
 
 histogram_test_SOURCES = HistogramTest.cpp