Patch autoconf, not configure to pass the correct optflags

- Run autoreconf before configure
- git rm obsolete patches
This commit is contained in:
Jakub Hrozek 2013-04-11 17:41:52 +02:00
parent 3c1ab0a7ec
commit 68e2f2a3ed
10 changed files with 107 additions and 399 deletions

View File

@ -1,28 +0,0 @@
From 293cd3170019015b6ce40f9fa5efc45bd89dad1a Mon Sep 17 00:00:00 2001
From: Ben Greear <greearb@candelatech.com>
Date: Tue, 24 Aug 2010 16:48:47 -0700
Subject: [PATCH] Add missing break that caused get_ares_servers to fail.
Reported-by: Ning Dong <flintning@163.com>
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
ares_data.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ares_data.c b/ares_data.c
index 6b6fae8..a2477be 100644
--- a/ares_data.c
+++ b/ares_data.c
@@ -145,7 +145,8 @@ void *ares_malloc_data(ares_datatype type)
ptr->data.addr_node.next = NULL;
ptr->data.addr_node.family = 0;
memset(&ptr->data.addr_node.addrV6, 0,
- sizeof(ptr->data.addr_node.addrV6));
+ sizeof(ptr->data.addr_node.addrV6));
+ break;
default:
free(ptr);
--
1.7.2.1

View File

@ -1,86 +0,0 @@
From 07bc7ea79509bcc9ef6e09151e81766ed00d3392 Mon Sep 17 00:00:00 2001
From: Ben Greear <greearb@candelatech.com>
Date: Sat, 31 Jul 2010 07:10:23 -0700
Subject: [PATCH] Fix aliasing warning in gcc 4.4.4 (at least).
Should be no functional change, though the code gets a bit
ugglier.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
ares_process.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/ares_process.c b/ares_process.c
index c3d7fa4..320dd5e 100644
--- a/ares_process.c
+++ b/ares_process.c
@@ -434,11 +434,15 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
unsigned char buf[PACKETSZ + 1];
#ifdef HAVE_RECVFROM
ares_socklen_t fromlen;
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+ struct sockaddr_storage from;
+#else
union {
struct sockaddr_in sa4;
struct sockaddr_in6 sa6;
} from;
#endif
+#endif
if(!read_fds && (read_fd == ARES_SOCKET_BAD))
/* no possible action */
@@ -473,10 +477,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
* packets as we can. */
do {
#ifdef HAVE_RECVFROM
- if (server->addr.family == AF_INET)
- fromlen = sizeof(from.sa4);
- else
- fromlen = sizeof(from.sa6);
+ fromlen = sizeof(from); /* doesn't matter if it's larger than needed */
count = (ssize_t)recvfrom(server->udp_socket, (void *)buf, sizeof(buf),
0, (struct sockaddr *)&from, &fromlen);
#else
@@ -487,7 +488,15 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
else if (count <= 0)
handle_error(channel, i, now);
#ifdef HAVE_RECVFROM
- else if (!same_address((struct sockaddr *)&from, &server->addr))
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+ /* This family hack works around compiler warnings about
+ * aliases.
+ */
+ else if (!((from.ss_family == server->addr.family) &&
+ same_address((struct sockaddr *)&from, &server->addr)))
+#else
+ else if (!same_address((struct sockaddr *)&from, &server->addr)))
+#endif
/* The address the response comes from does not match
* the address we sent the request to. Someone may be
* attempting to perform a cache poisoning attack. */
@@ -1177,8 +1186,10 @@ static int same_address(struct sockaddr *sa, struct ares_addr *aa)
void *addr1;
void *addr2;
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
if (sa->sa_family == aa->family)
{
+#endif
switch (aa->family)
{
case AF_INET:
@@ -1196,7 +1207,9 @@ static int same_address(struct sockaddr *sa, struct ares_addr *aa)
default:
break;
}
+#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
}
+#endif
return 0; /* different */
}
--
1.7.2.1

View File

