]> git.meshlink.io Git - meshlink/blob - m4/lzo.m4
Support and autodetect LZO version 2.0 and later.
[meshlink] / m4 / lzo.m4
1 dnl Check to find the lzo headers/libraries
2
3 AC_DEFUN([tinc_LZO],
4 [
5   AC_ARG_WITH(lzo,
6     AS_HELP_STRING([--with-lzo=DIR], [lzo base directory, or:]),
7     [lzo="$withval"
8      CPPFLAGS="$CPPFLAGS -I$withval/include"
9      LDFLAGS="$LDFLAGS -L$withval/lib"]
10   )
11
12   AC_ARG_WITH(lzo-include,
13     AS_HELP_STRING([--with-lzo-include=DIR], [lzo headers directory]),
14     [lzo_include="$withval"
15      CPPFLAGS="$CPPFLAGS -I$withval"]
16   )
17
18   AC_ARG_WITH(lzo-lib,
19     AS_HELP_STRING([--with-lzo-lib=DIR], [lzo library directory]),
20     [lzo_lib="$withval"
21      LDFLAGS="$LDFLAGS -L$withval"]
22   )
23
24   AC_CHECK_LIB(lzo2, lzo1x_1_compress,
25     [AC_CHECK_HEADERS(lzo/lzo1x.h,
26       [LIBS="$LIBS -llzo2"],
27       [AC_MSG_ERROR("lzo2 header files not found."); break]
28     )],
29     [AC_CHECK_LIB(lzo, lzo1x_1_compress,
30       [AC_CHECK_HEADERS(lzo1x.h,
31         [LIBS="$LIBS -llzo"],
32         [AC_MSG_ERROR("lzo1 header files not found."); break]
33       )],
34       [AC_MSG_ERROR("lzo libraries not found."); break]
35     )]
36   )
37 ])