summaryrefslogtreecommitdiff
path: root/math/fftw
diff options
context:
space:
mode:
authorthor <thor@pkgsrc.org>2021-04-30 23:31:08 +0000
committerthor <thor@pkgsrc.org>2021-04-30 23:31:08 +0000
commit1d464d985fda9c25378f38e15c18df304f3402b3 (patch)
tree21dc76ab225c73e8c0e6c0929ab7eeb7405835d1 /math/fftw
parent140417162f22ad99732924af2706e3cc6f31a0d8 (diff)
downloadpkgsrc-1d464d985fda9c25378f38e15c18df304f3402b3.tar.gz
math/fftw: fix up SIMD choice and conflict with user CFLAGS
This also requires gcc 4.8 at minimum, 4.9 for the full set of SIMD. The configure script is patched to avoid the build adding -march=core-avx2, which could conflict with user's CFLAGS.
Diffstat (limited to 'math/fftw')
-rw-r--r--math/fftw/Makefile29
1 files changed, 21 insertions, 8 deletions
diff --git a/math/fftw/Makefile b/math/fftw/Makefile
index 6adb0d9d18c..0ecaceb8fa8 100644
--- a/math/fftw/Makefile
+++ b/math/fftw/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.65 2021/04/30 20:51:06 thor Exp $
+# $NetBSD: Makefile,v 1.66 2021/04/30 23:31:08 thor Exp $
PKGREVISION= 5
@@ -35,9 +35,7 @@ FFTW_PRECISION= double float
.include "options.mk"
# Test will only use the default build.
-.if defined(PKGSRC_RUN_TEST) && !empty(PKGSRC_RUN_TEST:M[Yy][Ee][Ss])
-USE_TOOLS+= perl:test
-.endif
+USE_TOOLS+= perl:test sed
PLIST_VARS+= pthreads
PTHREAD_OPTS= native
@@ -53,6 +51,9 @@ CONFIGURE_DIRS+= build/${p}
MAKE_DIRS+= build/${p}
.endfor
+# SIMD stuff needs some baseline.
+GCC_REQD+= 4.8
+
# FFTW offers SIMD runtime detection, but wants explicit build options.
# These should be generic for all platforms. Compiler needs intrinsics
# for this, but those have been present for quite some time.
@@ -60,12 +61,24 @@ FFTW_FLOAT_OPTS= --enable-generic-simd128 --enable-generic-simd256
FFTW_DOUBLE_OPTS= --enable-generic-simd128 --enable-generic-simd256
.if ${MACHINE_ARCH} == "x86_64"
-FFTW_FLOAT_OPTS+= --enable-sse --enable-sse2 --enable-avx --enable-avx2
-FFTW_FLOAT_OPTS+= --enable-avx512 --enable-avx-128-fma
-FFTW_DOUBLE_OPTS+= --enable-sse2 --enable-avx --enable-avx2
-FFTW_DOUBLE_OPTS+= --enable-avx512 --enable-avx-128-fma
+FFTW_FLOAT_OPTS+= --enable-sse --enable-sse2 --enable-avx
+FFTW_DOUBLE_OPTS+= --enable-sse2 --enable-avx
+# From gcc-4.9 on, these should work trouble-free.
+.if empty(${CC_VERSION:Mgcc-4.8.*})
+FFTW_FLOAT_OPTS+= --enable-avx2 --enable-avx512 --enable-avx-128-fma
+FFTW_DOUBLE_OPTS+= --enable-avx2 --enable-avx512 --enable-avx-128-fma
+.endif
.endif
+# TODO: Add the above for other architectures.
+
+# Avoid -march=core-avx2 messing up with user CFLAGS.
+# This rules out gcc 4.8 for AVX2 builds.
+SUBST_CLASSES+= hardcore
+SUBST_STAGE.hardcore= pre-configure
+SUBST_FILES.hardcore= configure configure.ac
+SUBST_SED.hardcore= -e "s,march=core-avx2,march=donotbother,g"
+
pre-configure:
.for d in ${CONFIGURE_DIRS}
mkdir -p ${WRKSRC:Q}/${d}