Re: com php-src: Fixed finding CURL on systems with multiarch support: NEWS ext/curl/config.m4
| From: | Carsten Brandt | Date: | Tue, 15 Aug 2017 16:55:21 +0000 |
| Subject: | Re: com php-src: Fixed finding CURL on systems with multiarch support: NEWS ext/curl/config.m4 | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-99037@lists.php.net to get a copy of this message | ||
Hi Derick,
thanks for the hint, I have never worked with pkg-config so I had no
idea how it works.
In your example the pkg-config command prints out arguments to be passed
to the C compiler, however in the config.m4 file we need the directory
to pass it to PHP_ADD_INCLUDE(). Seems we can get it like this:
$ pkg-config --variable=includedir libcurl
/usr/include/x86_64-linux-gnu
If we change it to use pkg-config, is pkg-config a hard requirement for
building PHP, or should there be a fallback if pkg-config is not available?
If we rely on pkg-config, this should probably also be mentioned in the
docs:
http://php.net/manual/en/install.unix.php
I can make the changes if we agree on how it should be done.
best regards,
Carsten
On 09.08.2017 13:15, Derick Rethans wrote:
> Hi,
>
> this isn't really the right fix. It should use pkg-config instead of the
> multiarch guessing. pkg-config (As used in odbc) handles this perfectly:
>
> derick@singlemalt:~ $ pkg-config --cflags --libs libcurl
> -I/usr/include/x86_64-linux-gnu -lcurl
>
> pkg-config will also allow us to replace the version checking for curl
> with a normal pkg-config --atleast-version construct as well.
>
> I would like to see this back ported to 5.6 too, as we're still need to
> support that, and without this, we can't build 5.6 + curl on debian.
>
> cheers,
> Derick
>
>
> On Tue, 25 Jul 2017, Joe Watkins wrote:
>
>> Commit: 3fd7d819b8ea164bdf255cddcd0a1b1d156f4a3b
>> Author: Carsten Brandt <mail@cebe.cc> Fri, 14 Jul 2017 13:45:33 +0200
>> Committer: Joe Watkins <krakjoe@php.net> Tue, 25 Jul 2017 06:58:11 +0100
>> Parents: 69b48f83dfc287a8430cf8e993d0937c5128623f
>> Branches: PHP-7.0 PHP-7.1 PHP-7.2 master
>>
>> Link:
>> http://git.php.net/?p=php-src.git;a=commitdiff;h=3fd7d819b8ea164bdf255cddcd0a1b1d156f4a3b
>>
>> Log:
>> Fixed finding CURL on systems with multiarch support
>>
>> fixes https://bugs.php.net/bug.php?id=74125
>>
>> This commit makes the cURL config script aware of debian/ubuntu
>> [multiarch support][1] which installs architecture specific
>> headers in a different location.
>>
>> It checks whether the
dpkg-architecture script exists and
>> is
>> executeable, if that is the case, the multiarch architecture is
>> detected by calling dpkg-architecture -qDEB_HOST_MULTIARCH
>> as
>> documented in [debian multiarch implementation docs][2]:
>>
>>> /usr/include/<triplet>: used for arch-varying
>>> headers
>>
>> [1]: https://wiki.debian.org/Multiarch
>> [2]: https://wiki.debian.org/Multiarch/Implementation
>>
>> Changed paths:
>> M NEWS
>> M ext/curl/config.m4
>>
>>
>> Diff:
>> diff --git a/NEWS b/NEWS
>> index f82a0f3..ff9dba5 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -6,6 +6,10 @@ PHP
>> NEWS
>> . Fixed bug #74947 (Segfault in scanner on INF number). (Laruence)
>> . Fixed bug #74954 (null deref and segfault in zend_generator_resume()). (Bob)
>>
>> +- cURL:
>> + . Fixed bug #74125 (Fixed finding CURL on systems with multiarch support).
>> + (cebe)
>> +
>> - Mbstring:
>> . Fixed bug #71606 (Segmentation fault mb_strcut with HTML-ENTITIES encoding).
>> (cmb)
>> diff --git a/ext/curl/config.m4 b/ext/curl/config.m4
>> index 2f82c34..63682e0 100644
>> --- a/ext/curl/config.m4
>> +++ b/ext/curl/config.m4
>> @@ -17,11 +17,23 @@ if test "$PHP_CURL" != "no"; then
>> break
>> fi
>> done
>> + if test -z "$CURL_DIR"; then
>> + AC_MSG_RESULT(not found)
>> + if which dpkg-architecture>/dev/null; then
>> + AC_MSG_CHECKING(for cURL in multiarch path)
>> + CURL_MULTIARCH_INCLUDE=/usr/include/$(dpkg-architecture -qDEB_HOST_MULTIARCH)
>> + if test -r $CURL_MULTIARCH_INCLUDE/curl/easy.h; then
>> + CURL_DIR=/usr
>> + AC_MSG_RESULT(found in $CURL_MULTIARCH_INCLUDE)
>> + else
>> + AC_MSG_RESULT(not found)
>> + fi
>> + fi
>> + fi
>> fi
>>
>> if test -z "$CURL_DIR"; then
>> - AC_MSG_RESULT(not found)
>> - AC_MSG_ERROR(Please reinstall the libcurl distribution -
>> + AC_MSG_ERROR(Could not find cURL, please reinstall the libcurl distribution -
>> easy.h should be in <curl-dir>/include/curl/)
>> fi
>>
>> @@ -45,7 +57,11 @@ if test "$PHP_CURL" != "no"; then
>> AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL
>> support)
>> fi
>>
>> - PHP_ADD_INCLUDE($CURL_DIR/include)
>> + if test -z "$CURL_MULTIARCH_INCLUDE"; then
>> + PHP_ADD_INCLUDE($CURL_DIR/include)
>> + else
>> + PHP_ADD_INCLUDE($CURL_MULTIARCH_INCLUDE)
>> + fi
>> PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
>> PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, CURL_SHARED_LIBADD)
>>
>>
>> --
>> PHP CVS Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
--
mail: mail@cebe.cc
phone: +49 176 / 96 52 999 7
www: http://cebe.cc/
pgp: http://cebe.cc/cebe_pub.asc
skype: skype://cebe08
irc: cebe @ irc.freenode.net