File: pdns_check_lmdb.m4

package info (click to toggle)
pdns 4.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 8,856 kB
  • sloc: cpp: 78,652; sh: 5,405; makefile: 2,096; sql: 822; ruby: 598; yacc: 228; ansic: 208; lex: 130; perl: 48; python: 4
file content (49 lines) | stat: -rw-r--r-- 1,508 bytes parent folder | download | duplicates (2)
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
dnl invoking this makes lmdb a requirement
AC_DEFUN([PDNS_CHECK_LMDB], [
  AC_MSG_CHECKING([where to find the lmdb library and headers])
  AC_ARG_WITH([lmdb],
    AC_HELP_STRING([--with-lmdb], [lmdb library to use @<:@default=auto@:>@]),[
    with_lmdb=$withval
    ],[
    with_lmdb=auto
  ])
  AC_MSG_RESULT([$with_lmdb])

  AS_IF([test "$with_lmdb" != "no"], [
    AS_IF([test "x$with_lmdb" = "xyes" -o "x$with_lmdb" = "xauto"], [
      PKG_CHECK_MODULES([LMDB], [lmdb], [
        AC_DEFINE([HAVE_LMDB], [1], [Define to 1 if you have LMDB])
        [HAVE_LMDB=1]
        ], [ : ]
      )
    ], [
      save_CPPFLAGS=$CPPFLAGS
      save_LIBS=$LIBS
      AS_IF([test -d "$with_lmdb/include"], [
        LMDB_CFLAGS="-I$with_lmdb/include"
        LMDB_LIBS="-L$with_lmdb/lib"
      ],[
        LMDB_CFLAGS="-I$with_lmdb"
        LMDB_LIBS="-L$with_lmdb"
      ])
      CPPFLAGS="$LMDB_CFLAGS"
      LIBS="$LMDB_LIBS"

      AC_SEARCH_LIBS([mdb_env_open], [lmdb], [
        AC_CHECK_HEADERS([lmdb.h], [
          dnl ac_cv_search_mdb_env_open contains '-llmdb'
          LMDB_LIBS="$LMDB_LIBS $ac_cv_search_mdb_env_open"
          AC_DEFINE([HAVE_LMDB], [1], [Define to 1 if you have LMDB])
          [HAVE_LMDB=1]
        ], [
          AC_MSG_ERROR([lmdb headers not found in $with_lmdb])
        ])
        CPPFLAGS="$save_CPPFLAGS"
        LIBS="$save_LIBS"
        AC_SUBST([LMDB_CFLAGS])
        AC_SUBST([LMDB_LIBS])
      ])
    ])
  ])
  AM_CONDITIONAL([HAVE_LMDB], [test "x$LMDB_LIBS" != "x"])
])