configure.ac 10.8 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.0.2],[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 10 11
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
12

13
AM_INIT_AUTOMAKE
14
AC_CONFIG_HEADERS([config.h])
15

16 17 18
# Silent build by default. Use make V=1 to increase verbosity
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

19 20
dnl Improve make variable MAKE
AC_PROG_MAKE_SET
21

22
dnl Where to find configure files
23 24
AC_CONFIG_MACRO_DIR([m4])

25
dnl What to generate
26
AC_CONFIG_FILES([Makefile])
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
AC_CONFIG_FILES([libs/Makefile \
		libs/utilspp/Makefile \
		libs/utilspp/singleton/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 \
Rafaël Carré's avatar
Rafaël Carré committed
45
		src/history/Makefile])
46

47
dnl Unit tests section
48
AC_CONFIG_FILES([test/Makefile])
Emmanuel Milou's avatar
Emmanuel Milou committed
49

50
AC_CONFIG_FILES([ringtones/Makefile])
51

Yun Liu's avatar
Yun Liu committed
52 53
AC_CONFIG_FILES([man/Makefile])

54
AC_CONFIG_FILES([doc/Makefile doc/dbus-api/Makefile doc/doxygen/Makefile])
55

56 57 58 59 60 61 62 63 64 65
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
66

Rafaël Carré's avatar
Rafaël Carré committed
67
dnl Define C++ as default language
68
AC_LANG(C++)
69

Rafaël Carré's avatar
Rafaël Carré committed
70 71 72
dnl Check for header files
AC_FUNC_ALLOCA
AC_HEADER_STDC
73 74 75
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 \
                  sys/ioctl.h sys/socket.h sys/time.h unistd.h utime.h ostream])
Rafaël Carré's avatar
Rafaël Carré committed
76 77 78 79 80 81 82 83 84 85

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
86 87
AC_CHECK_TYPES([ptrdiff_t])

Rafaël Carré's avatar
Rafaël Carré committed
88 89 90 91 92 93 94 95 96 97 98
dnl ********************************
dnl Check for needed functions
dnl ********************************
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
99 100 101 102 103 104 105 106 107 108 109 110
	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').])

111 112 113 114
AC_FUNC_STAT
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([bzero floor gethostbyname gethrtime gettimeofday \
115 116
                inet_ntoa memset mkdir pathconf pow regcomp select setlocale \
                socket strchr strdup strerror strrchr strstr strtol utime])
117

118 119
dnl Check for GNU ccRTP
PKG_PROG_PKG_CONFIG
120

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

125 126 127
LIBCRYPTO_MIN_VERSION=1.0
PKG_CHECK_MODULES(LIBCRYPTO, libcrypto >= ${LIBCRYPTO_MIN_VERSION}, HAVE_LIBCRYPTO=true, HAVE_LIBCRYPTO=false);

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

Rafaël Carré's avatar
Rafaël Carré committed
132
dnl Check for pulseaudio development package - name: libpulse-dev
133
LIBPULSE_MIN_VERSION=0.9.15
134
PKG_CHECK_MODULES(PULSEAUDIO, libpulse >= ${LIBPULSE_MIN_VERSION},, AC_MSG_ERROR([Missing pulseaudio development package: libpulse-dev]))
135

136 137
dnl Check for the samplerate development package - name: libsamplerate0-dev
LIBSAMPLERATE_MIN_VERSION=0.1.2
138
PKG_CHECK_MODULES(SAMPLERATE, samplerate >= ${LIBSAMPLERATE_MIN_VERSION},, AC_MSG_ERROR([Missing libsamplerate development package: libsamplerate0-dev]))
139

140
LIBCCGNU2_MIN_VERSION=1.3.1
141
PKG_CHECK_MODULES(CCGNU2, libccgnu2 >= ${LIBCCGNU2_MIN_VERSION},, AC_MSG_ERROR([Missing common cpp development package: libcommoncpp2-dev]))
jpbl's avatar
jpbl committed
142

