configure.ac 33.5 KB
Newer Older
aymeric's avatar
aymeric committed
1 2
dnl Process this file with autoconf to produce a configure script.

Ghislain MARY's avatar
Ghislain MARY committed
3
AC_INIT([linphone],[3.9.0],[linphone-developers@nongnu.org])
4
AC_CANONICAL_SYSTEM
5
AC_CONFIG_SRCDIR([coreapi/linphonecore.c])
aymeric's avatar
aymeric committed
6 7 8 9 10 11 12 13 14

dnl Source packaging numbers

LINPHONE_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
LINPHONE_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
LINPHONE_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
LINPHONE_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)

dnl program extension
15 16 17 18
LINPHONE_VERSION=$LINPHONE_MAJOR_VERSION.$LINPHONE_MINOR_VERSION.${LINPHONE_MICRO_VERSION}
if test "$LINPHONE_EXTRA_VERSION" != "" ;then
	LINPHONE_VERSION=$LINPHONE_VERSION.${LINPHONE_EXTRA_VERSION}
fi
Simon Morlat's avatar
Simon Morlat committed
19

Ghislain MARY's avatar
Ghislain MARY committed
20
LIBLINPHONE_SO_CURRENT=8 dnl increment this number when you add/change/remove an interface
Simon Morlat's avatar
Simon Morlat committed
21 22 23 24
LIBLINPHONE_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
LIBLINPHONE_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface

LIBLINPHONE_SO_VERSION=$LIBLINPHONE_SO_CURRENT:$LIBLINPHONE_SO_REVISION:$LIBLINPHONE_SO_AGE
aymeric's avatar
aymeric committed
25

26
AC_SUBST(LIBLINPHONE_SO_CURRENT, $LIBLINPHONE_SO_CURRENT)
aymeric's avatar
aymeric committed
27 28 29 30 31 32
AC_SUBST(LIBLINPHONE_SO_VERSION, $LIBLINPHONE_SO_VERSION)
AC_SUBST(LINPHONE_VERSION)

AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION		A full featured audio/video sip phone.])
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])

Gautier Pelloux-Prayer's avatar
Gautier Pelloux-Prayer committed
33
AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects])
34
AC_SUBST([LIBTOOL_DEPS])
35
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
Yann Diorcet's avatar
Yann Diorcet committed
36
AC_SUBST([docdir], [${datadir}/doc])
37
AC_CONFIG_HEADERS(config.h)
smorlat's avatar
smorlat committed
38
AC_CONFIG_MACRO_DIR([m4])
39
dnl do not put anythingelse before AC_PROG_CC unless checking if macro still work for clang
Simon Morlat's avatar
Simon Morlat committed
40 41 42
AC_PROG_CXX(["xcrun clang++" g++])
AC_PROG_CC(["xcrun clang" gcc])

43 44
gl_LD_OUTPUT_DEF

aymeric's avatar
aymeric committed
45 46 47
AC_ISC_POSIX
AC_C_INLINE
AC_HEADER_STDC
48
AM_PROG_CC_C_O
Simon Morlat's avatar
Simon Morlat committed
49 50
AC_CHECK_PROGS(MD5SUM,[md5sum md5])
AM_CONDITIONAL(HAVE_MD5SUM,test -n $MD5SUM)
51

52 53
ios_found=no

jehan's avatar
jehan committed
54
case $target in
55
	*mingw32ce)
Yann Diorcet's avatar
Yann Diorcet committed
56 57 58
		CFLAGS="$CFLAGS -D_WIN32_WCE -DORTP_STATIC -D_WIN32_WINNT=0x0501"
		CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
		LIBS="$LIBS -lws2 -liphlpapi"
59
		mingw_found=yes
60
		mingwce_found=yes
Yann Diorcet's avatar
Yann Diorcet committed
61
	;;
62
	*mingw*)
63 64 65
		dnl Workaround for mingw, whose compiler does not check in /usr/include ...
		CPPFLAGS="$CPPFLAGS -I/usr/include"
		LDFLAGS="$LDFLAGS -L/usr/lib"
66
		CFLAGS="$CFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501 "
67
		CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
68
		LIBS="$LIBS -lws2_32"
69 70 71
		GUI_FLAGS="-mwindows"
		CONSOLE_FLAGS="-mconsole"
		mingw_found=yes
72
		AC_CHECK_TOOL(WINDRES, windres)
73
	;;
74
	armv6-apple-darwin|armv7-apple-darwin|i386-apple-darwin|armv7s-apple-darwin|aarch64-apple-darwin|*-apple-darwin.ios)
75
		CFLAGS="$CFLAGS -DTARGET_OS_IPHONE=1 "
76
		LIBS="$LIBS -framework CoreFoundation -framework AudioToolbox -framework CoreAudio -framework Foundation -framework QuartzCore -framework OpenGLES -framework UIKit -framework AVFoundation"
Yann Diorcet's avatar
Yann Diorcet committed
77 78 79 80
		ios_found=yes
	;;
	x86_64-apple-darwin*|i686-apple-darwin*)
		MSPLUGINS_CFLAGS=""
smorlat's avatar
smorlat committed
81
		dnl use macport installation
82
		AS_IF([test -d "/opt/local/share/aclocal"], [ACLOCAL_MACOS_FLAGS="-I /opt/local/share/aclocal"])
83
		build_macos=yes
Yann Diorcet's avatar
Yann Diorcet committed
84
	;;
jehan's avatar
jehan committed
85

86 87
esac

88
AM_CONDITIONAL(BUILD_IOS, test x$ios_found = xyes)
jehan's avatar
jehan committed
89

smorlat's avatar
smorlat committed
90
AC_SUBST(ACLOCAL_MACOS_FLAGS)
91 92 93
AC_SUBST(CONSOLE_FLAGS)
AC_SUBST(GUI_FLAGS)

Ghislain MARY's avatar
Ghislain MARY committed
94 95
case "$build_os" in
	*darwin*)
Ghislain MARY's avatar
Ghislain MARY committed
96 97 98 99 100 101
		HTTPS_CA_DIR=`openssl version -d | sed  "s/OPENSSLDIR: \"\(.*\)\"/\1/"`
	;;
esac

AC_SUBST(HTTPS_CA_DIR)

aymeric's avatar
aymeric committed
102
dnl localization tools
103 104
IT_PROG_INTLTOOL([0.40], [no-xml])

aymeric's avatar
aymeric committed
105
dnl Initialize libtool
106
LT_INIT([win32-dll shared disable-static])
Yann Diorcet's avatar
Yann Diorcet committed
107

108 109
dnl Enable library dependencies linking
AC_ARG_ENABLE(deplibs-link,
Yann Diorcet's avatar
Yann Diorcet committed
110 111 112 113
	[AS_HELP_STRING([--disable-deplibs-link ], [Disable library dependencies linking (might break builds)])],
	[enable_deplibs_linking="$enableval"],
	[enable_deplibs_linking="yes"]
)
114 115
AC_MSG_NOTICE([Enable library dependencies linking: $enable_interlib_deps])
if test "${enable_deplibs_linking}" == "yes"; then
Yann Diorcet's avatar
Yann Diorcet committed
116 117
	link_all_deplibs=yes
	link_all_deplibs_CXX=yes
