|
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
55
56
57
58
59
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
AC_DEFUN(DC_ASK_STATGRAB, [
# AC_CHECK_LIB(statgrab, get_memory_stats, AC_DEFINE(HAVE_LIBSTATGRAB, [1], [Have get_memory_stats from libstatgrab]))
AC_ARG_WITH(libstatgrab, [ --with-libstatgrab Support for libstatgrab], [
# Specified
LIBSTATGRAB=$withval
], [
# Not specified
LIBSTATGRABFLAGS=`pkg-config --libs libstatgrab 2>/dev/null`
LIBSTATGRABCFLAGS=`pkg-config --cflags libstatgrab 2>/dev/null`
AC_CHECK_LIB(statgrab, get_memory_stats, [
OLDCPPFLAGS="$CPPFLAGS"
OLDCFLAGS="$CFLAGS"
CPPFLAGS="$CPPFLAGS $LIBSTATGRABCFLAGS"
CFLAGS="$CFLAGS $LIBSTATGRABCFLAGS"
AC_CHECK_HEADER(statgrab.h, [
LIBSTATGRAB=yes
], [
LIBSTATGRAB=no
])
CPPFLAGS="$OLDCPPFLAGS"
CFLAGS="$OLDCFLAGS"
], [
LIBSTATGRAB=no
AC_MSG_WARN(Didn't find libstatgraph)
], $LIBSTATGRABFLAGS)
])
case $LIBSTATGRAB in
no)
AC_MSG_WARN(Freecolor will be compiled without libstatgrab support)
;;
*)
if test ! "${LIBSTATGRAB}" = "yes"; then
LIBSTATGRABFLAGS="-L${LIBSTATGRAB}/lib ${LIBSTATGRABFLAGS}"
LIBSTATGRABCFLAGS="-I${LIBSTATGRAB}/include ${LIBSTATGRABCFLAGS}"
fi
AC_CHECK_LIB(statgrab, get_memory_stats, [
OLDCFLAGS="$CFLAGS"
OLDCPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS ${LIBSTATGRABCFLAGS}"
CFLAGS="$CFLAGS ${LIBSTATGRABCFLAGS}"
AC_CHECK_HEADER(statgrab.h, [
AC_DEFINE(HAVE_LIBSTATGRAB_H, [1], [Define to 1 if you have the <statgrab.h> header file.])
AC_DEFINE(HAVE_LIBSTATGRAB, [1], [Define to 1 if you have get_memory_stats from -lstatgrab])
LDFLAGS="$LDFLAGS $LIBSTATGRABFLAGS"
LIBS="$LIBS -lstatgrab"
AC_CHECK_LIB(statgrab, statgrab_drop_privileges, [
AC_DEFINE(HAVE_STATGRAB_DROP_PRIVILEGES, [1], [Define to 1 if you have statgrab_drop_privileges from -lstatgrab])
])
], [
CFLAGS="$OLDCFLAGS"
CPPFLAGS="$OLDCPPFLAGS"
AC_MSG_ERROR(Could not find statgrab.h)
])
], [
AC_MSG_ERROR(Could not find libstatgrab)
], $LIBSTATGRABFLAGS)
;;
esac
])
|