143 144
LIBCCEXT2_MIN_VERSION=1.3.1
PKG_CHECK_MODULES(CCEXT2, libccext2 >= ${LIBCCEXT2_MIN_VERSION})
jpbl's avatar
jpbl committed
145

146
LIBCCRT_MIN_VERSION=1.3.0
147
PKG_CHECK_MODULES(CCRTP, libccrtp1 >= ${LIBCCRT_MIN_VERSION},, AC_MSG_ERROR([Missing ccrtp development package: libccrtp-dev]))
jpbl's avatar
jpbl committed
148

149
dnl Check for OpenSSL to link against pjsip and provide SIPS TLS support
150
PKG_CHECK_MODULES([libssl], libssl,, AC_MSG_ERROR([Missing ssl development package: libssl-dev]))
151

152 153 154
dnl Check for libzrtpcpp, a ccRTP extension providing zrtp key exchange
LIBZRTPCPP_MIN_VERSION=1.3.0
PKG_CHECK_MODULES(ZRTPCPP, libzrtpcpp >= ${LIBZRTPCPP_MIN_VERSION},, AC_MSG_ERROR([Missing zrtp development package: libzrtpcpp-dev]))
155

156
dnl DBus-C++ detection
Rafaël Carré's avatar
Rafaël Carré committed
157
dnl pkg-config doesn't like 0.6.0-pre1 version number, it assumes that it is
158 159 160 161
dnl more recent than (unreleased) 0.6.0
DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1
PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
	AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)]))
162

163
CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Weffc++ -Wfatal-errors"
164

165
AC_CHECK_LIB([expat], XML_ParserCreate_MM,
166 167
        [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)],
        have_expat=false)
168

Rafaël Carré's avatar
Rafaël Carré committed
169
test "$have_expat" = false && AC_MSG_ERROR([libexpat development files missing])
170 171 172 173

xml_CFLAGS=
xml_LIBS=-lexpat

174
AC_SUBST(xml_CFLAGS)
175 176
AC_SUBST(xml_LIBS)

177
AC_CHECK_LIB([yaml], yaml_parser_initialize,
178 179
        [AC_CHECK_HEADERS(yaml.h, have_yaml=true, have_yaml=false)],
        have_yaml=false)
180

Rafaël Carré's avatar
Rafaël Carré committed
181
test "$have_yaml" = "false" && AC_MSG_ERROR([libyaml development files missing])
182 183

yaml_CFLAGS=
184
yaml_LIBS=-lyaml
185 186 187
AC_SUBST(yaml_CFLAGS)
AC_SUBST(yaml_LIBS)

188
AC_CHECK_LIB([pthread], pthread_create,
189 190
		[AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)],
		have_pthread=false)
191

Rafaël Carré's avatar
Rafaël Carré committed
192
test "$have_pthread" = "false" && AC_MSG_ERROR([You need the POSIX Thread library (pthreads)])	
193

194 195 196 197
AC_CHECK_LIB([pcre], pcre_free,
		[AC_CHECK_HEADERS(pcre.h, have_pcre=true, have_pcre=false)],
		have_pcre=false)

Rafaël Carré's avatar
Rafaël Carré committed
198
test "$have_pcre" = "false" && AC_MSG_ERROR([You need the Perl-Compatible Regular Expressions library (pcre)])	
199

Rafaël Carré's avatar
Rafaël Carré committed
200 201 202
PCRE_LIBS=-lpcre
PCRE_CFLAGS=
AC_SUBST(PCRE_LIBS)
203 204
AC_SUBST(PCRE_CFLAGS)

205 206 207
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 ))
208

209
# check for libgsm1 (doesn't use pkg-config)
210
	dnl Check for libgsm
211 212
AC_ARG_WITH([gsm], [AS_HELP_STRING([--without-gsm],
			[disable support for gsm codec])], [], [with_gsm=yes])
213 214 215

LIBGSM=
AS_IF([test "x$with_gsm" != xno],
216 217 218 219 220 221 222 223 224
		[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.])]
			)
		]
	 )

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

