configure.ac 18.9 KB
Newer Older
aymeric's avatar
aymeric committed
1
dnl Process this file with autoconf to produce a configure script.
smorlat's avatar
smorlat committed
2
AC_INIT([mediastreamer],[2.3.1])
aymeric's avatar
aymeric committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34

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)

LIBMEDIASTREAMER_SO_CURRENT=0 dnl increment this number when you add/change/remove an interface
LIBMEDIASTREAMER_SO_REVISION=1 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
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 48 49
AC_SUBST([mkdir_p])

AC_MSG_CHECKING([warning make an error on compilation])
AC_ARG_ENABLE(strict,
[  --enable-strict       Enable error on compilation warning [default=no]],
[wall_werror=$enableval],
50 51 52 53 54 55 56
[
	if test "$USER" = "smorlat" ; then
		wall_werror=yes
	else
		wall_werror=no
	fi
]
aymeric's avatar
aymeric committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
)

CFLAGS="-DORTP_INET6 $CFLAGS "

dnl enable ipv6 support
AC_ARG_ENABLE(ipv6,
      [  --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])
if test x$ipv6 = xtrue ; then
	CFLAGS="$CFLAGS -DINET6"
fi


AC_ARG_ENABLE(debug,
			[  --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] )


dnl Checks for programs.
AC_PROG_CC
smorlat's avatar
smorlat committed
86
AC_PROG_CXX
87
AC_PROG_OBJC
88
AC_LIBTOOL_WIN32_DLL
aymeric's avatar
aymeric committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
AC_PROG_LIBTOOL
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)

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
	CFLAGS="$CFLAGS -Wall"
fi



if test $debug_enabled = "yes"; then
	CFLAGS="$CFLAGS -g -DDEBUG"
else
	CFLAGS="$CFLAGS -O2 -g "
fi

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
	CFLAGS="$CFLAGS -Werror "
fi

macosx_found=no
Jehan Monnier's avatar
Jehan Monnier committed
129
mingw32ce_found=no
aymeric's avatar
aymeric committed
130 131

dnl add thread flags
132 133 134 135 136
case $target_os in
  	*darwin*)
		MSPLUGINS_CFLAGS=""
		MSPLUGINS_LIBS="-dynamiclib"
		macosx_found=yes
137
		LIBS="$LIBS -framework CoreFoundation -framework AudioToolbox -framework CoreAudio"
138
	;;
139 140 141 142
  	*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
143
        	LIBS="$LIBS -lws2"
144
		mingw_found=yes
Jehan Monnier's avatar
Jehan Monnier committed
145
		mingw32ce_found=yes
146 147
		build_tests=no
    ;;
148
	*mingw*)
149 150 151 152 153 154
		CFLAGS="$CFLAGS -DINET6 -DORTP_INET6 -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
		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
155 156 157 158 159 160 161 162 163 164
  *)
     MSPLUGINS_CFLAGS="-pthread"
     MSPLUGINS_LIBS="-shared -pthread"
     CFLAGS="$CFLAGS -pthread -D_REENTRANT"
     LIBS="$LIBS -pthread -lpthread"
     ;;
esac

AM_CONDITIONAL(BUILD_MACOSX, test x$macosx_found = xyes)

165 166
AM_CONDITIONAL(BUILD_TESTS,test x$build_tests != xno)

167
AC_CONFIG_COMMANDS([libtool-hacking],[
168
if test "$mingw_found" = "yes" ; then
169
	echo "Hacking libtool to work with mingw..."
170 171 172
	sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
	cp -f ./libtool.tmp ./libtool
	rm -f ./libtool.tmp
173 174
else
	echo "No need to hack libtool."
175
fi
176
], [mingw_found=$mingw_found])
177 178


179 180
dnl prefer fixed point computations
AC_ARG_ENABLE(fixed_point,
181
      [  --enable-fixed-point    Turn on fixed point computations (default: guess)],
182 183 184
      [case "${enableval}" in
        yes)  fixed_point=true;;
        no)   fixed_point=false;;
185
	guess) fixed_point=guess;;
186
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-fixed-point) ;;
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
      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
  

206 207 208 209 210
if test x$fixed_point = xtrue ; then
	MS_PUBLIC_CFLAGS="$MS_PUBLIC_CFLAGS -DMS_FIXED_POINT"
fi


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

aymeric's avatar
aymeric committed
214 215 216 217 218 219 220 221 222 223 224
AC_SUBST(MSPLUGINS_CFLAGS)
AC_SUBST(MSPLUGINS_LIBS)

AC_CHECK_LIB(rt,clock_gettime,[LIBS="$LIBS -lrt"])

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

