forked from onecoolx/picasso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
313 lines (258 loc) · 9.06 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(picasso, 2.5, [email protected])
VERSION_MAJOR=2
VERSION_MINOR=5
VERSION_MICRO=0
VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_MICRO
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_MICRO)
AC_SUBST(VERSION)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, $VERSION)
AC_CONFIG_MACRO_DIR(m4)
AC_CONFIG_HEADER(pconfig.h)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_PREFIX_DEFAULT(/usr/local)
# User define macro.
build_freetype2="yes"
build_fontconfig="yes"
build_fastcopy="yes"
build_sysmalloc="no"
build_lowmem="no"
build_coverage="no"
format_rgba="yes"
format_argb="yes"
format_abgr="yes"
format_bgra="yes"
format_rgb="yes"
format_bgr="yes"
format_rgb565="yes"
format_rgb555="yes"
build_image="yes"
build_gif_support="yes"
build_jpg_support="yes"
build_png_support="yes"
build_webp_support="yes"
build_gles2_backend="yes"
# Check user define macro.
AC_ARG_ENABLE(freetype2,
[ --enable-freetype2 Build FreeType2 support <default=yes>],
build_freetype2=$enableval)
AC_ARG_ENABLE(fontconfig,
[ --enable-fontconfig Build FontConfig support <default=yes>],
build_fontconfig=$enableval)
AC_ARG_ENABLE(lowmem,
[ --enable-lowmem Build Low Memory used support <default=no>],
build_lowmem=$enableval)
AC_ARG_ENABLE(fastcopy,
[ --enable-fastcopy Build Fast Memory Copy used support <default=yes>],
build_fastcopy=$enableval)
AC_ARG_ENABLE(coverage,
[ --enable-coverage Build Code coverage test <default=no>],
build_coverage=$enableval)
AC_ARG_ENABLE(sysmalloc,
[ --enable-sysmalloc Build System Memory Allocator
(new/delete/malloc/free/realloc/calloc) used support <default=no>],
build_sysmalloc=$enableval)
AC_ARG_ENABLE(rgba,
[ --enable-rgba Pixel format RGBA support <default=yes>],
format_rgba=$enableval)
AC_ARG_ENABLE(argb,
[ --enable-argb Pixel format ARGB support <default=yes>],
format_argb=$enableval)
AC_ARG_ENABLE(abgr,
[ --enable-abgr Pixel format ABGR support <default=yes>],
format_abgr=$enableval)
AC_ARG_ENABLE(bgra,
[ --enable-bgra Pixel format BGRA support <default=yes>],
format_bgra=$enableval)
AC_ARG_ENABLE(rgb,
[ --enable-rgb Pixel format RGB support <default=yes>],
format_rgb=$enableval)
AC_ARG_ENABLE(bgr,
[ --enable-bgr Pixel format BGR support <default=yes>],
format_bgr=$enableval)
AC_ARG_ENABLE(rgb565,
[ --enable-rgb565 Pixel format RGB565 support <default=yes>],
format_rgb565=$enableval)
AC_ARG_ENABLE(rgb555,
[ --enable-rgb555 Pixel format RGB555 support <default=yes>],
format_rgb555=$enableval)
AC_ARG_ENABLE(image,
[ --enable-image Image encoder and decoder support <default=yes>],
build_image=$enableval)
AC_ARG_ENABLE(gif,
[ --enable-gif Gif Image support <default=yes>],
build_gif_support=$enableval)
AC_ARG_ENABLE(png,
[ --enable-png Png Image support <default=yes>],
build_png_support=$enableval)
AC_ARG_ENABLE(jpg,
[ --enable-jpg Jpeg Image support <default=yes>],
build_jpg_support=$enableval)
AC_ARG_ENABLE(webp,
[ --enable-webp WebP Image support <default=yes>],
build_webp_support=$enableval)
AC_ARG_ENABLE(gles2,
[ --enable-gles2 OpenGL ES 2.0 Backend support <default=yes>],
build_gles2_backend=$enableval)
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(memory.h stddef.h stdlib.h string.h)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS(floor memmove memset pow sqrt strncpy strncasecmp)
# Checks for User define macro.
have_freetype2="no"
if test "x$build_freetype2" = "xyes"; then
AC_CHECK_LIB(freetype, FT_New_Face, [
CFLAGS="$CFLAGS `pkg-config freetype2 --cflags`"
CPPFLAGS="$CPPFLAGS `pkg-config freetype2 --cflags`"
CXXFLAGS="$CXXFLAGS `pkg-config freetype2 --cflags`"
LIBS="$LIBS `pkg-config freetype2 --libs`"
AC_CHECK_HEADERS(ft2build.h, [
have_freetype2="yes"
AC_DEFINE(ENABLE_FREE_TYPE2, 1, [Define if FreeType2 is supported.])
])
])
if test "x$have_freetype2" = "xno"; then
AC_MSG_ERROR([freetype2 headers and/or libs where not found, install them or build with --disable-freetype2 on Windows])
fi
else
LIBS="$LIBS -lgdi32"
fi
if test "x$build_fontconfig" = "xyes"; then
AC_CHECK_LIB(fontconfig, FcInit, [
CFLAGS="$CFLAGS `pkg-config fontconfig --cflags`"
CPPFLAGS="$CPPFLAGS `pkg-config fontconfig --cflags`"
CXXFLAGS="$CXXFLAGS `pkg-config fontconfig --cflags`"
LIBS="$LIBS `pkg-config fontconfig --libs`"
AC_CHECK_HEADERS(fontconfig/fontconfig.h, [
AC_DEFINE(ENABLE_FONT_CONFIG, 1, [Define if FontConfig is supported.])
])
])
fi
if test "x$build_gles2_backend" = "xyes"; then
AC_CHECK_LIB(GLESv2, glGetString, [
LIBS="$LIBS -lGLESv2"
AC_CHECK_HEADERS(GLES2/gl2.h, [
AC_DEFINE(ENABLE_GLES2_SUPPORT, 1, [Define if gles 2.0 backend is supported.])
])
])
fi
if test "x$build_lowmem" = "xyes"; then
AC_DEFINE(ENABLE_LOW_MEMORY, 1, [Define if Low memory is supported.])
fi
if test "x$build_fastcopy" = "xyes"; then
AC_DEFINE(ENABLE_FAST_COPY, 1, [Define if Fast memory copy is supported.])
fi
if test "x$build_sysmalloc" = "xyes"; then
AC_DEFINE(ENABLE_SYSTEM_MALLOC, 1, [Define if System memory allocator is supported.])
fi
if test "x$format_rgba" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_RGBA, 1, [Define if RGBA color format is supported.])
fi
if test "x$format_argb" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_ARGB, 1, [Define if ARGB color format is supported.])
fi
if test "x$format_abgr" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_ABGR, 1, [Define if ABGR color format is supported.])
fi
if test "x$format_bgra" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_BGRA, 1, [Define if BGRA color format is supported.])
fi
if test "x$format_rgb" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_RGB, 1, [Define if RGB color format is supported.])
fi
if test "x$format_bgr" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_BGR, 1, [Define if BGR color format is supported.])
fi
if test "x$format_rgb565" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_RGB565, 1, [Define if RGB565 color format is supported.])
fi
if test "x$format_rgb555" = "xyes"; then
AC_DEFINE(ENABLE_FORMAT_RGB555, 1, [Define if RGB555 color format is supported.])
fi
if test "x$build_image" = "xyes"; then
if test "x$build_gif_support" = "xyes"; then
build_gif_support="no"
AC_CHECK_LIB(gif, DGifOpenFileName, [
AC_CHECK_HEADERS(gif_lib.h, [
build_gif_support="yes"
])
])
if test "x$build_gif_support" = "xno"; then
AC_MSG_WARN([giflib headers and/or libs where not found, gif support disabled!])
fi
fi
if test "x$build_png_support" = "xyes"; then
build_png_support="no"
AC_CHECK_LIB(png, png_get_copyright, [
AC_CHECK_HEADERS(png.h, [
build_png_support="yes"
])
])
if test "x$build_png_support" = "xno"; then
AC_MSG_WARN([libpng headers and/or libs where not found, png support disabled!])
fi
fi
if test "x$build_jpg_support" = "xyes"; then
build_jpg_support="no"
AC_CHECK_LIB(jpeg, jpeg_read_header, [
AC_CHECK_HEADERS(jpeglib.h, [
build_jpg_support="yes"
])
])
if test "x$build_jpg_support" = "xno"; then
AC_MSG_WARN([libjpeg headers and/or libs where not found, jpg support disabled!])
fi
fi
if test "x$build_webp_support" = "xyes"; then
build_webp_support="no"
AC_CHECK_LIB(webp, WebPGetDecoderVersion, [
AC_CHECK_HEADERS(webp/decode.h, [
build_webp_support="yes"
])
])
if test "x$build_webp_support" = "xno"; then
AC_MSG_WARN([libwebp headers and/or libs where not found, webp support disabled!])
fi
fi
fi
if test "x$build_coverage" = "xyes"; then
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
fi
AM_CONDITIONAL(PSX_IMAGE_SUPPORT, test "x$build_image" = "xyes")
AM_CONDITIONAL(PSX_IMAGE_GIF_SUPPORT, test "x$build_gif_support" = "xyes")
AM_CONDITIONAL(PSX_IMAGE_PNG_SUPPORT, test "x$build_png_support" = "xyes")
AM_CONDITIONAL(PSX_IMAGE_JPG_SUPPORT, test "x$build_jpg_support" = "xyes")
AM_CONDITIONAL(PSX_IMAGE_WEBP_SUPPORT, test "x$build_webp_support" = "xyes")
CFLAGS="$CFLAGS -Wall -DDLL_EXPORT=1 -DEXPORT=1 -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -Wall -fno-rtti -fno-exceptions -DDLL_EXPORT=1 -DEXPORT=1 -fvisibility=hidden -fvisibility-inlines-hidden"
AC_OUTPUT(
Makefile
include/Makefile
src/Makefile
ext/Makefile
ext/image_loader/Makefile
ext/image_loader/png/Makefile
ext/image_loader/jpeg/Makefile
ext/image_loader/gif/Makefile
ext/image_loader/webp/Makefile
test/Makefile
demos/Makefile
)