config.m4
41 lines
| 1 | PHP_ARG_WITH(maxminddb, |
| 2 | [Whether to enable the MaxMind DB Reader extension], |
| 3 | [ --with-maxminddb Enable MaxMind DB Reader extension support]) |
| 4 | |
| 5 | PHP_ARG_ENABLE(maxminddb-debug, for MaxMind DB debug support, |
| 6 | [ --enable-maxminddb-debug Enable MaxMind DB debug support], no, no) |
| 7 | |
| 8 | if test $PHP_MAXMINDDB != "no"; then |
| 9 | |
| 10 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) |
| 11 | |
| 12 | AC_MSG_CHECKING(for libmaxminddb) |
| 13 | if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmaxminddb; then |
| 14 | dnl retrieve build options from pkg-config |
| 15 | if $PKG_CONFIG libmaxminddb --atleast-version 1.0.0; then |
| 16 | LIBMAXMINDDB_INC=`$PKG_CONFIG libmaxminddb --cflags` |
| 17 | LIBMAXMINDDB_LIB=`$PKG_CONFIG libmaxminddb --libs` |
| 18 | LIBMAXMINDDB_VER=`$PKG_CONFIG libmaxminddb --modversion` |
| 19 | AC_MSG_RESULT(found version $LIBMAXMINDDB_VER) |
| 20 | else |
| 21 | AC_MSG_ERROR(system libmaxminddb must be upgraded to version >= 1.0.0) |
| 22 | fi |
| 23 | PHP_EVAL_LIBLINE($LIBMAXMINDDB_LIB, MAXMINDDB_SHARED_LIBADD) |
| 24 | PHP_EVAL_INCLINE($LIBMAXMINDDB_INC) |
| 25 | else |
| 26 | AC_MSG_RESULT(pkg-config information missing) |
| 27 | AC_MSG_WARN(will use libmaxmxinddb from compiler default path) |
| 28 | |
| 29 | PHP_CHECK_LIBRARY(maxminddb, MMDB_open) |
| 30 | PHP_ADD_LIBRARY(maxminddb, 1, MAXMINDDB_SHARED_LIBADD) |
| 31 | fi |
| 32 | |
| 33 | if test $PHP_MAXMINDDB_DEBUG != "no"; then |
| 34 | CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror" |
| 35 | fi |
| 36 | |
| 37 | PHP_SUBST(MAXMINDDB_SHARED_LIBADD) |
| 38 | |
| 39 | PHP_NEW_EXTENSION(maxminddb, maxminddb.c, $ext_shared) |
| 40 | fi |
| 41 |