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

Simon Morlat's avatar
Simon Morlat committed
3
AC_INIT([linphone],[3.5.99.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

20
LIBLINPHONE_SO_CURRENT=5 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 27 28 29 30 31

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

32 33
AM_INIT_AUTOMAKE
AC_SUBST([LIBTOOL_DEPS])
34
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
Yann Diorcet's avatar
Yann Diorcet committed
35
AC_SUBST([docdir], [${datadir}/doc])
36
AC_CONFIG_HEADERS(config.h)
smorlat's avatar
smorlat committed
37
AC_CONFIG_MACRO_DIR([m4])
aymeric's avatar
aymeric committed
38 39
AC_ISC_POSIX
AC_PROG_CC
Guillaume Beraudo's avatar
Guillaume Beraudo committed
40
AC_PROG_CXX
aymeric's avatar
aymeric committed
41 42
AC_C_INLINE
AC_HEADER_STDC
43
AM_PROG_CC_C_O
Simon Morlat's avatar
Simon Morlat committed
44 45
AC_CHECK_PROGS(MD5SUM,[md5sum md5])
AM_CONDITIONAL(HAVE_MD5SUM,test -n $MD5SUM)
46

jehan's avatar
jehan committed
47
case $target in
48
	*mingw32ce)
Yann Diorcet's avatar
Yann Diorcet committed
49 50 51
		CFLAGS="$CFLAGS -D_WIN32_WCE -DORTP_STATIC -D_WIN32_WINNT=0x0501"
		CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
		LIBS="$LIBS -lws2 -liphlpapi"
52
		mingw_found=yes
53
		mingwce_found=yes
Yann Diorcet's avatar
Yann Diorcet committed
54
	;;
55
	*mingw*)
56
		CFLAGS="$CFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501 "
57 58 59 60 61 62
		CXXFLAGS="$CXXFLAGS -DORTP_STATIC -D_WIN32_WINNT=0x0501"
		LIBS="$LIBS -lws2_32"
		GUI_FLAGS="-mwindows"
		CONSOLE_FLAGS="-mconsole"
		mingw_found=yes
	;;
Yann Diorcet's avatar
Yann Diorcet committed
63 64 65 66 67 68 69
	armv6-apple-darwin|armv7-apple-darwin|i386-apple-darwin|armv7s-apple-darwin)
		CFLAGS="$CFLAGS -DTARGET_OS_IPHONE "
		build_tests=no
		ios_found=yes
	;;
	x86_64-apple-darwin*|i686-apple-darwin*)
		MSPLUGINS_CFLAGS=""
smorlat's avatar
smorlat committed
70 71
		dnl use macport installation
		ACLOCAL_MACOS_FLAGS="-I /opt/local/share/aclocal"
72
		build_macos=yes
Yann Diorcet's avatar
Yann Diorcet committed
73
	;;
jehan's avatar
jehan committed
74

75 76
esac

smorlat's avatar
smorlat committed
77
AC_SUBST(ACLOCAL_MACOS_FLAGS)
78 79 80
AC_SUBST(CONSOLE_FLAGS)
AC_SUBST(GUI_FLAGS)

aymeric's avatar
aymeric committed
81
dnl localization tools
82 83
IT_PROG_INTLTOOL([0.40], [no-xml])

jehan's avatar
jehan committed
84
AM_CONDITIONAL(BUILD_TESTS,test x$build_tests != xno)
Yann Diorcet's avatar
Yann Diorcet committed
85

aymeric's avatar
aymeric committed
86
dnl Initialize libtool
87
LT_INIT([win32-dll shared disable-static])
Yann Diorcet's avatar
Yann Diorcet committed
88

89 90
dnl Enable library dependencies linking
AC_ARG_ENABLE(deplibs-link,
Yann Diorcet's avatar
Yann Diorcet committed
91 92 93 94
	[AS_HELP_STRING([--disable-deplibs-link ], [Disable library dependencies linking (might break builds)])],
	[enable_deplibs_linking="$enableval"],
	[enable_deplibs_linking="yes"]
)
95 96
AC_MSG_NOTICE([Enable library dependencies linking: $enable_interlib_deps])
if test "${enable_deplibs_linking}" == "yes"; then
Yann Diorcet's avatar
Yann Diorcet committed
97 98
	link_all_deplibs=yes
	link_all_deplibs_CXX=yes
