-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
configure.ac
690 lines (576 loc) · 23.1 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
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
dnl Jami - configure.ac
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([Jami Daemon],[15.3.0],[[email protected]],[jami])
dnl Clear the implicit flags that default to '-g -O2', otherwise they
dnl take precedence over the values we set via the
dnl DAEMONCFLAGS/DAEMONCXXFLAGS variables below.
: ${CFLAGS=""}
: ${CXXFLAGS=""}
AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux Inc. 2004-2023]])
AC_REVISION([$Revision$])
dnl Where to find configure files
AC_CONFIG_SRCDIR(src/ring_api.cpp)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([-Wno-portability subdir-objects foreign])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # required by automake 1.12
AC_CONFIG_HEADERS([config.h])
# Silent build by default. Use make V=1 to increase verbosity
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
dnl debug mode is default-disabled
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[Build in debug mode, adds stricter warnings, disables optimization]))
AS_IF([test "x$enable_debug" = "xyes"],
[DAEMONCFLAGS+=" -g -fno-omit-frame-pointer -Wall -Wextra -Wnon-virtual-dtor -Wno-deprecated -Wno-deprecated-declarations \
-Wno-unknown-pragmas -Wformat=2 -O0"
DAEMONCXXFLAGS+=" -g -fno-omit-frame-pointer -Wall -Wextra -Wnon-virtual-dtor -Wno-deprecated -Wno-deprecated-declarations \
-Wno-unknown-pragmas -Wformat=2 -O0"],
[DAEMONCFLAGS+=" -DNDEBUG=1 -O3"
DAEMONCXXFLAGS+=" -DNDEBUG=1 -O3 -Wno-deprecated"])
dnl Build using address sanitizer
AC_ARG_ENABLE([asan],
AS_HELP_STRING([--enable-asan],
[Enable address sanitization]))
AS_IF([test "x$enable_asan" = "xyes"],
[DAEMONCXXFLAGS+=" -fsanitize=address -fno-omit-frame-pointer"
DAEMONLDFLAGS+=" -fsanitize=address"
AC_MSG_NOTICE([WARNING: Address sanitization enabled for libjami])], [])
AC_ARG_ENABLE([fuzzing],
AS_HELP_STRING([--enable-fuzzing],
[Build fuzzing tools]))
AM_CONDITIONAL([ENABLE_FUZZING], [test "x$enable_fuzzing" = "xyes"])
AM_COND_IF([ENABLE_FUZZING], [AC_CONFIG_FILES([test/fuzzing/Makefile])])
AC_ARG_ENABLE([agent],
AS_HELP_STRING([--enable-agent],
[Build agent]))
AM_CONDITIONAL([ENABLE_AGENT], [test "x$enable_agent" = "xyes"])
AM_COND_IF([ENABLE_AGENT],
[AC_CONFIG_FILES([test/agent/Makefile
test/agent/pre-inst-env:test/agent/build-aux/pre-inst-env.in
test/agent/scenarios/bulk-calls/run-scenario],
[chmod +x test/agent/pre-inst-env
chmod +x test/agent/scenarios/bulk-calls/run-scenario])])
AC_ARG_ENABLE([tracepoints], AS_HELP_STRING([--enable-tracepoints], [Enable tracepoints]))
AS_IF([test "x$enable_tracepoints" = "xyes"],
[AC_DEFINE(ENABLE_TRACEPOINTS, [], [Static tracepoints enabled])
AM_CONDITIONAL(ENABLE_TRACEPOINTS, true)],
[AM_CONDITIONAL(ENABLE_TRACEPOINTS, false)])
dnl Check for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_OBJCXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_LANG(C++)
dnl
dnl Check the operating system
dnl
HAVE_WIN64="0"
HAVE_IOS="0"
HAVE_OSX="0"
case "${host_os}" in
"")
SYS=unknown
;;
linux*)
SYS=linux
# Necessary for linking .a to a .so
DAEMONLDFLAGS+=" -Wl,-Bsymbolic"
# Needed for plugin system
DAEMONLDFLAGS+=" -ldl"
;;
darwin*)
SYS=darwin
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#import <TargetConditionals.h>
#if TARGET_OS_IPHONE == 0
#error this is not an IPHONE
#endif
]])],
[HAVE_IOS="1"],
[HAVE_OSX="1"])
;;
mingw32*)
SYS=mingw32
AC_CHECK_TOOL(WINDRES, windres, :)
AC_CHECK_TOOL(OBJCOPY, objcopy, :)
AC_DEFINE([_UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
AC_DEFINE([UNICODE], [1], [Define to 1 for Unicode (Wide Chars) APIs.])
AC_DEFINE([_ISOC99_SOURCE], [1], [Extensions to ISO C89 from ISO C99.])
AC_DEFINE([_ISOC11_SOURCE], [1], [Extensions to ISO C99 from ISO C11.])
AC_DEFINE([_POSIX_SOURCE], [1], [IEEE Std 1003.1.])
AC_DEFINE([_POSIX_C_SOURCE], [200809L], [IEEE Std 1003.1.])
AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition])
AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], [XPG things and X/Open Unix extensions.])
AC_DEFINE([_BSD_SOURCE], [1], [ISO C, POSIX, and 4.3BSD things.])
AC_DEFINE([_SVID_SOURCE], [1], [ISO C, POSIX, and SVID things.])
AC_DEFINE([WIN32_LEAN_AND_MEAN],[1], [Define to limit the scope of <windows.h>.])
DAEMONCPPFLAGS+=" -D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -D__USE_MINGW_ANSI_STDIO=1"
DAEMONLDFLAGS+=" -Wl,--nxcompat -Wl,--dynamicbase"
LIBS+=" -lws2_32 -lwsock32 -lshlwapi"
ac_default_prefix="`pwd`/_win32"
DESTDIR="`pwd`/_win32/"
AC_SUBST(WINDOWS_ARCH)
AC_SUBST(PROGRAMFILES)
case "${host}" in
amd64*|x86_64*)
HAVE_WIN64="1"
;;
esac
;;
*)
SYS="${host_os}"
;;
esac
AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin")
AM_CONDITIONAL(HAVE_LINUX, test "${SYS}" = "linux")
AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32")
AM_CONDITIONAL(HAVE_WIN64, test "${HAVE_WIN64}" = "1")
AM_CONDITIONAL(HAVE_OSX, test "${HAVE_OSX}" = "1")
AM_CONDITIONAL(HAVE_IOS, test "${HAVE_IOS}" = "1")
AS_IF([test "${HAVE_OSX}" = "1"],
[DAEMONCFLAGS+=" -arch $ARCH"
DAEMONCXXFLAGS+=" -arch $ARCH"]
[])
AC_DEFINE([MSGPACK_DISABLE_LEGACY_NIL], [1], [msgpack])
dnl FIXME this should be deduced automatically
AC_DEFINE_UNQUOTED([HAVE_COREAUDIO],
`if test "${HAVE_OSX}" = "1" || test "${HAVE_IOS}" = "1"; \
then echo 1; else echo 0; fi`,
[Define if you have CoreAudio])
dnl Android is linux, but a bit different
AS_IF([test "$SYS" = linux],[
AC_MSG_CHECKING([for an Android system])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
[[#ifndef __ANDROID__
# error Not Android
#endif
]],[[;]])
],[
HAVE_ANDROID="1"
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
])
])
AM_CONDITIONAL(HAVE_ANDROID, test "${HAVE_ANDROID}" = "1")
AS_IF([test "$SYS" = linux && test "${HAVE_ANDROID}" != "1"],
[DAEMONCPPFLAGS+=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"]
[])
dnl override platform specific check for dependent libraries
dnl otherwise libtool linking of shared libraries will
dnl fail on anything other than pass_all.
AC_CACHE_VAL(lt_cv_deplibs_check_method,
[lt_cv_deplibs_check_method=pass_all])
LT_INIT([dlopen win32-dll shared static])
dnl Define C++ as default language
LT_LANG(C++)
lt_cv_deplibs_check_method=pass_all
dnl Check for C++17 support
AX_CXX_COMPILE_STDCXX(17,[ext],[mandatory])
dnl Check for header files
AC_CHECK_HEADERS([arpa/inet.h cxxabi.h fcntl.h libintl.h limits.h \
netdb.h netinet/in.h stdlib.h string.h \
sys/ioctl.h sys/socket.h sys/time.h unistd.h])
dnl Check for typedefs, structures, and compiler characteristics
AC_TYPE_PID_T
PKG_PROG_PKG_CONFIG()
dnl On some OS we need static linking
AS_IF([test -n "${PKG_CONFIG}"],
[AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin"],
[PKG_CONFIG="${PKG_CONFIG} --static"])])
dnl Check if we are using clang
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes], [CLANG=no])
AC_MSG_RESULT([$CLANG])
dnl define LIBJAMI_BUILD because we are building libjami, not using it
dnl if building shared library, define jami_EXPORTS
AC_MSG_CHECKING([if compiling shared library])
DAEMONCPPFLAGS+=" -fvisibility=hidden -DLIBJAMI_BUILD"
AS_IF([test "x$enable_shared" == "xyes"],
[RING_SHARED=yes
DAEMONCPPFLAGS+=" -Djami_EXPORTS"],
[RING_SHARED=no])
AC_MSG_RESULT([$RING_SHARED])
DAEMONCPPFLAGS+=" -DASIO_STANDALONE -DMSGPACK_NO_BOOST"
dnl
dnl Check for the contrib directory
dnl
AC_ARG_WITH(contrib,
[AS_HELP_STRING([--with-contrib[=DIR]],
[search for 3rd party libraries in DIR/include and DIR/lib])])
AC_MSG_CHECKING([for 3rd party libraries path])
AS_IF([test -z "${with_contrib}" || test "${with_contrib}" = "yes"],
[CONTRIB_DIR="${srcdir}/contrib/${host}"
AS_IF([test ! -d "${CONTRIB_DIR}"],
[echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
AS_IF([test ! -d "${CONTRIB_DIR}"],
[echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
CONTRIB_DIR=""
AC_MSG_RESULT([not found])])])],
[AS_IF([test "${with_contrib}" != "no"],
[CONTRIB_DIR="${with_contrib}"],
[CONTRIB_DIR=""
AC_MSG_RESULT([disabled])])])
AS_IF([test -n "${CONTRIB_DIR}"],
[AS_IF([test -d "${CONTRIB_DIR}/lib"],
[CONTRIB_DIR=`cd "${CONTRIB_DIR}" && pwd`],
[echo "${CONTRIB_DIR}/lib not found" >&AS_MESSAGE_LOG_FD
CONTRIB_DIR=""
AC_MSG_RESULT([not usable])])])
AS_IF([test -n "${CONTRIB_DIR}"],
[AC_MSG_RESULT([${CONTRIB_DIR}])
export PATH=${CONTRIB_DIR}/bin:$PATH
DAEMONCPPFLAGS+=" -I${CONTRIB_DIR}/include -DPJ_AUTOCONF=1"
AS_IF([test "${HAVE_WIN64}" = "1"],
[DAEMONCPPFLAGS+=" -DPJ_WIN64=1"])
AS_IF([test "${SYS}" = "mingw32"],
[PKG_CONFIG_PATH_CUSTOM="${CONTRIB_DIR}/lib/pkgconfig:\
${CONTRIB_DIR}/lib64/pkgconfig"
AC_SUBST(PKG_CONFIG_PATH_CUSTOM)
export PKG_CONFIG_PATH_CUSTOM])
export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:\
${CONTRIB_DIR}/lib64/pkgconfig:$PKG_CONFIG_PATH"
DAEMONLDFLAGS+=" -L${CONTRIB_DIR}/lib"
AS_IF([test "${SYS}" = "darwin"],
[export LD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="${CONTRIB_DIR}/lib:$DYLD_LIBRARY_PATH"])],
[AS_IF([test -n "${with_contrib}" && test "${with_contrib}" != "no"],
[AC_MSG_ERROR([Third party libraries not found!])])])
AC_SUBST(CONTRIB_DIR)
dnl Add extras/tools to the PATH
TOOLS_DIR="${srcdir}/extras/tools/build/bin"
AS_IF([test -d "${TOOLS_DIR}"],
[TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
export PATH="${TOOLS_DIR}":$PATH])
dnl Check for zlib
PKG_CHECK_MODULES(ZLIB, zlib,, AC_MSG_ERROR([zlib not found]))
PKG_CHECK_MODULES(LIBGIT2, [libgit2 >= 1.1.0],, AC_MSG_ERROR([Missing libgit2 files]))
dnl Check for pjproject
PKG_CHECK_MODULES(PJPROJECT, libpjproject,,
AC_MSG_ERROR([Missing pjproject files]))
dnl Guile
AM_COND_IF([ENABLE_AGENT],
[PKG_CHECK_MODULES(GUILE, [guile-3.0 >= 3.0.7],, AC_MSG_ERROR([Missing guile files]))],)
PKG_CHECK_MODULES([YAMLCPP], [yaml-cpp >= 0.5.1],,
AC_MSG_ERROR([yaml-cpp not found]))
PKG_CHECK_MODULES([JSONCPP], [jsoncpp >= 1.6.5],
[DAEMONCPPFLAGS+=" ${JSONCPP_CFLAGS}"
DAEMONLDFLAGS+=" ${JSONCPP_LIBS}"],
AC_MSG_ERROR([jsoncpp not found]))
if test "${HAVE_ANDROID}" = "1"; then
dnl Check for OpenSL
AC_ARG_WITH([opensl],
AS_HELP_STRING([--without-opensl],
[Ignore presence of opensl and disable it]))
AS_IF([test "x$with_opensl" != "xno"],
[AC_CHECK_HEADER(["SLES/OpenSLES.h"],
[have_opensl=yes], [have_opensl=no])],
[have_opensl=no])
AC_DEFINE_UNQUOTED([HAVE_OPENSL],
`if test "x$have_opensl" = "xyes"; then echo 1; else echo 0; fi`,
[Define if you have OpenSL])
fi
AM_CONDITIONAL([BUILD_OPENSL], test "x$have_opensl" = "xyes")
if test "${SYS}" = "linux"; then
dnl Check for alsa development package - name: libasound2-dev
ALSA_MIN_VERSION=1.0
AC_ARG_WITH([alsa],
[AS_HELP_STRING([--without-alsa], [disable support for alsa])],
[],
[with_alsa=yes])
AS_IF([test "x$with_alsa" = "xyes"],
[PKG_CHECK_MODULES(ALSA, alsa >= ${ALSA_MIN_VERSION},,
AC_MSG_ERROR([Missing alsa development files]))]);
AC_DEFINE_UNQUOTED([HAVE_ALSA],
`if test "x$with_alsa" = "xyes"; then echo 1; else echo 0; fi`,
[Define if you have alsa])
fi
AM_CONDITIONAL(BUILD_ALSA, test "x$with_alsa" = "xyes")
if test "${SYS}" = "linux"; then
dnl Check for pulseaudio development package - name: libpulse-dev
LIBPULSE_MIN_VERSION=0.9.15
AC_ARG_WITH([pulse],
[AS_HELP_STRING([--without-pulse], [disable support for pulseaudio])],
[],
[with_pulse=yes])
AS_IF([test "x$with_pulse" = "xyes"],
[PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= ${LIBPULSE_MIN_VERSION},,
AC_MSG_ERROR([Missing pulseaudio development files]))]);
AC_DEFINE_UNQUOTED([HAVE_PULSE],
`if test "x$with_pulse" = "xyes"; then echo 1; else echo 0; fi`,
[Define if you have pulseaudio])
fi
AM_CONDITIONAL(BUILD_PULSE, test "x$with_pulse" = "xyes")
AC_ARG_WITH([jack],
AS_HELP_STRING([--without-jack], [Ignore presence of jack and disable it]))
AS_IF([test "x$with_jack" != "xno"],
[PKG_CHECK_MODULES(JACK, jack, [have_jack=yes], [have_jack=no])],
[have_jack=no])
AS_IF([test "x$have_jack" = "xyes"],,
[AS_IF([test "x$with_jack" = "xyes"],
[AC_MSG_ERROR([jack requested but not found])])])
dnl check for libportaudio
AS_IF([test "${SYS}" = "mingw32"],[
AC_ARG_WITH([portaudio], [AS_HELP_STRING([--without-portaudio],
[disable support for portaudio])], [], [with_portaudio=yes])])
AS_IF([test "x$with_portaudio" = "xyes"],
[PKG_CHECK_MODULES(PORTAUDIO, [portaudio-2.0],
[AC_DEFINE([HAVE_PORTAUDIO], 1, [Define if you have portaudio])],
[AC_MSG_ERROR([Missing libportaudio development files])])])
AM_CONDITIONAL(BUILD_PORTAUDIO, test "x$with_portaudio" = "xyes")
AM_CONDITIONAL(HAVE_PORTAUDIO, test "x$with_portaudio" = "xyes")
AC_DEFINE_UNQUOTED([HAVE_JACK],
`if test "x$have_jack" = "xyes"; then echo 1; else echo 0; fi`,
[Define if you have jack])
AM_CONDITIONAL(BUILD_JACK, test "x$have_jack" = "xyes")
dnl Coverage is default-disabled
AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [Enable coverage]))
AS_IF([test "x$enable_coverage" = "xyes"],
[DAEMONCXXFLAGS+=" --coverage"
DAEMONLDFLAGS+=" --coverage"])
# SDBUSCPP
dnl Check for sdbus-c++, the C++ bindings for D-Bus
AC_ARG_WITH([dbus],
[AS_HELP_STRING([--without-dbus], [disable support for dbus])],
[],
[with_dbus=yes])
AS_IF([test "x$with_dbus" = "xyes"],
[PKG_CHECK_MODULES(SDBUSCPP, [sdbus-c++],,
AC_MSG_ERROR([sdbus-c++ not found]))
AC_CONFIG_FILES([bin/dbus/Makefile])
AC_PATH_PROG([SDBUSCPP_XML2CPP], [sdbus-c++-xml2cpp],
[AC_MSG_ERROR([dbusxx-xml2cpp not found])])
AM_CONDITIONAL(RING_DBUS, true)],
[TESTS= $(check_PROGRAMS)
AM_CONDITIONAL(RING_DBUS, false)]);
dnl name service is default-enabled
AC_ARG_ENABLE([ringns], AS_HELP_STRING([--disable-ringns],
[Enable Name Service]))
AM_CONDITIONAL([RINGNS], test "x$enable_ringns" != "xno")
AC_DEFINE_UNQUOTED([HAVE_RINGNS],
`if test "x$enable_ringns" != "xno"; then echo 1; else echo 0; fi`,
[Define if you use the Name Service])
AM_COND_IF([RINGNS],
[PKG_CHECK_MODULES(LIBCRYPTO, libcrypto,,
AC_MSG_ERROR([Missing libcrypto development files]))
PKG_CHECK_MODULES(LIBSSL, libssl,,
AC_MSG_ERROR([Missing libssl development files]))],
[]);
dnl nodejs module
AC_ARG_WITH([nodejs], AS_HELP_STRING([--with-nodejs], [Enable NodeJS module]))
AM_CONDITIONAL(ENABLE_NODEJS, [test "x$with_nodejs" = "xyes"])
AM_COND_IF([ENABLE_NODEJS],
[AC_PATH_PROG(SWIG, swig, "")
AS_AC_EXPAND(SBINDIR, $sbindir)
AC_SUBST(SBINDIR)
AC_CONFIG_FILES([bin/nodejs/Makefile])])
dnl Check for libav
PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 54.31.100,,
AC_MSG_ERROR([Missing libavutil development files]))
PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 56.60.100,,
AC_MSG_ERROR([Missing libavcodec development files]))
LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 56.40.101,,
AC_MSG_ERROR([Missing libavformat development files]))
PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 56.4.100,,
AC_MSG_ERROR([Missing libavdevice development files]))
PKG_CHECK_MODULES(LIBAVFILTER, libavfilter >= 5.40.101,,
AC_MSG_ERROR([Missing libavfilter development files]))
PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 3.1.101,,
AC_MSG_ERROR([Missing libswscale development files]))
PKG_CHECK_MODULES(LIBSWRESAMPLE, libswresample >= 1.2.101,,
AC_MSG_ERROR([Missing libswresample development files]))
dnl Jami Plugin is default-enabled
AC_ARG_ENABLE([plugin], AS_HELP_STRING([--disable-plugin], [Disable plugin]))
AS_IF([test "x$enable_plugin" != "xno"],
[AC_DEFINE(ENABLE_PLUGIN, [], [Jami Plugin support enabled])
AM_CONDITIONAL(ENABLE_PLUGIN, true)
AS_IF([test "$SYS" = linux],
[PKG_CHECK_MODULES([ARCHIVE], [libarchive >= 3.0],,
AC_MSG_ERROR([libarchive not found]))],
[AS_IF([test "$SYS" = darwin],
[PKG_CHECK_MODULES([MINIZIP], [minizip >= 3.0.0],,
AC_MSG_ERROR([libminizip not found]))],
[])]
)],
[AM_CONDITIONAL(ENABLE_PLUGIN, false)]);
dnl Video is default-enabled
AC_ARG_ENABLE([video], AS_HELP_STRING([--disable-video], [Disable video]))
AS_IF([test "x$enable_video" != "xno"],
[AC_DEFINE(ENABLE_VIDEO, [], [Video support enabled])
AM_CONDITIONAL(ENABLE_VIDEO, true)
AS_IF([test "$SYS" = linux && test -z "${HAVE_ANDROID_FALSE}"],
[PKG_CHECK_MODULES(UDEV, libudev,,
AC_MSG_ERROR([Missing libudev development files]))],
[])],
[AM_CONDITIONAL(ENABLE_VIDEO, false)]);
AC_ARG_ENABLE([accel],
AS_HELP_STRING([--disable-accel],
[Disable all hardware accelerations (enabled by default)]))
AS_IF([test "x$enable_video" != "xno" -a "x$enable_accel" != "xno"],
dnl if new hwaccel api is found, activate hardware accel
dnl prefix needs to be different from the one above
[PKG_CHECK_MODULES(AVUTIL, libavutil >= 55.75.100,
[ring_accel="yes"
AC_DEFINE([RING_ACCEL], [1], [Hardware acceleration is enabled])
AS_IF([test "${SYS}" = "darwin"],
[AC_CHECK_HEADER([VideoToolbox/VideoToolbox.h],
[AC_CHECK_HEADER([libavcodec/videotoolbox.h],
[ring_vt="yes"
AC_DEFINE([ENABLE_VIDEOTOOLBOX], [1],
[Defined if videotoolbox is available])])])])],
[])])
AM_CONDITIONAL([RING_ACCEL], [test "x${ring_accel}" = "xyes"])
dnl check for GnuTLS
PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.7.4], [], AC_MSG_ERROR([gnutls not found]))
PKG_CHECK_MODULES([NETTLE], [nettle >= 3.0.0], [], AC_MSG_ERROR([nettle not found]))
# PTHREAD
# required dependency: libxpat
AX_PTHREAD
dnl Check for libcppunit-dev
CPPUNIT_MIN_VERSION=1.12
PKG_CHECK_MODULES(CPPUNIT, cppunit >= ${CPPUNIT_MIN_VERSION},
AM_CONDITIONAL(BUILD_TEST, test 1 = 1 ),
AM_CONDITIONAL(BUILD_TEST, test 0 = 1 ))
# SPEEX CODEC
# required dependency: libspeex
dnl Check for libspeex
AC_ARG_WITH([speex],
[AS_HELP_STRING([--without-speex], [disable support for speex codec])],
[],
[with_speex=yes])
AS_IF([test "x$with_speex" != xno], [PKG_CHECK_MODULES([SPEEX], [speex])])
AC_DEFINE_UNQUOTED([HAVE_SPEEX],
`if test "x$with_speex" = "xyes"; then echo 1; else echo 0; fi`,
[Define if you have libspeex])
AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
# SPEEX DSP
# required dependency: libspeexdsp
dnl check in case the libspeexdsp is not installed
AC_ARG_WITH([speexdsp],
[AS_HELP_STRING([--without-speexdsp],
[disable support for speexdp Noise Suppression and Automatic Gain Control])],
[],
[with_speexdsp=yes])
AS_IF([test "x$with_speexdsp" != xno],
[PKG_CHECK_MODULES([SPEEXDSP], [speexdsp])])
AC_DEFINE_UNQUOTED([HAVE_SPEEXDSP],
`if test "x$with_speexdsp" = "xyes"; then echo 1; else echo 0; fi`,
[Define if you have libspeexdsp])
AM_CONDITIONAL(BUILD_SPEEXDSP, test "x$with_speexdsp" = "xyes" )
# WEBRTC AUDIO PROCESSING
if test "${SYS}" = "linux"; then
dnl Check for webrtc-audio-processing development package
dnl - name: libwebrtc-audio-processing-dev
AC_ARG_WITH([webrtcap],
[AS_HELP_STRING([--without-webrtcap],
[disable support for webrtc-audio-processing])],
[], [with_webrtc_ap=yes])
AS_IF([test "x$with_webrtc_ap" = "xyes"],
[PKG_CHECK_MODULES(WEBRTC, [webrtc-audio-processing >= 0.3],
[AC_DEFINE([HAVE_WEBRTC_AP], 1,
[Define if you have webrtc-audio-processing])],
[AC_MSG_WARN([Missing webrtc-audio-processing development files])])])
fi
AM_CONDITIONAL([HAVE_WEBRTC_AP], test "x$with_webrtc_ap" = "xyes")
dnl check for openDHT
PKG_CHECK_MODULES([OPENDHT], [opendht >= 2.3.2],,
AC_MSG_FAILURE([Missing OpenDHT]))
PKG_CHECK_MODULES([DHTNET], [dhtnet],,
AC_MSG_FAILURE([Missing DhtNet]))
PKG_CHECK_MODULES([SECP256K1], [libsecp256k1 >= 0.1],,
AC_MSG_FAILURE([Missing secp256k1]))
PKG_CHECK_MODULES([FMT], [fmt >= 7.0],,
AC_MSG_FAILURE([Missing {fmt}]))
# LIBUPNP
dnl check for libupnp
AC_ARG_WITH([upnp], [AS_HELP_STRING([--without-upnp],
[disable support for upnp])], [], [with_upnp=yes])
AS_IF([test "x$with_upnp" = "xyes"],
[PKG_CHECK_MODULES(LIBUPNP, [libupnp],
[AC_DEFINE([HAVE_LIBUPNP], 1, [Define if you have libupnp])],
[AC_MSG_WARN([Missing libupnp development files])
AC_DEFINE([HAVE_LIBUPNP], 0, [Define if you have libupnp])])])
AM_CONDITIONAL([BUILD_PUPNP], test "x$with_upnp" = "xyes")
# LIBNATPMP
dnl check for libnatpmp
AC_ARG_WITH([natpmp], [AS_HELP_STRING([--without-natpmp],
[disable support for NAT-PMP])], [], [with_natpmp=yes])
AS_IF([test "x$with_natpmp" != xno],
[AC_CHECK_HEADER([natpmp.h],
AC_CHECK_LIB([natpmp], [initnatpmp], [], [with_natpmp=no]),
[AC_MSG_WARN([Unable to find the libnatpmp headers
(you may need to install the dev package). You may use
--without-natpmp to compile without NAT-PMP support.]);
with_natpmp=no])],
[])
AC_DEFINE_UNQUOTED([HAVE_LIBNATPMP],
`if test "x$with_natpmp" != xno; then echo 1; else echo 0; fi`,
[Define if you have libnatpmp])
AM_CONDITIONAL([BUILD_NATPMP], test "x$with_natpmp" != "xno")
# SHM
dnl check for shm
AS_IF([test "x$with_dbus" == xyes],
AC_DEFINE([ENABLE_SHM], [1], [Define if you have shared memory support]))
# LTTNG
AM_COND_IF([ENABLE_TRACEPOINTS],
[PKG_CHECK_MODULES(LTTNG, [lttng-ust >= 2.13],, AC_MSG_ERROR([Missing lttng-ust]))
PKG_CHECK_MODULES(LIBURCU, [liburcu >= 0.13.1],, AC_MSG_ERROR([Missng liburcu]))])
# DOXYGEN
# required dependency(ies): doxygen
# check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
# ----------------------------------------------------------------------------
AC_DEFUN([BB_ENABLE_DOXYGEN],
[AC_ARG_ENABLE(doxygen,
[AS_HELP_STRING([--enable-doxygen],
[enable documentation generation with doxygen (disabled by default)])])
AC_ARG_ENABLE(dot,
[AS_HELP_STRING([--enable-dot],
[use 'dot' to generate graphs in doxygen (auto)])])
if test "x$enable_doxygen" = xyes; then
AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
test x$DOXYGEN = x && AC_MSG_ERROR([unable to find doxygen])
AC_PATH_PROG(DOT, dot, , $PATH)
test x$DOT = x -a "x$enable_dot" = xyes && AC_MSG_ERROR([unable to find dot])
fi
AM_CONDITIONAL(ENABLE_DOXYGEN, test "x$DOXYGEN" != "x")])
# Actually perform the doxygen check
BB_ENABLE_DOXYGEN
AC_CONFIG_FILES([Makefile \
bin/Makefile \
src/Makefile \
ringtones/Makefile \
test/Makefile\
test/sip/Makefile
test/unitTest/Makefile \
man/Makefile \
doc/Makefile \
doc/doxygen/Makefile
jami.pc])
dnl Transfer the Automake variables set here to Makefile.in.
echo DAEMONCPPFLAGS=$DAEMONCPPFLAGS
AS_IF([test "${HAVE_OSX}" = "1"],
[CXXFLAGS="$DAEMONCXXFLAGS"
OBJCXX="$CXX $DAEMONCXXFLAGS"
OBJCXXFLAG="$CXX $DAEMONCXXFLAGS"]
[])
AC_SUBST([AM_CPPFLAGS], [$DAEMONCPPFLAGS])
AC_SUBST([AM_CFLAGS], [$DAEMONCFLAGS])
AC_SUBST([AM_CXXFLAGS], [$DAEMONCXXFLAGS])
AC_SUBST([AM_LDFLAGS], [$DAEMONLDFLAGS])
# Go!
AC_OUTPUT