1From 9548dc5e1a6c835cd4f387ba384d8f3f14c3fc8b Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Thu, 22 Aug 2019 10:50:21 +0800
4Subject: [PATCH] configure.ac: add option for libcap
5
6Upstream-Status: Pending
7
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9Signed-off-by: Changqing Li <changqing.li@windriver.com>
10---
11 configure.ac | 36 +++++++++++++++++++++++++++---------
12 1 file changed, 27 insertions(+), 9 deletions(-)
13
14diff --git a/configure.ac b/configure.ac
15index ef8fced680..263098f7fd 100644
16--- a/configure.ac
17+++ b/configure.ac
18@@ -1161,6 +1161,22 @@ fi
19 dnl Set by FR_SMART_CHECKLIB
20 LIBS="${old_LIBS}"
21
22+dnl #
23+dnl #  extra argument: --with-libcap
24+dnl #
25+WITH_LIBCAP=yes
26+AC_ARG_WITH(libcap,
27+[  --with-licap          use licap for debugger checks. (default=yes)],
28+[ case "$withval" in
29+  no)
30+    WITH_LIBCAP=no
31+    ;;
32+  *)
33+    WITH_LIBCAP=yes
34+    ;;
35+  esac ]
36+)
37+
38 dnl Check for cap
39 dnl extra argument: --with-cap-lib-dir=DIR
40 cap_lib_dir=
41@@ -1194,15 +1210,17 @@ AC_ARG_WITH(cap-include-dir,
42       ;;
43   esac])
44
45-smart_try_dir="$cap_lib_dir"
46-FR_SMART_CHECK_LIB(cap, cap_get_proc)
47-if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
48-  AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
49-else
50-  AC_DEFINE(HAVE_LIBCAP, 1,
51-    [Define to 1 if you have the `cap' library (-lcap).]
52-  )
53-  HAVE_LIBCAP=1
54+if test "x$WITH_LIBCAP" = xyes; then
55+  smart_try_dir="$cap_lib_dir"
56+  FR_SMART_CHECK_LIB(cap, cap_get_proc)
57+  if test "x$ac_cv_lib_cap_cap_get_proc" != "xyes"; then
58+    AC_MSG_WARN([cap library not found, debugger checks will not be enabled. Use --with-cap-lib-dir=<path>.])
59+  else
60+    AC_DEFINE(HAVE_LIBCAP, 1,
61+      [Define to 1 if you have the `cap' library (-lcap).]
62+    )
63+    HAVE_LIBCAP=1
64+  fi
65 fi
66
67 dnl #
68--
692.25.1
70
71