Files @ 44f93efce74c
Branch filter:

Location: ohnobinki_overlay/net-irc/unrealircd/files/unrealircd-system-cares.patch

binki
Add ~x86 for my lappy.
(Portage version: 2.2_rc67-r4/hg/Linux x86_64)
(Signed Manifest commit)
Makes unrealircd-3.2.8 able to use a vanilla, system >=net-dns/c-ares-1.5.3
Expects the unrealircd-system-tre.patch to be applied beforehand
--- autoconf/configure.in	2009-03-29 18:35:15.000000000 -0400
+++ autoconf/configure.in	2009-03-29 18:45:54.000000000 -0400
@@ -393,6 +393,7 @@
 AC_ARG_WITH(operoverride-verify, [AC_HELP_STRING([--with-operoverride-verify], [Require opers to invite themselves to +s/+p channels])],
 	AC_DEFINE(OPEROVERRIDE_VERIFY))
 AC_ARG_WITH(system-tre, [AC_HELP_STRING([--with-system-tre], [Use the system tre package instead of bundled, discovered using pkg-config])], [], [with_system_tre=no ])
+AC_ARG_WITH(system-cares, [AC_HELP_STRING([--with-system-cares], [Use the system c-ares (at least version 1.5.3) package instead of bundled c-ares, discovered using pkg-config])], [], [with_system_cares=no ])
 CHECK_SSL
 CHECK_ZLIB
 CHECK_LIBCURL
@@ -462,6 +463,7 @@
 PKG_CHECK_MODULES([TRE], tre >= 0.7.5)
 ])
 
+AS_IF([test "x$with_system_cares" = "xno"],[
 dnl REMEMBER TO CHANGE WITH A NEW C-ARES RELEASE!
 cares_version="1.6.0"
 AC_MSG_RESULT(extracting c-ares resolver library)
@@ -484,10 +486,9 @@
 $ac_cv_prog_MAKER || exit 1
 AC_MSG_RESULT(installing c-ares resolver library)
 $ac_cv_prog_MAKER install || exit 1
-CARESINCDIR="$cur_dir/extras/c-ares/include"
-AC_SUBST(CARESINCDIR)
-CARESLIBDIR="-L../extras/c-ares/lib"
-AC_SUBST(CARESLIBDIR)
+CARES_CFLAGS="$cur_dir/extras/c-ares/include"
+AC_SUBST(CARES_CFLAGS)
+CARES_LIBS="-L../extras/c-ares/lib"

 dnl Set default library parameters for when pkg-config is not available
 CARESLIBSALT="-lcares"
@@ -504,15 +505,20 @@
 dnl from above. Also, if pkg-config returns an empty result (ex: on fbsd
 dnl or older versions it might be missing --static) then also use defaults.
 if test "x$ac_cv_path_PKGCONFIG" = "x" ; then
-	CARESLIBS="$CARESLIBSALT"
+	CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
 else
-	CARESLIBS="`$ac_cv_path_PKGCONFIG --static --libs libcares.pc`"
-	if test "x$CARESLIBS" = "x" ; then
-		CARESLIBS="$CARESLIBSALT"
+	CARES_LIBSPRE="$CARES_LIBS"
+	CARES_LIBS="$CARES_LIBS `$ac_cv_path_PKGCONFIG --static --libs libcares.pc`"
+	if test "$CARES_LIBS" = "$CARES_LIBSPRE " ; then
+		CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
 	fi
 fi
-AC_SUBST(CARESLIBS)
+AC_SUBST(CARES_LIBS)
 cd $cur_dir
+],[
+dnl use pkg-config for system c-ares:
+PKG_CHECK_MODULES([CARES], libcares >= 1.5.3)
+])
 
 
 AC_OUTPUT(Makefile src/modules/Makefile unreal ircdcron/ircdchk)


--- Makefile.in	2009-03-29 18:35:15.000000000 -0400
+++ Makefile.in	2009-03-29 18:48:03.000000000 -0400
@@ -34,11 +34,11 @@
 #
 
 #XCFLAGS=-O -g -export-dynamic
-IRCDLIBS=@IRCDLIBS@ @TRE_LIBS@ @CARESLIBS@
+IRCDLIBS=@IRCDLIBS@ @TRE_LIBS@ @CARES_LIBS@
 CRYPTOLIB=@CRYPTOLIB@
 OPENSSLINCLUDES=
 
-XCFLAGS=@TRE_CFLAGS@ -I@CARESINCDIR@ @CARESLIBDIR@ @CFLAGS@
+XCFLAGS=@TRE_CFLAGS@ -I@CARES_CFLAGS@ @CFLAGS@
 #
 # use the following on MIPS:
 #CFLAGS= -systype bsd43 -DSYSTYPE_BSD43 -I$(INCLUDEDIR)

--- src/res.c	(revision 333)
+++ src/res.c	(working copy)
@@ -49,7 +49,7 @@
 #include <res.h>
 
 /* Prevent crashes due to invalid prototype/ABI */
-#if ARES_VERSION < 0x010600
+#if ARES_VERSION < 0x010503
  #error "You have an old c-ares version on your system and/or Unreals c-ares failed to compile!"
 #endif

@@ -736,21 +736,35 @@
 	} else
 	if (*param == 'i') /* INFORMATION */
 	{
-		struct ares_config_info inf;
+		struct ares_options inf;
 		int i;
+		int optmask;
 		
-		ares_get_config(&inf, resolver_channel);
+		ares_save_options(resolver_channel, &inf, &optmask);
 
 		sendtxtnumeric(sptr, "****** DNS Configuration Information ******");
 		sendtxtnumeric(sptr, " c-ares version: %s",ares_version(NULL));
-		sendtxtnumeric(sptr, "        timeout: %d", inf.timeout);
-		sendtxtnumeric(sptr, "          tries: %d", inf.tries);
-		sendtxtnumeric(sptr, "   # of servers: %d", inf.numservers);
-		for (i = 0; i < inf.numservers; i++)
-			sendtxtnumeric(sptr, "      server #%d: %s", i+1, inf.servers[i] ? inf.servers[i] : "[???]");
-			
+
+		if(optmask & ARES_OPT_TIMEOUTMS)
+			sendtxtnumeric(sptr, "        timeout: %d", inf.timeout);
+		if(optmask & ARES_OPT_TRIES)
+			sendtxtnumeric(sptr, "          tries: %d", inf.tries);
+		if(optmask & ARES_OPT_SERVERS)
+		{
+			sendtxtnumeric(sptr, "   # of servers: %d", inf.nservers);
+			for (i = 0; i < inf.nservers; i++)
+				sendtxtnumeric(sptr, "      server #%d: %s", i+1, inet_ntoa(inf.servers[i]));	
+		}
+		if(optmask & ARES_OPT_DOMAINS)
+		{
+			sendtxtnumeric(sptr, "   # of search domains: %d", inf.ndomains);
+			for (i = 0; i < inf.ndomains; i++)
+				sendtxtnumeric(sptr, "      domain #%d: %s", i+1, inf.domains[i]);
+		}
 		/* TODO: free or get memleak ! */
 		sendtxtnumeric(sptr, "****** End of DNS Configuration Info ******");
+		
+		ares_destroy_options(&inf);
 	} else /* STATISTICS */
 	{
 		sendtxtnumeric(sptr, "DNS CACHE Stats:");