From 930fc152babda61d2eab05f0c9cc1a1928ead731 Mon Sep 17 00:00:00 2001 From: Mart Raudsepp Date: Sun, 5 Feb 2017 09:03:46 +0200 Subject: [PATCH] configure: Allow specifying libunwind usage explicitly https://bugzilla.gnome.org/show_bug.cgi?id=778193 --- configure.ac | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 5081a75..5905430 100644 --- a/configure.ac +++ b/configure.ac @@ -827,7 +827,24 @@ fi AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes") dnl libunwind is optionally used by the leaks tracer -PKG_CHECK_MODULES(UNWIND, libunwind, HAVE_UNWIND=yes, HAVE_UNWIND=no) +AC_ARG_ENABLE(libunwind, + AS_HELP_STRING([--disable-libunwind],[disable using libunwind inside leaks tracer @<:@default=auto@:>@]), + [LIBUNWIND="$enableval"], [LIBUNWIND="auto"]) + +if test "x$LIBUNWIND" != "xno"; then + PKG_CHECK_MODULES(UNWIND, libunwind, [ + HAVE_UNWIND=yes + AC_DEFINE(HAVE_UNWIND, 1, [libunwind available]) + ], [ + HAVE_UNWIND=no + if test "x$LIBUNWIND" = "xyes"; then + AC_MSG_ERROR([libunwind requested but not installed.]) + fi + ]) +else + HAVE_UNWIND=no +fi +AM_CONDITIONAL(HAVE_UNWIND, [test "x$HAVE_UNWIND" = "xyes"]) dnl Check for backtrace() from libc AC_CHECK_FUNC(backtrace, [ @@ -836,10 +853,6 @@ AC_CHECK_FUNC(backtrace, [ ], [], []) ]) -if test "x$HAVE_UNWIND" = "xyes"; then - AC_DEFINE(HAVE_UNWIND, 1, [libunwind available]) -fi - dnl building of unit test libraries AC_ARG_ENABLE(check, AS_HELP_STRING([--disable-check],[disable building unit test libraries]), -- 2.10.1