118
else
Yann Diorcet's avatar
Yann Diorcet committed
119 120
	link_all_deplibs=no
	link_all_deplibs_CXX=no
121
fi
122

Yann Diorcet's avatar
Yann Diorcet committed
123 124 125 126 127 128 129 130 131
AC_CONFIG_COMMANDS([libtool-hacking],
	[if test "$mingw_found" = "yes" ; then
		echo "Hacking libtool to work with mingw..."
		sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
		cp -f ./libtool.tmp ./libtool
		rm -f ./libtool.tmp
	fi],
	[mingw_found=$mingw_found]
)
132

aymeric's avatar
aymeric committed
133 134
dnl Add the languages which your application supports here.
PKG_PROG_PKG_CONFIG
jehan's avatar
jehan committed
135
ALL_LINGUAS=$(cd $srcdir/po && echo *.po | sed 's/\.po//g')
strk's avatar
strk committed
136
AC_SUBST(ALL_LINGUAS)
smorlat's avatar
smorlat committed
137
AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages])
138 139

if test "$mingw_found" != "yes" ; then
140
	dnl gettext macro does not work properly under mingw. And we want to use the one provided by GTK.
141

142 143 144
	dnl AM_GNU_GETTEXT pollutes CPPFLAGS: workaround this.
	CPPFLAGS_save=$CPPFLAGS
	AM_GNU_GETTEXT([external])
Yann Diorcet's avatar
Yann Diorcet committed
145
	AC_SUBST(INTLLIBS)
146 147
	CPPFLAGS=$CPPFLAGS_save
	LIBS="$LIBS $LIBINTL"
148
else
149
	if test "$USE_NLS" = "yes" ; then
150
		AC_DEFINE(HAVE_INTL,1,[Tells wheter localisation is possible])
151 152
		LIBS="$LIBS -lintl"
	fi
153 154 155
fi

GETTEXT_PACKAGE=linphone
156
AC_SUBST([GETTEXT_PACKAGE])
Yann Diorcet's avatar
Yann Diorcet committed
157
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext package name])
158
dnl AC_CHECK_LIB(intl,libintl_gettext)
aymeric's avatar
aymeric committed
159 160 161

AC_CHECK_FUNCS([get_current_dir_name strndup stpcpy] )

162
AC_ARG_ENABLE(x11,
163
	[AS_HELP_STRING([--disable-x11], [Disable X11 support (default=yes for MacOSX, no otherwise)])],
Yann Diorcet's avatar
Yann Diorcet committed
164 165 166 167 168
	[case "${enableval}" in
		yes)	enable_x11=true ;;
		no)	enable_x11=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
	esac],
169 170 171 172
	[case "$target_os" in
		*darwin*) enable_x11=false ;; #disable x11 on MacOS by default
		*) enable_x11=true ;;
	esac]
Yann Diorcet's avatar
Yann Diorcet committed
173
)
174

175 176
dnl conditional build of LDAP support
AC_ARG_ENABLE(ldap,
177
	[AS_HELP_STRING([--enable-ldap], [Enables LDAP support (default=no)])],
178 179 180
	[case "${enableval}" in
		yes)	enable_ldap=true ;;
		no)		enable_ldap=false ;;
181
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-ldap) ;;
182
	esac],
183
	[enable_ldap=false]
184 185 186
)

if test "$enable_ldap" = "true"; then
187 188 189 190
	PKG_CHECK_MODULES(LDAP, [openldap],[found_ldap=yes], [found_ldap=no])
	if test  "$found_ldap" = "no"; then
		AC_CHECK_LIB(ldap,ldap_initialize, [LDAP_LIBS="-lldap -llber"],
			[AC_MSG_ERROR([You need libldap for LDAP support])]
191
		)
192
		AC_CHECK_HEADERS(ldap.h, [foo=bar], [AC_MSG_ERROR( [ldap.h not found] ) ] )
193
		found_ldap=yes
194
	fi
195

196
	PKG_CHECK_MODULES(SASL, [libsasl2],[found_sasl=yes],[found_sasl=no] )
197

198 199 200 201 202
	if test "$found_sasl" = "no"; then
		AC_CHECK_LIB(sasl2, sasl_client_init , [SASL_LIBS="-lsasl2"],
			[AC_MSG_ERROR([You need SASL for LDAP support] ) ]
			)
		AC_CHECK_HEADERS(sasl/sasl.h,foo=bar, [AC_MSG_ERROR([sasl/sasl.h not found])])
203
		found_sasl=yes
204
	fi
205

206
	AC_SUBST(LDAP_CFLAGS)
207
	AC_SUBST(LDAP_LIBS)
208

209 210
	AC_SUBST(SASL_CFLAGS)
	AC_SUBST(SASL_LIBS)
211

212 213 214
	if test "$found_ldap$found_sasl" = "yesyes"; then
		AC_DEFINE(BUILD_LDAP,1,[Defined if LDAP build option enabled])
	else
215
		AC_MSG_ERROR([Cannot use LDAP due to previous errors])
216 217
	fi

218
fi
219

220
AM_CONDITIONAL(BUILD_LDAP, test x$enable_ldap != xfalse)
221

aymeric's avatar
aymeric committed
222 223
dnl conditionnal build of console interface.
AC_ARG_ENABLE(console_ui,
Yann Diorcet's avatar
Yann Diorcet committed
224 225 226 227 228 229 230 231
	[AS_HELP_STRING([--enable-console_ui=[yes/no]], [Turn on or off compilation of console interface (default=yes)])],
	[case "${enableval}" in
		yes)	console_ui=true ;;
		no)	console_ui=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-console_ui) ;;
	esac],
	[console_ui=true]
)
aymeric's avatar
aymeric committed
232

Yann Diorcet's avatar
Yann Diorcet committed
233 234
dnl conditionnal build of tools.
AC_ARG_ENABLE(tools,
Yann Diorcet's avatar
Yann Diorcet committed
235 236 237 238 239 240 241 242
	[AS_HELP_STRING([--enable-tools=[yes/no]], [Turn on or off compilation of console interface (default=yes)])],
	[case "${enableval}" in
		yes)	build_tools=true ;;
		no)	build_tools=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;;
	esac],
	[build_tools=check]
)
Yann Diorcet's avatar
Yann Diorcet committed
243

Yann Diorcet's avatar
Yann Diorcet committed
244 245
dnl check for installed version of libupnp
AC_ARG_ENABLE(upnp,
Yann Diorcet's avatar
Yann Diorcet committed
246 247 248 249 250 251 252 253
	[AS_HELP_STRING([--disable-upnp], [Disable uPnP support])],
	[case "${enableval}" in
		yes)	build_upnp=true ;;
		no)	build_upnp=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-upnp) ;;
	esac],
	[build_upnp=auto]
)
Yann Diorcet's avatar
Yann Diorcet committed
254 255

if test "$build_upnp" != "false" ; then
256
	PKG_CHECK_MODULES([LIBUPNP], [libupnp],
Yann Diorcet's avatar
Yann Diorcet committed
257 258 259 260 261
		[if  pkg-config --atleast-version=1.6 "libupnp < 1.7"; then
			build_upnp=true
		else
			AC_MSG_ERROR([libupnp >= 1.6 < 1.5 required.])
		fi],
Yann Diorcet's avatar
Yann Diorcet committed
262
		[if test "$build_upnp" == "true" ; then
Yann Diorcet's avatar
Yann Diorcet committed
263 264 265
			AC_MSG_ERROR([libupnp not found.])
		else
			build_upnp=false
Yann Diorcet's avatar
Yann Diorcet committed
266 267
		fi]
	)
