aconfigure.ac 85 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716
  1. AC_INIT([pjproject],[2.x])
  2. host_orig="$host"
  3. AC_CANONICAL_BUILD
  4. AC_CANONICAL_HOST
  5. AC_CANONICAL_TARGET
  6. AC_CONFIG_HEADERS([pjlib/include/pj/compat/os_auto.h
  7. pjlib/include/pj/compat/m_auto.h
  8. pjmedia/include/pjmedia/config_auto.h
  9. pjmedia/include/pjmedia-codec/config_auto.h
  10. pjsip/include/pjsip/sip_autoconf.h
  11. ])
  12. AC_CONFIG_FILES([build.mak
  13. build/os-auto.mak
  14. build/cc-auto.mak
  15. pjlib/build/os-auto.mak
  16. pjlib-util/build/os-auto.mak
  17. pjmedia/build/os-auto.mak
  18. pjsip/build/os-auto.mak
  19. third_party/build/os-auto.mak
  20. ])
  21. dnl
  22. dnl Setup default CFLAGS
  23. dnl
  24. if test "$CFLAGS" = ""; then
  25. CFLAGS="-O2"
  26. fi
  27. dnl #
  28. dnl # Configure tools
  29. dnl #
  30. AC_PROG_CC
  31. AC_PROG_CXX
  32. AC_LANG([C])
  33. dnl Make sure C++ compiler works
  34. AC_LANG_PUSH([C++])
  35. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[AC_MSG_ERROR(C++ compiler does not work)])
  36. AC_LANG_POP([C++])
  37. AC_PROG_RANLIB
  38. AC_CHECK_TOOLS([AR], [ar gar], :)
  39. if test "$AR_FLAGS" = ""; then AR_FLAGS="rv"; fi
  40. AC_SUBST(AR_FLAGS)
  41. if test "$LD" = ""; then LD="$CXX"; fi
  42. AC_SUBST(LD)
  43. if test "$LDOUT" = ""; then LDOUT="-o "; fi
  44. AC_SUBST(LDOUT)
  45. if test "$OBJEXT" = ""; then OBJEXT='o'; fi
  46. AC_SUBST(OBJEXT)
  47. if test "$LIBEXT" = ""; then LIBEXT='a'; fi
  48. AC_SUBST(LIBEXT)
  49. if test "$LIBEXT2" = ""; then LIBEXT2=""; fi
  50. AC_SUBST(LIBEXT2)
  51. if test "$CC_OUT" = ""; then CC_OUT="-c -o "; fi
  52. AC_SUBST(CC_OUT)
  53. if test "$CC_INC" = ""; then CC_INC="-I"; fi
  54. AC_SUBST(CC_INC)
  55. if test "$CC_DEF" = ""; then CC_DEF="-D"; fi
  56. AC_SUBST(CC_DEF)
  57. if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi
  58. AC_SUBST(CC_OPTIMIZE)
  59. if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
  60. AC_SUBST(CC_CFLAGS)
  61. AC_SUBST(ac_pjdir)
  62. AC_SUBST(ac_build_mak_vars)
  63. AC_SUBST(ac_cflags)
  64. case $host in
  65. *mingw* | *cygw* | *win32* | *w32* )
  66. if pwd -W 2&> /dev/null; then
  67. ac_pjdir=`pwd -W`
  68. else
  69. # We're probably cross-compiling mingw on Linux
  70. ac_pjdir=`pwd`
  71. fi
  72. ;;
  73. *)
  74. ac_pjdir=`pwd`
  75. ;;
  76. esac
  77. AC_SUBST(ac_shlib_suffix)
  78. case $target in
  79. *mingw* | *cygw* | *win32* | *w32* )
  80. ac_shlib_suffix=dll
  81. ;;
  82. *darwin*)
  83. ac_shlib_suffix=dylib
  84. ;;
  85. *)
  86. ac_shlib_suffix=so
  87. ;;
  88. esac
  89. AC_SUBST(ac_cross_compile)
  90. if test "$build" = "$host"; then
  91. ac_cross_compile=
  92. else
  93. ac_cross_compile=${host_orig}-
  94. fi
  95. AC_CHECK_LIB(pthread,pthread_create)
  96. AC_CHECK_LIB(wsock32,puts)
  97. AC_CHECK_LIB(ws2_32,puts)
  98. AC_CHECK_LIB(ole32,puts)
  99. AC_CHECK_LIB(winmm,puts)
  100. AC_CHECK_LIB(socket,puts)
  101. AC_CHECK_LIB(rt,puts)
  102. AC_CHECK_LIB(m,sin)
  103. dnl
  104. dnl libuuid
  105. dnl
  106. AC_ARG_ENABLE(libuuid,
  107. AS_HELP_STRING([--disable-libuuid],
  108. [Exclude libuuid(default: autodetect)]),
  109. [if test "$enable_libuuid" = "no"; then
  110. AC_MSG_RESULT([Checking if libuuid disabled... yes])
  111. ac_has_uuid_lib=0
  112. fi],
  113. [
  114. AC_CHECK_LIB(uuid,uuid_generate)
  115. AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
  116. ])
  117. AC_SEARCH_LIBS(gethostbyname,nsl)
  118. AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
  119. AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
  120. dnl
  121. dnl Memory alignment detection
  122. dnl
  123. AC_MSG_CHECKING([memory alignment])
  124. case $target in
  125. sparc64-* | ia64-* | x86_64-* | arm64-* | aarch64-* | mips64* )
  126. AC_DEFINE(PJ_POOL_ALIGNMENT, 8)
  127. AC_MSG_RESULT([8 bytes])
  128. ;;
  129. * )
  130. AC_DEFINE(PJ_POOL_ALIGNMENT, 4)
  131. AC_MSG_RESULT([4 bytes (default)])
  132. ;;
  133. esac
  134. dnl
  135. dnl Endianness detection
  136. dnl
  137. AC_C_BIGENDIAN
  138. if test "x$ac_cv_c_bigendian" = "xyes"; then
  139. CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
  140. ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
  141. else
  142. CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
  143. ac_cflags="$ac_cflags -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
  144. fi
  145. dnl
  146. dnl Legacy macros
  147. dnl
  148. AC_SUBST(ac_target_arch)
  149. AC_SUBST(ac_std_cpp_lib)
  150. case $target in
  151. *android*)
  152. AC_DEFINE(PJ_ANDROID,1)
  153. ac_target_arch=$TARGET_ABI
  154. ac_std_cpp_lib=$STD_CPP_LIB
  155. ;;
  156. *mingw* | *cygw* | *win32* | *w32* )
  157. AC_DEFINE(PJ_WIN32,1)
  158. AC_DEFINE(PJ_WIN32_WINNT,0x0400)
  159. AC_DEFINE(WIN32_LEAN_AND_MEAN)
  160. case $target in
  161. *_64-w64-mingw* )
  162. AC_DEFINE(PJ_WIN64,1)
  163. ;;
  164. esac
  165. ;;
  166. *darwin*)
  167. AC_DEFINE(PJ_DARWINOS,1)
  168. ac_target_arch=$ARCH_VAL
  169. ;;
  170. *linux*)
  171. AC_DEFINE(PJ_LINUX,1)
  172. ;;
  173. *bsd*)
  174. AC_DEFINE(PJ_BSD,1)
  175. ;;
  176. *rtems*)
  177. AC_DEFINE(PJ_RTEMS,1)
  178. ;;
  179. *sunos* | *solaris* )
  180. AC_DEFINE(PJ_SUNOS,1)
  181. ;;
  182. *)
  183. ;;
  184. esac
  185. dnl # --disable-floating-point option
  186. AC_ARG_ENABLE(floating-point,
  187. AS_HELP_STRING([--disable-floating-point],
  188. [Disable floating point where possible]),
  189. [if test "$enable_floating_point" = "no"; then
  190. AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
  191. AC_MSG_RESULT([Checking if floating point is disabled... yes])
  192. fi],
  193. [
  194. AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
  195. AC_MSG_RESULT([Checking if floating point is disabled... no])
  196. ])
  197. AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
  198. AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
  199. AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
  200. case $target in
  201. *mingw* | *cygw* | *win32* | *w32* )
  202. AC_DEFINE(PJ_HAS_ERRNO_H,0)
  203. ;;
  204. *)
  205. AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
  206. ;;
  207. esac
  208. AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)])
  209. AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
  210. AC_CHECK_HEADER(limits.h,[AC_DEFINE(PJ_HAS_LIMITS_H,1)])
  211. AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
  212. AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
  213. AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
  214. AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
  215. AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
  216. [#if PJ_HAS_SYS_TYPES_H
  217. # include <sys/types.h>
  218. #endif
  219. #if PJ_HAS_NETINET_IN_SYSTM_H
  220. # include <netinet/in_systm.h>
  221. #endif
  222. #if PJ_HAS_NETINET_IN_H
  223. # include <netinet/in.h>
  224. #endif
  225. ])
  226. AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
  227. AC_CHECK_HEADER(ifaddrs.h,
  228. [AC_CHECK_FUNC(getifaddrs,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])])
  229. AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)])
  230. AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
  231. AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
  232. AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
  233. AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
  234. AC_CHECK_HEADER(stdint.h,[AC_DEFINE(PJ_HAS_STDINT_H,1)])
  235. AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
  236. AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
  237. AC_CHECK_HEADER(inttypes.h,[AC_DEFINE(PJ_HAS_INTTYPES_H,1)])
  238. AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
  239. AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
  240. AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
  241. AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
  242. AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
  243. AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
  244. AC_CHECK_HEADER(sys/filio.h,[AC_DEFINE(PJ_HAS_SYS_FILIO_H,1)])
  245. AC_CHECK_HEADER(sys/sockio.h,[AC_DEFINE(PJ_HAS_SYS_SOCKIO_H,1)])
  246. AC_CHECK_HEADER(sys/utsname.h,[AC_DEFINE(PJ_HAS_SYS_UTSNAME_H,1)])
  247. AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
  248. AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
  249. AC_CHECK_HEADER(execinfo.h,[AC_DEFINE(PJ_HAS_EXECINFO_H,1)])
  250. AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
  251. AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
  252. AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
  253. [#if PJ_HAS_WINSOCK2_H
  254. # include <winsock2.h>
  255. #elif PJ_HAS_WINSOCK_H
  256. # include <winsock.h>
  257. #endif
  258. ])
  259. AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
  260. AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
  261. AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
  262. [#if PJ_HAS_SYS_TYPES_H
  263. # include <sys/types.h>
  264. #endif
  265. #if PJ_HAS_SYS_SOCKET_H
  266. # include <sys/socket.h>
  267. #endif
  268. ])
  269. case $target in
  270. *android*)
  271. AC_CHECK_HEADER(linux/android_alarm.h,[AC_DEFINE(PJ_HAS_ANDROID_ALARM_H,1)])
  272. ;;
  273. esac
  274. AC_CHECK_FUNC(localtime_r,[AC_DEFINE(PJ_HAS_LOCALTIME_R,1)])
  275. AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
  276. AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
  277. AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
  278. AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
  279. AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
  280. AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
  281. AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
  282. AC_DEFINE(PJ_HAS_MALLOC,1)
  283. AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
  284. AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
  285. AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
  286. AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
  287. dnl # Determine if inet_aton() is available
  288. AC_MSG_CHECKING([if inet_aton() is available])
  289. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  290. #include <sys/socket.h>
  291. #include <arpa/inet.h>]],
  292. [inet_aton(0, 0);])],
  293. [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
  294. AC_MSG_RESULT(yes)],
  295. [AC_MSG_RESULT(no)])
  296. dnl # Determine if inet_pton() is available
  297. AC_MSG_CHECKING([if inet_pton() is available])
  298. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  299. #include <sys/socket.h>
  300. #include <arpa/inet.h>]],
  301. [inet_pton(0, 0, 0);])],
  302. [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
  303. AC_MSG_RESULT(yes)],
  304. [AC_MSG_RESULT(no)])
  305. dnl # Determine if inet_ntop() is available
  306. AC_MSG_CHECKING([if inet_ntop() is available])
  307. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  308. #include <sys/socket.h>
  309. #include <arpa/inet.h>]],
  310. [inet_ntop(0, 0, 0, 0);])],
  311. [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
  312. AC_MSG_RESULT(yes)],
  313. [AC_MSG_RESULT(no)])
  314. dnl # Determine if getaddrinfo() is available
  315. AC_MSG_CHECKING([if getaddrinfo() is available])
  316. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  317. #include <sys/socket.h>
  318. #include <netdb.h>]],
  319. [getaddrinfo(0, 0, 0, 0);])],
  320. [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
  321. AC_MSG_RESULT(yes)],
  322. [AC_MSG_RESULT(no)])
  323. dnl # Determine if socketpair() is available
  324. AC_MSG_CHECKING([if socketpair() is available])
  325. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  326. #include <sys/socket.h>]],
  327. [socketpair(0, 0, 0, 0);])],
  328. [AC_DEFINE(PJ_SOCK_HAS_SOCKETPAIR,1)
  329. AC_MSG_RESULT(yes)],
  330. [AC_MSG_RESULT(no)])
  331. dnl # Determine if sockaddr_in has sin_len member
  332. AC_MSG_CHECKING([if sockaddr_in has sin_len member])
  333. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  334. #include <sys/socket.h>
  335. #include <netinet/in.h>
  336. #include <arpa/inet.h>]],
  337. [struct sockaddr_in a; a.sin_len=0;])],
  338. [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
  339. AC_MSG_RESULT(yes)],
  340. AC_MSG_RESULT(no))
  341. dnl # Determine if socklen_t is available
  342. AC_MSG_CHECKING([if socklen_t is available])
  343. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  344. #include <sys/socket.h>]],
  345. [socklen_t xxx = 0;])],
  346. [AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
  347. AC_MSG_RESULT(yes)],
  348. AC_MSG_RESULT(no))
  349. dnl # Determine if IPV6_V6ONLY is available
  350. AC_MSG_CHECKING([if IPV6_V6ONLY is available])
  351. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
  352. #include <netinet/in.h>]],
  353. [int opt = IPV6_V6ONLY;])],
  354. [AC_DEFINE(PJ_SOCK_HAS_IPV6_V6ONLY,1)
  355. AC_MSG_RESULT(yes)],
  356. AC_MSG_RESULT(no))
  357. dnl # Determine if SO_ERROR is available
  358. AC_MSG_CHECKING([if SO_ERROR is available])
  359. case $target in
  360. *mingw* | *cygw* | *win32* | *w32* )
  361. AC_DEFINE(PJ_HAS_SO_ERROR,1)
  362. AC_MSG_RESULT(yes)
  363. ;;
  364. *)
  365. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
  366. #include <sys/socket.h>
  367. #include <netinet/in.h>
  368. #include <arpa/inet.h>]],
  369. [int i=SO_ERROR;])],
  370. [AC_DEFINE(PJ_HAS_SO_ERROR,1)
  371. AC_MSG_RESULT(yes)],
  372. AC_MSG_RESULT(no))
  373. ;;
  374. esac
  375. dnl # Determine if RW-mutex is available
  376. AC_MSG_CHECKING([if pthread_rwlock_t is available])
  377. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
  378. [pthread_rwlock_t *x;])],
  379. [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
  380. ac_rwmutex="yes"
  381. AC_MSG_RESULT(yes)],
  382. [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
  383. ac_rwmutex="no"
  384. AC_MSG_RESULT(no)])
  385. dnl # If rwmutex is not detected, check again but this time
  386. dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
  387. if test "$ac_rwmutex" = "no"; then
  388. AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
  389. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
  390. #include <pthread.h>]],
  391. [pthread_rwlock_t *x;])],
  392. [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
  393. CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
  394. AC_MSG_RESULT(yes)],
  395. [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
  396. AC_MSG_RESULT(no)])
  397. fi
  398. dnl # Do we have pthread_mutexattr_settype()?
  399. AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
  400. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
  401. [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
  402. [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
  403. AC_MSG_RESULT(yes)],
  404. [AC_MSG_RESULT(no)])
  405. dnl # Does pthread_mutexattr_t has "recursive" member?
  406. AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
  407. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
  408. [[pthread_mutexattr_t attr;
  409. attr.recursive=1;]])],
  410. [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
  411. AC_MSG_RESULT(yes)],
  412. [AC_MSG_RESULT(no)])
  413. dnl ######################
  414. dnl # ioqueue selection
  415. dnl #
  416. AC_SUBST(ac_os_objs)
  417. AC_SUBST(ac_linux_poll)
  418. AC_MSG_CHECKING([ioqueue backend])
  419. ac_os_objs=ioqueue_select.o
  420. ac_linux_poll=select
  421. case $target in
  422. *darwin* | *bsd*)
  423. AC_ARG_ENABLE(kqueue,
  424. AS_HELP_STRING([--enable-kqueue],
  425. [Use kqueue ioqueue on macos/BSD (experimental)]),
  426. [
  427. if test "$enable_kqueue" = "yes"; then
  428. ac_os_objs=ioqueue_kqueue.o
  429. AC_MSG_RESULT([kqueue()])
  430. else
  431. AC_MSG_RESULT([select()])
  432. fi
  433. ],
  434. [
  435. AC_MSG_RESULT([select()])
  436. ])
  437. ;;
  438. *)
  439. AC_ARG_ENABLE(epoll,
  440. AS_HELP_STRING([--enable-epoll],
  441. [Use /dev/epoll ioqueue on Linux (experimental)]),
  442. [
  443. if test "$enable_epoll" = "yes"; then
  444. ac_os_objs=ioqueue_epoll.o
  445. AC_MSG_RESULT([/dev/epoll])
  446. AC_DEFINE(PJ_HAS_LINUX_EPOLL,1)
  447. ac_linux_poll=epoll
  448. else
  449. AC_MSG_RESULT([select()])
  450. fi
  451. ],
  452. [
  453. AC_MSG_RESULT([select()])
  454. ])
  455. ;;
  456. esac
  457. AC_SUBST(ac_shared_libraries)
  458. AC_ARG_ENABLE(shared,
  459. AS_HELP_STRING([--enable-shared],
  460. [Build shared libraries]),
  461. [if test "$enable_shared" = "yes"; then
  462. [ac_shared_libraries=1]
  463. CFLAGS="$CFLAGS -fPIC"
  464. AC_MSG_RESULT([Building shared libraries... yes])
  465. fi],
  466. AC_MSG_RESULT([Building shared libraries... no])
  467. )
  468. AC_SUBST(ac_no_pjsua2)
  469. AC_ARG_ENABLE(pjsua2,
  470. AS_HELP_STRING([--disable-pjsua2],
  471. [Exclude pjsua2 library and application from the build]),
  472. [if test "$enable_pjsua2" = "no"; then
  473. [ac_no_pjsua2=1]
  474. AC_MSG_RESULT([Building pjsua2 library and application... no])
  475. fi],
  476. AC_MSG_RESULT([Building pjsua2 library and application... yes])
  477. )
  478. dnl ######################
  479. dnl # OS specific files
  480. dnl #
  481. case $target in
  482. *mingw* | *cygw* | *win32* | *w32* )
  483. ac_os_objs="$ac_os_objs file_access_win32.o file_io_win32.o os_core_win32.o os_error_win32.o os_time_win32.o os_timestamp_win32.o guid_win32.o sock_qos_bsd.o unicode_win32.o"
  484. ;;
  485. *)
  486. ac_os_objs="$ac_os_objs file_access_unistd.o file_io_ansi.o os_core_unix.o os_error_unix.o os_time_unix.o os_timestamp_posix.o"
  487. case $target in
  488. *-apple-darwin_ios*)
  489. ac_os_objs="$ac_os_objs os_info_iphone.o os_core_darwin.o"
  490. ;;
  491. *darwin*)
  492. ac_os_objs="$ac_os_objs os_core_darwin.o"
  493. ;;
  494. esac
  495. # QoS
  496. case $target in
  497. *darwin*)
  498. ac_os_objs="$ac_os_objs sock_qos_darwin.o sock_qos_bsd.o"
  499. ;;
  500. *)
  501. ac_os_objs="$ac_os_objs sock_qos_bsd.o"
  502. ;;
  503. esac
  504. # SSL
  505. case $target in
  506. *darwin*)
  507. ac_os_objs="$ac_os_objs ssl_sock_apple.o"
  508. ;;
  509. esac
  510. # UUID
  511. case $target in
  512. *android*)
  513. ac_os_objs="$ac_os_objs guid_android.o"
  514. ;;
  515. *darwin*)
  516. ac_os_objs="$ac_os_objs guid_darwin.o"
  517. ;;
  518. *bsd*)
  519. ac_os_objs="$ac_os_objs guid_bsd.o"
  520. ;;
  521. *)
  522. if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
  523. ac_os_objs="$ac_os_objs guid_uuid.o"
  524. else
  525. ac_os_objs="$ac_os_objs guid_simple.o"
  526. fi
  527. ;;
  528. esac
  529. ;;
  530. esac
  531. dnl ##########################################
  532. dnl # PJLIB-UTIL
  533. dnl #
  534. dnl # UPnP alt prefix
  535. AC_ARG_WITH(upnp,
  536. AS_HELP_STRING([--with-upnp=DIR],
  537. [Specify alternate libupnp prefix]),
  538. [],
  539. [with_upnp=no]
  540. )
  541. dnl # Do not use default libupnp installation if we are cross-compiling
  542. if test "x$ac_cross_compile" != "x" -a "x$with_upnp" = "xno"; then
  543. enable_upnp=no
  544. fi
  545. dnl # UPnP
  546. AC_ARG_ENABLE(upnp,
  547. AS_HELP_STRING([--disable-upnp],
  548. [Disable UPnP (default: not disabled)]),
  549. [
  550. if test "$enable_upnp" = "no"; then
  551. AC_MSG_RESULT([Checking if UPnP is disabled... yes])
  552. fi
  553. ],
  554. [
  555. if test "x$with_upnp" != "xno" -a "x$with_upnp" != "x"; then
  556. UPNP_PREFIX=$with_upnp
  557. UPNP_CFLAGS="-I$UPNP_PREFIX/upnp/inc -I$UPNP_PREFIX/ixml/inc"
  558. UPNP_LDFLAGS="-L$UPNP_PREFIX/upnp/.libs -L$UPNP_PREFIX/imxl/.libs"
  559. AC_MSG_RESULT([Using UPnP prefix... $with_upnp])
  560. else
  561. UPNP_CFLAGS=""
  562. UPNP_LDFLAGS=""
  563. fi
  564. AC_MSG_CHECKING([UPnP usability])
  565. UPNP_LIBS="-lupnp -lixml"
  566. SAVED_LIBS="$LIBS"
  567. SAVED_LDFLAGS="$LDFLAGS"
  568. SAVED_CFLAGS="$CFLAGS"
  569. LIBS="$UPNP_LIBS $LIBS"
  570. LDFLAGS="$UPNP_LDFLAGS $LDFLAGS"
  571. CFLAGS="$UPNP_CFLAGS $CFLAGS"
  572. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <upnp/upnp.h>]],
  573. [UpnpInit2(NULL, 0);]
  574. )],
  575. [ CFLAGS="$CFLAGS -DPJNATH_HAS_UPNP=1 $UPNP_CFLAGS"
  576. LDFLAGS="$LDFLAGS $UPNP_LDFLAGS $UPNP_LIBS"
  577. AC_MSG_RESULT(yes)
  578. ],
  579. [
  580. LIBS="$SAVED_LIBS"
  581. LDFLAGS="$SAVED_LDFLAGS"
  582. CFLAGS="$SAVED_CFLAGS"
  583. AC_MSG_RESULT(no)
  584. ])
  585. ])
  586. dnl ##########################################
  587. dnl #
  588. dnl # PJMEDIA
  589. dnl #
  590. dnl # Use external Speex installation
  591. AC_SUBST(ac_external_speex,0)
  592. AC_ARG_WITH(external-speex,
  593. AS_HELP_STRING([--with-external-speex],
  594. [Use external Speex development files, not the one in "third_party" directory. When this option is set, make sure that Speex is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
  595. [
  596. if test "x$with_external_speex" != "xno"; then
  597. # Test Speex installation
  598. AC_MSG_CHECKING([if external Speex devkit is installed])
  599. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
  600. #include <speex/speex_echo.h>
  601. ]],
  602. [speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
  603. [AC_MSG_RESULT(yes!!)
  604. AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
  605. ac_external_speex="1"
  606. ],
  607. [AC_MSG_ERROR([Unable to use external Speex library. If Speex development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
  608. fi
  609. ]
  610. )
  611. dnl # Use external GSM codec library installation
  612. AC_SUBST(ac_external_gsm,0)
  613. AC_ARG_WITH(external-gsm,
  614. AS_HELP_STRING([--with-external-gsm],
  615. [Use external GSM codec library, not the one in "third_party" directory. When this option is set, make sure that the GSM include/lib files are accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
  616. [
  617. if test "x$with_external_gsm" != "xno"; then
  618. # Test GSM library installation
  619. AC_MSG_CHECKING([if external GSM devkit is installed as gsm/gsm.h])
  620. AC_COMPILE_IFELSE(
  621. [AC_LANG_PROGRAM([[#include <gsm/gsm.h> ]], [gsm_create(); ]) ],
  622. [AC_MSG_RESULT(yes!!)
  623. AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
  624. AC_DEFINE(PJMEDIA_EXTERNAL_GSM_GSM_H, 1)
  625. ac_external_gsm="1"
  626. ],
  627. [
  628. AC_MSG_RESULT(no)
  629. AC_MSG_CHECKING([if external GSM devkit is installed as gsm.h])
  630. AC_COMPILE_IFELSE(
  631. [AC_LANG_PROGRAM([[#include <gsm.h> ]], [gsm_create(); ]) ],
  632. [AC_MSG_RESULT(yes!!)
  633. AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
  634. AC_DEFINE(PJMEDIA_EXTERNAL_GSM_H, 1)
  635. ac_external_gsm="1"
  636. ],
  637. [AC_MSG_ERROR([Unable to use external GSM library. If GSM development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])
  638. ]
  639. )
  640. ]
  641. )
  642. fi
  643. ]
  644. )
  645. dnl # Use external SRTP installation
  646. AC_SUBST(ac_external_srtp,0)
  647. AC_SUBST(ac_external_srtp_lib)
  648. AC_ARG_WITH(external-srtp,
  649. AS_HELP_STRING([--with-external-srtp],
  650. [Use external SRTP development files, not the one in "third_party" directory. When this option is set, make sure that SRTP is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
  651. [
  652. if test "x$with_external_srtp" != "xno"; then
  653. # Test SRTP installation
  654. AC_MSG_CHECKING([if external SRTP devkit is installed])
  655. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp2/srtp.h>
  656. ]],
  657. [srtp_init();])],
  658. [AC_MSG_RESULT(yes: version 2.x)
  659. ac_external_srtp="2"
  660. ac_external_srtp_lib="srtp2"
  661. ],
  662. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h>
  663. ]],
  664. [srtp_init();])],
  665. [AC_MSG_RESULT(yes: version 1.x)
  666. ac_external_srtp="1"
  667. ac_external_srtp_lib="srtp"
  668. ],
  669. [AC_MSG_ERROR([Unable to use SRTP. If SRTP development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])])
  670. fi
  671. ]
  672. )
  673. dnl # For external SRTP, check availability of srtp_deinit() or srtp_shutdown()
  674. if test "x$ac_external_srtp" != "x0"; then
  675. AC_SUBST(ac_srtp_deinit_present,0)
  676. AC_SUBST(ac_srtp_shutdown_present,0)
  677. AC_CHECK_LIB($ac_external_srtp_lib,srtp_deinit,[ac_srtp_deinit_present=1])
  678. if test "x$ac_srtp_deinit_present" != "x1"; then
  679. AC_CHECK_LIB($ac_external_srtp_lib,srtp_shutdown,[ac_srtp_shutdown_present=1])
  680. fi
  681. fi
  682. dnl # Use external libyuv installation
  683. AC_SUBST(ac_external_yuv,0)
  684. AC_ARG_WITH(external-yuv,
  685. AS_HELP_STRING([--with-external-yuv],
  686. [Use external libyuv development files, not the one in "third_party" directory. When this option is set, make sure that libyuv is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
  687. [
  688. if test "x$with_external_yuv" != "xno"; then
  689. # Test libyuv installation
  690. AC_MSG_CHECKING([if external libyuv devkit is installed])
  691. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libyuv.h>]],
  692. [RGB24ToI420(0,0,0,0,0,0,0,0,0,0);])],
  693. [AC_MSG_RESULT(yes!!)
  694. ac_external_yuv="1"
  695. ],
  696. [AC_MSG_ERROR([Unable to use external libyuv. If libyuv development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
  697. fi
  698. ]
  699. )
  700. dnl # Use external webrtc installation
  701. AC_SUBST(ac_external_webrtc,0)
  702. AC_ARG_WITH(external-webrtc,
  703. AS_HELP_STRING([--with-external-webrtc],
  704. [Use external webrtc development files, not the one in "third_party" directory. When this option is set, make sure that webrtc is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
  705. [
  706. if test "x$with_external_webrtc" != "xno"; then
  707. # Test webrtc installation
  708. AC_MSG_CHECKING([if external webrtc devkit is installed])
  709. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <webrtc/modules/audio_processing/aec/aec_core.h>
  710. #include <webrtc/modules/audio_processing/aec/include/echo_cancellation.h>
  711. ]],
  712. [WebRtcAec_Create();])],
  713. [AC_MSG_RESULT(yes!!)
  714. ac_external_webrtc="1"
  715. ],
  716. [AC_MSG_ERROR([Unable to use external webrtc. If webrtc development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
  717. fi
  718. ]
  719. )
  720. dnl # Use external webrtc AEC3 installation
  721. AC_SUBST(ac_external_webrtc_aec3,0)
  722. AC_ARG_WITH(external-webrtc-aec3,
  723. AS_HELP_STRING([--with-external-webrtc-aec3],
  724. [Use external webrtc AEC3 development files, not the one in "third_party" directory. When this option is set, make sure that webrtc is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
  725. [
  726. if test "x$with_external_webrtc_aec3" != "xno"; then
  727. # Test webrtc AEC3 installation
  728. AC_MSG_CHECKING([if external webrtc AEC3 is installed])
  729. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "modules/audio_processing/aec3/echo_canceller3.h"
  730. ]],
  731. [EchoCanceller3 ec(EchoCanceller3Config(), 16000, 1, 1);])],
  732. [AC_MSG_RESULT(yes!!)
  733. ac_external_webrtc_aec3="1"
  734. ],
  735. [AC_MSG_ERROR([Unable to use external webrtc AEC3. If webrtc development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
  736. fi
  737. ]
  738. )
  739. dnl # Resample implementation
  740. AC_SUBST(ac_pjmedia_resample,libresample)
  741. AC_ARG_ENABLE(resample,
  742. AS_HELP_STRING([--disable-resample],
  743. [Disable resampling implementations]),
  744. [if test "$enable_resample" = "no"; then
  745. [ac_pjmedia_resample=none]
  746. AC_MSG_RESULT([Checking if resampling is disabled...yes])
  747. fi]
  748. )
  749. dnl # Sound device backend selection
  750. AC_SUBST(ac_pjmedia_snd)
  751. AC_ARG_ENABLE(sound,
  752. AS_HELP_STRING([--disable-sound],
  753. [Exclude sound (i.e. use null sound)]),
  754. [if test "$enable_sound" = "no"; then
  755. [ac_pjmedia_snd=null]
  756. AC_MSG_RESULT([Checking if sound is disabled... yes])
  757. fi]
  758. )
  759. dnl # Use external PortAudio installation
  760. AC_SUBST(ac_external_pa,0)
  761. AC_ARG_WITH(external-pa,
  762. AS_HELP_STRING([--with-external-pa],
  763. [Use external PortAudio development files. When this option is set, make sure that PortAudio is accessible to use (hint: use CFLAGS and LDFLAGS env var to set the include/lib paths)]),
  764. [
  765. if test "x$with_external_pa" != "xno"; then
  766. # Test PortAudio installation
  767. AC_MSG_CHECKING([if external PortAudio devkit is installed])
  768. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
  769. ]],
  770. [Pa_Initialize();])],
  771. [AC_MSG_RESULT(yes!!)
  772. ac_external_pa="1"
  773. ],
  774. [AC_MSG_ERROR([Unable to use PortAudio. If PortAudio development files are not available in the default locations, use CFLAGS and LDFLAGS env var to set the include/lib paths])])
  775. fi
  776. ]
  777. )
  778. AC_SUBST(ac_pa_cflags)
  779. AC_CHECK_HEADER(sys/soundcard.h,
  780. [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
  781. AC_CHECK_HEADER(linux/soundcard.h,
  782. [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
  783. AC_CHECK_HEADER(machine/soundcard.h,
  784. [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
  785. if test "x$ac_cv_c_bigendian" = "xyes"; then
  786. ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
  787. else
  788. ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
  789. fi
  790. dnl # Enable Android Oboe audio device
  791. AC_SUBST(ac_oboe_cflags)
  792. AC_SUBST(ac_oboe_ldflags)
  793. AC_ARG_WITH(oboe,
  794. AS_HELP_STRING([--with-oboe],
  795. [Enable Android Oboe audio device backend.]),
  796. [
  797. if test "x$with_oboe" != "xno" -a "x$with_oboe" != "x"; then
  798. OBOE_PREFIX=$with_oboe
  799. OBOE_CFLAGS="-I$OBOE_PREFIX/prefab/modules/oboe/include"
  800. OBOE_LDFLAGS="-L$OBOE_PREFIX/prefab/modules/oboe/libs/android.$TARGET_ABI"
  801. AC_MSG_RESULT([Using Oboe prefix... $with_oboe])
  802. else
  803. OBOE_CFLAGS=""
  804. OBOE_LDFLAGS=""
  805. fi
  806. AC_MSG_CHECKING([Oboe usability])
  807. OBOE_LIBS="-loboe -lOpenSLES -llog"
  808. SAVED_LIBS="$LIBS"
  809. SAVED_LDFLAGS="$LDFLAGS"
  810. SAVED_CXXFLAGS="$CXXFLAGS"
  811. LIBS="$OBOE_LIBS $LIBS"
  812. LDFLAGS="$OBOE_LDFLAGS $LDFLAGS"
  813. CXXFLAGS="$OBOE_CFLAGS $CXXFLAGS"
  814. AC_LANG_PUSH([C++])
  815. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <oboe/Oboe.h>]],
  816. [oboe::AudioStreamBuilder sb; sb.setDeviceId(0);]
  817. )],
  818. [ ac_oboe_cflags="-DPJMEDIA_AUDIO_DEV_HAS_OBOE=1 $OBOE_CFLAGS"
  819. ac_oboe_ldflags="$OBOE_LDFLAGS $OBOE_LIBS"
  820. AC_MSG_RESULT(yes)
  821. ],
  822. [
  823. LIBS="$SAVED_LIBS"
  824. LDFLAGS="$SAVED_LDFLAGS"
  825. AC_MSG_RESULT(no)
  826. ])
  827. AC_LANG_POP([C++])
  828. # Put back original CXXFLAGS as app won't needed it.
  829. CXXFLAGS="$SAVED_CFLAGS"
  830. ]
  831. )
  832. if test "$enable_sound" = "no"; then
  833. true;
  834. else
  835. AC_SUBST(ac_pjmedia_audiodev_objs)
  836. case $target in
  837. *android*)
  838. if test "x$ac_oboe_cflags" != "x"; then
  839. AC_MSG_RESULT([Checking sound device backend... Oboe])
  840. else
  841. LIBS="$LIBS -lOpenSLES"
  842. AC_MSG_RESULT([Checking sound device backend... Android])
  843. fi
  844. ;;
  845. *-apple-darwin_ios*)
  846. LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox -framework CFNetwork -framework UIKit -framework AVFoundation"
  847. ac_pjmedia_audiodev_objs="coreaudio_dev.o"
  848. AC_MSG_RESULT([Checking sound device backend... AudioUnit])
  849. ;;
  850. *darwin*)
  851. LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
  852. ac_pjmedia_audiodev_objs="coreaudio_dev.o"
  853. if test "`uname -r`" = "6.8"; then
  854. #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
  855. #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
  856. #ac_pjmedia_snd=pa_old_darwinos
  857. AC_MSG_RESULT([Checking sound device backend... old coreaudio])
  858. else
  859. ac_pjmedia_snd=coreaudio
  860. AC_MSG_RESULT([Checking sound device backend... coreaudio])
  861. fi
  862. ;;
  863. *cygwin* | *mingw*)
  864. ac_pjmedia_snd=win32
  865. AC_MSG_RESULT([Checking sound device backend... win32 sound])
  866. ;;
  867. *rtems*)
  868. ac_pjmedia_snd=null
  869. AC_MSG_RESULT([Checking sound device backend... null sound])
  870. ;;
  871. *)
  872. if test "x$ac_external_pa" != "x1"; then
  873. dnl # Check if ALSA is available
  874. AC_CHECK_HEADER(alsa/version.h,
  875. [LIBS="$LIBS -lasound"
  876. ac_pjmedia_snd=alsa])
  877. if test "x$ac_pjmedia_snd" = "xalsa"; then
  878. AC_MSG_RESULT([Checking sound device backend... alsa])
  879. else
  880. ac_pjmedia_snd=null
  881. AC_MSG_RESULT([Checking sound device backend... null sound])
  882. fi
  883. fi
  884. ;;
  885. esac
  886. fi
  887. AC_SUBST(ac_pjmedia_video)
  888. # Disable video on mingw by default (but respect --enable-video=yes)
  889. case $target in
  890. *mingw*)
  891. if test ! "$enable_video" = "yes"; then
  892. enable_video="no"
  893. fi
  894. ;;
  895. esac
  896. dnl # --disable-video option
  897. AC_ARG_ENABLE(video,
  898. AS_HELP_STRING([--disable-video],
  899. [Disable video feature]),
  900. [if test "$enable_video" = "no"; then
  901. #AC_DEFINE(PJMEDIA_HAS_VIDEO,0)
  902. AC_MSG_RESULT([Video is disabled])
  903. enable_sdl="no"
  904. enable_ffmpeg="no"
  905. enable_v4l2="no"
  906. enable_openh264="no"
  907. enable_libyuv="no"
  908. enable_vpx="no"
  909. fi],
  910. [])
  911. case $target in
  912. *android*)
  913. LIBS="$LIBS -llog"
  914. ;;
  915. *-apple-darwin_ios*)
  916. LIBS="$LIBS -framework UIKit"
  917. ;;
  918. *darwin*)
  919. LIBS="$LIBS -framework Foundation -framework AppKit"
  920. ;;
  921. esac
  922. if test "$enable_video" = "no"; then
  923. true;
  924. else
  925. case $target in
  926. *android*)
  927. ac_pjmedia_video=android_os
  928. AC_SUBST(ac_pjmedia_video_has_android)
  929. AC_SUBST(ac_android_cflags)
  930. SAVED_LIBS="$LIBS"
  931. LIBS="-lGLESv2 -lEGL -landroid -lc"
  932. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_android=yes],[ac_pjmedia_video_has_android=no])
  933. LIBS="$SAVED_LIBS"
  934. if test "$ac_pjmedia_video_has_android" = "yes"; then
  935. ac_android_cflags="-DPJMEDIA_VIDEO_DEV_HAS_ANDROID_OPENGL=1"
  936. LIBS="$LIBS -lGLESv2 -lEGL -landroid"
  937. AC_MSG_RESULT([Checking if OpenGL ES 2 is available... yes])
  938. else
  939. AC_MSG_RESULT([Checking if OpenGL ES 2 is available... no])
  940. fi
  941. ac_android_cflags="$ac_android_cflags -DPJMEDIA_VIDEO_DEV_HAS_ANDROID=1"
  942. ;;
  943. *mingw*)
  944. if test "$enable_video" = "yes"; then
  945. ac_pjmedia_video=windows_os
  946. AC_SUBST(ac_pjmedia_video_dev_has_dshow)
  947. ac_pjmedia_video_dev_has_dshow=yes
  948. AC_SUBST(ac_dshow_cflags)
  949. ac_dshow_cflags="-DPJMEDIA_HAS_VIDEO=1 -DPJMEDIA_VIDEO_DEV_HAS_DSHOW=1"
  950. AC_SUBST(ac_dshow_ldflags)
  951. ac_dshow_ldflags=" -lstdc++ -lquartz -lole32 -loleaut32 -lrpcrt4 -lwinmm -luuid -lmingwex -lstrmiids "
  952. LIBS="$LIBS -lstdc++ -lquartz -lole32 -loleaut32 -lrpcrt4 -lwinmm -luuid -lmingwex -lstrmiids "
  953. fi
  954. ;;
  955. *darwin*)
  956. ac_pjmedia_video=darwin_os
  957. AC_SUBST(ac_pjmedia_video_has_darwin)
  958. AC_SUBST(ac_pjmedia_video_has_metal)
  959. AC_SUBST(ac_pjmedia_video_has_vtoolbox)
  960. AC_SUBST(ac_pjmedia_video_has_ios_opengl)
  961. AC_SUBST(ac_darwin_cflags)
  962. SAVED_LIBS="$LIBS"
  963. LIBS="-framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
  964. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],
  965. [ac_pjmedia_video_has_darwin=yes],
  966. [ac_pjmedia_video_has_darwin=no])
  967. LIBS="-framework VideoToolbox"
  968. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],
  969. [ac_pjmedia_video_has_vtoolbox=yes],
  970. [ac_pjmedia_video_has_vtoolbox=no])
  971. LIBS="-framework Metal"
  972. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],
  973. [ac_pjmedia_video_has_metal=yes],
  974. [ac_pjmedia_video_has_metal=no])
  975. LIBS="-framework OpenGLES"
  976. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],
  977. [ac_pjmedia_video_has_ios_opengl=yes],
  978. [ac_pjmedia_video_has_ios_opengl=no])
  979. LIBS="$SAVED_LIBS"
  980. if test "$ac_pjmedia_video_has_darwin" = "yes"; then
  981. ac_darwin_cflags="-DPJMEDIA_VIDEO_DEV_HAS_DARWIN=1"
  982. LIBS="$LIBS -framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
  983. AC_MSG_RESULT([Checking if AVFoundation framework is available... yes])
  984. else
  985. AC_MSG_RESULT([Checking if AVFoundation framework is available... no])
  986. fi
  987. if test "$ac_pjmedia_video_has_metal" = "yes"; then
  988. ac_darwin_cflags+=" -DPJMEDIA_VIDEO_DEV_HAS_METAL=1"
  989. LIBS="$LIBS -framework Metal -framework MetalKit"
  990. AC_MSG_RESULT([Checking if Metal framework is available... yes])
  991. else
  992. AC_MSG_RESULT([Checking if Metal framework is available... no])
  993. fi
  994. if test "$ac_pjmedia_video_has_vtoolbox" = "yes"; then
  995. #ac_darwin_cflags+=" -DPJMEDIA_HAS_VID_TOOLBOX_CODEC=1"
  996. LIBS="$LIBS -framework VideoToolbox"
  997. AC_MSG_RESULT([Checking if VideoToolbox framework is available... yes])
  998. else
  999. AC_MSG_RESULT([Checking if VideoToolbox framework is available... no])
  1000. fi
  1001. if test "$ac_pjmedia_video_has_ios_opengl" = "yes"; then
  1002. ac_darwin_cflags+=" -DPJMEDIA_VIDEO_DEV_HAS_IOS_OPENGL=1"
  1003. LIBS="$LIBS -framework OpenGLES"
  1004. AC_MSG_RESULT([Checking if OpenGLES framework is available... yes])
  1005. else
  1006. AC_MSG_RESULT([Checking if OpenGLES framework is available... no])
  1007. fi
  1008. if false; then
  1009. # QTKit is deprecated, see ticket #1931.
  1010. ac_pjmedia_video=mac_os
  1011. AC_SUBST(ac_pjmedia_video_has_qt)
  1012. AC_SUBST(ac_qt_cflags)
  1013. SAVED_LIBS="$LIBS"
  1014. LIBS="-framework QTKit"
  1015. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_qt=yes],[ac_pjmedia_video_has_qt=no])
  1016. LIBS="$SAVED_LIBS"
  1017. if test "$ac_pjmedia_video_has_qt" = "yes"; then
  1018. ac_qt_cflags="-DPJMEDIA_VIDEO_DEV_HAS_QT=1"
  1019. LIBS="$LIBS -framework QTKit -framework QuartzCore -framework OpenGL"
  1020. AC_MSG_RESULT([Checking if QTKit framework is available... yes])
  1021. else
  1022. AC_MSG_RESULT([Checking if QTKit framework is available... no])
  1023. fi
  1024. fi
  1025. ;;
  1026. esac
  1027. fi
  1028. AC_ARG_ENABLE(ext_sound,
  1029. AS_HELP_STRING([--enable-ext-sound],
  1030. [PJMEDIA will not provide any sound device backend]),
  1031. [if test "$enable_ext_sound" = "yes"; then
  1032. [ac_pjmedia_snd=external]
  1033. AC_MSG_RESULT([Checking if external sound is set... yes])
  1034. fi]
  1035. )
  1036. dnl # Include resampling small filter
  1037. AC_SUBST(ac_no_small_filter)
  1038. AC_ARG_ENABLE(small-filter,
  1039. AS_HELP_STRING([--disable-small-filter],
  1040. [Exclude small filter in resampling]),
  1041. [if test "$enable_small_filter" = "no"; then
  1042. [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
  1043. AC_MSG_RESULT([Checking if small filter is disabled... yes])
  1044. fi],
  1045. AC_MSG_RESULT([Checking if small filter is disabled... no]))
  1046. dnl # Include resampling large filter
  1047. AC_SUBST(ac_no_large_filter)
  1048. AC_ARG_ENABLE(large-filter,
  1049. AS_HELP_STRING([--disable-large-filter],
  1050. [Exclude large filter in resampling]),
  1051. [if test "$enable_large_filter" = "no"; then
  1052. [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
  1053. AC_MSG_RESULT([Checking if large filter is disabled... yes])
  1054. fi],
  1055. AC_MSG_RESULT([Checking if large filter is disabled... no]))
  1056. dnl # Include Speex AEC
  1057. AC_SUBST(ac_no_speex_aec)
  1058. AC_ARG_ENABLE(speex-aec,
  1059. AS_HELP_STRING([--disable-speex-aec],
  1060. [Exclude Speex Acoustic Echo Canceller/AEC]),
  1061. [if test "$enable_speex_aec" = "no"; then
  1062. [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
  1063. AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
  1064. fi],
  1065. AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
  1066. dnl # Include G711 codec
  1067. AC_SUBST(ac_no_g711_codec)
  1068. AC_ARG_ENABLE(g711-codec,
  1069. AS_HELP_STRING([--disable-g711-codec],
  1070. [Exclude G.711 codecs from the build]),
  1071. [if test "$enable_g711_codec" = "no"; then
  1072. [ac_no_g711_codec=1]
  1073. AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
  1074. AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
  1075. fi],
  1076. AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
  1077. dnl # Include L16 codec
  1078. AC_SUBST(ac_no_l16_codec)
  1079. AC_ARG_ENABLE(l16-codec,
  1080. AS_HELP_STRING([--disable-l16-codec],
  1081. [Exclude Linear/L16 codec family from the build]),
  1082. [if test "$enable_l16_codec" = "no"; then
  1083. [ac_no_l16_codec=1]
  1084. AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
  1085. AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
  1086. fi],
  1087. AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
  1088. dnl # Include GSM codec
  1089. AC_SUBST(ac_no_gsm_codec)
  1090. AC_ARG_ENABLE(gsm-codec,
  1091. AS_HELP_STRING([--disable-gsm-codec],
  1092. [Exclude GSM codec in the build]),
  1093. [if test "$enable_gsm_codec" = "no"; then
  1094. [ac_no_gsm_codec=1]
  1095. AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
  1096. AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
  1097. fi],
  1098. AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
  1099. dnl # Include G.722 codec
  1100. AC_SUBST(ac_no_g722_codec)
  1101. AC_ARG_ENABLE(g722-codec,
  1102. AS_HELP_STRING([--disable-g722-codec],
  1103. [Exclude G.722 codec in the build]),
  1104. [if test "$enable_g722_codec" = "no"; then
  1105. [ac_no_g722_codec=1]
  1106. AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
  1107. AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
  1108. fi],
  1109. AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
  1110. dnl # Include G722.1 codec
  1111. AC_SUBST(ac_no_g7221_codec)
  1112. AC_ARG_ENABLE(g7221-codec,
  1113. AS_HELP_STRING([--disable-g7221-codec],
  1114. [Exclude G.7221 codec in the build]),
  1115. [if test "$enable_g7221_codec" = "no"; then
  1116. [ac_no_g7221_codec=1]
  1117. AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
  1118. AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
  1119. fi],
  1120. AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
  1121. dnl # Include Speex codec
  1122. AC_SUBST(ac_no_speex_codec)
  1123. AC_ARG_ENABLE(speex-codec,
  1124. AS_HELP_STRING([--disable-speex-codec],
  1125. [Exclude Speex codecs in the build]),
  1126. [if test "$enable_speex_codec" = "no"; then
  1127. [ac_no_speex_codec=1]
  1128. AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
  1129. AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
  1130. fi],
  1131. AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
  1132. dnl # Include iLBC codec
  1133. AC_SUBST(ac_no_ilbc_codec)
  1134. AC_ARG_ENABLE(ilbc-codec,
  1135. AS_HELP_STRING([--disable-ilbc-codec],
  1136. [Exclude iLBC codec in the build]),
  1137. [if test "$enable_ilbc_codec" = "no"; then
  1138. [ac_no_ilbc_codec=1]
  1139. AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
  1140. AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
  1141. fi],
  1142. AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
  1143. dnl # Include libsamplerate
  1144. AC_ARG_ENABLE(libsamplerate,
  1145. AS_HELP_STRING([--enable-libsamplerate],
  1146. [Link with libsamplerate when available.]),
  1147. [
  1148. if test "$enable_libsamplerate" = "yes"; then
  1149. AC_MSG_RESULT([Checking if libsamplerate is enabled...yes])
  1150. AC_CHECK_LIB(samplerate,src_new)
  1151. [ac_pjmedia_resample=libsamplerate]
  1152. else
  1153. AC_MSG_RESULT([Checking if libsamplerate is enabled...no])
  1154. fi
  1155. ], AC_MSG_RESULT([Checking if libsamplerate is enabled...no]))
  1156. AC_SUBST(ac_resample_dll)
  1157. AC_ARG_ENABLE(resample_dll,
  1158. AS_HELP_STRING([--enable-resample-dll],
  1159. [Build libresample as shared library]),
  1160. [if test "$enable_resample_dll" = "yes"; then
  1161. [ac_resample_dll=1]
  1162. AC_MSG_RESULT([Building libresample as shared library... yes])
  1163. fi],
  1164. AC_MSG_RESULT([Building libresample as shared library... no])
  1165. )
  1166. dnl # Include Speex resample
  1167. AC_ARG_ENABLE(speex-resample,
  1168. AS_HELP_STRING([--enable-speex-resample],
  1169. [Enable Speex resample]),
  1170. [
  1171. if test "$enable_speex_resample" = "yes"; then
  1172. AC_MSG_RESULT([Checking if Speex resample is enabled... yes])
  1173. [ac_pjmedia_resample=speex]
  1174. else
  1175. AC_MSG_RESULT([Checking if Speex resample is enabled... no])
  1176. fi
  1177. ], AC_MSG_RESULT([Checking if Speex resample is enabled... no]))
  1178. dnl # SDL alt prefix
  1179. AC_ARG_WITH(sdl,
  1180. AS_HELP_STRING([--with-sdl=DIR],
  1181. [Specify alternate libSDL prefix]),
  1182. [],
  1183. [with_sdl=no]
  1184. )
  1185. dnl # Do not use default SDL installation if we are cross-compiling
  1186. if test "x$ac_cross_compile" != "x" -a "x$with_sdl" = "xno"; then
  1187. enable_sdl=no
  1188. fi
  1189. dnl # SDL
  1190. AC_ARG_ENABLE(sdl,
  1191. AS_HELP_STRING([--disable-sdl],
  1192. [Disable SDL (default: not disabled)]),
  1193. [
  1194. if test "$enable_sdl" = "no"; then
  1195. AC_MSG_RESULT([Checking if SDL is disabled... yes])
  1196. fi
  1197. ],
  1198. [
  1199. if test "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
  1200. AC_MSG_RESULT([Using SDL prefix... $with_sdl])
  1201. AC_PATH_PROGS(SDL_CONFIG,sdl2-config sdl-config,,$with_sdl/bin)
  1202. else
  1203. AC_PATH_PROGS(SDL_CONFIG, sdl2-config sdl-config)
  1204. fi
  1205. AC_MSG_CHECKING([SDL availability])
  1206. if test "x$SDL_CONFIG" = "x"; then
  1207. AC_MSG_RESULT([not found])
  1208. elif (sh -c "$SDL_CONFIG --version" | grep -e '^1\.3' -e '^2\.') then
  1209. AC_SUBST(ac_sdl_cflags)
  1210. AC_SUBST(ac_sdl_ldflags)
  1211. ac_sdl_cflags=`$SDL_CONFIG --cflags`
  1212. ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
  1213. ac_sdl_ldflags=`$SDL_CONFIG --libs`
  1214. ac_sdl_ldflags=`echo "${ac_sdl_ldflags}" | sed -e 's/-mwindows//g'`
  1215. LIBS="$LIBS $ac_sdl_ldflags"
  1216. else
  1217. AC_MSG_RESULT([Unsupported SDL version])
  1218. fi
  1219. ])
  1220. AC_ARG_WITH(ffmpeg,
  1221. AS_HELP_STRING([--with-ffmpeg=DIR],
  1222. [Specify alternate FFMPEG prefix]),
  1223. [],
  1224. [with_ffmpeg=no]
  1225. )
  1226. dnl # Do not use default ffmpeg installation if we are cross-compiling
  1227. if test "x$ac_cross_compile" != "x" -a "x$with_ffmpeg" = "xno"; then
  1228. enable_ffmpeg=no
  1229. fi
  1230. dnl # FFMPEG stuffs
  1231. AC_ARG_ENABLE(ffmpeg,
  1232. AS_HELP_STRING([--disable-ffmpeg],
  1233. [Disable ffmpeg (default: not disabled)]),
  1234. [
  1235. AC_SUBST(ac_has_ffmpeg,0)
  1236. if test "$enable_ffmpeg" = "no"; then
  1237. AC_MSG_RESULT([Checking if ffmpeg is disabled... yes])
  1238. fi
  1239. ],
  1240. [
  1241. AC_SUBST(ac_ffmpeg_cflags)
  1242. AC_SUBST(ac_ffmpeg_ldflags)
  1243. FFMPEG_PREFIX=""
  1244. AC_SUBST(SAVED_PKG_CONFIG_PATH)
  1245. SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
  1246. if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
  1247. FFMPEG_PREFIX=$with_ffmpeg
  1248. AC_MSG_RESULT([Using ffmpeg prefix... $FFMPEG_PREFIX])
  1249. export PKG_CONFIG_PATH=$FFMPEG_PREFIX/lib/pkgconfig
  1250. fi
  1251. AC_CHECK_PROGS(PKG_CONFIG,pkg-config "python pkgconfig.py",none)
  1252. if test "$PKG_CONFIG" != "none"; then
  1253. AC_MSG_CHECKING([ffmpeg packages])
  1254. av_pkg=""
  1255. if $PKG_CONFIG --exists libavdevice; then
  1256. ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
  1257. av_pkg="$av_pkg libavdevice"
  1258. fi
  1259. if $PKG_CONFIG --exists libavformat; then
  1260. ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
  1261. av_pkg="$av_pkg libavformat"
  1262. fi
  1263. if $PKG_CONFIG --exists libavcodec; then
  1264. ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
  1265. av_pkg="$av_pkg libavcodec"
  1266. fi
  1267. if $PKG_CONFIG --exists libswscale; then
  1268. ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
  1269. av_pkg="$av_pkg libswscale"
  1270. fi
  1271. if $PKG_CONFIG --exists libavutil; then
  1272. ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
  1273. av_pkg="$av_pkg libavutil"
  1274. fi
  1275. if test "x$av_pkg" = "x"; then
  1276. AC_MSG_RESULT([none detected (check the prefix)! **])
  1277. else
  1278. AC_MSG_RESULT([$av_pkg])
  1279. fi
  1280. ac_ffmpeg_cflags="$ac_ffmpeg_cflags `$PKG_CONFIG --cflags $av_pkg`"
  1281. ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags `$PKG_CONFIG --libs $av_pkg`"
  1282. else
  1283. dnl #
  1284. dnl # Use hardcoded values to configure ffmpeg
  1285. dnl #
  1286. AC_MSG_RESULT([*** Warning: neither pkg-config nor python is available, ffmpeg dependency cannot be calculated. If ffmpeg libraries are not detected, you need to specify the correct CFLAGS and LDFLAGS settings for ffmpeg prior to invoking configure ***])
  1287. LIBS="-L$FFMPEG_PREFIX/lib $LIBS"
  1288. LDFLAGS="-L$FFMPEG_PREFIX/lib $LDFLAGS"
  1289. CFLAGS="-I$FFMPEG_PREFIX/include $CFLAGS"
  1290. AC_CHECK_LIB(avdevice,
  1291. avdevice_version,
  1292. [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
  1293. ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavdevice"
  1294. ]
  1295. )
  1296. AC_CHECK_LIB(avutil,
  1297. av_malloc,
  1298. [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
  1299. ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavutil"
  1300. ]
  1301. )
  1302. AC_CHECK_LIB(avcodec,
  1303. avcodec_init,
  1304. [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
  1305. ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcodec"
  1306. ],
  1307. [],
  1308. [-lavutil]
  1309. )
  1310. AC_CHECK_LIB(avformat,
  1311. av_register_all,
  1312. [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
  1313. ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavformat"
  1314. ],
  1315. [],
  1316. [-lavcodec -lavutil]
  1317. )
  1318. AC_CHECK_LIB(swscale,
  1319. sws_scale,
  1320. [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
  1321. ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lswscale"
  1322. ],
  1323. [],
  1324. [-lavutil]
  1325. )
  1326. AC_CHECK_LIB(avcore,
  1327. avcore_version,
  1328. [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
  1329. ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcore"
  1330. ]
  1331. )
  1332. fi
  1333. AC_CHECK_TYPES(enum AVPixelFormat,
  1334. [],
  1335. [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_USE_OLD_FFMPEG=1"],
  1336. [[#include <libavformat/avformat.h>]]
  1337. )
  1338. LIBS="$LIBS $ac_ffmpeg_ldflags"
  1339. export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
  1340. ]
  1341. )
  1342. dnl # Video for Linux 2
  1343. AC_ARG_ENABLE(v4l2,
  1344. AS_HELP_STRING([--disable-v4l2],
  1345. [Disable Video4Linux2 (default: not disabled)]),
  1346. [
  1347. if test "$enable_v4l2" = "no"; then
  1348. AC_MSG_RESULT([Checking if V4L2 is disabled... yes])
  1349. fi
  1350. ],
  1351. [
  1352. AC_SUBST(ac_v4l2_cflags)
  1353. AC_SUBST(ac_v4l2_ldflags)
  1354. AC_CHECK_LIB(v4l2,
  1355. v4l2_open,
  1356. [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
  1357. ac_v4l2_ldflags="-lv4l2"
  1358. LIBS="$LIBS -lv4l2"
  1359. ]
  1360. )
  1361. ])
  1362. dnl # OpenH264 alt prefix
  1363. AC_ARG_WITH(openh264,
  1364. AS_HELP_STRING([--with-openh264=DIR],
  1365. [Specify alternate OpenH264 prefix]),
  1366. [],
  1367. [with_openh264=no]
  1368. )
  1369. dnl # Do not use default OpenH264 installation if we are cross-compiling
  1370. if test "x$ac_cross_compile" != "x" -a "x$with_openh264" = "xno"; then
  1371. enable_openh264=no
  1372. fi
  1373. dnl # OpenH264
  1374. AC_SUBST(ac_openh264_cflags)
  1375. AC_SUBST(ac_openh264_ldflags)
  1376. AC_ARG_ENABLE(openh264,
  1377. AS_HELP_STRING([--disable-openh264],
  1378. [Disable OpenH264 (default: not disabled)]),
  1379. [
  1380. if test "$enable_openh264" = "no"; then
  1381. AC_MSG_RESULT([Checking if OpenH264 is disabled... yes])
  1382. fi
  1383. ],
  1384. [
  1385. if test "x$with_openh264" != "xno" -a "x$with_openh264" != "x"; then
  1386. OPENH264_PREFIX=$with_openh264
  1387. OPENH264_CFLAGS="-I$OPENH264_PREFIX/include"
  1388. OPENH264_LDFLAGS="-L$OPENH264_PREFIX/lib"
  1389. AC_MSG_RESULT([Using OpenH264 prefix... $with_openh264])
  1390. else
  1391. OPENH264_CFLAGS=""
  1392. OPENH264_LDFLAGS=""
  1393. fi
  1394. AC_MSG_CHECKING([OpenH264 usability])
  1395. OPENH264_LIBS="-lopenh264 -lstdc++"
  1396. SAVED_LIBS="$LIBS"
  1397. SAVED_LDFLAGS="$LDFLAGS"
  1398. SAVED_CFLAGS="$CFLAGS"
  1399. LIBS="$OPENH264_LIBS $LIBS"
  1400. LDFLAGS="$OPENH264_LDFLAGS $LDFLAGS"
  1401. CFLAGS="$OPENH264_CFLAGS $CFLAGS"
  1402. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wels/codec_api.h>
  1403. #include <wels/codec_app_def.h>
  1404. ]],
  1405. [WelsCreateSVCEncoder(0);]
  1406. )],
  1407. [ ac_openh264_cflags="-DPJMEDIA_HAS_OPENH264_CODEC=1 $OPENH264_CFLAGS"
  1408. ac_openh264_ldflags="$OPENH264_LDFLAGS $OPENH264_LIBS"
  1409. AC_MSG_RESULT(yes)
  1410. ],
  1411. [
  1412. LIBS="$SAVED_LIBS"
  1413. LDFLAGS="$SAVED_LDFLAGS"
  1414. CFLAGS="$SAVED_CFLAGS"
  1415. AC_MSG_RESULT(no)
  1416. ])
  1417. ])
  1418. dnl # VPX alt prefix
  1419. AC_ARG_WITH(vpx,
  1420. AS_HELP_STRING([--with-vpx=DIR],
  1421. [Specify alternate VPX prefix]),
  1422. [],
  1423. [with_vpx=no]
  1424. )
  1425. dnl # Do not use default VPX installation if we are cross-compiling
  1426. if test "x$ac_cross_compile" != "x" -a "x$with_vpx" = "xno"; then
  1427. enable_vpx=no
  1428. fi
  1429. dnl # VPX
  1430. AC_SUBST(ac_vpx_cflags)
  1431. AC_SUBST(ac_vpx_ldflags)
  1432. AC_ARG_ENABLE(vpx,
  1433. AS_HELP_STRING([--disable-vpx],
  1434. [Disable VPX (default: not disabled)]),
  1435. [
  1436. if test "$enable_vpx" = "no"; then
  1437. AC_MSG_RESULT([Checking if VPX is disabled... yes])
  1438. fi
  1439. ],
  1440. [
  1441. if test "x$with_vpx" != "xno" -a "x$with_vpx" != "x"; then
  1442. VPX_PREFIX=$with_vpx
  1443. VPX_CFLAGS="-I$VPX_PREFIX/include"
  1444. VPX_LDFLAGS="-L$VPX_PREFIX/lib"
  1445. AC_MSG_RESULT([Using VPX prefix... $with_vpx])
  1446. else
  1447. VPX_CFLAGS=""
  1448. VPX_LDFLAGS=""
  1449. fi
  1450. AC_MSG_CHECKING([VPX usability])
  1451. VPX_LIBS="-lvpx"
  1452. SAVED_LIBS="$LIBS"
  1453. SAVED_LDFLAGS="$LDFLAGS"
  1454. SAVED_CFLAGS="$CFLAGS"
  1455. LIBS="$VPX_LIBS $LIBS"
  1456. LDFLAGS="$VPX_LDFLAGS $LDFLAGS"
  1457. CFLAGS="$VPX_CFLAGS $CFLAGS"
  1458. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <vpx/vpx_encoder.h>
  1459. #include <vpx/vp8cx.h>
  1460. ]],
  1461. [vpx_codec_iface_t *(*enc_if)() = &vpx_codec_vp8_cx;]
  1462. )],
  1463. [ ac_vpx_cflags="-DPJMEDIA_HAS_VPX_CODEC=1 $VPX_CFLAGS"
  1464. ac_vpx_ldflags="$VPX_LDFLAGS $VPX_LIBS"
  1465. AC_MSG_RESULT(yes)
  1466. ],
  1467. [
  1468. LIBS="$SAVED_LIBS"
  1469. LDFLAGS="$SAVED_LDFLAGS"
  1470. CFLAGS="$SAVED_CFLAGS"
  1471. AC_MSG_RESULT(no)
  1472. ])
  1473. ])
  1474. dnl ########################################################
  1475. dnl # Intel IPP support
  1476. dnl #
  1477. AC_ARG_ENABLE(ipp,
  1478. AS_HELP_STRING([--enable-ipp],
  1479. [Enable Intel IPP support. Specify the Intel IPP package and samples location using IPPROOT and IPPSAMPLES env var or with --with-ipp and --with-ipp-samples options]),
  1480. [],
  1481. [enable_ipp=no]
  1482. )
  1483. AC_ARG_WITH(ipp,
  1484. AS_HELP_STRING([--with-ipp=DIR],
  1485. [Specify the Intel IPP location]),
  1486. [],
  1487. [with_ipp=no]
  1488. )
  1489. AC_ARG_WITH(ipp-samples,
  1490. AS_HELP_STRING([--with-ipp-samples=DIR],
  1491. [Specify the Intel IPP samples location]),
  1492. [],
  1493. [with_ipp_samples=no]
  1494. )
  1495. AC_ARG_WITH(ipp-arch,
  1496. AS_HELP_STRING([--with-ipp-arch=ARCH],
  1497. [Specify the Intel IPP ARCH suffix, e.g. "64" or "em64t. Default is blank for IA32"]),
  1498. [],
  1499. [with_ipp_arch=no]
  1500. )
  1501. if test "x$enable_ipp" != "xno"; then
  1502. dnl #
  1503. dnl # Verifying Intel IPP path
  1504. dnl #
  1505. AC_MSG_CHECKING([Intel IPP location])
  1506. if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
  1507. AC_MSG_RESULT([$with_ipp])
  1508. IPPROOT=$with_ipp
  1509. elif test "x$IPPROOT" = "x"; then
  1510. if test -d /opt/intel/ipp; then
  1511. IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
  1512. AC_MSG_RESULT([autodetected in $IPPROOT])
  1513. fi
  1514. else
  1515. AC_MSG_RESULT([$IPPROOT])
  1516. fi
  1517. if test "x$with_ipp_arch" != "xno"; then
  1518. IPP_SUFFIX=$with_ipp_arch
  1519. AC_MSG_RESULT([IPP arch suffix is set to $IPP_SUFFIX])
  1520. else
  1521. IPP_SUFFIX=""
  1522. AC_MSG_RESULT([IPP arch suffix is set to empty])
  1523. fi
  1524. if test x$IPPROOT = x; then
  1525. AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
  1526. elif test ! -d $IPPROOT; then
  1527. AC_MSG_ERROR([not found])
  1528. elif test ! -d $IPPROOT/include; then
  1529. AC_MSG_ERROR([directory doesn't seem to be valid])
  1530. else
  1531. # IPP directory looks okay.
  1532. # Remove trailing backslash
  1533. IPPROOT=`echo $IPPROOT | sed 's/\/$//'`
  1534. SAVED_CFLAGS="$CFLAGS"
  1535. SAVED_LDFLAGS="$LDFLAGS"
  1536. SAVED_LIBS="$LIBS"
  1537. IPP_CFLAGS="-I$IPPROOT/include"
  1538. IPP_LIBS="-lippsc${IPP_SUFFIX} -lipps${IPP_SUFFIX} -lippcore${IPP_SUFFIX}"
  1539. #
  1540. # Some differences between Mac OS X and Linux
  1541. case $target in
  1542. *darwin* )
  1543. IPP_LDFLAGS="-L$IPPROOT/Libraries -L$IPPROOT/lib"
  1544. ;;
  1545. *)
  1546. # Find out where the libraries live.
  1547. IPP7_ARCH=""
  1548. if test -d $IPPROOT/lib/intel64; then
  1549. IPP7_ARCH="intel64"
  1550. elif test -d $IPPROOT/lib/ia32; then
  1551. IPP7_ARCH="ia32"
  1552. elif test -d $IPPROOT/lib/mic; then
  1553. IPP7_ARCH="mic"
  1554. fi
  1555. if test -z "$IPP7_ARCH"; then
  1556. # IPP6 (and possibly below)
  1557. IPP_LDFLAGS="-L$IPPROOT/sharedlib"
  1558. IPP_LIBS="$IPP_LIBS -lippsr${IPP_SUFFIX} -lguide"
  1559. else
  1560. # IPP7
  1561. if ! test -d $IPPROOT/../compiler; then
  1562. AC_MSG_ERROR([Cannot find $IPPROOT/../compiler directory. Please set IPPROOT variable correctly])
  1563. fi
  1564. IPP_CFLAGS="$IPP_CFLAGS"
  1565. IPP_LDFLAGS="-L$IPPROOT/lib/intel64 -L$IPPROOT/../compiler/lib/$IPP7_ARCH"
  1566. IPP_LIBS="$IPP_LIBS -liomp5"
  1567. fi
  1568. ;;
  1569. esac
  1570. #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
  1571. #Static:
  1572. #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
  1573. CFLAGS="$CFLAGS $IPP_CFLAGS"
  1574. LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
  1575. LIBS="$IPP_LIBS $LIBS"
  1576. AC_MSG_CHECKING([Intel IPP usability])
  1577. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
  1578. ]],
  1579. [ippStaticInit();])],
  1580. [AC_MSG_RESULT(yes)],
  1581. [AC_MSG_FAILURE([Error: unable to recognize your IPP installation. Make sure the paths and ARCH suffix are set correctly, run with --help for more info])])
  1582. CFLAGS="$SAVED_CFLAGS"
  1583. LDFLAGS="$SAVED_LDFLAGS"
  1584. LIBS="$SAVED_LIBS"
  1585. fi
  1586. dnl #
  1587. dnl # Verifying Intel IPP samples path
  1588. dnl #
  1589. AC_MSG_CHECKING([Intel IPP samples location])
  1590. if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
  1591. AC_MSG_RESULT([$with_ipp_samples])
  1592. IPPSAMPLES=$with_ipp_samples
  1593. elif test "x$IPPSAMPLES" = "x"; then
  1594. if test -d /opt/intel/ipp-samples; then
  1595. IPPSAMPLES=/opt/intel/ipp-samples
  1596. AC_MSG_RESULT([autodetected in $IPPSAMPLES])
  1597. fi
  1598. else
  1599. AC_MSG_RESULT([$IPPSAMPLES])
  1600. fi
  1601. if test x$IPPSAMPLES = x; then
  1602. AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
  1603. elif test ! -d $IPPSAMPLES; then
  1604. AC_MSG_ERROR([not found])
  1605. elif test ! -d $IPPSAMPLES/speech-codecs; then
  1606. AC_MSG_ERROR([directory doesn't seem to be valid])
  1607. else
  1608. # Remove trailing backslash
  1609. IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
  1610. # Guess the libusc.a/libspeech.a build location
  1611. AC_MSG_CHECKING([Intel IPP USC build location])
  1612. if test -d $IPPSAMPLES/speech-codecs/bin; then
  1613. IPPVER=5
  1614. IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
  1615. elif test -d $IPPSAMPLES/speech-codecs/_bin; then
  1616. IPPVER=6
  1617. if test -d $IPPSAMPLES/speech-codecs/_bin/*gcc*; then
  1618. # gcc compiler
  1619. IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib | head -1`
  1620. elif test -d $IPPSAMPLES/speech-codecs/_bin/*icc*; then
  1621. # icc compiler
  1622. IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*icc*/lib | head -1`
  1623. else
  1624. AC_MSG_FAILURE([Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?])
  1625. fi
  1626. else
  1627. AC_MSG_FAILURE([unable to find $IPPSAMPLES/speech-codecs/bin/*gcc*/lib or $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib directory. Have you built the samples?])
  1628. fi
  1629. # Test the directory
  1630. if test ! -d $IPPSAMP_DIR; then
  1631. AC_MSG_FAILURE([There's something wrong with this script, directory $IPPSAMP_DIR does not exist])
  1632. exit 1;
  1633. fi
  1634. if test "x$IPPVER" = "x5"; then
  1635. IPPSAMP_LIBS="libusc.a"
  1636. IPPSAMP_LDLIBS="-lusc"
  1637. elif test "x$IPPVER" = "x6"; then
  1638. IPPSAMP_LIBS="libspeech.a"
  1639. IPPSAMP_LDLIBS="-lspeech"
  1640. else
  1641. AC_MSG_FAILURE([bug in this script: unsupported IPP version])
  1642. fi
  1643. if test ! -f $IPPSAMP_DIR/$IPPSAMP_LIBS; then
  1644. AC_MSG_FAILURE([$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR])
  1645. fi
  1646. AC_MSG_RESULT([$IPPSAMP_DIR])
  1647. SAVED_CFLAGS="$CFLAGS"
  1648. SAVED_LDFLAGS="$LDFLAGS"
  1649. SAVED_LIBS="$LIBS"
  1650. IPPSAMP_INC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
  1651. CFLAGS="$CFLAGS $IPPSAMP_INC"
  1652. LDFLAGS="$LDFLAGS -L$IPPSAMP_DIR"
  1653. LIBS="$IPPSAMP_LDLIBS $LIBS"
  1654. AC_MSG_CHECKING([Intel IPP USC usability])
  1655. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
  1656. ]],
  1657. [extern USC_Fxns USC_G729AFP_Fxns;])],
  1658. [AC_MSG_RESULT(yes)],
  1659. [AC_MSG_FAILURE(no)])
  1660. CFLAGS="$SAVED_CFLAGS"
  1661. LDFLAGS="$IPP_LDFLAGS $SAVED_LDFLAGS"
  1662. LIBS="$IPP_LIBS $SAVED_LIBS"
  1663. IPP_CFLAGS="$IPP_CFLAGS $IPPSAMP_INC"
  1664. IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMP_DIR"
  1665. IPP_LIBS="$IPPSAMP_LDLIBS $IPP_LIBS"
  1666. fi
  1667. CFLAGS="$CFLAGS $IPP_CFLAGS"
  1668. LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
  1669. LIBS="$LIBS $IPP_LIBS"
  1670. ac_build_mak_vars="$ac_build_mak_vars\n\
  1671. export IPP_CFLAGS=$IPP_CFLAGS\n\
  1672. export IPP_LDFLAGS=$IPP_LDFLAGS\n\
  1673. export IPP_LIBS=$IPP_LIBS"
  1674. else
  1675. AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
  1676. fi
  1677. dnl # Include Android MediaCodec
  1678. AC_SUBST(ac_no_mediacodec)
  1679. AC_ARG_ENABLE(android-mediacodec,
  1680. AS_HELP_STRING([--disable-android-mediacodec],
  1681. [Exclude Android MediaCodec (default: autodetect)]),
  1682. [if test "$enable_android_mediacodec" = "no"; then
  1683. [ac_no_mediacodec=1]
  1684. AC_MSG_RESULT([Checking if Android MediaCodec support is disabled... yes])
  1685. fi],
  1686. [
  1687. case $target in
  1688. *android*)
  1689. AC_CHECK_LIB(mediandk,AMediaCodec_createDecoderByType,[ac_pjmedia_has_amediacodec=1 && LIBS="-lmediandk $LIBS"])
  1690. if test "x$ac_pjmedia_has_amediacodec" = "x1"; then
  1691. AC_MSG_RESULT([Checking if Android AMediaCodec library is available... yes])
  1692. AC_DEFINE(PJMEDIA_HAS_ANDROID_MEDIACODEC, 1)
  1693. else
  1694. AC_MSG_RESULT([Checking if Android AMediaCodec library is available... no])
  1695. fi
  1696. ;;
  1697. esac
  1698. ])
  1699. dnl ##########################################
  1700. dnl #
  1701. dnl # PJSIP CONFIG
  1702. dnl #
  1703. dnl # SSL alt prefix
  1704. AC_ARG_WITH(ssl,
  1705. AS_HELP_STRING([--with-ssl=DIR],
  1706. [Specify alternate SSL library prefix. This option will try
  1707. to find OpenSSL first, then if not found, GnuTLS. To skip
  1708. OpenSSL finding, use --with-gnutls option instead.]),
  1709. [],
  1710. [with_ssl=no]
  1711. )
  1712. dnl # GnuTLS alt prefix
  1713. AC_ARG_WITH(gnutls,
  1714. AS_HELP_STRING([--with-gnutls=DIR],
  1715. [Specify alternate GnuTLS prefix]),
  1716. [],
  1717. [with_gnutls=no]
  1718. )
  1719. dnl # Do not use default SSL installation if we are cross-compiling
  1720. if test "x$ac_cross_compile" != "x" -a "x$with_ssl" = "xno" -a "x$with_gnutls" = "xno"; then
  1721. enable_ssl=no
  1722. fi
  1723. dnl # Include SSL support
  1724. AC_SUBST(ac_no_ssl)
  1725. AC_SUBST(ac_ssl_has_aes_gcm,0)
  1726. AC_SUBST(ac_ssl_backend)
  1727. AC_ARG_ENABLE(darwin-ssl,
  1728. AS_HELP_STRING([--disable-darwin-ssl],
  1729. [Exclude Darwin SSL (default: autodetect)]),
  1730. [if test "$enable_darwin_ssl" = "no"; then
  1731. AC_MSG_RESULT([Checking if Darwin SSL support is disabled... yes])
  1732. fi],
  1733. [
  1734. case $target in
  1735. *darwin*)
  1736. SAVED_CFLAGS="$CFLAGS"
  1737. CFLAGS="-Werror"
  1738. SAVED_LIBS="$LIBS"
  1739. LIBS="-framework Security"
  1740. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Security/SecureTransport.h>]],
  1741. [if (__builtin_available(macOS 10.12, iOS 10.0, *)) {
  1742. SSLContextRef ssl_ctx;
  1743. SSLReHandshake(ssl_ctx);
  1744. }])],
  1745. [ac_ssl_backend=darwin],)
  1746. CFLAGS="$SAVED_CFLAGS"
  1747. LIBS="$SAVED_LIBS"
  1748. if test "x$ac_ssl_backend" = "xdarwin"; then
  1749. AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
  1750. AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_DARWIN)
  1751. LIBS="$LIBS -framework Security"
  1752. AC_MSG_RESULT([Checking if Darwin SSL is available... yes])
  1753. else
  1754. AC_MSG_RESULT([Checking if Darwin SSL is available... no])
  1755. fi
  1756. ;;
  1757. esac
  1758. ])
  1759. AC_ARG_ENABLE(ssl,
  1760. AS_HELP_STRING([--disable-ssl],
  1761. [Exclude SSL support the build (default: autodetect)])
  1762. ,
  1763. [
  1764. if test "$enable_ssl" = "no"; then
  1765. [ac_no_ssl=1]
  1766. AC_MSG_RESULT([Checking if SSL support is disabled... yes])
  1767. fi
  1768. ],
  1769. [
  1770. if test "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then
  1771. CFLAGS="$CFLAGS -I$with_ssl/include"
  1772. CPPFLAGS="$CPPFLAGS -I$with_ssl/include"
  1773. LDFLAGS="$LDFLAGS -L$with_ssl/lib"
  1774. AC_MSG_RESULT([Using SSL prefix... $with_ssl])
  1775. fi
  1776. if test "x$with_gnutls" = "xno"; then
  1777. # We still need to check for OpenSSL installations even if
  1778. # we find Darwin SSL above since DTLS requires OpenSSL.
  1779. AC_MSG_RESULT([checking for OpenSSL installations..])
  1780. AC_SUBST(openssl_h_present)
  1781. AC_SUBST(libssl_present)
  1782. AC_SUBST(libcrypto_present)
  1783. AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
  1784. AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="-lcrypto $LIBS"], [AC_CHECK_LIB(crypto,ERR_get_error,[libcrypto_present=1 && LIBS="-lcrypto $LIBS"])])
  1785. AC_CHECK_LIB(ssl,SSL_CTX_new,[libssl_present=1 && LIBS="-lssl $LIBS"])
  1786. if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
  1787. AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
  1788. # Check if SRTP should be compiled with OpenSSL
  1789. # support, to enable cryptos such as AES GCM.
  1790. # EVP_CIPHER_CTX is now opaque in OpenSSL 1.1.0, libsrtp 1.5.4 uses it as a transparent type.
  1791. # Update 2.7: our bundled libsrtp has been upgraded to 2.1.0,
  1792. # so we can omit EVP_CIPHER_CTX definition check now.
  1793. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/evp.h>]],
  1794. [EVP_CIPHER_CTX *ctx;EVP_aes_128_gcm();])],
  1795. [AC_CHECK_LIB(crypto,EVP_aes_128_gcm,[ac_ssl_has_aes_gcm=1])])
  1796. if test "x$ac_ssl_has_aes_gcm" = "x1"; then
  1797. AC_MSG_RESULT([OpenSSL has AES GCM support, SRTP will use OpenSSL])
  1798. else
  1799. AC_MSG_RESULT([OpenSSL AES GCM support not found, SRTP will only support AES CM cryptos])
  1800. fi
  1801. if test "x$ac_ssl_backend" = "x"; then
  1802. # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
  1803. #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
  1804. AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
  1805. AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_OPENSSL)
  1806. ac_ssl_backend="openssl"
  1807. fi
  1808. else
  1809. AC_MSG_RESULT([** OpenSSL libraries not found **])
  1810. fi
  1811. fi
  1812. if test "x$ac_ssl_backend" = "x"; then
  1813. if test "x$with_gnutls" != "xno" -a "x$with_gnutls" != "x"; then
  1814. CFLAGS="$CFLAGS -I$with_gnutls/include"
  1815. LDFLAGS="$LDFLAGS -L$with_gnutls/lib"
  1816. AC_MSG_RESULT([Using GnuTLS prefix... $with_gnutls])
  1817. fi
  1818. AC_CHECK_PROGS(PKG_CONFIG,
  1819. $host-pkg-config pkg-config "python pkgconfig.py",
  1820. none)
  1821. AC_MSG_RESULT([checking for GnuTLS installations..])
  1822. AC_SUBST(gnutls_h_present)
  1823. AC_SUBST(libgnutls_present)
  1824. AC_CHECK_HEADER(gnutls/gnutls.h, [gnutls_h_present=1])
  1825. if test "$PKG_CONFIG" != "none"; then
  1826. if $PKG_CONFIG --exists gnutls; then
  1827. LIBS="$LIBS `$PKG_CONFIG --libs gnutls`"
  1828. libgnutls_present=1
  1829. else
  1830. AC_CHECK_LIB(gnutls,
  1831. gnutls_certificate_set_x509_system_trust,
  1832. [libgnutls_present=1 &&
  1833. LIBS="$LIBS -lgnutls"])
  1834. fi
  1835. else
  1836. AC_MSG_RESULT([*** Warning: neither pkg-config nor python is available, disabling gnutls. ***])
  1837. fi
  1838. if test "x$gnutls_h_present" = "x1" -a "x$libgnutls_present" = "x1"; then
  1839. AC_MSG_RESULT([GnuTLS library found, SSL support enabled])
  1840. AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
  1841. AC_DEFINE(PJ_SSL_SOCK_IMP, PJ_SSL_SOCK_IMP_GNUTLS)
  1842. ac_ssl_backend="gnutls"
  1843. else
  1844. AC_MSG_RESULT([** No GnuTLS libraries found, disabling SSL support **])
  1845. fi
  1846. fi
  1847. ])
  1848. dnl # Obsolete option --with-opencore-amrnb
  1849. AC_ARG_WITH(opencore-amrnb,
  1850. AS_HELP_STRING([--with-opencore-amrnb=DIR],
  1851. [This option is obsolete and replaced by --with-opencore-amr=DIR]),
  1852. [AC_MSG_ERROR(This option is obsolete and replaced by --with-opencore-amr=DIR)],
  1853. [true;]
  1854. )
  1855. dnl # opencore-amr alt prefix
  1856. AC_ARG_WITH(opencore-amr,
  1857. AS_HELP_STRING([--with-opencore-amr=DIR],
  1858. [Specify alternate libopencore-amr prefix]),
  1859. [],
  1860. [with_opencore_amr=no]
  1861. )
  1862. dnl # Do not use default opencore-amr installation if we are cross-compiling
  1863. if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amr" = "xno"; then
  1864. enable_opencore_amr=no
  1865. fi
  1866. dnl # vo-amrwbenc alt prefix
  1867. AC_ARG_WITH(opencore-amrwbenc,
  1868. AS_HELP_STRING([--with-opencore-amrwbenc=DIR],
  1869. [Specify alternate libvo-amrwbenc prefix]),
  1870. [],
  1871. [with_opencore_amrwbenc=no]
  1872. )
  1873. dnl # Do not use default vo-amrwbenc installation if we are cross-compiling
  1874. if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amrwbenc" = "xno"; then
  1875. enable_opencore_amrwbenc=no
  1876. fi
  1877. dnl # Include opencore-amr support
  1878. AC_SUBST(ac_no_opencore_amrnb)
  1879. AC_SUBST(ac_no_opencore_amrwb)
  1880. AC_ARG_ENABLE(opencore_amr,
  1881. AS_HELP_STRING([--disable-opencore-amr],
  1882. [Exclude OpenCORE AMR support from the build (default: autodetect)])
  1883. ,
  1884. [
  1885. if test "$enable_opencore_amr" = "no"; then
  1886. [ac_no_opencore_amrnb=1]
  1887. [ac_no_opencore_amrwb=1]
  1888. AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
  1889. AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
  1890. AC_MSG_RESULT([Checking if OpenCORE AMR support is disabled... yes])
  1891. fi
  1892. ],
  1893. [
  1894. AC_MSG_RESULT([checking for OpenCORE AMR installations..])
  1895. if test "x$with_opencore_amr" != "xno" -a "x$with_opencore_amr" != "x"; then
  1896. CFLAGS="$CFLAGS -I$with_opencore_amr/include"
  1897. CPPFLAGS="$CPPFLAGS -I$with_opencore_amr/include"
  1898. LDFLAGS="$LDFLAGS -L$with_opencore_amr/lib"
  1899. AC_MSG_RESULT([Using OpenCORE AMR prefix... $with_opencore_amr])
  1900. fi
  1901. if test "x$with_opencore_amrwbenc" != "xno" -a "x$with_opencore_amrwbenc" != "x"; then
  1902. CFLAGS="$CFLAGS -I$with_opencore_amrwbenc/include"
  1903. CPPFLAGS="$CPPFLAGS -I$with_opencore_amrwbenc/include"
  1904. LDFLAGS="$LDFLAGS -L$with_opencore_amrwbenc/lib"
  1905. AC_MSG_RESULT([Using OpenCORE AMRWB-enc prefix... $with_opencore_amrwbenc])
  1906. fi
  1907. AC_SUBST(opencore_amrnb_h_present)
  1908. AC_SUBST(opencore_amrnb_present)
  1909. AC_CHECK_HEADER(opencore-amrnb/interf_enc.h,[opencore_amrnb_h_present=1])
  1910. AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1 && LIBS="$LIBS -lopencore-amrnb"])
  1911. if test "x$opencore_amrnb_h_present" = "x1" -a "x$opencore_amrnb_present" = "x1"; then
  1912. AC_MSG_RESULT([OpenCORE AMR-NB library found, AMR-NB support enabled])
  1913. AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,1)
  1914. else
  1915. [ac_no_opencore_amrnb=1]
  1916. AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
  1917. fi
  1918. AC_SUBST(opencore_amrwb_enc_h_present)
  1919. AC_SUBST(opencore_amrwb_enc_present)
  1920. AC_SUBST(opencore_amrwb_dec_h_present)
  1921. AC_SUBST(opencore_amrwb_dec_present)
  1922. AC_CHECK_HEADER(vo-amrwbenc/enc_if.h,[opencore_amrwb_enc_h_present=1])
  1923. AC_CHECK_HEADER(opencore-amrwb/dec_if.h,[opencore_amrwb_dec_h_present=1])
  1924. AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"])
  1925. AC_CHECK_LIB(vo-amrwbenc,E_IF_init,[opencore_amrwb_enc_present=1 && LIBS="$LIBS -lvo-amrwbenc"])
  1926. if test "x$opencore_amrwb_enc_h_present" = "x1" -a "x$opencore_amrwb_dec_h_present" = "x1" -a "x$opencore_amrwb_enc_present" = "x1" -a "x$opencore_amrwb_dec_present" = "x1"; then
  1927. AC_MSG_RESULT([OpenCORE AMR-WB library found, AMR-WB support enabled])
  1928. AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,1)
  1929. else
  1930. [ac_no_opencore_amrwb=1]
  1931. AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
  1932. fi
  1933. ])
  1934. dnl # SILK prefix
  1935. AC_ARG_WITH(silk,
  1936. AS_HELP_STRING([--with-silk=DIR],
  1937. [Specify alternate SILK prefix]),
  1938. [],
  1939. [with_silk=no]
  1940. )
  1941. dnl # Do not use default SILK installation if we are cross-compiling
  1942. if test "x$ac_cross_compile" != "x" -a "x$with_silk" = "xno"; then
  1943. enable_silk=no
  1944. fi
  1945. dnl # Include SILK support
  1946. AC_SUBST(ac_no_silk)
  1947. AC_ARG_ENABLE(silk,
  1948. AS_HELP_STRING([--disable-silk],
  1949. [Exclude SILK support from the build (default: autodetect)])
  1950. ,
  1951. [
  1952. if test "$enable_silk" = "no"; then
  1953. [ac_no_silk=1]
  1954. AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
  1955. AC_MSG_RESULT([Checking if SILK support is disabled... yes])
  1956. fi
  1957. ],
  1958. [
  1959. AC_MSG_RESULT([checking for SILK installations..])
  1960. if test "x$with_silk" != "xno" -a "x$with_silk" != "x"; then
  1961. CFLAGS="$CFLAGS -I$with_silk/interface"
  1962. CPPFLAGS="$CPPFLAGS -I$with_silk/interface"
  1963. LDFLAGS="$LDFLAGS -L$with_silk"
  1964. AC_MSG_RESULT([Using SILK prefix... $with_silk])
  1965. fi
  1966. AC_SUBST(silk_h_present)
  1967. AC_SUBST(silk_present)
  1968. AC_CHECK_HEADER(SKP_Silk_SDK_API.h,[silk_h_present=1])
  1969. AC_CHECK_LIB(SKP_SILK_SDK,SKP_Silk_SDK_get_version,[silk_present=1 && LIBS="$LIBS -lSKP_SILK_SDK"])
  1970. if test "x$silk_h_present" = "x1" -a "x$silk_present" = "x1"; then
  1971. AC_MSG_RESULT([SILK library found, SILK support enabled])
  1972. AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,1)
  1973. else
  1974. [ac_no_silk=1]
  1975. AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
  1976. fi
  1977. ])
  1978. dnl # Do not use default OPUS installation if we are cross-compiling
  1979. if test "x$ac_cross_compile" != "x" -a "x$with_opus" = "xno"; then
  1980. enable_opus=no
  1981. fi
  1982. dnl # OPUS prefix
  1983. AC_ARG_WITH(opus,
  1984. AS_HELP_STRING([--with-opus=DIR],
  1985. [Specify alternate OPUS prefix]),
  1986. [],
  1987. [with_opus=no]
  1988. )
  1989. dnl # Include OPUS support
  1990. AC_SUBST(ac_no_opus)
  1991. AC_ARG_ENABLE(opus,
  1992. AS_HELP_STRING([--disable-opus],
  1993. [Exclude OPUS support from the build (default: autodetect)])
  1994. ,
  1995. [
  1996. if test "$enable_opus" = "no"; then
  1997. [ac_no_opus=1]
  1998. AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,0)
  1999. AC_MSG_RESULT([Checking if OPUS support is disabled... yes])
  2000. fi
  2001. ],
  2002. [
  2003. AC_MSG_RESULT([checking for OPUS installations..])
  2004. if test "x$with_opus" != "xno" -a "x$with_opus" != "x"; then
  2005. CFLAGS="$CFLAGS -I$with_opus/include"
  2006. CPPFLAGS="$CPPFLAGS -I$with_opus/include"
  2007. LDFLAGS="$LDFLAGS -L$with_opus/lib"
  2008. AC_MSG_RESULT([Using OPUS prefix... $with_opus])
  2009. fi
  2010. AC_SUBST(opus_h_present)
  2011. AC_SUBST(opus_present)
  2012. AC_CHECK_HEADER(opus/opus.h,[opus_h_present=1])
  2013. AC_CHECK_LIB(opus,opus_repacketizer_get_size,[opus_present=1 && LIBS="-lopus $LIBS"])
  2014. if test "x$opus_h_present" = "x1" -a "x$opus_present" = "x1"; then
  2015. AC_MSG_RESULT([OPUS library found, OPUS support enabled])
  2016. AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,1)
  2017. else
  2018. [ac_no_opus=1]
  2019. AC_MSG_RESULT([OPUS library not found, OPUS support disabled])
  2020. AC_DEFINE(PJMEDIA_HAS_OPUS_CODEC,0)
  2021. fi
  2022. ])
  2023. dnl # bcg729 prefix
  2024. AC_ARG_WITH(bcg729,
  2025. AS_HELP_STRING([--with-bcg729=DIR],
  2026. [Specify alternate bcg729 prefix]),
  2027. [],
  2028. [with_bcg729=no]
  2029. )
  2030. dnl # Do not use default bcg729 installation if we are cross-compiling
  2031. if test "x$ac_cross_compile" != "x" -a "x$with_bcg729" = "xno"; then
  2032. enable_bcg729=no
  2033. fi
  2034. dnl # bcg729
  2035. AC_SUBST(ac_no_bcg729)
  2036. AC_ARG_ENABLE(bcg729,
  2037. AS_HELP_STRING([--disable-bcg729],
  2038. [Disable bcg729 (default: not disabled)]),
  2039. [
  2040. if test "$enable_bcg729" = "no"; then
  2041. [ac_no_bcg729=1]
  2042. AC_DEFINE(PJMEDIA_HAS_BCG729,0)
  2043. AC_MSG_RESULT([Checking if bcg729 is disabled... yes])
  2044. fi
  2045. ],
  2046. [
  2047. if test "x$with_bcg729" != "xno" -a "x$with_bcg729" != "x"; then
  2048. BCG729_PREFIX=$with_bcg729
  2049. BCG729_CFLAGS="-I$BCG729_PREFIX/include"
  2050. BCG729_LDFLAGS="-L$BCG729_PREFIX/lib"
  2051. AC_MSG_RESULT([Using bcg729 prefix... $with_bcg729])
  2052. else
  2053. BCG729_CFLAGS=""
  2054. BCG729_LDFLAGS=""
  2055. fi
  2056. AC_MSG_CHECKING([bcg729 usability])
  2057. BCG729_LIBS="-lbcg729"
  2058. SAVED_LIBS="$LIBS"
  2059. SAVED_LDFLAGS="$LDFLAGS"
  2060. SAVED_CFLAGS="$CFLAGS"
  2061. LIBS="$BCG729_LIBS $LIBS"
  2062. LDFLAGS="$BCG729_LDFLAGS $LDFLAGS"
  2063. CFLAGS="$BCG729_CFLAGS $CFLAGS"
  2064. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <bcg729/encoder.h>
  2065. #include <bcg729/decoder.h>
  2066. ]],
  2067. [initBcg729EncoderChannel(0);]
  2068. )],
  2069. [
  2070. AC_DEFINE(PJMEDIA_HAS_BCG729,1)
  2071. AC_MSG_RESULT(yes)
  2072. ],
  2073. [
  2074. [ac_no_bcg729=1]
  2075. AC_DEFINE(PJMEDIA_HAS_BCG729,0)
  2076. LIBS="$SAVED_LIBS"
  2077. LDFLAGS="$SAVED_LDFLAGS"
  2078. CFLAGS="$SAVED_CFLAGS"
  2079. AC_MSG_RESULT(no)
  2080. ])
  2081. ])
  2082. dnl # lyra prefix
  2083. AC_ARG_WITH(lyra,
  2084. AS_HELP_STRING([--with-lyra=DIR],
  2085. [Specify alternate lyra prefix]),
  2086. [],
  2087. [with_lyra=no]
  2088. )
  2089. dnl # Do not use default lyra installation if we are cross-compiling
  2090. if test "x$ac_cross_compile" != "x" -a "x$with_lyra" = "xno"; then
  2091. enable_lyra=no
  2092. fi
  2093. dnl # lyra
  2094. AC_SUBST(ac_no_lyra_codec)
  2095. AC_SUBST(ac_lyra_model_path)
  2096. AC_ARG_ENABLE(lyra,
  2097. AS_HELP_STRING([--disable-lyra],
  2098. [Disable lyra (default: not disabled)]),
  2099. [
  2100. if test "$enable_lyra" = "no"; then
  2101. [ac_no_lyra_codec=1]
  2102. AC_DEFINE(PJMEDIA_HAS_LYRA_CODEC,0)
  2103. AC_MSG_RESULT([Checking if lyra is disabled... yes])
  2104. fi
  2105. ],
  2106. [
  2107. if test "x$with_lyra" != "xno" -a "x$with_lyra" != "x"; then
  2108. LYRA_PREFIX=$with_lyra
  2109. dnl # inside autoconf, single quoted preprocessor definition will raise error
  2110. LYRA_CPPFLAGS="-DGLOG_DEPRECATED=__attribute__((deprecated)) -DGLOG_EXPORT=__attribute__((visibility(\"default\"))) -DGLOG_NO_EXPORT=__attribute__((visibility(\"default\")))"
  2111. LYRA_CXXFLAGS="-std=c++17 -Wno-deprecated-builtins -I$LYRA_PREFIX/include/com_google_absl -I$LYRA_PREFIX/include/gulrak_filesystem -I$LYRA_PREFIX/include/com_google_glog/src -I$LYRA_PREFIX"
  2112. LYRA_LDFLAGS="-L$LYRA_PREFIX/lib"
  2113. AC_MSG_RESULT([Using lyra prefix... $with_lyra])
  2114. else
  2115. LYRA_CXXFLAGS=""
  2116. LYRA_LDFLAGS=""
  2117. fi
  2118. AC_MSG_CHECKING([lyra usability])
  2119. LYRA_LIBS="-llyra"
  2120. SAVED_LIBS="$LIBS"
  2121. SAVED_LDFLAGS="$LDFLAGS"
  2122. SAVED_CXXFLAGS="$CXXFLAGS"
  2123. SAVED_CPPFLAGS="$CPPFLAGS"
  2124. LIBS="$LYRA_LIBS $LIBS"
  2125. LDFLAGS="$LYRA_LDFLAGS $LDFLAGS"
  2126. CXXFLAGS="$LYRA_CXXFLAGS $CXXFLAGS"
  2127. CPPFLAGS="$LYRA_CPPFLAGS $CPPFLAGS"
  2128. AC_LANG_PUSH([C++])
  2129. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "lyra_decoder.h"
  2130. ]],
  2131. [std::unique_ptr<chromemedia::codec::LyraDecoder> dec = chromemedia::codec::LyraDecoder::Create(8000,1,"");]
  2132. )],
  2133. [
  2134. [ac_lyra_model_path="$LYRA_PREFIX/model_coeffs"]
  2135. AC_DEFINE(PJMEDIA_HAS_LYRA_CODEC,1)
  2136. dnl # use single quoted preprocessor definition
  2137. LYRA_CPPFLAGS="'-DGLOG_DEPRECATED=__attribute__((deprecated))' '-DGLOG_EXPORT=__attribute__((visibility(\"default\")))' '-DGLOG_NO_EXPORT=__attribute__((visibility(\"default\")))'"
  2138. CXXFLAGS="$LYRA_CPPFLAGS $CXXFLAGS"
  2139. AC_MSG_RESULT(yes)
  2140. ],
  2141. [
  2142. [ac_no_lyra_codec=1]
  2143. LIBS="$SAVED_LIBS"
  2144. LDFLAGS="$SAVED_LDFLAGS"
  2145. CXXFLAGS="$SAVED_CXXFLAGS"
  2146. AC_MSG_RESULT(no)
  2147. ])
  2148. AC_LANG_POP([C++])
  2149. CPPFLAGS="$SAVED_CPPFLAGS"
  2150. ])
  2151. dnl # Include libsrtp
  2152. AC_SUBST(ac_no_srtp)
  2153. AC_ARG_ENABLE(libsrtp,
  2154. AS_HELP_STRING([--disable-libsrtp],
  2155. [Exclude libsrtp in the build]),
  2156. [if test "$enable_libsrtp" = "no"; then
  2157. [ac_no_srtp=1]
  2158. CFLAGS="$CFLAGS -DPJMEDIA_HAS_SRTP=0"
  2159. AC_MSG_RESULT([Checking if libsrtp is disabled...yes])
  2160. fi],
  2161. AC_MSG_RESULT([Checking if libsrtp is disabled...no]))
  2162. dnl # Include libyuv
  2163. AC_SUBST(ac_no_yuv)
  2164. AC_ARG_ENABLE(libyuv,
  2165. AS_HELP_STRING([--disable-libyuv],
  2166. [Exclude libyuv in the build]),
  2167. [if test "$enable_libyuv" = "no"; then
  2168. [ac_no_yuv=1]
  2169. AC_DEFINE(PJMEDIA_HAS_LIBYUV,0)
  2170. AC_MSG_RESULT([Checking if libyuv is disabled...yes])
  2171. fi],
  2172. AC_MSG_RESULT([Checking if libyuv is disabled...no]))
  2173. dnl # Include webrtc
  2174. AC_SUBST(ac_no_webrtc)
  2175. AC_SUBST(ac_webrtc_instset)
  2176. AC_SUBST(ac_webrtc_cflags)
  2177. AC_SUBST(ac_webrtc_ldflags)
  2178. AC_ARG_ENABLE(libwebrtc,
  2179. AS_HELP_STRING([--disable-libwebrtc],
  2180. [Exclude libwebrtc in the build]),
  2181. [if test "$enable_libwebrtc" = "no"; then
  2182. [ac_no_webrtc=1]
  2183. AC_DEFINE(PJMEDIA_HAS_LIBWEBRTC,0)
  2184. AC_MSG_RESULT([Checking if libwebrtc is disabled...yes])
  2185. fi],
  2186. [
  2187. AC_MSG_RESULT([Checking if libwebrtc is disabled...no])
  2188. case $target in
  2189. *-apple-darwin_ios*)
  2190. case $target in
  2191. arm64*)
  2192. ac_webrtc_instset=neon
  2193. ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64"
  2194. ;;
  2195. *arm*)
  2196. ac_webrtc_instset=neon
  2197. ;;
  2198. *)
  2199. ac_webrtc_instset=sse2
  2200. ;;
  2201. esac
  2202. ;;
  2203. *android*)
  2204. case $TARGET_ABI in
  2205. armeabi-v7a)
  2206. ac_webrtc_instset=neon
  2207. ac_webrtc_cflags="-mfloat-abi=softfp -mfpu=neon"
  2208. ;;
  2209. armeabi)
  2210. ac_webrtc_instset=neon
  2211. ac_webrtc_cflags="-mthumb -mfloat-abi=softfp -mfpu=neon -march=armv7"
  2212. ;;
  2213. arm64*)
  2214. ac_webrtc_instset=neon
  2215. ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64"
  2216. ;;
  2217. mips64*)
  2218. ac_webrtc_instset=generic
  2219. ;;
  2220. mips*)
  2221. ac_webrtc_instset=mips
  2222. ;;
  2223. x86*)
  2224. ac_webrtc_instset=sse2
  2225. ;;
  2226. *)
  2227. ac_webrtc_instset=generic
  2228. ;;
  2229. esac
  2230. ;;
  2231. *mingw* | *cygw*)
  2232. ac_webrtc_instset=sse2
  2233. ac_webrtc_cflags="-msse2"
  2234. ;;
  2235. *win32* | *w32* | *darwin* | *linux*)
  2236. case $target in
  2237. armv7l*gnueabihf)
  2238. ac_webrtc_instset=neon
  2239. ac_webrtc_cflags="-DWEBRTC_ARCH_ARM_V7 -mfloat-abi=hard -mfpu=neon"
  2240. ;;
  2241. arm-apple-darwin* | aarch64*)
  2242. ac_webrtc_instset=neon
  2243. ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64"
  2244. ;;
  2245. *)
  2246. ac_webrtc_instset=sse2
  2247. ;;
  2248. esac
  2249. ;;
  2250. *)
  2251. ;;
  2252. esac
  2253. ])
  2254. dnl # Include webrtc AEC3
  2255. AC_SUBST(ac_no_webrtc_aec3)
  2256. AC_SUBST(ac_webrtc_aec3_instset)
  2257. AC_SUBST(ac_webrtc_aec3_cflags)
  2258. AC_SUBST(ac_webrtc_aec3_ldflags)
  2259. AC_ARG_ENABLE(libwebrtc_aec3,
  2260. AS_HELP_STRING([--enable-libwebrtc-aec3],
  2261. [Build libwebrtc-aec3 that's included in PJSIP]),
  2262. [
  2263. if test "$enable_libwebrtc_aec3" = "yes"; then
  2264. # Test if we can build WebRtc AEC3
  2265. AC_MSG_CHECKING([if WebRtc AEC3 can be compiled with C++17])
  2266. SAVED_CXXFLAGS="$CXXFLAGS"
  2267. CXXFLAGS="$CXXFLAGS -std=c++17"
  2268. AC_LANG_PUSH([C++])
  2269. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],
  2270. [AC_MSG_RESULT(yes)
  2271. LD="$CXX"],
  2272. [AC_MSG_RESULT(no)
  2273. CXXFLAGS="$SAVED_CXXFLAGS"
  2274. ac_no_webrtc_aec3=1
  2275. AC_DEFINE(PJMEDIA_HAS_LIBWEBRTC_AEC3,0)])
  2276. AC_LANG_POP([C++])
  2277. case $target in
  2278. *-apple-darwin_ios*)
  2279. case $target in
  2280. arm64*)
  2281. ac_webrtc_aec3_instset=neon
  2282. ac_webrtc_aec3_cflags="-DWEBRTC_ARCH_ARM64"
  2283. ;;
  2284. *arm*)
  2285. ac_webrtc_aec3_instset=neon
  2286. ;;
  2287. *)
  2288. ac_webrtc_aec3_instset=sse2
  2289. ;;
  2290. esac
  2291. ac_webrtc_aec3_cflags+=" -DWEBRTC_IOS=1"
  2292. ;;
  2293. *android*)
  2294. case $TARGET_ABI in
  2295. armeabi-v7a)
  2296. ac_webrtc_aec3_instset=neon
  2297. ac_webrtc_aec3_cflags="-mfloat-abi=softfp -mfpu=neon"
  2298. ;;
  2299. armeabi)
  2300. ac_webrtc_aec3_instset=neon
  2301. ac_webrtc_aec3_cflags="-mthumb -mfloat-abi=softfp -mfpu=neon -march=armv7"
  2302. ;;
  2303. arm64*)
  2304. ac_webrtc_aec3_instset=neon
  2305. ac_webrtc_aec3_cflags="-DWEBRTC_ARCH_ARM64"
  2306. ;;
  2307. x86*)
  2308. ac_webrtc_aec3_instset=sse2
  2309. ;;
  2310. esac
  2311. ac_webrtc_aec3_cflags+=" -DWEBRTC_ANDROID=1"
  2312. ;;
  2313. *mingw* | *cygw*)
  2314. ac_webrtc_aec3_instset=sse2
  2315. ac_webrtc_aec3_cflags="-msse2"
  2316. ;;
  2317. *win32* | *w32* | *darwin* | *linux*)
  2318. case $target in
  2319. armv7l*gnueabihf)
  2320. ac_webrtc_aec3_instset=neon
  2321. ac_webrtc_aec3_cflags="-DWEBRTC_ARCH_ARM_V7 -mfloat-abi=hard -mfpu=neon"
  2322. ;;
  2323. arm-apple-darwin* | aarch64*)
  2324. ac_webrtc_aec3_instset=neon
  2325. ac_webrtc_aec3_cflags="-DWEBRTC_ARCH_ARM64"
  2326. ;;
  2327. *)
  2328. ac_webrtc_aec3_instset=sse2
  2329. ;;
  2330. esac
  2331. case $target in
  2332. *darwin*)
  2333. ac_webrtc_aec3_cflags+=" -DWEBRTC_MAC=1"
  2334. ;;
  2335. *linux*)
  2336. ac_webrtc_aec3_cflags+=" -DWEBRTC_LINUX=1"
  2337. ;;
  2338. esac
  2339. ;;
  2340. *)
  2341. ;;
  2342. esac
  2343. ac_webrtc_aec3_cflags+=" -DWEBRTC_APM_DEBUG_DUMP=0 -DWEBRTC_POSIX=1"
  2344. else
  2345. ac_no_webrtc_aec3=1
  2346. AC_DEFINE(PJMEDIA_HAS_LIBWEBRTC_AEC3,0)
  2347. AC_MSG_RESULT([Checking if libwebrtc-aec3 is enabled...no])
  2348. fi
  2349. ],
  2350. [ac_no_webrtc_aec3=1
  2351. AC_DEFINE(PJMEDIA_HAS_LIBWEBRTC_AEC3,0)
  2352. AC_MSG_RESULT([Checking if libwebrtc-aec3 is enabled...no])
  2353. ])
  2354. dnl ##########################################
  2355. dnl #
  2356. dnl # MANUAL CONFIG
  2357. dnl #
  2358. dnl # Determine if select() requires nfds to be filled up with
  2359. dnl # correct value (max_fd+1). If zero, nfds will be filled up with
  2360. dnl # PJ_FD_SETSIZE
  2361. AC_MSG_CHECKING([if select() needs correct nfds])
  2362. case $target in
  2363. *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
  2364. AC_MSG_RESULT(yes)
  2365. ;;
  2366. *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
  2367. AC_MSG_RESULT([no (default)])
  2368. AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
  2369. ;;
  2370. esac
  2371. dnl # Determine if pj_thread_create() should enforce thread stack size when
  2372. dnl # creating thread. Default is zero, to allow OS to allocate appropriate
  2373. dnl # thread's stack size.
  2374. AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
  2375. case $target in
  2376. *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
  2377. AC_MSG_RESULT(yes)
  2378. ;;
  2379. *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
  2380. AC_MSG_RESULT([no (default)])
  2381. ;;
  2382. esac
  2383. dnl # Determine if pj_thread_create() should allocate thread's stack from
  2384. dnl # the pool. Default is zero, to let OS allocate thread's stack.
  2385. AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
  2386. case $target in
  2387. *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
  2388. AC_MSG_RESULT(yes)
  2389. ;;
  2390. *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
  2391. AC_MSG_RESULT([no (default)])
  2392. ;;
  2393. esac
  2394. dnl # This value specifies the value set in errno by the OS when a non-blocking
  2395. dnl # socket recv() can not return immediate data.
  2396. case $target in
  2397. *mingw* | *cygw* | *win32* | *w32* )
  2398. AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
  2399. ;;
  2400. *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
  2401. AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
  2402. ;;
  2403. esac
  2404. dnl # This value specifies the value set in errno by the OS when a non-blocking
  2405. dnl # socket connect() can not get connected immediately.
  2406. case $target in
  2407. *mingw* | *cygw* | *win32* | *w32* )
  2408. AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
  2409. ;;
  2410. *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
  2411. AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
  2412. ;;
  2413. esac
  2414. dnl
  2415. dnl # Find set thread display name function
  2416. dnl # pthread_setname_np() in pthread.h on linux/darwin
  2417. dnl # pthread_setname_np()/pthread_set_name_np() in pthread_np.h on bsd
  2418. dnl
  2419. case $target in
  2420. *linux* | *darwin* | *bsd*)
  2421. AC_CHECK_HEADER(pthread_np.h,[AC_DEFINE(PJ_HAS_PTHREAD_NP_H,1)])
  2422. AC_CHECK_FUNC(pthread_setname_np,[AC_DEFINE(PJ_HAS_PTHREAD_SETNAME_NP,1)])
  2423. AC_CHECK_FUNC(pthread_set_name_np,[AC_DEFINE(PJ_HAS_PTHREAD_SET_NAME_NP,1)])
  2424. ;;
  2425. esac
  2426. AC_SUBST(target)
  2427. AC_SUBST(ac_host,unix)
  2428. AC_SUBST(ac_main_obj)
  2429. case $target in
  2430. *rtems*)
  2431. ac_main_obj=main_rtems.o
  2432. ;;
  2433. *)
  2434. ac_main_obj=main.o
  2435. ;;
  2436. esac
  2437. AC_SUBST(CC)
  2438. ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
  2439. AC_OUTPUT
  2440. AC_MSG_RESULT([
  2441. Configurations for current target have been written to 'build.mak', and 'os-auto.mak' in various build directories, and pjlib/include/pj/compat/os_auto.h.
  2442. Further customizations can be put in:
  2443. - 'user.mak'
  2444. - 'pjlib/include/pj/config_site.h'
  2445. The next step now is to run 'make dep' and 'make'.
  2446. ])