configure.ac 21.9 KB
Newer Older
1
dnl Ring - configure.ac for automake 1.9 and autoconf 2.59
2

3
dnl Process this file with autoconf to produce a configure script.
4
AC_PREREQ([2.65])
Guillaume Roguez's avatar
Guillaume Roguez committed
5
AC_INIT([Ring],[2.3.0],[ring@lists.savoirfairelinux.net],[ring])
6

Guillaume Roguez's avatar
Guillaume Roguez committed
7
AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2015]])
8 9
AC_REVISION([$Revision$])

10
dnl Where to find configure files
Adrien Béraud's avatar
Adrien Béraud committed
11
AC_CONFIG_SRCDIR(src/ring_api.cpp)
12
AC_CONFIG_AUX_DIR([build-aux])
13 14 15 16
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST

17
AM_INIT_AUTOMAKE([-Wno-portability])
18
m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # required by automake 1.12
19
AC_CONFIG_HEADERS([config.h])
20

21
# Silent build by default. Use make V=1 to increase verbosity
22
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
23

24 25 26
dnl Check for programs
AC_PROG_CC
AC_PROG_CXX
27
AC_PROG_OBJCXX
28 29 30 31 32
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

33 34 35 36
dnl
dnl  Check the operating system
dnl
HAVE_WIN64="0"
37
HAVE_IOS="0"
38 39 40 41 42 43 44 45 46 47
HAVE_OSX="0"

case "${host_os}" in
  "")
    SYS=unknown
    ;;
  linux*)
    SYS=linux
    # Necessary for linking .a to a .so
    LDFLAGS+=" -Wl,-Bsymbolic"
48 49
    # Needed for plugin system
    LDFLAGS+=" -ldl"
50 51 52
    ;;
  darwin*)
    SYS=darwin
53 54 55 56 57 58 59 60

    AC_EGREP_CPP(yes,
            [#import <TargetConditionals.h>
             #if TARGET_OS_IPHONE
             yes
             #endif],
             [HAVE_IOS="1"],
             [HAVE_OSX="1"])
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
    ;;
  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
76 77 78

    AC_DEFINE([WIN32_LEAN_AND_MEAN],, [Define to limit the scope of <windows.h>.])

79
    CPPFLAGS+="-D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -D__USE_MINGW_ANSI_STDIO=1"
Edric Milaret's avatar
Edric Milaret committed
80
    LDFLAGS+="-no-undefined -avoid-version -Wl,--nxcompat -Wl,--dynamicbase"
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
    ac_default_prefix="`pwd`/_win32"
    DESTDIR="`pwd`/_win32/"
    AC_SUBST(WINDOWS_ARCH)
    AC_SUBST(PROGRAMFILES)
    ;;
  *)
    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")

96 97 98 99 100
dnl FIXME this should be deduced automatically
AC_DEFINE_UNQUOTED([HAVE_COREAUDIO],
                    `if test "${HAVE_OSX}" = "1"; then echo 1; else echo 0; fi`,
                    [Define if you have CoreAudio])

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
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")

118 119 120 121 122 123 124
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])
125

Rafaël Carré's avatar
Rafaël Carré committed
126
dnl Define C++ as default language
127 128
LT_LANG(C++)

Luca Barbato's avatar
Luca Barbato committed
129 130
DOLT

131
lt_cv_deplibs_check_method=pass_all
yanmorin's avatar
 
yanmorin committed
132

133
dnl Check for C++11 support
134
AX_CXX_COMPILE_STDCXX_11([ext],[mandatory])
135

Rafaël Carré's avatar
Rafaël Carré committed
136 137 138
dnl Check for header files
AC_FUNC_ALLOCA
AC_HEADER_STDC
139 140 141
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
142 143 144 145 146 147 148 149 150 151

dnl Check for typedefs, structures, and compiler characteristics
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_C_VOLATILE
152 153
AC_CHECK_TYPES([ptrdiff_t])

Tristan Matthews's avatar
Tristan Matthews committed
154
PKG_PROG_PKG_CONFIG()
yanmorin's avatar
 
