File: configure.ac

package info (click to toggle)
lebiniou 3.67.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,500 kB
  • sloc: ansic: 28,670; makefile: 1,276; sh: 602; awk: 432; xml: 261; javascript: 23
file content (791 lines) | stat: -rw-r--r-- 23,903 bytes parent folder | download
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
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
AC_INIT([lebiniou],[3.67.0],[olivier@biniou.info])
AC_PREREQ([2.68])
AC_CONFIG_SRCDIR([src/main.c])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.11 foreign -Wall])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

# ------------------------------------------------------------------
# Versioning
# ------------------------------------------------------------------
BINIOU_MAJOR=3
BINIOU_MINOR=67
BINIOU_PATCH=0
#BINIOU_EXTRA="-dev"
BINIOU_VERSION="$BINIOU_MAJOR.$BINIOU_MINOR.$BINIOU_PATCH$BINIOU_EXTRA"
AC_SUBST(BINIOU_VERSION)

# Prelude
LDFLAGS="-rdynamic $LDFLAGS"

# Checks for programs
OLD_FLAGS="$CFLAGS"
AC_PROG_CC
CFLAGS="$OLD_FLAGS"
AM_PROG_CC_C_O
AC_PROG_SED

# LFS
AC_SYS_LARGEFILE

m4_undefine([AC_PROG_F77])
m4_defun([AC_PROG_F77],[])

# Check for pkg-config
PKG_PROG_PKG_CONFIG

# Check OS family/flavor
os_family="unknown"
os_flavor="unknown"
DEFAULT_INPUT_PLUGIN=sndio
case "$target_os" in
*kfreebsd*)
os_family=bsd
os_flavor=kfreebsd
;;

dragonfly*)
os_family=bsd
LIBS="-ldl $LIBS"
;;

darwin*)
os_family=bsd
os_flavor=darwin
LIBS="-ldl $LIBS"
;;

netbsd*)
os_family=bsd
os_flavor=netbsd
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/pkg/lib/ffmpeg4/pkgconfig"
;;

freebsd*)
os_family=bsd
os_flavor=freebsd
;;

openbsd*)
os_family=bsd
os_flavor=openbsd
;;

# Hurd
*pc-gnu*)
os_family=linux
os_flavor=hurd
;;

*)
os_family=linux
os_flavor=linux
LIBS="-ldl $LIBS"
DEFAULT_INPUT_PLUGIN=alsa
esac
AC_MSG_CHECKING([for operating system family])
AC_MSG_RESULT([${os_family}])
AC_MSG_CHECKING([for operating system flavor])
AC_MSG_RESULT([${os_flavor}])
AM_CONDITIONAL([OS_LINUX_FAMILY], [test "x${os_family}" = "xlinux"])
AM_CONDITIONAL([OS_NETBSD_OR_OPENBSD], [test "x${os_flavor}" = "xnetbsd" || test "x${os_flavor}" = "xopenbsd"])
AM_CONDITIONAL([OS_DARWIN], [test "x${os_flavor}" = "xdarwin"])

# Checks for libraries

# glib-2.0
PKG_CHECK_MODULES([GLIB], [glib-2.0], , [AC_MSG_ERROR([You must have libglib2.0-dev installed])])
CFLAGS="$GLIB_CFLAGS $CFLAGS"

# fftw3
PKG_CHECK_MODULES([FFTW3], [fftw3], , [AC_MSG_ERROR([You must have libfftw3-dev installed])])

# jansson
PKG_CHECK_MODULES([JANSSON], [jansson], , [AC_MSG_ERROR([You must have libjansson-dev installed])])

# MagickWand
PKG_CHECK_MODULES([MAGICKWAND], [MagickWand], , [AC_MSG_ERROR([You must have libmagickwand-dev installed])])
magickwand7="no"
PKG_CHECK_MODULES([MAGICKWAND7], [MagickWand >= 7.0.0], [magickwand7="yes"], [AC_MSG_NOTICE([MagickWand 7 or higher not found])])
if test "x${magickwand7}" = "xyes"; then
   CPPFLAGS="-DMAGICKWAND7 ${CPPFLAGS}"
fi

# orcania
PKG_CHECK_MODULES([ORCANIA], [liborcania], , [AC_MSG_ERROR([You must have liborcania-dev installed])])