228
dnl Check for libspeex
229
AC_ARG_WITH([speex],
230
		[AS_HELP_STRING([--without-speex],
231
		[disable support for speex codec])],
232 233
		[],
		[with_speex=yes])
234 235

AS_IF([test "x$with_speex" != xno],
236 237
		[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],
238 239 240 241
		[],
		[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
242
AC_DEFINE_UNQUOTED([HAVE_SPEEX], `if test "x$with_speex" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libspeex])
243
AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
244

245 246 247
dnl check in case the libspeexdsp is not installed
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_CHECK_LIB(speexdsp, speex_preprocess_run, [], [], [])
jpbl's avatar
jpbl committed
248

Rafaël Carré's avatar
Rafaël Carré committed
249
# check for libcelt
250 251 252 253 254
AC_ARG_WITH([celt],
		[AS_HELP_STRING([--without-celt],
		[disable support for celt codec])],
		[],
		[with_celt=yes])
255

256
AS_IF([test "x$with_celt" != xno],
257
	[PKG_CHECK_MODULES(CELT, celt >= 0.9.1,
258
		[
259
			with_celt_91=yes; AC_MSG_NOTICE([Using celt 0.9.1])
Rafaël Carré's avatar
Rafaël Carré committed
260
    	],
261
    	[
262 263 264 265 266 267 268 269
			PKG_CHECK_MODULES(CELT, celt >= 0.7.1,
            [
                with_celt_71=yes; AC_MSG_NOTICE([Using celt 0.7.1])
            ],
            [
                AC_MSG_FAILURE([libcelt link test failed.   You may use --without-celt to compile without celt codec support.])
            ])
    	])]
270
)
271

272 273
AM_CONDITIONAL(BUILD_CELT_91, test "x$with_celt_91" = "xyes" )
AM_CONDITIONAL(BUILD_CELT_71, test "x$with_celt_71" = "xyes" )
274

275
dnl Check for IAX
276 277
AC_ARG_WITH([iax2], [AS_HELP_STRING([--without-iax2],
            [disable support for the iax2 protocol])], [], [with_iax2=yes])
278

279
AC_DEFINE_UNQUOTED([HAVE_IAX], `if test "x$with_iax2" = "xyes"; then echo 1; else echo 0;fi`, [Define if you have libiax2])
280
AM_CONDITIONAL(USE_IAX, test "x$with_iax2" = "xyes" )
jpbl's avatar
jpbl committed
281

282
	dnl Check for network-manager
283 284 285
AC_ARG_WITH([networkmanager], [AS_HELP_STRING([--without-networkmanager],
			[disable support for network-manager events])], [],
            [with_networkmanager=yes])
286 287 288

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

289 290 291
# check for doxygen, mostly stolen from http://log4cpp.sourceforge.net/
# ----------------------------------------------------------------------------
AC_DEFUN([BB_ENABLE_DOXYGEN],
Rafaël Carré's avatar
Rafaël Carré committed
292
    [
293
    AC_ARG_ENABLE(doxygen, [  --enable-doxygen        enable documentation generation with doxygen (disabled by default)])
Rafaël Carré's avatar
Rafaël Carré committed
294
    AC_ARG_ENABLE(dot, [  --enable-dot            use 'dot' to generate graphs in doxygen (auto)])
295
    if test "x$enable_doxygen" = xyes; then
Rafaël Carré's avatar
Rafaël Carré committed
296
        AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
297
        test x$DOXYGEN = x && AC_MSG_ERROR([could not find doxygen])
Rafaël Carré's avatar
Rafaël Carré committed
298
        AC_PATH_PROG(DOT, dot, , $PATH)
299
        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
300
    fi
301
	AM_CONDITIONAL(ENABLE_DOXYGEN, test x$DOXYGEN = xyes)
Rafaël Carré's avatar
Rafaël Carré committed
302 303 304
])
# Acutally perform the doxygen check
BB_ENABLE_DOXYGEN
305

306
# Go!
Rafaël Carré's avatar
Rafaël Carré committed
307
AC_OUTPUT
308

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