blob: 31d7252dc67721f7ca0ce51fb92f86fc577fe678 [file] [log] [blame]
Andrew Geisslerd1d22e62020-10-16 10:14:32 -05001Configure does not work with OE pkg-config for the ldns option
2
3Upstream-Status: OE specific
4
5Signed-off-by: Armin Kuster <akuster808@gmail.com>
6
Andrew Geissler8b139282021-03-05 15:22:30 -06007Index: opendnssec-2.1.8/configure.ac
Andrew Geisslerd1d22e62020-10-16 10:14:32 -05008===================================================================
Andrew Geissler8b139282021-03-05 15:22:30 -06009--- opendnssec-2.1.8.orig/configure.ac
10+++ opendnssec-2.1.8/configure.ac
11@@ -133,9 +133,7 @@ AC_CHECK_MEMBER([struct sockaddr_un.sun_
12
13 # common dependencies
14 ACX_LIBXML2
15-ACX_LDNS(1,6,17)
16-ACX_LDNS_NOT(1,6,14, [binary incompatibility, see http://open.nlnetlabs.nl/pipermail/ldns-users/2012-October/000564.html])
17-ACX_LDNS_NOT(1,6,15, [fail to create NSEC3 bitmap for empty non-terminals, see http://www.nlnetlabs.nl/pipermail/ldns-users/2012-November/000565.html])
18+ACX_LDNS(1.6.17)
19 ACX_PKCS11_MODULES
20 ACX_RT
21 ACX_LIBC
22Index: opendnssec-2.1.8/m4/acx_ldns.m4
23===================================================================
24--- opendnssec-2.1.8.orig/m4/acx_ldns.m4
25+++ opendnssec-2.1.8/m4/acx_ldns.m4
26@@ -1,128 +1,63 @@
Andrew Geisslerd1d22e62020-10-16 10:14:32 -050027-AC_DEFUN([ACX_LDNS],[
28- AC_ARG_WITH(ldns,
Andrew Geissler8b139282021-03-05 15:22:30 -060029- [AS_HELP_STRING([--with-ldns=PATH],[specify prefix of path of ldns library to use])],
Andrew Geisslerd1d22e62020-10-16 10:14:32 -050030- [
31- LDNS_PATH="$withval"
32- AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $LDNS_PATH/bin)
33- ],[
34- LDNS_PATH="/usr/local"
35- AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $PATH)
36- ])
37-
38- if test -x "$LDNS_CONFIG"
39- then
40- AC_MSG_CHECKING(what are the ldns includes)
41- LDNS_INCLUDES="`$LDNS_CONFIG --cflags`"
42- AC_MSG_RESULT($LDNS_INCLUDES)
43-
44- AC_MSG_CHECKING(what are the ldns libs)
45- LDNS_LIBS="`$LDNS_CONFIG --libs`"
46- AC_MSG_RESULT($LDNS_LIBS)
47- else
48- AC_MSG_CHECKING(what are the ldns includes)
49- LDNS_INCLUDES="-I$LDNS_PATH/include"
50- AC_MSG_RESULT($LDNS_INCLUDES)
51-
52- AC_MSG_CHECKING(what are the ldns libs)
53- LDNS_LIBS="-L$LDNS_PATH/lib -lldns"
54- AC_MSG_RESULT($LDNS_LIBS)
55- fi
56-
57- tmp_CPPFLAGS=$CPPFLAGS
58- tmp_LIBS=$LIBS
59-
60- CPPFLAGS="$CPPFLAGS $LDNS_INCLUDES"
61- LIBS="$LIBS $LDNS_LIBS"
62-
63- AC_CHECK_LIB(ldns, ldns_rr_new,,[AC_MSG_ERROR([Can't find ldns library])])
64- LIBS=$tmp_LIBS
65-
66- AC_MSG_CHECKING([for ldns version])
67- CHECK_LDNS_VERSION=m4_format(0x%02x%02x%02x, $1, $2, $3)
68- AC_LANG_PUSH([C])
69- AC_RUN_IFELSE([
70- AC_LANG_SOURCE([[
71- #include <ldns/ldns.h>
72- int main()
73- {
74- #ifdef LDNS_REVISION
75- if (LDNS_REVISION >= $CHECK_LDNS_VERSION)
76- return 0;
77- #endif
78- return 1;
79- }
80- ]])
81- ],[
82- AC_MSG_RESULT([>= $1.$2.$3])
83- ],[
84- AC_MSG_RESULT([< $1.$2.$3])
85- AC_MSG_ERROR([ldns library too old ($1.$2.$3 or later required)])
86- ],[])
87- AC_LANG_POP([C])
Andrew Geissler8b139282021-03-05 15:22:30 -060088-
Andrew Geisslerd1d22e62020-10-16 10:14:32 -050089- CPPFLAGS=$tmp_CPPFLAGS
90-
91- AC_SUBST(LDNS_INCLUDES)
92- AC_SUBST(LDNS_LIBS)
93-])
94-
95-
96-AC_DEFUN([ACX_LDNS_NOT],[
97- AC_ARG_WITH(ldns,
Andrew Geissler8b139282021-03-05 15:22:30 -060098- [AS_HELP_STRING([--with-ldns=PATH],[specify prefix of path of ldns library to use])],
Andrew Geisslerd1d22e62020-10-16 10:14:32 -050099- [
100- LDNS_PATH="$withval"
101- AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $LDNS_PATH/bin)
102- ],[
103- LDNS_PATH="/usr/local"
104- AC_PATH_PROGS(LDNS_CONFIG, ldns-config, ldns-config, $PATH)
105- ])
106-
107- if test -x "$LDNS_CONFIG"
108- then
109- AC_MSG_CHECKING(what are the ldns includes)
110- LDNS_INCLUDES="`$LDNS_CONFIG --cflags`"
111- AC_MSG_RESULT($LDNS_INCLUDES)
112-
113- AC_MSG_CHECKING(what are the ldns libs)
114- LDNS_LIBS="`$LDNS_CONFIG --libs`"
115- AC_MSG_RESULT($LDNS_LIBS)
116- else
117- AC_MSG_CHECKING(what are the ldns includes)
118- LDNS_INCLUDES="-I$LDNS_PATH/include"
119- AC_MSG_RESULT($LDNS_INCLUDES)
120-
121- AC_MSG_CHECKING(what are the ldns libs)
122- LDNS_LIBS="-L$LDNS_PATH/lib -lldns"
123- AC_MSG_RESULT($LDNS_LIBS)
124- fi
125-
126- tmp_CPPFLAGS=$CPPFLAGS
127-
128- CPPFLAGS="$CPPFLAGS $LDNS_INCLUDES"
129-
130- AC_MSG_CHECKING([for ldns version not $1.$2.$3])
131- CHECK_LDNS_VERSION=m4_format(0x%02x%02x%02x, $1, $2, $3)
132- AC_LANG_PUSH([C])
133- AC_RUN_IFELSE([
134- AC_LANG_SOURCE([[
135- #include <ldns/ldns.h>
136- int main()
137- {
138- #ifdef LDNS_REVISION
139- if (LDNS_REVISION != $CHECK_LDNS_VERSION)
140- return 0;
141- #endif
142- return 1;
143- }
144- ]])
145- ],[
146- AC_MSG_RESULT([ok])
147- ],[
148- AC_MSG_RESULT([no])
149- AC_MSG_ERROR([ldns version $1.$2.$3 is not compatible due to $4])
150- ],[])
151- AC_LANG_POP([C])
152-
153- CPPFLAGS=$tmp_CPPFLAGS
154+AU_ALIAS([CHECK_LDNS], [ACX_LDNS])
155+AC_DEFUN([ACX_LDNS], [
156+ found=false
157+ AC_ARG_WITH([ldns],
158+ [AS_HELP_STRING([--with-ldns=DIR],
159+ [root of the lnds directory])],
160+ [
161+ case "$withval" in
162+ "" | y | ye | yes | n | no)
163+ AC_MSG_ERROR([Invalid --with-lnds value])
164+ ;;
165+ *) ldnsdirs="$withval"
166+ ;;
167+ esac
168+ ], [
169+ # if pkg-config is installed and lnds has installed a .pc file,
170+ # then use that information and don't search ldnsdirs
171+ AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
172+ if test x"$PKG_CONFIG" != x""; then
173+ OPENSSL_LDFLAGS=`$PKG_CONFIG ldns --libs-only-L 2>/dev/null`
174+ if test $? = 0; then
175+ LDNS_LIBS=`$PKG_CONFIG ldns --libs-only-l 2>/dev/null`
176+ LDNS_INCLUDES=`$PKG_CONFIG ldns --cflags-only-I 2>/dev/null`
177+ found=true
178+ fi
179+ fi
180+
181+ # no such luck; use some default ldnsdirs
182+ if ! $found; then
183+ ldnsdirs="/usr/local/ldns /usr/lib/ldns /usr/ldns /usr/local /usr"
184+ fi
185+ ]
186+ )
187+
188+
189+ if ! $found; then
190+ LDNS_INCLUDES=
191+ for ldnsdir in $ldnsdirs; do
192+ AC_MSG_CHECKING([for LDNS in $ldnsdir])
193+ if test -f "$ldnsdir/include/ldns/dnssec.h"; then
194+ LDNS_INCLUDES="-I$ldnsdir/include"
195+ LDNS_LDFLAGS="-L$ldnsdir/lib"
196+ LDNS_LIBS="-lldns"
197+ found=true
198+ AC_MSG_RESULT([yes])
199+ break
200+ else
201+ AC_MSG_RESULT([no])
202+ fi
203+ done
204+
205+ # if the file wasn't found, well, go ahead and try the link anyway -- maybe
206+ # it will just work!
207+ fi
208+
209+ LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
210+ LIBS="$LDNS_LIBS $LIBS"
211+ CPPFLAGS="$LDNS_INCLUDES $CPPFLAGS"
212+
213+ AC_SUBST([LDNS_INCLUDES])
214+ AC_SUBST([LDNS_LIBS])
215+ AC_SUBST([LDNS_LDFLAGS])
216 ])