-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.m4
61 lines (48 loc) · 1.54 KB
/
config.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
dnl $Id$
dnl config.m4 for extension mystem
PHP_ARG_WITH(mystem, for mystem support,
Make sure that the comment is aligned:
[ --with-mystem Include mystem support])
if test "$PHP_MYSTEM" != "no"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if ! test -x $PKG_CONFIG; then
AC_MSG_ERROR([pkg-config is required])
fi
AC_MSG_CHECKING([for libicu using pkg-config])
if ! $PKG_CONFIG --exists icu-uc; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([libicu not found])
fi
AC_MSG_RESULT([found])
PHP_ICU_LIBS=`$PKG_CONFIG icu-uc --libs`
PHP_ICU_INCS=`$PKG_CONFIG icu-uc --cflags`
PHP_EVAL_LIBLINE($PHP_ICU_LIBS, MYSTEM_SHARED_LIBADD)
PHP_EVAL_INCLINE($PHP_ICU_INCS)
SEARCH_PATH="./lib /usr/local/lib64 /usr/lib64"
SEARCH_FOR="libmystem_c_binding.so"
AC_MSG_CHECKING([for mystem files in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
MYSTEM_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
if test -z "$MYSTEM_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Please install the mystem_c_binding library])
fi
LIBNAME=mystem_c_binding
LIBSYMBOL=MystemAnalyze
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $MYSTEM_DIR, MYSTEM_SHARED_LIBADD)
AC_DEFINE(HAVE_MYSTEMLIB,1,[ ])
],[
AC_MSG_ERROR([wrong mystem lib version or lib not found])
],[
-L$MYSTEM_DIR -lm
])
PHP_REQUIRE_CXX()
PHP_SUBST(MYSTEM_SHARED_LIBADD)
PHP_NEW_EXTENSION(mystem, mystem.cpp, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi