Commit 8dabde17 authored by Alexandre Julliard's avatar Alexandre Julliard

configure: Add a helper macro for invoking pkg-config, and use it for libxml.

parent 3173e275
......@@ -22,13 +22,17 @@ dnl configuration script generated by Autoconf, you may include it
dnl under the same distribution terms that you use for the rest of
dnl that program.
dnl **** Get the programs used by WINE_GET_SONAME ****
dnl **** Initialize the programs used by other checks ****
dnl
dnl Usage: WINE_PATH_SONAME_TOOLS
dnl Usage: WINE_PATH_PKG_CONFIG
dnl
AC_DEFUN([WINE_PATH_SONAME_TOOLS],
[AC_PATH_PROG(LDD,ldd,true,/sbin:/usr/sbin:$PATH)
AC_CHECK_TOOLS(READELF,[readelf],true)])
AC_CHECK_TOOL(READELF,[readelf],true)])
AC_DEFUN([WINE_PATH_PKG_CONFIG],
[AC_CHECK_TOOL(PKG_CONFIG,[pkg-config])])
dnl **** Extract the soname of a library ****
dnl
......@@ -61,6 +65,25 @@ AS_IF([test "x]AS_VAR_GET(ac_Lib)[" = "x"],
m4_popdef([ac_lib_pattern])dnl
AS_VAR_POPDEF([ac_Lib])])
dnl **** Get flags from pkg-config or alternate xxx-config program ****
dnl
dnl Usage: WINE_PACKAGE_FLAGS(var,pkg-name,[default-lib,[cflags-alternate,libs-alternate]])
dnl
AC_DEFUN([WINE_PACKAGE_FLAGS],
[AC_REQUIRE([WINE_PATH_PKG_CONFIG])dnl
AC_ARG_VAR([$1]_CFLAGS, [C compiler flags for $2, overriding pkg-config])dnl
AS_IF([test -n "$[$1]_CFLAGS"],[],
[test -n "$PKG_CONFIG"],
[[$1]_CFLAGS=`$PKG_CONFIG --cflags [$2] 2>/dev/null`])
m4_ifval([$4],[[$1]_CFLAGS=[$]{[$1]_CFLAGS:-`[$4] 2>/dev/null`}])
CPPFLAGS="$CPPFLAGS $[$1]_CFLAGS"
AC_ARG_VAR([$1]_LIBS, [Linker flags for $2, overriding pkg-config])dnl
AS_IF([test -n "$[$1]_LIBS"],[],
[test -n "$PKG_CONFIG"],
[[$1]_LIBS=`$PKG_CONFIG --libs [$2] 2>/dev/null`])
m4_ifval([$5],[[$1]_LIBS=[$]{[$1]_LIBS:-`[$5] 2>/dev/null`}])
m4_ifval([$3],[[$1]_LIBS=[$]{[$1]_LIBS:-"$3"}])])
dnl **** Link C code with an assembly file ****
dnl
dnl Usage: WINE_TRY_ASM_LINK(asm-code,includes,function,[action-if-found,[action-if-not-found]])
......
......@@ -286,7 +286,6 @@ AC_SUBST(LINTFLAGS)
dnl Check for various programs
AC_CHECK_PROGS(FONTFORGE, fontforge, false)
AC_CHECK_PROGS(PKG_CONFIG, pkg-config, false)
AC_CHECK_PROGS(RSVG, rsvg, false)
AC_CHECK_PROGS(CONVERT, convert, false)
AC_CHECK_PROGS(ICOTOOL, icotool, false)
......@@ -1268,40 +1267,30 @@ test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes && enable_opencl=${enable_op
dnl **** Check for libxml2 ****
AC_SUBST(XML2LIBS,"")
AC_SUBST(XML2INCL,"")
AC_SUBST(XSLTINCL,"")
if test "x$with_xml" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
if test "$PKG_CONFIG" != "false"
then
ac_xml_libs="`$PKG_CONFIG --libs libxml-2.0 2>/dev/null`"
ac_xml_cflags="`$PKG_CONFIG --cflags libxml-2.0 2>/dev/null`"
else
ac_xml_libs="`xml2-config --libs 2>/dev/null`"
ac_xml_cflags="`xml2-config --cflags 2>/dev/null`"
fi
CPPFLAGS="$CPPFLAGS $ac_xml_cflags"
WINE_PACKAGE_FLAGS(XML2,[libxml-2.0],[-lxml2],[xml2-config --cflags],[xml2-config --libs])
AC_CHECK_HEADERS([libxml/parser.h libxml/xmlsave.h libxml/SAX2.h])
if test "$ac_cv_header_libxml_parser_h" = "yes" -a "$ac_cv_header_libxml_xmlsave_h" = "yes" -a "$ac_cv_header_libxml_SAX2_h" = "yes"
then
AC_CHECK_LIB(xml2, xmlParseMemory,
[AC_DEFINE(HAVE_LIBXML2, 1, [Define if you have the libxml2 library])
XML2LIBS="$ac_xml_libs"
XML2INCL="$ac_xml_cflags"],,$ac_xml_libs)
[AC_DEFINE(HAVE_LIBXML2, 1, [Define if you have the libxml2 library])],[XML2_LIBS=""],[$XML2_LIBS])
AC_CHECK_LIB(xml2, xmlReadMemory,
[AC_DEFINE(HAVE_XMLREADMEMORY,1,[Define if libxml2 has the xmlReadMemory function])],,$ac_xml_libs)
[AC_DEFINE(HAVE_XMLREADMEMORY,1,[Define if libxml2 has the xmlReadMemory function])],,[$XML2_LIBS])
AC_CHECK_LIB(xml2, xmlNewDocPI,
[AC_DEFINE(HAVE_XMLNEWDOCPI,1,[Define if libxml2 has the xmlNewDocPI function])],,$ac_xml_libs)
[AC_DEFINE(HAVE_XMLNEWDOCPI,1,[Define if libxml2 has the xmlNewDocPI function])],,[$XML2_LIBS])
AC_CHECK_LIB(xml2, xmlSchemaSetParserStructuredErrors,
[AC_DEFINE(HAVE_XMLSCHEMASSETPARSERSTRUCTUREDERRORS,1,[Define if libxml2 has the xmlSchemaSetParserStructuredErrors function])],,$ac_xml_libs)
[AC_DEFINE(HAVE_XMLSCHEMASSETPARSERSTRUCTUREDERRORS,1,[Define if libxml2 has the xmlSchemaSetParserStructuredErrors function])],,[$XML2_LIBS])
AC_CHECK_LIB(xml2, xmlSchemaSetValidStructuredErrors,
[AC_DEFINE(HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS,1,[Define if libxml2 has the xmlSchemaSetValidStructuredErrors function])],,$ac_xml_libs)
[AC_DEFINE(HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS,1,[Define if libxml2 has the xmlSchemaSetValidStructuredErrors function])],,[$XML2_LIBS])
AC_CHECK_LIB(xml2, xmlFirstElementChild,
[AC_DEFINE(HAVE_XMLFIRSTELEMENTCHILD,1,[Define if libxml2 has the xmlFirstElementChild function])],,$ac_xml_libs)
[AC_DEFINE(HAVE_XMLFIRSTELEMENTCHILD,1,[Define if libxml2 has the xmlFirstElementChild function])],,[$XML2_LIBS])
AC_CHECK_TYPE([xmlDocProperties],
[AC_DEFINE(HAVE_XMLDOC_PROPERTIES,1,[Define if libxml2 has the xmlDocProperties enum])],,[[#include <libxml/tree.h>]])
else
XML2_CFLAGS=""
XML2_LIBS=""
fi
CPPFLAGS="$ac_save_CPPFLAGS"
fi
......@@ -1310,16 +1299,8 @@ WINE_WARNING_WITH(xml,[test "$ac_cv_lib_xml2_xmlParseMemory" != "yes"],
if test "x$with_xslt" != "xno"
then
if test "$PKG_CONFIG" != "false"
then
ac_xslt_libs="`$PKG_CONFIG --libs libxslt 2>/dev/null`"
ac_xslt_cflags="`$PKG_CONFIG --cflags libxslt 2>/dev/null`"
else
ac_xslt_libs="`xslt-config --libs 2>/dev/null`"
ac_xslt_cflags="`xslt-config --cflags 2>/dev/null`"
fi
ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $ac_xslt_cflags"
WINE_PACKAGE_FLAGS(XSLT,[libxslt],[-lxml2],[xslt-config --cflags],[xslt-config --libs])
AC_CHECK_HEADERS([libxslt/pattern.h libxslt/transform.h],,,
[#ifdef HAVE_LIBXSLT_PATTERN_H
# include <libxslt/pattern.h>
......@@ -1327,8 +1308,9 @@ then
CPPFLAGS="$ac_save_CPPFLAGS"
if test "$ac_cv_header_libxslt_transform_h" = "yes"
then
WINE_CHECK_SONAME(xslt,xsltCompilePattern,
[XSLTINCL="$ac_xslt_cflags"],,[$ac_xslt_libs])
WINE_CHECK_SONAME(xslt,xsltCompilePattern,,,[$XSLT_LIBS])
else
XSLT_CFLAGS=""
fi
fi
WINE_WARNING_WITH(xslt,[test "x$ac_cv_lib_soname_xslt" = "x"],
......
EXTRADEFS = -DCOM_NO_WINDOWS_H
MODULE = msxml3.dll
IMPORTS = uuid urlmon shlwapi oleaut32 ole32 user32 advapi32
EXTRALIBS = @XML2LIBS@
EXTRAINCL = @XML2INCL@ @XSLTINCL@
EXTRALIBS = @XML2_LIBS@
EXTRAINCL = @XML2_CFLAGS@ @XSLT_CFLAGS@
C_SRCS = \
attribute.c \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment