summaryrefslogtreecommitdiff
blob: 472726f561018d285a0074c46aa8710884c9d61b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 930fc152babda61d2eab05f0c9cc1a1928ead731 Mon Sep 17 00:00:00 2001
From: Mart Raudsepp <leio@gentoo.org>
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