found_sound=no

225 226 227 228
if test x$mingw_found = xyes ; then
	found_sound=yes
fi

smorlat's avatar
smorlat committed
229 230 231 232 233 234 235 236 237
AC_ARG_ENABLE(oss,
      [  --enable-oss    Disable oss support],
      [case "${enableval}" in
        yes) oss=true ;;
        no)  oss=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-oss) ;;
      esac],[oss=true])

if "$oss" = "true"; then
aymeric's avatar
aymeric committed
238 239 240 241 242 243
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
244 245
else
	oss=false
aymeric's avatar
aymeric committed
246
fi
smorlat's avatar
smorlat committed
247
fi
aymeric's avatar
aymeric committed
248

249
AM_CONDITIONAL(BUILD_OSS, test x$oss = xtrue)
aymeric's avatar
aymeric committed
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276

dnl conditionnal build of ALSA support
AC_ARG_ENABLE(alsa,
      [  --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])

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])
			alsa_enabled=true 
			])
		]
	)
fi
AC_SUBST(ALSA_LIBS)

AM_CONDITIONAL(BUILD_ALSA, test x$alsa_enabled = xtrue)


AC_ARG_ENABLE(artsc,
smorlat's avatar
smorlat committed
277
      [  --enable-artsc    Turn on artsc (kde<4) sound input/output (no) ],
aymeric's avatar
aymeric committed
278 279 280 281
      [case "${enableval}" in
        yes) artsc=true ;;
        no)  artsc=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-artsc) ;;
smorlat's avatar
smorlat committed
282
      esac],[artsc=no])
aymeric's avatar
aymeric committed
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337

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,
				[ AC_CHECK_LIB(artsc,arts_init, 
					[ 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,
      [  --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])

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])
			portaudio_enabled=true 
			])
		]
	)
fi

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

AC_ARG_ENABLE(macsnd,
338
      [  --enable-macsnd    Turn on native macosx sound support (default=no)],
aymeric's avatar
aymeric committed
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
      [case "${enableval}" in
        yes) macsnd=true ;;
        no)  macsnd=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-macsnd) ;;
      esac],[macsnd=false])

if test "$macsnd" = "true"; then
	AC_DEFINE(__MACSND_ENABLED__,1,[defined if native macosx sound support is available])
	macsnd_enabled=true
	found_sound=yes
fi

AM_CONDITIONAL(BUILD_MACSND, test x$macsnd_enabled = xtrue)

AC_ARG_ENABLE(macaqsnd,
354
      [  --enable-macaqsnd    Turn on native macosx Audio Queue sound support (default=yes)],
aymeric's avatar
aymeric committed
355 356 357 358
      [case "${enableval}" in
        yes) macaqsnd=true ;;
        no)  macaqsnd=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-macaqsnd) ;;
359
      esac],[macaqsnd=true])
360 361 362 363

if test "$macosx_found" != "yes" ; then
	macaqsnd=false
fi
aymeric's avatar
aymeric committed
364

365
if test "$macaqsnd" = "true"; then
aymeric's avatar
aymeric committed
366 367 368 369
	AC_DEFINE(__MAC_AQ_ENABLED__,1,[defined if native macosx AQ sound support is available])
	found_sound=yes
fi

370
AM_CONDITIONAL(BUILD_MACAQSND, test x$macaqsnd = xtrue)
aymeric's avatar
aymeric committed
371

smorlat's avatar
smorlat committed
372 373 374 375 376 377 378 379 380 381
AC_ARG_ENABLE(jack,
      [  --disable-jack    Disable jack support],
      [case "${enableval}" in
        yes) jack=true ;;
        no)  jack=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-jack) ;;
      esac],[jack=true])

if test x$jack = xtrue; then

aymeric's avatar
aymeric committed
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
dnl Check for samplerate libraries
dnl Check for jack libraries (sound output plugin)
PKG_CHECK_MODULES(JACK,jack >= 0.15.0, 
[ 
	dnl we' found jack devel files
	PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.0.13,
		[AC_DEFINE(__JACK_ENABLED__,1,[Jack support])
		found_sound=yes 
		jack_found=yes] ,
		[echo "libsamplerate not found, jack support disabled."])
	AC_SUBST(SAMPLERATE_CFLAGS)
	AC_SUBST(SAMPLERATE_LIBS)
], 
[echo "No jack support."] )

if test x$jack_found = xno ; then
	dnl reset flags 
	JACK_CFLAGS=
	JACK_LIBS=
	SAMPLERATE_CFLAGS=
	SAMPLERATE_LIBS=
