From bc529dd0c2632d45bf7b1e28cd7b0580a891ea02 Mon Sep 17 00:00:00 2001 From: Doug Kwan Date: Sun, 16 Feb 2014 22:54:45 +0100 Subject: [PATCH] ares_build.h: fix building on 64-bit powerpc There are two issues. 1. gcc actually does not use __ppc__ and __ppc64__ but __PPC__ and __PPC64__. The tests of __ILP32__ and __LP64__ are sufficient for gcc. 2. clang defines __GNU__ and defines both __ppc64__ and __ppc__ when targeting ppc64. This makes CARES_SIZEOF_LONG to be 4 on a ppc64 system when building with clang. My patch is two change the order of the checks so that we check the 64-bit case first. --- ares_build.h.dist | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ares_build.h.dist b/ares_build.h.dist index afcb75a..7d69f1e 100644 --- a/ares_build.h.dist +++ b/ares_build.h.dist @@ -216,12 +216,12 @@ /* ===================================== */ #elif defined(__GNUC__) -# if defined(__ILP32__) || \ - defined(__i386__) || defined(__ppc__) || defined(__arm__) -# define CARES_SIZEOF_LONG 4 -# elif defined(__LP64__) || \ +# if defined(__LP64__) || \ defined(__x86_64__) || defined(__ppc64__) # define CARES_SIZEOF_LONG 8 +# elif defined(__ILP32__) || \ + defined(__i386__) || defined(__ppc__) || defined(__arm__) +# define CARES_SIZEOF_LONG 4 # endif # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_SIZEOF_ARES_SOCKLEN_T 4