8000 Add ability to use libpng-config to get linker flags · matplotlib/matplotlib@04f13a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 04f13a4

Browse files
committed
Add ability to use libpng-config to get linker flags
1 parent 7d4ac9d commit 04f13a4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

setupext.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,10 +976,16 @@ class Png(SetupPackage):
976976
name = "png"
977977

978978
def check(self):
979+
status, output = getstatusoutput("libpng-config --version")
980+
if status == 0:
981+
version = output
982+
else:
983+
version = None
984+
979985
try:
980986
return self._check_for_pkg_config(
981987
'libpng', 'png.h',
982-
min_version='1.2')
988+
min_version='1.2', version=version)
983989
except CheckFailed as e:
984990
self.__class__.found_external = False
985991
return str(e) + ' Using unknown version.'
@@ -990,7 +996,8 @@ def get_extension(self):
990996
]
991997
ext = make_extension('matplotlib._png', sources)
992998
pkg_config.setup_extension(
993-
ext, 'libpng', default_libraries=['png', 'z'])
999+
ext, 'libpng', default_libraries=['png', 'z'],
1000+
alt_exec='libpng-config --ldflags')
9941001
Numpy().add_flags(ext)
9951002
CXX().add_flags(ext)
9961003
return ext

0 commit comments

Comments
 (0)
0