# yder
PKG_CHECK_MODULES([YDER], [libyder], , [AC_MSG_ERROR([You must have libyder-dev installed])])

# ulfius
PKG_CHECK_MODULES([ULFIUS], [libulfius], , [AC_MSG_ERROR([You must have libulfius-dev installed ])])

LIBS="${GLIB_LIBS} ${JANSSON_LIBS} -lm $LIBS"

# We need to know which prefix we used to find some default values
if test "x${prefix}" = "xNONE"; then
prefix="/usr/local"
fi
LEBINIOU_LIBDIR="$prefix/lib"
if test x"$DEB_HOST_MULTIARCH" != "x"; then
LEBINIOU_LIBDIR="$LEBINIOU_LIBDIR/$DEB_HOST_MULTIARCH"
fi
LEBINIOU_SHAREDIR="$prefix/share/lebiniou"
LEBINIOU_DATADIR="${LEBINIOU_SHAREDIR}"
LEBINIOU_PLUGINSDIR="${LEBINIOU_LIBDIR}/lebiniou/plugins"
LEBINIOU_SAMPLESDIR="${LEBINIOU_SHAREDIR}/sequences/json"
LEBINIOU_WWWDIR="${LEBINIOU_SHAREDIR}/www"
LEBINIOU_VUEDIR="${LEBINIOU_SHAREDIR}/vue"
LEBINIOU_SCHEMES_FILE="${LEBINIOU_SHAREDIR}/etc/schemes.json"

AC_SUBST(LEBINIOU_DATADIR)
AC_SUBST(LEBINIOU_PLUGINSDIR)
AC_SUBST(LEBINIOU_SAMPLESDIR)
AC_SUBST(LEBINIOU_WWWDIR)
AC_SUBST(LEBINIOU_VUEDIR)
AC_SUBST(LEBINIOU_SCHEMES_FILE)

# Check for SwScale
PKG_CHECK_MODULES([SWSCALE], [libswscale], , [AC_MSG_ERROR([You must have libswscale-dev installed])])

# Check for avutils
PKG_CHECK_MODULES([AVUTIL], [libavutil], , [AC_MSG_ERROR([You must have libavutil-dev installed])])

# Check for avcodec
PKG_CHECK_MODULES([AVCODEC], [libavcodec], , [AC_MSG_ERROR([You must have libavcodec-dev installed])])

# Check for avformat
PKG_CHECK_MODULES([AVFORMAT], [libavformat], , [AC_MSG_ERROR([You must have libavformat-dev installed])])

# Keep a list of input/output plugins
INPUT_PLUGINS="sndio"
AC_SUBST([INPUT_PLUGINS])
OUTPUT_PLUGINS="SDL2"
AC_SUBST([OUTPUT_PLUGINS])

# Compile test/debug plugins
AC_ARG_ENABLE([test-plugins],
AS_HELP_STRING([--enable-test-plugins],[build the test/debug plugins [default=no]]),,
enable_test_plugins="no")
AM_CONDITIONAL([WITH_TEST_PLUGINS], [test "x${enable_test_plugins}" = "xyes"])

# Check for Alsa
alsa_present="no"
AC_ARG_ENABLE([alsa],
AS_HELP_STRING([--enable-alsa],[build the ALSA input plugin [default=yes]]),,
enable_alsa="yes")
if test "x${enable_alsa}" = "xyes"; then
PKG_CHECK_MODULES([ALSA], alsa, alsa_present=yes, alsa_present=no)
fi
AM_CONDITIONAL([ALSA_PLUGIN], [test "x${alsa_present}" = "xyes"])
if test "x${alsa_present}" = "xyes"; then
INPUT_PLUGINS="$INPUT_PLUGINS,alsa"
fi

# Check for JACK Audio
jack_present="no"
AC_ARG_ENABLE([jackaudio],
AS_HELP_STRING([--enable-jackaudio],[build the JACK Audio input plugin [default=yes]]),,
enable_jackaudio="yes")
if test "x${enable_jackaudio}" = "xyes"; then
PKG_CHECK_MODULES([JACK], jack, jack_present=yes, jack_present=no)
fi
AM_CONDITIONAL([JACK_PLUGIN], [test "x${jack_present}" = "xyes"])
if test "x${jack_present}" = "xyes"; then
INPUT_PLUGINS="$INPUT_PLUGINS,jackaudio"
fi

