Re: com php-src: Fixed finding CURL on systems with multiarch support: NEWS ext/curl/config.m4
| From: | Derick Rethans | Date: | Tue, 15 Aug 2017 19:42:37 +0000 |
| Subject: | Re: com php-src: Fixed finding CURL on systems with multiarch support: NEWS ext/curl/config.m4 | ||
| References: | 1 2 3 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-99044@lists.php.net to get a copy of this message | ||
Hi,
On Tue, 15 Aug 2017, Carsten Brandt wrote:
> 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?
The fallback could be guessing in which directory it could live. If you
check the ext/odbc/config.m4 file, you see how this is commonly done:
if test -z "$ODBC_TYPE"; then
PHP_ARG_WITH(iodbc,,
[ --with-iodbc[=DIR] Include iODBC support [/usr/local]])
AC_MSG_CHECKING(for iODBC support)
if test "$PHP_IODBC" != "no"; then
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libiodbc ; then
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
ODBC_TYPE=iodbc
ODBC_INCLUDE=
$PKG_CONFIG --cflags-only-I libiodbc
ODBC_LFLAGS=$PKG_CONFIG --libs-only-L libiodbc
ODBC_LIBS=$PKG_CONFIG --libs-only-l libiodbc
PHP_EVAL_INCLINE($ODBC_INCLUDE)
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
else
if test "$PHP_IODBC" = "yes"; then
PHP_IODBC=/usr/local
fi
A
This bit of course needs to do what ext/curl/config.m4 already did for multiple paths.
PHP_ADD_LIBRARY_WITH_PATH(iodbc, $PHP_IODBC/$PHP_LIBDIR)
PHP_ADD_INCLUDE($PHP_IODBC/include, 1)
ODBC_TYPE=iodbc
ODBC_INCLUDE=-I$PHP_IODBC/include
ODBC_LFLAGS=-L$PHP_IODBC/$PHP_LIBDIR
ODBC_LIBS=-liodbc
AC_DEFINE(HAVE_IODBC,1,[ ])
AC_DEFINE(HAVE_ODBC2,1,[ ])
AC_MSG_RESULT([$ext_output])
fi
else
AC_MSG_RESULT(no)
fi
fi
>
> 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.
I think pkg-config is pretty ubiquitous, and should be available on most
distributions. Remi will know that better.
cheers,
Derick
--
https://derickrethans.nl | https://xdebug.org | https://dram.io
Like Xdebug? Consider a donation: https://xdebug.org/donate.php
twitter: @derickr and @xdebug