configure.ac 24.2 KB
Newer Older
aymeric's avatar
aymeric committed
1
dnl Process this file with autoconf to produce a configure script.
2
AC_INIT([mediastreamer],[2.8.99])
aymeric's avatar
aymeric committed
3 4 5 6 7 8 9 10 11 12 13 14

AC_MSG_NOTICE([$PACKAGE_NAME-$PACKAGE_VERSION		A mediastreaming library for telephony application.])
AC_MSG_NOTICE([licensed under the terms of the General Public License (GPL)])

AC_CANONICAL_SYSTEM

dnl Source packaging numbers
MEDIASTREAMER_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
MEDIASTREAMER_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
MEDIASTREAMER_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
MEDIASTREAMER_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)

Ghislain MARY's avatar
Ghislain MARY committed
15
LIBMEDIASTREAMER_SO_CURRENT=2 dnl increment this number when you add/change/remove an interface
Simon Morlat's avatar
Simon Morlat committed
16
LIBMEDIASTREAMER_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
aymeric's avatar
aymeric committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
LIBMEDIASTREAMER_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface

LIBMEDIASTREAMER_SO_VERSION=$LIBMEDIASTREAMER_SO_CURRENT:$LIBMEDIASTREAMER_SO_REVISION:$LIBMEDIASTREAMER_SO_AGE
MEDIASTREAMER_VERSION=${MEDIASTREAMER_MAJOR_VERSION}.${MEDIASTREAMER_MINOR_VERSION}.${MEDIASTREAMER_MICRO_VERSION}

if test -n "$MEDIASTREAMER_EXTRA_VERSION" ; then
	MEDIASTREAMER_VERSION="${MEDIASTREAMER_VERSION}.${MEDIASTREAMER_EXTRA_VERSION}"
fi

AC_SUBST(LIBMEDIASTREAMER_SO_VERSION)
AC_SUBST(MEDIASTREAMER_VERSION)

PACKAGE=mediastreamer

OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
AC_MSG_RESULT([Building Package on ${OS}])

AM_INIT_AUTOMAKE([tar-ustar])
35
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
aymeric's avatar
aymeric committed
36 37 38 39 40 41
AC_CONFIG_HEADERS(mediastreamer-config.h)
AC_DEFINE_UNQUOTED(MEDIASTREAMER_MAJOR_VERSION,$MEDIASTREAMER_MAJOR_VERSION, [major version])
AC_DEFINE_UNQUOTED(MEDIASTREAMER_MINOR_VERSION,$MEDIASTREAMER_MINOR_VERSION, [minor version])
AC_DEFINE_UNQUOTED(MEDIASTREAMER_MICRO_VERSION,$MEDIASTREAMER_MICRO_VERSION, [micro version])
AC_DEFINE_UNQUOTED(MEDIASTREAMER_VERSION,"$MEDIASTREAMER_VERSION",[MEDIASTREAMER version number])

42 43
MS_PUBLIC_CFLAGS=

aymeric's avatar
aymeric committed
44 45 46 47
AC_SUBST([mkdir_p])

AC_MSG_CHECKING([warning make an error on compilation])
AC_ARG_ENABLE(strict,
48
[AS_HELP_STRING([--enable-strict], [Enable error on compilation warning (default=no)])],
aymeric's avatar
aymeric committed
49
[wall_werror=$enableval],
50
[wall_werror=yes]
aymeric's avatar
aymeric committed
51 52 53 54 55 56
)

CFLAGS="-DORTP_INET6 $CFLAGS "

dnl enable ipv6 support
AC_ARG_ENABLE(ipv6,
57
      [AS_HELP_STRING([--enable-ipv6], [Turn on IPv6 support (default=yes)])],
aymeric's avatar
aymeric committed
58 59 60 61 62 63 64 65 66
      [case "${enableval}" in
        yes)  ipv6=true;;
        no)   ipv6=false;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
      esac],[ipv6=true])
if test x$ipv6 = xtrue ; then
	CFLAGS="$CFLAGS -DINET6"
fi

67
dnl enable timestamp support
68
AC_ARG_ENABLE(ntp-timestamp,
69
      [AS_HELP_STRING([--enable-ntp-timestamp], [Turn on NTP timestamping on received packet (default=no)])],
70
      [case "${enableval}" in
71 72 73 74
        yes)  ntptimestamp=true;;
        no)   ntptimestamp=false;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-ntp-timestamp) ;;
      esac],[ntptimestamp=false])
aymeric's avatar
aymeric committed
75 76

dnl Checks for programs.
smorlat's avatar
smorlat committed
77
AC_PROG_CXX
78
AC_PROG_CC
79
AC_PROG_OBJC
80

Simon Morlat's avatar
Simon Morlat committed
81 82 83 84 85 86
AC_CONFIG_MACRO_DIR([m4])
LT_INIT([win32-dll shared disable-static])