# Check for OSC Audio
osc_present="no"
AC_ARG_ENABLE([oscaudio],
AS_HELP_STRING([--enable-oscaudio],[build the OSC Audio input plugin [default=yes]]),,
enable_oscaudio="yes")
if test "x${enable_oscaudio}" = "xyes"; then
PKG_CHECK_MODULES([OSC], liblo, osc_present=yes, osc_present=no)
fi
AM_CONDITIONAL([OSC_PLUGIN], [test "x${osc_present}" = "xyes"])
if test "x${osc_present}" = "xyes"; then
INPUT_PLUGINS="$INPUT_PLUGINS,oscaudio"
fi

# Check for sndio
sndio_present="no"
AC_ARG_ENABLE([sndio],
AS_HELP_STRING([--enable-sndio],[build the Sndio input plugin [default=yes]]),,
enable_sndio="yes")
if test "x${enable_sndio}" = "xyes"; then
AC_CHECK_HEADER(sndio.h, [sndio_present="yes"])
fi
AM_CONDITIONAL([SNDIO_PLUGIN], [test "x${sndio_present}" = "xyes"])

# Check for libpulse
pulseaudio_present="no"
AC_ARG_ENABLE([pulseaudio],
AS_HELP_STRING([--enable-pulseaudio],[build the PulseAudio input plugin [default=yes]]),,
enable_pulseaudio="yes")
if test "x${enable_pulseaudio}" = "xyes"; then
PKG_CHECK_MODULES([PULSEAUDIO], libpulse-simple, pulseaudio_present=yes, pulseaudio_present=no)
fi
AM_CONDITIONAL([PULSEAUDIO_PLUGIN], [test "x${pulseaudio_present}" = "xyes"])
if test "x${pulseaudio_present}" = "xyes"; then
INPUT_PLUGINS="$INPUT_PLUGINS,pulseaudio"
fi

# Check for eSound
esd_present="no"
AC_ARG_ENABLE([esd],
AS_HELP_STRING([--enable-esd],[build the ESD input plugin [default=no]]),,
enable_esd="no")
if test "x${enable_esd}" = "xyes"; then
PKG_CHECK_MODULES([ESD], esound >= 0.2.36, esd_present=yes, esd_present=no)
fi
AM_CONDITIONAL([ESD_PLUGIN], [test "x${esd_present}" = "xyes"])
if test "x${esd_present}" = "xyes"; then
INPUT_PLUGINS="$INPUT_PLUGINS,esound"
fi

# Check for sndfile
AC_ARG_ENABLE([sndfile],
AS_HELP_STRING([--enable-sndfile],[build the SndFile input plugin [default=yes]]),,
enable_sndfile="yes")
if test "x${enable_sndfile}" = "xyes"; then
PKG_CHECK_MODULES([SNDFILE], sndfile, sndfile_present=yes, sndfile_present=no)
fi
AM_CONDITIONAL([SNDFILE_PLUGIN], [test "x${sndfile_present}" = "xyes"])
if test "x${sndfile_present}" = "xyes"; then
INPUT_PLUGINS="$INPUT_PLUGINS,sndfile"
fi

# Twip input plugin
AC_ARG_ENABLE([twip],
AS_HELP_STRING([--enable-twip],[build the Twip input plugin [default=yes]]),,
enable_twip="yes")
AM_CONDITIONAL([TWIP_PLUGIN], [test "x${enable_twip}" = "xyes"])
if test "x${enable_twip}" = "xyes"; then
INPUT_PLUGINS="$INPUT_PLUGINS,twip"
fi

# Check for libcaca
caca_present="no"
AC_ARG_ENABLE([caca],
AS_HELP_STRING([--enable-caca],[build the libcaca plugin [default=yes]]),,
enable_caca="yes")
if test "x${enable_caca}" = "xyes"; then
PKG_CHECK_MODULES([CACA], caca, caca_present=yes, caca_present=no)
fi
AM_CONDITIONAL([CACA_PLUGIN], [test "x${caca_present}" = "xyes"])
if test "x${caca_present}" = "xyes"; then
OUTPUT_PLUGINS="$OUTPUT_PLUGINS,caca"
fi

