diff --git a/src/module_list.py b/src/module_list.py index 52b9ab11087..a5ee17623cf 100644 --- a/src/module_list.py +++ b/src/module_list.py @@ -116,14 +116,6 @@ ############################################################# from sage_setup.optional_extension import OptionalExtension -UNAME = os.uname() - -def uname_specific(name, value, alternative): - if name in UNAME[0]: - return value - else: - return alternative - ext_modules = [ @@ -501,10 +493,7 @@ def uname_specific(name, value, alternative): language = 'c++'), Extension('sage.libs.libecm', - sources = ['sage/libs/libecm.pyx'], - libraries = ['ecm'], - extra_link_args = uname_specific("Linux", ["-Wl,-z,noexecstack"], - [])), + sources = ['sage/libs/libecm.pyx']), Extension('sage.libs.lrcalc.lrcalc', sources = ["sage/libs/lrcalc/lrcalc.pyx"]), diff --git a/src/sage/env.py b/src/sage/env.py index 8cd7981ea88..85d558333ac 100644 --- a/src/sage/env.py +++ b/src/sage/env.py @@ -412,6 +412,18 @@ def cython_aliases(): aliases[var + "LIBEXTRA"] = list(filter(lambda s: not s.startswith(('-l','-L')), libs.split())) aliases[var + "LIBRARIES"] = pc['libraries'] + # uname-specific flags + UNAME = os.uname() + + def uname_specific(name, value, alternative): + if name in UNAME[0]: + return value + else: + return alternative + + aliases["LINUX_NOEXECSTACK"] = uname_specific("Linux", ["-Wl,-z,noexecstack"], + []) + # LinBox needs special care because it actually requires C++11 with # GNU extensions: -std=c++11 does not work, you need -std=gnu++11 # (this is true at least with GCC 7.2.0). diff --git a/src/sage/libs/libecm.pyx b/src/sage/libs/libecm.pyx index 41a788aca3f..1deacb45b39 100644 --- a/src/sage/libs/libecm.pyx +++ b/src/sage/libs/libecm.pyx @@ -1,3 +1,5 @@ +# distutils: libraries = ecm +# distutils: extra_link_args = LINUX_NOEXECSTACK r""" The Elliptic Curve Method for Integer Factorization (ECM)