Skip to content

Commit 05042c5

Browse files
committed
Merge pull request #3278 from milljm/libpng-config
BLD : Use libpng-config if available
2 parents 1cadc90 + 04f13a4 commit 05042c5

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
@@ -1003,10 +1003,16 @@ class Png(SetupPackage):
10031003
name = "png"
10041004

10051005
def check(self):
1006+
status, output = getstatusoutput("libpng-config --version")
1007+
if status == 0:
1008+
version = output
1009+
else:
1010+
version = None
1011+
10061012
try:
10071013
return self._check_for_pkg_config(
10081014
'libpng', 'png.h',
1009-
min_version='1.2')
1015+
min_version='1.2', version=version)
10101016
except CheckFailed as e:
10111017
self.__class__.found_external = False
10121018
return str(e) + ' Using unknown version.'
@@ -1017,7 +1023,8 @@ def get_extension(self):
10171023
]
10181024
ext = make_extension('matplotlib._png', sources)
10191025
pkg_config.setup_extension(
1020-
ext, 'libpng', default_libraries=['png', 'z'])
1026+
ext, 'libpng', default_libraries=['png', 'z'],
1027+
alt_exec='libpng-config --ldflags')
10211028
Numpy().add_flags(ext)
10221029
CXX().add_flags(ext)
10231030
return ext

0 commit comments

Comments
 (0)