diff --git a/.gitignore b/.gitignore index 4c4c039e..1639dd47 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ stamp-h1 /ltmain.sh /libtool /test-driver +/g6k.egg-info/ diff --git a/kernel/g6k_config.h.in b/kernel/g6k_config.h.in index a015e31f..bb94da9a 100644 --- a/kernel/g6k_config.h.in +++ b/kernel/g6k_config.h.in @@ -88,9 +88,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 to support Multimedia Extensions */ #undef HAVE_MMX @@ -136,6 +133,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -191,7 +191,9 @@ your system. */ #undef PTHREAD_CREATE_JOINABLE -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* enable templated dimensions */ diff --git a/setup.py b/setup.py index 09d24c4d..89c6d4de 100755 --- a/setup.py +++ b/setup.py @@ -39,12 +39,23 @@ # `setup,py` consumes files output by `configure` so we insist on running it first. # +if "CONDA_PREFIX" in os.environ: + prefix = os.environ["CONDA_PREFIX"] +elif "VIRTUAL_ENV" in os.environ: + prefix = os.environ["VIRTUAL_ENV"] +elif "LD_LIBRARY_PATH" in os.environ and os.environ["LD_LIBRARY_PATH"].endswith("/lib"): + prefix = os.environ["LD_LIBRARY_PATH"][:-4] +else: + prefix = None + if not os.path.exists("configure"): subprocess.check_call(["autoreconf", "-i"]) if not os.path.exists("Makefile"): - subprocess.check_call("./configure") - + if prefix: + subprocess.check_call(["./configure", f"--prefix={prefix}"]) + else: + subprocess.check_call("./configure") # # But we only run `make` as part of `build_ext` @@ -83,6 +94,8 @@ def read_from(filename, field, sep): # extra_compile_args += ["-DCYTHON_TRACE=1"] # there's so many warnings generated here, we need to filter out -Werror extra_compile_args += [opt for opt in read_from("g6k.pc", "Cflags", ": ") if opt != "-Werror"] +if prefix: + extra_compile_args += [f"-L{prefix}/lib"] kwds = { "language": "c++", @@ -96,6 +109,10 @@ def read_from(filename, field, sep): "include_dirs": [numpy.get_include()], } +if prefix: + kwds["library_dirs"] = [f"{prefix}/lib"] + + extensions = [ Extension("g6k.siever", ["g6k/siever.pyx"], **kwds), Extension("g6k.siever_params", ["g6k/siever_params.pyx"], **kwds),