summaryrefslogtreecommitdiff
path: root/net-libs/loudmouth/files/loudmouth-1.4.3-asyncns-system.patch
blob: 9cf5345e558da4b68f35517b0aa95601da4838aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
diff --git a/configure.ac b/configure.ac
index 9369e55..17a9e1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -199,19 +199,31 @@ AM_CONDITIONAL(USE_GNUTLS, test x$enable_ssl = xGnuTLS)
 dnl +-------------------------------------------------------------------+
 dnl | Checking for libasyncns                                           |
 dnl +-------------------------------------------------------------------+
-AC_ARG_WITH(asyncns, [  --with-asyncns=yes/no  define whether to use libasyncns, default=no],
-            ac_asyncns=$withval,
-            ac_asyncns=no
-            )
+AC_ARG_WITH(asyncns,
+	AS_HELP_STRING([--with-asyncns],
+		[define whether to use libasyncns, @<:@default=no@:>@ (internal/system/no)]),
+	ac_asyncns=$withval,
+	ac_asyncns=no)
 
 enable_asyncns=no
+have_asyncns_system=no
 if test x$ac_asyncns != xno; then
 	enable_asyncns=yes
 	AC_DEFINE(HAVE_ASYNCNS, 1, [Whether to use libasyncns])
+
+	if test x$ac_asyncns = xsystem; then
+		PKG_CHECK_MODULES(ASYNCNS, [libasyncns >= 0.3],
+			[have_asyncns_system=yes],
+			[have_asyncns_system=no])
+	fi
 else
 	echo "Not using asynchronous dns lookups"
 fi
 
+AC_SUBST(ASYNCNS_CFLAGS)
+AC_SUBST(ASYNCNS_LIBS)
+AM_CONDITIONAL(USE_SYSTEM_ASYNCNS, test x$have_asyncns_system = xyes)
+
 dnl +-------------------------------------------------------------------+
 dnl | Checking for Linux TCP/IP stack                                   |
 dnl +-------------------------------------------------------------------+
diff --git a/loudmouth/Makefile.am b/loudmouth/Makefile.am
index f73aa0c..e308e1c 100644
--- a/loudmouth/Makefile.am
+++ b/loudmouth/Makefile.am
@@ -6,6 +6,7 @@ AM_CPPFLAGS = 				    \
 	-I.				    \
 	-I$(top_srcdir)			    \
 	$(LOUDMOUTH_CFLAGS)		    \
+	$(ASYNCNS_CFLAGS)                   \
 	$(LIBIDN_CFLAGS)		    \
 	-DLM_COMPILATION	  	    \
 	-DRUNTIME_ENDIAN                    \
@@ -51,8 +52,6 @@ libloudmouth_1_la_SOURCES =		\
 	lm-sock.c			\
 	lm-socket.c                     \
 	lm-socket.h                     \
-	asyncns.c     \
-	asyncns.h     \
 	lm-sasl.c                       \
 	lm-sasl.h                       \
 	md5.c                           \
@@ -61,6 +60,13 @@ libloudmouth_1_la_SOURCES =		\
 	base64.h                        \
 	$(NULL)
 
+if ! USE_SYSTEM_ASYNCNS
+libloudmouth_1_la_SOURCES += \
+	asyncns.c     \
+	asyncns.h     \
+	$(NULL)
+endif
+
 libloudmouthinclude_HEADERS =		\
 	lm-connection.h			\
 	lm-error.h			\
@@ -75,6 +81,7 @@ libloudmouthinclude_HEADERS =		\
 
 libloudmouth_1_la_LIBADD = 		\
 	$(LOUDMOUTH_LIBS)		\
+	$(ASYNCNS_LIBS)			\
 	$(LIBIDN_LIBS) \
 	-lresolv