# Fixed buffers support
AC_ARG_ENABLE([fixed],
[AS_HELP_STRING([--enable-fixed="WIDTHxHEIGHT"],[use fixed-size video buffers [default=no]])],
[enable_fixed=$enableval],
[enable_fixed="no"])
if test "x${enable_fixed}" != "xno"; then
FIXED_W=${enableval%*x*}
FIXED_H=${enableval#*x*}
CPPFLAGS="-DFIXED -DWIDTH=$FIXED_W -DHEIGHT=$FIXED_H $CPPFLAGS"
fi

# Set webcam capture size
AC_ARG_ENABLE([camsize],
[AS_HELP_STRING([--enable-camsize="WIDTHxHEIGHT"],[set webcam capture size [default="640x480"]])],
[enable_camsize=$enableval],
[enable_camsize="no"])
CAP_W=640
CAP_H=480
if test "x${enable_camsize}" != "xno"; then
CAP_W=${enableval%*x*}
CAP_H=${enableval#*x*}
CPPFLAGS="-DCAPTURE_SET -DCAP_WIDTH=$CAP_W -DCAP_HEIGHT=$CAP_H $CPPFLAGS"
fi

# Enable unfinished plugins
AC_ARG_ENABLE([unfinished-plugins],
AS_HELP_STRING([--enable-unfinished-plugins],[build unfinished plugins [default=no]]),,
enable_unfinished_plugins="no")
AM_CONDITIONAL([WITH_UNFINISHED_PLUGINS], [test "x${enable_unfinished_plugins}" = "xyes"])

# Flatpak support
AC_ARG_ENABLE([flatpak],
AS_HELP_STRING([--enable-flatpak],[flatpak support [default=no]]),,
enable_flatpak="no")
if test "x${enable_flatpak}" != "xno"; then
CPPFLAGS="-DFLATPAK $CPPFLAGS"
fi

# Check for getopt / getopt_long
# XXX completely review this -- only needed for the main binary --oliv3
# FIXME eeeuh on check 2x ?! --oliv3
AC_CHECK_FUNCS([getopt_long], , AC_DEFINE([HAVE_GETOPT_LONG]))
HAVE_GETOPT_LONG="no"
GETOPT_LONG_LIBS=""
AC_CHECK_FUNC([getopt_long], [HAVE_GETOPT_LONG="yes"])
if test "x$HAVE_GETOPT_LONG" != "xyes" ; then
# FreeBSD has a gnugetopt library
AC_CHECK_LIB([gnugetopt], [getopt_long], [HAVE_GETOPT_LONG="yes"])
if test "x$HAVE_GETOPT_LONG" = "xyes"; then
GETOPT_LONG_LIBS="-lgnugetopt"
fi
fi
AC_SUBST(GETOPT_LONG_LIBS)
if test "x$HAVE_GETOPT_LONG" = "xyes"; then
AC_DEFINE([HAVE_GETOPT_LONG])
fi

# Checks for header files
AC_CHECK_HEADERS([ \
sys/mman.h \
poll.h \
sys/time.h \
sys/ioctl.h \
sys/stat.h \
sys/types.h \
stdio.h \
stdlib.h \
string.h \
unistd.h \
dirent.h \
errno.h \
fcntl.h \
dlfcn.h \
zlib.h \
complex.h \
pthread.h \
ctype.h \
stdint.h \
assert.h \
malloc.h \
math.h \
getopt.h \
time.h \
soundcard.h \
sys/soundcard.h \
sys/select.h
])

# Check for SDL2
DEFAULT_OUTPUT_PLUGIN=SDL2
PKG_CHECK_MODULES([SDL2],[sdl2],have_sdl2=yes,[AC_MSG_ERROR([You must have libsdl2-dev installed])])

# Check for OpenGL/GLU
PKG_CHECK_MODULES([GLU],[glu],[have_opengl="yes"],[have_opengl="no"])
AC_ARG_ENABLE([opengl],
AS_HELP_STRING([--enable-opengl],[enable OpenGL support [default=no]]),,
[enable_opengl="no"])
AM_CONDITIONAL([EXTRA_OPENGL], [test "x${enable_opengl}" = "xyes"])
if test "x${enable_opengl}" = "xyes" && test "x${have_opengl}" = "xyes"; then
CPPFLAGS="-DWITH_GL $CPPFLAGS"
LIBS="${GLU_LIBS} $LIBS"
OUTPUT_PLUGINS="$OUTPUT_PLUGINS,GL"
fi

# RTMP/mp4/v4l2loopback
OUTPUT_PLUGINS="$OUTPUT_PLUGINS,RTMP,mp4,v4l2loopback"

# Webcam support
have_webcam="no"
AC_CHECK_HEADERS(linux/videodev2.h, have_webcam=yes)
AC_CHECK_HEADERS(sys/videoio.h, have_webcam=yes)

AC_DEFINE_UNQUOTED([DEFAULT_INPUT_PLUGIN], ["$DEFAULT_INPUT_PLUGIN"], [Default input plugin])
AC_DEFINE_UNQUOTED([DEFAULT_OUTPUT_PLUGIN], ["$DEFAULT_OUTPUT_PLUGIN"], [Default output plugin])
AC_SUBST(LIBS)

if test "x$os_flavor" = "xopenbsd"; then
CPPFLAGS="-DSDL_DISABLE_IMMINTRIN_H $CPPFLAGS"
fi

# armhf
CFLAGS="-fsigned-char $CFLAGS"

# ISO C 2011
CFLAGS="-std=c11 $CFLAGS"
CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS"

# ------------------------------------------------------------------
# Options
# ------------------------------------------------------------------
# Debugging option
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],[turn on debugging [default=no]]),,
enable_debug="no")
if test "x${enable_debug}" = "xyes"; then
CPPFLAGS="-DDEBUG $CPPFLAGS"
CFLAGS="-g -O0 $CFLAGS"
else
CPPFLAGS="-DNDEBUG $CPPFLAGS"
CFLAGS="-fomit-frame-pointer $CFLAGS"
fi