AC_SUBST([LIBTOOL_DEPS])

aymeric's avatar
aymeric committed
87 88 89 90 91 92 93 94
if test "$GCC" != "yes" ; then
	case $target_os in
		*hpux*)
			dnl we are probably using HPUX cc compiler, so add a +O2 to CFLAGS
			CFLAGS="$CFLAGS +O2 -g "
			;;
	esac
else
95
	CFLAGS="$CFLAGS -Wall -fdiagnostics-show-option"
aymeric's avatar
aymeric committed
96 97
fi

Simon Morlat's avatar
Simon Morlat committed
98 99 100 101
AC_ARG_ENABLE([debug],
			AS_HELP_STRING([--enable-debug=@<:@yes/no@:>@],[enables the display of traces showing the execution of the library. @<:@default=yes@:>@]),
			[],											dnl [action-if-given]
			[enable_debug=no])							dnl [action-if-not-given]
102

Simon Morlat's avatar
Simon Morlat committed
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

AS_CASE([$enable_debug],
		[yes],[
			CFLAGS="$CFLAGS -g -DDEBUG"
			CXXFLAGS="$CXXFLAGS -g -DDEBUG"
		],
		[no],
		[
			case "$CFLAGS" in
				*-O*)
				;;
				*)
				CFLAGS="$CFLAGS -O2 -g"
				CXXFLAGS="$CXXFLAGS -O2 -g"
				;;
			esac
		],
		[AC_MSG_ERROR([Bad value ($enable_debug) for --enable-debug. Valid values are yes or no.])])
aymeric's avatar
aymeric committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134

dnl Checks for header files.
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_WORDS_BIGENDIAN
if test x$ac_cv_c_bigendian = xyes ; then
	CFLAGS="$CFLAGS -D_BIGENDIAN "
fi

if test $GCC = yes && test $wall_werror = yes;  then
135
	CFLAGS="$CFLAGS -Werror -Wno-error=deprecated-declarations"
aymeric's avatar
aymeric committed
136 137 138
fi

macosx_found=no
139
ios_found=false
Jehan Monnier's avatar
Jehan Monnier committed
140
mingw32ce_found=no
jehan's avatar
jehan committed
141
ios_found=no
aymeric's avatar
aymeric committed
142 143

dnl add thread flags
144
case $host in
jehan's avatar
jehan committed
145
        i386-apple*|armv6-apple*|armv7-apple*|armv7s-apple*)
146
		ios_found=yes
jehan's avatar
jehan committed
147
        ;;
Yann Diorcet's avatar
Yann Diorcet committed
148
        x86_64-apple*|i686-apple*)
149
		macosx_found=yes
150
        ;;
151 152 153 154
  	*mingw32ce)
		CFLAGS="$CFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501  -D_WIN32_WCE  -DORTP_STATIC"
		CXXFLAGS="$CXXFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -DORTP_STATIC  -D_WIN32_WCE"
dnl ORTP_STATIC to tell ortp not to export its variable with dllexport, as if we were building statically, or dynamically on linux
Jehan Monnier's avatar
Jehan Monnier committed
155
        	LIBS="$LIBS -lws2"
156
		mingw_found=yes
Jehan Monnier's avatar
Jehan Monnier committed
157
		mingw32ce_found=yes
158
    ;;
159
	*mingw*)
160
		CFLAGS="$CFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
161 162 163 164 165
		CXXFLAGS="$CXXFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
dnl ORTP_STATIC to tell ortp not to export its variable with dllexport, as if we were building statically, or dynamically on linux
		LIBS="$LIBS -lws2_32 -lwinmm "
		mingw_found=yes
	;;
aymeric's avatar
aymeric committed
166 167 168 169 170 171 172 173
  *)
     MSPLUGINS_CFLAGS="-pthread"
     MSPLUGINS_LIBS="-shared -pthread"
     CFLAGS="$CFLAGS -pthread -D_REENTRANT"
     LIBS="$LIBS -pthread -lpthread"
     ;;
esac

174 175 176 177
if test "$macosx_found" == "yes" ; then
	LIBS="$LIBS -framework CoreFoundation -framework AudioToolbox -framework CoreAudio -framework AppKit"
fi
if test "$ios_found" == "yes" ; then
178 179
	LIBS="$LIBS -framework CoreFoundation -framework AudioToolbox -framework CoreAudio "
fi
Simon Morlat's avatar
Simon Morlat committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
dnl localization tools
IT_PROG_INTLTOOL([0.40], [no-xml])


GETTEXT_PACKAGE="mediastreamer"
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,["mediastreamer"],[name of the gettext domain. Used in the call to 'bindtextdomain()'])
AC_SUBST([GETTEXT_PACKAGE])
if test "$mingw_found" != "yes" ; then
	dnl gettext macro does not work properly under mingw. And we want to use the one provided by GTK.
	AM_GNU_GETTEXT([external])
	AM_GNU_GETTEXT_VERSION([0.18])
	LIBS="$LIBS $LIBINTL"