@ -0,0 +1,41 @@
From 7dada62a77e061c752123e672e844386ff3b01ea Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Wed, 10 Apr 2013 12:32:44 -0400
Subject: [PATCH] Use RPM compiler options
---
m4/cares-compilers.m4 | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/m4/cares-compilers.m4 b/m4/cares-compilers.m4
index 7ee8e0dbe741c1a64149a0d20b826f507b3ec620..d7708230fb5628ae80fbf1052da0d2c78ebbc160 100644
--- a/m4/cares-compilers.m4
+++ b/m4/cares-compilers.m4
@@ -143,19 +143,12 @@ AC_DEFUN([CARES_CHECK_COMPILER_GNU_C], [
gccvhi=`echo $gccver | cut -d . -f1`
gccvlo=`echo $gccver | cut -d . -f2`
compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
- flags_dbg_all="-g -g0 -g1 -g2 -g3"
- flags_dbg_all="$flags_dbg_all -ggdb"
- flags_dbg_all="$flags_dbg_all -gstabs"
- flags_dbg_all="$flags_dbg_all -gstabs+"
- flags_dbg_all="$flags_dbg_all -gcoff"
- flags_dbg_all="$flags_dbg_all -gxcoff"
- flags_dbg_all="$flags_dbg_all -gdwarf-2"
- flags_dbg_all="$flags_dbg_all -gvms"
- flags_dbg_yes="-g"
- flags_dbg_off="-g0"
- flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
- flags_opt_yes="-O2"
- flags_opt_off="-O0"
+ flags_dbg_all=""
+ flags_dbg_yes=""
+ flags_dbg_off=""
+ flags_opt_all=""
+ flags_opt_yes=""
+ flags_opt_off=""
CURL_CHECK_DEF([_WIN32], [], [silent])
else
AC_MSG_RESULT([no])
--
1.8.1.4

View File

@ -1,67 +0,0 @@
From 125b1a8619eb27556e093fd9c9adf451e896f012 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek@redhat.com>
Date: Mon, 31 May 2010 16:32:54 +0200
Subject: [PATCH] ares_init: Last, not first instance of domain or search should win
diff --git a/ares_init.3 b/ares_init.3
index 00ff36d..fb25306 100644
--- a/ares_init.3
+++ b/ares_init.3
@@ -109,7 +109,7 @@ or the domain derived from the kernel hostname variable.
.B ARES_OPT_LOOKUPS
.B char *\fIlookups\fP;
.br
-The lookups to perform for host queries.
+The lookups to perform for host queries.
.I lookups
should be set to a string of the characters "b" or "f", where "b"
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
@@ -189,6 +189,27 @@ The process's available memory was exhausted.
.TP 14
.B ARES_ENOTINITIALIZED
c-ares library initialization not yet performed.
+.SH NOTES
+When initializing from
+.B /etc/resolv.conf,
+.BR ares_init (3)
+reads the
+.I domain
+and
+.I search
+directives to allow lookups of short names relative to the domains
+specified. The
+.I domain
+and
+.I search
+directives override one another. If more that one instance of either
+.I domain
+or
+.I search
+directives is specified, the last occurence wins. For more information,
+please see the
+.BR resolv.conf (5)
+manual page.
.SH SEE ALSO
.BR ares_destroy(3),
.BR ares_dup(3),
diff --git a/ares_init.c b/ares_init.c
index 1f561aa..9d1e447 100644
--- a/ares_init.c
+++ b/ares_init.c
@@ -839,11 +839,11 @@ DhcpNameServer
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
- if ((p = try_config(line, "domain")) && channel->ndomains == -1)
+ if ((p = try_config(line, "domain")))
status = config_domain(channel, p);
else if ((p = try_config(line, "lookup")) && !channel->lookups)
status = config_lookup(channel, p, "bind", "file");
- else if ((p = try_config(line, "search")) && channel->ndomains == -1)
+ else if ((p = try_config(line, "search")))
status = set_search(channel, p);
else if ((p = try_config(line, "nameserver")) && channel->nservers == -1)
status = config_nameserver(&servers, &nservers, p);
--
1.6.6.1

View File

@ -1,32 +0,0 @@
From d6b869894190e15960987786d337dc8d42f8285b Mon Sep 17 00:00:00 2001
From: Andrew C. Morrow <andrew.c.morrow@gmail.com>
Date: Wed, 16 Jun 2010 10:18:24 +0800
Subject: [PATCH] fix memory leak in ares_getnameinfo
---
ares_getnameinfo.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c
index fc4b7fa..8ae2f02 100644
--- a/ares_getnameinfo.c
+++ b/ares_getnameinfo.c
@@ -243,6 +243,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts,
(char *)(host->h_name),
service);
+ free(niquery);
return;
}
/* We couldn't find the host, but it's OK, we can use the IP */
@@ -273,6 +274,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
}
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf,
service);
+ free(niquery);
return;
}
niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL);
--
1.7.2.1