Yann Diorcet's avatar
Yann Diorcet committed
268 269 270 271 272 273 274

fi

AM_CONDITIONAL(BUILD_UPNP, test x$build_upnp != xfalse)
if test "$build_upnp" != "false" ; then
	AC_DEFINE(BUILD_UPNP, 1, [Define if upnp enabled])
fi
Yann Diorcet's avatar
Yann Diorcet committed
275

276
dnl check zlib
277 278 279 280 281 282 283 284 285 286 287
AC_ARG_ENABLE(zlib,
	[AS_HELP_STRING([--disable-zlib], [Disable ZLib support])],
	[case "${enableval}" in
		yes)	build_zlib=true ;;
		no)	build_zlib=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-zlib) ;;
	esac],
	[build_zlib=auto]
)
if test "$build_zlib" != "false" ; then
	PKG_CHECK_MODULES(ZLIB, [zlib], [found_zlib=yes], [found_zlib=no])
288
	if test "x$found_zlib" = "xno" ; then
289 290 291 292 293 294 295 296 297 298 299 300 301 302
		AC_CHECK_LIB(z, inflate,
			[AC_CHECK_HEADER([zlib.h],
			[AC_COMPILE_IFELSE(
				[AC_LANG_PROGRAM([[
				 #include <zlib.h>
				 #if !defined(ZLIB_VERNUM) || (ZLIB_VERNUM < 0x1230)
				 // compile error
				 #endif
			]],[])],
			[found_zlib=yes])])])
		if test "x$found_zlib" = "xno" ; then
			AC_MSG_NOTICE([zlib library and headers not found])
		else
			AC_DEFINE( HAVE_ZLIB, 1, [ZLIB support] )
Guillaume BIENKOWSKI's avatar
Guillaume BIENKOWSKI committed
303
			ZLIB_LIBS='-lz'
304 305
			AC_SUBST(ZLIB_LIBS)
		fi
306
	else
307
		AC_MSG_NOTICE([ZLIB found])
308 309 310 311 312
		AC_DEFINE( HAVE_ZLIB, 1, [ZLIB support] )
	fi
fi


Ghislain MARY's avatar
Ghislain MARY committed
313 314 315 316
dnl check libxml2
PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],[libxml2_found=yes],foo=bar)
if test "$libxml2_found" != "yes" ; then
	AC_MSG_ERROR([libxml2 not found. Install it and try again (the package is usually named libxml2-dev in the Linux distributions)])
Yann Diorcet's avatar
Yann Diorcet committed
317 318 319 320
fi

AM_CONDITIONAL(BUILD_TOOLS, test x$build_tools != xfalse)
if test "$build_tools" != "false" ; then
Yann Diorcet's avatar
Yann Diorcet committed
321
	build_tools=true
322
	AC_DEFINE(BUILD_TOOLS, 1, [Define if tools enabled] )
Yann Diorcet's avatar
Yann Diorcet committed
323 324
fi

aymeric's avatar
aymeric committed
325 326
dnl conditionnal build of gtk interface.
AC_ARG_ENABLE(gtk_ui,
Yann Diorcet's avatar
Yann Diorcet committed
327 328 329 330 331 332 333 334
	[AS_HELP_STRING([--enable-gtk_ui=[yes/no]], [Turn on or off compilation of gtk interface (default=yes)])],
	[case "${enableval}" in
		yes)	gtk_ui=true ;;
		no)	gtk_ui=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-gtk_ui) ;;
	esac],
	[gtk_ui=true]
)
aymeric's avatar
aymeric committed
335 336

if test "$gtk_ui" = "true" ; then
337
	PKG_CHECK_MODULES(LIBGTK, gtk+-2.0 >= 2.18.0 gthread-2.0)
jehan's avatar
jehan committed
338
	if test "$enable_x11" = "false" ; then
339 340 341 342 343 344 345 346
		PKG_CHECK_MODULES(LIBGTKMAC,[gtk-mac-integration >= 2.0.1], [found_gtkmac=true], [found_gtkmac=false])
		if test "$found_gtkmac" != "true" ; then
			dnl for newest macports, the name changed.
			PKG_CHECK_MODULES(LIBGTKMAC,[gtk-mac-integration-gtk2 >= 2.0.1], [found_gtkmac=true], [found_gtkmac=false])
		fi
		if test "$found_gtkmac" != "true" ; then
			AC_MSG_ERROR([gtk-mac-integration not found. Please install gtk-osx-application package.])
		fi
jehan's avatar
jehan committed
347
		AC_DEFINE([HAVE_GTK_OSX],[1],[Defined when gtk osx is used])
348
	fi
349 350

	PKG_CHECK_MODULES(LIBGLIB, [glib-2.0 >= 2.26.0], [build_status_notifier=yes], [build_status_notifier=no])
aymeric's avatar
aymeric committed
351 352 353 354
else
	echo "GTK interface compilation is disabled."
fi

355 356
AM_CONDITIONAL([BUILD_STATUS_NOTIFIER], [test "$build_status_notifier" = "yes"])

357
AC_ARG_ENABLE(notify,
Yann Diorcet's avatar
Yann Diorcet committed
358 359 360 361 362 363 364 365
	[AS_HELP_STRING([--enable-notify=[yes/no]], [Enable libnotify support (default=yes)])],
	[case "${enableval}" in
		yes)	notify=true ;;
		no)	notify=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-notify) ;;
	esac],
	[notify=true]
)
366 367 368 369

dnl conditionnal build of the notify library
if test "$gtk_ui" = "true" ; then
	if test "$notify" = "true"; then
370 371
		PKG_CHECK_MODULES([NOTIFY4], [libnotify >= 0.7.0 ], [found_notify4=yes], foo=bar)
		case "$found_notify4" in
Yann Diorcet's avatar
Yann Diorcet committed
372
			yes)
373 374 375
				AC_SUBST(NOTIFY4_CFLAGS)
				AC_SUBST(NOTIFY4_LIBS)
				AC_DEFINE([HAVE_NOTIFY4],[1],[NOTIFY4 support])
376
		esac
377

Yann Diorcet's avatar
Yann Diorcet committed
378 379 380 381 382 383 384
		PKG_CHECK_MODULES([NOTIFY1], [libnotify < 0.7.0], [found_notify1=yes], foo=bar)
		case "$found_notify1" in
			yes)
				AC_SUBST(NOTIFY1_CFLAGS)
				AC_SUBST(NOTIFY1_LIBS)
				AC_DEFINE([HAVE_NOTIFY1],[1],[NOTIFY1 support])
		esac
385 386 387 388
	else
		echo "Libnotify support is disabled."
	fi
fi
aymeric's avatar
aymeric committed
389 390 391 392 393

dnl os-specific problems not handled by existing macros.
case "$host_os" in
	*freebsd*)
		LDFLAGS="$LDFLAGS -pthread"
Yann Diorcet's avatar
Yann Diorcet committed
394
	;;
