configure.ac 22.8 KB
Newer Older
1
dnl Jami - configure.ac
2

3
dnl Process this file with autoconf to produce a configure script.
4
AC_PREREQ([2.69])
5
AC_INIT([Jami Daemon],[10.1.0],[jami@gnu.org],[jami])
6

7
8
9
10
11
12
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=""}

13
AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2021]])
14
15
AC_REVISION([$Revision$])

16
dnl Where to find configure files
Adrien Béraud's avatar
Adrien Béraud committed
17
AC_CONFIG_SRCDIR(src/ring_api.cpp)
18
AC_CONFIG_AUX_DIR([build-aux])
19
20
21
22
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST

23
AM_INIT_AUTOMAKE([-Wno-portability subdir-objects])
24
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # required by automake 1.12
25
AC_CONFIG_HEADERS([config.h])
26

27
# Silent build by default. Use make V=1 to increase verbosity
28
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
29

30
dnl debug mode is default-disabled
31
32
33
34
35
36
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 \
37
-Wno-unknown-pragmas -Wformat=2 -O0"
38
   DAEMONCXXFLAGS+=" -g -fno-omit-frame-pointer -Wall -Wextra -Wnon-virtual-dtor \
39
-Wno-unknown-pragmas -Wformat=2 -O0"],
40
41
  [DAEMONCFLAGS+=" -DNDEBUG=1 -O3"
   DAEMONCXXFLAGS+=" -DNDEBUG=1 -O3"])
42

43
44
45
46
47
48
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])])

49
50
51
dnl Check for programs
AC_PROG_CC
AC_PROG_CXX
52
AC_PROG_OBJCXX
53
54
55
56
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
Adrien Béraud's avatar
Adrien Béraud committed
57
AC_LANG(C++)
58

59
60
61
62
dnl
dnl  Check the operating system
dnl
HAVE_WIN64="0"
63
HAVE_IOS="0"
64
65
66
67
68
69
70
71
72
HAVE_OSX="0"

case "${host_os}" in
  "")
    SYS=unknown
    ;;
  linux*)
    SYS=linux
    # Necessary for linking .a to a .so
73
    DAEMONLDFLAGS+=" -Wl,-Bsymbolic"
74
    # Needed for plugin system
75
    DAEMONLDFLAGS+=" -ldl"
76
77
78
    ;;
  darwin*)
    SYS=darwin
Guillaume Roguez's avatar
Guillaume Roguez committed
79
80
81
82
83
84
85
86
    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"])
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
    ;;
  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.])
Edric Milaret's avatar
Edric Milaret committed
102

Edric Milaret's avatar
Edric Milaret committed
103
    AC_DEFINE([WIN32_LEAN_AND_MEAN],[1], [Define to limit the scope of <windows.h>.])
Edric Milaret's avatar
Edric Milaret committed
104

105
106
    DAEMONCPPFLAGS+=" -D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -D__USE_MINGW_ANSI_STDIO=1"
    DAEMONLDFLAGS+=" -Wl,--nxcompat -Wl,--dynamicbase"
107
    LIBS+=" -lws2_32 -lwsock32 -lshlwapi"
108
109
110
111
    ac_default_prefix="`pwd`/_win32"
    DESTDIR="`pwd`/_win32/"
    AC_SUBST(WINDOWS_ARCH)
    AC_SUBST(PROGRAMFILES)
Edric Milaret's avatar
Edric Milaret committed
112
113

    case "${host}" in
114
115
116
      amd64*|x86_64*)
        HAVE_WIN64="1"
        ;;
Edric Milaret's avatar
Edric Milaret committed
117
    esac
118
119
120
121
122
123
124
125
126
    ;;
  *)
    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")
127
128
AM_CONDITIONAL(HAVE_OSX,     test "${HAVE_OSX}" = "1")
AM_CONDITIONAL(HAVE_IOS,     test "${HAVE_IOS}" = "1")
129

130
131
AC_DEFINE([MSGPACK_DISABLE_LEGACY_NIL], [1], [msgpack])

132
133
dnl FIXME this should be deduced automatically
AC_DEFINE_UNQUOTED([HAVE_COREAUDIO],
134
135
136
  `if test "${HAVE_OSX}" = "1" || test "${HAVE_IOS}" = "1"; \
then echo 1; else echo 0; fi`,
   [Define if you have CoreAudio])
