Skip to content

Commit 5d56082

Browse files
authored
Merge pull request #63 from remicollet/issue-curl-dir
fix libcurl handling
2 parents e4511fb + 75380ea commit 5d56082

File tree

3 files changed

+26
-29
lines changed

3 files changed

+26
-29
lines changed

README.INSTALLATION

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
PHP VERSION Dependencies
33
================================================================================
44

5-
PHP version 5.3 or later is needed
5+
PHP version 7.0 or later is needed
66

77
================================================================================
88
Extension Dependencies
@@ -16,10 +16,10 @@ Library Dependencies
1616

1717
libxml2 2.6.26 or later is required
1818

19-
libcurl 7.15.0 or later is required
19+
libcurl 7.15.5 or later is required
2020

2121
================================================================================
22-
On UNIX
22+
On Linux/UNIX
2323
================================================================================
2424

2525
As mentioned before, the libxml and curl extensions must be enabled for the Apache Solr extension to be functional.
@@ -30,7 +30,7 @@ To install the Apache Solr extension directly from PECL, please enter the follow
3030

3131
pecl install solr
3232

33-
To compile from source, please follow the following steps
33+
4A. To compile from source, please follow the following steps
3434

3535
$ phpize
3636

@@ -46,9 +46,7 @@ extension=solr.so
4646

4747
Then restart your webserver. For CLI only, you do not have to restart your webserver.
4848

49-
Note :
50-
51-
If your system does not have the minimum version of the libcurl or libxml libraries, you can download the libraries
49+
4B. If your system does not have the minimum version of the libcurl or libxml libraries, you can download the libraries
5250

5351
and compile them from source into a separate install prefix.
5452

@@ -94,7 +92,9 @@ Then you can pass libcurl prefix to the configure script for CURL and LIBXML res
9492

9593
during the configuration phase as shown here :
9694

97-
4B ./configure --enable-solr --with-curl=/root/custom/software --with-libxml-dir=/root/custom/software
95+
export PKG_CONFIG_PATH=/root/custom/software/lib/pkgconfig
96+
export PATH=$PATH:/root/custom/software/bin
97+
./configure --enable-solr
9898

9999
If you already have the latest versions of the libraries then the step listed in 4A alone is sufficient.
100100

config.m4

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
dnl 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-
93
PHP_ARG_ENABLE(solr, whether to enable the Solr extension,
104
[ --enable-solr Enable solr support])
115

126
PHP_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-
219
PHP_ARG_ENABLE(coverage, whether to enable code coverage,
2210
[ --enable-coverage Enable developer code coverage information],, no)
2311

2412
dnl Setting up the apache Solr extension
2513
if 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

package.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,6 @@ https://github.com/php/pecl-search_engine-solr
428428
<configureoption default="no"
429429
name="enable-solr-debug"
430430
prompt="Enable Solr Debugging (Compiles solr in debug mode)" />
431-
<configureoption default="/usr" name="with-curl"
432-
prompt="libcURL install prefix" />
433-
<configureoption default="/usr"
434-
name="with-libxml-dir" prompt="libxml2 install prefix" />
435431
</extsrcrelease>
436432

437433
<!-- Changes to the extension should be tracked here -->

0 commit comments

Comments
 (0)