yanmorin committed
155

156 157 158 159 160 161 162
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"
    ])
])

163 164 165 166 167 168 169 170 171 172 173
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])
174

175 176 177 178 179 180 181 182 183
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"], [
Tristan Matthews's avatar
Tristan Matthews committed
184
  CONTRIB_DIR="${srcdir}/contrib/${host}"
185 186
  AS_IF([test ! -d "${CONTRIB_DIR}"], [
    echo "${CONTRIB_DIR} not found" >&AS_MESSAGE_LOG_FD
Tristan Matthews's avatar
Tristan Matthews committed
187
    CONTRIB_DIR="${srcdir}/contrib/`$CC -dumpmachine`"
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
    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
  CPPFLAGS="${CPPFLAGS} -I${CONTRIB_DIR}/include"
  CFLAGS="${CFLAGS} -I${CONTRIB_DIR}/include"
  CXXFLAGS="${CXXFLAGS} -I${CONTRIB_DIR}/include"
  OBJCFLAGS="${OBJCFLAGS} -I${CONTRIB_DIR}/include"
Edric Milaret's avatar
Edric Milaret committed
220 221 222 223 224
  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
  ])
225
  export PKG_CONFIG_PATH="${CONTRIB_DIR}/lib/pkgconfig:${CONTRIB_DIR}/lib64/pkgconfig:$PKG_CONFIG_PATH"
226 227 228 229 230 231 232 233 234 235 236 237 238
  LDFLAGS="${LDFLAGS} -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)

239 240 241 242 243 244
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
])
245 246 247 248

dnl Check for pjproject
PKG_CHECK_MODULES(PJPROJECT, libpjproject,, AC_MSG_ERROR([Missing pjproject files]))

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

251
if test "${HAVE_ANDROID}" = "1"; then
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
    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")

267
if test "${SYS}" != "mingw32"; then
Rafaël Carré's avatar
Rafaël Carré committed
268
dnl Check for alsa development package - name: libasound2-dev
269
ALSA_MIN_VERSION=1.0
270
AC_ARG_WITH([alsa],
271
	[AS_HELP_STRING([--without-alsa], [disable support for alsa])],
272 273 274
	[],
	[with_alsa=yes])
AS_IF([test "x$with_alsa" = "xyes"], [
275
       PKG_CHECK_MODULES(ALSA, alsa >= ${ALSA_MIN_VERSION},, AC_MSG_ERROR([Missing alsa development files]))
276 277 278
	]);

AC_DEFINE_UNQUOTED([HAVE_ALSA], `if test "x$with_alsa" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have alsa])
279
fi
280 281
AM_CONDITIONAL(BUILD_ALSA, test "x$with_alsa" = "xyes")

282

283
if test "${SYS}" != "mingw32"; then
Rafaël Carré's avatar
Rafaël Carré committed
284
dnl Check for pulseaudio development package - name: libpulse-dev
285
LIBPULSE_MIN_VERSION=0.9.15
286
AC_ARG_WITH([pulse],
287
    [AS_HELP_STRING([--without-pulse], [disable support for pulseaudio])],
288 289 290
    [],
    [with_pulse=yes])

291
AS_IF([test "x$with_pulse" = "xyes"], [
292
       PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= ${LIBPULSE_MIN_VERSION},, AC_MSG_ERROR([Missing pulseaudio development files]))
293
      ]);
294

295
AC_DEFINE_UNQUOTED([HAVE_PULSE], `if test "x$with_pulse" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have pulseaudio])
296
fi
297
AM_CONDITIONAL(BUILD_PULSE, test "x$with_pulse" = "xyes")
298

299 300 301 302 303 304 305 306 307 308 309 310 311
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])
      ])
])

Edric Milaret's avatar
Edric Milaret committed
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
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_WARN([Missing libportaudio development files])
         AC_DEFINE([HAVE_PORTAUDIO], 0, [Define if you have portaudio])
        ])
      ])
])
AM_CONDITIONAL(BUILD_PORTAUDIO, test "x$with_portaudio" = "xyes")
AM_CONDITIONAL(HAVE_PORTAUDIO, test "x$with_portaudio" = "xyes")

