Hi

NetBSD now ships popcount in libc, which does the same job as the gcc builtin that rxvt likes to use. This causes a header conflict as rxvt likes to alias this builtin to popcount.

Attached is a patch that checks for popcount in libc and uses that by preference.

Thanks!

Roy
--- configure.ac        2008-01-28 11:48:32.000000000 +0000
+++ configure.ac        2009-09-03 17:57:28.000000000 +0100
@@ -82,6 +82,9 @@
 AC_CHECK_FUNC(gethostbyname, [], [AC_CHECK_LIB(nsl,    gethostbyname, 
[LIBS="$LIBS -lnsl"])])
 AC_CHECK_FUNC(socket,        [], [AC_CHECK_LIB(socket, socket,        
[LIBS="$LIBS -lsocket"])])

+# NetBSD libc has a popcount function
+AC_CHECK_FUNCS([popcount])
+
 support_frills=yes
 support_inheritpixmap=yes
 support_fading=yes
--- src/rxvtdaemon.C    2008-02-19 12:17:46.000000000 +0000
+++ src/rxvtdaemon.C    2009-09-03 17:57:27.000000000 +0100
@@ -31,6 +31,7 @@
 #include <sys/utsname.h>
 #include <limits.h>
 
+#include "../config.h"
 #include "rxvtdaemon.h"
 
 char *rxvt_connection::unix_sockname ()
--- src/rxvtutil.C      2008-02-19 12:17:46.000000000 +0000
+++ src/rxvtutil.C      2009-09-03 17:57:27.000000000 +0100
@@ -24,6 +24,7 @@
 #include <cstring>
 #include <inttypes.h>
 
+#include "../config.h"
 #include "rxvtutil.h"
 
 class byteorder byteorder;
--- src/rxvtutil.h      2008-11-05 14:43:24.000000000 +0000
+++ src/rxvtutil.h      2009-09-03 17:57:27.000000000 +0100
@@ -94,12 +94,16 @@
 // some bit functions, xft fuck me plenty
 #if HAVE_GCC_BUILTINS
 static inline int ctz      (unsigned int x) { return __builtin_ctz      (x); }
+#if !HAVE_POPCOUNT
 static inline int popcount (unsigned int x) { return __builtin_popcount (x); }
+#endif
 #else
 // count trailing zero bits and count # of one bits
 int ctz      (unsigned int x) CONST;
+#if !HAVE_POPCOUNT
 int popcount (unsigned int x) CONST;
 #endif
+#endif
 
 // in range including end
 #define IN_RANGE_INC(val,beg,end) \
--- configure   2009-09-03 18:06:08.000000000 +0100
+++ configure   2009-09-03 18:06:19.000000000 +0100
@@ -4316,6 +4316,17 @@
 
 fi
 
+for ac_func in popcount
+do :
+  ac_fn_cxx_check_func "$LINENO" "popcount" "ac_cv_func_popcount"
+if test "x$ac_cv_func_popcount" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_POPCOUNT 1
+_ACEOF
+
+fi
+done
+
 
 support_frills=yes
 support_inheritpixmap=yes
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to