@@ -15,21 +15,6 @@ if test "$PHP_MECAB" != "no"; then
15
15
AC_PATH_PROGS ( SED , sed gsed , [ no] )
16
16
fi
17
17
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
-
33
18
dnl
34
19
dnl Check the location of mecab-config
35
20
dnl
@@ -67,9 +52,9 @@ if test "$PHP_MECAB" != "no"; then
67
52
68
53
MECAB_VERSION_NUMBER=`echo $MECAB_VERSION_STRING | $AWK -F. '{ printf "%d", $1 * 1000 + $2 }'`
69
54
70
- if test "$MECAB_VERSION_NUMBER" -lt 94 ; then
55
+ if test "$MECAB_VERSION_NUMBER" -ne 99 -a "$MECAB_VERSION_NUMBER" - lt 99 ; then
71
56
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] )
73
58
fi
74
59
75
60
AC_DEFINE_UNQUOTED ( PHP_MECAB_VERSION_NUMBER , $MECAB_VERSION_NUMBER , [ MeCab library version number] )
@@ -101,5 +86,13 @@ if test "$PHP_MECAB" != "no"; then
101
86
export LIBS="$OLD_LIBS"
102
87
103
88
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
105
98
fi
0 commit comments