configure.ac 13.9 KB
Newer Older
1
dnl SFLPhone - 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])
5
AC_INIT([sflphone],[1.1.0],[sflphoneteam@savoirfairelinux.com],[sflphone])
6
AC_COPYRIGHT([[Copyright (c) Savoir-Faire Linux 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012]])
7
8
AC_REVISION([$Revision$])

9
AM_INIT_AUTOMAKE
10
AC_CONFIG_HEADERS([config.h])
11

12
# Silent build by default. Use make V=1 to increase verbosity
13
#m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
14

15
16
dnl Improve make variable MAKE
AC_PROG_MAKE_SET
17

18
dnl Where to find configure files
19
20
AC_CONFIG_MACRO_DIR([m4])

21
dnl Unit tests section
22
AC_CONFIG_FILES([test/Makefile])
Emmanuel Milou's avatar
nothing    
Emmanuel Milou committed
23

24
AC_CONFIG_FILES([ringtones/Makefile])
25

Yun Liu's avatar
Yun Liu committed
26
27
AC_CONFIG_FILES([man/Makefile])

28
AC_CONFIG_FILES([doc/Makefile doc/dbus-api/Makefile doc/doxygen/Makefile])
29

30
31
32
33
34
35
36
37
38
39
dnl Check for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl will have to remove this
LT_INIT
40

Rafaël Carré's avatar
Rafaël Carré committed
41
dnl Define C++ as default language
42
AC_LANG(C++)
yanmorin's avatar
   
yanmorin committed
43

Rafaël Carré's avatar
Rafaël Carré committed
44
45
46
dnl Check for header files
AC_FUNC_ALLOCA
AC_HEADER_STDC
47
48
AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h malloc.h memory.h \
                  netdb.h netinet/in.h stdlib.h string.h strings.h \
49
50
                  sys/ioctl.h sys/socket.h sys/time.h unistd.h utime.h \
                  ostream getopt.h])
Rafaël Carré's avatar
Rafaël Carré committed
51
52
53
54
55
56
57
58
59
60

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
61
62
AC_CHECK_TYPES([ptrdiff_t])

Rafaël Carré's avatar
Rafaël Carré committed
63
64
65
dnl ********************************
dnl Check for needed functions
dnl ********************************
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#AC_FUNC_CHOWN
#AC_FUNC_ERROR_AT_LINE
#AC_FUNC_FORK
#AC_PROG_GCC_TRADITIONAL
#AC_FUNC_MALLOC
#AC_FUNC_MEMCMP
#AC_FUNC_REALLOC
#AC_FUNC_SELECT_ARGTYPES
#AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
#Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
#AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
#[AC_LANG_PROGRAM([#include <sys/types.h>
##include <signal.h>
#],
#         [return *(signal (0, 0)) (0) == 1;])],
#           [ac_cv_type_signal=int],
#           [ac_cv_type_signal=void])])
#AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
#            (`int' or `void').])

#AC_FUNC_STAT
#AC_FUNC_UTIME_NULL
#AC_FUNC_VPRINTF
89

90
91
dnl Check for GNU ccRTP
PKG_PROG_PKG_CONFIG
yanmorin's avatar
   
yanmorin committed
92

Rafaël Carré's avatar
Rafaël Carré committed
93
dnl Check for uuid development package - name: uuid-dev
94
95
UUID_MIN_VERSION=1.0
PKG_CHECK_MODULES(UUID, uuid >= ${UUID_MIN_VERSION}, HAVE_UUID=true, HAVE_UUID=false);
96

97
AC_SEARCH_LIBS([yaml_parser_initialize], [yaml], [AC_SUBST(YAML_LIBS, -lyaml)], [
98
       AC_MSG_ERROR([Unable to find yaml development files])])
99

100
101
LIBCRYPTO_MIN_VERSION=1.0
PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= ${LIBCRYPTO_MIN_VERSION}, HAVE_LIBCRYPTO=true, HAVE_LIBCRYPTO=false);
102

Rafaël Carré's avatar
Rafaël Carré committed
103
dnl Check for alsa development package - name: libasound2-dev
104
ALSA_MIN_VERSION=1.0
105
PKG_CHECK_MODULES(ALSA, alsa >= ${ALSA_MIN_VERSION},, AC_MSG_ERROR([Missing alsa development package: libasound2-dev or alsa-lib-devel]))
106

