-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
455 lines (422 loc) · 12.8 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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
AC_INIT([snowmix], [0.5.1.1], [email protected])
# AM_INIT_AUTOMAKE([Snowmix], [0.5.1])
# AM_INIT_AUTOMAKE([Snowmix], [0.5.1])
AM_INIT_AUTOMAKE
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_LN_S
AC_PROG_MKDIR_P
# AC_CHECK_HEADERS([src])
# AM_CONFIG_HEADER(config.h)
WITH_OPENGL=""
SNOWMIX_INIFILES=`find ini -type f | sed 's/^ini\///g' | awk '{ printf("%s ",$0); }'`
SNOWMIX_TCLINCFILES=`ls tcl/*.inc | sed 's/^tcl\///g' | awk '{ printf("%s ",$0); }'`
AC_SUBST(SNOWMIX_INIFILES)
AC_SUBST(SNOWMIX_TCLINCFILES)
AC_ARG_ENABLE([snowmixgui],
[ --enable-snowmixgui Turn on GUI for Snowmix. Under development.],
[case "${enableval}" in
yes) snowmixgui=true ;;
no) snowmixgui=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-snowmixgui]) ;;
esac],[snowmixgui=false])
AM_CONDITIONAL([SNOWMIXGUI], [test "x$snowmixgui" = "xtrue"])
#AC_ARG_ENABLE([snowmixglew],
#[ --enable-snowmixglew Turn on GL Extension Wrangler],
#[case "${enableval}" in
# yes) snowmixglew=true ;;
# no) snowmixglew=false ;;
# *) AC_MSG_ERROR([bad value ${enableval} for --enable-snowmixglew]) ;;
#esac],[snowmixglew=false])
#AM_CONDITIONAL([SNOWMIXGLEW], [test "x$snowmixglew" = "xtrue"])
AC_ARG_ENABLE([snowmixosmesa],
[ --enable-snowmixosmesa Turn on Off Screen Mesa (OpenGL)],
[case "${enableval}" in
yes) snowmixosmesa=true ; snowmixgl=true ;;
no) snowmixosmesa=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-snowmixosmesa]) ;;
esac],[snowmixosmesa=false])
AM_CONDITIONAL([SNOWMIXMESA], [test "x$snowmixosmesa" = "xtrue"])
AC_ARG_ENABLE([snowmixx11],
[ --enable-snowmixx11 Turn on X11 (OpenGL for X-Windows)],
[case "${enableval}" in
yes) snowmixx11=true ; snowmixgl=true ;;
no) snowmixx11=false ; snowmixgl=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-snowmixx11]) ;;
esac],[snowmixx11=false])
AM_CONDITIONAL([SNOWMIXX11], [test "x$snowmixx11" = "xtrue"])
AC_ARG_ENABLE([snowmixglu],
[ --enable-snowmixglu Turn on OpenGL Utility Library],
[case "${enableval}" in
yes) snowmixglu=true ;;
no) snowmixglu=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-snowmixglu]) ;;
esac],[snowmixglu=false])
AM_CONDITIONAL([SNOWMIXGLU], [test "x$snowmixglu" = "xtrue"])
AC_ARG_ENABLE([snowmixglut],
[ --enable-snowmixglut Turn on OpenGL Utility Toolkit Library],
[case "${enableval}" in
yes) snowmixglut=true ;;
no) snowmixglut=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-snowmixglut]) ;;
esac],[snowmixglut=false])
AM_CONDITIONAL([SNOWMIXGLUT], [test "x$snowmixglut" = "xtrue"])
WITH_LIBRT="-lrt"
AC_CANONICAL_HOST
TCLADDLIBS=""
SNOWMIX_VERSION=`cat VERSION`
AC_SUBST(SNOWMIX_VERSION)
case $host_os in
darwin* )
# Do something specific for mac
PLATFORM_OS="-DHAVE_MACOSX"
WITH_LIBRT=""
if test -d /opt/local ; then
if test -d /opt/local/include ; then
export CPPFLAGS='-I/opt/local/include'
else
if test -d /usr/local/include ; then
export CPPFLAGS='-I/usr/local/include'
fi
fi
if test -d /opt/local/lib ; then
export LDFLAGS='-L/opt/local/lib'
else
if test -d /usr/local/lib ; then
export LDFLAGS='-L/usr/local/lib'
fi
fi
else
if test -d /usr/local/include ; then
export CPPFLAGS='-I/usr/local/include'
fi
if test -d /usr/local/lib ; then
export LDFLAGS='-L/usr/local/lib'
fi
fi
if test -d /usr/include/malloc ; then
export CPPFLAGS=$CPPFLAGS' -I/usr/include/malloc'
fi
;;
linux*)
# Do something specific for linux
PLATFORM_OS="-DHAVE_LINUX"
if test -f /etc/os-release ; then
osvariant=`grep '^ID=' /etc/os-release | cut -f2 -d= | tr 'A-Z' 'a-z'`
if [[ X"$osvariant" = Xchakra ]] ; then TCLADDLIBS=" -ltcl" ; fi
fi
;;
freebsd*)
# Do something specific for FreeBSD
AC_MSG_WARN([Your platform may not be supported. Assuming PCBSD])
PLATFORM_OS="-DHAVE_PCBSD -DHAVE_BSD"
;;
*BSD*)
# Do something specific for BSD
AC_MSG_WARN([Your platform may not be supported])
PLATFORM_OS="-DHAVE_BSD"
;;
*)
#Default Case
AC_MSG_ERROR([Your platform is not currently supported])
PLATFORM_OS=""
;;
esac
dnl Check for mman.h
AC_CHECK_HEADER(sys/mman.h,
MMAN_H="-DHAVE_MMAN",
MMAN_H=""
)
AC_SUBST(MMAN_H)
# SDL
dnl Get SDL cflags and SDL libraries to include
AC_CHECK_HEADER(SDL.h,
SDL_LIBS="`sdl-config --libs` "
SDL_CFLAGS="`sdl-config --cflags` ",
[AC_CHECK_HEADER(SDL/SDL.h,
SDL_LIBS="`sdl-config --libs` "
SDL_CFLAGS="`sdl-config --cflags` ",
[AC_MSG_ERROR([Could not find SDL.h. SDL is essential for building Snowmix.])]
)]
)
AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_CFLAGS)
# libpng16
dnl *** libpng16 ***
AC_CHECK_LIB([png16],
[png_sig_cmp],
HAVE_PNG="-DHAVE_PNG16"
PNG_LIBS="`echo $(pkg-config --libs libpng16)` "
PNG_CFLAGS="`echo $(pkg-config --cflags libpng16)` ",
[AC_CHECK_LIB([png15],
[png_sig_cmp],
HAVE_PNG="-DHAVE_PNG15"
PNG_LIBS="`echo $(pkg-config --libs libpng15)` "
PNG_CFLAGS="`echo $(pkg-config --cflags libpng15)` ",
[AC_CHECK_LIB([png12],
[png_sig_cmp],
HAVE_PNG="-DHAVE_PNG12"
PNG_LIBS="`echo $(pkg-config --libs libpng12)` "
PNG_CFLAGS="`echo $(pkg-config --cflags libpng12)` ",
HAVE_PNG=""
PNG_LIBS=""
PNG_CFLAGS=""
[AC_MSG_ERROR([Could not find libpng16, libpng15 or libpng12. libpng is essential for building Snowmix])]
)]
)]
)
AC_SUBST(PNG_LIBS)
AC_SUBST(PNG_CFLAGS)
AC_SUBST(HAVE_PNG)
dnl *** cairo ***
AC_CHECK_LIB([cairo],
[cairo_create],
CAIRO_LIBS="`echo $(pkg-config --libs cairo)` "
CAIRO_CFLAGS="`echo $(pkg-config --cflags cairo)` "
[AC_MSG_NOTICE([We have Cairo])],
CAIRO_LIBS=""
CAIRO_CFLAGS=""
[AC_MSG_ERROR([Could not find libcairo. libcairo is essential for building Snowmix])]
)
AC_SUBST(CAIRO_LIBS)
AC_SUBST(CAIRO_CFLAGS)
dnl *** pangocairo ***
AC_CHECK_LIB([pangocairo],
[pango_cairo_update_context],
PANGO_LIBS="`echo $(pkg-config --libs pangocairo)` "
PANGO_CFLAGS="`echo $(pkg-config --cflags pangocairo)` "
[AC_MSG_NOTICE([We have pangocairo])],
[AC_CHECK_LIB([pangocairo-1.0],
[pango_cairo_update_context],
PANGO_LIBS="`echo $(pkg-config --libs pangocairo)` "
PANGO_CFLAGS="`echo $(pkg-config --cflags pangocairo)` "
[AC_MSG_NOTICE([We have pangocairo])],
PANGO_LIBS=""
PANGO_CFLAGS=""
[AC_MSG_ERROR([Could not find libpangocairo. libpangocairo is essential for building Snowmix])]
)]
)
AC_SUBST(PANGO_LIBS)
AC_SUBST(PANGO_CFLAGS)
dnl *** GTK+ ***
AS_IF([test "x$snowmixgui" = "xtrue"],
GTK_PLUS_LIBS="`echo $( pkg-config --libs gtk+-3.0)` "
GTK_PLUS_CFLAGS="`echo $(pkg-config --cflags gtk+-3.0)` ",
GTK_PLUS_LIBS=""
GTK_PLUS_CFLAGS=""
[AC_MSG_NOTICE([GTK+ skipped. snowmixgui is not enabled. Default])]
)
AC_SUBST(GTK_PLUS_LIBS)
AC_SUBST(GTK_PLUS_CFLAGS)
# Gstreamer
#dnl *** Gstreamer ***
#AC_CHECK_LIB([gstreamer-1.0],
# [gst_init],
# GSTREAMER_LIBS="`echo $(pkg-config --libs gstreamer-1.0)` "
# GSTREAMER_CFLAGS="`echo $(pkg-config --cflags gstreamer-1.0)` ",
# [AC_CHECK_LIB([gstreamer-0.10],
# [gst_init],
# GSTREAMER_LIBS="`echo $(pkg-config --libs gstreamer-0.10)` "
# GSTREAMER_CFLAGS="`echo $(pkg-config --cflags gstreamer-0.10)` ",
# [AC_MSG_ERROR([Could not find libgstreamer-1.0 or libgstreamer-0.10])]
# )]
#)
#AC_SUBST(GSTREAMER_LIBS)
#AC_SUBST(GSTREAMER_CFLAGS)
# X11 for XOpenDisplay
dnl *** X11 ***
AS_IF([test "x$snowmixx11" = "xtrue"],
[AC_MSG_NOTICE([snowmixx11 is enabled. X11 for OpenGL. Checking ...])]
[AC_CHECK_LIB([X11],
[XOpenDisplay],
WITH_X11="-DHAVE_GLX"
# WITH_OPENGL="-DHAVE_OPENGL"
X11_LIBS="`echo $(pkg-config --libs x11)` "
X11_CFLAGS="`echo $(pkg-config --cflags x11)` ",
WITH_X11=""
X11_LIBS=""
X11_CFLAGS=""
[AC_MSG_ERROR([Could not find x11 library])]
)],
WITH_X11=""
X11_LIBS=""
X11_CFLAGS=""
[AC_MSG_NOTICE([Skipping x11. snowmixx11 is not enabled (default). See ./configure --help.])]
)
AC_SUBST(WITH_X11)
AC_SUBST(X11_LIBS)
AC_SUBST(X11_CFLAGS)
# Check GL for glXCreateContext
dnl *** GL ***
AS_IF([test "x$snowmixgl" = "xtrue"],
[AC_MSG_NOTICE([snowmixgl is enabled. GL for OpenGL. Checking ...])]
[AC_CHECK_LIB([GL],
[glXCreateContext],
WITH_GL="-DHAVE_GL"
# WITH_OPENGL="-DHAVE_OPENGL"
GL_LIBS="`echo $(pkg-config --libs gl)` "
GL_CFLAGS="`echo $(pkg-config --cflags gl)` ",
WITH_GL=""
GL_LIBS=""
GL_CFLAGS=""
[AC_MSG_ERROR([Could not find gl library])]
)],
WITH_GL=""
GL_LIBS=""
GL_CFLAGS=""
[AC_MSG_NOTICE([Skipping gl. snowmixgl is not enabled (default).])]
)
#AC_SUBST(WITH_GL)
AC_SUBST(GL_LIBS)
AC_SUBST(GL_CFLAGS)
# OSMesa - Off Screen Mesa (OpenGL)
dnl *** osmesa ***
AS_IF([test "x$snowmixosmesa" = "xtrue"],
[AC_MSG_NOTICE([snowmixosmesa is enabled. Off Screen Mesa (OpenGL). Checking ...])]
[AC_CHECK_LIB([OSMesa],
[OSMesaCreateContext],
WITH_OSMESA="-DHAVE_OSMESA"
# WITH_OPENGL="-DHAVE_OPENGL"
OSMESA_LIBS="`echo $(pkg-config --libs osmesa)` "
OSMESA_CFLAGS="`echo $(pkg-config --cflags osmesa)` ",
WITH_OSMESA=""
OSMESA_LIBS=""
OSMESA_CFLAGS=""
[AC_MSG_ERROR([Could not find osmesa library])]
)],
WITH_OSMESA=""
OSMESA_LIBS=""
OSMESA_CFLAGS=""
[AC_MSG_NOTICE([Skipping osmesa. snowmixosmesa is not enabled (default). See ./configure --help.])]
)
AC_SUBST(WITH_OSMESA)
AC_SUBST(OSMESA_LIBS)
AC_SUBST(OSMESA_CFLAGS)
## GLU - OpenGL GLU
dnl *** GLU ***
AS_IF([test "x$snowmixglu" = "xtrue"],
[AC_MSG_NOTICE([Including GLU. snowmixglu is enabled])]
WITH_GLU="-DHAVE_GLU"
GLU_LIBS="`echo $(pkg-config --libs glu)` "
GLU_CFLAGS="`echo $(pkg-config --cflags glu)` ",
WITH_GLU=""
GLU_LIBS=""
GLU_CFLAGS=""
[AC_MSG_NOTICE([Skipping GLU. snowmixglu is not enabled (default). See ./configure --help.])]
)
AC_SUBST(WITH_GLU)
AC_SUBST(GLU_LIBS)
AC_SUBST(GLU_CFLAGS)
AC_SUBST(WITH_OPENGL)
# Check for GLUT
AS_IF([test "x$snowmixglut" = "xtrue"],
[AC_MSG_NOTICE([Including GLUT. snowmixglut is enabled])]
AC_CHECK_HEADER(GL/glut.h,
GLUT_CFLAGS=""
GLUT_LIBS="-lglut"
GLUT_H="-DHAVE_GLUT",
GLUT_CFLAGS=""
GLUT_LIBS=""
GLUT_H=""
[AC_MSG_WARN([glut.h not present])]
),
[AC_MSG_NOTICE([Skipping GLUT. snowmixglut is not enabled (default). See ./configure --help.])]
GLUT_CFLAGS=""
GLUT_LIBS=""
GLUT_H=""
)
AC_SUBST(GLUT_LIBS)
AC_SUBST(GLUT_CFLAGS)
AC_SUBST(GLUT_H)
### GLEW - OpenGL Wrangler
#dnl *** glew ***
#AS_IF([test "x$snowmixglew" = "xtrue"],
# [AC_MSG_NOTICE([Including GLEW. snowmixglew is enabled])]
# WITH_GLEW="-DHAVE_GLEW"
# GLEW_LIBS="`echo $(pkg-config --libs glew)` "
# GLEW_CFLAGS="`echo $(pkg-config --cflags glew)` ",
# WITH_GLEW=""
# GLEW_LIBS=""
# GLEW_CFLAGS=""
# [AC_MSG_NOTICE([Skipping GLEW. snowmixglew is not enabled (default). See ./configure --help.])]
#)
#AC_SUBST(WITH_GLEW)
#AC_SUBST(GLEW_LIBS)
#AC_SUBST(GLEW_CFLAGS)
# Check for malloc.h
AC_CHECK_HEADER(malloc.h,
MALLOC_H="-DHAVE_MALLOC",
MALLOC_H="-DNO_MALLOC_H"
[AC_MSG_WARN([malloc.h not present])]
)
AC_SUBST(MALLOC_H)
dnl *** pangocairo ***
AC_CHECK_LIB([tcl8.6],
[Tcl_CreateInterp],
TCL_LIBS="-ltcl8.6"
[AC_MSG_NOTICE([We have tcl8.6])],
[AC_CHECK_LIB([tcl8.5],
[Tcl_CreateInterp],
TCL_LIBS="-ltcl8.5"
[AC_MSG_NOTICE([We have tcl8.5])],
[AC_CHECK_LIB([tcl],
[Tcl_CreateInterp],
TCL_LIBS="-ltcl"
[AC_MSG_NOTICE([We have tcl, perhaps 8.5 or 8.6])],
TCL_LIBS="",
[AC_MSG_ERROR([Could not find libpangocairo. libpangocairo is essential for building Snowmix])]
)]
)]
)
# Check for tcl8.6, then tcl8.5 and then tcl (assming tcl8.5)
AC_CHECK_HEADER(tcl8.6/tcl.h,
# TCL_LIBS="-ltcl8.6"
TCLFLAGS="-DWITH_TCL -DHAVE_TCL"
TCLVERSION="-DWITH_TCL86" ,
[AC_CHECK_HEADER(tcl8.5/tcl.h,
# TCL_LIBS="-ltcl8.5"
TCLFLAGS="-DWITH_TCL -DHAVE_TCL"
TCLVERSION="-DWITH_TCL85" ,
[AC_CHECK_HEADER(tcl.h,
# TCL_LIBS="-ltcl"
TCLFLAGS="-DWITH_TCL -DHAVE_TCL"
TCLVERSION="-DWITH_TCL" ,
TCLFLAGS=""
TCLVERSION=""
TCL_LIBS=""
[AC_MSG_ERROR(
[Unable to find tcl header files, install tcl development package.] )]
)]
)]
)
if pkg-config --exists tcl ; then
AC_MSG_NOTICE([Found tcl.pc for pkg-config. Using it to set TCL_LIBS.])
tcllibs=`echo $(pkg-config --libs tcl)` 2>/dev/null
if [[ "X$tcllibs" != X ]] ; then TCL_LIBS="$tcllibs $TCL_LIBS $TCLADDLIBS" ; fi
else
AC_MSG_NOTICE([No tcl.pc for pkg-config. This is usually okay.])
fi
# tcllibs=`echo $(pkg-config --libs tcl)` 2>/dev/null
# if [[ "X$tcllibs" != X ]] ; then TCL_LIBS="$tcllibs $TCLADDLIBS" ; fi
AC_SUBST(TCLVERSION)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCLFLAGS)
AC_SUBST(PLATFORM_OS)
AC_SUBST(WITH_LIBRT)
AC_CONFIG_FILES([Makefile
src/Makefile
relay/Makefile
frames/Makefile
images/Makefile
images/aismaps/Makefile
images/tcl_images/Makefile
images/CS/Makefile
images/GL/Makefile
ini/Makefile
slib/Makefile
scripts/Makefile
tcl/Makefile
test/Makefile
])
AC_OUTPUT