xref: /PHP-5.3/ext/mcrypt/config.m4 (revision 932e276c)
1dnl
2dnl $Id$
3dnl
4
5AC_DEFUN([PHP_MCRYPT_CHECK_VERSION],[
6  old_CPPFLAGS=$CPPFLAGS
7  CPPFLAGS=-I$MCRYPT_DIR/include
8  AC_MSG_CHECKING(for libmcrypt version)
9  AC_EGREP_CPP(yes,[
10#include <mcrypt.h>
11#if MCRYPT_API_VERSION >= 20021217
12  yes
13#endif
14  ],[
15    AC_MSG_RESULT(>= 2.5.6)
16  ],[
17    AC_MSG_ERROR(libmcrypt version 2.5.6 or greater required.)
18  ])
19  CPPFLAGS=$old_CPPFLAGS
20])
21
22
23PHP_ARG_WITH(mcrypt, for mcrypt support,
24[  --with-mcrypt[=DIR]     Include mcrypt support])
25
26if test "$PHP_MCRYPT" != "no"; then
27  for i in $PHP_MCRYPT /usr/local /usr; do
28    test -f $i/include/mcrypt.h && MCRYPT_DIR=$i && break
29  done
30
31  if test -z "$MCRYPT_DIR"; then
32    AC_MSG_ERROR(mcrypt.h not found. Please reinstall libmcrypt.)
33  fi
34
35  PHP_MCRYPT_CHECK_VERSION
36
37  PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
38  [
39    PHP_ADD_LIBRARY(ltdl,, MCRYPT_SHARED_LIBADD)
40    AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
41  ],[
42    PHP_CHECK_LIBRARY(mcrypt, mcrypt_module_open,
43    [
44      AC_DEFINE(HAVE_LIBMCRYPT,1,[ ])
45    ],[
46      AC_MSG_ERROR([Sorry, I was not able to diagnose which libmcrypt version you have installed.])
47    ],[
48      -L$MCRYPT_DIR/$PHP_LIBDIR
49    ])
50  ],[
51    -L$MCRYPT_DIR/$PHP_LIBDIR -lltdl
52  ])
53
54  PHP_ADD_LIBRARY_WITH_PATH(mcrypt, $MCRYPT_DIR/$PHP_LIBDIR, MCRYPT_SHARED_LIBADD)
55  PHP_ADD_INCLUDE($MCRYPT_DIR/include)
56
57  PHP_SUBST(MCRYPT_SHARED_LIBADD)
58  PHP_NEW_EXTENSION(mcrypt, mcrypt.c mcrypt_filter.c, $ext_shared)
59fi
60