else
	AC_DEFINE(ENABLE_NLS,1,[Tells whether localisation is possible])
	AC_DEFINE(HAVE_GETTEXT,1,[Tells wheter localisation is possible])
	LIBS="$LIBS -lintl"
fi

aymeric's avatar
aymeric committed
198
AM_CONDITIONAL(BUILD_MACOSX, test x$macosx_found = xyes)
jehan's avatar
jehan committed
199
AM_CONDITIONAL(BUILD_IOS, test x$ios_found = xyes)
aymeric's avatar
aymeric committed
200

201
AC_CONFIG_COMMANDS([libtool-hacking],[
202
if test "$mingw_found" = "yes" ; then
203
	echo "Hacking libtool to work with mingw..."
204 205 206
	sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
	cp -f ./libtool.tmp ./libtool
	rm -f ./libtool.tmp
207 208
else
	echo "No need to hack libtool."
209
fi
210
], [mingw_found=$mingw_found])
211 212


213 214
dnl prefer fixed point computations
AC_ARG_ENABLE(fixed_point,
215
      [AS_HELP_STRING([--enable-fixed-point=@<:@yes/no/guess@:>@], [Turn on fixed point computations (default=guess)])],
216 217 218
      [case "${enableval}" in
        yes)  fixed_point=true;;
        no)   fixed_point=false;;
219
	guess) fixed_point=guess;;
220
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-fixed-point) ;;
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
      esac],[fixed_point=guess])

if test "$fixed_point" = "guess" ; then
	AC_MSG_CHECKING([whether fixed point arithmetic is preferred])
	case ${target_cpu}${host_cpu} in
		*bfin*)
			fixed_point=true
		;;
		*arm*)
			fixed_point=true
		;;
		*)
			fixed_point=false
		;;
	esac
	AC_MSG_RESULT([$fixed_point])
fi
238

239

240 241 242 243 244
if test x$fixed_point = xtrue ; then
	MS_PUBLIC_CFLAGS="$MS_PUBLIC_CFLAGS -DMS_FIXED_POINT"
fi


smorlat's avatar
smorlat committed
245 246 247
dnl initialize pkg-config so that we can use it within if else fi statements.
PKG_PROG_PKG_CONFIG()

aymeric's avatar
aymeric committed
248 249 250 251 252 253 254 255 256
AC_SUBST(MSPLUGINS_CFLAGS)
AC_SUBST(MSPLUGINS_LIBS)

dnl	*********************************
dnl	various checks for soundcard apis
dnl	*********************************

found_sound=no

257 258 259 260
if test x$mingw_found = xyes ; then
	found_sound=yes
fi

261
AC_ARG_ENABLE(sound,
262
      [AS_HELP_STRING([--disable-sound], [Turn off all possible sound backend (default=no)])],
263 264 265 266 267 268
      [case "${enableval}" in
        yes) use_sound=true ;;
        no)  use_sound=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-sound) ;;
      esac],[use_sound=true])

smorlat's avatar
smorlat committed
269
AC_ARG_ENABLE(oss,
270
      [AS_HELP_STRING([--enable-oss], [Enable oss support])],
smorlat's avatar
smorlat committed
271 272 273 274
      [case "${enableval}" in
        yes) oss=true ;;
        no)  oss=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-oss) ;;
275
      esac],[oss=$use_sound])
smorlat's avatar
smorlat committed
276 277

if "$oss" = "true"; then
aymeric's avatar
aymeric committed
278 279 280 281 282 283
AC_CHECK_HEADERS(soundcard.h sys/soundcard.h machine/soundcard.h sys/audio.h)
if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
	test "${ac_cv_header_soundcard_h}" = "yes" || \
		test "${ac_cv_header_sys_audio_h}" = "yes" || \
	test "${ac_cv_header_machine_soundcard_h}" = "yes"; then
	found_sound=yes
284 285
else
	oss=false
aymeric's avatar
aymeric committed
286
fi
smorlat's avatar
smorlat committed
287
fi
aymeric's avatar
aymeric committed
288

289
AM_CONDITIONAL(BUILD_OSS, test x$oss = xtrue)
aymeric's avatar
aymeric committed
290 291 292

dnl conditionnal build of ALSA support
AC_ARG_ENABLE(alsa,
293
      [AS_HELP_STRING([--enable-alsa], [Turn on alsa native support compiling])],
aymeric's avatar
aymeric committed
294 295 296 297
      [case "${enableval}" in
        yes) alsa=true ;;
        no)  alsa=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsa) ;;
298
      esac],[alsa=$use_sound])
aymeric's avatar
aymeric committed
299 300 301 302 303 304 305