137

138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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")

155
156
157
AS_IF([test "$SYS" = linux && test "${HAVE_ANDROID}" != "1"],
  [DAEMONCPPFLAGS+=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"]
  [])
158

159
160
161
162
163
164
165
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 disable-static])
166

Rafaël Carré's avatar
Rafaël Carré committed
167
dnl Define C++ as default language
168
169
170
LT_LANG(C++)

lt_cv_deplibs_check_method=pass_all
yanmorin's avatar
   
yanmorin committed
171

Adrien Béraud's avatar
Adrien Béraud committed
172
173
dnl Check for C++17 support
AX_CXX_COMPILE_STDCXX(17,[ext],[mandatory])
174

Rafaël Carré's avatar
Rafaël Carré committed
175
dnl Check for header files
176
177
178
AC_CHECK_HEADERS([arpa/inet.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])
Rafaël Carré's avatar
Rafaël Carré committed
179
180
181

dnl Check for typedefs, structures, and compiler characteristics
AC_TYPE_PID_T
182

Tristan Matthews's avatar
Tristan Matthews committed
183
PKG_PROG_PKG_CONFIG()
yanmorin's avatar
   
yanmorin committed
184

185
dnl On some OS we need static linking
186
187
188
AS_IF([test -n "${PKG_CONFIG}"],
  [AS_IF([test "${SYS}" = "mingw32" -o "${SYS}" = "darwin"],
     [PKG_CONFIG="${PKG_CONFIG} --static"])])
189

190
191
192
193
194
195
196
197
198
199
200
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])
201

202
dnl define DRING_BUILD because we are building libring, not using it
203
dnl if building shared library, define jami_EXPORTS
204
AC_MSG_CHECKING([if compiling shared library])
205
206
207
DAEMONCPPFLAGS+=" -fvisibility=hidden -DDRING_BUILD"
AS_IF([test "x$enable_shared" == "xyes"],
  [RING_SHARED=yes
208
   DAEMONCPPFLAGS+=" -Djami_EXPORTS"],
209
  [RING_SHARED=no])
210
211
AC_MSG_RESULT([$RING_SHARED])

212
DAEMONCPPFLAGS+=" -DASIO_STANDALONE"
213

214
215
216
217
218
dnl
dnl  Check for the contrib directory
dnl
AC_ARG_WITH(contrib,
  [AS_HELP_STRING([--with-contrib[=DIR]],
219
    [search for 3rd party libraries in DIR/include and DIR/lib])])
220
AC_MSG_CHECKING([for 3rd party libraries path])
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
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!])])])
266
267
AC_SUBST(CONTRIB_DIR)

268
269
dnl Add extras/tools to the PATH
TOOLS_DIR="${srcdir}/extras/tools/build/bin"
270
271
272
AS_IF([test -d "${TOOLS_DIR}"],
  [TOOLS_DIR=`cd "${TOOLS_DIR}" && pwd`
   export PATH="${TOOLS_DIR}":$PATH])
273

aviau's avatar
aviau committed
274
275
276
dnl Check for zlib
PKG_CHECK_MODULES(ZLIB, zlib,, AC_MSG_ERROR([zlib not found]))

277
278
PKG_CHECK_MODULES(LIBGIT2, [libgit2 >= 1.1.0],, AC_MSG_ERROR([Missing libgit2 files]))

279
dnl Check for pjproject
280
281
282
283
284
PKG_CHECK_MODULES(PJPROJECT, libpjproject,,
  AC_MSG_ERROR([Missing pjproject files]))

PKG_CHECK_MODULES([YAMLCPP], [yaml-cpp >= 0.5.1],,
  AC_MSG_ERROR([yaml-cpp not found]))
285

286
287
288
289
290
291
292
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]))
293

294
if test "${HAVE_ANDROID}" = "1"; then
295
296
297
298
299
300
301
302
303
304
305
306
307
  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])
308
309
310
fi
AM_CONDITIONAL([BUILD_OPENSL], test "x$have_opensl" = "xyes")

311
if test "${SYS}" = "linux"; then
312
313
314
  dnl Check for alsa development package - name: libasound2-dev
  ALSA_MIN_VERSION=1.0
  AC_ARG_WITH([alsa],
Guillaume Roguez's avatar
Guillaume Roguez committed
315
316
317
    [AS_HELP_STRING([--without-alsa], [disable support for alsa])],
    [],
    [with_alsa=yes])