View File

@ -0,0 +1,49 @@
From 70ac469a0c138eff5c0678fcb753d56710f589ec Mon Sep 17 00:00:00 2001
From: Yang Tse <yangsita@gmail.com>
Date: Tue, 1 Jan 2013 18:21:34 +0100
Subject: [PATCH] cares-override.m4: provide AC_CONFIG_MACRO_DIR definition
conditionally
Provide a 'traceable' AC_CONFIG_MACRO_DIR definition only when using
an autoconf version that does not provide it, instead of what we were
doing up to now of providing and overriding AC_CONFIG_MACRO_DIR for
all autoconf versions.
---
m4/cares-override.m4 | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/m4/cares-override.m4 b/m4/cares-override.m4
index afd7aeedf3db9da6fda6da1a95e2cc019c0184e6..72f486e8e0e3f0b1feb3ae6a1aa8929026d2056d 100644
--- a/m4/cares-override.m4
+++ b/m4/cares-override.m4
@@ -2,7 +2,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 5
+# serial 6
dnl CARES_OVERRIDE_AUTOCONF
dnl -------------------------------------------------
@@ -89,12 +89,12 @@ m4_defun([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
[CARES_CHECK_PATH_SEPARATOR
m4_define([$0],[])])
-dnl Override Autoconf's AC_CONFIG_MACRO_DIR (DIR)
+dnl Provide Autoconf's AC_CONFIG_MACRO_DIR (DIR)
dnl -------------------------------------------------
-dnl This is an emulation of Autoconf's 2.61 macro.
-dnl This is done to use fixed macro across Autoconf
-dnl versions, and avoid warnings from modern libtool
-dnl which traces usage of this macro.
+dnl Allow usage of mentioned macro in configure.ac
+dnl even with ancient Autoconf versions, such as 2.57,
+dnl that do not provide a definition for this macro.
-AC_DEFUN([AC_CONFIG_MACRO_DIR],[:])
+m4_ifndef([AC_CONFIG_MACRO_DIR],
+[AC_DEFUN([AC_CONFIG_MACRO_DIR],[:])])
--
1.8.1.4

View File

@ -1,87 +0,0 @@
diff -up ./configure.optflags ./configure
--- ./configure.optflags 2011-08-17 08:17:31.000000000 +0200
+++ ./configure 2011-08-17 08:24:33.000000000 +0200
@@ -14925,7 +14925,7 @@ $as_echo "$as_me: WARNING: compiler opti
ac_var_stripped=""
for word1 in $tmp_CFLAGS; do
ac_var_strip_word="no"
- for word2 in $flags_dbg_all; do
+ for word2 in ""; do
if test "$word1" = "$word2"; then
ac_var_strip_word="yes"
fi
@@ -14941,7 +14941,7 @@ $as_echo "$as_me: WARNING: compiler opti
ac_var_stripped=""
for word1 in $tmp_CPPFLAGS; do
ac_var_strip_word="no"
- for word2 in $flags_dbg_all; do
+ for word2 in ""; do
if test "$word1" = "$word2"; then
ac_var_strip_word="yes"
fi
@@ -14957,12 +14957,12 @@ $as_echo "$as_me: WARNING: compiler opti
if test "$want_debug" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug enabling options" >&5
$as_echo_n "checking if compiler accepts debug enabling options... " >&6; }
- tmp_options="$flags_dbg_yes"
+ tmp_options=""
fi
if test "$want_debug" = "no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts debug disabling options" >&5
$as_echo_n "checking if compiler accepts debug disabling options... " >&6; }
- tmp_options="$flags_dbg_off"
+ tmp_options=""
fi
#
if test "$flags_prefer_cppflags" = "yes"; then
@@ -15123,7 +15123,7 @@ $as_echo_n "checking if compiler optimiz
ac_var_match_word="no"
for word1 in $tmp_CFLAGS; do
- for word2 in $flags_opt_all; do
+ for word2 in ""; do
if test "$word1" = "$word2"; then
ac_var_match_word="yes"
fi
@@ -15141,7 +15141,7 @@ $as_echo_n "checking if compiler optimiz
ac_var_match_word="no"
for word1 in $tmp_CPPFLAGS; do
- for word2 in $flags_opt_all; do
+ for word2 in ""; do
if test "$word1" = "$word2"; then
ac_var_match_word="yes"
fi
@@ -15172,7 +15172,7 @@ $as_echo "$honor_optimize_option" >&6; }
ac_var_stripped=""
for word1 in $tmp_CFLAGS; do
ac_var_strip_word="no"
- for word2 in $flags_opt_all; do
+ for word2 in ""; do
if test "$word1" = "$word2"; then
ac_var_strip_word="yes"
fi
@@ -15188,7 +15188,7 @@ $as_echo "$honor_optimize_option" >&6; }
ac_var_stripped=""
for word1 in $tmp_CPPFLAGS; do
ac_var_strip_word="no"
- for word2 in $flags_opt_all; do
+ for word2 in ""; do
if test "$word1" = "$word2"; then
ac_var_strip_word="yes"
fi
@@ -15203,12 +15203,12 @@ $as_echo "$honor_optimize_option" >&6; }
if test "$want_optimize" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer enabling options" >&5
$as_echo_n "checking if compiler accepts optimizer enabling options... " >&6; }
- tmp_options="$flags_opt_yes"
+ tmp_options=""
fi
if test "$want_optimize" = "no"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts optimizer disabling options" >&5
$as_echo_n "checking if compiler accepts optimizer disabling options... " >&6; }
- tmp_options="$flags_opt_off"
+ tmp_options=""
fi
if test "$flags_prefer_cppflags" = "yes"; then
CPPFLAGS="$tmp_CPPFLAGS $tmp_options"