if test "$alsa" = "true"; then
	AC_CHECK_HEADERS(alsa/asoundlib.h,
		[ AC_CHECK_LIB(asound,snd_pcm_open,
			[ ALSA_LIBS="-lasound"
			  found_sound=yes
			AC_DEFINE(__ALSA_ENABLED__,1,[defined if alsa support is available])
306
			alsa_enabled=true
aymeric's avatar
aymeric committed
307 308 309 310 311 312 313 314 315 316
			])
		]
	)
fi
AC_SUBST(ALSA_LIBS)

AM_CONDITIONAL(BUILD_ALSA, test x$alsa_enabled = xtrue)


AC_ARG_ENABLE(artsc,
317
      [AS_HELP_STRING([--enable-artsc], [Turn on artsc (KDE<4) sound input/output (default=no)])],
aymeric's avatar
aymeric committed
318 319 320 321
      [case "${enableval}" in
        yes) artsc=true ;;
        no)  artsc=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-artsc) ;;
322
      esac],[artsc=false])
aymeric's avatar
aymeric committed
323 324 325 326 327 328 329 330 331 332 333 334 335

arts_enabled=false

if test "$artsc" = "true" ; then

	dnl check for arts (kde sound daemon) support
	PKG_CHECK_MODULES(ARTS, [artsc],[
		dnl New detection
		arts_enabled=true
	],[
		dnl Old detection
		if test x$artsc = xtrue ; then
			AC_CHECK_HEADERS(kde/artsc/artsc.h,
336
				[ AC_CHECK_LIB(artsc,arts_init,
aymeric's avatar
aymeric committed
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
					[ ARTS_LIBS="-lartsc"
					arts_enabled=true
					])
				]
			)
		fi
		AC_SUBST(ARTS_LIBS)
	])
fi

if test x$arts_enabled = xtrue; then
	found_sound=yes
	AC_DEFINE(__ARTS_ENABLED__,1,[defined if arts support is available])
fi

AM_CONDITIONAL(BUILD_ARTS, test x$arts_enabled = xtrue)

AC_ARG_ENABLE(portaudio,
355
      [AS_HELP_STRING([--enable-portaudio], [Turn on portaudio native support compiling (default=no)])],
aymeric's avatar
aymeric committed
356 357 358 359 360 361 362 363 364 365 366 367
      [case "${enableval}" in
        yes) portaudio=true ;;
        no)  portaudio=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-portaudio) ;;
      esac],[portaudio=false])

if test "$portaudio" = "true"; then
	AC_CHECK_HEADERS(portaudio.h,
		[ AC_CHECK_LIB(portaudio,Pa_Initialize,
			[ PORTAUDIO_LIBS="-lportaudio"
			  found_sound=yes
			AC_DEFINE(__PORTAUDIO_ENABLED__,1,[defined if portaudio support is available])
368
			portaudio_enabled=true
aymeric's avatar
aymeric committed
369 370 371 372 373 374 375 376 377
			])
		]
	)
fi

AC_SUBST(PORTAUDIO_LIBS)
AM_CONDITIONAL(BUILD_PORTAUDIO, test x$portaudio_enabled = xtrue)

AC_ARG_ENABLE(macsnd,
378
      [AS_HELP_STRING([--enable-macsnd], [Turn on MAC OS X Audio Units sound support])],
aymeric's avatar
aymeric committed
379 380 381 382
      [case "${enableval}" in
        yes) macsnd=true ;;
        no)  macsnd=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-macsnd) ;;
383
      esac],[macsnd=$use_sound])
aymeric's avatar
aymeric committed
384

Simon Morlat's avatar
Simon Morlat committed
385
macaqsnd_default=no
386 387 388
if test "$ios_found" = "yes" ; then
	macaqsnd_default=true;
fi
Simon Morlat's avatar
Simon Morlat committed
389

aymeric's avatar
aymeric committed
390
AC_ARG_ENABLE(macaqsnd,
391
      [AS_HELP_STRING([--enable-macaqsnd], [Turn on native MAC OS X Audio Queue sound support (default=no)])],
aymeric's avatar
aymeric committed
392 393 394 395
      [case "${enableval}" in
        yes) macaqsnd=true ;;
        no)  macaqsnd=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-macaqsnd) ;;
396
      esac],[macaqsnd=$macaqsnd_default])
397

aymeric's avatar
aymeric committed
398

399 400 401 402 403

if test "$macosx_found" = "yes" ; then
	if test "$macsnd" = "true"; then
		AC_DEFINE(__MACSND_ENABLED__,1,[defined if native macosx sound support is available])
		macsnd_enabled=true
jehan's avatar
jehan committed
404
		LIBS="$LIBS -framework Carbon -framework AudioUnit"
405 406
		found_sound=yes
	fi
aymeric's avatar
aymeric committed
407 408
fi

409 410
if test "$macaqsnd" = "true"; then
	AC_DEFINE(__MAC_AQ_ENABLED__,1,[defined if native macosx AQ sound support is available])
411
	found_sound=yes
412
	macaqsnd=true
413 414
fi

415
AM_CONDITIONAL(BUILD_MACSND, test x$macsnd_enabled = xtrue)
416
AM_CONDITIONAL(BUILD_MACAQSND, test x$macaqsnd = xtrue)
417
AM_CONDITIONAL(BUILD_IOSIOUNIT, test x$ios_found = xyes)
smorlat's avatar
smorlat committed
418

419
AC_ARG_ENABLE(pulseaudio,
420
      [AS_HELP_STRING([--disable-pulseaudio], [Disable pulseaudio support])],
421 422 423 424
      [case "${enableval}" in
        yes) pulseaudio=true ;;
        no)  pulseaudio=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-pulseaudio) ;;
425
      esac],[pulseaudio=$use_sound])
426 427 428 429


if test x$pulseaudio = xtrue ; then
	PKG_CHECK_MODULES(LIBPULSE, libpulse >= 0.9.21,
430 431 432 433
		[
		AC_DEFINE(__PULSEAUDIO_ENABLED__,1,[Pulse audio support])
		found_sound=yes
		],
434 435 436 437 438 439
		[pulseaudio=false])
fi

AM_CONDITIONAL(BUILD_PULSEAUDIO,test x$pulseaudio = xtrue)


440 441
if test "${found_sound}${use_sound}" = "noyes"; then
	AC_MSG_ERROR([Could not find a support sound driver API. Use --disable-sound if you don't care about having sound.])
aymeric's avatar
aymeric committed
442 443 444 445 446 447 448
fi


dnl	*************************************
dnl	check for various codecs libraries
dnl	*************************************

smorlat's avatar
smorlat committed
449
AC_ARG_ENABLE(speex,
450
      [AS_HELP_STRING([--disable-speex], [Disable speex support])],
smorlat's avatar
smorlat committed
451 452 453 454 455 456 457 458
      [case "${enableval}" in
        yes) speex=true ;;
        no)  speex=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-speex) ;;
      esac],[speex=true])

if test x$speex = xtrue; then

aymeric's avatar
aymeric committed
459
dnl check for installed version of speex
smorlat's avatar
smorlat committed
460
PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3,
aymeric's avatar
aymeric committed
461 462 463
	[ AC_DEFINE(HAVE_SPEEX_NOISE,1,[tells whether the noise arg of speex_echo_cancel can be used]) ],
	[try_other_speex=yes]
)
464
PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3, build_speex=yes)
465
build_resample=false
aymeric's avatar
aymeric committed
466
PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2beta3,
467
    [SPEEX_LIBS="$SPEEX_LIBS $SPEEXDSP_LIBS"
468
    AC_DEFINE(HAVE_SPEEXDSP,1,[have speexdsp library])
469
    build_resample=yes] ,
Simon Morlat's avatar
Simon Morlat committed
470
    [AC_MSG_ERROR([No libspeexdsp library found.])
aymeric's avatar
aymeric committed
471 472 473 474
]
)
AC_SUBST(SPEEX_CFLAGS)
AC_SUBST(SPEEX_LIBS)
smorlat's avatar
smorlat committed
475 476 477

fi

aymeric's avatar
aymeric committed
478
AM_CONDITIONAL(BUILD_SPEEX, test x$build_speex = xyes )
479
AM_CONDITIONAL(BUILD_RESAMPLE, test x$build_resample = xyes )
aymeric's avatar
aymeric committed
480

smorlat's avatar
smorlat committed
481
AC_ARG_ENABLE(gsm,
482
      [AS_HELP_STRING([--disable-gsm], [Disable gsm support])],
smorlat's avatar
smorlat committed
483 484 485 486
      [case "${enableval}" in
        yes) gsm=true ;;
        no)  gsm=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-gsm) ;;
487
      esac],[gsm=auto])
488

489
if test x$gsm != xfalse; then
smorlat's avatar
smorlat committed
490

aymeric's avatar
aymeric committed
491 492 493 494 495 496 497 498 499 500 501 502
dnl check for gsm
build_gsm=no
AC_ARG_WITH( gsm,
		  [  --with-gsm		Sets the installation prefix of gsm codec library [default=/usr] ],
		  [ gsmdir=${withval}],[ gsmdir=/usr ])

if test x"$gsmdir" != xno ; then
	test x"$gmsdir" = xyes && gsmdir=/usr
	MS_CHECK_DEP([gsm codec],[GSM],[${gsmdir}/include],
		[${gsmdir}/lib],[gsm/gsm.h],[gsm],[gsm_create])
	if test "$GSM_found" = "yes" ; then
		build_gsm=yes
503
	elif test "$gsm" = "true"; then
504
		AC_MSG_ERROR([Could not locate gsm headers or library.])
aymeric's avatar
aymeric committed
505 506 507 508
	fi
else
	build_gsm=no
fi
smorlat's avatar
smorlat committed
509 510 511

