8000 Properly hide __has_include to support C++<17 compilers. · matplotlib/matplotlib@dea5106 · GitHub
[go: up one dir, main page]

Skip to content

Commit dea5106

Browse files
committed
Properly hide __has_include to support C++<17 compilers.
1 parent 765d452 commit dea5106

File tree

2 files changed

+26
-30
lines changed

2 files changed

+26
-30
lines changed

src/checkdep_freetype2.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
#if defined __has_include && ! __has_include(<ft2build.h>)
2-
3-
#error "FreeType version 2.3 or higher is required. \
4-
You may set the MPLLOCALFREETYPE environment variable to 1 to let \
5-
Matplotlib download it."
6-
7-
#else
8-
9-
#include <ft2build.h>
10-
#include FT_FREETYPE_H
11-
12-
#define XSTR(x) STR(x)
13-
#define STR(x) #x
14-
15-
#pragma message(&qu 8000 ot;Compiling with FreeType version " \
16-
XSTR(FREETYPE_MAJOR) "." XSTR(FREETYPE_MINOR) "." XSTR(FREETYPE_PATCH) ".")
17-
#if FREETYPE_MAJOR << 16 + FREETYPE_MINOR << 8 + FREETYPE_PATCH < 0x020300
1+
#ifdef __has_include
2+
#if !__has_include(<ft2build.h>)
183
#error "FreeType version 2.3 or higher is required. \
19-
You may set the MPLLOCALFREETYPE environment variable to 1 to let \
20-
Matplotlib download it."
4+
You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib \
5+
download it."
216
#endif
7+
#endif
8+
9+
#include <ft2build.h>
10+
#include FT_FREETYPE_H
2211

12+
#define XSTR(x) STR(x)
13+
#define STR(x) #x
14+
15+
#pragma message("Compiling with FreeType version " \
16+
XSTR(FREETYPE_MAJOR) "." XSTR(FREETYPE_MINOR) "." XSTR(FREETYPE_PATCH) ".")
17+
#if FREETYPE_MAJOR << 16 + FREETYPE_MINOR << 8 + FREETYPE_PATCH < 0x020300
18+
#error "FreeType version 2.3 or higher is required. \
19+
You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib \
20+
download it."
2321
#endif

src/checkdep_libpng.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
#if defined __has_include && ! __has_include(<png.h>)
2-
3-
#error "libpng version 1.2 or higher is required. \
1+
#ifdef __has_include
2+
#if !__has_include(<png.h>)
3+
#error "libpng version 1.2 or higher is required. \
44
Consider installing it with e.g. 'conda install libpng', \
55
'apt install libpng12-dev', 'dnf install libpng-devel', or \
66
'brew install libpng'."
7+
#endif
8+
#endif
79

8-
#else
9-
10-
#include <png.h>
11-
#pragma message("Compiling with libpng version " PNG_LIBPNG_VER_STRING ".")
12-
#if PNG_LIBPNG_VER < 10200
13-
#error "libpng version 1.2 or higher is required. \
10+
#include <png.h>
11+
#pragma message("Compiling with libpng version " PNG_LIBPNG_VER_STRING ".")
12+
#if PNG_LIBPNG_VER < 10200
13+
#error "libpng version 1.2 or higher is required. \
1414
Consider installing it with e.g. 'conda install libpng', \
1515
'apt install libpng12-dev', 'dnf install libpng-devel', or \
1616
'brew install libpng'."
17-
#endif
18-
1917
#endif

0 commit comments

Comments
 (0)
0