318
319
320
  AS_IF([test "x$with_alsa" = "xyes"],
    [PKG_CHECK_MODULES(ALSA, alsa >= ${ALSA_MIN_VERSION},,
       AC_MSG_ERROR([Missing alsa development files]))]);
321

322
323
324
  AC_DEFINE_UNQUOTED([HAVE_ALSA],
    `if test "x$with_alsa" = "xyes"; then echo 1; else echo 0; fi`,
    [Define if you have alsa])
325
fi
326
327
AM_CONDITIONAL(BUILD_ALSA, test "x$with_alsa" = "xyes")

328

329
if test "${SYS}" = "linux"; then
330
331
332
  dnl Check for pulseaudio development package - name: libpulse-dev
  LIBPULSE_MIN_VERSION=0.9.15
  AC_ARG_WITH([pulse],
333
    [AS_HELP_STRING([--without-pulse], [disable support for pulseaudio])],
334
335
336
    [],
    [with_pulse=yes])

337
338
339
  AS_IF([test "x$with_pulse" = "xyes"],
    [PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= ${LIBPULSE_MIN_VERSION},,
     AC_MSG_ERROR([Missing pulseaudio development files]))]);
340

341
342
343
  AC_DEFINE_UNQUOTED([HAVE_PULSE],
    `if test "x$with_pulse" = "xyes"; then echo 1; else echo 0; fi`,
    [Define if you have pulseaudio])
344
fi
345
AM_CONDITIONAL(BUILD_PULSE, test "x$with_pulse" = "xyes")
346

347
AC_ARG_WITH([jack],
348
  AS_HELP_STRING([--without-jack], [Ignore presence of jack and disable it]))
349
350

AS_IF([test "x$with_jack" != "xno"],
351
352
  [PKG_CHECK_MODULES(JACK, jack, [have_jack=yes], [have_jack=no])],
  [have_jack=no])
353
354

AS_IF([test "x$have_jack" = "xyes"],,
355
356
  [AS_IF([test "x$with_jack" = "xyes"],
     [AC_MSG_ERROR([jack requested but not found])])])
357

Edric Milaret's avatar
Edric Milaret committed
358
359
360
dnl check for libportaudio
AS_IF([test "${SYS}" = "mingw32"],[
AC_ARG_WITH([portaudio], [AS_HELP_STRING([--without-portaudio],
361
            [disable support for portaudio])], [], [with_portaudio=yes])])
Edric Milaret's avatar
Edric Milaret committed
362
AS_IF([test "x$with_portaudio" = "xyes"],
363
364
365
  [PKG_CHECK_MODULES(PORTAUDIO, [portaudio-2.0],
    [AC_DEFINE([HAVE_PORTAUDIO], 1, [Define if you have portaudio])],
    [AC_MSG_ERROR([Missing libportaudio development files])])])
366

Edric Milaret's avatar
Edric Milaret committed
367
368
369
AM_CONDITIONAL(BUILD_PORTAUDIO, test "x$with_portaudio" = "xyes")
AM_CONDITIONAL(HAVE_PORTAUDIO, test "x$with_portaudio" = "xyes")

370
371
372
AC_DEFINE_UNQUOTED([HAVE_JACK],
  `if test "x$have_jack" = "xyes"; then echo 1; else echo 0; fi`,
  [Define if you have jack])
373
374
AM_CONDITIONAL(BUILD_JACK, test "x$have_jack" = "xyes")

375
376
377
dnl Coverage is default-disabled
AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [Enable coverage]))

378
379
380
AS_IF([test "x$enable_coverage" = "xyes"],
  [DAEMONCXXFLAGS+=" --coverage"
   DAEMONLDFLAGS+=" --coverage"])
381

382
383
384
# DBUSCPP
dnl Check for dbuscpp, the C++ bindings for D-Bus
AC_ARG_WITH([dbus],
385
386
387
  [AS_HELP_STRING([--without-dbus], [disable support for dbus])],
  [],
  [with_dbus=yes])
