dnl
dnl $ Id: $
dnl

dnl # PHP_ARG_ENABLE(clucene, whether to enable clucene functions,
dnl # [  --enable-clucene         Enable clucene support])

PHP_ARG_WITH(clucene, for CLucene support,
[  --with-clucene[=DIR]      Include CLucene support])

if test "$PHP_CLUCENE" != "no"; then
    PHP_NEW_EXTENSION(clucene, clucene.cpp , $ext_shared)
    PHP_REQUIRE_CXX
    AC_LANG_CPLUSPLUS
    PHP_ADD_LIBRARY(stdc++,,CLUCENE_SHARED_LIBADD)

    if test "$PHP_CLUCENE" != "yes"; then
        CLUCENE_SEARCH_DIRS=$PHP_CLUCENE
    else
        CLUCENE_SEARCH_DIRS="/usr/local /usr"
    fi
    for i in $CLUCENE_SEARCH_DIRS; do
        if test -f $i/include/CLucene.h; then
            CLUCENE_DIR=$i
            CLUCENE_INCDIR=$i/include/CLucene
        fi
    done

    if test -z "$CLUCENE_DIR"; then
        AC_MSG_ERROR(Cannot find libclucene)
    fi

    CLUCENE_LIBDIR=$CLUCENE_DIR/lib

    AC_DEFINE(HAVE_CLUCENE, 1, [ ])
    PHP_SUBST(CLUCENE_SHARED_LIBADD)
    PHP_ADD_LIBRARY_WITH_PATH(clucene, $CLUCENE_LIBDIR, CLUCENE_SHARED_LIBADD)
    PHP_ADD_INCLUDE($CLUCENE_INCDIR)
fi