Rafaël Carré's avatar
Rafaël Carré committed
107
dnl Check for pulseaudio development package - name: libpulse-dev
108
LIBPULSE_MIN_VERSION=0.9.15
109
110
111
112
113
114
115
116
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 package: libpulse-dev]))
      ]);
117

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

121
122
dnl Check for the samplerate development package - name: libsamplerate0-dev
LIBSAMPLERATE_MIN_VERSION=0.1.2
123
PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development package: libsamplerate0-dev]))
124

125
126
dnl Video is default-disabled
AC_ARG_ENABLE([video], AS_HELP_STRING([--enable-video], [Enable video]))
127

128
AS_IF([test "x$enable_video" = "xyes"], [
129
        AC_DEFINE(SFL_VIDEO, [], [Video support enabled])
130

131
132
133
134
        dnl The libav versions correspond to the last libav release: 0.7
        dnl Check for libavcodec development package - name: libavcodec-dev
        PKG_CHECK_MODULES(LIBAVCODEC, libavcodec >= 53.5.0,, AC_MSG_ERROR([Missing libavcodec package: libavcodec-dev]))
        LIBAVCODEC_CFLAGS="${LIBAVCODEC_CFLAGS} -D__STDC_CONSTANT_MACROS"
135

136
137
        dnl Check for libavformat development package - name: libavformat-dev
        PKG_CHECK_MODULES(LIBAVFORMAT, libavformat >= 53.2.0,, AC_MSG_ERROR([Missing libavformat package: libavformat-dev]))
138

139
140
141
142
143
144
145
146
        dnl Check for libswscale development package - name: libswcale-dev
        PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 1.1.0,, AC_MSG_ERROR([Missing libswscale package: libswscale-dev]))

        dnl Check for libavdevice development package - name: libavdevice-dev
        PKG_CHECK_MODULES(LIBAVDEVICE, libavdevice >= 53.0.0,, AC_MSG_ERROR([Missing libavdevice package: libavdevice-dev]))

        dnl Check for libavutil development package - name: libavutil-dev
        PKG_CHECK_MODULES(LIBAVUTIL, libavutil >= 51.7.0,, AC_MSG_ERROR([Missing libavutil package: libavutil-dev]))
Tristan Matthews's avatar
Tristan Matthews committed
147
148

        PKG_CHECK_MODULES(UDEV, libudev,, AC_MSG_ERROR([Missing libudev package: libudev-dev]))
149
    ]);
Tristan Matthews's avatar
Tristan Matthews committed
150

151
AM_CONDITIONAL(SFL_VIDEO, test "x$enable_video" = "xyes")
152

153
LIBCCGNU2_MIN_VERSION=1.3.1
154
155
156
157
PKG_CHECK_MODULES([CCGNU2], [commoncpp] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([COMMONCPP_PREFIX], [1], [Use commoncpp include prefix]), [
        PKG_CHECK_MODULES([CCGNU2], [libccgnu2] >= ${LIBCCGNU2_MIN_VERSION}, AC_DEFINE_UNQUOTED([CCPP_PREFIX], [1], [Use cc++ include prefix]),
            AC_MSG_ERROR([Missing common cpp development package: libcommoncpp2-dev]))
        ])
jpbl's avatar
jpbl committed
158

159
160
161
162
LIBCCRTP_MIN_VERSION=1.3.0
PKG_CHECK_MODULES([CCRTP], [libccrtp] >= ${LIBCCRTP_MIN_VERSION},, [
        PKG_CHECK_MODULES([CCRTP], [libccrtp1] >= ${LIBCCRTP_MIN_VERSION},, AC_MSG_ERROR([Missing ccrtp development package: libccrtp-dev]))
        ])
jpbl's avatar
jpbl committed
163

164
165


166
167
# TLS
# required dependency(ies): libssl
168
dnl Check for OpenSSL to link against pjsip and provide SIPS TLS support
169
AC_ARG_WITH([tls],
170
	[ AS_HELP_STRING([--without-tls], [disable tls support]) ],
171
172
173
174
175
	[],
	[with_tls=yes])
AS_IF([test "xwith_tls" = "xyes"], [
	PKG_CHECK_MODULES([libssl], libssl,, AC_MSG_ERROR([Missing ssl development package: libssl-dev]))
	]);