fi

AC_SUBST(JACK_CFLAGS)
AC_SUBST(JACK_LIBS) 

smorlat's avatar
smorlat committed
408 409
fi

410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
AC_ARG_ENABLE(pulseaudio,
      [  --disable-pulseaudio    Disable pulseaudio support],
      [case "${enableval}" in
        yes) pulseaudio=true ;;
        no)  pulseaudio=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-pulseaudio) ;;
      esac],[pulseaudio=true])


if test x$pulseaudio = xtrue ; then
	PKG_CHECK_MODULES(LIBPULSE, libpulse >= 0.9.21,
		[AC_DEFINE(__PULSEAUDIO_ENABLED__,1,[Pulse audio support])],
		[pulseaudio=false])
fi

AM_CONDITIONAL(BUILD_PULSEAUDIO,test x$pulseaudio = xtrue)


aymeric's avatar
aymeric committed
428
if test "$found_sound" = "no"; then
jehan's avatar
jehan committed
429
	AC_MSG_WARN([Could not find a support sound driver API])
aymeric's avatar
aymeric committed
430 431 432 433 434 435 436
fi


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

smorlat's avatar
smorlat committed
437 438 439 440 441 442 443 444 445 446
AC_ARG_ENABLE(speex,
      [  --disable-speex    Disable speex support],
      [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
447
dnl check for installed version of speex
smorlat's avatar
smorlat committed
448
PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3,
aymeric's avatar
aymeric committed
449 450 451
	[ AC_DEFINE(HAVE_SPEEX_NOISE,1,[tells whether the noise arg of speex_echo_cancel can be used]) ],
	[try_other_speex=yes]
)
452
PKG_CHECK_MODULES(SPEEX, speex >= 1.2beta3, build_speex=yes)
453
build_resample=false
aymeric's avatar
aymeric committed
454
PKG_CHECK_MODULES(SPEEXDSP, speexdsp >= 1.2beta3,
455
    [SPEEX_LIBS="$SPEEX_LIBS $SPEEXDSP_LIBS"
456
    AC_DEFINE(HAVE_SPEEXDSP,1,[have speexdsp library])
457 458
    build_resample=yes] ,
    [AC_MSG_NOTICE([No speexdsp library found.])
aymeric's avatar
aymeric committed
459 460 461 462
]
)
AC_SUBST(SPEEX_CFLAGS)
AC_SUBST(SPEEX_LIBS)
smorlat's avatar
smorlat committed
463 464 465

fi

aymeric's avatar
aymeric committed
466
AM_CONDITIONAL(BUILD_SPEEX, test x$build_speex = xyes )
467
AM_CONDITIONAL(BUILD_RESAMPLE, test x$build_resample = xyes )
aymeric's avatar
aymeric committed
468

smorlat's avatar
smorlat committed
469 470 471 472 473 474 475
AC_ARG_ENABLE(gsm,
      [  --disable-gsm    Disable gsm support],
      [case "${enableval}" in
        yes) gsm=true ;;
        no)  gsm=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-gsm) ;;
      esac],[gsm=true])
476
      
smorlat's avatar
smorlat committed
477 478
if test x$gsm = xtrue; then

aymeric's avatar
aymeric committed
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
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
	fi
else
	build_gsm=no
fi
smorlat's avatar
smorlat committed
495 496 497

fi

aymeric's avatar
aymeric committed
498 499 500 501 502
AM_CONDITIONAL(BUILD_GSM, test x$build_gsm = xyes )

MS_CHECK_VIDEO
AM_CONDITIONAL(BUILD_VIDEO, test "$video" = "true")
AM_CONDITIONAL(BUILD_THEORA, test "$have_theora" = "yes")
503
AM_CONDITIONAL(BUILD_WIN32, test "$mingw_found" = "yes")
Jehan Monnier's avatar
Jehan Monnier committed
504
AM_CONDITIONAL(BUILD_WIN32_WCE, test "$mingw32ce_found" = "yes")
505
AM_CONDITIONAL(BUILD_FFMPEG, test "$ffmpeg" = "true")
aymeric's avatar
aymeric committed
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549

dnl	*********************************************
dnl	setup oRTP dependency
dnl	*********************************************
AC_ARG_ENABLE(external-ortp,
      [  --enable-external-ortp    Use external oRTP library],
      [case "${enableval}" in
        yes) external_ortp=true ;;
        no)  external_ortp=false ;;
        *) AC_MSG_ERROR(bad value ${enableval} for --enable-external-ortp) ;;
      esac],[external_ortp=false])

if test "$external_ortp" = '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
	else
		external_ortp=true
	fi
fi
if test "$external_ortp" = 'true'; then
	PKG_CHECK_MODULES(ORTP, ortp >= 0.9.0, ,
		[ AC_MSG_ERROR([Couldn't find ortp library]) ] )
fi
AC_SUBST(ORTP_CFLAGS)
AC_SUBST(ORTP_LIBS)


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

smorlat's avatar
smorlat committed
550
if test "x${prefix}" = "xNONE"; then
simorl's avatar
simorl committed
551 552 553 554 555 556 557
	package_prefix=${ac_default_prefix}
else
	package_prefix=${prefix}
fi

if test x$mingw_found = xyes ; then
	package_prefix="."
smorlat's avatar
smorlat committed
558 559
fi

aymeric's avatar
aymeric committed
560
dnl define path of plugins:
simorl's avatar
simorl committed
561 562
AC_DEFINE_UNQUOTED(PACKAGE_PLUGINS_DIR, "${package_prefix}/lib/mediastreamer/plugins" ,[path of plugins])
PACKAGE_PLUGINS_DIR="${package_prefix}/lib/mediastreamer/plugins"
aymeric's avatar
aymeric committed
563 564
AC_SUBST(PACKAGE_PLUGINS_DIR)

smorlat's avatar
smorlat committed
565
PACKAGE_DATA_DIR="$prefix/share"
simorl's avatar
simorl committed
566
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR,  "${package_prefix}/share" ,[path of data])
aymeric's avatar
aymeric committed
567 568 569 570
AC_SUBST(PACKAGE_DATA_DIR)

dnl check for video4linux headers
AC_CHECK_HEADERS(linux/videodev.h linux/videodev2.h)
571 572 573 574 575 576 577 578 579
if test "${ac_cv_header_linux_videodev_h}" = "yes" || \
	test "${ac_cv_header_linux_videodev2_h}" = "yes" ; then
	found_v4l=yes
else
	found_v4l=no
fi

AM_CONDITIONAL(BUILD_V4L, test x$found_v4l = xyes )

580 581 582
AC_ARG_ENABLE(libv4l,
      [  --disable-libv4l    Disable usage of libv4l, really discouraged],
      [case "${enableval}" in
583
        yes) libv4l=yes ;;
584
        no)  libv4l=no ;;
585
        *) AC_MSG_ERROR(bad value ${enableval} for --disable-libv4l) ;;
586
      esac],[libv4l=yes])
587

588
PKG_CHECK_MODULES(LIBV4L2, libv4l2,
589 590
	[AC_DEFINE(HAVE_LIBV4L2,1,[Defined if we have libv4l2])
	have_libv4l2=yes]
aymeric's avatar
aymeric committed
591
	,[echo "No libv4l2 found."]
592 593
)
PKG_CHECK_MODULES(LIBV4L1, libv4l1,
594 595
	[AC_DEFINE(HAVE_LIBV4L1,1,[Defined if we have libv4l1])
	have_libv4l1=yes]
aymeric's avatar
aymeric committed
596
	,[echo "No libv4l1 found."]
597
)
aymeric's avatar
aymeric committed
598

599
if test "$found_v4l" = "yes" && test "$have_libv4l2" != "yes" ; then
600
	if test "$video" = "true" && test "$libv4l" = "yes" ; then
601 602 603 604 605 606 607 608 609 610 611
		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.
If you know what you are doing, you can use --disable-libv4l to disable
this check.
])
	fi
fi

smorlat's avatar
smorlat committed
612 613 614 615 616 617 618
dnl ##################################################
dnl # Check for doxygen
dnl ##################################################

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

aymeric's avatar
aymeric committed
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679

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)

680 681 682 683
CFLAGS="$CFLAGS $MS_PUBLIC_CFLAGS"
CXXFLAGS="$CXXFLAGS $MS_PUBLIC_CFLAGS"
dnl: these ones gets exported in pkgconfig file.
AC_SUBST(MS_PUBLIC_CFLAGS)
aymeric's avatar
aymeric committed
684 685 686 687 688 689 690 691 692 693 694

AC_OUTPUT(
Makefile
include/Makefile
include/mediastreamer2/Makefile
src/Makefile
tests/Makefile
build/Makefile
build/win32native/Makefile
build/win32-novideo/Makefile
build/wince/Makefile
695
build/winmob/Makefile
aymeric's avatar
aymeric committed
696 697 698
mediastreamer.pc
mediastreamer2.spec
help/Makefile
smorlat's avatar
smorlat committed
699
help/Doxyfile
aymeric's avatar
aymeric committed
700 701
help/doxygen.dox
)