fi

512 513
dnl check for spandsp support to bring up g726 codec
AC_ARG_ENABLE(spandsp,
514
      [AS_HELP_STRING([--disable-spandsp], [Disable spandsp support])],
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534
      [case "${enableval}" in
        yes) spandsp=true ;;
        no)  spandsp=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-spandsp) ;;
      esac],[spandsp=true])

if test x$spandsp = xtrue; then

dnl check for installed version of speex
PKG_CHECK_MODULES(SPANDSP, spandsp >= 0.0.6,
	[ AC_DEFINE(HAVE_SPANDSP,1,[tells whether spandsp can be used])
	have_spandsp=true ],
	[have_spandsp=false]
)
AC_SUBST(SPANDSP_CFLAGS)
AC_SUBST(SPANDSP_LIBS)

fi


aymeric's avatar
aymeric committed
535
AM_CONDITIONAL(BUILD_GSM, test x$build_gsm = xyes )
536
AM_CONDITIONAL(BUILD_G726, test "$have_spandsp" = "true" )
aymeric's avatar
aymeric committed
537 538 539 540

MS_CHECK_VIDEO
AM_CONDITIONAL(BUILD_VIDEO, test "$video" = "true")
AM_CONDITIONAL(BUILD_THEORA, test "$have_theora" = "yes")
541
AM_CONDITIONAL(BUILD_VP8, test "$have_vp8" = "yes")
542
AM_CONDITIONAL(BUILD_WIN32, test "$mingw_found" = "yes")
Jehan Monnier's avatar
Jehan Monnier committed
543
AM_CONDITIONAL(BUILD_WIN32_WCE, test "$mingw32ce_found" = "yes")
544
AM_CONDITIONAL(BUILD_FFMPEG, test "$ffmpeg" = "true")
Simon Morlat's avatar
Simon Morlat committed
545 546
AM_CONDITIONAL(BUILD_SDL,test "$sdl_found" = "true" )
AM_CONDITIONAL(BUILD_X11_XV, test "$enable_xv" = "true" )
547
AM_CONDITIONAL(BUILD_X11_GL, test "$enable_gl" = "true" )
aymeric's avatar
aymeric committed
548

549 550 551 552 553 554 555 556 557 558 559 560

dnl	*********************************************
dnl	Enable/disable oRTP dependency
dnl	*********************************************
AC_ARG_ENABLE(ortp,
	[AS_HELP_STRING([--disable-ortp], [Disable usage of the oRTP library (default=no)])],
	[case "${enableval}" in
		yes)	ortp_enabled=true ;;
		no)	ortp_enabled=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-ortp) ;;
	esac],
	[ortp_enabled=true])
561
AM_CONDITIONAL(ORTP_ENABLED, test x$ortp_enabled = xtrue)
562 563


aymeric's avatar
aymeric committed
564 565 566 567
dnl	*********************************************
dnl	setup oRTP dependency
dnl	*********************************************
AC_ARG_ENABLE(external-ortp,
568
      [AS_HELP_STRING([--enable-external-ortp], [Use external oRTP library (default=no)])],
aymeric's avatar
aymeric committed
569 570 571 572 573 574
      [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])

575 576 577 578 579 580 581 582 583 584 585 586 587 588
if test "$ortp_enabled" = 'true'; then
	if test "$external_ortp" = 'false'; then
		if test -e $srcdir/../oRTP/include/ortp/ortp.h ; then
			echo "building from linphone source tree, using ../oRTP/include/ortp/ortp.h"
			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
		else
			external_ortp=true
aymeric's avatar
aymeric committed
589 590
		fi
	fi