328 329 330
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")

331 332
dnl Check for the samplerate development package - name: libsamplerate0-dev
LIBSAMPLERATE_MIN_VERSION=0.1.2
333
PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development files]))
334

335
dnl Check for the sndfile development package - name: libsndfile-dev
336
PKG_CHECK_MODULES(SNDFILE, sndfile,, AC_MSG_ERROR([Missing sndfile development files]))
337

338 339 340 341
dnl Coverage is default-disabled
AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [Enable coverage]))

AS_IF([test "x$enable_coverage" = "xyes"], [
342 343
        CXXFLAGS="${CXXFLAGS} --coverage"
        LDFLAGS="${LDFLAGS} --coverage"])
344

345 346 347 348 349 350 351 352
# DBUSCPP
dnl Check for dbuscpp, 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(DBUSCPP, dbus-c++-1,, AC_MSG_WARN([Missing dbus development files]))
353 354 355 356 357

       AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
       AC_SUBST(LIBEXECDIR)

       AC_CONFIG_FILES([bin/dbus/Makefile
Adrien Béraud's avatar
Adrien Béraud committed
358
                        bin/dbus/cx.ring.Ring.service])
359 360 361 362 363 364 365 366 367

       AC_CHECK_PROG(HAVE_DBUSXML2CPP, dbusxx-xml2cpp, true, false)
       if test "x$HAVE_DBUSXML2CPP" = "xfalse"; then
           AC_MSG_ERROR([dbusxx-xml2cpp not found])
       fi

       AS_IF([test "x$CLANG" = "xyes"], [
             AC_MSG_ERROR([dbus does not compile when clang is used, rerun with --without-dbus])
       ]);
Adrien Béraud's avatar
Adrien Béraud committed
368 369
       AM_CONDITIONAL(RING_DBUS, true)],
       AM_CONDITIONAL(RING_DBUS, false));
370 371


372 373 374 375 376 377 378 379 380 381
dnl Check for libav
PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec development files]))
LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"

PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 54.20.3,, AC_MSG_ERROR([Missing libavformat development files]))

PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale development files]))

PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 53.0.0,, AC_MSG_ERROR([Missing libavdevice development files]))

382
PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 52.5.0,, AC_MSG_ERROR([Missing libavutil development files]))
383

Tristan Matthews's avatar
Tristan Matthews committed
384 385
dnl Video is default-enabled
AC_ARG_ENABLE([video], AS_HELP_STRING([--disable-video], [Disable video]))
386

Tristan Matthews's avatar
Tristan Matthews committed
387
AS_IF([test "x$enable_video" != "xno"],
388
      [
Adrien Béraud's avatar
Adrien Béraud committed
389 390
        AC_DEFINE(RING_VIDEO, [], [Video support enabled])
        AM_CONDITIONAL(RING_VIDEO, true)
Adrien Béraud's avatar
Adrien Béraud committed
391
        AS_IF([test "$SYS" = linux && test -z "${HAVE_ANDROID_FALSE}"],[
392 393 394
            PKG_CHECK_MODULES(UDEV, libudev,, AC_MSG_ERROR([Missing libudev development files]))
        ],[
        ])
395
    ],
396
    [
Adrien Béraud's avatar
Adrien Béraud committed
397
     AM_CONDITIONAL(RING_VIDEO, false)
398
     ]);
399

400
dnl TLS support is enabled if it's installed and up to date
401
AC_ARG_WITH([tls],
402 403 404 405 406
  [AS_HELP_STRING([--with-tls],
    [support tls @<:@default=check@:>@])],
  [],
  [with_tls=check])
AS_CASE(["$with_tls"],
407
  [yes], [PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3], [HAVE_GNUTLS=1])],
408
  [no], [HAVE_GNUTLS=0],
409
  [PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3], [HAVE_GNUTLS=1], [HAVE_GNUTLS=0])])
410