176

177
178
AC_DEFINE_UNQUOTED([HAVE_TLS], `if test "x$with_tls" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have tls support])
AM_CONDITIONAL(BUILD_TLS, test "x$with_tls" = "xyes" )
179
180


181
182
183

# ZRTP
# required dependency(ies): libzrtp
184
185
dnl Check for libzrtpcpp, a ccRTP extension providing zrtp key exchange
LIBZRTPCPP_MIN_VERSION=1.3.0
186
187
188
189
190
191
192
193
194
195
AC_ARG_WITH([zrtp],
	[ AS_HELP_STRING([--without-zrtp], [disable zrtp support]) ],
	[],
	[with_zrtp=yes])
AS_IF([test "xwith_zrtp" = "xyes"], [
	PKG_CHECK_MODULES(ZRTPCPP, libzrtpcpp >= ${LIBZRTPCPP_MIN_VERSION},, AC_MSG_ERROR([Missing zrtp development package: libzrtpcpp-dev]))
	]);

AC_DEFINE_UNQUOTED([HAVE_ZRTP], `if test "x$with_zrtp" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have zrtp support])
AM_CONDITIONAL(BUILD_ZRTP, test "x$with_zrtp" = "xyes" )
196

197
198
199
200


# DBUS
# required dependency(ies): libdbus-c++
201
dnl DBus-C++ detection
Rafaël Carré's avatar
Rafaël Carré committed
202
dnl pkg-config doesn't like 0.6.0-pre1 version number, it assumes that it is
203
204
205
dnl more recent than (unreleased) 0.6.0
DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1
PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
206
AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)]))
207

208
209


210
211
# Instant Messaging
# required dependency(ies): libxpat
212
213
214
215
216
217
218
219
220
221
222
223
AC_ARG_WITH([instant_messaging],
	[ AS_HELP_STRING([--without-instant_messaging], [disable support for instant-messaging]) ],
	[],
	[with_instant_messaging=yes])

AS_IF([test "x$with_instant_messaging" = "xyes"], [
	AX_LIB_EXPAT([1.95.0])
	AS_IF([test "$HAVE_EXPAT" != "yes"], [AC_MSG_ERROR([libexpat could not be found, which is required to build this package.])], [])
	]);

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

225
226
227
228


# PTHREAD
# required dependency(ies): libxpat
229
AX_PTHREAD
230

231
232


233
234
# SDES Key Exchange
# required dependency(ies): libpcre
235
236
237
238
239
240
241
242
243
244
245
AC_ARG_WITH([sdes],
	[ AS_HELP_STRING([--without-sdes], [disable support for sdes key exchange]) ],
	[],
	[with_sdes=yes])

AS_IF([test "x$with_sdes" = "xyes"], [
	AX_PATH_LIB_PCRE
        ]);

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
246

247
248
249
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 ))
250

251
252


253
254
# GSM CODEC
# required dependency(ies): libgsm
255
256
dnl check for libgsm1 (doesn't use pkg-config)
dnl Check for libgsm
257
AC_ARG_WITH([gsm], [AS_HELP_STRING([--without-gsm],
258
            [disable support for gsm codec])], [], [with_gsm=yes])
259
260
261

LIBGSM=
AS_IF([test "x$with_gsm" != xno],
262
263
264
265
266
        [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.])
        ])
    ])
267

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

271
272


273
274
# SPEEX CODEC
# required dependency(ies): libspeex
275
dnl Check for libspeex
276
AC_ARG_WITH([speex],
277
278
279
280
        [AS_HELP_STRING([--without-speex],
        [disable support for speex codec])],
        [],
        [with_speex=yes])
281
282

AS_IF([test "x$with_speex" != xno],
283
284
285
286
287
288
        [AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Unable to find the libspeex headers (you may need to install the dev package).  You may use --without-speex to compile without speex codec support.]))]
        [AC_CHECK_LIB([speex], [speex_decode_int],
        [],
        [AC_MSG_FAILURE([libspeex link test failed.   You may use --without-speex to compile without speex codec support.])])
        ])

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

292
293


