Skip to content

Commit 0241ad3

Browse files
author
Release Manager
committed
Trac #31365: Add NTL to cython_aliases and sage.misc.cython library search dirs
(from #31348) ... using `SAGE_NTL_PREFIX` via `sage_conf`. This is for macOS with configurations in which Python extensions no longer have access to `/usr/local` due to the use of `-isysroot` in the compiler configuration from sysconfig. In particular, we add handling for `ntl` to the `.homebrew-build-env` script -- so that after `brew install ntl; brew unlink ntl`, our `./configure` still finds NTL. URL: https://trac.sagemath.org/31365 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): Jonathan Kliem
2 parents 70cbb47 + dbcbf79 commit 0241ad3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+310
-80
lines changed

.homebrew-build-env

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export PKG_CONFIG_PATH
2323
LIBRARY_PATH="$HOMEBREW/lib$LIBRARY_PATH"
2424
[ -z "$CPATH" ] || CPATH=":${CPATH}"
2525
CPATH="$HOMEBREW/include$CPATH"
26-
for l in readline bzip2; do
26+
for l in readline bzip2 ntl; do
2727
if [ -d "$HOMEBREW/opt/$l/lib" ]; then
2828
LIBRARY_PATH="$HOMEBREW/opt/$l/lib:$LIBRARY_PATH"
2929
fi

build/pkgs/ntl/spkg-configure.m4

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ SAGE_SPKG_CONFIGURE([ntl], [
4949
AC_SUBST(SAGE_NTL_PREFIX, ['$SAGE_LOCAL'])
5050
else
5151
AC_SUBST(SAGE_NTL_PREFIX, [''])
52+
AX_ABSOLUTE_HEADER([NTL/ZZ.h])
53+
ntl_inc_ntl_dir=`AS_DIRNAME(["$gl_cv_absolute_NTL_ZZ_h"])`
54+
ntl_inc_dir=`AS_DIRNAME(["$ntl_inc_ntl_dir"])`
55+
ntl_prefix=`AS_DIRNAME(["$ntl_inc_dir"])`
56+
AC_SUBST(NTL_INCDIR, [$ntl_inc_dir])
57+
AC_SUBST(NTL_LIBDIR, [$ntl_prefix/lib])
5258
fi
5359
])
5460

build/pkgs/sage_conf/src/sage_conf.py.in

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ MAXIMA = "@prefix@/bin/maxima"
66

77
ARB_LIBRARY = "@SAGE_ARB_LIBRARY@"
88

9+
NTL_INCDIR = "@NTL_INCDIR@"
10+
NTL_LIBDIR = "@NTL_LIBDIR@"
11+
912
# Path to the ecl-config script
1013
# TODO: At the moment this is hard-coded, needs to be set during the configure phase if we want to support system-installed ecl.
1114
ECL_CONFIG = "@prefix@/bin/ecl-config"

src/sage/algebras/quatalg/quaternion_algebra_cython.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# distutils: language = c++
2-
# distutils: libraries = gmp m ntl
2+
# distutils: libraries = gmp m NTL_LIBRARIES
3+
# distutils: extra_compile_args = NTL_CFLAGS
4+
# distutils: include_dirs = NTL_INCDIR
5+
# distutils: library_dirs = NTL_LIBDIR
6+
# distutils: extra_link_args = NTL_LIBEXTRA
37
"""
48
Optimized Cython code needed by quaternion algebras
59

src/sage/algebras/quatalg/quaternion_algebra_element.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# distutils: language = c++
2-
# distutils: libraries = gmp m ntl
2+
# distutils: libraries = gmp m NTL_LIBRARIES
3+
# distutils: extra_compile_args = NTL_CFLAGS
4+
# distutils: include_dirs = NTL_INCDIR
5+
# distutils: library_dirs = NTL_LIBDIR
6+
# distutils: extra_link_args = NTL_LIBEXTRA
37
"""
48
Elements of Quaternion Algebras
59

src/sage/env.py

+9
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
211211
ARB_LIBRARY = var("ARB_LIBRARY", "arb")
212212
CBLAS_PC_MODULES = var("CBLAS_PC_MODULES", "cblas:openblas:blas")
213213
ECL_CONFIG = var("ECL_CONFIG", "ecl-config")
214+
NTL_INCDIR = var("NTL_INCDIR")
215+
NTL_LIBDIR = var("NTL_LIBDIR")
214216

215217
# misc
216218
SAGE_BANNER = var("SAGE_BANNER", "")
@@ -473,4 +475,11 @@ def uname_specific(name, value, alternative):
473475
aliases["ECL_LIBRARIES"] = list(map(lambda s: s[2:], filter(lambda s: s.startswith('-l'), ecl_libs)))
474476
aliases["ECL_LIBEXTRA"] = list(filter(lambda s: not s.startswith(('-l','-L')), ecl_libs))
475477

478+
# NTL
479+
aliases["NTL_CFLAGS"] = ['-std=c++11']
480+
aliases["NTL_INCDIR"] = [NTL_INCDIR] if NTL_INCDIR else []
481+
aliases["NTL_LIBDIR"] = [NTL_LIBDIR] if NTL_LIBDIR else []
482+
aliases["NTL_LIBRARIES"] = ['ntl']
483+
aliases["NTL_LIBEXTRA"] = []
484+
476485
return aliases

src/sage/libs/eclib/__init__.pxd

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# distutils: language = c++
2-
# distutils: libraries = ec ntl pari gmp m
2+
# distutils: libraries = ec NTL_LIBRARIES pari gmp m
3+
# distutils: extra_compile_args = NTL_CFLAGS
4+
# distutils: include_dirs = NTL_INCDIR
5+
# distutils: library_dirs = NTL_LIBDIR
6+
# distutils: extra_link_args = NTL_LIBEXTRA
37

48

59
from libcpp.map cimport map

src/sage/libs/lcalc/lcalc_Lfunction.pyx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# distutils: libraries = m ntl Lfunction
2-
# distutils: extra_compile_args = -O3 -ffast-math
1+
# distutils: libraries = m NTL_LIBRARIES Lfunction
2+
# distutils: extra_compile_args = NTL_CFLAGS -O3 -ffast-math
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
36
# distutils: language = c++
47
r"""
58
Rubinstein's lcalc library

src/sage/libs/ntl/convert.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# distutils: depends = NTL/ZZ.h
2-
# distutils: libraries = ntl gmp
2+
# distutils: libraries = NTL_LIBRARIES gmp
3+
# distutils: extra_compile_args = NTL_CFLAGS
4+
# distutils: include_dirs = NTL_INCDIR
5+
# distutils: library_dirs = NTL_LIBDIR
6+
# distutils: extra_link_args = NTL_LIBEXTRA
37
# distutils: language = c++
48

59
"""

src/sage/libs/ntl/error.pyx

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# distutils: libraries = ntl gmp
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: libraries = NTL_LIBRARIES
5+
# distutils: library_dirs = NTL_LIBDIR
6+
# distutils: extra_link_args = NTL_LIBEXTRA
27
# distutils: language = c++
38

49
"""

src/sage/libs/ntl/ntl_GF2.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp
1+
# distutils: libraries = NTL_LIBRARIES gmp
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_GF2E.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_GF2EContext.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_GF2EX.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_GF2X.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
# ****************************************************************************

src/sage/libs/ntl/ntl_ZZ.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_ZZX.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_ZZ_p.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_ZZ_pContext.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_ZZ_pE.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_ZZ_pEContext.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_ZZ_pEX.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
"""

src/sage/libs/ntl/ntl_ZZ_pX.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
# ****************************************************************************

src/sage/libs/ntl/ntl_lzz_p.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
"""

src/sage/libs/ntl/ntl_lzz_pContext.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_lzz_pX.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
"""

src/sage/libs/ntl/ntl_mat_GF2.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
"""

src/sage/libs/ntl/ntl_mat_GF2E.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/libs/ntl/ntl_mat_ZZ.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
# distutils: libraries = ntl gmp m
1+
# distutils: libraries = NTL_LIBRARIES gmp m
2+
# distutils: extra_compile_args = NTL_CFLAGS
3+
# distutils: include_dirs = NTL_INCDIR
4+
# distutils: library_dirs = NTL_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
26
# distutils: language = c++
37

48
#*****************************************************************************

src/sage/matrix/matrix_cyclo_dense.pyx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# distutils: language = c++
2-
# distutils: libraries = ntl
2+
# distutils: libraries = NTL_LIBRARIES
3+
# distutils: extra_compile_args = NTL_CFLAGS
4+
# distutils: include_dirs = NTL_INCDIR
5+
# distutils: library_dirs = NTL_LIBDIR
6+
# distutils: extra_link_args = NTL_LIBEXTRA
37
"""
48
Matrices over Cyclotomic Fields
59

src/sage/matrix/matrix_integer_dense.pyx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# -*- coding: utf-8 -*-
2-
# distutils: extra_compile_args = M4RI_CFLAGS
3-
# distutils: libraries = iml ntl gmp m CBLAS_LIBRARIES
4-
# distutils: library_dirs = CBLAS_LIBDIR
5-
# distutils: include_dirs = M4RI_INCDIR CBLAS_INCDIR
2+
# distutils: extra_compile_args = NTL_CFLAGS M4RI_CFLAGS
3+
# distutils: libraries = iml NTL_LIBRARIES gmp m CBLAS_LIBRARIES
4+
# distutils: library_dirs = NTL_LIBDIR CBLAS_LIBDIR
5+
# distutils: extra_link_args = NTL_LIBEXTRA
6+
# distutils: include_dirs = NTL_INCDIR M4RI_INCDIR CBLAS_INCDIR
67
"""
78
Dense matrices over the integer ring
89

src/sage/matrix/matrix_rational_dense.pyx

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# distutils: extra_compile_args = -D_XPG6 M4RI_CFLAGS
2-
# distutils: libraries = iml ntl m CBLAS_LIBRARIES
3-
# distutils: library_dirs = CBLAS_LIBDIR
4-
# distutils: include_dirs = M4RI_INCDIR CBLAS_INCDIR
5-
1+
# distutils: extra_compile_args = -D_XPG6 NTL_CFLAGS M4RI_CFLAGS
2+
# distutils: extra_link_args = NTL_LIBEXTRA
3+
# distutils: libraries = iml NTL_LIBRARIES m CBLAS_LIBRARIES
4+
# distutils: library_dirs = NTL_LIBDIR CBLAS_LIBDIR
5+
# distutils: include_dirs = NTL_INCDIR M4RI_INCDIR CBLAS_INCDIR
6+
# distutils: language = c++
67
"""
78
Dense matrices over the rational field
89

0 commit comments

Comments
 (0)