Re: com php-src: Fixed finding CURL on systems with multiarch support: NEWS ext/curl/config.m4

From: Date: Wed, 16 Aug 2017 06:36:00 +0000
Subject: Re: com php-src: Fixed finding CURL on systems with multiarch support: NEWS ext/curl/config.m4
References: 1 2 3 4  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-99049@lists.php.net to get a copy of this message
Le 15/08/2017 à 21:42, Derick Rethans a écrit : > 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: See the macros dedicated to this task: PHP_EVAL_INCLINE PHP_EVAL_LIBLINE >> >> $ 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. Indeed, pkg-config should be available on all distribution, already use by various extensions (php or pecl), and a fallback (using directory) still required. In short PHP_CURL == yes => curl-config or pkg-config PHP_CURL != yes => use provided directory The ugly thing with current config.m4 is the use of dpkg (which is debian specific) As "curl-config" is used, we should use "curl-config --libs", but this one seems broken on debian (according to Derick tests, so adding ondrej in the loop for feedback) Indeed switching to pkg-config should work (pkg-config --libs output is ok, from Derick tests) BTW, this may introduce some changes, and could break some build scripts, (curl-config is searched in provided directory, while pkg-config need PKG_CONFIG_PATH from env) So such big change should probably only go in 7.2+ (even if it have happen in the past, e.g. for interbase, but this one was totally broken) Remi

« previous php.cvs (#99049) next »