blob: b4ed4306da1b2f0558ee27966a35d0f0adb2297e [file] [log] [blame]
Andrew Geisslerd1d22e62020-10-16 10:14:32 -05001configure does not work with OE pkg-config for the libxml2 option
2
3Upstream-Status: OE specific
4
5Signed-off-by: Armin Kuster <akuster808@gmail.com>
6
7Index: opendnssec-2.1.6/m4/acx_libxml2.m4
8===================================================================
9--- opendnssec-2.1.6.orig/m4/acx_libxml2.m4
10+++ opendnssec-2.1.6/m4/acx_libxml2.m4
11@@ -1,37 +1,67 @@
12+#serial 11
13+AU_ALIAS([CHECK_XML2], [ACX_LIBXML2])
14 AC_DEFUN([ACX_LIBXML2],[
15- AC_ARG_WITH(libxml2,
16- [AS_HELP_STRING([--with-libxml2=DIR],[look for libxml2 in this dir])],
17- [
18- XML2_PATH="$withval"
19- AC_PATH_PROGS(XML2_CONFIG, xml2-config, xml2-config, $XML2_PATH/bin)
20- ],[
21- XML2_PATH="/usr/local"
22- AC_PATH_PROGS(XML2_CONFIG, xml2-config, xml2-config, $PATH)
23- ])
24- if test -x "$XML2_CONFIG"
25- then
26- AC_MSG_CHECKING(what are the xml2 includes)
27- XML2_INCLUDES="`$XML2_CONFIG --cflags`"
28- AC_MSG_RESULT($XML2_INCLUDES)
29-
30- AC_MSG_CHECKING(what are the xml2 libs)
31- XML2_LIBS="`$XML2_CONFIG --libs`"
32- AC_MSG_RESULT($XML2_LIBS)
33-
34- tmp_CPPFLAGS=$CPPFLAGS
35- tmp_LIBS=$LIBS
36-
37- CPPFLAGS="$CPPFLAGS $XML2_INCLUDES"
38- LIBS="$LIBS $XML2_LIBS"
39-
40- AC_CHECK_LIB(xml2, xmlDocGetRootElement,,[AC_MSG_ERROR([Can't find libxml2 library])])
41-
42- CPPFLAGS=$tmp_CPPFLAGS
43- LIBS=$tmp_LIBS
44- else
45- AC_MSG_ERROR([libxml2 required, but not found.])
46- fi
47+ found=false
48+ AC_ARG_WITH([libxml2],
49+ [AS_HELP_STRING([--with-libxml2=DIR],
50+ [root of the libxml directory])],
51+ [
52+ case "$withval" in
53+ "" | y | ye | yes | n | no)
54+ AC_MSG_ERROR([Invalid --with-libxml2 value])
55+ ;;
56+ *) xml2dirs="$withval"
57+ ;;
58+ esac
59+ ], [
60+ # if pkg-config is installed and openssl has installed a .pc file,
61+ # then use that information and don't search ssldirs
62+ AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
63+ if test x"$PKG_CONFIG" != x""; then
64+ XML2_LDFLAGS=`$PKG_CONFIG libxml-2.0 --libs-only-L 2>/dev/null`
65+ if test $? = 0; then
66+ XML2_LIBS=`$PKG_CONFIG libxml-2.0 --libs-only-l 2>/dev/null`
67+ XML2_INCLUDES=`$PKG_CONFIG libxml-2.0 --cflags-only-I 2>/dev/null`
68+ found=true
69+ fi
70+ fi
71
72- AC_SUBST(XML2_INCLUDES)
73- AC_SUBST(XML2_LIBS)
74+ # no such luck; use some default ssldirs
75+ if ! $found; then
76+ xml2dirs="/usr/local/libxml /usr/lib/libxml /usr/libxml /usr/pkg /usr/local /usr"
77+ fi
78+ ]
79+ )
80+
81+
82+ # note that we #include <libxml/tree.h>, so the libxml2 headers have to be in
83+ # an 'libxml' subdirectory
84+
85+ if ! $found; then
86+ XML2_INCLUDES=
87+ for xml2dir in $xml2dirs; do
88+ AC_MSG_CHECKING([for XML2 in $xml2dir])
89+ if test -f "$xml2dir/include/libxml2/libxml/tree.h"; then
90+ XML2_INCLUDES="-I$xml2dir/include/libxml2"
91+ XML2_LDFLAGS="-L$xml2dir/lib"
92+ XML2_LIBS="-lxml2"
93+ found=true
94+ AC_MSG_RESULT([yes])
95+ break
96+ else
97+ AC_MSG_RESULT([no])
98+ fi
99+ done
100+
101+ # if the file wasn't found, well, go ahead and try the link anyway -- maybe
102+ # it will just work!
103+ fi
104+
105+ LDFLAGS="$LDFLAGS $XML2_LDFLAGS"
106+ LIBS="$XML2_LIBS $LIBS"
107+ CPPFLAGS="$XML2_INCLUDES $CPPFLAGS"
108+
109+ AC_SUBST(XML2_INCLUDES)
110+ AC_SUBST(XML2_LIBS)
111+ AC_SUBST(XML2_LDFLAGS)
112 ])