# SDL2 user interface
AC_ARG_ENABLE([sdl2ui],
AS_HELP_STRING([--enable-sdl2ui],[enable the legacy SDL2 user interface [default=no]]),,
enable_sdl2ui="no")
if test "x${enable_debug}" = "xyes"; then
   if test "x${enable_sdl2ui}" = "xyes"; then
      # freetype-2
      PKG_CHECK_MODULES([FT2], [freetype2], , [AC_MSG_ERROR([You must have libfreetype6-dev installed])])
      # Check for SDL2_ttf
      PKG_CHECK_MODULES([SDL2_ttf],[SDL2_ttf],have_sdl2_ttf=yes,[AC_MSG_ERROR([You must have libsdl2-ttf-dev installed])])
      CPPFLAGS="-DWITH_SDL2UI ${CPPFLAGS}"
      # Set default font path
      # default: Debian/Ubuntu
      OSD_FONT="/usr/share/fonts/truetype/freefont/FreeMono.ttf"
      OSD_PTSIZE=16
      if test x"${os_flavor}" = x"freebsd"; then
         OSD_FONT="/usr/local/share/fonts/dejavu/DejaVuSansMono.ttf"
         OSD_PTSIZE=14
      fi
      AC_SUBST(OSD_FONT)
      AC_SUBST(OSD_PTSIZE)
   fi
fi
AM_CONDITIONAL([WITH_SDL2UI], [test "x${enable_sdl2ui}" = "xyes"])

# ASan
AC_ARG_ENABLE([asan],
AS_HELP_STRING([--enable-asan],[use AddressSanitizer [default=no]]),,
enable_asan="no")
if test "x${enable_asan}" = "xyes"; then
CFLAGS="-fsanitize=address $CFLAGS"
LIBS="-lasan $LIBS"
fi

# Treat warnings as errors
AC_ARG_ENABLE([warnings],
AS_HELP_STRING([--enable-warnings],[treat warnings as errors [default=yes]]),,
enable_warnings="yes")
if test "x${enable_warnings}" = "xyes"; then
CFLAGS="-Wall $CFLAGS"
if test "x${os_flavor}" != "xopenbsd"; then
CFLAGS="-Wextra -Wno-unused-parameter $CFLAGS"
fi
if test "x${os_flavor}" = "xnetbsd"; then
CFLAGS="-Wno-old-style-declaration $CFLAGS"
fi
fi

# Disable calls to dlclose() (for debugging with valgrind)
AC_ARG_ENABLE([dlclose],
AS_HELP_STRING([--enable-dlclose], [call dlclose() when unloading plugins [default=yes]]),[call_dlclose=no],[call_dlclose=yes])
if test "x${call_dlclose}" = "xno"; then
CPPFLAGS="-DDISABLE_DLCLOSE $CPPFLAGS"
fi

