Pull in a patch from the openbabel source repo to remove

the unconditional use of __builtin_popcount if using GCC.
Eliminates the need for a newer GCC version.

ok ajacoutot@
This commit is contained in:
brad 2008-09-01 08:51:03 +00:00
parent 253896ad83
commit e2b3c7c7cf
3 changed files with 38 additions and 9 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.5 2008/08/20 16:08:11 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.6 2008/09/01 08:51:03 brad Exp $
COMMENT= chemistry file translation program
V= 2.2.0
DISTNAME= openbabel-${V}
PKGNAME= ${DISTNAME}p0
CATEGORIES= misc
SHARED_LIBS+= openbabel 4.0 # .3.0
@ -20,26 +21,22 @@ PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=openbabel/}
WANTLIB= c iconv m z
# needs the __builtin_popcount built-in function (gcc>=3.4)
MODULES+= gcc4
MODGCC4_LANGS= c++
MODGCC4_ARCHES= *
WANTLIB= c iconv m stdc++ z
SUBST_VARS= V
BUILD_DEPENDS= ::devel/boost
LIB_DEPENDS= xml2.>=9::textproc/libxml
REGRESS_DEPENDS=::misc/openbabel
USE_LIBTOOL= Yes
CONFIGURE_STYLE=gnu
CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib" \
ac_cv_path_DOXYGEN=""
CONFIGURE_ARGS= ${CONFIGURE_SHARED} \
--disable-inchi \
--disable-wx-gui
--disable-wx-gui \
--with-boost=${LOCALBASE}
.include <bsd.port.mk>

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-include_openbabel_fingerprint_h,v 1.1 2008/09/01 08:51:03 brad Exp $
--- include/openbabel/fingerprint.h.orig Sun Aug 31 22:58:48 2008
+++ include/openbabel/fingerprint.h Sun Aug 31 23:01:45 2008
@@ -90,7 +90,11 @@ const char* TypeID() (public)
int andfp = vec1[i] & p2[i];
int orfp = vec1[i] | p2[i];
// Count bits
-#ifdef __GNUC__
+ /* GCC 3.4 supports a "population count" builtin, which on many targets is
+ implemented with a single instruction. There is a fallback definition
+ in libgcc in case a target does not have one, which should be just as
+ good as the static function below. */
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
andbits += __builtin_popcount(andfp);
orbits += __builtin_popcount(orfp);
#else

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_fingerprint_cpp,v 1.1 2008/09/01 08:51:03 brad Exp $
--- src/fingerprint.cpp.orig Sun Aug 31 22:57:28 2008
+++ src/fingerprint.cpp Sun Aug 31 22:58:30 2008
@@ -100,7 +100,11 @@ namespace OpenBabel
int andfp = vec1[i] & vec2[i];
int orfp = vec1[i] | vec2[i];
//Count bits
-#ifdef __GNUC__
+ /* GCC 3.4 supports a "population count" builtin, which on many targets is
+ implemented with a single instruction. There is a fallback definition
+ in libgcc in case a target does not have one, which should be just as
+ good as the static function below. */
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
andbits += __builtin_popcount(andfp);
orbits += __builtin_popcount(orfp);
#else