388
389
390
AS_IF([test "x$with_dbus" = "xyes"],
  [PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
     AC_MSG_WARN([Missing dbus development files]))
391

392
   AC_CONFIG_FILES([bin/dbus/Makefile])
393

394
395
   AC_PATH_PROG([DBUSXX_XML2CPP], dbusxx-xml2cpp,
     [AC_MSG_ERROR([dbusxx-xml2cpp not found])])
396

397
398
399
400
401
402
   AS_IF([test "x$CLANG" = "xyes"],
     [AC_MSG_ERROR([dbus does not compile when clang is used,
                    rerun with --without-dbus])]);
   AM_CONDITIONAL(RING_DBUS, true)],
  [TESTS= $(check_PROGRAMS)
   AM_CONDITIONAL(RING_DBUS, false)]);
403

Philippe Gorley's avatar
Philippe Gorley committed
404
dnl name service is default-enabled
405
406
AC_ARG_ENABLE([ringns], AS_HELP_STRING([--disable-ringns],
  [Enable Name Service]))
Adrien Béraud's avatar
Adrien Béraud committed
407
AM_CONDITIONAL([RINGNS], test "x$enable_ringns" != "xno")
408
409
410
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])
Adrien Béraud's avatar
Adrien Béraud committed
411
412
413
414
415
416
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]))],
  []);
417

Philippe Gorley's avatar
Philippe Gorley committed
418
419
dnl nodejs module
AC_ARG_WITH([nodejs], AS_HELP_STRING([--with-nodejs], [Enable NodeJS module]))
Adrien Béraud's avatar
Adrien Béraud committed
420
421
AM_CONDITIONAL(ENABLE_NODEJS, [test "x$with_nodejs" = "xyes"])
AM_COND_IF([ENABLE_NODEJS],
422
423
424
  [AC_PATH_PROG(SWIG, swig, "")
   AS_AC_EXPAND(SBINDIR, $sbindir)
   AC_SUBST(SBINDIR)
Adrien Béraud's avatar
Adrien Béraud committed
425
   AC_CONFIG_FILES([bin/nodejs/Makefile])])
Guillaume Roguez's avatar
Guillaume Roguez committed
426

427
dnl Check for libav
428
429
PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 54.31.100,,
  AC_MSG_ERROR([Missing libavutil development files]))
430

431
432
PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 56.60.100,,
  AC_MSG_ERROR([Missing libavcodec development files]))
Philippe Gorley's avatar
Philippe Gorley committed
433
LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
434

435
436
PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 56.40.101,,
  AC_MSG_ERROR([Missing libavformat development files]))
437

438
439
PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 56.4.100,,
  AC_MSG_ERROR([Missing libavdevice development files]))
440

441
442
PKG_CHECK_MODULES(LIBAVFILTER, libavfilter >= 5.40.101,,
  AC_MSG_ERROR([Missing libavfilter development files]))
443

444
445
PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 3.1.101,,
  AC_MSG_ERROR([Missing libswscale development files]))
446

447
448
PKG_CHECK_MODULES(LIBSWRESAMPLE, libswresample >= 1.2.101,,
  AC_MSG_ERROR([Missing libswresample development files]))
449

450
451
452
dnl Jami Plugin is default-enabled
AC_ARG_ENABLE([plugin], AS_HELP_STRING([--disable-plugin], [Disable plugin]))
AS_IF([test "x$enable_plugin" != "xno"],
453
454
455
456
457
  [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]))],
458
459
460
461
462
     [AS_IF([test "$SYS" = darwin],
     [PKG_CHECK_MODULES([MINIZIP], [minizip >= 3.0.0],,
      AC_MSG_ERROR([libminizip not found]))],
     [])]
     )],
463
  [AM_CONDITIONAL(ENABLE_PLUGIN, false)]);
464

Tristan Matthews's avatar
Tristan Matthews committed
465
466
dnl Video is default-enabled
AC_ARG_ENABLE([video], AS_HELP_STRING([--disable-video], [Disable video]))
467

Tristan Matthews's avatar
Tristan Matthews committed
468
AS_IF([test "x$enable_video" != "xno"],
469
470
471
472
473
474
475
476
477
478
479
480
  [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"],
Philippe Gorley's avatar
Philippe Gorley committed
481
  dnl if new hwaccel api is found, activate hardware accel
Philippe Gorley's avatar
Philippe Gorley committed
482
  dnl prefix needs to be different from the one above
483
484
485
486
487
488
489
490
491
492
  [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])])])])],
     [])])
493
494
495
AM_CONDITIONAL([RING_ACCEL], [test "x${ring_accel}" = "xyes"])