# ------------------------------------------------------------------
# Hardening
# ------------------------------------------------------------------
AC_CHECK_PROG(DPKG_BUILDFLAGS_CHECK,dpkg-buildflags,yes)
if test "x${os_flavor}" != "xdarwin"; then
LDFLAGS="-Wl,-z,now $LDFLAGS"
fi
if test "x${enable_debug}" != "xyes"; then
if test "x${DPKG_BUILDFLAGS_CHECK}" = "xyes"; then
CFLAGS="`dpkg-buildflags --get CFLAGS` $CFLAGS"
CPPFLAGS="`dpkg-buildflags --get CPPFLAGS` $CPPFLAGS"
LDFLAGS="`dpkg-buildflags --get LDFLAGS` $LDFLAGS"
else
CFLAGS="-fstack-protector-strong -Wformat -Werror=format-security $CFLAGS"
if test "x$os_flavor" != "xopenbsd"; then
CPPFLAGS="-Wdate-time $CPPFLAGS"
fi
if test "x${os_flavor}" != "xdarwin"; then
LDFLAGS="-Wl,-z,relro $LDFLAGS"
fi
fi
fi

# ------------------------------------------------------------------
# Fixed buffers optimizations
# ------------------------------------------------------------------
if test "x${enable_fixed}" != "xno"; then
CFLAGS="-O3 -funroll-all-loops $CFLAGS"
fi

# ------------------------------------------------------------------
# Plugin-specific stuff
# ------------------------------------------------------------------
if test "x${have_webcam}" = "xyes"; then
AC_ARG_ENABLE([webcam],
AS_HELP_STRING([--enable-webcam],[enable webcam support [default=yes]]),[enable_webcam=$enableval],
[enable_webcam="yes"])
else
enable_webcam="no"
fi
AM_CONDITIONAL([EXTRA_WEBCAM], [test "x${enable_webcam}" = "xyes"])
if test "x${enable_webcam}" = "xyes"; then
CPPFLAGS="-DWITH_WEBCAM $CPPFLAGS"
fi