aymeric's avatar
aymeric committed
395 396 397 398 399 400
esac

case "$host_cpu" in
	*arm*)
		AC_DEFINE(__ARM__,1,[Defined if we are compiling for arm processor])
		use_arm_toolchain=yes
Yann Diorcet's avatar
Yann Diorcet committed
401
	;;
aymeric's avatar
aymeric committed
402 403
esac

404
AC_ARG_WITH(configdir,
Yann Diorcet's avatar
Yann Diorcet committed
405 406
	[AS_HELP_STRING([--with-configdir], [Set a APPDATA subdir where linphone is supposed to find its config (windows only)])],
	[ configdir=${withval}],[ configdir="Linphone" ])
aymeric's avatar
aymeric committed
407

smorlat's avatar
smorlat committed
408
AC_DEFINE_UNQUOTED(LINPHONE_CONFIG_DIR,"$configdir",[Windows appdata subdir where linphonerc can be found])
aymeric's avatar
aymeric committed
409

410
AC_ARG_ENABLE(relativeprefix,
Yann Diorcet's avatar
Yann Diorcet committed
411 412 413 414 415 416 417 418
	[AS_HELP_STRING([--enable-relativeprefix], [Build a linphone that finds its resources relatively to the directory where it is installed])],
	[case "${enableval}" in
		yes)	relativeprefix=yes ;;
		no)	relativeprefix=no ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-relativeprefix) ;;
	esac],
	[relativeprefix=guess]
)
aymeric's avatar
aymeric committed
419

420
AC_ARG_ENABLE(date,
Yann Diorcet's avatar
Yann Diorcet committed
421 422 423 424 425 426 427 428
	[AS_HELP_STRING([--enable-date], [Use build date in internal version number])],
	[case "${enableval}" in
		yes)	use_date=yes ;;
		no)	use_date=no ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-date) ;;
	esac],
	[use_date=no]
)
429 430 431 432 433

if test x$use_date =  xyes ; then
	AC_DEFINE(USE_BUILDDATE_VERSION,1,[Tell whether date_version.h must be used])
fi

aymeric's avatar
aymeric committed
434 435 436

dnl enable ipv6 support
AC_ARG_ENABLE(ipv6,
Yann Diorcet's avatar
Yann Diorcet committed
437 438 439 440 441 442 443 444
	[AS_HELP_STRING([--enable-ipv6], [Turn on ipv6 support])],
	[case "${enableval}" in
		yes)	ipv6=true;;
		no)	ipv6=false;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
	esac],
	[ipv6=true]
)
aymeric's avatar
aymeric committed
445 446 447 448 449 450
IPV6_CFLAGS=
if test x$ipv6 = xtrue ; then
	IPV6_CFLAGS=-DINET6
fi
AC_SUBST(IPV6_CFLAGS)

451
dnl enable timestamp support
452
AC_ARG_ENABLE(ntp-timestamp,
Yann Diorcet's avatar
Yann Diorcet committed
453 454 455 456 457 458 459 460
	[AS_HELP_STRING([--enable-ntp-timestamp], [Turn on NTP timestamping on received packet])],
	[case "${enableval}" in
		yes)	ntptimestamp=true;;
		no)	ntptimestamp=false;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-ntp-timestamp) ;;
	esac],
	[ntptimestamp=false]
)
461 462

AC_ARG_ENABLE(debug,
Yann Diorcet's avatar
Yann Diorcet committed
463 464 465 466 467 468 469 470
	[AS_HELP_STRING([--enable-debug=[yes/no]], [Enables the display of traces showing the execution of the library. (default=yes)])],
	[case "${enableval}" in
		yes)	debug_enabled=yes;;
		no)	debug_enabled=no;;
		*)	AC_MSG_ERROR("Bad value for --enable-debug");;
	esac],
	[debug_enabled=no]
)
471
AS_CASE([$debug_enabled],
472
		[yes],[
473 474 475
			CFLAGS="$CFLAGS -g -O0 -DDEBUG"
			CXXFLAGS="$CXXFLAGS -g -O0 -DDEBUG"
			OBJCFLAGS="$OBJCFLAGS -g -O0 -DDEBUG"
476 477 478 479 480 481 482 483 484 485 486 487 488
		],
		[no],
		[
			case "$CFLAGS" in
				*-O*)
				;;
				*)
					CFLAGS="$CFLAGS -O2 -g"
					CXXFLAGS="$CXXFLAGS -O2 -g"
					OBJCFLAGS="$OBJCFLAGS -O2 -g"
				;;
			esac
		],
489
		[AC_MSG_ERROR([Bad value ($debug_enabled) for --enable-debug. Valid values are yes or no.])])
490

aymeric's avatar
aymeric committed
491 492
dnl enable truespeech codec support
AC_ARG_ENABLE(truespeech,
Yann Diorcet's avatar
Yann Diorcet committed
493 494 495 496 497 498 499 500
	[AS_HELP_STRING([--enable-truespeech], [Turn on TrueSpeech support (x86 only)])],
	[case "${enableval}" in
		yes)	truespeech=true;;
		no)	truespeech=false;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-truespeech) ;;
	esac],
	[truespeech=false]
)
aymeric's avatar
aymeric committed
501 502 503 504 505 506 507
TRUESPEECH_CFLAGS=
if test x$truespeech = xtrue ; then
	TRUESPEECH_CFLAGS=-DTRUESPEECH
fi
AC_SUBST(TRUESPEECH_CFLAGS)
AM_CONDITIONAL([BUILD_TRUESPEECH], [test x$truespeech = xtrue])

508
AC_ARG_ENABLE(nonstandard-gsm,
Yann Diorcet's avatar
Yann Diorcet committed
509 510 511 512 513 514 515 516 517 518 519
	[AS_HELP_STRING([--enable-nonstandard-gsm], [Enable GSM codec at nonstandard rates (11025hz, 16000hz)])],
	[case "${enableval}" in
		yes)
			exotic_gsm=yes
	 		AC_DEFINE(ENABLE_NONSTANDARD_GSM,1,[Defined when using gsm at nonstandard rates])
	 	;;
		no)	exotic_gsm=no ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-nonstandard-gsm) ;;
	esac],
	[exotic_gsm=no]
)
aymeric's avatar
aymeric committed
520 521

if test "x${prefix}" = "xNONE"; then
simorl's avatar
simorl committed
522 523 524 525 526
	package_prefix=${ac_default_prefix}
else
	package_prefix=${prefix}
fi

Simon Morlat's avatar
Simon Morlat committed
527 528 529 530 531
if test "$relativeprefix" = "guess" ; then
	if test "$mingw_found" = "yes" ; then
		relativeprefix="yes"
	fi
fi
532 533 534 535

if test "$relativeprefix" = "yes" ; then
	dnl allow binaries to install everywhere
	package_prefix="."
aymeric's avatar
aymeric committed
536 537 538
fi

dnl Set PACKAGE_LOCALE_DIR in config.h.
539 540 541 542 543 544 545 546
case "$target_os" in
	*qnx*)
		DATADIRNAME=app/native/assets
	;;
	*)
		DATADIRNAME=share
	;;
