11dnl config.m4 for the solr extension
22
3- dnl Configuring the CURL external library
4- dnl This folder is the grand-parent folder of easy.h
5- PHP_ARG_WITH(curl, for cURL support, [ --with-curl[ =DIR] SOLR : libcurl install prefix] )
6-
7- PKG_CHECK_MODULES([ CURL] , [ libcurl >= 7.15.0] )
8-
93PHP_ARG_ENABLE(solr, whether to enable the Solr extension,
104[ --enable-solr Enable solr support] )
115
126PHP_ARG_ENABLE(solr-debug, whether to compile with solr in verbose mode,
137[ --enable-solr-debug Compile with solr in verbose mode] , no, no)
148
15- dnl Configuring the LibXML external Library
16- if test -z "$PHP_LIBXML_DIR"; then
17- PHP_ARG_WITH(libxml-dir, libxml2 install dir,
18- [ --with-libxml-dir=[ DIR] SOLR : libxml2 install prefix] , no, no)
19- fi
20-
219PHP_ARG_ENABLE(coverage, whether to enable code coverage,
2210 [ --enable-coverage Enable developer code coverage information] ,, no)
2311
2412dnl Setting up the apache Solr extension
2513if test "$PHP_SOLR" != "no"; then
2614
27- if test "$PHP_CURL" = "no"; then
28- AC_MSG_ERROR ( [ Solr extension requires curl extension, add --with-curl] )
15+ AC_PATH_PROG ( PKG_CONFIG , pkg-config , no )
16+
17+ AC_MSG_CHECKING ( for libcurl )
18+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libcurl; then
19+ if $PKG_CONFIG libcurl --atleast-version 7.15.5; then
20+ CURL_CFLAGS=`$PKG_CONFIG libcurl --cflags`
21+ CURL_LIBS=`$PKG_CONFIG libcurl --libs`
22+ CURL_VERSON=`$PKG_CONFIG libcurl --modversion`
23+ AC_MSG_RESULT ( from pkgconfig: version $CURL_VERSON found )
24+ else
25+ AC_MSG_ERROR ( system libcurl must be upgraded to version >= 7.15.5 )
26+ fi
27+ else
28+ AC_MSG_ERROR ( pkg-config or libcurl not found )
2929 fi
3030
3131 PHP_CHECK_LIBRARY(curl,curl_easy_perform,
@@ -34,12 +34,11 @@ if test "$PHP_SOLR" != "no"; then
3434 ] ,[
3535 AC_MSG_ERROR ( There is something wrong. Please check config.log for more information. )
3636 ] ,[
37- $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR
37+ $CURL_LIBS
3838 ] )
3939
40- PHP_ADD_INCLUDE($CURL_DIR/include )
40+ PHP_EVAL_INCLINE($CURL_CFLAGS )
4141 PHP_EVAL_LIBLINE($CURL_LIBS, SOLR_SHARED_LIBADD)
42- PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, SOLR_SHARED_LIBADD)
4342
4443 if test "$PHP_LIBXML" = "no"; then
4544 AC_MSG_ERROR ( [ Solr extension requires LIBXML extension, add --enable-libxml] )
@@ -53,6 +52,8 @@ if test "$PHP_SOLR" != "no"; then
5352 AC_MSG_ERROR ( [ Solr extension requires json or jsonc support] )
5453 fi
5554
55+ dnl until PHP 7.3: xml2-config or pkg-config
56+ dnl since PHP 7.4: pkg-config only
5657 PHP_SETUP_LIBXML(SOLR_SHARED_LIBADD, [
5758 AC_DEFINE ( HAVE_SOLR , 1 ,[ Setting the value of HAVE_SOLR to 1 ] )
5859
0 commit comments