View File

@ -1,41 +0,0 @@
diff -up ./ares_build.h.in.multilib ./ares_build.h.in
--- ./ares_build.h.in.multilib 2010-03-23 13:41:44.000000000 +0100
+++ ./ares_build.h.in 2010-06-15 10:38:15.804618311 +0200
@@ -96,9 +96,6 @@
# include <sys/socket.h>
#endif
-/* The size of `long', as computed by sizeof. */
-#undef CARES_SIZEOF_LONG
-
/* Integral data type used for ares_socklen_t. */
#undef CARES_TYPEOF_ARES_SOCKLEN_T
diff -up ./ares_rules.h.multilib ./ares_rules.h
--- ./ares_rules.h.multilib 2010-06-15 10:39:22.895368907 +0200
+++ ./ares_rules.h 2010-06-15 10:40:19.271619152 +0200
@@ -69,10 +69,12 @@
* Verify that some macros are actually defined.
*/
+#if 0
#ifndef CARES_SIZEOF_LONG
# error "CARES_SIZEOF_LONG definition is missing!"
Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing
#endif
+#endif
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
@@ -97,9 +99,11 @@
* is the same as the one reported by sizeof() at compile time.
*/
+#if 0
typedef char
__cares_rule_01__
[CareschkszEQ(long, CARES_SIZEOF_LONG)];
+#endif
/*
* Verify that the size previously defined and expected for

View File

@ -1,18 +1,23 @@
Summary: A library that performs asynchronous DNS operations
Name: c-ares
Version: 1.9.1
Release: 4%{?dist}
Release: 5%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://c-ares.haxx.se/
Source0: http://c-ares.haxx.se/download/%{name}-%{version}.tar.gz
# The license can be obtained at http://c-ares.haxx.se/license.html
Source1: LICENSE
Patch0: %{name}-1.7.5-optflags.patch
Patch0: 0001-Use-RPM-compiler-options.patch
Patch1: c-ares-1.8.0-multilib.patch
Patch2: 0002-cares-override.m4-provide-AC_CONFIG_MACRO_DIR-defini.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
%description
c-ares is a C library that performs DNS requests and name resolves
asynchronously. c-ares is a fork of the library named 'ares', written
@ -32,10 +37,13 @@ compile applications or shared objects that use c-ares.
%setup -q
%patch0 -p1 -b .optflags
%patch1 -p0 -b .multilib
%patch2 -p1 -b .override
cp %{SOURCE1} .
f=CHANGES ; iconv -f iso-8859-1 -t utf-8 $f -o $f.utf8 ; mv $f.utf8 $f
%build
autoreconf -if
%configure --enable-shared --disable-static \
--disable-dependency-tracking
%{__make} %{?_smp_mflags}
@ -68,6 +76,13 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/ares_*
%changelog
* Thu Apr 11 2013 Jakub Hrozek <jhrozek@redhat.com> - 1.9.1-4
- Apply a patch by Stephen Gallagher to patch autoconf, not configure to
allow optflags to be passed in by build environment
- Run autoreconf before configure
- git rm obsolete patches
- Apply upstream patch to stop overriding AC_CONFIG_MACRO_DIR
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

View File

@ -1,56 +0,0 @@
From 2d5ed6400ba430f412ebc9748eb847771907776d Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Sat, 18 Dec 2010 22:20:16 +0100
Subject: [PATCH] cleanup: avoid unsafe typecasts
Avoid the risk of reading 16bit data from an unaligned address by using
a macro that is adapted for this.
---
ares_parse_mx_reply.c | 4 ++--
ares_parse_srv_reply.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/ares_parse_mx_reply.c b/ares_parse_mx_reply.c
index 186ddd3..2180054 100644
--- a/ares_parse_mx_reply.c
+++ b/ares_parse_mx_reply.c
@@ -47,7 +47,7 @@
int
ares_parse_mx_reply (const unsigned char *abuf, int alen,
- struct ares_mx_reply **mx_out)
+ struct ares_mx_reply **mx_out)
{
unsigned int qdcount, ancount, i;
const unsigned char *aptr, *vptr;
@@ -134,7 +134,7 @@ ares_parse_mx_reply (const unsigned char *abuf, int alen,
mx_last = mx_curr;
vptr = aptr;
- mx_curr->priority = ntohs (*((unsigned short *)vptr));
+ mx_curr->priority = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
status = ares_expand_name (vptr, abuf, alen, &mx_curr->host, &len);
diff --git a/ares_parse_srv_reply.c b/ares_parse_srv_reply.c
index 7d443b3..9c7eb6e 100644
--- a/ares_parse_srv_reply.c
+++ b/ares_parse_srv_reply.c
@@ -139,11 +139,11 @@ ares_parse_srv_reply (const unsigned char *abuf, int alen,
srv_last = srv_curr;
vptr = aptr;
- srv_curr->priority = ntohs (*((unsigned short *)vptr));
+ srv_curr->priority = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
- srv_curr->weight = ntohs (*((unsigned short *)vptr));
+ srv_curr->weight = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
- srv_curr->port = ntohs (*((unsigned short *)vptr));
+ srv_curr->port = DNS__16BIT(vptr);
vptr += sizeof(unsigned short);
status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len);
--
1.7.4.2