From: Ted Percival Date: Fri, 30 Sep 2016 17:40:00 +0000 (-0700) Subject: Find dwarf.h in libdwarf subdirectory X-Git-Tag: v2016.10.03.00~3 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=fc8025b463cbd1a167d68c49e74e93a158b2bf03;p=folly.git Find dwarf.h in libdwarf subdirectory Summary: libdwarf headers moved from `/usr/include` to `/usr/include/libdwarf` in [dwarfutils 20160613-2](http://metadata.ftp-master.debian.org/changelogs/main/d/dwarfutils/unstable_changelog). Adds a check for the library as well, and fixes a tiny typo in the `libunwind` check. No longer checks for `libdwarf.h`; only `dwarf.h` is used. Closes https://github.com/facebook/folly/pull/480 Reviewed By: yfeldblum Differential Revision: D3878961 Pulled By: Orvid fbshipit-source-id: 7970d33511bf6d351cec2c8077cb07b85f2f8d33 --- diff --git a/folly/configure.ac b/folly/configure.ac index 36c7fc81..21cc2ce2 100644 --- a/folly/configure.ac +++ b/folly/configure.ac @@ -550,13 +550,20 @@ AC_ARG_ENABLE([follytestmain], [follytestmain=${enableval}], [follytestmain=no]) use_follytestmain=yes +# libdwarf used to install in /usr/include, now installs in /usr/include/libdwarf. +AC_SEARCH_LIBS([dwarf_init], [dwarf]) +AC_CHECK_HEADERS([libdwarf/dwarf.h dwarf.h], [break]) +# Check whether we have both the library and the header +have_libdwarf=no +AS_IF([test "x${ac_cv_search_dwarf_init}" != xno && test "x${ac_cv_header_libdwarf_dwarf_h}" = xyes], [have_libdwarf=yes]) +AS_IF([test "x${ac_cv_search_dwarf_init}" != xno && test "x${ac_cv_header_dwarf_h}" = xyes], [have_libdwarf=yes]) if test "x${follytestmain}" = "xyes"; then - AC_CHECK_HEADERS([libdwarf.h dwarf.h],, AC_MSG_ERROR([Please install libdwarf development package])) - AC_CHECK_HEADERS([libelf.h elf.h],, AC_MSG_ERROR([Please install libelf development package])) - AC_CHECK_HEADERS([libunwind.h],, AC_MSG_ERROR([Please install libinwind development package])) + 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 - AC_CHECK_HEADERS([libdwarf.h dwarf.h],, [use_follytestmain=no]) - AC_CHECK_HEADERS([libelf.h elf.h],, [use_follytestmain=no]) + 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 diff --git a/folly/experimental/symbolizer/Dwarf.cpp b/folly/experimental/symbolizer/Dwarf.cpp index f9e9709d..f1087f80 100644 --- a/folly/experimental/symbolizer/Dwarf.cpp +++ b/folly/experimental/symbolizer/Dwarf.cpp @@ -19,7 +19,11 @@ #include +#if FOLLY_HAVE_LIBDWARF_DWARF_H +#include +#else #include +#endif namespace folly { namespace symbolizer {