forked from karlstav/cava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
471 lines (384 loc) · 12.3 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
456
457
458
459
460
461
462
463
464
465
466
AC_INIT([cava], [m4_esyscmd_s([cat version])], [[email protected]])
AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
dnl AC_CONFIG_MACRO_DIRS([m4])
AM_PROG_AR
LT_INIT
AC_PROG_CC
AC_PROG_CC_STDC
AM_PROG_LIBTOOL
AC_CANONICAL_HOST
build_linux=no
build_windows=no
build_mac=no
build_freebsd=no
AC_MSG_NOTICE([Checking OS])
# Detect the target system
case "${host_os}" in
linux*)
AC_MSG_NOTICE([Linux detected])
build_linux=yes
;;
darwin*)
AC_MSG_NOTICE([OSX detected])
build_mac=yes
;;
freebsd*)
AC_MSG_NOTICE([FreeBSD detected])
build_freebsd=yes
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
esac
# Pass the conditionals to automake
AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"])
AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"])
AM_CONDITIONAL([FREEBSD], [test "$build_freebsd" = "yes"])
dnl ############################
dnl checking if debug is enabled
dnl ############################
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[enable debug messages and frequency table output])
)
AS_IF([test "x$enable_debug" != "xyes"], [
dnl enabling debug mode
CPPFLAGS="$CPPFLAGS -DNDEBUG"
])
AC_ARG_ENABLE([asan],
AS_HELP_STRING([--enable-asan],
[build with AddressSanitizer])
)
AS_IF([test "x$enable_asan" = "xyes"], [
dnl enabling asan
CPPFLAGS="$CPPFLAGS -fsanitize=address"
LDFLAGS="$LDFLAGS -fsanitize=address"
])
AC_ARG_ENABLE([tsan],
AS_HELP_STRING([--enable-tsan],
[build with ThreadSanitizer])
)
AS_IF([test "x$enable_tsan" = "xyes"], [
dnl enabling tsan
CPPFLAGS="$CPPFLAGS -fsanitize=thread"
LDFLAGS="$LDFLAGS -fsanitize=thread"
])
AC_ARG_ENABLE([ubsan],
AS_HELP_STRING([--enable-ubsan],
[build with UndefinedBehaviorSanitizer])
)
AS_IF([test "x$enable_ubsan" = "xyes"], [
dnl enabling ubsan
CPPFLAGS="$CPPFLAGS -fsanitize=undefined"
LDFLAGS="$LDFLAGS -fsanitize=undefined"
])
dnl ######################
dnl checking for pthread
dnl ######################
AC_CHECK_HEADERS([pthread.h],
AC_CHECK_LIB(pthread, pthread_create, LIBS="$LIBS -lpthread",
AC_MSG_ERROR([pthread.h found but there is no pthread library to make use of])
),
AC_MSG_ERROR([no pthread.h header header file found])
)
dnl ######################
dnl checking for alloca.h
dnl ######################
AC_CHECK_HEADER([alloca.h], [CPPFLAGS="$CPPFLAGS -DHAVE_ALLOCA_H"])
dnl ######################
dnl checking for alsa dev
dnl ######################
AC_ARG_ENABLE([input_alsa],
AS_HELP_STRING([--disable-input-alsa],
[do not include support for input from alsa streams])
)
AS_IF([test "x$enable_input_alsa" != "xno"], [
AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
if [[ $have_alsa = "yes" ]] ; then
LIBS="$LIBS -lasound"
CPPFLAGS="$CPPFLAGS -DALSA"
fi
if [[ $have_alsa = "no" ]] ; then
AC_MSG_NOTICE([WARNING: No alsa dev files found building without alsa support])
fi],
[have_alsa=no]
)
AM_CONDITIONAL([ALSA], [test "x$have_alsa" = "xyes"])
dnl ######################
dnl checking for pipewire dev
dnl ######################
AC_ARG_ENABLE([input_pipewire],
AS_HELP_STRING([--disable-input-pipewire],
[do not include support for input from pipewire])
)
AS_IF([test "x$enable_input_pipewire" != "xno"], [
PKG_CHECK_MODULES(PIPEWIRE, libpipewire-0.3, have_pipewire=yes, have_pipewire=no)
if [[ $have_pipewire = "yes" ]] ; then
LIBS="$LIBS $PIPEWIRE_LIBS"
CPPFLAGS="$CPPFLAGS -DPIPEWIRE $PIPEWIRE_CFLAGS"
fi
if [[ $have_pipewire = "no" ]] ; then
AC_MSG_NOTICE([WARNING: No pipewire dev files found building without pipewire support])
fi],
[have_pipewire=no]
)
AM_CONDITIONAL([PIPEWIRE], [test "x$have_pipewire" = "xyes"])
dnl ######################
dnl checking for pulse dev
dnl ######################
AC_ARG_ENABLE([input_pulse],
AS_HELP_STRING([--disable-input-pulse],
[do not include support for input from pulseaudio])
)
AS_IF([test "x$enable_input_pulse" != "xno"], [
AC_CHECK_LIB(pulse-simple, pa_simple_new, have_pulse=yes, have_pulse=no)
if [[ $have_pulse = "yes" ]] ; then
LIBS="$LIBS -lpulse-simple -lpulse"
CPPFLAGS="$CPPFLAGS -DPULSE"
fi
if [[ $have_pulse = "no" ]] ; then
AC_MSG_NOTICE([WARNING: No pulseaudio dev files found building without pulseaudio support])
fi],
[have_pulse=no]
)
AM_CONDITIONAL([PULSE], [test "x$have_pulse" = "xyes"])
dnl ######################
dnl checking for portaudio dev
dnl ######################
AC_ARG_ENABLE([input_portaudio],
AS_HELP_STRING([--disable-input-portaudio],
[do not include support for input from portaudio])
)
AS_IF([test "x$enable_input_portaudio" != "xno"], [
AC_CHECK_LIB(portaudio, Pa_Initialize, have_portaudio=yes, have_portaudio=no)
if [[ $have_portaudio = "yes" ]] ; then
LIBS="$LIBS -lportaudio"
CPPFLAGS="$CPPFLAGS -DPORTAUDIO"
fi
if [[ $have_portaudio = "no" ]] ; then
AC_MSG_NOTICE([WARNING: No portaudio dev files found building without portaudio support])
fi],
[have_portaudio=no]
)
AM_CONDITIONAL([PORTAUDIO], [test "x$have_portaudio" = "xyes"])
dnl ######################
dnl checking for sndio dev
dnl ######################
AC_ARG_ENABLE([input_sndio],
AS_HELP_STRING([--disable-input-sndio],
[do not include support for input from sndio])
)
AS_IF([test "x$enable_input_sndio" != "xno"], [
AC_CHECK_LIB(sndio, sio_open, have_sndio=yes, have_sndio=no)
if [[ $have_sndio = "yes" ]] ; then
LIBS="$LIBS -lsndio"
CPPFLAGS="$CPPFLAGS -DSNDIO"
fi
if [[ $have_sndio = "no" ]] ; then
AC_MSG_NOTICE([WARNING: No sndio dev files found building without sndio support])
fi],
[have_sndio=no]
)
AM_CONDITIONAL([SNDIO], [test "x$have_sndio" = "xyes"])
dnl ######################
dnl checking for oss dev
dnl ######################
AC_ARG_ENABLE([input_oss],
AS_HELP_STRING([--disable-input-oss],
[do not include support for input from oss])
)
AS_IF([test "x$enable_input_oss" != "xno"], [
have_oss=no
if [[ $build_freebsd = "yes" ]] ; then
AC_CHECK_HEADERS(sys/soundcard.h, have_oss=yes, have_oss=no)
if [[ $have_oss = "yes" ]] ; then
CPPFLAGS="$CPPFLAGS -DOSS -D__BSD_VISIBLE"
fi
if [[ $have_oss = "no" ]] ; then
AC_MSG_NOTICE([WARNING: No oss dev files found building without oss support])
fi
fi],
[have_oss=no]
)
AM_CONDITIONAL([OSS], [test "x$have_oss" = "xyes"])
dnl ######################
dnl checking for jack dev
dnl ######################
AC_ARG_ENABLE([input_jack],
AS_HELP_STRING([--disable-input-jack],
[do not include support for input from jack])
)
AS_IF([test "x$enable_input_jack" != "xno"], [
PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
if [[ $have_jack = "yes" ]] ; then
LIBS="$LIBS $JACK_LIBS"
CPPFLAGS="$CPPFLAGS -DJACK $JACK_CFLAGS"
fi
if [[ $have_jack = "no" ]] ; then
AC_MSG_NOTICE([WARNING: No jack dev files found building without jack support])
fi],
[have_jack=no]
)
AM_CONDITIONAL([JACK], [test "x$have_jack" = "xyes"])
dnl ######################
dnl checking for math lib
dnl ######################
AC_CHECK_LIB(m, sqrt, have_m=yes, have_m=no)
if [[ $have_m = "yes" ]] ; then
LIBS="$LIBS -lm"
fi
if [[ $have_m = "no" ]] ; then
AC_MSG_ERROR([math library is required!])
fi
dnl ######################
dnl checking for fftw3
dnl ######################
AC_CHECK_LIB(fftw3,fftw_execute, have_fftw=yes, have_fftw=no)
if [[ $have_fftw = "yes" ]] ; then
LIBS="$LIBS -lfftw3"
fi
if [[ $have_fftw = "no" ]] ; then
AC_MSG_ERROR([fftw library is required!])
fi
dnl ######################
dnl checking for sdl2
dnl ######################
AC_ARG_ENABLE([output_sdl],
AS_HELP_STRING([--disable-output-sdl],
[do not include support for output with sdl])
)
AS_IF([test "x$enable_output_sdl" != "xno"], [
AC_CHECK_LIB(SDL2,SDL_Init, have_sdl=yes, have_sdl=no)
if [[ $have_sdl = "yes" ]] ; then
LIBS="$LIBS -lSDL2"
CPPFLAGS="$CPPFLAGS -DSDL"
dnl ######################
dnl checking for opengl (only if we know we have sdl)
dnl ######################
AC_ARG_ENABLE([output_sdl_glsl],
AS_HELP_STRING([--disable-output-sdl-glsl],
[do not include support for output with sdl_glsl])
)
AS_IF([test "x$enable_output_sdl_glsl" != "xno"], [
m4_ifdef([AX_CHECK_GL], [
AX_CHECK_GL(have_opengl=yes, have_opengl=no)
], [
AC_MSG_NOTICE([You need to install the autoconf archives to check for opengl. Remember to re-run autogen.sh.])
have_opengl=no
])
if [[ $have_opengl = "yes" ]] ; then
LIBS="$LIBS $GL_LIBS"
CPPFLAGS="$CPPFLAGS -DSDL_GLSL $GL_CFLAGS"
fi
if [[ $have_opengl = "no" ]] ; then
AC_MSG_NOTICE([INFO: building without sdl_glsl (opengl) support])
fi
],
[have_opengl=no]
)
fi
if [[ $have_sdl = "no" ]] ; then
AC_MSG_NOTICE([INFO: building without sdl support])
fi
],
[have_sdl=no]
)
AM_CONDITIONAL([SDL], [test "x$have_sdl" = "xyes"])
AM_CONDITIONAL([SDL_GLSL], [test "x$have_opengl" = "xyes"])
dnl ######################
dnl checking for ncursesw
dnl ######################
AC_ARG_ENABLE([output_ncurses],
AS_HELP_STRING([--disable-output-ncurses],
[do not include support for output with ncurses])
)
AS_IF([test "x$enable_output_ncurses" != "xno"], [
curses_config_bin="ncursesw6-config ncursesw5-config"
AC_PATH_PROGS(CURSES_CONFIG, $curses_config_bin)
AC_CHECK_LIB(ncursesw, initscr,
curses_lib=ncursesw
)
AC_CHECK_LIB($curses_lib, initscr,
if test "$CURSES_CONFIG" = "" ; then
LIBS="$LIBS -l$curses_lib"
CPPFLAGS="$CPPFLAGS -DNCURSES"
fi
if test "$CURSES_CONFIG" != "" ; then
CPPFLAGS="$CPPFLAGS `$CURSES_CONFIG --cflags` -DNCURSES"
LIBS="$LIBS `$CURSES_CONFIG --libs`"
fi
AC_CHECK_HEADERS([curses.h], , AC_MSG_ERROR([missing curses.h header]))
have_ncurses=yes,
AC_MSG_NOTICE([WARNING: building without ncursesw support ncursesw is recomended!])
have_ncurses=no
)],
[have_ncurses=no]
)
AM_CONDITIONAL([NCURSES], [test "x$have_ncurses" = "xyes"])
dnl ######################
dnl checking for cava font
dnl ######################
AC_ARG_ENABLE([cava_font],
AS_HELP_STRING([--disable-cava-font],
[do not include support for the console cava font])
)
AS_IF([test "x$enable_cava_font" != "xno"], [
have_cava_font=yes
if [[ $build_freebsd = "yes" ]] ; then
AC_PATH_PROG(VTFONTCVT, vtfontcvt)
if [[ -z "$VTFONTCVT" ]] ; then
AC_MSG_NOTICE([WARNING: vtfontcvt not found])
have_cava_font=no
fi
AC_PATH_PROG(PSF2BDF, psf2bdf)
if [[ -z "$PSF2BDF" ]] ; then
AC_MSG_NOTICE([WARNING: psf2bdf not found])
have_cava_font=no
fi
if [[ $have_cava_font = "no" ]] ; then
AC_MSG_NOTICE([WARNING: Font conversion tool missing. Building without cava font supported!])
fi
fi],
[have_cava_font=no]
)
AS_IF([test "x$have_cava_font" = "xyes"], [CPPFLAGS="$CPPFLAGS -DCAVAFONT"], [])
AM_CONDITIONAL([CAVAFONT], [test "x$have_cava_font" = "xyes"])
dnl ######################
dnl checking for iniparser
dnl ######################
AC_CHECK_LIB(iniparser,iniparser_load, have_iniparser=yes, have_iniparser=no)
if [[ $have_iniparser = "yes" ]] ; then
LIBS="$LIBS -liniparser"
CPPFLAGS="$CPPFLAGS -I/usr/include/iniparser"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iniparser.h>]],
[[dictionary* ini;
const char *keys[3];
iniparser_getseckeys(ini, "eq", keys);]])],
[AC_MSG_RESULT(iniparser > 3.2 test OK)],
[AC_MSG_RESULT(iniparser > 3.2 test failed falling back to legacy iniparser mode)
CPPFLAGS="$CPPFLAGS -DLEGACYINIPARSER"])
fi
if [[ $have_iniparser = "no" ]] ; then
AC_MSG_ERROR([iniparser library is required!])
fi
dnl ############################
dnl Set font directory
dnl ############################
AC_ARG_VAR(FONT_DIR, [Directory where the font will be installed.])
AC_SUBST([FONT_FILE])
AS_IF([test "x$have_cava_font" = "xyes"], [
if [[ "$build_freebsd" = "yes" ]] ; then
DEFAULT_FONT_DIR="${datarootdir}/cava"
FONT_FILE="cava.fnt"
else
DEFAULT_FONT_DIR="${datarootdir}/consolefonts"
FONT_FILE="cava.psf"
fi], [
DEFAULT_FONT_DIR=
FONT_FILE=]
)
if test -z "$FONT_DIR" ; then
FONT_DIR="$DEFAULT_FONT_DIR"
fi
AC_CONFIG_FILES([Makefile])
AC_OUTPUT