esac
simorl's avatar
simorl committed
547
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${package_prefix}/${DATADIRNAME}/locale",[Defines the place where locales can be found])
aymeric's avatar
aymeric committed
548

simorl's avatar
simorl committed
549
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${package_prefix}/${DATADIRNAME}",[Defines the place where data are found])
aymeric's avatar
aymeric committed
550 551

dnl Set PACKAGE_SOUND_DIR in config.h.
simorl's avatar
simorl committed
552
AC_DEFINE_UNQUOTED(PACKAGE_SOUND_DIR, "${package_prefix}/${DATADIRNAME}/sounds/linphone",[Defines the place where linphone sounds are found])
aymeric's avatar
aymeric committed
553 554 555 556 557 558


dnl check if we have the getifaddrs() sytem call
AC_CHECK_FUNCS(getifaddrs)

if test "$console_ui" = "true" ; then
Yann Diorcet's avatar
Yann Diorcet committed
559 560
	dnl check gnu readline
	LP_CHECK_READLINE
aymeric's avatar
aymeric committed
561
else
Yann Diorcet's avatar
Yann Diorcet committed
562
	echo "Console interface compilation is disabled."
aymeric's avatar
aymeric committed
563 564 565 566
fi

AC_WORDS_BIGENDIAN

567
AC_ARG_ENABLE([speex],
Yann Diorcet's avatar
Yann Diorcet committed
568 569 570 571
	AS_HELP_STRING([--disable-speex], [Disable speex support]),
	[],
	[enable_speex=yes]
)
572 573 574 575 576 577 578 579
if test "x$enable_speex" = "xyes"; then
	dnl normaly this should only by done by mediastreamer2/configure.ac
	dnl but to workaround bugs when cross-compiling for arm-linux,
	dnl we need to have SPEEX_LIBS defined
	dnl Furthermore it is good to repeat here all mediastreamer2 toggles
	dnl since top-level configure --help will not print them.
	PKG_CHECK_MODULES(SPEEX, speex >= 1.1.6, build_speex=yes)
fi
aymeric's avatar
aymeric committed
580 581 582

dnl conditionnal build of video support
AC_ARG_ENABLE(video,
583
	[AS_HELP_STRING([--enable-video], [Turn on video support compiling (default=yes)])],
Yann Diorcet's avatar
Yann Diorcet committed
584 585 586 587 588 589 590
	[case "${enableval}" in
		yes)	video=true ;;
		no)	video=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
	esac],
	[video=true]
)
591

Yann Diorcet's avatar
Yann Diorcet committed
592 593 594 595 596
AC_ARG_WITH(ffmpeg,
	[AS_HELP_STRING([--with-ffmpeg], [Sets the installation prefix of ffmpeg, needed for video support. (default=/usr)])],
	[ ffmpegdir=${withval}],
	[ ffmpegdir=/usr ]
)
aymeric's avatar
aymeric committed
597 598

if test "$video" = "true"; then
599

600
	if test "$enable_x11" = "true"; then
601
	  	AC_CHECK_HEADERS(X11/Xlib.h)
602
		if test "$build_macos" = "yes"; then
jehan's avatar
jehan committed
603 604 605 606
			X11_LIBS="-L/usr/X11/lib -lX11"
		else
			AC_CHECK_LIB(X11,XUnmapWindow, X11_LIBS="-lX11")
		fi
607
		AC_SUBST(X11_LIBS)
608
	fi
aymeric's avatar
aymeric committed
609 610 611 612
	AC_DEFINE(VIDEO_ENABLED,1,[defined if video support is available])
fi

AC_ARG_ENABLE(alsa,
Yann Diorcet's avatar
Yann Diorcet committed
613 614 615 616 617 618 619 620
	[AS_HELP_STRING([--enable-alsa], [Turn on alsa native support compiling])],
	[case "${enableval}" in
		yes)	alsa=true ;;
		no)	alsa=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-alsa) ;;
	esac],
	[alsa=true]
)
aymeric's avatar
aymeric committed
621

Simon Morlat's avatar
Simon Morlat committed
622
dnl this options are just for passing to mediastreamer2 subproject
Simon Morlat's avatar
Simon Morlat committed
623
AC_ARG_ENABLE(zrtp,
Yann Diorcet's avatar
Yann Diorcet committed
624 625 626 627 628 629 630 631
	[AS_HELP_STRING([--enable-zrtp], [Turn on zrtp support])],
	[case "${enableval}" in
		yes)	zrtp=true ;;
		no)	zrtp=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-zrtp) ;;
	esac],
	[zrtp=false]
)
Simon Morlat's avatar
Simon Morlat committed
632

Simon Morlat's avatar
Simon Morlat committed
633
dnl this options are just for passing to mediastreamer2 subproject
johan's avatar
johan committed
634
AC_ARG_ENABLE(dtls,
635
	[AS_HELP_STRING([--enable-dtls], [Turn on srtp-dtls support - requires polarssl > 1.4])],
johan's avatar
johan committed
636 637 638 639 640 641 642 643
	[case "${enableval}" in
		yes)	dtls=true ;;
		no)	dtls=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-dtls) ;;
	esac],
	[dtls=false]
)

644 645 646 647 648 649 650 651 652 653
AC_ARG_ENABLE(g729bCN,
	[AS_HELP_STRING([--enable-g729bCN], [Turn on or off usage of G729AnnexB in RFC3389 implementation of Comfort Noise Payload (default=no)])],
	[case "${enableval}" in
		yes)	g729bCN=true ;;
		no)	g729bCN=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-g729bCN) ;;
	esac],
	[g729bCN=false]
)

johan's avatar
johan committed
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
dnl Polarssl lib is requested for Lime
AC_ARG_WITH( polarssl,
      [  --with-polarssl      Set prefix where polarssl can be found (ex:/usr, /usr/local)[[default=PREFIX or /usr if NONE]] ],
      [ polarssl_prefix=${withval}],[ if test "$prefix" != "NONE"; then
					polarssl_prefix=${prefix}
				      else
					polarssl_prefix="/usr"
				      fi ])

found_polarssl=no

if test "$polarssl_prefix" != "none" ; then
	if test "$polarssl_prefix" != "/usr" ; then
		POLARSSL_CFLAGS="-I${polarssl_prefix}/include"
		POLARSSL_LIBS="-L${polarssl_prefix}/lib"
	fi
	POLARSSL_LIBS="$POLARSSL_LIBS -lpolarssl"

	CPPFLAGS_save=$CPPFLAGS
	LIBS_save=$LIBS

	CPPFLAGS="$CPPFLAGS $POLARSSL_CFLAGS"
	LIBS="$LIBS $POLARSSL_LIBS"
	AC_CHECK_HEADERS(polarssl/gcm.h,
				[found_polarssl=yes; AC_MSG_NOTICE([polarssl usable])],
				[POLARSSL_CFLAGS=""
					POLARSSL_LIBS=""])
	CPPFLAGS=$CPPFLAGS_save
	LIBS=$LIBS_save
fi

dnl check for Lime support, need polarssl version >= 1.3 (with gcm.h)
AC_ARG_ENABLE(lime,
Simon Morlat's avatar
Simon Morlat committed
687
	[AS_HELP_STRING([--enable-lime], [Turn on or off compilation of Instant Messaging Encryption (default=auto)])],
johan's avatar
johan committed
688 689 690 691 692
	[case "${enableval}" in
		yes)	lime=true ;;
		no)	lime=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-lime) ;;
	esac],
