-
Notifications
You must be signed in to change notification settings - Fork 3
/
libcontainer.m4
63 lines (63 loc) · 2.74 KB
/
libcontainer.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
dnl Copyright 2013 Mo McRoberts.
dnl
dnl Licensed under the Apache License, Version 2.0 (the "License");
dnl you may not use this file except in compliance with the License.
dnl You may obtain a copy of the License at
dnl
dnl http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl
m4_pattern_forbid([^BT_])dnl
m4_pattern_forbid([^_BT_])dnl
dnl Internal: _BT_CHECK_LIBCONTAINER([action-if-exists],[action-if-not-exists],[subdir],[preconfigured])
AC_DEFUN([_BT_CHECK_LIBCONTAINER],[
m4_ifval([$4],[libcontainer_configured=yes])
dnl libcontainer incorporates liburi and jsondata
m4_ifval([$3],[
BT_CHECK_LIBURI_INCLUDED(,,[$3/liburi])
BT_CHECK_LIBJSONDATA_INCLUDED(,,[$3/jsondata])
],[
BT_CHECK_LIBURI
BT_CHECK_LIBJSONDATA
])
if test x"$have_liburi" = x"yes" && test x"$have_libjsondata" = x"yes" ; then
BT_CHECK_LIB([libcontainer],[$3],[libcontainer],,[
LIBCONTAINER_CPPFLAGS="$LIBCONTAINER_CPPFLAGS $LIBURI_CPPFLAGS $LIBJSONDATA_CPPFLAGS"
LIBCONTAINER_LDFLAGS="$LIBCONTAINER_LDFLAGS $LIBURI_LDFLAGS $LIBJSONDATA_LDFLAGS"
LIBCONTAINER_LOCAL_LIBS="${libcontainer_builddir}/libcontainer.la $LIBURI_LOCAL_LIBS $LIBJSONDATA_LOCAL_LIBS"
LIBCONTAINER_INSTALLED_LIBS="-L${libdir} -lcontainer $LIBURI_INSTALLED_LIBS $LIBJSONDATA_INSTALLED_LIBS"
],[$1],[$2])
else
m4_ifval([$2],[$2],true)
fi
])dnl
dnl
dnl - BT_CHECK_LIBCONTAINER([action-if-found],[action-if-not-found])
dnl Default action is to update AM_CPPFLAGS, AM_LDFLAGS, LIBS and LOCAL_LIBS
dnl as required, and do nothing if not found
AC_DEFUN([BT_CHECK_LIBCONTAINER],[
_BT_CHECK_LIBCONTAINER([$1],[$2])
])dnl
dnl - BT_CHECK_LIBCONTAINER_INCLUDED([action-if-found],[action-if-not-found],[subdir=libcontainer],[preconfigured])
AC_DEFUN([BT_CHECK_LIBCONTAINER_INCLUDED],[
AS_LITERAL_IF([$3],,[AC_DIAGNOSE([syntax],[$0: subdir must be a literal])])dnl
_BT_CHECK_LIBCONTAINER([$1],[$2],m4_ifval([$3],[$3],[libcontainer]),[$4])
])dnl
dnl - BT_REQUIRE_LIBCONTAINER([action-if-found])
AC_DEFUN([BT_REQUIRE_LIBCONTAINER],[
_BT_CHECK_LIBCONTAINER([$1],[
AC_MSG_ERROR([cannot find required library libcontainer])
])
])dnl
dnl - BT_REQUIRE_LIBCONTAINER_INCLUDED([action-if-found],[subdir=libcontainer],[preconfigured])
AC_DEFUN([BT_REQUIRE_LIBCONTAINER_INCLUDED],[
AS_LITERAL_IF([$2],,[AC_DIAGNOSE([syntax],[$0: subdir passed must be a literal])])dnl
_BT_CHECK_LIBCONTAINER([$1],[
AC_MSG_ERROR([cannot find required library libcontainer])
],m4_ifval([$2],[$2],[libcontainer]),[$3])
])dnl