294
295
# SPEEX DSP
# required dependency(ies): libspeexdsp
296
dnl check in case the libspeexdsp is not installed
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
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],
	AC_CHECK_HEADER([speex/speex_preprocess.h], , AC_MSG_FAILURE([Unable to find the libspeexdsp headers (you may need to install the libspeexdsp-dev package) used for Noise Suppression and Automatic Gain Control.]))
	AC_SEARCH_LIBS([speex_preprocess_run], [speexdsp],
	[],
	[AC_MSG_ERROR([Unable to find speexdsp development files])])
	])

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


jpbl's avatar
jpbl committed
314

315
316
# IAX
# required dependency(ies): libiax2 (static)
317
dnl Check for IAX
318
319
AC_ARG_WITH([iax2], [AS_HELP_STRING([--without-iax2],
            [disable support for the iax2 protocol])], [], [with_iax2=yes])
320

321
AC_DEFINE_UNQUOTED([HAVE_IAX], `if test "x$with_iax2" = "xyes"; then echo 1; else echo 0;fi`, [Define if you have libiax2])
Benoit Grégoire's avatar
Benoit Grégoire committed
322
AM_CONDITIONAL(USE_IAX, test "x$with_iax2" = "xyes" )
jpbl's avatar
jpbl committed
323

324
325


326
327
# NETWORK MANAGER
# required dependency(ies): libiax2 (static)
328
dnl Check for network-manager
329
AC_ARG_WITH([networkmanager], [AS_HELP_STRING([--without-networkmanager],
330
            [disable support for network-manager events])], [],
331
            [with_networkmanager=yes])
332
333
334

AM_CONDITIONAL(USE_NETWORKMANAGER, test "x$with_networkmanager" = "xyes" )

335
336


337
338
# DOXYGEN
# required dependency(ies): doxygen
339
340
341
# check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
# ----------------------------------------------------------------------------
AC_DEFUN([BB_ENABLE_DOXYGEN],
Rafaël Carré's avatar
Rafaël Carré committed
342
    [
Rafaël Carré's avatar
Rafaël Carré committed
343
    AC_ARG_ENABLE(doxygen, [  --enable-doxygen        enable documentation generation with doxygen (disabled by default)])
Rafaël Carré's avatar
Rafaël Carré committed
344
    AC_ARG_ENABLE(dot, [  --enable-dot            use 'dot' to generate graphs in doxygen (auto)])
Rafaël Carré's avatar
Rafaël Carré committed
345
    if test "x$enable_doxygen" = xyes; then
Rafaël Carré's avatar
Rafaël Carré committed
346
        AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
Rafaël Carré's avatar
Rafaël Carré committed
347
        test x$DOXYGEN = x && AC_MSG_ERROR([could not find doxygen])
Rafaël Carré's avatar
Rafaël Carré committed
348
        AC_PATH_PROG(DOT, dot, , $PATH)
Rafaël Carré's avatar
Rafaël Carré committed
349
        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
350
    fi
351
    AM_CONDITIONAL(ENABLE_DOXYGEN, test x$DOXYGEN = xyes)
Rafaël Carré's avatar
Rafaël Carré committed
352
353
354
])
# Acutally perform the doxygen check
BB_ENABLE_DOXYGEN
355

356
357


358
CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Weffc++"
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377

dnl What to generate
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([libs/Makefile \
                 libs/iax2/Makefile])

AC_CONFIG_FILES([src/Makefile \
        src/sip/Makefile \
        src/im/Makefile \
        src/iax/Makefile \
        src/audio/Makefile \
        src/audio/audiortp/Makefile \
        src/audio/pulseaudio/Makefile \
        src/audio/alsa/Makefile \
        src/audio/sound/Makefile \
        src/audio/codecs/Makefile \
        src/config/Makefile \
        src/dbus/Makefile \
        src/hooks/Makefile \
Tristan Matthews's avatar
Tristan Matthews committed
378
379
380
        src/history/Makefile \
        src/video/Makefile \
        src/video/test/Makefile])
381
382


383
# Go!
Rafaël Carré's avatar
Rafaël Carré committed
384
AC_OUTPUT
385

386
AC_CONFIG_SUBDIRS([libs/pjproject])
Rafaël Carré's avatar
Rafaël Carré committed
387
AC_MSG_NOTICE([[Configuration done! Please make sure that pjsip library (libs/pjproject) has already been compiled. Run `make' to build the software.]])