| 1 |
|
| 2 |
PHP_ARG_WITH(groonga, whether groonga is available,[ --with-groonga[=DIR] With groonga support]) |
| 3 |
|
| 4 |
|
| 5 |
if test "$PHP_GROONGA" != "no"; then |
| 6 |
|
| 7 |
|
| 8 |
if test -r "$PHP_GROONGA/include/groonga.h"; then |
| 9 |
PHP_GROONGA_DIR="$PHP_GROONGA" |
| 10 |
PHP_ADD_INCLUDE($PHP_GROONGA_DIR/include) |
| 11 |
elif test -r "$PHP_GROONGA/include/groonga/groonga.h"; then |
| 12 |
PHP_GROONGA_DIR="$PHP_GROONGA" |
| 13 |
PHP_ADD_INCLUDE($PHP_GROONGA_DIR/include/groonga) |
| 14 |
else |
| 15 |
AC_MSG_CHECKING(for groonga in default path) |
| 16 |
for i in /usr /usr/local; do |
| 17 |
if test -r "$i/include/groonga/groonga.h"; then |
| 18 |
PHP_GROONGA_DIR=$i |
| 19 |
AC_MSG_RESULT(found in $i) |
| 20 |
break |
| 21 |
fi |
| 22 |
done |
| 23 |
if test "x" = "x$PHP_GROONGA_DIR"; then |
| 24 |
AC_MSG_ERROR(not found) |
| 25 |
fi |
| 26 |
PHP_ADD_INCLUDE($PHP_GROONGA_DIR/include) |
| 27 |
fi |
| 28 |
|
| 29 |
export OLD_CPPFLAGS="$CPPFLAGS" |
| 30 |
export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_GROONGA" |
| 31 |
AC_CHECK_HEADER([groonga.h], [], AC_MSG_ERROR('groonga.h' header not found)) |
| 32 |
PHP_SUBST(GROONGA_SHARED_LIBADD) |
| 33 |
|
| 34 |
|
| 35 |
PHP_CHECK_LIBRARY(groonga, grn_init, |
| 36 |
[ |
| 37 |
PHP_ADD_LIBRARY_WITH_PATH(groonga, $PHP_GROONGA_DIR/lib, GROONGA_SHARED_LIBADD) |
| 38 |
],[ |
| 39 |
AC_MSG_ERROR([wrong groonga lib version or lib not found]) |
| 40 |
],[ |
| 41 |
-L$PHP_GROONGA_DIR/lib |
| 42 |
]) |
| 43 |
export CPPFLAGS="$OLD_CPPFLAGS" |
| 44 |
|
| 45 |
export OLD_CPPFLAGS="$CPPFLAGS" |
| 46 |
export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_GROONGA" |
| 47 |
|
| 48 |
AC_MSG_CHECKING(PHP version) |
| 49 |
AC_TRY_COMPILE([#include <php_version.h>], [ |
| 50 |
#if PHP_VERSION_ID < 40000 |
| 51 |
#error this extension requires at least PHP version 4.0.0 |
| 52 |
#endif |
| 53 |
], |
| 54 |
[AC_MSG_RESULT(ok)], |
| 55 |
[AC_MSG_ERROR([need at least PHP 4.0.0])]) |
| 56 |
|
| 57 |
export CPPFLAGS="$OLD_CPPFLAGS" |
| 58 |
|
| 59 |
|
| 60 |
PHP_SUBST(GROONGA_SHARED_LIBADD) |
| 61 |
AC_DEFINE(HAVE_GROONGA, 1, [ ]) |
| 62 |
|
| 63 |
PHP_NEW_EXTENSION(groonga, groonga.c , $ext_shared) |
| 64 |
|
| 65 |
fi |
| 66 |
|