dnl check for GnuTLS
496
497
PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.6.7], [], AC_MSG_ERROR([gnutls not found]))
PKG_CHECK_MODULES([NETTLE], [nettle >= 3.0.0], [], AC_MSG_ERROR([nettle not found]))
498
499

# PTHREAD
500
# required dependency: libxpat
501
AX_PTHREAD
502

503
504
dnl Check for libcppunit-dev
CPPUNIT_MIN_VERSION=1.12
505
506
507
PKG_CHECK_MODULES(CPPUNIT, cppunit >= ${CPPUNIT_MIN_VERSION},
  AM_CONDITIONAL(BUILD_TEST, test 1 = 1 ),
  AM_CONDITIONAL(BUILD_TEST, test 0 = 1 ))
508

509

510
# SPEEX CODEC
511
# required dependency: libspeex
512
dnl Check for libspeex
513
AC_ARG_WITH([speex],
514
515
516
  [AS_HELP_STRING([--without-speex], [disable support for speex codec])],
  [],
  [with_speex=yes])
517

518
AS_IF([test "x$with_speex" != xno], [PKG_CHECK_MODULES([SPEEX], [speex])])
519

520
521
522
AC_DEFINE_UNQUOTED([HAVE_SPEEX],
  `if test "x$with_speex" = "xyes"; then echo 1; else echo 0; fi`,
  [Define if you have libspeex])
523
AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
524

525
# SPEEX DSP
526
# required dependency: libspeexdsp
527
dnl check in case the libspeexdsp is not installed
528
AC_ARG_WITH([speexdsp],
529
530
531
532
533
534
535
536
537
538
  [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])
539
540
AM_CONDITIONAL(BUILD_SPEEXDSP, test "x$with_speexdsp" = "xyes" )

541
542
# WEBRTC AUDIO PROCESSING
if test "${SYS}" = "linux"; then
543
544
545
  dnl Check for webrtc-audio-processing development package
  dnl - name: libwebrtc-audio-processing-dev
  AC_ARG_WITH([webrtcap],
546
    [AS_HELP_STRING([--without-webrtcap],
547
548
549
550
551
552
553
554
       [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.1],
      [AC_DEFINE([HAVE_WEBRTC_AP], 1,
         [Define if you have webrtc-audio-processing])],
      [AC_MSG_WARN([Missing webrtc-audio-processing development files])])])
555
556
557
fi
AM_CONDITIONAL([HAVE_WEBRTC_AP], test "x$with_webrtc_ap" = "xyes")

558
dnl check for openDHT
559
PKG_CHECK_MODULES([OPENDHT], [opendht >= 2.2.0],,
Adrien Béraud's avatar
Adrien Béraud committed
560
  AC_MSG_FAILURE([Missing OpenDHT]))
Adrien Béraud's avatar
Adrien Béraud committed
561

562
563
PKG_CHECK_MODULES([SECP256K1], [libsecp256k1 >= 0.1],,
  AC_MSG_FAILURE([Missing secp256k1]))
Adrien Béraud's avatar
Adrien Béraud committed
564

565
566
567
PKG_CHECK_MODULES([FMT], [fmt >= 5.3],,
  AC_MSG_FAILURE([Missing {fmt}]))

Stepan Salenikovich's avatar
Stepan Salenikovich committed
568
569
# LIBUPNP
dnl check for libupnp
Stepan Salenikovich's avatar
Stepan Salenikovich committed
570
AC_ARG_WITH([upnp], [AS_HELP_STRING([--without-upnp],
571
  [disable support for upnp])], [], [with_upnp=yes])
Stepan Salenikovich's avatar
Stepan Salenikovich committed
572

Stepan Salenikovich's avatar
Stepan Salenikovich committed
573
AS_IF([test "x$with_upnp" = "xyes"],
574
575
576
577
  [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])])])
578
AM_CONDITIONAL([BUILD_PUPNP], test "x$with_upnp" = "xyes")
579

Adrien Béraud's avatar
Adrien Béraud committed
580
581
582
# LIBNATPMP
dnl check for libnatpmp
AC_ARG_WITH([natpmp], [AS_HELP_STRING([--without-natpmp],
583
  [disable support for NAT-PMP])], [], [with_natpmp=yes])
Adrien Béraud's avatar
Adrien Béraud committed
584
585