99
else
Yann Diorcet's avatar
Yann Diorcet committed
100 101
	link_all_deplibs=no
	link_all_deplibs_CXX=no
102
fi
103

Yann Diorcet's avatar
Yann Diorcet committed
104 105 106 107 108 109 110 111 112
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]
)
113

aymeric's avatar
aymeric committed
114 115
dnl Add the languages which your application supports here.
PKG_PROG_PKG_CONFIG
116
ALL_LINGUAS="fr it de ja es pl cs nl sv pt_BR hu ru zh_CN nb_NO zh_TW he"
strk's avatar
strk committed
117
AC_SUBST(ALL_LINGUAS)
118
AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages])
119 120

if test "$mingw_found" != "yes" ; then
121 122 123 124 125
	dnl gettext macro does not work properly under mingw. And we want to use the one provided by GTK.
	
	dnl AM_GNU_GETTEXT pollutes CPPFLAGS: workaround this.
	CPPFLAGS_save=$CPPFLAGS
	AM_GNU_GETTEXT([external])
Yann Diorcet's avatar
Yann Diorcet committed
126
	AC_SUBST(INTLLIBS)
127 128
	CPPFLAGS=$CPPFLAGS_save
	LIBS="$LIBS $LIBINTL"
129
else
130 131 132
	AC_DEFINE(ENABLE_NLS,1,[Tells whether localisation is possible])
	AC_DEFINE(HAVE_GETTEXT,1,[Tells wheter localisation is possible])
	LIBS="$LIBS -lintl"
133 134 135
fi

GETTEXT_PACKAGE=linphone
aymeric's avatar
aymeric committed
136
AC_SUBST(GETTEXT_PACKAGE)
Yann Diorcet's avatar
Yann Diorcet committed
137
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext package name])
138
dnl AC_CHECK_LIB(intl,libintl_gettext)
aymeric's avatar
aymeric committed
139 140 141

AC_CHECK_FUNCS([get_current_dir_name strndup stpcpy] )

142
AC_ARG_ENABLE(x11,
Yann Diorcet's avatar
Yann Diorcet committed
143 144 145 146 147 148 149 150
	[AS_HELP_STRING([--disable-x11], [Disable X11 support (default=no)])],
	[case "${enableval}" in
		yes)	enable_x11=true ;;
		no)	enable_x11=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-x11) ;;
	esac],
	[enable_x11=true]
)
151

