configure.ac 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  1. #
  2. # Copyright (C) 2010-2015 Mamadou DIOP
  3. # Copyright (C) 2011-2015 Doubango Telecom <http://www.doubango.org>
  4. # License: GPLv3 or commercial
  5. # This file is part of Doubango VoIP framework <https://code.google.com/p/doubango/>
  6. #
  7. AC_PREREQ([2.0])
  8. AC_INIT(libdoubango, 2.0.1316, doubango(at)googlegroups(dot)com)
  9. AC_CANONICAL_SYSTEM
  10. AM_INIT_AUTOMAKE([subdir-objects])
  11. AC_CONFIG_MACRO_DIR([m4])
  12. AC_CONFIG_HEADERS([config.h])
  13. AC_CONFIG_SRCDIR([tinySAK/src/tsk.c])
  14. ### HOST FOR CROSS-COMPILING
  15. target_os=`uname -s`
  16. android_cpu=unknown
  17. case "$host" in
  18. arm-*-linux-androideabi)
  19. target_os=android
  20. android_cpu=armv5te
  21. ;;
  22. aarch64-*-linux-android)
  23. target_os=android
  24. android_cpu=arm64
  25. ;;
  26. x86_64-*-linux-android)
  27. target_os=android
  28. android_cpu=x64
  29. ;;
  30. i686-*-linux-android)
  31. target_os=android
  32. android_cpu=x86
  33. ;;
  34. *)
  35. AC_MSG_NOTICE(["Using host as target os: $host"])
  36. ;;
  37. esac
  38. ### ANDROID-CPU
  39. AC_ARG_WITH(android-cpu,
  40. [ --with-android-cpu[=cpu] set android CPU type [[default=armv5te]]
  41. armv5te: ARMv5TE
  42. armv7-a: ARMv7-a *without* NEON
  43. armv7-a-neon: ARMv7-a *with* NEON
  44. arm64: aarch64
  45. x86: X86
  46. x64: X86_64],
  47. [ android_cpu=$withval ])
  48. ### ANDROID-TOOLCHAIN (http://www.kandroid.org/ndk/docs/STANDALONE-TOOLCHAIN.html)
  49. if test "$target_os" = "android"; then
  50. case "$android_cpu" in
  51. x86)
  52. export SYSROOT=$NDK/platforms/android-23/arch-x86
  53. export ANDROID_PREFIX=i686-linux-android
  54. export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-x86
  55. $NDK/build/tools/make-standalone-toolchain.sh --platform=android-23 --arch=x86 --install-dir=$ANDROID_TOOLCHAIN
  56. export CFLAGS='-DANDROID=1'
  57. AC_SUBST(TARGET_ARCH, "x86")
  58. ;;
  59. x64)
  60. export SYSROOT=$NDK/platforms/android-21/arch-x86_64
  61. export ANDROID_PREFIX=x86_64-linux-android
  62. export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-x86_64
  63. $NDK/build/tools/make-standalone-toolchain.sh --arch=x86_64 --platform=android-21 --install-dir=$ANDROID_TOOLCHAIN
  64. export CFLAGS='-DANDROID=1'
  65. AC_SUBST(TARGET_ARCH, "x86")
  66. ;;
  67. arm64)
  68. export ANDROID_PREFIX=aarch64-linux-android
  69. export SYSROOT=$NDK/platforms/android-21/arch-arm64
  70. export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-arm64
  71. $NDK/build/tools/make-standalone-toolchain.sh --arch=arm64 --platform=android-21 --install-dir=$ANDROID_TOOLCHAIN
  72. export CFLAGS='-DANDROID=1 -D__ARMEL__'
  73. AC_SUBST(TARGET_ARCH, "arm")
  74. ;;
  75. armv7-a)
  76. export ANDROID_PREFIX=arm-linux-androideabi
  77. export SYSROOT=$NDK/platforms/android-23/arch-arm
  78. export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-armv7-a
  79. $NDK/build/tools/make-standalone-toolchain.sh --platform=android-23 --arch=arm --install-dir=$ANDROID_TOOLCHAIN
  80. export CFLAGS='-march=armv7-a -mfloat-abi=softfp -DANDROID=1 -D__ARMEL__'
  81. export LDFLAGS='-Wl,--fix-cortex-a8'
  82. AC_SUBST(TARGET_ARCH, "arm")
  83. ;;
  84. armv7-a-neon)
  85. export ANDROID_PREFIX=arm-linux-androideabi
  86. export SYSROOT=$NDK/platforms/android-23/arch-arm
  87. export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-android-armv7-a-neon
  88. $NDK/build/tools/make-standalone-toolchain.sh --platform=android-23 --arch=arm --install-dir=$ANDROID_TOOLCHAIN
  89. export CFLAGS='-march=armv7-a -mfloat-abi=softfp -mfpu=neon -DANDROID=1'
  90. export LDFLAGS='-Wl,--fix-cortex-a8'
  91. AC_SUBST(TARGET_ARCH, "arm")
  92. ;;
  93. *)
  94. export ANDROID_PREFIX=arm-linux-androideabi
  95. export SYSROOT=$NDK/platforms/android-23/arch-arm
  96. export ANDROID_TOOLCHAIN=$(pwd)/my-android-toolchain-armv5te
  97. $NDK/build/tools/make-standalone-toolchain.sh --platform=android-23 --arch=arm --install-dir=$ANDROID_TOOLCHAIN
  98. AC_SUBST(TARGET_ARCH, "arm")
  99. ;;
  100. esac
  101. AC_SUBST(NDK, $NDK)
  102. export CFLAGS="${CFLAGS} -fsigned-char"
  103. export CPPFLAGS="$CFLAGS -fPIC"
  104. export LDFLAGS="${LDFLAGS} -lc -lm -lgcc"
  105. export PATH=$ANDROID_TOOLCHAIN/bin:$PATH
  106. export CC=$ANDROID_TOOLCHAIN/bin/$ANDROID_PREFIX-gcc
  107. export AR=$ANDROID_TOOLCHAIN/bin/$ANDROID_PREFIX-ar
  108. export CXX=$ANDROID_TOOLCHAIN/bin/$ANDROID_PREFIX-g++
  109. export AS=$ANDROID_TOOLCHAIN/bin/$ANDROID_PREFIX-as
  110. export RANLIB=$ANDROID_TOOLCHAIN/bin/$ANDROID_PREFIX-ranlib
  111. export STRIP=$ANDROID_TOOLCHAIN/bin/$ANDROID_PREFIX-strip
  112. fi
  113. dnl find suitable C and C++ compilers
  114. AC_PROG_CC
  115. AC_PROG_CXX
  116. AC_PROG_INSTALL
  117. AC_PROG_LIBTOOL
  118. AC_LIBTOOL_WIN32_DLL
  119. AC_PROG_SED
  120. AC_PROG_MAKE_SET
  121. PKG_PROG_PKG_CONFIG
  122. ### Set Target OS
  123. AM_CONDITIONAL([TARGET_OS_IS_ANDROID], [test "x$target_os" = xandroid])
  124. ### CROSS COMPILATION?
  125. AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
  126. ### ENABLE GPL CODE
  127. AC_ARG_ENABLE(gpl,
  128. [ AS_HELP_STRING([--disable-gpl], [Disable GPL code]) ], [ ],[])
  129. test "x$enable_gpl" = "x" && enable_gpl=yes
  130. ### ENABLE NONFREE CODE
  131. AC_ARG_ENABLE(nonfree,
  132. [ AS_HELP_STRING([--disable-nonfree], [Disable NONFREE code]) ], [ ],[])
  133. test "x$enable_nonfree" = "x" && enable_nonfree=yes
  134. ### ENABLE-DEBUG
  135. AC_MSG_CHECKING(whether to enable debugging)
  136. debug_default="no"
  137. AC_ARG_ENABLE(debug,
  138. [ --enable-debug[=no/yes] turn on/off debugging
  139. [[default=$debug_default]]],
  140. [ if test "x$enableval" = "xyes" ; then
  141. AC_DEFINE(DEBUG_LEVEL, DEBUG_LEVEL_INFO, [])
  142. else
  143. AC_DEFINE(DEBUG_LEVEL, DEBUG_LEVEL_ERROR, [])
  144. fi
  145. ],
  146. [])
  147. test "x$enable_debug" = "x" && enable_debug=no
  148. AM_CONDITIONAL(USE_DEBUG, test x"$enable_debug" = x"yes")
  149. if test "$enable_debug" = "yes"; then
  150. CFLAGS="${CFLAGS} -O0 -g3 -DDEBUG"
  151. CPPFLAGS=$CFLAGS
  152. CXXFLAGS=$CFLAGS
  153. else
  154. if test "$target_os" = "android"; then
  155. CFLAGS="${CFLAGS} -Os -s"
  156. else
  157. CFLAGS="${CFLAGS} -O3 -DNDEBUG"
  158. fi
  159. CPPFLAGS=$CFLAGS
  160. CXXFLAGS=$CFLAGS
  161. fi
  162. ### DEBUG-LEVEL
  163. debug_level=error
  164. AC_ARG_WITH(debug-level,
  165. [ --with-debug-level[=level] Set debug-level to level [[default=error]]
  166. info: informational
  167. warn: warnings
  168. error [default]: errors
  169. fatal: fatal],
  170. [ if test "x$withval" = "xinfo" ; then
  171. AC_DEFINE(DEBUG_LEVEL, DEBUG_LEVEL_INFO, [info debug])
  172. AC_MSG_RESULT(info)
  173. elif test "x$withval" = "xwarn" ; then
  174. AC_DEFINE(DEBUG_LEVEL, DEBUG_LEVEL_INFO, [warn debug])
  175. AC_MSG_RESULT(warn)
  176. elif test "x$withval" = "xerror" ; then
  177. AC_DEFINE(DEBUG_LEVEL, DEBUG_LEVEL_ERROR, [error debug])
  178. AC_MSG_RESULT(error)
  179. elif test "x$withval" = "xfatal" ; then
  180. AC_DEFINE(DEBUG_LEVEL, DEBUG_LEVEL_FATAL, [fatal debug])
  181. AC_MSG_RESULT(fatal)
  182. fi
  183. debug_level=$withval
  184. ])
  185. ### BUILD-TYPE
  186. build_type=doubango
  187. AC_ARG_WITH(build-type,
  188. [ --with-build-type[=bt] Set build-type to bt [[default=doubango]]
  189. doubango [default]: Doubango Telecom
  190. ge: General Electric
  191. tiscali: Tiscali
  192. tch: Technicolor],
  193. [ if test "x$withval" = "xtch" ; then
  194. AC_DEFINE(BUILD_TYPE_TCH, 1, [Technicolor])
  195. elif test "x$withval" = "xge" ; then
  196. AC_DEFINE(BUILD_TYPE_GE, 1, [General Electric])
  197. elif test "x$withval" = "xtiscali" ; then
  198. AC_DEFINE(BUILD_TYPE_TISCALI, 1, [Tiscali])
  199. fi
  200. build_type="$withval"
  201. ])
  202. ### CFLAGS && LDFLAGS
  203. if test "$target_os" = "android"; then
  204. home_dir=`pwd`
  205. CFLAGS="${CFLAGS} -I${home_dir}/thirdparties/android/${android_cpu}/include -I${home_dir}/thirdparties/android/common/include -I${home_dir}/thirdparties/common/include -I${home_dir}/thirdparties/common/include/libyuv"
  206. CPPFLAGS=$CFLAGS
  207. LDFLAGS="${LDFLAGS} -L${home_dir}/thirdparties/android/${android_cpu}/lib/dist"
  208. if test "$enable_gpl" = yes; then
  209. LDFLAGS="${LDFLAGS} -L${home_dir}/thirdparties/android/${android_cpu}/lib/dist/gpl"
  210. else
  211. LDFLAGS="${LDFLAGS} -L${home_dir}/thirdparties/android/${android_cpu}/lib/dist/lgpl"
  212. fi
  213. AC_SUBST(CFLAGS)
  214. AC_SUBST(LDFLAGS)
  215. fi
  216. AC_CHECK_FUNCS([stricmp strnicmp strtok_r strtok_s])
  217. AC_TRY_COMPILE([#include <pthread.h>],
  218. [static int k = PTHREAD_MUTEX_RECURSIVE;],
  219. [AC_DEFINE(TSK_RECURSIVE_MUTEXATTR, PTHREAD_MUTEX_RECURSIVE,
  220. [Check whether PTHREAD_MUTEX_RECURSIVE is defined])],
  221. [AC_TRY_COMPILE([#include <pthread.h>],
  222. [static int k = PTHREAD_MUTEX_RECURSIVE_NP;],
  223. [AC_DEFINE(TSK_RECURSIVE_MUTEXATTR, PTHREAD_MUTEX_RECURSIVE_NP,
  224. [Check whether PTHREAD_MUTEX_RECURSIVE_NP is defined])])])
  225. AC_TRY_COMPILE([#include <stdlib.h>],
  226. [static int a = 0; __sync_fetch_and_add(&a, 1);],
  227. [AC_DEFINE(HAVE___SYNC_FETCH_AND_ADD, 1,
  228. [Check whether __sync_fetch_and_add is defined])],[])
  229. AC_TRY_COMPILE([#include <stdlib.h>],
  230. [static int a = 0; __sync_fetch_and_sub(&a, 1);],
  231. [AC_DEFINE(HAVE___SYNC_FETCH_AND_SUB, 1,
  232. [Check whether __sync_fetch_and_sub is defined])],[])
  233. AC_DEFINE(USE_POLL, 1, [Setting USE_POLL to 1 for backward compatibility])
  234. AC_CHECK_FUNCS([inet_pton inet_ntop poll getdtablesize opendir closedir getpid])
  235. AC_CHECK_HEADERS([arpa/inet.h net/if_types.h net/if_dl.h poll.h unistd.h dirent.h fcntl.h sys/param.h sys/resource.h linux/videodev2.h])
  236. AC_CHECK_FUNC(getifaddrs, AC_DEFINE(HAVE_GETIFADDRS, 1 ,[Define to 1 if you have the 'getifaddrs' function]))
  237. AH_TEMPLATE([HAVE_IFADDRS_H], [Define if <ifaddrs.h> header exist])
  238. AC_CHECK_HEADER([ifaddrs.h], AC_DEFINE(HAVE_IFADDRS_H, 1), AC_DEFINE(HAVE_IFADDRS_H, 0), [])
  239. AH_TEMPLATE([HAVE_NET_IF_DL_H], [Define if <net/if_dl.h> header exist])
  240. AC_CHECK_HEADER([net/if_dl.h], AC_DEFINE(HAVE_NET_IF_DL_H, 1), AC_DEFINE(HAVE_NET_IF_DL_H, 0), [])
  241. AH_TEMPLATE([HAVE_NET_IF_TYPES_H], [Define if <net/if_types> header exist])
  242. AC_CHECK_HEADER([net/if_types.h], AC_DEFINE(HAVE_NET_IF_TYPES_H, 1), AC_DEFINE(HAVE_NET_IF_TYPES_H, 0), [])
  243. AH_TEMPLATE([HAVE_NETPACKET_PACKET_H], [Define if <netpacket/packet.h> header exist])
  244. AC_CHECK_HEADER([netpacket/packet.h], AC_DEFINE(HAVE_NETPACKET_PACKET_H, 1), AC_DEFINE(HAVE_NETPACKET_PACKET_H, 0), [])
  245. AH_TEMPLATE([HAVE_NET_ROUTE_H], [Define if <net/route.h> header exist])
  246. AC_CHECK_HEADER([net/route.h], AC_DEFINE(HAVE_NET_ROUTE_H, 1), AC_DEFINE(HAVE_NET_ROUTE_H, 0), [])
  247. AC_CHECK_TYPES([struct rt_metrics], [], [],
  248. [
  249. #if HAVE_NET_ROUTE_H
  250. # include <net/route.h>
  251. #endif
  252. ])
  253. AC_CHECK_TYPES([struct sockaddr_dl], [], [],
  254. [
  255. #if HAVE_NET_IF_DL_H
  256. # include <net/if_dl.h>
  257. #endif
  258. ])
  259. AC_CHECK_TYPES([struct rlimit], [AC_CHECK_FUNCS([getrlimit setrlimit])], [],
  260. [
  261. #if HAVE_SYS_RESOURCE_H
  262. # include <sys/resource.h>
  263. #endif
  264. ])
  265. AC_CHECK_TYPES([struct dirent], [], [],
  266. [
  267. #if HAVE_DIRENT_H
  268. # include <dirent.h>
  269. #endif
  270. ])
  271. have_resolv=no
  272. AH_TEMPLATE([HAVE_DNS_H], [Define if <dns.h> header exist])
  273. AM_CONDITIONAL(USE_RESOLV, false)
  274. AC_CHECK_LIB([resolv], [dns_search],
  275. AC_SUBST(LIBRESOLV_LIBADD, "-lresolv")
  276. AM_CONDITIONAL(USE_RESOLV, true)
  277. [have_resolv=yes],
  278. AC_SUBST(LIBRESOLV_LIBADD, "")
  279. )
  280. # check for <dns.h> only if libresolv exist
  281. test $have_resolv = yes &&
  282. AC_CHECK_HEADER([dns.h], AC_DEFINE(HAVE_DNS_H, 1), AC_DEFINE(HAVE_DNS_H, 0), [])
  283. AM_CONDITIONAL(USE_RT, false)
  284. have_rt=no
  285. AC_CHECK_LIB([rt], [clock_gettime],
  286. AC_SUBST(LIBRT_LIBADD, "-lrt")
  287. AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define to 1 if we have the `clock_gettime' function.])
  288. AM_CONDITIONAL(USE_RT, true)
  289. [have_rt=yes],
  290. AC_SUBST(LIBRT_LIBADD, "")
  291. )
  292. have_alsa=no
  293. AH_TEMPLATE([HAVE_ALSA_ASOUNDLIB_H], [Define if <alsa/asoundlib.h> header exist])
  294. AM_CONDITIONAL(USE_ALSA, false)
  295. AC_CHECK_LIB([asound], [snd_pcm_open],
  296. AC_SUBST(LIBASOUND_LIBADD, "-lasound")
  297. AM_CONDITIONAL(USE_ALSA, true)
  298. [have_alsa=yes],
  299. AC_SUBST(LIBASOUND_LIBADD, "")
  300. )
  301. # check for <alsa/asoundlib.h> only if libasound exist
  302. test $have_alsa = yes &&
  303. AC_CHECK_HEADER([alsa/asoundlib.h], AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H, 1), AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H, 0) [have_alsa=no], [])
  304. have_oss=no
  305. AH_TEMPLATE([HAVE_LINUX_SOUNDCARD_H], [Define if <linux/soundcard.h> header exist])
  306. AC_CHECK_HEADER([linux/soundcard.h], AC_DEFINE(HAVE_LINUX_SOUNDCARD_H, 1) [have_oss=yes], AC_DEFINE(HAVE_LINUX_SOUNDCARD_H, 0), [])
  307. have_v4l2=no
  308. AH_TEMPLATE([HAVE_LINUX_VIDEODEV2_H], [Define if <linux/videodev2.h> header exist])
  309. AC_CHECK_HEADER([linux/videodev2.h], AC_DEFINE(HAVE_LINUX_VIDEODEV2_H, 1) [have_v4l2=yes], AC_DEFINE(HAVE_LINUX_VIDEODEV2_H, 0), [])
  310. AH_TEMPLATE([TNET_HAVE_SS_LEN], [Define if sockaddr_storage.ss_len exists])
  311. AC_CHECK_MEMBER([struct sockaddr_storage.ss_len], AC_DEFINE(TNET_HAVE_SS_LEN, 1), AC_DEFINE(TNET_HAVE_SS_LEN,0), [#include <sys/socket.h>])
  312. AH_TEMPLATE([TNET_HAVE_SA_LEN], [Define if sockaddr.sa_len exists])
  313. AC_CHECK_MEMBER([struct sockaddr.sa_len], AC_DEFINE(TNET_HAVE_SA_LEN, 1), AC_DEFINE(TNET_HAVE_SA_LEN, 0), [#include <netinet/in.h>])
  314. ########################################################
  315. # SRTP
  316. # --with-srtp / --without-srtp as argument to configure
  317. ########################################################
  318. AH_TEMPLATE([HAVE_APPEND_SALT_TO_KEY], [Checks if the installed libsrtp version support append_salt_to_key() function])
  319. AH_TEMPLATE([HAVE_SRTP_PROFILE_GET_MASTER_KEY_LENGTH], [Checks if the installed libsrtp version support srtp_profile_get_master_key_length() function])
  320. AH_TEMPLATE([HAVE_SRTP_PROFILE_GET_MASTER_SALT_LENGTH], [Checks if the installed libsrtp version support srtp_profile_get_master_salt_length() function])
  321. have_srtp=no
  322. want_srtp=check
  323. path_srtp=undef
  324. AC_SUBST(LIBSRTP_LIBADD, "")
  325. AC_ARG_WITH(srtp,
  326. [ --with-srtp=PATH Build with SRTP (requires libsrtp). PATH is optional.],
  327. if test "x$withval" = "xyes"; then
  328. want_srtp=yes
  329. path_srtp=undef
  330. elif test "x$withval" = "xno"; then
  331. want_srtp=no
  332. path_srtp=undef
  333. elif test "$withval"; then
  334. want_srtp=yes
  335. path_srtp=$withval
  336. fi,
  337. )
  338. # only if --without-srtp not used
  339. if test $want_srtp != no; then
  340. # check for lib and headers
  341. AC_CHECK_HEADERS(srtp/srtp.h,
  342. AC_CHECK_LIB(srtp, srtp_create, AC_DEFINE_UNQUOTED(HAVE_SRTP, 1, HAVE_SRTP) [have_srtp=yes] LIBSRTP_LIBADD="-lsrtp"
  343. AC_CHECK_LIB(srtp, append_salt_to_key, AC_DEFINE(HAVE_APPEND_SALT_TO_KEY, 1), AC_DEFINE(HAVE_APPEND_SALT_TO_KEY, 0))
  344. AC_CHECK_LIB(srtp, srtp_profile_get_master_key_length, AC_DEFINE(HAVE_SRTP_PROFILE_GET_MASTER_KEY_LENGTH, 1), AC_DEFINE(HAVE_SRTP_PROFILE_GET_MASTER_KEY_LENGTH, 0))
  345. AC_CHECK_LIB(srtp, srtp_profile_get_master_salt_length, AC_DEFINE(HAVE_SRTP_PROFILE_GET_MASTER_SALT_LENGTH, 1), AC_DEFINE(HAVE_SRTP_PROFILE_GET_MASTER_SALT_LENGTH, 0))
  346. ,
  347. AC_DEFINE_UNQUOTED(HAVE_SRTP, 0, HAVE_SRTP) [have_srtp=no]
  348. ))
  349. # if srtp not found and requested then, die.
  350. test $have_srtp:$want_srtp = no:yes &&
  351. AC_MSG_ERROR([You requested SRTP (requires libsrtp) but not found...die])
  352. fi
  353. AM_CONDITIONAL([USE_SRTP], [test $have_srtp = yes])
  354. ########################################################
  355. # SSL
  356. # --with-ssl / --without-ssl as argument to configure
  357. ########################################################
  358. have_ssl=no
  359. have_dtls_srtp=no
  360. have_dtls=no
  361. want_ssl=check
  362. path_ssl=undef
  363. AC_SUBST(LIBSSL_LIBADD, "")
  364. AC_ARG_WITH(ssl,
  365. [ --with-ssl=PATH Build with SSL (requires OpenSSL). PATH is optional.],
  366. if test "x$withval" = "xyes"; then
  367. want_ssl=yes
  368. path_ssl=undef
  369. elif test "x$withval" = "xno"; then
  370. want_ssl=no
  371. path_ssl=undef
  372. elif test "$withval"; then
  373. want_ssl=yes
  374. path_ssl=$withval
  375. fi,
  376. )
  377. # only if --without-ssl not used
  378. if test $want_ssl != no; then
  379. # check for lib and headers
  380. AC_CHECK_HEADERS(openssl/ssl.h,
  381. AC_CHECK_LIB(ssl, SSL_connect, AC_DEFINE_UNQUOTED(HAVE_OPENSSL, 1, HAVE_OPENSSL) [have_ssl=yes] LIBSSL_LIBADD="${LIBSSL_LIBADD} -lssl",
  382. AC_DEFINE_UNQUOTED(HAVE_OPENSSL, 0, HAVE_OPENSSL) [have_ssl=no], [-lcrypto]
  383. ))
  384. AC_CHECK_LIB(crypto, CRYPTO_new_ex_data,
  385. LIBSSL_LIBADD="${LIBSSL_LIBADD} -lcrypto"
  386. AC_CHECK_LIB(ssl, SSL_CTX_set_tlsext_use_srtp, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS_SRTP, 1, HAVE_OPENSSL_DTLS_SRTP) [have_dtls_srtp=yes],[],[-lcrypto])
  387. AC_CHECK_LIB(ssl, DTLSv1_method, AC_DEFINE_UNQUOTED(HAVE_OPENSSL_DTLS, 1, HAVE_OPENSSL_DTLS) [have_dtls=yes],[],[-lcrypto])
  388. )
  389. # if ssl not found and requested then, die.
  390. test $have_ssl:$want_ssl = no:yes &&
  391. AC_MSG_ERROR([You requested SSL (requires OpenSSL) but not found...die])
  392. fi
  393. AM_CONDITIONAL([USE_SSL], [test $have_ssl = yes])
  394. ########################################################
  395. # FFmpeg
  396. # --with-ffmpeg / --without-ffmpeg as argument to configure
  397. ########################################################
  398. have_ffmpeg=no
  399. want_ffmpeg=check
  400. path_ffmpeg=undef
  401. AC_SUBST(LIBFFMPEG_LIBADD, "")
  402. AC_ARG_WITH(ffmpeg,
  403. [ --with-ffmpeg=PATH Build with FFmpeg (h264, h263, theora, mp4v-es). PATH is optional.],
  404. if test "x$withval" = "xyes"; then
  405. want_ffmpeg=yes
  406. path_ffmpeg=undef
  407. elif test "x$withval" = "xno"; then
  408. want_ffmpeg=no
  409. path_ffmpeg=undef
  410. elif test "$withval"; then
  411. want_ffmpeg=yes
  412. path_ffmpeg=$withval
  413. fi,
  414. )
  415. # only if --without-opus not used
  416. if test $want_ffmpeg != no; then
  417. have_avutil=check
  418. AC_CHECK_HEADERS(libavutil/avutil.h,
  419. AC_CHECK_LIB(avutil, av_gettime, [have_avutil=yes] LIBFFMPEG_LIBADD="-lavutil ${LIBFFMPEG_LIBADD}", [have_avutil=no])
  420. )
  421. have_swscale=check
  422. AC_CHECK_HEADERS(libswscale/swscale.h,
  423. AC_CHECK_LIB(swscale, sws_scale, [have_swscale=yes] LIBFFMPEG_LIBADD="-lswscale ${LIBFFMPEG_LIBADD}", [have_swscale=no], [-lavutil])
  424. )
  425. have_avcodec=check
  426. AC_CHECK_HEADERS(libavcodec/avcodec.h,
  427. AC_CHECK_LIB(avcodec, avcodec_alloc_frame, [have_avcodec=yes] LIBFFMPEG_LIBADD="-lavcodec ${LIBFFMPEG_LIBADD}", [have_avcodec=no], [-lavutil])
  428. )
  429. test $have_avutil:$have_swscale:$have_avcodec = yes:yes:yes &&
  430. have_ffmpeg=yes && AC_DEFINE_UNQUOTED(HAVE_FFMPEG, 1, HAVE_FFMPEG)
  431. # if ffmpeg not found and requested then, die.
  432. test $have_ffmpeg:$want_ffmpeg = no:yes &&
  433. AC_MSG_ERROR([You requested FFmpeg (h264, h263, theora, mp4v-es) but not found...die])
  434. fi
  435. AM_CONDITIONAL([USE_FFMPEG], [test $have_ffmpeg = yes])
  436. ########################################################
  437. # X264
  438. ########################################################
  439. AM_CONDITIONAL(USE_X264, [test $target_os:$enable_gpl:$have_ffmpeg = android:yes:yes]) # X264 is always there for Android and statically linked
  440. AC_SUBST(LIBX264_LIBADD, "-lx264")
  441. AC_ARG_WITH(x264, [ --with-x264 IMPORTANT: deprecated to be removed ],[], [])
  442. ########################################################
  443. # OpenH264
  444. # --with-openh264 / --without-openh264 as argument to configure
  445. ########################################################
  446. have_openh264=no
  447. want_openh264=check
  448. path_openh264=undef
  449. AC_SUBST(LIBOPENH264_LIBADD, "")
  450. AC_ARG_WITH(openh264,
  451. [ --with-openh264=PATH Build with OpenH264 video codecs. PATH is optional.],
  452. if test "x$withval" = "xyes"; then
  453. want_openh264=yes
  454. path_openh264=undef
  455. elif test "x$withval" = "xno"; then
  456. want_openh264=no
  457. path_openh264=undef
  458. elif test "$withval"; then
  459. want_openh264=yes
  460. path_openh264=$withval
  461. fi,
  462. )
  463. # only if --without-openh264 not used
  464. if test $want_openh264 != no; then
  465. # check for lib and headers
  466. AC_LANG_PUSH([C++])
  467. AC_CHECK_HEADERS(wels/codec_api.h wels/codec_app_def.h,
  468. AC_CHECK_LIB(openh264, WelsCreateSVCEncoder,
  469. AC_CHECK_LIB(openh264, WelsCreateDecoder, AC_DEFINE_UNQUOTED(HAVE_OPENH264, 1, HAVE_OPENH264) [have_openh264=yes] LIBOPENH264_LIBADD="-lopenh264",
  470. AC_DEFINE_UNQUOTED(HAVE_OPENH264, 0, HAVE_OPENH264) [have_openh264=no]
  471. )))
  472. AC_LANG_POP([C++])
  473. # if opus not found and requested then, die.
  474. test $have_openh264:$want_openh264 = no:yes &&
  475. AC_MSG_ERROR([You requested OpenH264 video codec but not found...die])
  476. fi
  477. AM_CONDITIONAL([USE_OPENH264], [test $have_openh264 = yes])
  478. ########################################################
  479. # VPX (VP8, VP9)
  480. # --with-vpx / --without-vpx as argument to configure
  481. ########################################################
  482. have_vpx=no
  483. want_vpx=check
  484. path_vpx=undef
  485. AC_SUBST(LIBVPX_LIBADD, "")
  486. AC_ARG_WITH(vpx,
  487. [ --with-vpx=PATH Build with VPX(VP8, VP9) video codecs. PATH is optional.],
  488. if test "x$withval" = "xyes"; then
  489. want_vpx=yes
  490. path_vpx=undef
  491. elif test "x$withval" = "xno"; then
  492. want_vpx=no
  493. path_vpx=undef
  494. elif test "$withval"; then
  495. want_vpx=yes
  496. path_vpx=$withval
  497. fi,
  498. )
  499. # only if --without-vpx not used
  500. if test $want_vpx != no; then
  501. # check for lib and headers
  502. AC_CHECK_HEADERS(vpx/vpx_encoder.h vpx/vpx_decoder.h,
  503. AC_CHECK_LIB(vpx, vpx_codec_encode, AC_DEFINE_UNQUOTED(HAVE_LIBVPX, 1, HAVE_LIBVPX) [have_vpx=yes] LIBVPX_LIBADD="-lvpx",
  504. AC_DEFINE_UNQUOTED(HAVE_LIBVPX, 0, HAVE_LIBVPX) [have_vpx=no]
  505. ))
  506. # if opus not found and requested then, die.
  507. test $have_vpx:$want_vpx = no:yes &&
  508. AC_MSG_ERROR([You requested VPX(VP8, VP9) video codecs but not found...die])
  509. fi
  510. AM_CONDITIONAL([USE_VPX], [test $have_vpx = yes])
  511. ########################################################
  512. # YUV
  513. # --with-yuv / --without-yuv as argument to configure
  514. ########################################################
  515. have_yuv=no
  516. want_yuv=check
  517. path_yuv=undef
  518. AC_SUBST(LIBYUV_LIBADD, "")
  519. AC_SUBST(LIBYUV_INCLUDE, "")
  520. AC_SUBST(LIBYUV_LIB, "")
  521. AC_ARG_WITH(yuv,
  522. [ --with-yuv=PATH Build with LIBYUV. PATH is optional.],
  523. if test "x$withval" = "xyes"; then
  524. want_yuv=yes
  525. path_yuv=undef
  526. elif test "x$withval" = "xno"; then
  527. want_yuv=no
  528. path_yuv=undef
  529. elif test "$withval"; then
  530. want_yuv=yes
  531. path_yuv=$withval
  532. fi,
  533. )
  534. # only if --without-yuv not used
  535. if test $want_yuv != no; then
  536. if test "x$path_yuv" = xundef; then
  537. if test "$target_os" != "android"; then
  538. LIBYUV_INCLUDE="-I/usr/local/include -I/usr/local/include/libyuv"
  539. LIBYUV_LIB="-L/usr/local/lib"
  540. fi
  541. else
  542. LIBYUV_INCLUDE="-I${path_yuv}/include -I${path_yuv}/include/libyuv"
  543. LIBYUV_LIB="-L${path_yuv}/lib"
  544. fi
  545. AC_LANG_PUSH([C++])
  546. CFLAGS_SAVED=$CFLAGS
  547. CPPFLAGS_SAVED=$CPPFLAGS
  548. CFLAGS="${CFLAGS} ${LIBYUV_INCLUDE}"
  549. CPPFLAGS="${CPPFLAGS} ${LIBYUV_INCLUDE}"
  550. # check for lib and headers
  551. AC_CHECK_HEADERS(libyuv/libyuv.h,
  552. AC_CHECK_LIB(yuv, I420Scale, AC_DEFINE_UNQUOTED(HAVE_LIBYUV, 1, HAVE_LIBYUV) [have_yuv=yes] AC_SUBST(LIBYUV_LIBADD, "-lyuv"),
  553. AC_DEFINE_UNQUOTED(HAVE_LIBYUV, 0, HAVE_LIBYUV) [have_yuv=no]
  554. ))
  555. test $have_yuv = yes && LIBYUV_LIB="${LIBYUV_LIB}"
  556. # if opus not found and requested then, die.
  557. test $have_yuv:$want_yuv = no:yes &&
  558. AC_MSG_ERROR([You requested LIBYUV but not found...die])
  559. CFLAGS=$CFLAGS_SAVED
  560. CPPFLAGS=$CPPFLAGS_SAVED
  561. AC_LANG_POP([C++])
  562. fi
  563. AM_CONDITIONAL([USE_YUV], [test $have_yuv = yes])
  564. ########################################################
  565. # JPEG
  566. # --with-jpeg / --without-jpeg as argument to configure
  567. ########################################################
  568. have_jpeg=no
  569. want_jpeg=check
  570. path_jpeg=undef
  571. AC_SUBST(LIBJPEG_LIBADD, "")
  572. AC_ARG_WITH(jpeg,
  573. [ --with-jpeg=PATH Build with JPEG compression (requires libjpeg[-turbo] library). PATH is optional.],
  574. if test "x$withval" = "xyes"; then
  575. want_jpeg=yes
  576. path_jpeg=undef
  577. elif test "x$withval" = "xno"; then
  578. want_jpeg=no
  579. path_jpeg=undef
  580. elif test "$withval"; then
  581. want_jpeg=yes
  582. path_jpeg=$withval
  583. fi,
  584. )
  585. # only if --without-jpeg not used
  586. if test $want_jpeg != no; then
  587. # check for lib and headers
  588. AC_CHECK_HEADERS(jpeglib.h jerror.h,
  589. AC_CHECK_LIB(jpeg, jpeg_CreateDecompress, [have_jpeg=yes] LIBJPEG_LIBADD="-ljpeg", [have_jpeg=no]
  590. ))
  591. # if jpeg not found and requested then, die.
  592. test $have_jpeg:$want_jpeg = no:yes &&
  593. AC_MSG_ERROR([You requested JPEG library but not found...die])
  594. # define HAVE_LIBJPEG 1
  595. test $have_jpeg:$enable_nonfree = yes:yes &&
  596. AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, HAVE_LIBJPEG)
  597. fi
  598. AM_CONDITIONAL([USE_JPEG], [test $have_jpeg:$enable_nonfree = yes:yes])
  599. ########################################################
  600. # AMR
  601. # --with-amr / --without-amr as argument to configure
  602. ########################################################
  603. have_amr=no
  604. want_amr=check
  605. path_amr=undef
  606. AC_SUBST(LIBAMR_LIBADD, "")
  607. AC_ARG_WITH(amr,
  608. [ --with-amr=PATH Build with AMR audio codec (requires opencore-amr library). PATH is optional.],
  609. if test "x$withval" = "xyes"; then
  610. want_amr=yes
  611. path_amr=undef
  612. elif test "x$withval" = "xno"; then
  613. want_amr=no
  614. path_amr=undef
  615. elif test "$withval"; then
  616. want_amr=yes
  617. path_amr=$withval
  618. fi,
  619. )
  620. # only if --without-amr not used
  621. if test $want_amr != no; then
  622. # check for lib and headers
  623. AC_CHECK_HEADERS(opencore-amrnb/interf_dec.h opencore-amrnb/interf_enc.h,
  624. AC_CHECK_LIB(opencore-amrnb, Encoder_Interface_init, [have_amr=yes] LIBAMR_LIBADD="-lopencore-amrnb", [have_amr=no]
  625. ))
  626. # if amr not found and requested then, die.
  627. test $have_amr:$want_amr = no:yes &&
  628. AC_MSG_ERROR([You requested AMR audio codec but not found...die])
  629. # define HAVE_OPENCORE_AMR 1
  630. test $have_amr:$enable_nonfree = yes:yes &&
  631. AC_DEFINE_UNQUOTED(HAVE_OPENCORE_AMR, 1, HAVE_OPENCORE_AMR)
  632. fi
  633. AM_CONDITIONAL([USE_AMR], [test $have_amr:$enable_nonfree = yes:yes])
  634. ########################################################
  635. # OPUS
  636. # --with-opus / --without-opus as argument to configure
  637. ########################################################
  638. have_opus=no
  639. want_opus=check
  640. path_opus=undef
  641. AC_SUBST(LIBOPUS_LIBADD, "")
  642. AC_ARG_WITH(opus,
  643. [ --with-opus=PATH Build with OPUS audio codec. PATH is optional.],
  644. if test "x$withval" = "xyes"; then
  645. want_opus=yes
  646. path_opus=undef
  647. elif test "x$withval" = "xno"; then
  648. want_opus=no
  649. path_opus=undef
  650. elif test "$withval"; then
  651. want_opus=yes
  652. path_opus=$withval
  653. fi,
  654. )
  655. # only if --without-opus not used
  656. if test $want_opus != no; then
  657. # check for lib and headers
  658. AC_CHECK_HEADERS(opus/opus.h,
  659. AC_CHECK_LIB(opus, opus_decoder_create, AC_DEFINE_UNQUOTED(HAVE_LIBOPUS, 1, HAVE_LIBOPUS) [have_opus=yes] LIBOPUS_LIBADD="-lopus",
  660. AC_DEFINE_UNQUOTED(HAVE_LIBOPUS, 0, HAVE_LIBOPUS) [have_opus=no]
  661. ))
  662. # if opus not found and requested then, die.
  663. test $have_opus:$want_opus = no:yes &&
  664. AC_MSG_ERROR([You requested OPUS audio codec but not found...die])
  665. fi
  666. AM_CONDITIONAL([USE_OPUS], [test $have_opus = yes])
  667. ########################################################
  668. # SPEEX
  669. # --with-speex / --without-speex as argument to configure
  670. ########################################################
  671. have_speex=no
  672. want_speex=check
  673. path_speex=undef
  674. AC_SUBST(LIBSPEEX_LIBADD, "")
  675. AC_ARG_WITH(speex,
  676. [ --with-speex=PATH Build with SPEEX audio codec. PATH is optional.],
  677. if test "x$withval" = "xyes"; then
  678. want_speex=yes
  679. path_speex=undef
  680. elif test "x$withval" = "xno"; then
  681. want_speex=no
  682. path_speex=undef
  683. elif test "$withval"; then
  684. want_speex=yes
  685. path_speex=$withval
  686. fi,
  687. )
  688. # only if --without-speex not used
  689. if test $want_speex != no; then
  690. # check lib and headers
  691. AC_CHECK_HEADERS(speex/speex.h,
  692. AC_CHECK_LIB(speex, speex_decode_int, AC_DEFINE_UNQUOTED(HAVE_LIB_SPEEX, 1, HAVE_LIB_SPEEX) [have_speex=yes] LIBSPEEX_LIBADD="-lspeex",
  693. AC_DEFINE_UNQUOTED(HAVE_LIB_SPEEX, 0, HAVE_LIB_SPEEX) [have_speex=no]
  694. ))
  695. # if speex not found and requested then, die.
  696. test $have_speex:$want_speex = no:yes &&
  697. AC_MSG_ERROR([You requested SPEEX audio codec but not found...die])
  698. fi
  699. AM_CONDITIONAL([USE_SPEEX], [test $have_speex = yes])
  700. ########################################################
  701. # SPEEXDSP
  702. # --with-speexdsp / --without-speexdsp as argument to configure
  703. ########################################################
  704. have_speexdsp=no
  705. want_speexdsp=check
  706. path_speexdsp=undef
  707. AC_SUBST(LIBSPEEXDSP_LIBADD, "")
  708. AC_ARG_WITH(speexdsp,
  709. [ --with-speexdsp=PATH Build with SPEEX DSP (audio resampler, jitter buffer...). PATH is optional.],
  710. if test "x$withval" = "xyes"; then
  711. want_speexdsp=yes
  712. path_speexdsp=undef
  713. elif test "x$withval" = "xno"; then
  714. want_speexdsp=no
  715. path_speexdsp=undef
  716. elif test "$withval"; then
  717. want_speexdsp=yes
  718. path_speexdsp=$withval
  719. fi,
  720. )
  721. # only if --without-speexdsp not used
  722. if test $want_speexdsp != no; then
  723. # check main lib
  724. AC_CHECK_HEADERS(speex/speex_preprocess.h,
  725. AC_CHECK_LIB(speexdsp, speex_preprocess_state_init, AC_DEFINE_UNQUOTED(HAVE_SPEEX_DSP, 1, HAVE_SPEEX_DSP) [have_speexdsp=yes] LIBSPEEXDSP_LIBADD="-lspeexdsp",
  726. AC_DEFINE_UNQUOTED(HAVE_SPEEX_DSP, 0, HAVE_SPEEX_DSP) [have_speexdsp=no])
  727. )
  728. # check for jitter buffer
  729. AC_CHECK_HEADERS(speex/speex_jitter.h,
  730. AC_CHECK_LIB(speexdsp, jitter_buffer_init, AC_DEFINE_UNQUOTED(HAVE_SPEEX_JB, 1, HAVE_SPEEX_JB),
  731. AC_DEFINE_UNQUOTED(HAVE_SPEEX_JB, 0, HAVE_SPEEX_JB))
  732. )
  733. # check for resampler
  734. AC_CHECK_HEADERS(speex/speex_resampler.h,
  735. AC_CHECK_LIB(speexdsp, speex_resampler_init, AC_DEFINE_UNQUOTED(HAVE_SPEEX_RESAMPLER, 1, HAVE_SPEEX_RESAMPLER),
  736. AC_DEFINE_UNQUOTED(HAVE_SPEEX_RESAMPLER, 0, HAVE_SPEEX_RESAMPLER))
  737. )
  738. # check for denoiser and echo canceler
  739. AC_CHECK_HEADERS(speex/speex_echo.h,
  740. AC_CHECK_LIB(speexdsp, speex_echo_playback, AC_DEFINE_UNQUOTED(HAVE_SPEEX_DENOISE, 1, HAVE_SPEEX_DENOISE),
  741. AC_DEFINE_UNQUOTED(HAVE_SPEEX_DENOISE, 0, HAVE_SPEEX_DENOISE))
  742. )
  743. # if speex not found and requested then, die.
  744. test $have_speexdsp:$want_speexdsp = no:yes &&
  745. AC_MSG_ERROR([You requested SPEEX DSP but not found...die])
  746. fi
  747. AM_CONDITIONAL([USE_SPEEXDSP], [test $have_speexdsp = yes])
  748. # Deprecated options: to be removed
  749. AC_ARG_ENABLE(speexresampler, [ --enable-speexresampler IMPORTANT: deprecated to be removed], , )
  750. AC_ARG_ENABLE(speexdenoiser, [ --enable-speexdenoiser IMPORTANT: deprecated to be removed], , )
  751. AC_ARG_ENABLE(speexjb, [ --enable-speexjb IMPORTANT: deprecated to be removed], , )
  752. ########################################################
  753. # GSM
  754. # --with-gsm / --without-gsm as argument to configure
  755. ########################################################
  756. have_gsm=no
  757. want_gsm=check
  758. path_gsm=undef
  759. AC_SUBST(LIBGSM_LIBADD, "")
  760. AC_ARG_WITH(gsm,
  761. [ --with-gsm=PATH Build with GSM audio codec. PATH is optional.],
  762. if test "x$withval" = "xyes"; then
  763. want_gsm=yes
  764. path_gsm=undef
  765. elif test "x$withval" = "xno"; then
  766. want_gsm=no
  767. path_gsm=undef
  768. elif test "$withval"; then
  769. want_gsm=yes
  770. path_gsm=$withval
  771. fi,
  772. )
  773. # only if --without-gsm not used
  774. if test $want_gsm != no; then
  775. # check lib and headers
  776. AC_CHECK_HEADERS(gsm.h,
  777. AC_CHECK_LIB(gsm, gsm_create, AC_DEFINE_UNQUOTED(HAVE_LIBGSM, 1, HAVE_LIBGSM) [have_gsm=yes] LIBGSM_LIBADD="-lgsm",
  778. AC_DEFINE_UNQUOTED(HAVE_LIBGSM, 0, HAVE_LIBGSM) [have_gsm=no]
  779. ))
  780. # if gsm not found and requested then, die.
  781. test $have_gsm:$want_gsm = no:yes &&
  782. AC_MSG_ERROR([You requested GSM audio codec but not found...die])
  783. fi
  784. AM_CONDITIONAL([USE_GSM], [test $have_gsm = yes])
  785. ########################################################
  786. # G729
  787. # --with-g729 / --without-g729 as argument to configure
  788. ########################################################
  789. have_g729=no
  790. want_g729=check
  791. path_g729=undef
  792. AC_SUBST(LIBG729_LIBADD, "")
  793. AC_ARG_WITH(g729,
  794. [ --with-g729=PATH Build with G.729 audio codec. PATH is optional.],
  795. if test "x$withval" = "xyes"; then
  796. want_g729=yes
  797. path_g729=undef
  798. elif test "x$withval" = "xno"; then
  799. want_g729=no
  800. path_g729=undef
  801. elif test "$withval"; then
  802. want_g729=yes
  803. path_g729=$withval
  804. fi,
  805. )
  806. # only if --without-g729 not used
  807. if test $want_g729 != no; then
  808. # check lib and headers
  809. AC_CHECK_HEADERS(g729b/typedef.h g729b/ld8a.h,
  810. AC_CHECK_LIB(g729b, Init_Decod_ld8a, [have_g729=yes] LIBG729_LIBADD="-lg729b",
  811. [have_g729=no]), [],
  812. [[#ifdef HAVE_G729B_TYPEDEF_H
  813. # include <g729b/typedef.h>
  814. #endif
  815. ]])
  816. # if g729 not found and requested then, die.
  817. test $have_g729:$want_g729 = no:yes &&
  818. AC_MSG_ERROR([You requested G729 audio codec but not found...die])
  819. #define HAVE_G729 1
  820. test $have_g729:$enable_nonfree = yes:yes &&
  821. AC_DEFINE_UNQUOTED(HAVE_G729, 1, HAVE_G729)
  822. fi
  823. AM_CONDITIONAL([USE_G729], [test $have_g729:$enable_nonfree = yes:yes])
  824. ########################################################
  825. # ILBC
  826. # --with-ilbc / --without-ilbc as argument to configure
  827. ########################################################
  828. have_ilbc=no
  829. want_ilbc=check
  830. path_ilbc=undef
  831. AC_SUBST(LIBILBC_LIBADD, "")
  832. AC_ARG_WITH(ilbc,
  833. [ --with-ilbc=PATH Build with ILBC audio codec. PATH is optional.],
  834. if test "x$withval" = "xyes"; then
  835. want_ilbc=yes
  836. path_ilbc=undef
  837. elif test "x$withval" = "xno"; then
  838. want_ilbc=no
  839. path_ilbc=undef
  840. elif test "$withval"; then
  841. want_ilbc=yes
  842. path_ilbc=$withval
  843. fi,
  844. )
  845. # only if --without-ilbc not used
  846. if test $want_ilbc != no; then
  847. # check lib and headers
  848. AC_CHECK_HEADERS(ilbc/iLBC_define.h ilbc/iLBC_encode.h ilbc/iLBC_decode.h,
  849. AC_CHECK_LIB(iLBC, initDecode, AC_DEFINE_UNQUOTED(HAVE_ILBC, 1, HAVE_ILBC) [have_ilbc=yes] LIBILBC_LIBADD="-liLBC",
  850. AC_DEFINE_UNQUOTED(HAVE_ILBC, 0, HAVE_ILBC) [have_ilbc=no], [-lm]
  851. ))
  852. # if gsm not found and requested then, die.
  853. test $have_ilbc:$want_ilbc = no:yes &&
  854. AC_MSG_ERROR([You requested ILBC audio codec but not found...die])
  855. fi
  856. AM_CONDITIONAL([USE_ILBC], [test $have_ilbc = yes])
  857. ########################################################
  858. # WEBRTC
  859. # --with-webrtc / --without-webrtc as argument to configure
  860. ########################################################
  861. have_webrtc=no
  862. want_webrtc=check
  863. path_webrtc=undef
  864. AC_SUBST(LIBWEBRTC_LIBADD, "")
  865. AC_ARG_WITH(webrtc,
  866. [ --with-webrtc=PATH Build with WebRTC audio processing features (AEC, VAD, Noise supp...). PATH is optional.],
  867. if test "x$withval" = "xyes"; then
  868. want_webrtc=yes
  869. path_webrtc=undef
  870. elif test "x$withval" = "xno"; then
  871. want_webrtc=no
  872. path_webrtc=undef
  873. elif test "$withval"; then
  874. want_webrtc=yes
  875. path_webrtc=$withval
  876. fi,
  877. )
  878. # only if --without-webrtc not used
  879. if test $want_webrtc != no; then
  880. # WebRTC AEC
  881. have_webrtc_aec=no
  882. if test "$target_os" = "android"; then
  883. AC_CHECK_HEADERS(webrtc/echo_control_mobile.h,
  884. AC_CHECK_LIB(audio_processing, WebRtcAecm_Create, [have_webrtc_aec=yes], [], [-lsystem_wrappers -lcommon_audio])
  885. )
  886. else
  887. AC_CHECK_HEADERS(webrtc/echo_cancellation.h,
  888. AC_CHECK_LIB(audio_processing, WebRtcAec_Create, [have_webrtc_aec=yes], [], [-lsystem_wrappers -lcommon_audio])
  889. )
  890. fi
  891. # WebRTC NS
  892. have_webrtc_ns=no
  893. if test "$target_os" = "android"; then
  894. AC_CHECK_HEADERS(webrtc/noise_suppression_x.h,
  895. AC_CHECK_LIB(audio_processing, WebRtcNsx_Process, [have_webrtc_ns=yes] [], [], [-lsystem_wrappers -lcommon_audio])
  896. )
  897. else
  898. AC_CHECK_HEADERS(webrtc/noise_suppression.h,
  899. AC_CHECK_LIB(audio_processing, WebRtcNs_Process, [have_webrtc_ns=yes] [], [], [-lsystem_wrappers -lcommon_audio])
  900. )
  901. fi
  902. if test $have_webrtc_aec:$have_webrtc_ns = yes:yes; then
  903. have_webrtc=yes
  904. AC_DEFINE_UNQUOTED(HAVE_WEBRTC, 1, HAVE_WEBRTC)
  905. AC_DEFINE_UNQUOTED(HAVE_WEBRTC_DENOISE, 1, HAVE_WEBRTC_DENOISE)
  906. LIBWEBRTC_LIBADD="-laudio_processing -lcommon_audio -lsystem_wrappers"
  907. fi
  908. test $have_webrtc:$want_webrtc = no:yes &&
  909. AC_MSG_ERROR([You requested WebRTC (audio processing features) but not found...die])
  910. fi
  911. AM_CONDITIONAL([USE_WEBRTC], [test $have_webrtc = yes])
  912. AC_CONFIG_FILES(
  913. Makefile
  914. doubango.pc
  915. tinySAK/Makefile
  916. tinySAK/tinySAK.pc
  917. tinyNET/Makefile
  918. tinyNET/tinyNET.pc
  919. tinyHTTP/Makefile
  920. tinyHTTP/tinyHTTP.pc
  921. tinyXCAP/Makefile
  922. tinyXCAP/tinyXCAP.pc
  923. tinyIPSec/Makefile
  924. tinyIPSec/tinyIPSec.pc
  925. tinySMS/Makefile
  926. tinySMS/tinySMS.pc
  927. tinySIGCOMP/Makefile
  928. tinySIGCOMP/tinySIGCOMP.pc
  929. tinySDP/Makefile
  930. tinySDP/tinySDP.pc
  931. tinyBFCP/Makefile
  932. tinyBFCP/tinyBFCP.pc
  933. tinyRTP/Makefile
  934. tinyRTP/tinyRTP.pc
  935. tinyMSRP/Makefile
  936. tinyMSRP/tinyMSRP.pc
  937. tinyMEDIA/Makefile
  938. tinyMEDIA/tinyMEDIA.pc
  939. tinyDAV/Makefile
  940. tinyDAV/tinyDAV.pc
  941. tinySIP/Makefile
  942. tinySIP/tinySIP.pc
  943. bindings/Makefile
  944. bindings/tinyWRAP.pc
  945. plugins/audio_opensles/Makefile
  946. plugins/audio_opensles/plugin_audio_opensles.pc
  947. )
  948. AC_OUTPUT
  949. AC_MSG_NOTICE([
  950. **************************************************************************
  951. * CONGRATULATIONS
  952. **************************************************************************
  953. Cross Compilation: ${cross_compiling}
  954. Target OS: ${target_os}
  955. Host setup: ${host}
  956. Install prefix: ${prefix}
  957. Compiler: ${CC}
  958. Build Type: ${build_type}
  959. Enable GPL: $enable_gpl
  960. Enable Non Free: $enable_nonfree
  961. FFmpeg: $have_ffmpeg
  962. VP8 video codec: $have_vpx
  963. OpenH264 video codec: $have_openh264
  964. OPUS audio codec: $have_opus
  965. ILBC audio codec: $have_ilbc
  966. G.729 audio codec: $have_g729 -> $enable_nonfree
  967. GSM audio codec: $have_gsm
  968. AMR audio codec: $have_amr -> $enable_nonfree
  969. SPEEX audio codec: $have_speex
  970. G.722 audio codec: yes
  971. G.711 audio codec: yes
  972. YUV: $have_yuv
  973. JPEG: $have_jpeg
  974. SPEEX DSP: $have_speexdsp
  975. SSL: $have_ssl
  976. DTLS-SRTP: $have_dtls_srtp
  977. DTLS: $have_dtls
  978. SRTP: $have_srtp
  979. WebRTC: Enabled($have_webrtc): AEC($have_webrtc_aec), NS($have_webrtc_ns)
  980. Monotonic timers: $have_rt
  981. RESOLV: $have_resolv
  982. ALSA (audio): $have_alsa
  983. OSS (audio): $have_oss
  984. V4L2 (video): $have_v4l2
  985. DEBUG: $enable_debug
  986. DEBUG_LEVEL: $debug_level
  987. Report any issue at https://groups.google.com/group/doubango
  988. ])
  989. if test "$target_os" = "android"; then
  990. AC_MSG_NOTICE([
  991. --------------------------------------------------------------------------
  992. - ANDRDOID
  993. --------------------------------------------------------------------------
  994. CPU: ${android_cpu}
  995. ])
  996. fi