693
	[lime=false]
johan's avatar
johan committed
694 695
)

Simon Morlat's avatar
Simon Morlat committed
696
if test "$lime" != "false" ; then
johan's avatar
johan committed
697
	if test "x$found_polarssl" != "xyes" ; then
Simon Morlat's avatar
Simon Morlat committed
698 699 700 701
		if test "$lime" = "true" ; then
			AC_MSG_ERROR("LIME requires POLARSSL in version >= 1.3")
		fi
		lime=false
johan's avatar
johan committed
702 703
	else
		AC_DEFINE(HAVE_LIME, 1, [Defined when LIME support is compiled])
Simon Morlat's avatar
Simon Morlat committed
704
		lime=true
johan's avatar
johan committed
705 706 707
	fi
fi

aymeric's avatar
aymeric committed
708 709
dnl build console if required
AM_CONDITIONAL(BUILD_CONSOLE, test x$console_ui = xtrue)
Yann Diorcet's avatar
Yann Diorcet committed
710

aymeric's avatar
aymeric committed
711 712
dnl special things for arm-linux cross compilation toolchain
AM_CONDITIONAL(ARMBUILD, test x$use_arm_toolchain = xyes)
Yann Diorcet's avatar
Yann Diorcet committed
713

714 715
dnl compilation of gtk user interface
AM_CONDITIONAL(BUILD_GTK_UI, [test x$gtk_ui = xtrue ] )
716
AM_CONDITIONAL(BUILD_WIN32, test x$mingw_found = xyes )
aymeric's avatar
aymeric committed
717

718 719 720 721 722 723 724 725 726 727
dnl check getenv
AH_TEMPLATE([HAVE_GETENV])
AC_CHECK_FUNC([getenv], AC_DEFINE([HAVE_GETENV], [1], [If present, the getenv function allows fim to read environment variables.]))

dnl
AC_MSG_CHECKING([for sighandler_t])
AC_TRY_COMPILE([#include <signal.h>],[sighandler_t *f;],
has_sighandler_t=yes,has_sighandler_t=no)
AC_MSG_RESULT($has_sighandler_t)
if test "$has_sighandler_t" = "yes" ; then
Yann Diorcet's avatar
Yann Diorcet committed
728
	AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] )
729 730
fi

731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755
AC_ARG_ENABLE(assistant,
	[AS_HELP_STRING([--enable-assistant], [Turn on assistant compiling])],
	[case "${enableval}" in
		yes)	build_wizard=true ;;
		no)	build_wizard=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-assistant) ;;
	esac],
	[build_wizard=check]
)

if test "$build_wizard" != "false" ; then
	PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[],
		[if test "$build_wizard" = "true" ; then
			AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.])
		else
			build_wizard=false
		fi]
	)
fi
AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard != xfalse)
if test "$build_wizard" != "false" ; then
	build_wizard=true
	 AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] )
fi

756 757 758
AC_CHECK_HEADERS(libudev.h)
AC_CHECK_LIB(udev,udev_new)

aymeric's avatar
aymeric committed
759 760 761 762 763 764
##################################################
# Stricter build options (after external packages)
##################################################


AC_ARG_ENABLE(strict,
765
	AC_HELP_STRING([--enable-strict], [Build with stricter options @<:@yes@:>@]),
Yann Diorcet's avatar
Yann Diorcet committed
766 767
	[strictness="${enableval}"],
	[strictness=yes]
aymeric's avatar
aymeric committed
768 769
)

770 771 772
STRICT_OPTIONS="-Wall -Wuninitialized"
STRICT_OPTIONS_CC="-Wdeclaration-after-statement "
STRICT_OPTIONS_CXX=""
773

jehan's avatar
jehan committed
774 775
#for clang

776
case $CC in
Simon Morlat's avatar
Simon Morlat committed
777
	*clang*)
778
		STRICT_OPTIONS="$STRICT_OPTIONS -Qunused-arguments "
779 780 781
		#disabled due to wrong optimization false positive with small string
		#(cf. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35903)
		STRICT_OPTIONS="$STRICT_OPTIONS -Wno-array-bounds "
Simon Morlat's avatar
Simon Morlat committed
782 783
	;;
esac
784 785 786 787 788 789 790 791 792
# because Darwin's gcc is actually clang, we need to check it...
case "$target_os" in
	*darwin*)
	STRICT_OPTIONS="$STRICT_OPTIONS -Wno-error=unknown-warning-option -Qunused-arguments -Wno-tautological-compare -Wno-unused-function "
	#disabled due to wrong optimization false positive with small string
	#(cf. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35903)
	STRICT_OPTIONS="$STRICT_OPTIONS -Wno-array-bounds "
	;;
esac
jehan's avatar
jehan committed
793
if test "$strictness" = "yes" ; then
794
	STRICT_OPTIONS="$STRICT_OPTIONS -Werror"
aymeric's avatar
aymeric committed
795 796 797 798
	CFLAGS="$CFLAGS -fno-strict-aliasing"
fi

AC_SUBST(STRICT_OPTIONS)
799 800
AC_SUBST(STRICT_OPTIONS_CC)
AC_SUBST(STRICT_OPTIONS_CXX)
aymeric's avatar
aymeric committed
801

802 803
top_srcdir=`dirname $0`

804 805 806 807 808 809 810 811 812 813 814
AC_ARG_ENABLE(external-ortp,
	[AS_HELP_STRING([--enable-external-ortp], [Use external oRTP library])],
	[case "${enableval}" in
		yes)	external_ortp=true ;;
		no)	external_ortp=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-external-ortp) ;;
	esac],
	[external_ortp=false]
)

if test "$external_ortp" = 'true'; then
815
	PKG_CHECK_MODULES([ORTP], [ortp >= 0.24.0])
816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836
	ORTP_VERSION=`$PKG_CONFIG --modversion ortp`
else
	AC_CONFIG_SUBDIRS( oRTP )
	ORTP_CFLAGS="-I\$(top_srcdir)/oRTP/include"
	ORTP_LIBS="\$(top_builddir)/oRTP/src/libortp.la"
	if test x$ac_cv_c_bigendian = xyes ; then
		ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
	fi
	if test x$ntptimestamp = xtrue ; then
		ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP"
	fi
	ORTP_DIR=oRTP
	changequote(<<, >>)
	ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
	changequote([, ])
fi
AC_SUBST(ORTP_CFLAGS)
AC_SUBST(ORTP_LIBS)
AC_SUBST([ORTP_VERSION])
AC_SUBST([ORTP_DIR])

837
AC_ARG_ENABLE([external-mediastreamer],
Yann Diorcet's avatar
Yann Diorcet committed
838 839 840
	[AS_HELP_STRING([--enable-external-mediastreamer],[Use external mediastreamer library])],,
	[enable_external_mediastreamer=no]
)
841 842

