[PATCH V2] configure.ac: Fallback to older detection code if pkg-config can't find expat

sardemff7+wayland at sardemff7.net sardemff7+wayland at sardemff7.net
Mon Feb 2 15:12:59 PST 2015


On 2015-02-02 22:29, Bill Spitzak wrote:
> This paritally reverts commit a4afd90f9f0c27ed5f3f313b915c260673f8be34.
>
> On older expat versions (ie the one on Ubuntu 12.04) there is no pkg-config
> file, so fall back to the previous test for the header file when it fails.
> Test is slightly cleaned up from previous one.
>
> I could not use AC_SEARCH_LIBS as was suggested, as this leaves the switch
> in LIBS, not EXPAT_LIBS, and thus does not match the pkg-config results.

Well, you can perfectly do that, especially since AC_CHECK_LIB does not 
export EXPAT_LIBS either.

I would advice to use AM_SUBST_NOTMAKE(LIBS) and never rely on LIBS at 
all. But that could be left to another patch I guess.
> ---
>   configure.ac |    7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 0426b53..fc5ea55 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -85,7 +85,12 @@ AC_ARG_WITH(icondir, [  --with-icondir=<dir>    Look for cursor icons here],
>   AC_SUBST([ICONDIR])
>
>   if test "x$enable_scanner" = "xyes"; then
> -	PKG_CHECK_MODULES(EXPAT, [expat])
> +	PKG_CHECK_MODULES(EXPAT, [expat],,
> +		[AC_CHECK_HEADERS(expat.h,,
> +			[AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
> +		AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],

Do you rely on PKG_CHECK_MODULES to AC_SUBST?


> +			[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
> +		])
>   fi
>
>   AC_PATH_PROG(XSLTPROC, xsltproc)
>


-- 

Quentin “Sardem FF7” Glidic


More information about the wayland-devel mailing list