AS_IF([test "x$with_natpmp" != xno],
586
587
588
589
590
591
592
  [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])],
  [])
Adrien Béraud's avatar
Adrien Béraud committed
593

594
595
596
AC_DEFINE_UNQUOTED([HAVE_LIBNATPMP],
  `if test "x$with_natpmp" != xno; then echo 1; else echo 0; fi`,
  [Define if you have libnatpmp])
597
AM_CONDITIONAL([BUILD_NATPMP], test "x$with_natpmp" = "xyes")
Adrien Béraud's avatar
Adrien Béraud committed
598

599
600
601
602
AC_DEFINE_UNQUOTED([HAVE_SHM],
  `if test -z "${HAVE_LINUX_TRUE}" && \
test -z "${HAVE_ANDROID_FALSE}"; then echo 1; else echo 0; fi`,
  [Define if you have shared memory support])
603

604
605
# DOXYGEN
# required dependency(ies): doxygen
606
607
608
# check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
# ----------------------------------------------------------------------------
AC_DEFUN([BB_ENABLE_DOXYGEN],
609
610
611
612
613
614
615
616
617
618
619
620
621
  [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([could not find doxygen])
     AC_PATH_PROG(DOT, dot, , $PATH)
     test x$DOT = x -a "x$enable_dot" = xyes && AC_MSG_ERROR([could not find dot])
   fi
   AM_CONDITIONAL(ENABLE_DOXYGEN, test "x$DOXYGEN" != "x")])
622

623
624
# Actually perform the doxygen check
BB_ENABLE_DOXYGEN
625

626
AC_CONFIG_FILES([Makefile \
627
                 bin/Makefile \
628
629
630
                 src/Makefile \
                 src/sip/Makefile \
                 src/im/Makefile \
Adrien Béraud's avatar
Adrien Béraud committed
631
632
633
                 src/jamidht/Makefile \
                 src/jamidht/eth/libdevcore/Makefile \
                 src/jamidht/eth/libdevcrypto/Makefile \
634
635
636
637
638
639
640
                 src/media/Makefile \
                 src/media/audio/Makefile \
                 src/media/audio/pulseaudio/Makefile \
                 src/media/audio/alsa/Makefile \
                 src/media/audio/opensl/Makefile \
                 src/media/audio/jack/Makefile \
                 src/media/audio/coreaudio/Makefile \
Edric Milaret's avatar
Edric Milaret committed
641
                 src/media/audio/portaudio/Makefile \
642
                 src/media/audio/sound/Makefile \
643
                 src/media/audio/echo-cancel/Makefile \
644
                 src/config/Makefile \
645
                 src/client/Makefile \
646
647
                 src/media/video/Makefile \
                 src/media/video/v4l2/Makefile \
648
                 src/media/video/androidvideo/Makefile \
649
                 src/media/video/osxvideo/Makefile \
650
                 src/media/video/iosvideo/Makefile \
Edric Milaret's avatar
Edric Milaret committed
651
                 src/media/video/winvideo/Makefile \
652
                 src/plugin/Makefile \
653
                 src/security/Makefile \
Stepan Salenikovich's avatar
Stepan Salenikovich committed
654
                 src/upnp/Makefile \
655
656
657
                 src/upnp/protocol/Makefile \
                 src/upnp/protocol/natpmp/Makefile \
                 src/upnp/protocol/pupnp/Makefile \
658
                 ringtones/Makefile \
Guillaume Roguez's avatar
Guillaume Roguez committed
659
                 test/Makefile\
660
                 test/sip/Makefile
661
                 test/unitTest/Makefile \
662
                 test/agent/Makefile \
663
664
665
                 man/Makefile \
                 doc/Makefile \
                 doc/doxygen/Makefile])
666

667
668
669
670
671
672
673
dnl Transfer the Automake variables set here to Makefile.in.
echo DAEMONCPPFLAGS=$DAEMONCPPFLAGS
AC_SUBST([AM_CPPFLAGS], [$DAEMONCPPFLAGS])
AC_SUBST([AM_CFLAGS],   [$DAEMONCFLAGS])
AC_SUBST([AM_CXXFLAGS], [$DAEMONCXXFLAGS])
AC_SUBST([AM_LDFLAGS],  [$DAEMONLDFLAGS])

674
# Go!
Rafaël Carré's avatar
Rafaël Carré committed
675
AC_OUTPUT