This repository has been archived by the owner on Nov 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.m4
114 lines (95 loc) · 3.12 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
dnl $Id$
AC_DEFUN([SPHINX_CHECK_ENUM], [
AC_MSG_CHECKING([for $1 in sphinxclient.h])
AC_TRY_COMPILE([#include <sphinxclient.h>], [int i = $1],
[
AC_DEFINE([HAVE_]$1, [], [Define if $1 is available])
AC_MSG_RESULT([found])
], [
AC_MSG_RESULT([not found])
])
])
PHP_ARG_WITH(sphinx, for sphinx support,
[ --with-sphinx Include sphinx support])
if test "$PHP_SPHINX" != "no"; then
SEARCH_PATH="/usr/local /usr /local /opt"
SEARCH_FOR="/include/sphinxclient.h"
if test "$PHP_SPHINX" = "yes"; then
AC_MSG_CHECKING([for libsphinxclient headers in default path])
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
SPHINX_DIR=$i
AC_MSG_RESULT(found in $i)
fi
done
else
AC_MSG_CHECKING([for libsphinxclient headers in $PHP_SPHINX])
if test -r $PHP_SPHINX/$SEARCH_FOR; then
SPHINX_DIR=$PHP_SPHINX
AC_MSG_RESULT([found])
fi
fi
if test -z "$SPHINX_DIR"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Cannot find libsphinxclient headers])
fi
PHP_ADD_INCLUDE($SPHINX_DIR/include)
LIBNAME=sphinxclient
LIBSYMBOL=sphinx_create
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SPHINX_DIR/$PHP_LIBDIR, SPHINX_SHARED_LIBADD)
AC_DEFINE(HAVE_SPHINXLIB,1,[ ])
],[
AC_MSG_ERROR([wrong libsphinxclient version or lib not found])
],[
-L$SPHINX_DIR/$PHP_LIBDIR -lm
])
PHP_CHECK_LIBRARY($LIBNAME,sphinx_get_string,
[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SPHINX_DIR/$PHP_LIBDIR, SPHINX_SHARED_LIBADD)
AC_DEFINE(LIBSPHINX_VERSION_ID,110,[ ])
LIBSPHINX_VERSION_ID="110"
],[],[
-L$SPHINX_DIR/$PHP_LIBDIR -lm
])
if test "x$LIBSPHINX_VERSION_ID" = "x"; then
PHP_CHECK_LIBRARY($LIBNAME,sphinx_set_select,
[
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $SPHINX_DIR/$PHP_LIBDIR, SPHINX_SHARED_LIBADD)
AC_DEFINE(LIBSPHINX_VERSION_ID,99,[ ])
LIBSPHINX_VERSION_ID="99"
],[],[
-L$SPHINX_DIR/$PHP_LIBDIR -lm
])
fi
if test "x$LIBSPHINX_VERSION_ID" = "x"; then
AC_DEFINE(LIBSPHINX_VERSION_ID,98,[ ])
fi
PHP_CHECK_LIBRARY($LIBNAME,sphinx_add_filter_string,
[
AC_DEFINE(HAVE_SPHINX_ADD_FILTER_STRING,1,[ ])
],[],[
-L$SPHINX_DIR/$PHP_LIBDIR -lm
])
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I$SPHINX_DIR/include"
AC_CACHE_CHECK([for new sphinx_set_ranking_mode() signature], ac_cv_3arg_setrankingmode,
[AC_TRY_COMPILE([#include <sphinxclient.h>], [sphinx_set_ranking_mode(0, 0, 0)],
ac_cv_3arg_setrankingmode=yes, ac_cv_3arg_setrankingmode=no)])
if test "$ac_cv_3arg_setrankingmode" = yes; then
AC_DEFINE(HAVE_3ARG_SPHINX_SET_RANKING_MODE,1,[Whether we have 3 arg sphinx_set_ranking_mode()])
fi
CFLAGS=$_SAVE_CFLAGS
_SAVE_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$SPHINX_DIR/include"
SPHINX_CHECK_ENUM(SPH_RANK_PROXIMITY)
SPHINX_CHECK_ENUM(SPH_RANK_MATCHANY)
SPHINX_CHECK_ENUM(SPH_RANK_FIELDMASK)
SPHINX_CHECK_ENUM(SPH_RANK_SPH04)
SPHINX_CHECK_ENUM(SPH_RANK_EXPR)
SPHINX_CHECK_ENUM(SPH_RANK_TOTAL)
CPPFLAGS=$_SAVE_CPPFLAGS
PHP_SUBST(SPHINX_SHARED_LIBADD)
PHP_NEW_EXTENSION(sphinx, sphinx.c, $ext_shared)
fi