dnl dnl $ Id: $ dnl PHP_ARG_WITH(mecab, for MeCab support, [ --with-mecab[=FILE] Include MeCab support. FILE is the optional pathname to mecab-config]) if test "$PHP_MECAB" != "no"; then dnl dnl Check if the locations of sed and awk are defined dnl if test -z "$SED"; then SED=sed fi if test -z "$AWK"; then AWK=awk fi dnl dnl Check the location of mecab-config dnl if test "$PHP_MECAB" = "yes"; then for i in /usr/local /usr; do test -x $i/bin/mecab-config && MECAB_CONFIG=$i && break done if test -z "$MECAB_CONFIG"; then AC_MSG_ERROR([mecab-config not found.]) fi else MECAB_CONFIG=$PHP_MECAB fi dnl dnl Get the version number, CFLAGS and LIBS by mecab-config dnl if test -x "$PHP_MECAB"; then AC_MSG_CHECKING([for MeCab library version]) MECAB_VERSION=`$MECAB_CONFIG --version 2> /dev/null` if test -z "$MECAB_VERSION"; then AC_MSG_ERROR([invalid mecab-config passed to --with-mecab!]) fi MECAB_VERSION_NUMBER=`echo $MECAB_VERSION | $AWK -F. '{ printf "%d", $1 * 1000 + $2 }'` if test "$MECAB_VERSION_NUMBER" -lt 90; then AC_MSG_ERROR([MeCab version 0.90 or later is required to compile php with MeCab support.]) fi AC_DEFINE_UNQUOTED(PHP_MECAB_VERSION_STRING, "$MECAB_VERSION", [MeCab library version]) AC_MSG_RESULT([$MECAB_VERSION]) MECAB_INCLINE=`$MECAB_CONFIG --cflags` MECAB_LIBLINE=`$MECAB_CONFIG --libs` else AC_MSG_ERROR([mecab-config not executable.]) fi dnl dnl Check the headers and types dnl export OLD_CPPFLAGS="$CPPFLAGS" export CPPFLAGS="$CPPFLAGS $MECAB_INCLINE" AC_CHECK_HEADER(mecab.h, [], AC_MSG_ERROR([mecab.h header not found.])) AC_CHECK_TYPE(mecab_t *, [], [ AC_MSG_ERROR([required payload type for resource mecab not found.]) ],[ #include ]) AC_CHECK_TYPE(mecab_node_t *, [], [ AC_MSG_ERROR([required payload type for resource mecab_node not found.]) ],[ #include ]) AC_CHECK_TYPE(mecab_path_t *, [], [ AC_MSG_ERROR([required payload type for resource mecab_path not found.]) ],[ #include ]) export CPPFLAGS="$OLD_CPPFLAGS" dnl dnl Check the library dnl PHP_CHECK_LIBRARY(mecab, mecab_new2, [ PHP_EVAL_INCLINE($MECAB_INCLINE) PHP_EVAL_LIBLINE($MECAB_LIBLINE, MECAB_SHARED_LIBADD) ],[ AC_MSG_ERROR([wrong MeCab library version or lib not found. Check config.log for more information.]) ],[ $MECAB_LIBLINE ]) PHP_SUBST(MECAB_SHARED_LIBADD) PHP_NEW_EXTENSION(mecab, mecab.c , $ext_shared) fi