Debian Codegraph @

Xpjproject/aconfigure.ac

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