# ------------------------------------------------------------------
# Output files
# ------------------------------------------------------------------
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([

Makefile
etc/Makefile
images/Makefile
src/Makefile
src/defaults.h

plugins/Makefile
plugins/input/Makefile
plugins/main/Makefile
plugins/output/Makefile

plugins/input/alsa/Makefile
plugins/input/random/Makefile
plugins/input/esound/Makefile
plugins/input/pulseaudio/Makefile
plugins/input/sndfile/Makefile
plugins/input/twip/Makefile
plugins/input/jackaudio/Makefile
plugins/input/oscaudio/Makefile
plugins/input/sndio/Makefile

plugins/main/_params/Makefile
plugins/main/acid_drop/Makefile
plugins/main/bassline/Makefile
plugins/main/blur_chemical/Makefile
plugins/main/blur_cross/Makefile
plugins/main/blur_diagonal_1/Makefile
plugins/main/blur_diagonal_2/Makefile
plugins/main/blur_gaussian/Makefile
plugins/main/blur_horizontal/Makefile
plugins/main/blur_horizontal_2/Makefile
plugins/main/blur_horizontal_colrot/Makefile
plugins/main/blur_light/Makefile
plugins/main/blur_vertical/Makefile
plugins/main/blur_vertical_2/Makefile
plugins/main/broken_mirror/Makefile
plugins/main/cellular_venus/Makefile
plugins/main/clear/Makefile
plugins/main/color_cycle/Makefile
plugins/main/color_flashy/Makefile
plugins/main/critters/Makefile
plugins/main/big_half_wheel/Makefile
plugins/main/hurricane/Makefile
plugins/main/smoke/Makefile
plugins/main/space_in/Makefile
plugins/main/space_out/Makefile
plugins/main/spiral_effect/Makefile
plugins/main/roller_x/Makefile
plugins/main/roller_y/Makefile
plugins/main/drops/Makefile
plugins/main/edge_detect/Makefile
plugins/main/emboss/Makefile
plugins/main/fadeout/Makefile
plugins/main/fadeout_beat/Makefile
plugins/main/fadeout_mist/Makefile
plugins/main/fadeout_slow/Makefile
plugins/main/faders/Makefile
plugins/main/flow/Makefile
plugins/main/galaxy/Makefile
plugins/main/GLCube/Makefile
plugins/main/hodge/Makefile
plugins/main/image/Makefile
plugins/main/image_beat_1/Makefile
plugins/main/image_beat_2/Makefile
plugins/main/image_beat_3/Makefile
plugins/main/image_colrot/Makefile
plugins/main/image_colrot_beat/Makefile
plugins/main/image_dissolve/Makefile
plugins/main/image_drop/Makefile
plugins/main/image_squares/Makefile
plugins/main/image_squares_beat/Makefile
plugins/main/images_pulse/Makefile
plugins/main/infinity/Makefile
plugins/main/kaleidoscope/Makefile
plugins/main/life/Makefile
plugins/main/melt/Makefile
plugins/main/mosaic/Makefile
plugins/main/monitor/Makefile
plugins/main/spirals_nested/Makefile
plugins/main/spiral_archimedean_3d/Makefile
plugins/main/spiral_pulsing/Makefile
plugins/main/paint_drops/Makefile
plugins/main/poincare/Makefile
plugins/main/oscillo_polar/Makefile
plugins/main/pulse/Makefile
plugins/main/recurrence_plot/Makefile
plugins/main/reflector/Makefile
plugins/main/ripple/Makefile
plugins/main/oscillo_rotating/Makefile
plugins/main/rotors/Makefile
plugins/main/rotors_freq/Makefile
plugins/main/scroll_horizontal/Makefile
plugins/main/scroll_vertical/Makefile
plugins/main/sequence_fadeout/Makefile
plugins/main/sin_oscillo_1/Makefile
plugins/main/sin_oscillo_2/Makefile
plugins/main/snake/Makefile
plugins/main/snake_oscillo/Makefile
plugins/main/speaker/Makefile
plugins/main/spheres_pulse/Makefile
plugins/main/spectrogram/Makefile
plugins/main/spectrum/Makefile
plugins/main/spectrum_s_horizontal/Makefile
plugins/main/spectrum_s_vertical/Makefile
plugins/main/spirals/Makefile
plugins/main/splash/Makefile
plugins/main/swarm/Makefile
plugins/main/taquin/Makefile
plugins/main/touw_eiffel/Makefile
plugins/main/tunnel/Makefile
plugins/main/video/Makefile
plugins/main/warp/Makefile
plugins/main/gum_x/Makefile
plugins/main/mirror_bottom/Makefile
plugins/main/mirror_top/Makefile
plugins/main/oscillo_x/Makefile
plugins/main/scanline_x/Makefile
plugins/main/shaker_x/Makefile
plugins/main/swap_columns/Makefile
plugins/main/gum_y/Makefile
plugins/main/mirror_left/Makefile
plugins/main/mirror_right/Makefile
plugins/main/oscillo_y/Makefile
plugins/main/path/Makefile
plugins/main/path_freq/Makefile
plugins/main/path_oscillo/Makefile
plugins/main/path_oscillo_freq/Makefile
plugins/main/rotozoom/Makefile
plugins/main/scanline_y/Makefile
plugins/main/shaker_y/Makefile
plugins/main/swap_rows/Makefile
plugins/main/takens/Makefile

plugins/main/tv_1d/Makefile
plugins/main/tv_colrot/Makefile
plugins/main/tv_colrot_slow/Makefile
plugins/main/tv_colrot_beat/Makefile
plugins/main/tv_diff/Makefile
plugins/main/tv_diff2/Makefile
plugins/main/tv_diff3/Makefile
plugins/main/tv_diff4/Makefile
plugins/main/tv_diffbeat/Makefile
plugins/main/tv_fire/Makefile
plugins/main/tv_nervous/Makefile
plugins/main/tv_predator/Makefile
plugins/main/tv_quark/Makefile
plugins/main/tv_streak/Makefile
plugins/main/tv_webcam/Makefile

plugins/output/caca/Makefile
plugins/output/mp4/Makefile
plugins/output/v4l2loopback/Makefile
plugins/output/SDL2/Makefile
plugins/output/GL/Makefile
plugins/output/RTMP/Makefile

plugins/main/test_beat_detection/Makefile

])

AC_CONFIG_FILES([lebiniou.1.head lebiniou.1.tail])

