Skip to content

Commit 93d7735

Browse files
committed
Add support for PHP 7.
PHP versions less than 5.3 are no longer supported. MeCab versions less than 0.99 aer no longer supported.
1 parent 55e6481 commit 93d7735

File tree

6 files changed

+3980
-356
lines changed

6 files changed

+3980
-356
lines changed

mecab/config.m4

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@ if test "$PHP_MECAB" != "no"; then
1515
AC_PATH_PROGS(SED, sed gsed, [no])
1616
fi
1717

18-
dnl
19-
dnl Check PHP version
20-
dnl
21-
export OLD_CPPFLAGS="$CPPFLAGS"
22-
export CPPFLAGS="$CPPFLAGS $INCLUDES"
23-
AC_MSG_CHECKING([PHP version])
24-
AC_TRY_COMPILE([#include <php_version.h>], [
25-
#if !defined(PHP_VERSION_ID) || PHP_VERSION_ID < 50200
26-
#error this extension requires at least PHP version 5.2.0
27-
#endif
28-
],
29-
[AC_MSG_RESULT([ok])],
30-
[AC_MSG_ERROR([need at least PHP 5.2.0])])
31-
export CPPFLAGS="$OLD_CPPFLAGS"
32-
3318
dnl
3419
dnl Check the location of mecab-config
3520
dnl
@@ -67,9 +52,9 @@ if test "$PHP_MECAB" != "no"; then
6752

6853
MECAB_VERSION_NUMBER=`echo $MECAB_VERSION_STRING | $AWK -F. '{ printf "%d", $1 * 1000 + $2 }'`
6954

70-
if test "$MECAB_VERSION_NUMBER" -lt 94; then
55+
if test "$MECAB_VERSION_NUMBER" -ne 99 -a "$MECAB_VERSION_NUMBER" -lt 99; then
7156
AC_MSG_RESULT([$MECAB_VERSION_STRING])
72-
AC_MSG_ERROR([MeCab version 0.94 or later is required to compile php with MeCab support])
57+
AC_MSG_ERROR([MeCab version 0.99 or later is required to compile php with MeCab support])
7358
fi
7459

7560
AC_DEFINE_UNQUOTED(PHP_MECAB_VERSION_NUMBER, $MECAB_VERSION_NUMBER, [MeCab library version number])
@@ -101,5 +86,13 @@ if test "$PHP_MECAB" != "no"; then
10186
export LIBS="$OLD_LIBS"
10287

10388
PHP_SUBST(MECAB_SHARED_LIBADD)
104-
PHP_NEW_EXTENSION(mecab, mecab.c , $ext_shared)
89+
PHP_MECAB_PHP_VERSION=`$PHP_CONFIG --version 2>/dev/null`
90+
PHP_MECAB_PHP_VERNUM=`$PHP_CONFIG --vernum 2>/dev/null`
91+
AC_MSG_CHECKING([for PHP version])
92+
AC_MSG_RESULT([build for $PHP_MECAB_PHP_VERSION])
93+
if test "$PHP_MECAB_PHP_VERNUM" -ge 70000; then
94+
PHP_NEW_EXTENSION(mecab, mecab7.c , $ext_shared)
95+
else
96+
PHP_NEW_EXTENSION(mecab, mecab5.c , $ext_shared)
97+
fi
10598
fi

0 commit comments

Comments
 (0)