Enable making libfollyinit even when libdwarf is not available
authorJacob Bower <jbower@fb.com>
Fri, 23 Dec 2016 08:09:51 +0000 (00:09 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 23 Dec 2016 08:18:00 +0000 (00:18 -0800)
Summary:
The hard requirement for libdwarf when building libfollyinit does not appear to be needed.

Without libfollyinit, code with calls to folly::init() won't build. Notably this is breaking build/execution of tests + examples for the Watchman C++ client in Watchman.

Reviewed By: yfeldblum

Differential Revision: D4361498

fbshipit-source-id: f3586d8cdca36eda3634663e95a4a61d879de6cf

folly/configure.ac
folly/experimental/Makefile.am
folly/init/Makefile.am

index 14bff8b984b491017309215c4a8bf6600cd448bc..a38ea92c39b4bfc351d61651a8bcbbf0caeec509 100644 (file)
@@ -591,15 +591,7 @@ AC_CHECK_HEADERS([libdwarf/dwarf.h dwarf.h], [break])
 have_libdwarf=no
 AS_IF([test "x${ac_cv_header_libdwarf_dwarf_h}" = xyes], [have_libdwarf=yes])
 AS_IF([test "x${ac_cv_header_dwarf_h}" = xyes], [have_libdwarf=yes])
-if test "x${follytestmain}" = "xyes"; then
-   AS_IF([test "x${have_libdwarf}" = xno], [AC_MSG_ERROR([Please install libdwarf development library and headers])])
-   AC_CHECK_HEADERS([elf.h],, AC_MSG_ERROR([Please install libelf development package]))
-   AC_CHECK_HEADERS([libunwind.h],, AC_MSG_ERROR([Please install libunwind development package]))
-else
-   AS_IF([test "x${have_libdwarf}" = xno],, [use_follytestmain=no])
-   AC_CHECK_HEADERS([elf.h],, [use_follytestmain=no])
-   AC_CHECK_HEADERS([libunwind.h],, [use_follytestmain=no])
-fi
+
 
 AC_ARG_ENABLE([mobile],
    AS_HELP_STRING([--enable-mobile],
@@ -634,6 +626,7 @@ AM_CONDITIONAL([HAVE_BITS_FUNCTEXCEPT_H], [test "$ac_cv_header_bits_functexcept_
 AM_CONDITIONAL([HAVE_EXTRANDOM_SFMT19937],
                [test "$folly_cv_prog_cc_have_extrandom_sfmt19937" = "yes"])
 AM_CONDITIONAL([FOLLY_TESTMAIN], [test "x${use_follytestmain}" = "xyes"])
+AM_CONDITIONAL([HAVE_LIBDWARF], [test "x${have_libdwarf}" = "xyes"])
 AM_CONDITIONAL([HAVE_BOOST_CONTEXT], [test "x${ax_cv_boost_context}" = "xyes"])
 
 # remove pkg-config deps from dependent libraries
index 4cdff7ed0ea92a52fd10730c5441ede7bde24c0f..f67636daa1d903eb0c9a09c37b98d77a40599608 100644 (file)
@@ -1 +1,3 @@
+if HAVE_LIBDWARF
 SUBDIRS = symbolizer
+endif
index 40320ac633a9f046568d51d0059acefc121a4dc6..4b6367e060b95303ce818905b0e9f552a519b54a 100644 (file)
@@ -2,6 +2,10 @@ SUBDIRS = .
 
 lib_LTLIBRARIES = libfollyinit.la
 
+if HAVE_LIBDWARF
+FOLLY_SYMBOLIZER=$(top_builddir)/experimental/symbolizer/libfollysymbolizer.la
+endif
+
 libfollyinit_la_SOURCES = Init.cpp
-libfollyinit_la_LIBADD = $(top_builddir)/libfolly.la $(top_builddir)/experimental/symbolizer/libfollysymbolizer.la
+libfollyinit_la_LIBADD = $(top_builddir)/libfolly.la $(FOLLY_SYMBOLIZER)
 libfollyinit_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LT_VERSION)