-
Notifications
You must be signed in to change notification settings - Fork 0
/
acinclude.m4
100 lines (94 loc) · 3.72 KB
/
acinclude.m4
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
dnl AIDE_PKG_CHECK_MODULES(OPTION, PREFIX, LIBRARY)
AC_DEFUN([AIDE_PKG_CHECK_MODULES],
[
if test "$aide_static_choice" = "yes"; then
PKG_CHECK_MODULES_STATIC($2, [$3], [], [AC_MSG_ERROR([$3 not found by pkg-config - Try --without-$1 or add directory containing $3.pc to PKG_CONFIG_PATH environment variable])])
else
PKG_CHECK_MODULES($2, [$3], [], [AC_MSG_ERROR([$3 not found by pkg-config - Try --without-$1 or add directory containing $3.pc to PKG_CONFIG_PATH environment variable])])
fi
AC_DEFINE(WITH_$2,1,[Define to 1 if $3 is available])
])
dnl AIDE_PKG_CHECK_MODULES_OPTIONAL(OPTION, PREFIX, LIBRARY)
AC_DEFUN([AIDE_PKG_CHECK_MODULES_OPTIONAL],
[
AS_IF([test x"$with_$1" != xno], [
if test "$aide_static_choice" = "yes"; then
PKG_CHECK_MODULES_STATIC($2, [$3], [
with_$1=yes
], [
AS_IF([test x"$with_$1" = xyes], [
AC_MSG_ERROR([$3 not found by pkg-config - Try to add directory containing $3.pc to PKG_CONFIG_PATH environment variable])
])
with_$1=no
])
else
PKG_CHECK_MODULES($2, [$3], [
with_$1=yes
], [
AS_IF([test x"$with_$1" = xyes], [
AC_MSG_ERROR([$3 not found by pkg-config - Try to add directory containing $3.pc to PKG_CONFIG_PATH environment variable])
])
with_$1=no
])
fi
AS_IF([test x"$with_$1" = xyes], [
AC_DEFINE(WITH_$2,1,[Define to 1 if $3 is available])
])
])
])
dnl AIDE_PKG_CHECK(OPTION, DESCRIPTION, DEFAULT, PREFIX, LIBRARY, EXTRA_GROUP)
AC_DEFUN([AIDE_PKG_CHECK],
[
AC_MSG_CHECKING(for $2)
AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1], [use $2 (default: $3)]), [with_$5=$withval], [with_$5=$3])
AS_IF([test x"$with_$5" = xyes], [
AC_MSG_RESULT(yes)
AIDE_PKG_CHECK_MODULES($1, $4, $5)
if test -n $6; then
aideextragroups="${aideextragroups}+$6"
fi
],[
AC_MSG_RESULT(no)
])
compoptionstring="${compoptionstring}use $2: $with_$5\\n"
AM_CONDITIONAL(HAVE_$4, [test "x$$4_LIBS" != "x"])
])
dnl AIDE_PKG_CHECK_MANDATORY(DESCRIPTION, PREFIX, LIBRARY)
AC_DEFUN([AIDE_PKG_CHECK_MANDATORY],
[
if test "$aide_static_choice" = "yes"; then
PKG_CHECK_MODULES_STATIC($2, [$3], [], [AC_MSG_ERROR([$3 not found by pkg-config - Try to add directory containing $3.pc to PKG_CONFIG_PATH environment variable])])
else
PKG_CHECK_MODULES($2, [$3], [], [AC_MSG_ERROR([$3 not found by pkg-config - Try to add directory containing $3.pc to PKG_CONFIG_PATH environment variable])])
fi
compoptionstring="${compoptionstring}use $1: mandatory\\n"
])
dnl AIDE_PKG_CHECK_HEADERS(OPTION, DESCRIPTION, DEFAULT, PREFIX, HEADERS)
AC_DEFUN([AIDE_PKG_CHECK_HEADERS],
[
AC_MSG_CHECKING(for $1)
AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1], [$2 (default: $3)]), [with_$1=$withval], [with_$1=$3])
AC_MSG_RESULT([$with_$1])
AS_IF([test x"$with_$1" != xno], [
AC_CHECK_HEADERS($5, [
AS_IF([test x"$3" != xno], [
AC_DEFINE(WITH_$4,1,[Define to 1 if $1 is available])
with_$1="yes"
])
], [
AS_IF([test x"$3" = xyes], [
AC_MSG_ERROR([headers $5 for $1 not found])
])
])
])
compoptionstring="${compoptionstring}use $2: $with_$1\\n"
AM_CONDITIONAL(HAVE_$4, [test "x$with_$1" = "xyes"])
])
dnl AIDE_COMPILE_TIME_OPTION(OPTION, WITH_HELP_STRING, DESCRIPTION, DEFAULT)
AC_DEFUN([AIDE_COMPILE_TIME_OPTION],
[
AC_MSG_CHECKING(for $3)
AC_ARG_WITH([$1], AS_HELP_STRING([--with-$2], [$3 (default: $4)]), [with_$1=$withval], [with_$1=$4])
AC_MSG_RESULT([$with_$1])
compoptionstring="${compoptionstring}$3: $with_$1\\n"
])