Skip to content

Commit 6e7f26f

Browse files
committed
Merged revisions 8708 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v1_0_maint ........ r8708 | efiring | 2010-09-16 20:41:34 -1000 (Thu, 16 Sep 2010) | 2 lines including Python.h and png.h: a second try, special case for linux ........ svn path=/trunk/matplotlib/; revision=8709
1 parent fc0c773 commit 6e7f26f

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/_backend_agg.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
/* Python API mandates Python.h is included *first* */
55
#include "Python.h"
66

7-
#define PNG_SKIP_SETJMP_CHECK
8-
#include <png.h>
9-
107
#include "ft2font.h"
118
#include "_image.h"
129
#include "_backend_agg.h"

src/_png.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
2+
/* For linux, png.h must be imported before Python.h because
3+
png.h needs to be the one to define setjmp.
4+
Undefining _POSIX_C_SOURCE and _XOPEN_SOURCE stops a couple
5+
of harmless warnings.
6+
*/
7+
8+
#ifdef __linux__
9+
# include <png.h>
10+
# ifdef _POSIX_C_SOURCE
11+
# undef _POSIX_C_SOURCE
12+
# endif
13+
# ifdef _XOPEN_SOURCE
14+
# undef _XOPEN_SOURCE
15+
# endif
16+
# include "Python.h"
17+
#else
18+
119
/* Python API mandates Python.h is included *first* */
2-
#include "Python.h"
20+
# include "Python.h"
321

4-
#define PNG_SKIP_SETJMP_CHECK
5-
#include <png.h>
22+
# include <png.h>
23+
#endif
624

725
// TODO: Un CXX-ify this module
826
#include "CXX/Extensions.hxx"

0 commit comments

Comments
 (0)