1dnl Process this file with autoconf to produce a configure script.
2AC_INIT([mediastreamer],[2.15.1])
3
4AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION		A mediastreaming library for telephony application.])
5AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])
6
7dnl do not put anything else before AC_PROG_CC unless checking if macro still work for clang
8AC_PROG_CXX(["xcrun clang++" g++])
9AC_PROG_CC(["xcrun clang" gcc])
10AC_PROG_OBJC(["xcrun clang" gcc])
11AC_CANONICAL_SYSTEM
12
13dnl Source packaging numbers
14MEDIASTREAMER_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
15MEDIASTREAMER_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
16MEDIASTREAMER_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
17MEDIASTREAMER_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)
18
19LIBMEDIASTREAMER_SO_CURRENT=10 dnl increment this number when you add/change/remove an interface. It has been incremented after Mediastreamer 2.15.1. Do not increment until next release.
20LIBMEDIASTREAMER_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
21LIBMEDIASTREAMER_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface
22
23LIBMEDIASTREAMER_SO_VERSION=$LIBMEDIASTREAMER_SO_CURRENT:$LIBMEDIASTREAMER_SO_REVISION:$LIBMEDIASTREAMER_SO_AGE
24MEDIASTREAMER_VERSION=${MEDIASTREAMER_MAJOR_VERSION}.${MEDIASTREAMER_MINOR_VERSION}.${MEDIASTREAMER_MICRO_VERSION}
25
26if test -n "$MEDIASTREAMER_EXTRA_VERSION" ; then
27	MEDIASTREAMER_VERSION="${MEDIASTREAMER_VERSION}.${MEDIASTREAMER_EXTRA_VERSION}"
28fi
29
30AC_SUBST(LIBMEDIASTREAMER_SO_CURRENT, $LIBMEDIASTREAMER_SO_CURRENT)
31AC_SUBST(LIBMEDIASTREAMER_SO_VERSION)
32AC_SUBST(MEDIASTREAMER_VERSION)
33
34PACKAGE=mediastreamer
35
36OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
37AC_MSG_RESULT([Building Package on ${OS}])
38AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects foreign])
39m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
40AC_SUBST([docdir], [${datadir}/doc])
41AC_CONFIG_HEADERS(mediastreamer-config.h)
42AC_DEFINE_UNQUOTED(MEDIASTREAMER_MAJOR_VERSION,$MEDIASTREAMER_MAJOR_VERSION, [major version])
43AC_DEFINE_UNQUOTED(MEDIASTREAMER_MINOR_VERSION,$MEDIASTREAMER_MINOR_VERSION, [minor version])
44AC_DEFINE_UNQUOTED(MEDIASTREAMER_MICRO_VERSION,$MEDIASTREAMER_MICRO_VERSION, [micro version])
45AC_DEFINE_UNQUOTED(MEDIASTREAMER_VERSION,"$MEDIASTREAMER_VERSION",[MEDIASTREAMER version number])
46
47MS_PUBLIC_CFLAGS=
48
49gl_LD_OUTPUT_DEF
50
51AC_MSG_CHECKING([warning make an error on compilation])
52
53AC_ARG_ENABLE(strict,
54	AC_HELP_STRING([--enable-strict], [Build with stricter options @<:@yes@:>@]),
55	[strictness="${enableval}"],
56	[strictness=yes]
57)
58
59STRICT_OPTIONS="-Wall -Wuninitialized"
60STRICT_OPTIONS_CC="-Wdeclaration-after-statement -Wstrict-prototypes"
61STRICT_OPTIONS_CXX=""
62
63#for clang
64
65case $CC in
66	*clang*)
67		STRICT_OPTIONS="$STRICT_OPTIONS -Qunused-arguments -Wno-unused-function "
68		#disabled due to wrong optimization false positive with small string
69		#(cf. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35903)
70		STRICT_OPTIONS="$STRICT_OPTIONS -Wno-array-bounds "
71	;;
72esac
73
74# because Darwin's gcc is actually clang, we need to check it...
75case "$target_os" in
76	*darwin*)
77	STRICT_OPTIONS="$STRICT_OPTIONS -Wno-error=unknown-warning-option -Qunused-arguments -Wno-tautological-compare -Wno-unused-function "
78	#disabled due to wrong optimization false positive with small string
79	#(cf. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35903)
80	STRICT_OPTIONS="$STRICT_OPTIONS -Wno-array-bounds "
81	;;
82esac
83
84if test "$strictness" = "yes" ; then
85	STRICT_OPTIONS="$STRICT_OPTIONS -Werror -Wextra -Wno-unused-parameter -Wno-error=strict-prototypes -Wno-missing-field-initializers"
86	CFLAGS="$CFLAGS -fno-strict-aliasing"
87fi
88AC_SUBST(STRICT_OPTIONS)
89AC_SUBST(STRICT_OPTIONS_CC)
90AC_SUBST(STRICT_OPTIONS_CXX)
91
92dnl enable timestamp support
93AC_ARG_ENABLE(ntp-timestamp,
94	[AS_HELP_STRING([--enable-ntp-timestamp], [Turn on NTP timestamping on received packet (default=no)])],
95	[case "${enableval}" in
96		yes)	ntptimestamp=true;;
97		no)	ntptimestamp=false;;
98		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-ntp-timestamp) ;;
99	esac],
100	[ntptimestamp=false]
101)
102
103
104AC_CONFIG_MACRO_DIR([m4])
105LT_INIT([win32-dll shared disable-static])
106
107
108AC_SUBST([LIBTOOL_DEPS])
109
110if test "$GCC" != "yes" ; then
111	case $target_os in
112		*hpux*)
113			dnl we are probably using HPUX cc compiler, so add a +O2 to CFLAGS
114			CFLAGS="$CFLAGS +O2 -g "
115		;;
116	esac
117else
118	CFLAGS="$CFLAGS -Wall -fdiagnostics-show-option"
119	OBJCFLAGS="$OBJCFLAGS -Wall"
120	CXXFLAGS="$CXXFLAGS -Wall"
121fi
122
123AC_ARG_ENABLE([debug],
124	AS_HELP_STRING([--enable-debug=@<:@yes/no@:>@],[enables the display of traces showing the execution of the library. @<:@default=yes@:>@]),
125	[],
126	[enable_debug=no]
127)
128
129
130AS_CASE([$enable_debug],
131		[yes],[
132			CFLAGS="$CFLAGS -g -O0 -DDEBUG"
133			CXXFLAGS="$CXXFLAGS -g -O0 -DDEBUG"
134			OBJCFLAGS="$OBJCFLAGS -g -O0 -DDEBUG"
135		],
136		[no],
137		[
138			case "$CFLAGS" in
139				*-O*)
140				;;
141				*)
142					CFLAGS="$CFLAGS -O2 -g"
143					CXXFLAGS="$CXXFLAGS -O2 -g"
144					OBJCFLAGS="$OBJCFLAGS -O2 -g"
145				;;
146			esac
147		],
148		[AC_MSG_ERROR([Bad value ($enable_debug) for --enable-debug. Valid values are yes or no.])])
149
150AC_ARG_ENABLE(non-free-codecs,
151	AC_HELP_STRING([--enable-non-free-codecs], [Include non-free codecs in build @<:@yes@:>@]),
152	[non_free_codecs="${enableval}"],
153	[non_free_codecs=yes]
154)
155
156if test "$non_free_codecs" = "yes" ; then
157	AC_DEFINE(HAVE_NON_FREE_CODECS, 1, [whether non free codecs are allowed in the build])
158else
159	AC_DEFINE(HAVE_NON_FREE_CODECS, 0, [whether non free codecs are allowed in the build])
160fi
161
162dnl Checks for header files.
163AC_HEADER_STDC
164
165dnl Checks for typedefs, structures, and compiler characteristics.
166AC_C_CONST
167AC_C_INLINE
168AC_HEADER_TIME
169AC_WORDS_BIGENDIAN
170if test x$ac_cv_c_bigendian = xyes ; then
171	CFLAGS="$CFLAGS -D_BIGENDIAN "
172fi
173
174macosx_found=no
175mingw32ce_found=no
176ios_found=no
177
178dnl add thread flags
179case $host in
180	i386-apple*|armv6-apple*|armv7-apple*|armv7s-apple*|aarch64-apple*|arm64-apple*|*-darwin.ios)
181		ios_found=yes
182	;;
183	x86_64-apple*|i686-apple*)
184		macosx_found=yes
185		OBJCFLAGS="$OBJCFLAGS -Wno-error=deprecated-declarations"
186	;;
187  	*mingw32ce)
188		CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0501  -D_WIN32_WCE  -DORTP_STATIC"
189		CXXFLAGS="$CXXFLAGS -D_WIN32_WINNT=0x0501 -DORTP_STATIC  -D_WIN32_WCE"
190dnl ORTP_STATIC to tell ortp not to export its variable with dllexport, as if we were building statically, or dynamically on linux
191	  	LIBS="$LIBS -lws2"
192		mingw_found=yes
193		mingw32ce_found=yes
194	;;
195	*mingw*)
196		dnl Workaround for mingw, whose compiler does not check in /usr/include ...
197		CPPFLAGS="$CPPFLAGS -I/usr/include"
198		LDFLAGS="$LDFLAGS -L/usr/lib"
199		CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
200		CXXFLAGS="$CXXFLAGS -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
201dnl ORTP_STATIC to tell ortp not to export its variable with dllexport, as if we were building statically, or dynamically on linux
202		LIBS="$LIBS -lws2_32 -lwinmm "
203		mingw_found=yes
204	;;
205	*nto-qnx*)
206	;;
207	*)
208		MSPLUGINS_CFLAGS="-pthread"
209		MSPLUGINS_LIBS="-shared -pthread"
210		CFLAGS="$CFLAGS -pthread -D_REENTRANT"
211		LIBS="$LIBS -pthread -lpthread"
212	;;
213esac
214
215if test "$macosx_found" == "yes" ; then
216	LIBS="$LIBS -framework CoreFoundation -framework AudioToolbox -framework CoreAudio -framework AppKit"
217fi
218if test "$ios_found" == "yes" ; then
219	LIBS="$LIBS -framework CoreFoundation -framework AudioToolbox -framework CoreAudio -framework Foundation -framework QuartzCore -framework OpenGLES -framework UIKit -framework AVFoundation"
220fi
221
222dnl localization tools
223IT_PROG_INTLTOOL([0.40], [no-xml])
224
225
226GETTEXT_PACKAGE="mediastreamer"
227AC_SUBST([GETTEXT_PACKAGE])
228AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[name of the gettext domain. Used in the call to 'bindtextdomain()'])
229if test "$mingw_found" != "yes" ; then
230	dnl gettext macro does not work properly under mingw. And we want to use the one provided by GTK.
231	CPPFLAGS_save=$CPPFLAGS
232	AM_GNU_GETTEXT([external])
233	AC_SUBST(INTLLIBS)
234	CPPFLAGS=$CPPFLAGS_save
235	LIBS="$LIBS $LIBINTL"
236else
237	if test "$USE_NLS" = "yes" ; then
238		AC_DEFINE(ENABLE_NLS,1,[Tells whether localisation is possible])
239		AC_DEFINE(HAVE_GETTEXT,1,[Tells wheter localisation is possible])
240		LIBS="$LIBS -L/usr/lib -lintl"
241	fi
242fi
243
244AM_CONDITIONAL(BUILD_MACOSX, test x$macosx_found = xyes)
245AM_CONDITIONAL(BUILD_IOS, test x$ios_found = xyes)
246
247AC_CONFIG_COMMANDS([libtool-hacking],
248	[if test "$mingw_found" = "yes" ; then
249		echo "Hacking libtool to work with mingw..."
250		sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
251		cp -f ./libtool.tmp ./libtool
252		rm -f ./libtool.tmp
253	else
254		echo "No need to hack libtool."
255	fi],
256	[mingw_found=$mingw_found]
257)
258
259dnl conditionnal build of tools.
260AC_ARG_ENABLE(tools,
261	[AS_HELP_STRING([--enable-tools=[yes/no]], [Turn on or off compilation of console interface (default=yes)])],
262	[case "${enableval}" in
263		yes)	build_tools=true ;;
264		no)	build_tools=false ;;
265		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-tools) ;;
266	esac],
267	[build_tools=check]
268)
269AM_CONDITIONAL(BUILD_TOOLS, test x$build_tools != xfalse)
270if test "$build_tools" != "false" ; then
271	build_tools=true
272	AC_DEFINE(BUILD_TOOLS, 1, [Define if tools enabled] )
273fi
274
275dnl prefer fixed point computations
276AC_ARG_ENABLE(fixed_point,
277	[AS_HELP_STRING([--enable-fixed-point=@<:@yes/no/guess@:>@], [Turn on fixed point computations (default=guess)])],
278	[case "${enableval}" in
279		yes)	fixed_point=true;;
280		no)	fixed_point=false;;
281		guess)	fixed_point=guess;;
282		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-fixed-point) ;;
283	esac],
284	[fixed_point=guess]
285)
286
287if test "$fixed_point" = "guess" ; then
288	AC_MSG_CHECKING([whether fixed point arithmetic is preferred])
289	case ${target_cpu}${host_cpu} in
290		*bfin*)
291			fixed_point=true
292		;;
293		*arm*)
294			fixed_point=true
295		;;
296		*)
297			fixed_point=false
298		;;
299	esac
300	AC_MSG_RESULT([$fixed_point])
301fi
302
303
304if test x$fixed_point = xtrue ; then
305	MS_PUBLIC_CFLAGS="$MS_PUBLIC_CFLAGS -DMS_FIXED_POINT"
306fi
307
308
309dnl initialize pkg-config so that we can use it within if else fi statements.
310PKG_PROG_PKG_CONFIG()
311
312AC_SUBST(MSPLUGINS_CFLAGS)
313AC_SUBST(MSPLUGINS_LIBS)
314
315dnl	*********************************
316dnl	various checks for soundcard apis
317dnl	*********************************
318
319found_sound=no
320
321if test x$mingw_found = xyes ; then
322	found_sound=yes
323fi
324
325AC_ARG_ENABLE(sound,
326	[AS_HELP_STRING([--disable-sound], [Turn off all possible sound backend (default=no)])],
327	[case "${enableval}" in
328		yes)	use_sound=true ;;
329		no)	use_sound=false ;;
330		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-sound) ;;
331	esac],
332	[use_sound=true]
333)
334
335AC_ARG_ENABLE(oss,
336	[AS_HELP_STRING([--enable-oss], [Enable oss support])],
337	[case "${enableval}" in
338		yes)	oss=true ;;
339		no)	oss=false ;;
340		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-oss) ;;
341	esac],
342	[oss=$use_sound]
343)
344
345if "$oss" = "true"; then
346	AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h sys/audio.h)
347	if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
348	   test "${ac_cv_header_soundcard_h}" = "yes" || \
349	   test "${ac_cv_header_sys_audio_h}" = "yes" || \
350	   test "${ac_cv_header_machine_soundcard_h}" = "yes"; then
351		found_sound=yes
352	else
353		oss=false
354	fi
355fi
356
357AM_CONDITIONAL(BUILD_OSS, test x$oss = xtrue)
358
359dnl conditionnal build of ALSA support
360AC_ARG_ENABLE(alsa,
361	[AS_HELP_STRING([--enable-alsa], [Turn on alsa native support compiling])],
362	[case "${enableval}" in
363		yes)	alsa=true ;;
364		no)	alsa=false ;;
365		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-alsa) ;;
366	esac],
367	[alsa=$use_sound]
368)
369
370if test "$alsa" = "true"; then
371	AC_CHECK_HEADERS(alsa/asoundlib.h,
372		[ AC_CHECK_LIB(asound,snd_pcm_open,
373			[ ALSA_LIBS="-lasound"
374			  found_sound=yes
375			AC_DEFINE(__ALSA_ENABLED__,1,[defined if alsa support is available])
376			alsa_enabled=true
377			])
378		]
379	)
380fi
381AC_SUBST(ALSA_LIBS)
382
383AM_CONDITIONAL(BUILD_ALSA, test x$alsa_enabled = xtrue)
384
385dnl conditionnal build of QSA support
386AC_ARG_ENABLE(qsa,
387	[AS_HELP_STRING([--enable-qsa], [Turn on QSA (QNX Sound Architecture) support])],
388	[case "${enableval}" in
389		yes)	qsa=true ;;
390		no)	qsa=false ;;
391		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-qsa) ;;
392	esac],
393	[qsa=$false]
394)
395if test "$qsa" = "true"; then
396	AC_CHECK_HEADERS(sys/asoundlib.h,
397		[ AC_CHECK_LIB(asound, snd_pcm_open,
398			[ QSA_LIBS="-lasound"
399			  found_sound=yes
400			AC_DEFINE(__QSA_ENABLED__, 1, [defined if QSA support is available])
401			qsa_enabled=true
402			])
403		]
404	)
405fi
406AC_SUBST(QSA_LIBS)
407AM_CONDITIONAL(BUILD_QSA, test x$qsa_enabled = xtrue)
408
409
410AC_ARG_ENABLE(artsc,
411	[AS_HELP_STRING([--enable-artsc], [Turn on artsc (KDE<4) sound input/output (default=no)])],
412	[case "${enableval}" in
413		yes)	artsc=true ;;
414		no)	artsc=false ;;
415		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-artsc) ;;
416	esac],
417	[artsc=false]
418)
419
420arts_enabled=false
421
422if test "$artsc" = "true" ; then
423	dnl check for arts (kde sound daemon) support
424	PKG_CHECK_MODULES(ARTS, [artsc],[
425		dnl New detection
426		arts_enabled=true
427	],[
428		dnl Old detection
429		if test x$artsc = xtrue ; then
430			AC_CHECK_HEADERS(kde/artsc/artsc.h,
431				[ AC_CHECK_LIB(artsc,arts_init,
432					[ ARTS_LIBS="-lartsc"
433					arts_enabled=true
434					])
435				]
436			)
437		fi
438		AC_SUBST(ARTS_LIBS)
439	])
440fi
441
442if test x$arts_enabled = xtrue; then
443	found_sound=yes
444	AC_DEFINE(__ARTS_ENABLED__,1,[defined if arts support is available])
445fi
446
447AM_CONDITIONAL(BUILD_ARTS, test x$arts_enabled = xtrue)
448
449AC_ARG_ENABLE(portaudio,
450	[AS_HELP_STRING([--enable-portaudio], [Turn on portaudio native support compiling (default=no)])],
451	[case "${enableval}" in
452		yes)	portaudio=true ;;
453		no)	portaudio=false ;;
454		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-portaudio) ;;
455	esac],
456	[portaudio=false]
457)
458
459if test "$portaudio" = "true"; then
460	AC_CHECK_HEADERS(portaudio.h,
461		[ AC_CHECK_LIB(portaudio,Pa_Initialize,
462			[PORTAUDIO_LIBS="-lportaudio"
463			found_sound=yes
464			AC_DEFINE(__PORTAUDIO_ENABLED__,1,[defined if portaudio support is available])
465			portaudio_enabled=true]
466			)
467		]
468	)
469fi
470
471AC_SUBST(PORTAUDIO_LIBS)
472AM_CONDITIONAL(BUILD_PORTAUDIO, test x$portaudio_enabled = xtrue)
473
474AC_ARG_ENABLE(macsnd,
475	[AS_HELP_STRING([--enable-macsnd], [Turn on MAC OS X Audio Units sound support])],
476	[case "${enableval}" in
477		yes)	macsnd=true ;;
478		no)	macsnd=false ;;
479		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-macsnd) ;;
480	esac],
481	[macsnd=$use_sound]
482)
483
484macaqsnd_default=no
485if test "$ios_found" = "yes" ; then
486	macaqsnd_default=true;
487fi
488
489AC_ARG_ENABLE(macaqsnd,
490	[AS_HELP_STRING([--enable-macaqsnd], [Turn on native MAC OS X Audio Queue sound support (default=no)])],
491	[case "${enableval}" in
492		yes)	macaqsnd=true ;;
493		no)	macaqsnd=false ;;
494		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-macaqsnd) ;;
495	esac],
496	[macaqsnd=$macaqsnd_default]
497)
498
499if test "$macosx_found" = "yes" ; then
500	if test "$macsnd" = "true"; then
501		AC_DEFINE(__MACSND_ENABLED__,1,[defined if native macosx sound support is available])
502		macsnd_enabled=true
503		LIBS="$LIBS -framework Carbon -framework AudioUnit"
504		found_sound=yes
505	fi
506fi
507
508if test "$macaqsnd" = "true"; then
509	AC_DEFINE(__MAC_AQ_ENABLED__,1,[defined if native macosx AQ sound support is available])
510	found_sound=yes
511	macaqsnd=true
512fi
513
514AM_CONDITIONAL(BUILD_MACSND, test x$macsnd_enabled = xtrue)
515AM_CONDITIONAL(BUILD_MACAQSND, test x$macaqsnd = xtrue)
516AM_CONDITIONAL(BUILD_IOSIOUNIT, test x$ios_found = xyes)
517
518AC_ARG_ENABLE(pulseaudio,
519	[AS_HELP_STRING([--disable-pulseaudio], [Disable pulseaudio support])],
520	[case "${enableval}" in
521		yes)	pulseaudio=true ;;
522		no)	pulseaudio=false ;;
523		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-pulseaudio) ;;
524	esac],
525	[pulseaudio=$use_sound]
526)
527
528
529if test x$pulseaudio = xtrue ; then
530	PKG_CHECK_MODULES(LIBPULSE, libpulse >= 0.9.21,
531		[AC_DEFINE(__PULSEAUDIO_ENABLED__,1,[Pulse audio support])
532		found_sound=yes],
533		[pulseaudio=false]
534	)
535fi
536
537AM_CONDITIONAL(BUILD_PULSEAUDIO,test x$pulseaudio = xtrue)
538
539
540if test "${found_sound}${use_sound}" = "noyes"; then
541	AC_MSG_ERROR([Could not find a support sound driver API. Use --disable-sound if you don't care about having sound.])
542fi
543
544
545dnl	*************************************
546dnl	check for various codecs libraries
547dnl	*************************************
548
549AC_ARG_ENABLE(speex,
550	[AS_HELP_STRING([--disable-speex], [Disable speex support])],
551	[case "${enableval}" in
552		yes)	speex=true ;;
553		no)	speex=false ;;
554		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-speex) ;;
555	esac],
556	[speex=true]
557)
558
559if test x$speex = xtrue; then
560	dnl check for installed version of speex
561	PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3,
562		[ AC_DEFINE(HAVE_SPEEX_NOISE,1,[tells whether the noise arg of speex_echo_cancel can be used]) ],
563		[try_other_speex=yes]
564	)
565	PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3, build_speex=yes)
566	build_resample=false
567	PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2beta3,
568		[SPEEX_LIBS="$SPEEX_LIBS $SPEEXDSP_LIBS"
569		AC_DEFINE(HAVE_SPEEXDSP,1,[have speexdsp library])
570		build_resample=yes],
571		[AC_MSG_ERROR([No libspeexdsp library found.])]
572	)
573	AC_SUBST(SPEEX_CFLAGS)
574	AC_SUBST(SPEEX_LIBS)
575fi
576
577AM_CONDITIONAL(BUILD_SPEEX, test x$build_speex = xyes )
578AM_CONDITIONAL(BUILD_RESAMPLE, test x$build_resample = xyes )
579
580AC_ARG_ENABLE(gsm,
581	[AS_HELP_STRING([--disable-gsm], [Disable gsm support])],
582	[case "${enableval}" in
583		yes)	gsm=true ;;
584		no)	gsm=false ;;
585		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-gsm) ;;
586	esac],
587	[gsm=auto]
588)
589
590if test x$gsm != xfalse; then
591
592dnl check for gsm
593build_gsm=no
594AC_ARG_WITH(gsm,
595	[  --with-gsm		Sets the installation prefix of gsm codec library [default=/usr] ],
596	[ gsmdir=${withval}],
597	[ gsmdir=/usr ]
598)
599
600if test x"$gsmdir" != xno ; then
601	test x"$gmsdir" = xyes && gsmdir=/usr
602	MS_CHECK_DEP([gsm codec],[GSM],[${gsmdir}/include],
603		[${gsmdir}/lib],[gsm/gsm.h],[gsm],[gsm_create])
604	if test "$GSM_found" = "yes" ; then
605		build_gsm=yes
606	elif test "$gsm" = "true"; then
607		AC_MSG_ERROR([Could not locate gsm headers or library.])
608	fi
609else
610	build_gsm=no
611fi
612
613fi
614
615
616
617
618dnl check for matroska file support
619AC_ARG_ENABLE(matroska,
620	[AS_HELP_STRING([--enable-matroska], [Enable mkv file support])],
621	[case "${enableval}" in
622		yes)	matroska=true ;;
623		no)	matroska=false ;;
624		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-matroska) ;;
625	esac],
626	[matroska=guess]
627)
628AC_ARG_WITH(ebml,
629	[AS_HELP_STRING([--with-ebml],[Sets the installation prefix of ebml library (v2) [default=/usr]])],
630	[ ebmldir=${withval} ],
631	[ ebmldir=/usr ]
632)
633AC_ARG_WITH(matroska,
634	[AS_HELP_STRING([--with-matroska],[Sets the installation prefix of matroska library (v2) [default=/usr]])],
635	[ matroskadir=${withval} ],
636	[ matroskadir=/usr ]
637)
638
639if test x$matroska != xfalse ; then
640
641build_matroska=yes
642if test x"$ebmldir" != xno ; then
643	MS_CHECK_DEP([ebml library],[EBML],[${ebmldir}/include],
644		[${ebmldir}/lib],[ebml/ebml.h],[ebml2],[EBML_ElementRender])
645
646	if test "$EBML_found" = "no" ; then
647		no_ebml=true
648		dnl check without ebml lib, directly in matroska2 (cmake build doesn't create libebml)
649		MS_CHECK_DEP([ebml library],[EBML],[${ebmldir}/include],
650			[${ebmldir}/lib],[ebml/ebml.h],[matroska2],[EBML_ElementRender])
651	fi
652	if test "$EBML_found" = "no" ; then
653		build_matroska=no
654		if test "$matroska" = "true" ; then
655			AC_MSG_ERROR([Could not locate ebml headers or library.])
656		fi
657	fi
658else
659	build_matroska=no
660fi
661
662if test x"$matroskadir" != xno ; then
663
664	if test "$no_ebml" = "true" ; then
665		MS_CHECK_DEP([matroska library],[MATROSKA],[${matroskadir}/include],
666		[${matroskadir}/lib],[matroska/matroska.h],[matroska2],[MATROSKA_BlockReleaseData])
667	else
668		MS_CHECK_DEP([matroska library],[MATROSKA],[${matroskadir}/include],
669		[${matroskadir}/lib],[matroska/matroska.h],[matroska2],[MATROSKA_BlockReleaseData],[-lebml2])
670	fi
671	if test "$MATROSKA_found" = "trueno" ; then
672		build_matroska=no
673		if test "$matroska" = "true" ; then
674			AC_MSG_ERROR([Could not locate matroska headers or library.])
675		fi
676	fi
677else
678	build_matroska=no
679fi
680
681fi
682
683
684
685dnl check for spandsp support to bring up g726 codec
686AC_ARG_ENABLE(spandsp,
687	[AS_HELP_STRING([--disable-spandsp], [Disable spandsp support])],
688	[case "${enableval}" in
689		yes)	spandsp=true ;;
690		no)	spandsp=false ;;
691		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-spandsp) ;;
692	esac],
693	[spandsp=true]
694)
695
696if test x$spandsp = xtrue; then
697	dnl check for installed version of speex
698	PKG_CHECK_MODULES(SPANDSP, spandsp >= 0.0.6,
699		[ AC_DEFINE(HAVE_SPANDSP,1,[tells whether spandsp can be used])
700		have_spandsp=true ],
701		[have_spandsp=false]
702	)
703	AC_SUBST(SPANDSP_CFLAGS)
704	AC_SUBST(SPANDSP_LIBS)
705fi
706
707dnl check for installed version of libupnp
708AC_ARG_ENABLE(upnp,
709	[AS_HELP_STRING([--disable-upnp], [Disable uPnP support])],
710	[case "${enableval}" in
711		yes)	build_upnp=true ;;
712		no)	build_upnp=false ;;
713		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-upnp) ;;
714	esac],
715	[build_upnp=auto]
716)
717
718if test "$build_upnp" != "false" ; then
719	PKG_CHECK_MODULES([LIBUPNP], [libupnp],
720		[if  pkg-config --atleast-version=1.6 "libupnp < 1.7"; then
721			build_upnp=true
722			old_CFLAGS="$CFLAGS"
723			CFLAGS="$CFLAGS $LIBUPNP_CFLAGS -Werror -Wno-error=unused-variable"
724			AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
725				#include <upnp.h>
726			]], [[
727				struct Upnp_Action_Complete aa={0};
728				char *url = aa.CtrlUrl;
729			]])],,
730			AC_DEFINE(USE_PATCHED_UPNP, 1, [Define if upnp is patched]))
731			CFLAGS="$old_CFLAGS"
732		else
733			AC_MSG_ERROR([libupnp >= 1.6 < 1.5 required.])
734		fi],
735		[if test "$build_upnp" == "true" ; then
736			AC_MSG_ERROR([libupnp not found.])
737		else
738			build_upnp=false
739		fi]
740	)
741
742fi
743
744dnl check for opus codec support
745AC_ARG_ENABLE(opus,
746	[AS_HELP_STRING([--disable-opus], [Disable opus codec support])],
747	[case "${enableval}" in
748		yes) opus=true ;;
749		no) opus=false ;;
750		*) AC_MSG_ERROR(bad value ${enableval} for --disable-opus) ;;
751	esac], [opus=true])
752if test x$opus = xtrue; then
753PKG_CHECK_MODULES(OPUS, opus >= 0.9.0,
754	[AC_DEFINE(HAVE_OPUS, 1, [Tells whether opus can be used])
755	have_opus=true],
756	[have_opus=false]
757)
758AC_SUBST(OPUS_CFLAGS)
759AC_SUBST(OPUS_LIBS)
760fi
761
762AM_CONDITIONAL(BUILD_OPUS, test x$have_opus = xtrue)
763AM_CONDITIONAL(BUILD_GSM, test x$build_gsm = xyes )
764AM_CONDITIONAL(BUILD_MATROSKA, test x$build_matroska = xyes )
765AM_CONDITIONAL(BUILD_G726, test "$have_spandsp" = "true" )
766
767MS_CHECK_VIDEO
768AM_CONDITIONAL(BUILD_VIDEO, test "$video" = "true")
769AM_CONDITIONAL(BUILD_THEORA, test "$have_theora" = "yes")
770AM_CONDITIONAL(BUILD_VP8, test "$have_vp8" = "yes")
771AM_CONDITIONAL(BUILD_WIN32, test "$mingw_found" = "yes")
772AM_CONDITIONAL(BUILD_WIN32_WCE, test "$mingw32ce_found" = "yes")
773AM_CONDITIONAL(BUILD_AVCODEC, test x$avcodec_found = xyes)
774AM_CONDITIONAL(BUILD_SWSCALE, test x$swscale_found = xyes)
775AM_CONDITIONAL(BUILD_SDL,test "$sdl_found" = "true" )
776AM_CONDITIONAL(BUILD_X11_XV, test "$enable_xv" = "true" )
777AM_CONDITIONAL(BUILD_X11_GL, test "$enable_glx" = "true" )
778AM_CONDITIONAL(BUILD_UPNP, test "$build_upnp" = "true" )
779
780if test "$build_vp8" != "false" ; then
781	AC_DEFINE(HAVE_VPX, 1, [Tells whether vpx can be used])
782fi
783
784dnl	*********************************************
785dnl	Enable/disable oRTP dependency
786dnl	*********************************************
787AC_ARG_ENABLE(ortp,
788	[AS_HELP_STRING([--disable-ortp], [Disable usage of the oRTP library (default=no)])],
789	[case "${enableval}" in
790		yes)	ortp_enabled=true ;;
791		no)	ortp_enabled=false ;;
792		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-ortp) ;;
793	esac],
794	[ortp_enabled=true]
795)
796AM_CONDITIONAL(ORTP_ENABLED, test x$ortp_enabled = xtrue)
797
798
799dnl	*********************************************
800dnl	setup oRTP dependency
801dnl	*********************************************
802AC_ARG_ENABLE(external-ortp,
803	[AS_HELP_STRING([--enable-external-ortp], [Use external oRTP library (default=no)])],
804	[case "${enableval}" in
805		yes)	external_ortp=true ;;
806		no)	external_ortp=false ;;
807		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-external-ortp) ;;
808	esac],
809	[external_ortp=false]
810)
811
812if test "$ortp_enabled" = 'true'; then
813	if test "$external_ortp" = 'false'; then
814		if test -e ../oRTP/ortp.defs ; then
815			echo "building from linphone source tree, using ../oRTP/include/ortp/ortp.h"
816			ORTP_CFLAGS="-I\$(top_srcdir)/../oRTP/include"
817			ORTP_DEFS=`cat ../oRTP/ortp.defs`
818			ORTP_CFLAGS="$ORTP_CFLAGS $ORTP_DEFS"
819			ORTP_LIBS="\$(top_builddir)/../oRTP/src/libortp.la"
820			if test x$ac_cv_c_bigendian = xyes ; then
821				ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_BIGENDIAN"
822			fi
823			if test x$ntptimestamp = xtrue ; then
824				ORTP_CFLAGS="$ORTP_CFLAGS -DORTP_TIMESTAMP"
825			fi
826		else
827			external_ortp=true
828		fi
829	fi
830	if test "$external_ortp" = 'true'; then
831		PKG_CHECK_MODULES(ORTP, ortp >= 1.0.0, ,
832			[ AC_MSG_ERROR([Couldn't find ortp library]) ] )
833	fi
834else
835	AC_CHECK_HEADERS(sys/shm.h)
836	ORTP_CFLAGS="-Iortp-deps"
837fi
838AC_SUBST(ORTP_CFLAGS)
839AC_SUBST(ORTP_LIBS)
840
841
842dnl	*********************************************
843dnl	Enable/disable mediastreamer2 filters
844dnl	*********************************************
845AC_ARG_ENABLE(filters,
846	[AS_HELP_STRING([--disable-filters], [Disable compilation of filters (default=no)])],
847	[case "${enableval}" in
848		yes)	filters=true ;;
849		no)	filters=false ;;
850		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-filters) ;;
851	esac],
852	[filters=true]
853)
854AM_CONDITIONAL(MS2_FILTERS, test x$filters = xtrue)
855
856AM_CONDITIONAL(BUILD_VOIP_LIBRARY, test x$ortp_enabled = xtrue)
857
858
859dnl check dlopen support in headers and libraries, so that we can use mediastreamer plugins
860AC_CHECK_HEADERS(dlfcn.h)
861have_dlopen=false
862AC_CHECK_LIB(dl,dlopen,[LIBS="$LIBS -ldl"; have_dlopen=true])
863AC_CHECK_FUNC(dlopen,[have_dlopen=true])
864if test "$have_dlopen" = "true" ; then
865	AC_DEFINE(HAVE_DLOPEN,1,[Defined if dlopen() is availlable])
866fi
867
868dnl check various things
869AC_FUNC_ALLOCA
870AC_ARG_ENABLE(relativeprefix,
871	[AS_HELP_STRING([--enable-relativeprefix], [Build a linphone that finds its resources relatively to the directory where it is installed])],
872	[case "${enableval}" in
873		yes)	relativeprefix=yes ;;
874		no)	relativeprefix=no ;;
875		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-relativeprefix) ;;
876	esac],
877	[relativeprefix=guess]
878)
879
880if test "x${prefix}" = "xNONE"; then
881	package_prefix=${ac_default_prefix}
882else
883	package_prefix=${prefix}
884fi
885
886
887
888if test x$mingw_found = xyes || test x$relativeprefix = xyes ; then
889	package_prefix="."
890	PACKAGE_PLUGINS_DIR="./lib/mediastreamer/plugins"
891else
892	PACKAGE_PLUGINS_DIR="\$(libdir)/mediastreamer/plugins"
893fi
894
895dnl define path of plugins:
896
897AC_SUBST(PACKAGE_PLUGINS_DIR)
898
899PACKAGE_DATA_DIR="$prefix/share"
900AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR,  "${package_prefix}/share" ,[path of data])
901AC_SUBST(PACKAGE_DATA_DIR)
902
903dnl check for video4linux headers
904
905AC_ARG_ENABLE(v4l,
906	[AS_HELP_STRING([--disable-v4l], [Disable usage of video4linux, really discouraged (linux-only)])],
907	[case "${enableval}" in
908		yes)	v4l=yes ;;
909		no)	v4l=no ;;
910		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l1) ;;
911	esac],
912	[v4l=yes]
913)
914
915if test "$v4l" = "yes" ; then
916	AC_CHECK_HEADERS(linux/videodev.h linux/videodev2.h)
917	if test "${ac_cv_header_linux_videodev_h}" = "yes" ; then
918		found_v4l1=yes
919	else
920		found_v4l1=no
921	fi
922	if test "${ac_cv_header_linux_videodev2_h}" = "yes" ; then
923		found_v4l2=yes
924	else
925		found_v4l2=no
926	fi
927
928	AC_ARG_ENABLE(libv4l1,
929		[AS_HELP_STRING([--disable-libv4l1], [Disable usage of libv4l1, really discouraged])],
930		[case "${enableval}" in
931			yes)	libv4l1=yes ;;
932			no)	libv4l1=no ;;
933			*)	AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l1) ;;
934		esac],
935		[libv4l1=yes]
936	)
937
938	AC_ARG_ENABLE(libv4l2,
939		[AS_HELP_STRING([--disable-libv4l2], [Disable usage of libv4l2, really discouraged])],
940		[case "${enableval}" in
941			yes)	libv4l2=yes ;;
942			no)	libv4l2=no ;;
943			*)	AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l2) ;;
944		esac],
945		[libv4l2=yes]
946	)
947
948	AS_IF([test "$libv4l2" != "no"],
949	[PKG_CHECK_MODULES(LIBV4L2, libv4l2,
950		[AC_DEFINE(HAVE_LIBV4L2,1,[Defined if we have libv4l2])
951		have_libv4l2=yes],
952		[echo "No libv4l2 found."]
953	)
954	])
955	AS_IF([test "$libv4l1" != "no"],
956	[PKG_CHECK_MODULES(LIBV4L1, libv4l1,
957		[AC_DEFINE(HAVE_LIBV4L1,1,[Defined if we have libv4l1])
958		have_libv4l1=yes],
959		[echo "No libv4l1 found."]
960	)
961	])
962
963	PKG_CHECK_MODULES(LIBV4LCONVERT, libv4lconvert,
964		[AC_DEFINE(HAVE_LIBV4LCONVERT,1,[Defined if we have libv4lconvert])
965		have_libv4lconvert=yes],
966		[echo "No libv4lconvert found."]
967	)
968
969	if test "$found_v4l2" = "yes" && test "$have_libv4l2" != "yes" ; then
970		if test "$video" = "true" && test "$libv4l2" = "yes" ; then
971			AC_MSG_ERROR([
972	Missing libv4l2. It is highly recommended to build with
973	libv4l2 headers and library. Many camera will won't work or will crash
974	your application if libv4l2 is not installed.
975	If you know what you are doing, you can use --disable-libv4l2 to disable
976	this check.
977			])
978		fi
979	fi
980fi
981AM_CONDITIONAL(BUILD_V4L1, test x$found_v4l1 = xyes )
982AM_CONDITIONAL(BUILD_V4L2, test x$found_v4l2 = xyes )
983
984AC_ARG_ENABLE(pcap,
985	[AS_HELP_STRING([--enable-pcap], [Enable pcap library (default=auto)])],
986	[case "${enableval}" in
987		yes)	enable_pcap=yes ;;
988		no)	enable_pcap=no ;;
989		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-pcap) ;;
990	esac],
991	[enable_pcap=auto]
992)
993
994if test x$enable_pcap != xno ; then
995
996	AC_PATH_PROG(PCAP,pcap-config,false)
997	if test $PCAP != false ; then
998		PCAP_LIBS=`pcap-config --libs`
999		PCAP_CFLAGS=`pcap-config --cflags`
1000		AC_SUBST(PCAP_LIBS)
1001		AC_SUBST(PCAP_CFLAGS)
1002		AC_DEFINE(HAVE_PCAP,1,[whether we compile with libpcap support])
1003		enable_pcap=yes
1004	else
1005		enable_pcap=no
1006	fi
1007fi
1008
1009AM_CONDITIONAL(ENABLE_PCAP, test x$enable_pcap = xyes)
1010
1011
1012dnl ##################################################
1013dnl # Check for bctoolbox-tester
1014dnl ##################################################
1015
1016PKG_CHECK_MODULES(BCTOOLBOXTESTER, bctoolbox-tester, [found_pkg_config_bctoolboxtester=yes],[found_pkg_config_bctoolboxtester=no])
1017
1018case "$target_os" in
1019	*mingw*)
1020		CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0501"
1021		LIBS="$LIBS -lws2_32 -liphlpapi"
1022		LDFLAGS="$LDFLAGS -Wl,--export-all-symbols"
1023	;;
1024esac
1025
1026if test "$found_pkg_config_bctoolboxtester" = "no" ; then
1027	AC_MSG_WARN([Could not find bctoolbox-tester wrapper, tests are not compiled.])
1028fi
1029
1030
1031AC_ARG_ENABLE(tests,
1032	[AS_HELP_STRING([--enable-tests], [Enable compilation of tests (default=yes)])],
1033	[case "${enableval}" in
1034		yes)	tests=true ;;
1035		no)		tests=false  ;;
1036		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
1037	esac],
1038	[tests=true]
1039)
1040AM_CONDITIONAL(BUILD_TESTS, [test x$tests = xtrue && test x$found_pkg_config_bctoolboxtester = xyes])
1041
1042dnl check for libsrtp support (secure rtp)
1043AC_ARG_WITH(srtp,
1044	AC_HELP_STRING([--with-srtp], [Set prefix where libsrtp can be found or "none" to disable (ex:/usr or /usr/local) [[default=/usr]]]),
1045	[srtp_prefix=$withval],
1046	[if test "$prefix" != "NONE"; then
1047		srtp_prefix=$prefix
1048	 else
1049		srtp_prefix="/usr"
1050	 fi])
1051
1052if test "${srtp_prefix}" != "none" ; then
1053	if test "${srtp_prefix}" != "/usr" ; then
1054		SRTP_CFLAGS="-I${srtp_prefix}/include -I${srtp_prefix}/include/srtp"
1055		SRTP_LIBS="-L${srtp_prefix}/lib"
1056	fi
1057	SRTP_LIBS="$SRTP_LIBS -lsrtp"
1058
1059	dnl check srtp headers
1060	CPPFLAGS_save=$CPPFLAGS
1061	CPPFLAGS="$CPPFLAGS $SRTP_CFLAGS"
1062	AC_CHECK_HEADER([srtp/srtp.h],have_srtp_headers=yes)
1063	CPPFLAGS=$CPPFLAGS_save
1064
1065	dnl check for srtp lib
1066	LDFLAGS_save=$LDFLAGS
1067	LDFLAGS="$LDFLAGS $SRTP_LIBS"
1068	LIBS_save=$LIBS
1069	AC_CHECK_LIB(srtp,[srtp_init, crypto_policy_set_aes_cm_256_hmac_sha1_80, crypto_policy_set_aes_cm_256_hmac_sha1_32], have_srtp_lib=yes)
1070	LDFLAGS=$LDFLAGS_save
1071	LIBS=$LIBS_save
1072
1073	if test "$have_srtp_headers$have_srtp_lib" = "yesyes" ; then
1074		LDFLAGS_save=$LDFLAGS
1075		LIBS_save=$LIBS
1076		LDFLAGS="$LDFLAGS $SRTP_LIBS"
1077		AC_CHECK_LIB(
1078			srtp,
1079			sha1_update,[
1080				AC_MSG_WARN([This libsrtp version exports symbols conflicting with polarssl, resulting in a bad execution path. libsrtp will be statically linked])
1081				srtp_polarssl_conflict=yes
1082			],
1083			srtp_polarssl_conflict=no
1084		)
1085		LDFLAGS=$LDFLAGS_save
1086		LIBS=$LIBS_save
1087
1088		if test "$srtp_polarssl_conflict" = "yes"; then
1089			srtp_static_lib="${srtp_prefix}/lib/libsrtp.a"
1090			if test -f $srtp_static_lib -a -r $srtp_static_lib; then
1091				SRTP_LIBS="${srtp_prefix}/lib/libsrtp.a -Bsymbolic -Wl,--version-script=\$(top_srcdir)/src/libsrtp.map"
1092				AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
1093				have_srtp=true
1094			else
1095				AC_MSG_WARN([Could not access to $srtp_static_lib. Please use --with-srtp=PREFIX to specify the prefix where libsrtp.a has been installed])
1096				SRTP_CFLAGS=
1097				SRTP_LIBS=
1098				have_srtp=true
1099			fi
1100		else
1101			AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
1102			have_srtp=true
1103		fi
1104
1105	else
1106		AC_MSG_NOTICE([Could not find libsrtp headers or lib, cryto transport disabled.])
1107		have_srtp=false
1108		SRTP_CFLAGS=
1109		SRTP_LIBS=
1110	fi
1111
1112	AC_SUBST(SRTP_CFLAGS)
1113	AC_SUBST(SRTP_LIBS)
1114else
1115	have_srtp=false
1116	SRTP_CFLAGS=
1117	SRTP_LIBS=
1118fi
1119
1120
1121dnl check bctoolbox library
1122PKG_CHECK_MODULES(BCTOOLBOX, bctoolbox >= 0.4.0, found_bctoolbox=true, found_bctoolbox=false)
1123if test "$found_bctoolbox" = "true" ; then
1124	LIBS="$LIBS $BCTOOLBOX_LIBS"
1125	CFLAGS="$CFLAGS $BCTOOLBOX_CFLAGS"
1126else
1127	AC_MSG_ERROR("Could not find bctoolbox")
1128fi
1129
1130dnl check for libzrtp support (RFC 6189: Media Path Key Agreement for Unicast Secure RTP)
1131AC_ARG_ENABLE(zrtp,
1132	[AS_HELP_STRING([--enable-zrtp], [Turn on or off compilation of zrtp (default=detect)])],
1133	[case "${enableval}" in
1134		yes)	zrtp=true ;;
1135		no)	zrtp=false ;;
1136		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-zrtp) ;;
1137	esac],
1138	[zrtp=detect]
1139)
1140
1141
1142if test "$zrtp" != "false" ; then
1143	PKG_CHECK_MODULES(LIBBZRTP, libbzrtp >= 1.0.0, found_zrtp=true, found_zrtp=false)
1144	if test "$zrtp$found_zrtp" = "truefalse" ; then
1145		AC_MSG_ERROR("Cound not find bZRTP library.")
1146	fi
1147	if test "$found_zrtp" = "true" ; then
1148		if test "$have_srtp" = "false" ; then
1149			if test "$zrtp" = "true" ; then
1150				AC_MSG_ERROR("ZRTP requires SRTP")
1151			else
1152				AC_MSG_WARN("ZRTP requires SRTP")
1153				zrtp=false
1154			fi
1155		else
1156			AC_DEFINE(HAVE_ZRTP, 1, [Defined when zrtp support is compiled])
1157			LIBS="$LIBS $LIBBZRTP_LIBS"
1158			CFLAGS="$CFLAGS $LIBBZRTP_CFLAGS"
1159			zrtp=true
1160		fi
1161	else
1162		zrtp=false
1163	fi
1164fi
1165
1166AM_CONDITIONAL(LIBBZRTP,test x$zrtp != xfalse)
1167
1168dnl check for bcg729 presence to use for G729 codec
1169AC_ARG_ENABLE(g729,
1170	[AS_HELP_STRING([--enable-g729], [Turn on or off usage of G729 codec (default=no)])],
1171	[case "${enableval}" in
1172		yes)	g729=true ;;
1173		no)	g729=false ;;
1174		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-g729) ;;
1175	esac],
1176	[g729=false]
1177)
1178
1179if test "$g729" = "true" ; then
1180	PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 1.0)
1181
1182	LIBS="$LIBS $LIBBCG729_LIBS"
1183	CFLAGS="$CFLAGS $LIBBCG729_CFLAGS"
1184else
1185	echo "G729 codec is disabled."
1186fi
1187AM_CONDITIONAL(BUILD_G729,test x$g729 != xfalse)
1188
1189dnl check for bcg729 annexB presence to use for VAD/DTX (RFC3389 : Real-time Transport Protocol (RTP) Payload for Comfort Noise (CN))
1190AC_ARG_ENABLE(g729bCN,
1191	[AS_HELP_STRING([--enable-g729bCN], [Turn on or off usage of G729AnnexB in RFC3389 implementation of Comfort Noise Payload (default=no)])],
1192	[case "${enableval}" in
1193		yes)	g729bCN=true ;;
1194		no)	g729bCN=false ;;
1195		*)	AC_MSG_ERROR(bad value ${enableval} for --enable-g729bCN) ;;
1196	esac],
1197	[g729bCN=false]
1198)
1199
1200if test "$g729bCN" = "true" ; then
1201	PKG_CHECK_MODULES(LIBBCG729, libbcg729 >= 1.0)
1202
1203	AC_DEFINE(HAVE_G729B, 1, [Defined when use of g729AnnexB Comfort Noise and RFC3389 support is compiled])
1204
1205	LIBS="$LIBS $LIBBCG729_LIBS"
1206	CFLAGS="$CFLAGS $LIBBCG729_CFLAGS"
1207else
1208	echo "G729 AnnexB in RFC3389 is disabled."
1209fi
1210
1211AM_CONDITIONAL(LIBBCG729,test x$g729bCN != xfalse)
1212
1213dnl ##################################################
1214dnl # Check for doxygen
1215dnl ##################################################
1216
1217AC_ARG_ENABLE(documentation,
1218	[AS_HELP_STRING([--enable-documentation], [Documentation generation using doxygen (default=yes)])],
1219	[case "${enableval}" in
1220		yes)	documentation_enabled=yes;;
1221		no)		documentation_enabled=no;;
1222		*)		AC_MSG_ERROR("Bad value for --enable-documentation");;
1223	esac],
1224	[documentation_enabled=yes]
1225)
1226if test "$documentation_enabled" = "yes" ; then
1227	AC_CHECK_PROG(DOXYGEN,doxygen,doxygen,false)
1228else
1229	DOXYGEN=false
1230fi
1231AC_CHECK_PROG(DOXYGEN,doxygen,doxygen,false)
1232AM_CONDITIONAL(HAVE_DOXYGEN, test "$DOXYGEN" != "false")
1233
1234
1235dnl ##################################################
1236dnl # Check for ESP Packager
1237dnl ##################################################
1238
1239AC_PATH_PROG(EPM,epm,false)
1240AC_PATH_PROG(MKEPMLIST,mkepmlist,false)
1241AC_PATH_PROG(EPMINSTALL,epminstall,false)
1242AM_CONDITIONAL(WITH_EPM,test $EPM != false && test $MKEPMLIST != false && test $EPMINSTALL != false)
1243
1244
1245dnl Check for xxd
1246AC_CHECK_PROG(xxd_found, xxd, yes)
1247if test "$xxd_found" != yes ;then
1248 	AC_MSG_ERROR("xxd is required (provided by vim package)")
1249fi
1250
1251# Preferred packaging system, as per EPM terminology
1252case $target in
1253	*-*-linux*)
1254		if test -f /etc/debian_version ; then
1255			EPM_PKG_EXT=deb
1256		else
1257			EPM_PKG_EXT=rpm
1258		fi
1259	;;
1260	*-hp-hpux*)
1261		EPM_PKG_EXT=depot.gz
1262	;;
1263	*-dec-osf*)
1264		EPM_PKG_EXT=setld
1265	;;
1266esac
1267AC_SUBST(EPM_PKG_EXT)
1268
1269# System software User & Group names
1270case $target in
1271	*-*-linux*)
1272		SYS_USER=root
1273		SYS_GROUP=root
1274	;;
1275	*-*-hpux*|*-dec-osf*)
1276		SYS_USER=bin
1277		SYS_GROUP=bin
1278	;;
1279esac
1280AC_SUBST(SYS_USER)
1281AC_SUBST(SYS_GROUP)
1282
1283# CPU Architecture
1284case $target_cpu in
1285	i?86)
1286		ARCH=i386
1287	;;
1288	*)
1289		ARCH=$target_cpu
1290	;;
1291esac
1292AC_SUBST(ARCH)
1293
1294# Various other packaging variables, that can be over-ridden ad `make
1295# package' time
1296SUMMARY="A mediastreaming library."
1297AC_SUBST(SUMMARY)
1298PACKAGER=anonymous
1299AC_SUBST(PACKAGER)
1300LICENSE=GPL
1301AC_SUBST(LICENSE)
1302VENDOR=Linphone
1303AC_SUBST(VENDOR)
1304RELEASE=1
1305AC_SUBST(RELEASE)
1306
1307CFLAGS="$CFLAGS $MS_PUBLIC_CFLAGS"
1308CXXFLAGS="$CXXFLAGS $MS_PUBLIC_CFLAGS "
1309dnl: these ones gets exported in pkgconfig file.
1310AC_SUBST(MS_PUBLIC_CFLAGS)
1311
1312AC_CONFIG_FILES(
1313	Makefile
1314	po/Makefile.in
1315	m4/Makefile
1316	include/Makefile
1317	include/mediastreamer2/Makefile
1318	src/Makefile
1319	tools/Makefile
1320	mediastreamer.pc
1321	mediastreamer2.spec
1322	help/Makefile
1323	help/Doxyfile
1324	tester/Makefile
1325)
1326
1327AC_OUTPUT
1328
1329echo "Mediastreamer2 build configuration ended."
1330echo "Summary of build options:"
1331printf "* %-30s %s\n" "Video support"		$video
1332printf "* %-30s %s\n" "sRTP encryption"		$have_srtp
1333printf "* %-30s %s\n" "zRTP encryption"		$zrtp
1334printf "* %-30s %s\n" "Non-free codecs" 	$non_free_codecs
1335printf "* %-30s %s\n" "pcap support"	 	$enable_pcap
1336
1337