aymeric's avatar
aymeric committed
152 153
dnl conditionnal build of console interface.
AC_ARG_ENABLE(console_ui,
Yann Diorcet's avatar
Yann Diorcet committed
154 155 156 157 158 159 160 161
	[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
162

Yann Diorcet's avatar
Yann Diorcet committed
163 164
dnl conditionnal build of tools.
AC_ARG_ENABLE(tools,
Yann Diorcet's avatar
Yann Diorcet committed
165 166 167 168 169 170 171 172
	[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
173

Yann Diorcet's avatar
Yann Diorcet committed
174 175
dnl check for installed version of libupnp
AC_ARG_ENABLE(upnp,
Yann Diorcet's avatar
Yann Diorcet committed
176 177 178 179 180 181 182 183
	[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
184 185

if test "$build_upnp" != "false" ; then
Yann Diorcet's avatar
Yann Diorcet committed
186 187
	PKG_CHECK_MODULES([LIBUPNP], [libupnp], [build_upnp=true],
		[if test "$build_upnp" == "true" ; then
Yann Diorcet's avatar
Yann Diorcet committed
188 189 190
			AC_MSG_ERROR([libupnp not found.])
		else
			build_upnp=false
Yann Diorcet's avatar
Yann Diorcet committed
191 192
		fi]
	)
Yann Diorcet's avatar
Yann Diorcet committed
193 194 195 196 197 198 199 200

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
201 202
dnl check libxml2 (needed for tools)
if test "$build_tools" != "false" ; then
203
	PKG_CHECK_MODULES(LIBXML2, [libxml-2.0],[],
Yann Diorcet's avatar
Yann Diorcet committed
204
		[if test "$build_tools" = "true" ; then
Yann Diorcet's avatar
Yann Diorcet committed
205 206 207
			AC_MSG_ERROR([Could not found libxml2, tools cannot be compiled.])
		else
			build_tools=false
Yann Diorcet's avatar
Yann Diorcet committed
208 209
		fi]
	)
Yann Diorcet's avatar
Yann Diorcet committed
210 211 212 213
fi

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

aymeric's avatar
aymeric committed
218 219
dnl conditionnal build of gtk interface.
AC_ARG_ENABLE(gtk_ui,
Yann Diorcet's avatar
Yann Diorcet committed
220 221 222 223 224 225 226 227
	[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
228 229

if test "$gtk_ui" = "true" ; then
230
	PKG_CHECK_MODULES(LIBGTK, gtk+-2.0 >= 2.18.0 gthread-2.0)
jehan's avatar
jehan committed
231
	if test "$enable_x11" = "false" ; then
232
		PKG_CHECK_MODULES(LIBGTKMAC,[gtk-mac-integration >= 2.0.1])
jehan's avatar
jehan committed
233
		AC_DEFINE([HAVE_GTK_OSX],[1],[Defined when gtk osx is used])
234
	fi
aymeric's avatar
aymeric committed
235 236 237 238
else
	echo "GTK interface compilation is disabled."
fi

239
AC_ARG_ENABLE(notify,
Yann Diorcet's avatar
Yann Diorcet committed
240 241 242 243 244 245 246 247
	[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]
)
248 249 250 251

dnl conditionnal build of the notify library
if test "$gtk_ui" = "true" ; then
	if test "$notify" = "true"; then
252 253
		PKG_CHECK_MODULES([NOTIFY4], [libnotify >= 0.7.0 ], [found_notify4=yes], foo=bar)
		case "$found_notify4" in
Yann Diorcet's avatar
Yann Diorcet committed
254
			yes)
255 256 257
				AC_SUBST(NOTIFY4_CFLAGS)
				AC_SUBST(NOTIFY4_LIBS)
				AC_DEFINE([HAVE_NOTIFY4],[1],[NOTIFY4 support])
258
		esac
259

Yann Diorcet's avatar
Yann Diorcet committed
260 261 262 263 264 265 266
		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
267
	else
Yann Diorcet's avatar
Yann Diorcet committed
268
		NotifyNotification *n;
269 270 271
		echo "Libnotify support is disabled."
	fi
fi
aymeric's avatar
aymeric committed
272 273 274 275 276

dnl os-specific problems not handled by existing macros.
case "$host_os" in
	*freebsd*)
		LDFLAGS="$LDFLAGS -pthread"
Yann Diorcet's avatar
Yann Diorcet committed
277
	;;
aymeric's avatar
aymeric committed
278 279 280 281 282 283
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
284
	;;
aymeric's avatar
aymeric committed
285 286
esac

287
AC_ARG_WITH(configdir,
Yann Diorcet's avatar
Yann Diorcet committed
288 289
	[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
290

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

293
AC_ARG_ENABLE(relativeprefix,
Yann Diorcet's avatar
Yann Diorcet committed
294 295 296 297 298 299 300 301
	[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
302

303
AC_ARG_ENABLE(date,
Yann Diorcet's avatar
Yann Diorcet committed
304 305 306 307 308 309 310 311
	[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]
)
312 313 314 315 316

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
317 318 319

dnl enable ipv6 support
AC_ARG_ENABLE(ipv6,
Yann Diorcet's avatar
Yann Diorcet committed
320 321 322 323 324 325 326 327
	[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
328 329 330 331 332 333
IPV6_CFLAGS=
if test x$ipv6 = xtrue ; then
	IPV6_CFLAGS=-DINET6
fi
AC_SUBST(IPV6_CFLAGS)

334
dnl enable timestamp support
335
AC_ARG_ENABLE(ntp-timestamp,
Yann Diorcet's avatar
Yann Diorcet committed
336 337 338 339 340 341 342 343
	[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]
)
344 345

AC_ARG_ENABLE(debug,
Yann Diorcet's avatar
Yann Diorcet committed
346 347 348 349 350 351 352 353
	[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]
)
354

aymeric's avatar
aymeric committed
355 356
dnl enable truespeech codec support
AC_ARG_ENABLE(truespeech,
Yann Diorcet's avatar
Yann Diorcet committed
357 358 359 360 361 362 363 364
	[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
365 366 367 368 369 370 371
TRUESPEECH_CFLAGS=
if test x$truespeech = xtrue ; then
	TRUESPEECH_CFLAGS=-DTRUESPEECH
fi
AC_SUBST(TRUESPEECH_CFLAGS)
AM_CONDITIONAL([BUILD_TRUESPEECH], [test x$truespeech = xtrue])

372
AC_ARG_ENABLE(nonstandard-gsm,
Yann Diorcet's avatar
Yann Diorcet committed
373 374 375 376 377 378 379 380 381 382 383
	[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
384 385 386 387


dnl support for RSVP (by Vincent Maury)
AC_ARG_ENABLE(rsvp,
Yann Diorcet's avatar
Yann Diorcet committed
388 389 390
	[AS_HELP_STRING([--enable-rsvp], [Enable support for QoS reservations.])],
	AC_DEFINE(VINCENT_MAURY_RSVP,1,[Tell whether RSVP support should be compiled.])
)
aymeric's avatar
aymeric committed
391 392

if test "x${prefix}" = "xNONE"; then
simorl's avatar
simorl committed
393 394 395 396 397
	package_prefix=${ac_default_prefix}
else
	package_prefix=${prefix}
fi

Simon Morlat's avatar
Simon Morlat committed
398 399 400 401 402
if test "$relativeprefix" = "guess" ; then
	if test "$mingw_found" = "yes" ; then
		relativeprefix="yes"
	fi
fi
403 404 405 406

if test "$relativeprefix" = "yes" ; then
	dnl allow binaries to install everywhere
	package_prefix="."
aymeric's avatar
aymeric committed
407 408 409 410
fi

dnl Set PACKAGE_LOCALE_DIR in config.h.
DATADIRNAME=share
simorl's avatar
simorl committed
411
AC_DEFINE_UNQUOTED(PACKAGE_LOCALE_DIR, "${package_prefix}/${DATADIRNAME}/locale",[Defines the place where locales can be found])
aymeric's avatar
aymeric committed
412

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

dnl Set PACKAGE_SOUND_DIR in config.h.
simorl's avatar
simorl committed
416
AC_DEFINE_UNQUOTED(PACKAGE_SOUND_DIR, "${package_prefix}/${DATADIRNAME}/sounds/linphone",[Defines the place where linphone sounds are found])
aymeric's avatar
aymeric committed
417 418 419 420 421 422 423 424


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

dnl check for osip2
LP_CHECK_OSIP2

jehan's avatar
jehan committed
425 426
dnl conditionnal build for ssl
AC_ARG_ENABLE(ssl,
Yann Diorcet's avatar
Yann Diorcet committed
427 428 429 430 431 432 433 434
	[AS_HELP_STRING([--enable-ssl], [Turn on ssl support compiling. Required for sip tls. (default=false)])],
	[case "${enableval}" in
		yes)	build_ssl=true ;;
		no)	build_ssl=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-ssl) ;;
	esac],
	[build_ssl=false]
)
jehan's avatar
jehan committed
435 436 437 438

if test "$build_ssl" = "true"; then
	PKG_CHECK_MODULES(OPENSSL, libssl >= 0.9.8)
fi
aymeric's avatar
aymeric committed
439 440 441
dnl setup flags for exosip library
LP_SETUP_EXOSIP

442 443 444
dnl check exosip support of DSCP in exosip
AC_MSG_CHECKING([for DSCP support in exosip])
AC_TRY_COMPILE([#include <eXosip2/eXosip.h>],
Yann Diorcet's avatar
Yann Diorcet committed
445 446 447 448
	[int dscp=0;eXosip_set_option(EXOSIP_OPT_SET_DSCP,&dscp);],
	has_exosip_dscp=yes,
	has_exosip_dscp=no
)
449 450
AC_MSG_RESULT($has_exosip_dscp)
if test "$has_exosip_dscp" = "yes" ; then
Yann Diorcet's avatar
Yann Diorcet committed
451
	AC_DEFINE( HAVE_EXOSIP_DSCP, 1, [Define if exosip dscp available] )
452 453 454
fi


aymeric's avatar
aymeric committed
455
if test "$console_ui" = "true" ; then
Yann Diorcet's avatar
Yann Diorcet committed
456 457
	dnl check gnu readline
	LP_CHECK_READLINE
aymeric's avatar
aymeric committed
458
else
Yann Diorcet's avatar
Yann Diorcet committed
459
	echo "Console interface compilation is disabled."
aymeric's avatar
aymeric committed
460 461 462 463
fi

AC_WORDS_BIGENDIAN

464
AC_ARG_ENABLE([speex],
Yann Diorcet's avatar
Yann Diorcet committed
465 466 467 468
	AS_HELP_STRING([--disable-speex], [Disable speex support]),
	[],
	[enable_speex=yes]
)
469 470 471 472 473 474 475 476
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
477 478 479

dnl conditionnal build of video support
AC_ARG_ENABLE(video,
Yann Diorcet's avatar
Yann Diorcet committed
480 481 482 483 484 485 486 487
	[AS_HELP_STRING([--enable-video], [Turn on video support compiling])],
	[case "${enableval}" in
		yes)	video=true ;;
		no)	video=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-video) ;;
	esac],
	[video=true]
)
488

Yann Diorcet's avatar
Yann Diorcet committed
489 490 491 492 493
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
494 495

if test "$video" = "true"; then
496 497
	
	if test "$enable_x11" = "true"; then
498
	  	AC_CHECK_HEADERS(X11/Xlib.h)
jehan's avatar
jehan committed
499 500 501 502 503
		if test "$build_macos" = "yes"; then 
			X11_LIBS="-L/usr/X11/lib -lX11"
		else
			AC_CHECK_LIB(X11,XUnmapWindow, X11_LIBS="-lX11")
		fi
504
		AC_SUBST(X11_LIBS)
505
	fi
aymeric's avatar
aymeric committed
506 507 508 509
	AC_DEFINE(VIDEO_ENABLED,1,[defined if video support is available])
fi

AC_ARG_ENABLE(alsa,
Yann Diorcet's avatar
Yann Diorcet committed
510 511 512 513 514 515 516 517
	[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
518

Simon Morlat's avatar
Simon Morlat committed
519
AC_ARG_ENABLE(zrtp,
Yann Diorcet's avatar
Yann Diorcet committed
520 521 522 523 524 525 526 527
	[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
528

aymeric's avatar
aymeric committed
529 530

AC_ARG_ENABLE(portaudio,
Yann Diorcet's avatar
Yann Diorcet committed
531 532 533 534 535 536 537 538
	[AS_HELP_STRING([--enable-portaudio], [Turn on portaudio native support compiling])],
	[case "${enableval}" in
		yes)	portaudio=true ;;
		no)	portaudio=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-portaudio) ;;
	esac],
	[portaudio=false]
)
aymeric's avatar
aymeric committed
539 540 541

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

aymeric's avatar
aymeric committed
543 544
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
545

546 547
dnl compilation of gtk user interface
AM_CONDITIONAL(BUILD_GTK_UI, [test x$gtk_ui = xtrue ] )
548
AM_CONDITIONAL(BUILD_WIN32, test x$mingw_found = xyes )
Simon Morlat's avatar
Simon Morlat committed
549
AM_CONDITIONAL(BUILD_ZRTP, test x$zrtp = xtrue)
aymeric's avatar
aymeric committed
550

551 552 553 554 555 556 557 558 559 560
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
561
	AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] )
562 563
fi

564
AC_ARG_ENABLE(assistant,
Yann Diorcet's avatar
Yann Diorcet committed
565 566 567 568 569 570 571 572
	[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]
)
573

Sylvain Berfini's avatar
Sylvain Berfini committed
574
dnl check libsoup (needed for wizard)
575
if test "$build_wizard" != "false" ; then
576
	PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26],[],
Yann Diorcet's avatar
Yann Diorcet committed
577
		[if test "$build_wizard" = "true" ; then
578
			AC_MSG_ERROR([Could not found libsoup, assistant cannot be compiled.])
579 580
		else
			build_wizard=false
Yann Diorcet's avatar
Yann Diorcet committed
581 582
		fi]
	)
Yann Diorcet's avatar
Yann Diorcet committed
583 584
fi
if test "$build_wizard" != "false" ; then
585
	PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[],
Yann Diorcet's avatar
Yann Diorcet committed
586
		[if test "$build_wizard" = "true" ; then
587 588 589
			AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.])
		else
			build_wizard=false
Yann Diorcet's avatar
Yann Diorcet committed
590 591
		fi]
	)
592
fi
Sylvain Berfini's avatar
Sylvain Berfini committed
593 594
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
Yann Diorcet's avatar
Yann Diorcet committed
595
AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard != xfalse)
596
if test "$build_wizard" != "false" ; then
Yann Diorcet's avatar
Yann Diorcet committed
597 598
	build_wizard=true
	 AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] ) 
599
fi
Sylvain Berfini's avatar
Sylvain Berfini committed
600

601 602 603
AC_CHECK_HEADERS(libudev.h)
AC_CHECK_LIB(udev,udev_new)

aymeric's avatar
aymeric committed
604 605 606 607 608 609
##################################################
# Stricter build options (after external packages)
##################################################


AC_ARG_ENABLE(strict,
Yann Diorcet's avatar
Yann Diorcet committed
610 611 612
	AC_HELP_STRING([--enable-strict], [Build with stricter options (gcc only) @<:@yes@:>@]),
	[strictness="${enableval}"],
	[strictness=yes]
aymeric's avatar
aymeric committed
613 614
)

615 616
STRICT_OPTIONS="-Wall "

jehan's avatar
jehan committed
617
if test "$strictness" = "yes" ; then
aymeric's avatar
aymeric committed
618 619 620 621 622 623
	STRICT_OPTIONS="$STRICT_OPTIONS -Werror"
	CFLAGS="$CFLAGS -fno-strict-aliasing"
fi

AC_SUBST(STRICT_OPTIONS)

624 625 626
top_srcdir=`dirname $0`

AC_ARG_ENABLE([external-mediastreamer],
Yann Diorcet's avatar
Yann Diorcet committed
627 628 629
	[AS_HELP_STRING([--enable-external-mediastreamer],[Use external mediastreamer library])],,
	[enable_external_mediastreamer=no]
)
630 631

AS_CASE($enable_external_mediastreamer,
Yann Diorcet's avatar
Yann Diorcet committed
632 633 634 635 636 637 638 639
	[yes],
	[PKG_CHECK_MODULES([MEDIASTREAMER], [mediastreamer])
	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"
640
dnl need to temporary change quotes to allow square brackets
Yann Diorcet's avatar
Yann Diorcet committed
641 642 643 644 645 646
	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])]
)
647 648 649 650

AC_SUBST(MEDIASTREAMER_CFLAGS)
AC_SUBST(MEDIASTREAMER_LIBS)
AC_SUBST([MS2_VERSION])
651
AC_SUBST([MS2_DIR])
aymeric's avatar
aymeric committed
652

Guillaume Beraudo's avatar
Guillaume Beraudo committed
653 654 655


AC_ARG_ENABLE(tunnel,
Yann Diorcet's avatar
Yann Diorcet committed
656 657 658 659 660 661 662 663
	[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
664 665
AM_CONDITIONAL(BUILD_TUNNEL, test x$enable_tunnel = xtrue)
if test x$enable_tunnel = xtrue; then
Yann Diorcet's avatar
Yann Diorcet committed
666 667 668 669
	PKG_CHECK_MODULES(TUNNEL, tunnel >= 0.3.3)
	TUNNEL_CFLAGS+="-DTUNNEL_ENABLED"
	AC_SUBST(TUNNEL_CFLAGS)
	AC_SUBST(TUNNEL_LIBS)
Guillaume Beraudo's avatar
Guillaume Beraudo committed
670 671 672
fi


aymeric's avatar
aymeric committed
673
dnl check for db2html (docbook) to generate html user manual
Yann Diorcet's avatar
Yann Diorcet committed
674
AC_CHECK_PROG(have_sgmltools, sgmltools, yes, no)
aymeric's avatar
aymeric committed
675 676 677
AM_CONDITIONAL(ENABLE_MANUAL, test x$have_sgmltools$build_manual = xyesyes )

dnl for external use of linphone libs
678 679
LINPHONE_CFLAGS="-I${includedir} -I${includedir}/linphone"
LINPHONE_LIBS="-L${libdir} -llinphone"
simorl's avatar
simorl committed
680 681 682 683

if test x$mingw_found = xyes ; then
	LINPHONE_LIBS="$LINPHONE_LIBS $OSIP_LIBS"
fi
aymeric's avatar
aymeric committed
684 685 686
AC_SUBST(LINPHONE_CFLAGS)
AC_SUBST(LINPHONE_LIBS)

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

simorl's avatar
simorl committed
689 690
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
691
AC_SUBST(LINPHONE_PLUGINS_DIR)
aymeric's avatar
aymeric committed
692 693

AC_ARG_ENABLE(external-ortp,
Yann Diorcet's avatar
Yann Diorcet committed
694 695 696 697 698 699 700 701
	[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]
)
aymeric's avatar
aymeric committed
702 703

if test "$external_ortp" = 'true'; then
704 705
	PKG_CHECK_MODULES([ORTP], [ortp])
	ORTP_VERSION=`$PKG_CONFIG --modversion ortp`
aymeric's avatar
aymeric committed
706 707 708 709 710 711 712
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
713
	if test x$ntptimestamp = xtrue ; then
Yann Diorcet's avatar
Yann Diorcet committed
714
		ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP"
715
	fi
716
	ORTP_DIR=oRTP
717 718 719
	changequote(<<, >>)
	ORTP_VERSION=`grep -E ^[AC]+_INIT ${top_srcdir}/oRTP/configure.ac | sed -e 's:^.*_INIT(.*,\[\(.*\)\]):\1:g'`
	changequote([, ])
aymeric's avatar
aymeric committed
720 721 722
fi
AC_SUBST(ORTP_CFLAGS)
AC_SUBST(ORTP_LIBS)
723
AC_SUBST([ORTP_VERSION])
724
AC_SUBST([ORTP_DIR])
aymeric's avatar
aymeric committed
725

726
AC_ARG_ENABLE(tests_enabled,
Yann Diorcet's avatar
Yann Diorcet committed
727 728 729 730 731 732 733 734
	[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],
	[tests_enabled=false]
)
735 736
AM_CONDITIONAL(ENABLE_TESTS, test x$tests_enabled = xyes)

Guillaume Beraudo's avatar
Guillaume Beraudo committed
737 738


739 740 741 742 743 744 745
dnl ##################################################
dnl # Check for doxygen
dnl ##################################################

AC_PATH_PROG(DOXYGEN,doxygen,false)
AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)

746

747
AC_CONFIG_FILES([ 
Yann Diorcet's avatar
Yann Diorcet committed
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
	Makefile
	build/Makefile
	build/macos/Makefile
	build/macos/Info-linphone.plist
	m4/Makefile
	po/Makefile.in
	pixmaps/Makefile
	coreapi/Makefile
	coreapi/help/Makefile
	coreapi/help/Doxyfile
	gtk/Makefile
	console/Makefile
	share/Makefile
	share/C/Makefile
	share/fr/Makefile
	share/it/Makefile
	share/ja/Makefile
	share/cs/Makefile
	share/xml/Makefile
	share/linphone.pc
	share/linphone.desktop
	scripts/Makefile
	tools/Makefile
	linphone.spec
	linphone.iss
aymeric's avatar
aymeric committed
773 774
])

775 776
AC_OUTPUT

aymeric's avatar
aymeric committed
777
echo "Linphone build configuration ended."
778
echo "Summary of build options:"
Yann Diorcet's avatar
Yann Diorcet committed
779 780 781 782 783 784
printf "* %-30s %s\n" "Video support"		$video
printf "* %-30s %s\n" "GTK interface"		$gtk_ui
printf "* %-30s %s\n" "Account assistant"	$build_wizard
printf "* %-30s %s\n" "Console interface"	$console_ui
printf "* %-30s %s\n" "Tools"			$build_tools
printf "* %-30s %s\n" "zRTP encryption (GPLv3)"	$zrtp
785
printf "* %-30s %s\n" "uPnP support" 		$build_upnp
786 787 788

if test "$enable_tunnel" = "true" ; then
	printf "* Tunnel support\t\ttrue\n"
aymeric's avatar
aymeric committed
789 790 791
fi

echo "Now type 'make' to compile, and then 'make install' as root to install it."