forked from tqm-dev/ShaderVG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
313 lines (247 loc) · 8.05 KB
/
configure.ac
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
AC_INIT([ShaderVG],[1.0.0])
AC_CONFIG_HEADERS([config.h:config.h.in])
AM_INIT_AUTOMAKE([foreign])
# Checks for programs.
AC_CANONICAL_HOST
AG_GST_INIT
LT_INIT
# Checks for programs.
AC_PROG_CC
# Ensure that tests are run with the C compiler
#AC_LANG([CC])
# ==============================================
# Check examples selection
AC_ARG_WITH(
[example-all],
[ --with-example-all Initialize build values for all examples (default=yes)],
[build_test_all=$withval], [build_test_all="yes"])
AC_ARG_WITH(
[example-vgu],
[ --with-example-vgu Build VGU example (default=yes)],
[build_test_vgu=$withval], [build_test_vgu="$build_test_all"])
AC_ARG_WITH(
[example-dash],
[ --with-example-dash Build Dashing example (default=yes)],
[build_test_dash=$withval], [build_test_dash="$build_test_all"])
AC_ARG_WITH(
[example-linear],
[ --with-example-linear Build Linear Gradient example (default=yes)],
[build_test_linear=$withval], [build_test_linear="$build_test_all"])
AC_ARG_WITH(
[example-radial],
[ --with-example-radial Build Radial Gradient example (default=yes)],
[build_test_radial=$withval], [build_test_radial="$build_test_all"])
AC_ARG_WITH(
[example-interpolate],
[ --with-example-interpolate Build Path Interpolation example (default=yes)],
[build_test_interpolate=$withval], [build_test_interpolate="$build_test_all"])
AC_ARG_WITH(
[example-tiger],
[ --with-example-tiger Build Tiger SVG example (default=yes)],
[build_test_tiger=$withval], [build_test_tiger="$build_test_all"])
AC_ARG_WITH(
[example-image],
[ --with-example-image Build Images example (default=yes)],
[build_test_image=$withval], [build_test_image="$build_test_all"])
AC_ARG_WITH(
[example-pattern],
[ --with-example-pattern Build Pattern Paint example (default=yes)],
[build_test_pattern=$withval], [build_test_pattern="$build_test_all"])
AC_ARG_WITH(
[example-blend],
[ --with-example-blend Build Blending example (default=yes)],
[build_test_blend=$withval], [build_test_blend="$build_test_all"])
AC_ARG_WITH(
[example-tiger-shader],
[ --with-example-tiger-shader Build tiger shader example (default=yes)],
[build_test_tiger_shader=$withval], [build_test_tiger_shader="$build_test_all"])
# ==============================================
# Integer types
AC_TYPE_INT8_T
AC_TYPE_UINT8_T
AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
AC_CHECK_SIZEOF([void *])
# ==============================================
# Check for math library
AC_CHECK_LIB([m],[cos])
# ==============================================
# Platform-specific directories and flags
case "${host_os}" in
*darwin*)
GL_LIB="-framework OpenGL"
GLUT_LIB="-framework GLUT"
CONFIG_CFLAGS=""
CONFIG_LDFLAGS="-framework OpenGL -framework GLUT"
CONFIG_LDADD=""
AC_CHECK_HEADERS([OpenGL/gl.h],
[has_gl_h="yes"], [has_gl_h="no"])
AC_CHECK_HEADERS([OpenGL/glu.h],
[has_glu_h="yes"], [has_glu_h="no"])
AC_CHECK_HEADERS([GLUT/glut.h],
[has_glut_h="yes"], [has_glut_h="no"])
;;
#*mingw* | *cygwin*)
*)
GL_LIB="-lGL"
GLUT_LIB="-lglut"
CONFIG_CFLAGS=""
CONFIG_LDFLAGS=""
CONFIG_LDADD="-lglut -lGL"
# Check for OpenGL and GLUT headers
AC_CHECK_HEADERS([GL/gl.h],
[has_gl_h="yes"], [has_gl_h="no"])
AC_CHECK_HEADERS([GL/glu.h],
[has_glu_h="yes"], [has_glu_h="no"])
AC_CHECK_HEADERS([GL/glut.h],
[has_glut_h="yes"], [has_glut_h="no"])
case "${host_os}" in
*linux*)
AC_CHECK_HEADERS([GL/glx.h],
[has_glx_h]="yes", [has_glx_h]="no") ;;
esac
;;
esac
AC_SUBST([CONFIG_CFLAGS])
AC_SUBST([CONFIG_LDFLAGS])
AC_SUBST([CONFIG_LDADD])
# ===============================================
# Check for OpenGL and GLUT libraries
AC_CHECK_LIB([GL], [glEnd],
[has_gl="yes"], [has_gl="no"])
case "${host_os}" in
*linux*)
AC_CHECK_LIB([GL], glXGetProcAddress,
[has_glx="yes"], [has_glx="no"]) ;;
esac
AC_CHECK_LIB([glut], [glutInit],
[has_glut="yes"], [has_glut="no"])
LDFLAGS=""
# ==============================================
# JPEG library required for VGImage example
#CFLAGS="$CFLASG -I$prefix/include"
LDFLAGS="-ljpeg -L/usr/local/lib -L$prefix/lib"
AC_CHECK_HEADERS(
jpeglib.h,
[has_jpeg_h="yes"], [has_jpeg_h="no"])
AC_MSG_CHECKING([JPEG library])
AC_LINK_IFELSE([
AC_LANG_SOURCE([
#include <stdio.h>
#include <stdlib.h>
#include <jpeglib.h>
int main(void) {jpeg_create_decompress(0); return 0;}
])], [has_jpeg="yes"], [has_jpeg="no"])
AC_MSG_RESULT($has_jpeg)
if test "x$build_test_image" = "xyes"; then
if test "x$has_jpeg_h" = "xno"; then
build_test_image="no (jpeg library headers missing)"
else
if test "x$has_jpeg" = "xno"; then
build_test_image="no (failed linking with jpeg library)"
fi
fi
fi
if test "x$build_test_pattern" = "xyes"; then
if test "x$has_jpeg_h" = "xno"; then
build_test_pattern="no (jpeg library headers missing)"
else
if test "x$has_jpeg" = "xno"; then
build_test_pattern="no (failed linking with jpeg library)"
fi
fi
fi
CFLASGS=""
LDFLAGS=""
# ==============================================
# report failure on missing libraries
NO_GL_H_MSG="
gl.h header missing! ShaderVG cannot be built without
OpenGL headers.
"
NO_GL_MSG="
Failed linking with GL library! ShaderVG cannot be built
without OpenGL library.
"
NO_GLX_H_MSG="
glx.h header missing! ShaderVG cannot be build without
GLX headers.
"
NO_GLX_MSG="
Failed linking with GLX library! ShaderVG cannot be built
without GLX library.
"
if test "x$has_gl_h" = "xno"; then
AC_MSG_FAILURE([$NO_GL_H_MSG])
fi
if test "x$has_gl" = "xno"; then
AC_MSG_FAILURE([$NO_GL_MSG])
fi
case "${host_os}" in
*linux*)
if test "x$has_glx_h" = "xno"; then
AC_MSG_FAILURE([$NO_GLX_H_MSG])
fi
if test "x$has_glx" = "xno"; then
AC_MSG_FAILURE([$NO_GLX_MSG])
fi ;;
esac
# ========================================================
# Setup automake conditionals according to configuration
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$has_glut_h" = "xyes"])
AM_CONDITIONAL([BUILD_VGU], [test "x$build_test_vgu" = "xyes"])
AM_CONDITIONAL([BUILD_DASH], [test "x$build_test_dash" = "xyes"])
AM_CONDITIONAL([BUILD_LINEAR], [test "x$build_test_linear" = "xyes"])
AM_CONDITIONAL([BUILD_RADIAL], [test "x$build_test_radial" = "xyes"])
AM_CONDITIONAL([BUILD_INTERPOLATE], [test "x$build_test_interpolate" = "xyes"])
AM_CONDITIONAL([BUILD_TIGER], [test "x$build_test_tiger" = "xyes"])
AM_CONDITIONAL([BUILD_IMAGE], [test "x$build_test_image" = "xyes"])
AM_CONDITIONAL([BUILD_PATTERN], [test "x$build_test_pattern" = "xyes"])
AM_CONDITIONAL([BUILD_BLEND], [test "x$build_test_blend" = "xyes"])
AM_CONDITIONAL([BUILD_TIGER_SHADER],[test "x$build_test_tiger_shader" = "xyes"])
AC_CONFIG_FILES([
Makefile
src/Makefile
examples/Makefile
])
AC_OUTPUT
# =============================================
#echo "GL headers present $has_gl_h"
#echo "GLX headers present $has_glx_h"
#echo "GLUT headers present $has_glut_h"
#echo "JPEG headers present $has_jpeg_h"
#echo ""
#echo "GL library present $has_gl"
#echo "GLX library present $has_glx"
#echo "GLUT library present $has_glut"
#echo "JPEG library present $has_jpeg"
EXAMPLES_LIST="
ShaderVG will be compiled with the following example programs
(run './configure --help' to see how to change selection) :
VGU ${build_test_vgu}
Dashing ${build_test_dash}
Linear Gradient ${build_test_linear}
Radial Gradient ${build_test_radial}
Path Interpolation ${build_test_interpolate}
Tiger SVG ${build_test_tiger}
Images ${build_test_image}
Pattern paint ${build_test_pattern}
Blending ${build_test_blend}
Tiger Shader ${build_test_tiger_shader}
"
if test "x$has_glut_h" = "xno"; then
echo "ShaderVG example programs will not be built because"
echo "the GLUT headers are missing!"
else
if test "x$has_glut" = "xno"; then
echo "ShaderVG example programs will not be built because"
echo "linking to GLUT library failed!"
else
echo "$EXAMPLES_LIST"
fi
fi
echo ""