respect CFLAGS/LDFLAGS when searching for headers/libs

This commit is contained in:
Domen Kožar 2013-10-07 21:43:39 +02:00
parent 34944bf533
commit 9b6af55702

View File

@ -214,6 +214,14 @@ class pil_build_ext(build_ext):
_add_directory(library_dirs, "/usr/local/lib") _add_directory(library_dirs, "/usr/local/lib")
# FIXME: check /opt/stuff directories here? # FIXME: check /opt/stuff directories here?
# respect CFLAGS/LDFLAGS
for k in 'CFLAGS LDFLAGS'.split():
if k in os.environ:
for match in re.finditer(r'-I([^\s]+)', os.environ[k]):
_add_directory(include_dirs, match.group(1))
for match in re.finditer(r'-L([^\s]+)', os.environ[k]):
_add_directory(library_dirs, match.group(1))
# include, rpath, if set as environment variables: # include, rpath, if set as environment variables:
for k in 'C_INCLUDE_PATH INCLUDE'.split(): for k in 'C_INCLUDE_PATH INCLUDE'.split():
if k in os.environ: if k in os.environ: