From 800c9333b2c29c59cb85a91ebba43e644c721c83 Mon Sep 17 00:00:00 2001 From: mattip Date: Wed, 24 Aug 2022 00:17:46 +0300 Subject: [PATCH] MAINT: fix defines for universal2 python builds of NumPy --- numpy/core/include/numpy/numpyconfig.h | 8 ++++++++ numpy/core/setup.py | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/numpy/core/include/numpy/numpyconfig.h b/numpy/core/include/numpy/numpyconfig.h index 6be87b77425d..164fcbdbe668 100644 --- a/numpy/core/include/numpy/numpyconfig.h +++ b/numpy/core/include/numpy/numpyconfig.h @@ -22,13 +22,21 @@ #undef NPY_SIZEOF_LONGDOUBLE #undef NPY_SIZEOF_COMPLEX_LONGDOUBLE + #ifdef HAVE_LDOUBLE_IEEE_DOUBLE_LE + #undef HAVE_LDOUBLE_IEEE_DOUBLE_LE + #endif + #ifdef HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE + #undef HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE + #endif #if defined(__arm64__) #define NPY_SIZEOF_LONGDOUBLE 8 #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 16 + #define HAVE_LDOUBLE_IEEE_DOUBLE_LE 1 #elif defined(__x86_64) #define NPY_SIZEOF_LONGDOUBLE 16 #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 32 + #define HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE 1 #elif defined (__i386) #define NPY_SIZEOF_LONGDOUBLE 12 #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 24 diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 65aacfdadadb..fc09dba8b5f4 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -530,6 +530,10 @@ def generate_config_h(ext, build_dir): # Generate the config.h file from moredefs with open(target, 'w') as target_f: + if sys.platform == 'darwin': + target_f.write( + "/* may be overridden by numpyconfig.h on darwin */\n" + ) for d in moredefs: if isinstance(d, str): target_f.write('#define %s\n' % (d))