411 412
AC_DEFINE_UNQUOTED([HAVE_TLS], `if test $HAVE_GNUTLS -eq 1; then echo 1; else echo 0; fi`, [Define if you have tls support])
AM_CONDITIONAL(BUILD_TLS, test "$HAVE_GNUTLS" -eq 1)
413

414
# Instant Messaging
415
AC_ARG_WITH([instant_messaging],
416
    [AS_HELP_STRING([--without-instant_messaging], [disable support for instant-messaging])],
417 418
    [],
    [with_instant_messaging=yes])
419 420 421

AC_DEFINE_UNQUOTED([HAVE_INSTANT_MESSAGING], `if test "x$with_instant_messaging" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have instant messaging support])
AM_CONDITIONAL(BUILD_INSTANT_MESSAGING, test "x$with_instant_messaging" = "xyes" )
422

423 424 425

# PTHREAD
# required dependency(ies): libxpat
426
AX_PTHREAD
427

428

429 430
# SDES Key Exchange
# required dependency(ies): libpcre
431
AC_ARG_WITH([sdes],
432
    [AS_HELP_STRING([--without-sdes], [disable support for sdes key exchange])],
433 434
    [],
    [with_sdes=yes])
435
AS_IF([test "x$with_sdes" = "xyes"], [
436
      PKG_CHECK_MODULES(PCRE, [libpcre],,AC_MSG_ERROR([libpcre not found]))]);
437

438 439
AC_DEFINE_UNQUOTED([HAVE_SDES], `if test "x$with_sdes" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have sdes support])
AM_CONDITIONAL(BUILD_SDES, test "x$with_sdes" = "xyes" )
Alexandre Savard's avatar
Alexandre Savard committed
440

441

442 443 444
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 ))
445

446

447
if test "${SYS}" != "mingw32"; then
448 449
# GSM CODEC
# required dependency(ies): libgsm
450 451
dnl check for libgsm1 (doesn't use pkg-config)
dnl Check for libgsm
452
AC_ARG_WITH([gsm], [AS_HELP_STRING([--without-gsm],
453
            [disable support for gsm codec])], [], [with_gsm=yes])
454 455 456

LIBGSM=
AS_IF([test "x$with_gsm" != xno],
457 458 459 460 461
        [AC_CHECK_HEADER([gsm/gsm.h], , AC_MSG_FAILURE([Unable to find the libgsm1 headers (you may need to install the dev package).  You may use --without-gsm to compile without gsm codec support.]))]
        [AC_CHECK_LIB([gsm], [gsm_decode], [], [
            AC_MSG_FAILURE([libgsm link test failed. You may use --without-gsm to compile without gsm codec support.])
        ])
    ])
462

463
AC_DEFINE_UNQUOTED([HAVE_GSM], `if test "x$with_gsm" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libgsm])
464
fi
465 466
AM_CONDITIONAL(BUILD_GSM, test "x$with_gsm" = "xyes" )

467

468 469
# SPEEX CODEC
# required dependency(ies): libspeex
470
dnl Check for libspeex
471
AC_ARG_WITH([speex],
472
        [AS_HELP_STRING([--without-speex], [disable support for speex codec])],
473 474
        [],
        [with_speex=yes])
475

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

Rafaël Carré's avatar
Rafaël Carré committed
478
AC_DEFINE_UNQUOTED([HAVE_SPEEX], `if test "x$with_speex" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libspeex])
479
AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
480

481

482 483
# SPEEX DSP
# required dependency(ies): libspeexdsp
484
dnl check in case the libspeexdsp is not installed
485
AC_ARG_WITH([speexdsp],
486 487 488 489
    [AS_HELP_STRING([--without-speexdsp],
    [disable support for speexdp Noise Suppression and Automatic Gain Control])],
    [],
    [with_speexdsp=yes])
490

491
AS_IF([test "x$with_speexdsp" != xno], [PKG_CHECK_MODULES([SPEEXDSP], [speexdsp])])
492 493 494 495

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" )