INPUT_PLUGINS="$INPUT_PLUGINS,random,NULL"
AC_DEFINE_UNQUOTED([INPUT_PLUGINS], ["$INPUT_PLUGINS"], [Available input plugins])
OUTPUT_PLUGINS="$OUTPUT_PLUGINS,NULL"
AC_DEFINE_UNQUOTED([OUTPUT_PLUGINS], ["$OUTPUT_PLUGINS"], [Available output plugins])

# Plugins compilation flags
PLUGIN_CFLAGS="-fPIC"

if test "x${os_flavor}" != "xdarwin"; then
PLUGIN_LDFLAGS="-shared -fPIC -Wl,-z,defs -pthread -Wl,--no-as-needed"
PLUGIN_LDADD="-l:liblebiniou.so.0"
else
PLUGIN_LDFLAGS="-shared -fPIC -pthread"
PLUGIN_LDADD="-llebiniou"
fi

AC_SUBST([PLUGIN_CFLAGS])
AC_SUBST([PLUGIN_LDFLAGS])
AC_SUBST([PLUGIN_LDADD])

# Output files
AC_OUTPUT

# ------------------------------------------------------------------
# Configuration report
# ------------------------------------------------------------------
yn() {
if test "x$1" = "xyes"; then
echo -n "	@<:@*@:>@ ";
else
echo -n "	@<:@ @:>@ ";
fi
echo $2
}

echo "-REPORT-"
echo
echo "=== Le Biniou v${BINIOU_VERSION} ==="
echo
echo " * Build options:"
echo "        Target OS:                  ${target_os}"
echo "        OS family:                  ${os_family}"
echo "        OS flavor:                  ${os_flavor}"
echo "        Debian-based:               ${DPKG_BUILDFLAGS_CHECK}" 
echo
echo "        Installation prefix:        ${prefix}"
echo "        Preprocessor flags:         ${CPPFLAGS}"
echo "        Compiler flags:             ${CFLAGS}"
echo "        Linker flags:               ${LDFLAGS}"
echo "        Libraries:                  ${LIBS}"
echo "        Debug enabled:              ${enable_debug}"
echo "        Treat warnings as errors:   ${enable_warnings}"
echo "        Use dlclose():              ${call_dlclose}"
echo "        Plugin compiler flags:      ${PLUGIN_CFLAGS}"
echo "        Plugin linker flags:        ${PLUGIN_LDFLAGS}"
echo "        Plugin libraries:           ${PLUGIN_LDADD}"
echo
echo "        Debug/test plugins:         ${enable_test_plugins}"
echo "        Legacy SDL2 interface:      ${enable_sdl2ui}"
echo "        Unfinished plugins:         ${enable_unfinished_plugins}"
if test "x${enable_fixed}" != "xno"; then
echo "        Fixed video buffers:        ${enable_fixed}"
fi
echo -n "        Webcam:                     ${enable_webcam}"
if test "x${enable_webcam}" != "xno"; then
echo " (capture at ${CAP_W}x${CAP_H})"
else
echo
fi
echo "        Flatpak support:            ${enable_flatpak}"

echo
echo " * Input plugins:"
if test "x${os_family}" = "xlinux"; then
yn ${alsa_present} "ALSA"
fi
yn ${jack_present} "JACK Audio"
yn ${osc_present} "OSC Audio"
yn ${sndio_present} "Sndio"
yn ${pulseaudio_present} "PulseAudio"
yn ${esd_present} "eSound"
yn yes "/dev/urandom"
yn ${sndfile_present} "sndfile"
yn ${enable_twip} "twip"
echo "   (Default input plugin: "${DEFAULT_INPUT_PLUGIN}")"

echo
echo " * Output plugins:"
yn ${have_sdl2} "SDL2"
if test "x${enable_sdl2ui}" = "xyes"; then
  echo "   (Default font: "${OSD_FONT}", "${OSD_PTSIZE}"px)"
fi
yn ${caca_present} "libcaca"
if test "x${enable_opengl}" = "xyes"; then
yn ${enable_opengl} "GL"
fi
yn yes "MP4 encoder"
yn yes "RTMP transport"
yn yes "V4L2 loopback device"
echo "   (Default output plugin: "${DEFAULT_OUTPUT_PLUGIN}")"
echo