591 592 593 594
	if test "$external_ortp" = 'true'; then
		PKG_CHECK_MODULES(ORTP, ortp >= 0.17.0, ,
			[ AC_MSG_ERROR([Couldn't find ortp library]) ] )
	fi
595 596 597
else
	AC_CHECK_HEADERS(sys/shm.h)
	ORTP_CFLAGS="-Iortp-deps"
aymeric's avatar
aymeric committed
598
fi
599 600
AC_SUBST(ORTP_CFLAGS)
AC_SUBST(ORTP_LIBS)
aymeric's avatar
aymeric committed
601 602


603 604 605 606 607 608 609 610 611 612 613
dnl	*********************************************
dnl	Enable/disable mediastreamer2 filters
dnl	*********************************************
AC_ARG_ENABLE(filters,
	[AS_HELP_STRING([--disable-filters], [Disable compilation of filters (default=no)])],
	[case "${enableval}" in
		yes)	filters=true ;;
		no)	filters=false ;;
		*)	AC_MSG_ERROR(bad value ${enableval} for --disable-filters) ;;
	esac],
	[filters=true])
614
AM_CONDITIONAL(MS2_FILTERS, test x$filters = xtrue)
615

616
AM_CONDITIONAL(BUILD_VOIP_LIBRARY, test x$ortp_enabled = xtrue)
617 618


aymeric's avatar
aymeric committed
619 620 621 622 623 624 625 626 627 628 629
dnl check dlopen support in headers and libraries, so that we can use mediastreamer plugins
AC_CHECK_HEADERS(dlfcn.h)
have_dlopen=false
AC_CHECK_LIB(dl,dlopen,[LIBS="$LIBS -ldl"; have_dlopen=true])
AC_CHECK_FUNC(dlopen,[have_dlopen=true])
if test "$have_dlopen" = "true" ; then
	AC_DEFINE(HAVE_DLOPEN,1,[Defined if dlopen() is availlable])
fi

dnl check various things
AC_FUNC_ALLOCA
630
AC_ARG_ENABLE(relativeprefix,
631
      [AS_HELP_STRING([--enable-relativeprefix], [Build a linphone that finds its resources relatively to the directory where it is installed])],
632 633 634 635 636
      [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
637

smorlat's avatar
smorlat committed
638
if test "x${prefix}" = "xNONE"; then
simorl's avatar
simorl committed
639 640 641 642 643
	package_prefix=${ac_default_prefix}
else
	package_prefix=${prefix}
fi

644 645


646
if test x$mingw_found = xyes || test x$relativeprefix = xyes ; then
simorl's avatar
simorl committed
647
	package_prefix="."
648
	PACKAGE_PLUGINS_DIR="./lib/mediastreamer/plugins"
649 650
else
PACKAGE_PLUGINS_DIR="\$(libdir)/mediastreamer/plugins"
smorlat's avatar
smorlat committed
651 652
fi

aymeric's avatar
aymeric committed
653
dnl define path of plugins:
654

aymeric's avatar
aymeric committed
655 656
AC_SUBST(PACKAGE_PLUGINS_DIR)

smorlat's avatar
smorlat committed
657
PACKAGE_DATA_DIR="$prefix/share"
simorl's avatar
simorl committed
658
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR,  "${package_prefix}/share" ,[path of data])
aymeric's avatar
aymeric committed
659 660 661 662
AC_SUBST(PACKAGE_DATA_DIR)

dnl check for video4linux headers
AC_CHECK_HEADERS(linux/videodev.h linux/videodev2.h)
663 664
if test "${ac_cv_header_linux_videodev_h}" = "yes" ; then
	found_v4l1=yes
665
else
666 667 668 669 670 671
	found_v4l1=no
fi
if test "${ac_cv_header_linux_videodev2_h}" = "yes" ; then
	found_v4l2=yes
else
	found_v4l2=no
672 673
fi

674 675 676 677
AM_CONDITIONAL(BUILD_V4L1, test x$found_v4l1 = xyes )
AM_CONDITIONAL(BUILD_V4L2, test x$found_v4l2 = xyes )

AC_ARG_ENABLE(libv4l1,
678
      [AS_HELP_STRING([--disable-libv4l1], [Disable usage of libv4l1, really discouraged])],
679 680 681 682 683
      [case "${enableval}" in
        yes) libv4l1=yes ;;
        no)  libv4l1=no ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l1) ;;
      esac],[libv4l1=yes])
684

685
AC_ARG_ENABLE(libv4l2,
686
      [AS_HELP_STRING([--disable-libv4l2], [Disable usage of libv4l2, really discouraged])],
687
      [case "${enableval}" in
688 689 690 691
        yes) libv4l2=yes ;;
        no)  libv4l2=no ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l2) ;;
      esac],[libv4l2=yes])
692

693
PKG_CHECK_MODULES(LIBV4L2, libv4l2,
694 695
	[AC_DEFINE(HAVE_LIBV4L2,1,[Defined if we have libv4l2])
	have_libv4l2=yes]
aymeric's avatar
aymeric committed
696
	,[echo "No libv4l2 found."]
697 698
)
PKG_CHECK_MODULES(LIBV4L1, libv4l1,
699 700
	[AC_DEFINE(HAVE_LIBV4L1,1,[Defined if we have libv4l1])
	have_libv4l1=yes]
aymeric's avatar
aymeric committed
701
	,[echo "No libv4l1 found."]
702
)
aymeric's avatar
aymeric committed
703

704 705
if test "$found_v4l2" = "yes" && test "$have_libv4l2" != "yes" ; then
	if test "$video" = "true" && test "$libv4l2" = "yes" ; then
706 707 708 709 710
		AC_MSG_ERROR(
[
Missing libv4l2. It is highly recommended to build with
libv4l2 headers and library. Many camera will won't work or will crash
your application if libv4l2 is not installed.
711
If you know what you are doing, you can use --disable-libv4l2 to disable
712 713 714 715 716
this check.
])
	fi
fi

717