496
dnl iLBC is enabled if it's installed
497
AC_ARG_WITH([libilbc],
498 499 500 501 502 503
  [AS_HELP_STRING([--with-libilbc],
    [support ilbc audio @<:@default=check@:>@])],
  [],
  [with_libilbc=check])
AS_CASE(["$with_libilbc"],
  [yes], [PKG_CHECK_MODULES([libilbc], [libilbc], [HAVE_LIBILBC=1])],
504
  [no], [HAVE_LIBILBC=0],
505
  [PKG_CHECK_MODULES([libilbc], [libilbc], [HAVE_LIBILBC=1], [HAVE_LIBILBC=0])])
506
AM_CONDITIONAL([BUILD_ILBC], [test "$HAVE_LIBILBC" -eq 1])
jpbl's avatar
jpbl committed
507

508
dnl opus is enabled if it's installed
509
AC_ARG_WITH([opus],
510 511 512
  [AS_HELP_STRING([--with-opus], [support opus audio @<:@default=check@:>@])], [], [with_opus=check])
AS_CASE(["$with_opus"],
  [yes], [PKG_CHECK_MODULES([opus], [opus], [HAVE_OPUS=1])],
513
  [no], [HAVE_OPUS=0],
514
  [PKG_CHECK_MODULES([opus], [opus], [HAVE_OPUS=1], [HAVE_OPUS=0])])
515
AM_CONDITIONAL([BUILD_OPUS], [test "$HAVE_OPUS" -eq 1])
jpbl's avatar
jpbl committed
516

517 518 519 520 521 522 523 524 525 526 527 528 529 530 531
AC_ARG_WITH([iax],
    AS_HELP_STRING([--without-iax], [Ignore presence of iax and disable it]))

AS_IF([test "x$with_iax" != "xno"],
      [AC_CHECK_HEADER("iax/iax-client.h", [have_iax=yes], [have_iax=no])],
      [have_iax=no])

# only fail if IAX was explicitly requested but not found
AS_IF([test "x$have_iax" = "xyes"],
      [AC_DEFINE([HAVE_IAX], 1, [Define if you have libiax])
       AM_CONDITIONAL(USE_IAX, `true`)],
      [AS_IF([test "x$with_iax" = "xyes"],
             [AC_MSG_ERROR([iax requested but not found])])
       AC_DEFINE([HAVE_IAX], 0, [Define if you have libiax])
       AM_CONDITIONAL(USE_IAX, `false`)])
532

533 534 535 536 537 538
# dht is default-enabled, but requires gnutls
AC_ARG_ENABLE([dht],
  AS_HELP_STRING([--disable-dht], [disable support for dht]))

AS_IF([test "x$enable_dht" != "xno" -a "$HAVE_GNUTLS" -eq 1],
      [AC_DEFINE([HAVE_DHT], 1, [Define to enable dht])
539 540 541 542 543
       PKG_CHECK_MODULES([OPENDHT], opendht,
                         AC_DEFINE([HAVE_DHT], 1, [Define to enable dht])
                         AM_CONDITIONAL(USE_DHT, true),
                         AC_DEFINE([HAVE_DHT], 0, [Define to enable dht])
                         AM_CONDITIONAL(USE_DHT, false)
Tristan Matthews's avatar
Tristan Matthews committed
544
                         AC_MSG_WARN([Missing OpenDHT]))],
545 546
      [AC_DEFINE([HAVE_DHT], 0, [Define to enable dht])
       AM_CONDITIONAL(USE_DHT, false)])
Adrien Béraud's avatar
Adrien Béraud committed
547

548 549 550
dnl IPv6 mode is default-disabled
AC_ARG_ENABLE([ipv6], AS_HELP_STRING([--enable-ipv6], [Enable IPv6 support]))

