Debian Codegraph @

m4/acx_botan.m4

raw
1 AC_DEFUN([ACX_BOTAN],[
2 WITH_BOTAN=
3 AC_ARG_WITH(botan,
4 AC_HELP_STRING([--with-botan=PATH],[Specify prefix of path of Botan]),
5 [
6 BOTAN_PATH="$withval"
7 WITH_BOTAN=1
8 ],
9 [
10 BOTAN_PATH="/usr/local"
11 ])
12
13 if test -n "${PKG_CONFIG}" && test -z "${WITH_BOTAN}"; then
14 PKG_CHECK_MODULES([BOTAN], [botan-2 >= $1.$2.$3], [
15 BOTAN_VERSION_MAJOR=2
16 BOTAN_VERSION_MINOR=0
17 ],[
18 AC_MSG_ERROR([Cannot find Botan])
19 ])
20 else
21 BOTAN_VERSION_MAJOR=2
22 BOTAN_VERSION_MINOR=0
23 if test -f "$BOTAN_PATH/include/botan-2/botan/version.h"; then
24 BOTAN_VERSION_MAJOR=2
25 BOTAN_VERSION_MINOR=0
26 else
27 AC_MSG_ERROR([Cannot find Botan includes])
28 fi
29
30 if test "x${BOTAN_VERSION_MAJOR}" = "x2"; then
31 BOTAN_CFLAGS="-I$BOTAN_PATH/include/botan-2"
32 BOTAN_LIBS="-L$BOTAN_PATH/lib -lbotan-2"
33 else
34 BOTAN_CFLAGS="-I$BOTAN_PATH/include/botan-1.$BOTAN_VERSION_MINOR"
35 BOTAN_LIBS="-L$BOTAN_PATH/lib -lbotan-1.$BOTAN_VERSION_MINOR"
36 fi
37
38 AC_SUBST(BOTAN_CFLAGS)
39 AC_SUBST(BOTAN_LIBS)
40 fi
41
42 AC_MSG_CHECKING(what are the Botan includes)
43 AC_MSG_RESULT($BOTAN_CFLAGS)
44
45 AC_MSG_CHECKING(what are the Botan libs)
46 AC_MSG_RESULT($BOTAN_LIBS)
47
48 if test "x${BOTAN_VERSION_MAJOR}" != "x1" -o "x${BOTAN_VERSION_MINOR}" != "x10"; then
49 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
50 fi
51
52 tmp_CPPFLAGS=$CPPFLAGS
53 tmp_LIBS=$LIBS
54
55 CPPFLAGS="$CPPFLAGS $BOTAN_CFLAGS"
56 LIBS="$LIBS $BOTAN_LIBS"
57
58 AC_LANG_PUSH([C++])
59 AC_LINK_IFELSE(
60 [AC_LANG_PROGRAM(
61 [#include <botan/version.h>],
62 [#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR($1,$2,$3)
63 #error "Botan version too old";
64 #endif])],
65 [AC_MSG_RESULT([checking for Botan >= v$1.$2.$3 ... yes])],
66 [AC_MSG_RESULT([checking for Botan >= v$1.$2.$3 ... no])
67 AC_MSG_ERROR([Missing the correct version of the Botan library])]
68 )
69 AC_LANG_POP([C++])
70
71 CPPFLAGS=$tmp_CPPFLAGS
72 LIBS=$tmp_LIBS
73
74 AC_SUBST(BOTAN_VERSION_MAJOR)
75 AC_SUBST(BOTAN_VERSION_MINOR)
76 ])