AS_CASE($enable_external_mediastreamer,
Yann Diorcet's avatar
Yann Diorcet committed
843
	[yes],
844
	[PKG_CHECK_MODULES([MEDIASTREAMER], [mediastreamer >= 2.11.0])
Yann Diorcet's avatar
Yann Diorcet committed
845 846 847 848 849 850
	MS2_VERSION=`$PKG_CONFIG --modversion mediastreamer`],
	[no],
	[AC_CONFIG_SUBDIRS( mediastreamer2 )
	MEDIASTREAMER_DIR=${top_srcdir}/mediastreamer2
	MEDIASTREAMER_CFLAGS="-I\$(top_srcdir)/mediastreamer2/include"
	MEDIASTREAMER_LIBS="\$(top_builddir)/mediastreamer2/src/libmediastreamer_base.la \$(top_builddir)/mediastreamer2/src/libmediastreamer_voip.la"
851
dnl need to temporary change quotes to allow square brackets
Yann Diorcet's avatar
Yann Diorcet committed
852 853 854 855 856 857
	changequote(<<, >>)
	MS2_VERSION=`grep -e '^.C_INIT(' $MEDIASTREAMER_DIR/configure.ac | sed -e 's:\([^(]\+\)(\[mediastreamer\],\[\(.*\)\]):\2:g'`
	changequote([, ])
	MS2_DIR=mediastreamer2],
	[AC_MSG_ERROR([bad value '${enable_external_mediastreamer}' for --enable-external-mediastreamer])]
)
858 859 860 861

AC_SUBST(MEDIASTREAMER_CFLAGS)
AC_SUBST(MEDIASTREAMER_LIBS)
AC_SUBST([MS2_VERSION])
862
AC_SUBST([MS2_DIR])
aymeric's avatar
aymeric committed
863

Guillaume Beraudo's avatar
Guillaume Beraudo committed
864 865

AC_ARG_ENABLE(tunnel,
Yann Diorcet's avatar
Yann Diorcet committed
866 867 868 869 870 871 872 873
	[AS_HELP_STRING([--enable-tunnel=[yes/no]], [Turn on compilation of tunnel support (default=no)])],
	[case "${enableval}" in
		yes)	enable_tunnel=true ;;
		no)	enable_tunnel=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-tunnel) ;;
	esac],
	[enable_tunnel=false]
)
Guillaume Beraudo's avatar
Guillaume Beraudo committed
874 875
AM_CONDITIONAL(BUILD_TUNNEL, test x$enable_tunnel = xtrue)
if test x$enable_tunnel = xtrue; then
Yann Diorcet's avatar
Yann Diorcet committed
876
	PKG_CHECK_MODULES(TUNNEL, tunnel >= 0.3.3)
877
	AC_DEFINE(TUNNEL_ENABLED,1,[Tells tunnel extension is built-in])
Guillaume Beraudo's avatar
Guillaume Beraudo committed
878 879
fi

Margaux Clerc's avatar
Margaux Clerc committed
880
AC_ARG_ENABLE(msg-storage,
Simon Morlat's avatar
Simon Morlat committed
881
	[AS_HELP_STRING([--enable-msg-storage=[yes/no]], [Turn on compilation of message storage (default=auto)])],
Margaux Clerc's avatar
Margaux Clerc committed
882 883 884 885 886
	[case "${enableval}" in
		yes)	enable_msg_storage=true ;;
		no)	enable_msg_storage=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-msg-storage) ;;
	esac],
Simon Morlat's avatar
Simon Morlat committed
887
	[enable_msg_storage=auto]
Margaux Clerc's avatar
Margaux Clerc committed
888
)
Simon Morlat's avatar
Simon Morlat committed
889 890

if test x$enable_msg_storage != xfalse; then
891 892 893
	PKG_CHECK_MODULES(SQLITE3,[sqlite3 >= 3.6.0],[found_sqlite=yes],[found_sqlite=no])
	if test "$found_sqlite" = "no"; then
		dnl Check the lib presence in case the PKG-CONFIG version is not found
894
		AC_CHECK_LIB(sqlite3, sqlite3_open, [SQLITE3_LIBS+=" -lsqlite3 "; found_sqlite=yes], [foo=bar])
895 896
	fi
	if test "$found_sqlite" = "yes"; then
897
		SQLITE3_CFLAGS+=" -DMSG_STORAGE_ENABLED"
François Grisez's avatar
François Grisez committed
898
		if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
899 900
			SQLITE3_LIBS+=" -liconv"
		fi
901
		enable_msg_storage=true
902 903 904
	else
		if test x$enable_msg_storage = xtrue; then
			AC_MSG_ERROR([sqlite3, required for message storage, not found])
Simon Morlat's avatar
Simon Morlat committed
905
		fi
906
		enable_msg_storage=false
907
	fi
908

909 910
	AC_SUBST(SQLITE3_CFLAGS)
	AC_SUBST(SQLITE3_LIBS)
Margaux Clerc's avatar
Margaux Clerc committed
911
fi
Guillaume Beraudo's avatar
Guillaume Beraudo committed
912

913
AM_CONDITIONAL(BUILD_MSG_STORAGE, test x$enable_msg_storage = xtrue)
914

915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949
AC_ARG_ENABLE(call-logs-storage,
        [AS_HELP_STRING([--enable-call-logs-storage=[yes/no]], [Turn on compilation of call logs storage (default=auto)])],
        [case "${enableval}" in
                yes)    enable_call_logs_storage=true ;;
                no)     enable_call_logs_storage=false ;;
                *)      AC_MSG_ERROR(bad value ${enableval} for --enable-call-logs-storage) ;;
        esac],
        [enable_call_logs_storage=auto]
)

if test x$enable_call_logs_storage != xfalse; then
        PKG_CHECK_MODULES(SQLITE3,[sqlite3 >= 3.6.0],[found_sqlite=yes],[found_sqlite=no])
        if test "$found_sqlite" = "no"; then
                dnl Check the lib presence in case the PKG-CONFIG version is not found
                AC_CHECK_LIB(sqlite3, sqlite3_open, [SQLITE3_LIBS+=" -lsqlite3 "; found_sqlite=yes], [foo=bar])
        fi
        if test "$found_sqlite" = "yes"; then
                SQLITE3_CFLAGS+=" -DCALL_LOGS_STORAGE_ENABLED"
                if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
                        SQLITE3_LIBS+=" -liconv"
                fi
                enable_call_logs_storage=true
        else
                if test x$enable_call_logs_storage = xtrue; then
                        AC_MSG_ERROR([sqlite3, required for call logs storage, not found])
                fi
                enable_call_logs_storage=false
        fi

        AC_SUBST(SQLITE3_CFLAGS)
        AC_SUBST(SQLITE3_LIBS)
fi

AM_CONDITIONAL(BUILD_CALL_LOGS_STORAGE, test x$enable_call_logs_storage = xtrue)

950
PKG_CHECK_MODULES(BELLESIP, [belle-sip >= 1.4.0])
Guillaume Beraudo's avatar
Guillaume Beraudo committed
951

952 953
SIPSTACK_CFLAGS="$BELLESIP_CFLAGS"
SIPSTACK_LIBS="$BELLESIP_LIBS"
Guillaume Beraudo's avatar
Guillaume Beraudo committed
954 955


jehan's avatar
jehan committed
956 957
AC_SUBST(SIPSTACK_CFLAGS)
AC_SUBST(SIPSTACK_LIBS)
Guillaume Beraudo's avatar
Guillaume Beraudo committed
958