Adrien Béraud's avatar
Adrien Béraud committed
551 552
AC_DEFINE_UNQUOTED([HAVE_IPV6], `if test "x$enable_ipv6" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have IPv6])
AM_CONDITIONAL(BUILD_IPV6, test "x$enable_ipv6" = "xyes" )
553

Stepan Salenikovich's avatar
Stepan Salenikovich committed
554 555
# LIBUPNP
dnl check for libupnp
Stepan Salenikovich's avatar
Stepan Salenikovich committed
556 557 558
AC_ARG_WITH([upnp], [AS_HELP_STRING([--without-upnp],
            [disable support for upnp])], [], [with_upnp=yes])

Stepan Salenikovich's avatar
Stepan Salenikovich committed
559 560 561 562 563 564
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])])
      ])
565

566
AC_DEFINE_UNQUOTED([HAVE_SHM], `if test -z "${HAVE_LINUX_TRUE}" && test -z "${HAVE_ANDROID_FALSE}" ; then echo 1; else echo 0; fi`,
567 568
	[Define if you have shared memory support])

569 570
# DOXYGEN
# required dependency(ies): doxygen
571 572 573
# check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
# ----------------------------------------------------------------------------
AC_DEFUN([BB_ENABLE_DOXYGEN],
Rafaël Carré's avatar
Rafaël Carré committed
574
    [
Rafaël Carré's avatar
Rafaël Carré committed
575
    AC_ARG_ENABLE(doxygen, [  --enable-doxygen        enable documentation generation with doxygen (disabled by default)])
Rafaël Carré's avatar
Rafaël Carré committed
576
    AC_ARG_ENABLE(dot, [  --enable-dot            use 'dot' to generate graphs in doxygen (auto)])
Rafaël Carré's avatar
Rafaël Carré committed
577
    if test "x$enable_doxygen" = xyes; then
Rafaël Carré's avatar
Rafaël Carré committed
578
        AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
Rafaël Carré's avatar
Rafaël Carré committed
579
        test x$DOXYGEN = x && AC_MSG_ERROR([could not find doxygen])
Rafaël Carré's avatar
Rafaël Carré committed
580
        AC_PATH_PROG(DOT, dot, , $PATH)
Rafaël Carré's avatar
Rafaël Carré committed
581
        test x$DOT = x -a "x$enable_dot" = xyes && AC_MSG_ERROR([could not find dot])
Rafaël Carré's avatar
Rafaël Carré committed
582
    fi
583
    AM_CONDITIONAL(ENABLE_DOXYGEN, test "x$DOXYGEN" != "x")
Rafaël Carré's avatar
Rafaël Carré committed
584
])
585

586 587
# Actually perform the doxygen check
BB_ENABLE_DOXYGEN
588 589


590 591 592 593
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"],
Edric Milaret's avatar
Edric Milaret committed
594
      [CXXFLAGS="${CXXFLAGS} -g -fno-omit-frame-pointer -Wall -Wextra -Wnon-virtual-dtor -O0"])
595 596 597

dnl What Makefiles to generate

598
#TODO: split this list across where the relevant check is performed
599
AC_CONFIG_FILES([Makefile \
600
                 bin/Makefile \
601 602 603 604
                 src/Makefile \
                 src/sip/Makefile \
                 src/im/Makefile \
                 src/iax/Makefile \
605
                 src/ringdht/Makefile \
606 607 608 609 610 611 612
                 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
613
                 src/media/audio/portaudio/Makefile \
614
                 src/media/audio/sound/Makefile \
615
                 src/config/Makefile \
616
                 src/client/Makefile \
617
                 src/hooks/Makefile \
618 619
                 src/media/video/Makefile \
                 src/media/video/v4l2/Makefile \
620
                 src/media/video/androidvideo/Makefile \
621
                 src/media/video/osxvideo/Makefile \
Edric Milaret's avatar
Edric Milaret committed
622
                 src/media/video/winvideo/Makefile \
623
                 src/media/video/test/Makefile \
624
                 src/security/Makefile \
Stepan Salenikovich's avatar
Stepan Salenikovich committed
625
                 src/upnp/Makefile \
626 627 628 629 630
                 test/Makefile \
                 ringtones/Makefile \
                 man/Makefile \
                 doc/Makefile \
                 doc/doxygen/Makefile])
631

632
# Go!
Rafaël Carré's avatar
Rafaël Carré committed
633
AC_OUTPUT