Ghislain MARY's avatar
Ghislain MARY committed
718 719
AC_PATH_PROG(PCAP,pcap-config,false)
AM_CONDITIONAL(HAVE_PCAP, test $PCAP != false)
720 721 722 723 724 725 726 727 728
AC_ARG_ENABLE(pcap,
	[AS_HELP_STRING([--enable-pcap], [Enable pcap library (default=no)])],
	[case "${enableval}" in
		yes) enable_pcap=yes ;;
		no) enable_pcap=no ;;
		*) AC_MSG_ERROR(bad value ${enableval} for --enable-pcap) ;;
	esac], [enable_pcap=no])
AM_CONDITIONAL(ENABLE_PCAP, test x$enable_pcap = xyes)
if test x$enable_pcap == xyes ; then
729 730 731 732 733 734 735
	if test $PCAP != false ; then
		PCAP_LIBS=`pcap-config --libs`
		PCAP_CFLAGS=`pcap-config --cflags`
		PCAP_CFLAGS="$PCAP_CFLAGS -DHAVE_PCAP"
		AC_SUBST(PCAP_LIBS)
		AC_SUBST(PCAP_CFLAGS)
	fi
736
fi
Ghislain MARY's avatar
Ghislain MARY committed
737 738


739
AC_ARG_ENABLE(tests,
740
      [AS_HELP_STRING([--enable-tests], [Enable compilation of tests (default=yes)])],
741
      [case "${enableval}" in
742 743 744
        yes) tests=yes ;;
        no)  tests=no  ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
745
      esac],[tests=yes])
746
AM_CONDITIONAL(ENABLE_TESTS, test x$tests = xyes)
747 748


smorlat's avatar
smorlat committed
749 750 751 752 753 754 755
dnl ##################################################
dnl # Check for doxygen
dnl ##################################################

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

aymeric's avatar
aymeric committed
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816

dnl ##################################################
dnl # Check for ESP Packager
dnl ##################################################

AC_PATH_PROG(EPM,epm,false)
AC_PATH_PROG(MKEPMLIST,mkepmlist,false)
AC_PATH_PROG(EPMINSTALL,epminstall,false)
AM_CONDITIONAL(WITH_EPM,test $EPM != false && test $MKEPMLIST != false && test $EPMINSTALL != false)


# Preferred packaging system, as per EPM terminology
case $target in
*-*-linux*)
	if test -f /etc/debian_version ; then
		EPM_PKG_EXT=deb
	else
     		EPM_PKG_EXT=rpm
     	fi
     	;;
*-hp-hpux*)
     	EPM_PKG_EXT=depot.gz;;
*-dec-osf*)
	EPM_PKG_EXT=setld;;
esac
AC_SUBST(EPM_PKG_EXT)

# System software User & Group names
case $target in
*-*-linux*)
	SYS_USER=root
	SYS_GROUP=root
	;;
*-*-hpux*|*-dec-osf*)
	SYS_USER=bin
	SYS_GROUP=bin
	;;
esac
AC_SUBST(SYS_USER)
AC_SUBST(SYS_GROUP)

# CPU Architecture
case $target_cpu in
i?86)		ARCH=i386;;
*)		ARCH=$target_cpu;;
esac
AC_SUBST(ARCH)

# Various other packaging variables, that can be over-ridden ad `make
# package' time
SUMMARY="A mediastreaming library."
AC_SUBST(SUMMARY)
PACKAGER=anonymous
AC_SUBST(PACKAGER)
LICENSE=GPL
AC_SUBST(LICENSE)
VENDOR=Linphone
AC_SUBST(VENDOR)
RELEASE=1
AC_SUBST(RELEASE)

817
CFLAGS="$CFLAGS $MS_PUBLIC_CFLAGS"
Simon Morlat's avatar
Simon Morlat committed
818
CXXFLAGS="$CXXFLAGS $MS_PUBLIC_CFLAGS "
819 820
dnl: these ones gets exported in pkgconfig file.
AC_SUBST(MS_PUBLIC_CFLAGS)
aymeric's avatar
aymeric committed
821

Simon Morlat's avatar
Simon Morlat committed
822
AC_CONFIG_FILES(
aymeric's avatar
aymeric committed
823
Makefile
Simon Morlat's avatar
Simon Morlat committed
824
po/Makefile.in
aymeric's avatar
aymeric committed
825 826 827 828 829 830
include/Makefile
include/mediastreamer2/Makefile
src/Makefile
tests/Makefile
build/Makefile
build/win32native/Makefile
831
build/win32native/mediastream/Makefile
aymeric's avatar
aymeric committed
832 833
build/win32-novideo/Makefile
build/wince/Makefile
834
build/winmob/Makefile
aymeric's avatar
aymeric committed
835 836 837
mediastreamer.pc
mediastreamer2.spec
help/Makefile
smorlat's avatar
smorlat committed
838
help/Doxyfile
aymeric's avatar
aymeric committed
839
)
840

Simon Morlat's avatar
Simon Morlat committed
841
AC_OUTPUT