aymeric's avatar
aymeric committed
959
dnl check for db2html (docbook) to generate html user manual
Yann Diorcet's avatar
Yann Diorcet committed
960
AC_CHECK_PROG(have_sgmltools, sgmltools, yes, no)
aymeric's avatar
aymeric committed
961 962 963
AM_CONDITIONAL(ENABLE_MANUAL, test x$have_sgmltools$build_manual = xyesyes )

dnl for external use of linphone libs
964
LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone"
965
LINPHONE_LIBS="-L${libdir} -llinphone"
simorl's avatar
simorl committed
966

aymeric's avatar
aymeric committed
967 968 969
AC_SUBST(LINPHONE_CFLAGS)
AC_SUBST(LINPHONE_LIBS)

Yann Diorcet's avatar
Yann Diorcet committed
970
AC_DEFINE_UNQUOTED(LINPHONE_VERSION, "$PACKAGE_VERSION", [Linphone\'s version number])
aymeric's avatar
aymeric committed
971

simorl's avatar
simorl committed
972 973
AC_DEFINE_UNQUOTED(LINPHONE_PLUGINS_DIR, "${package_prefix}/lib/liblinphone/plugins" ,[path of liblinphone plugins, not mediastreamer2 plugins])
LINPHONE_PLUGINS_DIR="${package_prefix}/lib/liblinphone/plugins"
smorlat's avatar
smorlat committed
974
AC_SUBST(LINPHONE_PLUGINS_DIR)
aymeric's avatar
aymeric committed
975 976 977



jehan's avatar
jehan committed
978 979 980 981 982 983 984 985 986 987 988
AC_ARG_ENABLE(tutorials,
	[AS_HELP_STRING([--disable-tutorials], [Disable compilation of tutorials])],
	[case "${enableval}" in
		yes)	tutorials_enabled=true ;;
		no)	tutorials_enabled=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-tutorials) ;;
	esac],
	[tutorials_enabled=yes]
)
AM_CONDITIONAL(ENABLE_TUTORIALS, test x$tutorials_enabled = xyes)

Ghislain MARY's avatar
Ghislain MARY committed
989
AC_ARG_ENABLE(tests,
Yann Diorcet's avatar
Yann Diorcet committed
990 991 992 993 994 995
	[AS_HELP_STRING([--disable-tests], [Disable compilation of tests])],
	[case "${enableval}" in
		yes)	tests_enabled=true ;;
		no)	tests_enabled=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-tests) ;;
	esac],
Simon Morlat's avatar
Simon Morlat committed
996
	[tests_enabled=yes]
Yann Diorcet's avatar
Yann Diorcet committed
997
)
998
AM_CONDITIONAL(ENABLE_TESTS, test x$tests_enabled = xyes)
jehan's avatar
jehan committed
999 1000 1001 1002

PKG_CHECK_MODULES(CUNIT, cunit, [found_cunit=yes],[found_cunit=no])

if test "$found_cunit" = "no" ; then
jehan's avatar
jehan committed
1003 1004 1005 1006 1007 1008 1009 1010
        AC_CHECK_HEADERS(CUnit/CUnit.h,
                [
                        AC_CHECK_LIB(cunit,CU_add_suite,[
                                found_cunit=yes
                                CUNIT_LIBS+=" -lcunit"
                        ])

                ])
jehan's avatar
jehan committed
1011 1012 1013 1014 1015 1016 1017 1018
fi

case "$target_os" in
	*darwin*)
		#hack for macport
		CUNIT_LIBS+=" -lncurses"
	;;
esac
Simon Morlat's avatar
Simon Morlat committed
1019
AM_CONDITIONAL([BUILD_CUNIT_TESTS], [test x$found_cunit = xyes && test x$tests_enabled != xfalse])
jehan's avatar
jehan committed
1020 1021 1022
if test "$found_cunit" = "no" ; then
        AC_MSG_WARN([Could not find cunit framework, tests are not compiled.])
else
1023 1024 1025 1026
		AC_CHECK_LIB(cunit,CU_get_suite,[
										AC_DEFINE(HAVE_CU_GET_SUITE,1,[defined when CU_get_suite is available])
										],[foo=bar],[$CUNIT_LIBS])

jehan's avatar
jehan committed
1027 1028 1029 1030
        AC_CHECK_LIB(cunit,CU_curses_run_tests,[
                                        AC_DEFINE(HAVE_CU_CURSES,1,[defined when CU_curses_run_tests is available])
                                        ],[foo=bar],[$CUNIT_LIBS])
fi
Guillaume Beraudo's avatar
Guillaume Beraudo committed
1031

1032 1033 1034 1035 1036 1037
case "$target_os" in
	*linux*)
		# Eliminate -lstdc++ addition to postdeps for cross compiles.
		postdeps_CXX=`echo " $postdeps_CXX " | sed 's, -lstdc++ ,,g'`
	;;
esac
Guillaume Beraudo's avatar
Guillaume Beraudo committed
1038

1039

1040 1041 1042 1043
dnl ##################################################
dnl # Check for doxygen
dnl ##################################################

1044 1045
AC_ARG_ENABLE(documentation,
	[AS_HELP_STRING([--enable-documentation], [Documentation generation using doxygen (default=yes)])],
1046 1047 1048
	[case "${enableval}" in
		yes)	documentation_enabled=yes;;
		no)		documentation_enabled=no;;
1049
		*)		AC_MSG_ERROR("Bad value for --enable-documentation");;
1050 1051 1052 1053 1054 1055 1056 1057
	esac],
	[documentation_enabled=yes]
)
if test "$documentation_enabled" = "yes" ; then
	AC_CHECK_PROG(DOXYGEN,doxygen,doxygen,false)
else
	DOXYGEN=false
fi
Simon Morlat's avatar
Simon Morlat committed
1058
AM_CONDITIONAL(HAVE_DOXYGEN, test "$DOXYGEN" != "false")
1059

jehan's avatar
jehan committed
1060
AC_PATH_PROG([SIPP],[sipp],[false])
jehan's avatar
jehan committed
1061 1062
if test "x$SIPP" != "xfalse" ; then
	AC_DEFINE(HAVE_SIPP,1,[defined when SIPP is available])
jehan's avatar
jehan committed
1063
	AC_DEFINE_UNQUOTED(SIPP_COMMAND,"$SIPP",[defined when SIPP is available])
jehan's avatar
jehan committed
1064
fi
Jehan Monnier's avatar
Jehan Monnier committed
1065

1066
AC_CONFIG_FILES([
Yann Diorcet's avatar
Yann Diorcet committed
1067 1068 1069 1070
	Makefile
	build/Makefile
	build/macos/Makefile
	build/macos/Info-linphone.plist
1071
	build/macos/pkg-distribution.xml
Yann Diorcet's avatar
Yann Diorcet committed
1072 1073 1074
	m4/Makefile
	po/Makefile.in
	pixmaps/Makefile
jehan's avatar
jehan committed
1075
	include/Makefile
Yann Diorcet's avatar
Yann Diorcet committed
1076 1077 1078
	coreapi/Makefile
	coreapi/help/Makefile
	coreapi/help/Doxyfile
1079
	tester/Makefile
Yann Diorcet's avatar
Yann Diorcet committed
1080 1081 1082 1083 1084 1085