blob: 20467f2cbc2bf1837a6ff37326d73c84096f6cb0 [file] [log] [blame]
Alexandre Lision67916dd2014-01-24 13:33:04 -05001AC_INIT(pjproject,2.x)
2
3host_orig="$host"
4
5AC_CANONICAL_BUILD
6AC_CANONICAL_HOST
7AC_CANONICAL_TARGET
8AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h
9 pjlib/include/pj/compat/m_auto.h
10 pjmedia/include/pjmedia/config_auto.h
11 pjmedia/include/pjmedia-codec/config_auto.h
12 pjsip/include/pjsip/sip_autoconf.h
13 ])
14AC_CONFIG_FILES([build.mak
15 build/os-auto.mak
16 build/cc-auto.mak
17 pjlib/build/os-auto.mak
18 pjlib-util/build/os-auto.mak
19 pjmedia/build/os-auto.mak
20 pjsip/build/os-auto.mak
21 third_party/build/os-auto.mak
22 third_party/build/portaudio/os-auto.mak
23 ])
24
25
26dnl
27dnl Setup default CFLAGS
28dnl
29if test "$CFLAGS" = ""; then
30 CFLAGS="-O2"
31else
32 CFLAGS="$CFLAGS"
33fi
34
35CXXFLAGS="$CFLAGS $CXXFLAGS"
36
37dnl #
38dnl # Configure tools
39dnl #
40AC_PROG_CC
41AC_PROG_CXX
42AC_LANG_C
43
44AC_PROG_RANLIB
45AC_CHECK_TOOLS([AR], [ar gar], :)
46
47if test "$AR_FLAGS" = ""; then AR_FLAGS="rv"; fi
48AC_SUBST(AR_FLAGS)
49if test "$LD" = ""; then LD="$CC"; fi
50AC_SUBST(LD)
51if test "$LDOUT" = ""; then LDOUT="-o "; fi
52AC_SUBST(LDOUT)
53if test "$OBJEXT" = ""; then OBJEXT='o'; fi
54AC_SUBST(OBJEXT)
55if test "$LIBEXT" = ""; then LIBEXT='a'; fi
56AC_SUBST(LIBEXT)
57if test "$LIBEXT2" = ""; then LIBEXT2=""; fi
58AC_SUBST(LIBEXT2)
59if test "$CC_OUT" = ""; then CC_OUT="-o "; fi
60AC_SUBST(CC_OUT)
61if test "$CC_INC" = ""; then CC_INC="-I"; fi
62AC_SUBST(CC_INC)
63if test "$CC_DEF" = ""; then CC_DEF="-D"; fi
64AC_SUBST(CC_DEF)
65if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi
66AC_SUBST(CC_OPTIMIZE)
67if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
68AC_SUBST(CC_CFLAGS)
69
70
71
72AC_SUBST(ac_pjdir)
73AC_SUBST(ac_build_mak_vars)
74
75case $host in
76 *mingw* | *cygw* | *win32* | *w32* )
77 if pwd -W 2&> /dev/null; then
78 ac_pjdir=`pwd -W`
79 else
80 # We're probably cross-compiling mingw on Linux
81 ac_pjdir=`pwd`
82 fi
83 ;;
84 *)
85 ac_pjdir=`pwd`
86 ;;
87esac
88
89AC_SUBST(ac_shlib_suffix)
90case $target in
91 *mingw* | *cygw* | *win32* | *w32* )
92 ac_shlib_suffix=dll
93 ;;
94 *darwin*)
95 ac_shlib_suffix=dylib
96 ;;
97 *)
98 ac_shlib_suffix=so
99 ;;
100esac
101
102AC_SUBST(ac_cross_compile)
103if test "$build" = "$host"; then
104 ac_cross_compile=
105else
106 ac_cross_compile=${host_orig}-
107fi
108
109AC_CHECK_LIB(pthread,pthread_create)
110AC_CHECK_LIB(wsock32,puts)
111AC_CHECK_LIB(ws2_32,puts)
112AC_CHECK_LIB(ole32,puts)
113AC_CHECK_LIB(winmm,puts)
114AC_CHECK_LIB(socket,puts)
115AC_CHECK_LIB(rt,puts)
116AC_CHECK_LIB(nsl,puts)
117AC_CHECK_LIB(m,sin)
118AC_CHECK_LIB(uuid,uuid_generate)
119AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
120
121AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
122AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
123
124dnl
125dnl Memory alignment detection
126dnl
127AC_MSG_CHECKING([memory alignment])
128case $target in
129 sparc64-* | ia64-* | x86_64-* )
130 AC_DEFINE(PJ_POOL_ALIGNMENT, 8)
131 AC_MSG_RESULT([8 bytes])
132 ;;
133 * )
134 AC_DEFINE(PJ_POOL_ALIGNMENT, 4)
135 AC_MSG_RESULT([4 bytes (default)])
136 ;;
137esac
138
139
140dnl
141dnl Endianness detection
142dnl
143AC_C_BIGENDIAN
144
145if test "x$ac_cv_c_bigendian" = "xyes"; then
146 CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
147else
148 CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
149fi
150
151dnl
152dnl Legacy macros
153dnl
154case $target in
155 *android*)
156 AC_DEFINE(PJ_ANDROID,1)
157 ;;
158 *mingw* | *cygw* | *win32* | *w32* )
159 AC_DEFINE(PJ_WIN32,1)
160 AC_DEFINE(PJ_WIN32_WINNT,0x0400)
161 AC_DEFINE(WIN32_LEAN_AND_MEAN)
162 ;;
163 *darwin*)
164 AC_DEFINE(PJ_DARWINOS,1)
165 ;;
166 *linux*)
167 AC_DEFINE(PJ_LINUX,1)
168 ;;
169 *rtems*)
170 AC_DEFINE(PJ_RTEMS,1)
171 ;;
172 *sunos* | *solaris* )
173 AC_DEFINE(PJ_SUNOS,1)
174 ;;
175 *)
176 ;;
177esac
178
179
180
181
182dnl # --disable-floating-point option
183AC_ARG_ENABLE(floating-point,
184 AC_HELP_STRING([--disable-floating-point],
185 [Disable floating point where possible]),
186 [if test "$enable_floating_point" = "no"; then
187 AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
188 AC_MSG_RESULT([Checking if floating point is disabled... yes])
189 fi],
190 [
191 AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
192 AC_MSG_RESULT([Checking if floating point is disabled... no])
193 ])
194
195
196AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
197AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
198AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
199
200case $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 ;;
207esac
208
209AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)])
210AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
211AC_CHECK_HEADER(limits.h,[AC_DEFINE(PJ_HAS_LIMITS_H,1)])
212AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
213AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
214AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
215AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
216AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
217 [#if PJ_HAS_SYS_TYPES_H
218 # include <sys/types.h>
219 #endif
220 #if PJ_HAS_NETINET_IN_SYSTM_H
221 # include <netinet/in_systm.h>
222 #endif
223 #if PJ_HAS_NETINET_IN_H
224 # include <netinet/in.h>
225 #endif
226 ])
227AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
228AC_CHECK_HEADER(ifaddrs.h,
229 [AC_CHECK_FUNC(getifaddrs,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])])
230AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)])
231AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
232AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
233AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
234AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
235AC_CHECK_HEADER(stdint.h,[AC_DEFINE(PJ_HAS_STDINT_H,1)])
236AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
237AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
238AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
239AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
240AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
241AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
242AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
243AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
244AC_CHECK_HEADER(sys/filio.h,[AC_DEFINE(PJ_HAS_SYS_FILIO_H,1)])
245AC_CHECK_HEADER(sys/sockio.h,[AC_DEFINE(PJ_HAS_SYS_SOCKIO_H,1)])
246AC_CHECK_HEADER(sys/utsname.h,[AC_DEFINE(PJ_HAS_SYS_UTSNAME_H,1)])
247AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
248AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
249AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
250AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
251AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
252 [#if PJ_HAS_WINSOCK2_H
253 # include <winsock2.h>
254 #elif PJ_HAS_WINSOCK_H
255 # include <winsock.h>
256 #endif
257 ])
258AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
259AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
260AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
261 [#if PJ_HAS_SYS_TYPES_H
262 # include <sys/types.h>
263 #endif
264 #if PJ_HAS_SYS_SOCKET_H
265
266 # include <sys/socket.h>
267 #endif
268 ])
269AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
270AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
271
272AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
273AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
274
275AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
276AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
277
278AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
279AC_DEFINE(PJ_HAS_MALLOC,1)
280
281AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
282AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
283
284AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
285AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
286
287dnl # Determine if inet_aton() is available
288AC_MSG_CHECKING([if inet_aton() is available])
289AC_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
297dnl # Determine if inet_pton() is available
298AC_MSG_CHECKING([if inet_pton() is available])
299AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
300 #include <sys/socket.h>
301 #include <arpa/inet.h>]],
302 [inet_pton(0, 0, 0);])],
303 [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
304 AC_MSG_RESULT(yes)],
305 [AC_MSG_RESULT(no)])
306
307dnl # Determine if inet_ntop() is available
308AC_MSG_CHECKING([if inet_ntop() is available])
309AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
310 #include <sys/socket.h>
311 #include <arpa/inet.h>]],
312 [inet_ntop(0, 0, 0, 0);])],
313 [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
314 AC_MSG_RESULT(yes)],
315 [AC_MSG_RESULT(no)])
316
317dnl # Determine if getaddrinfo() is available
318AC_MSG_CHECKING([if getaddrinfo() is available])
319AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
320 #include <sys/socket.h>
321 #include <netdb.h>]],
322 [getaddrinfo(0, 0, 0, 0);])],
323 [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
324 AC_MSG_RESULT(yes)],
325 [AC_MSG_RESULT(no)])
326
327dnl # Determine if sockaddr_in has sin_len member
328AC_MSG_CHECKING([if sockaddr_in has sin_len member])
329AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
330 #include <sys/socket.h>
331 #include <netinet/in.h>
332 #include <arpa/inet.h>]],
333 [struct sockaddr_in a; a.sin_len=0;])],
334 [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
335 AC_MSG_RESULT(yes)],
336 AC_MSG_RESULT(no))
337
338dnl # Determine if socklen_t is available
339AC_MSG_CHECKING([if socklen_t is available])
340AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
341 #include <sys/socket.h>]],
342 [socklen_t xxx = 0;])],
343 [AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
344 AC_MSG_RESULT(yes)],
345 AC_MSG_RESULT(no))
346
347dnl # Determine if SO_ERROR is available
348AC_MSG_CHECKING([if SO_ERROR is available])
349case $target in
350 *mingw* | *cygw* | *win32* | *w32* )
351 AC_DEFINE(PJ_HAS_SO_ERROR,1)
352 AC_MSG_RESULT(yes)
353 ;;
354 *)
355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
356 #include <sys/socket.h>
357 #include <netinet/in.h>
358 #include <arpa/inet.h>]],
359 [int i=SO_ERROR;])],
360 [AC_DEFINE(PJ_HAS_SO_ERROR,1)
361 AC_MSG_RESULT(yes)],
362 AC_MSG_RESULT(no))
363 ;;
364esac
365
366
367dnl # Determine if RW-mutex is available
368AC_MSG_CHECKING([if pthread_rwlock_t is available])
369AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
370 [pthread_rwlock_t *x;])],
371 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
372 ac_rwmutex="yes"
373 AC_MSG_RESULT(yes)],
374 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
375 ac_rwmutex="no"
376 AC_MSG_RESULT(no)])
377
378dnl # If rwmutex is not detected, check again but this time
379dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
380if test "$ac_rwmutex" = "no"; then
381 AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
382 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
383 #include <pthread.h>]],
384 [pthread_rwlock_t *x;])],
385 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
386 CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
387 AC_MSG_RESULT(yes)],
388 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
389 AC_MSG_RESULT(no)])
390fi
391
392dnl # Do we have pthread_mutexattr_settype()?
393AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
394AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
395 [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
396 [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
397 AC_MSG_RESULT(yes)],
398 [AC_MSG_RESULT(no)])
399
400dnl # Does pthread_mutexattr_t has "recursive" member?
401AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
402AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
403 [[pthread_mutexattr_t attr;
404 attr.recursive=1;]])],
405 [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
406 AC_MSG_RESULT(yes)],
407 [AC_MSG_RESULT(no)])
408
409dnl ######################
410dnl # ioqueue selection
411dnl #
412AC_SUBST(ac_os_objs)
413AC_MSG_CHECKING([ioqueue backend])
414AC_ARG_ENABLE(epoll,
415 AC_HELP_STRING([--enable-epoll],
416 [Use /dev/epoll ioqueue on Linux (experimental)]),
417 [
418 ac_os_objs=ioqueue_epoll.o
419 AC_MSG_RESULT([/dev/epoll])
420 ],
421 [
422 ac_os_objs=ioqueue_select.o
423 AC_MSG_RESULT([select()])
424 ])
425
426AC_SUBST(ac_shared_libraries)
427AC_ARG_ENABLE(shared,
428 AC_HELP_STRING([--enable-shared],
429 [Build shared libraries]),
430 [if test "$enable_shared" = "yes"; then
431 [ac_shared_libraries=1]
432 CFLAGS="$CFLAGS -fPIC"
433 AC_MSG_RESULT([Building shared libraries... yes])
434 fi],
435 AC_MSG_RESULT([Building shared libraries... no])
436 )
437
438
439dnl ######################
440dnl # OS specific files
441dnl #
442case $target in
443 *mingw* | *cygw* | *win32* | *w32* )
444 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"
445 ;;
446 *)
447 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"
448 case $target in
449 arm-apple-darwin*)
450 ac_os_objs="$ac_os_objs os_info_iphone.o"
451 ;;
452 esac
453 # UUID
454 if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
455 ac_os_objs="$ac_os_objs guid_uuid.o"
456 else
457 ac_os_objs="$ac_os_objs guid_simple.o"
458 fi
459 ;;
460esac
461
462case $target in
463 *darwin*)
464 ac_os_objs="$ac_os_objs os_core_darwin.o"
465 ;;
466esac
467
468dnl ##########################################
469dnl #
470dnl # PJMEDIA
471dnl #
472
473dnl # Use external Speex installation
474AC_SUBST(ac_external_speex,0)
475AC_ARG_WITH(external-speex,
476 AC_HELP_STRING([--with-external-speex],
477 [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)]),
478 [
479 if test "x$with_external_speex" != "xno"; then
480 # Test Speex installation
481 AC_MSG_CHECKING([if external Speex devkit is installed])
482 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
483 #include <speex/speex_echo.h>
484 ]],
485 [speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
486 [AC_MSG_RESULT(yes!!)
487 AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
488 ac_external_speex="1"
489 ],
490 [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])])
491 fi
492 ]
493 )
494
495dnl # Use external GSM codec library installation
496AC_SUBST(ac_external_gsm,0)
497AC_ARG_WITH(external-gsm,
498 AC_HELP_STRING([--with-external-gsm],
499 [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)]),
500 [
501 if test "x$with_external_gsm" != "xno"; then
502 # Test GSM library installation
503 AC_MSG_CHECKING([if external GSM devkit is installed as gsm/gsm.h])
504 AC_COMPILE_IFELSE(
505 [AC_LANG_PROGRAM([[#include <gsm/gsm.h> ]], [gsm_create(); ]) ],
506 [AC_MSG_RESULT(yes!!)
507 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
508 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_GSM_H, 1)
509 ac_external_gsm="1"
510 ],
511 [
512 AC_MSG_RESULT(no)
513 AC_MSG_CHECKING([if external GSM devkit is installed as gsm.h])
514 AC_COMPILE_IFELSE(
515 [AC_LANG_PROGRAM([[#include <gsm.h> ]], [gsm_create(); ]) ],
516 [AC_MSG_RESULT(yes!!)
517 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
518 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_H, 1)
519 ac_external_gsm="1"
520 ],
521 [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])
522 ]
523 )
524 ]
525 )
526 fi
527 ]
528 )
529
530
531dnl # Use external SRTP installation
532AC_SUBST(ac_external_srtp,0)
533AC_ARG_WITH(external-srtp,
534 AC_HELP_STRING([--with-external-srtp],
535 [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)]),
536 [
537 if test "x$with_external_srtp" != "xno"; then
538 # Test SRTP installation
539 AC_MSG_CHECKING([if external SRTP devkit is installed])
540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <srtp/srtp.h>
541 ]],
542 [srtp_init();])],
543 [AC_MSG_RESULT(yes!!)
544 ac_external_srtp="1"
545 ],
546 [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])])
547 fi
548 ]
549 )
550
551
552dnl # Resample implementation
553AC_SUBST(ac_pjmedia_resample,libresample)
554AC_ARG_ENABLE(resample,
555 AC_HELP_STRING([--disable-resample],
556 [Disable resampling implementations]),
557 [if test "$enable_resample" = "no"; then
558 [ac_pjmedia_resample=none]
559 AC_MSG_RESULT([Checking if resampling is disabled...yes])
560 fi]
561 )
562
563dnl # Sound device backend selection
564AC_SUBST(ac_pjmedia_snd)
565AC_ARG_ENABLE(sound,
566 AC_HELP_STRING([--disable-sound],
567 [Exclude sound (i.e. use null sound)]),
568 [if test "$enable_sound" = "no"; then
569 [ac_pjmedia_snd=null]
570 AC_MSG_RESULT([Checking if sound is disabled... yes])
571 fi]
572 )
573
574dnl # Use external PortAudio installation
575AC_SUBST(ac_external_pa,0)
576AC_ARG_WITH(external-pa,
577 AC_HELP_STRING([--with-external-pa],
578 [Use external PortAudio development files, not the one in "third_party" directory. 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)]),
579 [
580 if test "x$with_external_pa" != "xno"; then
581 # Test PortAudio installation
582 AC_MSG_CHECKING([if external PortAudio devkit is installed])
583 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
584 ]],
585 [Pa_Initialize();])],
586 [AC_MSG_RESULT(yes!!)
587 ac_external_pa="1"
588 ],
589 [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])])
590 fi
591 ]
592 )
593
594AC_SUBST(ac_pa_cflags)
595AC_CHECK_HEADER(sys/soundcard.h,
596 [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
597AC_CHECK_HEADER(linux/soundcard.h,
598 [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
599AC_CHECK_HEADER(machine/soundcard.h,
600 [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
601
602if test "x$ac_cv_c_bigendian" = "xyes"; then
603 ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
604else
605 ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
606fi
607
608if test "$enable_sound" = "no"; then
609 true;
610else
611 AC_SUBST(ac_pjmedia_audiodev_objs)
612 case $target in
613 *android*)
614 LIBS="$LIBS -lOpenSLES"
615 AC_MSG_RESULT([Checking sound device backend... OpenSL ES])
616 ;;
617 arm-apple-darwin*)
618 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox -framework CFNetwork -framework UIKit"
619 ac_pjmedia_audiodev_objs="coreaudio_dev.o"
620 AC_MSG_RESULT([Checking sound device backend... AudioUnit])
621 ;;
622 *darwin*)
623 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
624 ac_pjmedia_audiodev_objs="coreaudio_dev.o"
625 if test "`uname -r`" = "6.8"; then
626 #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
627 #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
628 ac_pjmedia_snd=pa_old_darwinos
629 AC_MSG_RESULT([Checking sound device backend... old coreaudio])
630 else
631 ac_pjmedia_snd=pa_darwinos
632 AC_MSG_RESULT([Checking sound device backend... coreaudio])
633 fi
634 ;;
635 *cygwin* | *mingw*)
636 ac_pjmedia_snd=pa_win32
637 AC_MSG_RESULT([Checking sound device backend... win32 sound])
638 ;;
639 *rtems*)
640 ac_pjmedia_snd=null
641 AC_MSG_RESULT([Checking sound device backend... null sound])
642 ;;
643 *)
644 dnl # Check if ALSA is available
645 ac_pjmedia_snd=pa_unix
646 AC_CHECK_HEADER(alsa/version.h,
647 [AC_SUBST(ac_pa_use_alsa,1)
648 LIBS="$LIBS -lasound"
649 ],
650 [AC_SUBST(ac_pa_use_alsa,0)])
651 AC_MSG_RESULT([Checking sound device backend... unix])
652
653 dnl # Check if OSS is disabled
654 AC_SUBST(ac_pa_use_oss,1)
655 AC_ARG_ENABLE(oss,
656 AC_HELP_STRING([--disable-oss],
657 [Disable OSS audio (default: not disabled)]),
658 [
659 if test "$enable_oss" = "no"; then
660 [ac_pa_use_oss=0]
661 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
662 fi
663 ])
664 ;;
665 esac
666fi
667
668AC_SUBST(ac_pjmedia_video)
669
670dnl # --disable-video option
671AC_ARG_ENABLE(video,
672 AC_HELP_STRING([--disable-video],
673 [Disable video feature]),
674 [if test "$enable_video" = "no"; then
675 #AC_DEFINE(PJMEDIA_HAS_VIDEO,0)
676 AC_MSG_RESULT([Video is disabled])
677 enable_sdl="no"
678 enable_ffmpeg="no"
679 enable_v4l2="no"
680 fi],
681 [])
682
683case $target in
684 *android*)
685 LIBS="$LIBS -llog -lgcc"
686 ;;
687 arm-apple-darwin*)
688 LIBS="$LIBS -framework UIKit"
689 ;;
690 *darwin*)
691 LIBS="$LIBS -framework Foundation -framework AppKit"
692 ;;
693esac
694
695if test "$enable_video" = "no"; then
696 true;
697else
698 case $target in
699 arm-apple-darwin*)
700 ac_pjmedia_video=iphone_os
701 AC_SUBST(ac_pjmedia_video_has_ios)
702 AC_SUBST(ac_ios_cflags)
703 SAVED_LIBS="$LIBS"
704 LIBS="-framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
705 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_ios=yes],[ac_pjmedia_video_has_ios=no])
706 LIBS="$SAVED_LIBS"
707 if test "$ac_pjmedia_video_has_ios" = "yes"; then
708 ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
709 LIBS="$LIBS -framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
710 AC_MSG_RESULT([Checking if AVFoundation framework is available... yes])
711 else
712 AC_MSG_RESULT([Checking if AVFoundation framework is available... no])
713 fi
714 ;;
715 *darwin*)
716 ac_pjmedia_video=mac_os
717 AC_SUBST(ac_pjmedia_video_has_qt)
718 AC_SUBST(ac_qt_cflags)
719 SAVED_LIBS="$LIBS"
720 LIBS="-framework QTKit"
721 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_qt=yes],[ac_pjmedia_video_has_qt=no])
722 LIBS="$SAVED_LIBS"
723 if test "$ac_pjmedia_video_has_qt" = "yes"; then
724 ac_qt_cflags="-DPJMEDIA_VIDEO_DEV_HAS_QT=1"
725 LIBS="$LIBS -framework QTKit -framework QuartzCore -framework OpenGL"
726 AC_MSG_RESULT([Checking if QTKit framework is available... yes])
727 else
728 AC_MSG_RESULT([Checking if QTKit framework is available... no])
729 fi
730 ;;
731 esac
732fi
733
734AC_ARG_ENABLE(ext_sound,
735 AC_HELP_STRING([--enable-ext-sound],
736 [PJMEDIA will not provide any sound device backend]),
737 [if test "$enable_ext_sound" = "yes"; then
738 [ac_pjmedia_snd=external]
739 AC_MSG_RESULT([Checking if external sound is set... yes])
740 fi]
741 )
742
743dnl # Include resampling small filter
744AC_SUBST(ac_no_small_filter)
745AC_ARG_ENABLE(small-filter,
746 AC_HELP_STRING([--disable-small-filter],
747 [Exclude small filter in resampling]),
748 [if test "$enable_small_filter" = "no"; then
749 [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
750 AC_MSG_RESULT([Checking if small filter is disabled... yes])
751 fi],
752 AC_MSG_RESULT([Checking if small filter is disabled... no]))
753
754dnl # Include resampling large filter
755AC_SUBST(ac_no_large_filter)
756AC_ARG_ENABLE(large-filter,
757 AC_HELP_STRING([--disable-large-filter],
758 [Exclude large filter in resampling]),
759 [if test "$enable_large_filter" = "no"; then
760 [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
761 AC_MSG_RESULT([Checking if large filter is disabled... yes])
762 fi],
763 AC_MSG_RESULT([Checking if large filter is disabled... no]))
764
765dnl # Include Speex AEC
766AC_SUBST(ac_no_speex_aec)
767AC_ARG_ENABLE(speex-aec,
768 AC_HELP_STRING([--disable-speex-aec],
769 [Exclude Speex Acoustic Echo Canceller/AEC]),
770 [if test "$enable_speex_aec" = "no"; then
771 [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
772 AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
773 fi],
774 AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
775
776dnl # Include G711 codec
777AC_SUBST(ac_no_g711_codec)
778AC_ARG_ENABLE(g711-codec,
779 AC_HELP_STRING([--disable-g711-codec],
780 [Exclude G.711 codecs from the build]),
781 [if test "$enable_g711_codec" = "no"; then
782 [ac_no_g711_codec=1]
783 AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
784 AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
785 fi],
786 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
787
788
789dnl # Include L16 codec
790AC_SUBST(ac_no_l16_codec)
791AC_ARG_ENABLE(l16-codec,
792 AC_HELP_STRING([--disable-l16-codec],
793 [Exclude Linear/L16 codec family from the build]),
794 [if test "$enable_l16_codec" = "no"; then
795 [ac_no_l16_codec=1]
796 AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
797 AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
798 fi],
799 AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
800
801
802dnl # Include GSM codec
803AC_SUBST(ac_no_gsm_codec)
804AC_ARG_ENABLE(gsm-codec,
805 AC_HELP_STRING([--disable-gsm-codec],
806 [Exclude GSM codec in the build]),
807 [if test "$enable_gsm_codec" = "no"; then
808 [ac_no_gsm_codec=1]
809 AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
810 AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
811 fi],
812 AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
813
814dnl # Include G.722 codec
815AC_SUBST(ac_no_g722_codec)
816AC_ARG_ENABLE(g722-codec,
817 AC_HELP_STRING([--disable-g722-codec],
818 [Exclude G.722 codec in the build]),
819 [if test "$enable_g722_codec" = "no"; then
820 [ac_no_g722_codec=1]
821 AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
822 AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
823 fi],
824 AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
825
826dnl # Include G722.1 codec
827AC_SUBST(ac_no_g7221_codec)
828AC_ARG_ENABLE(g7221-codec,
829 AC_HELP_STRING([--disable-g7221-codec],
830 [Exclude G.7221 codec in the build]),
831 [if test "$enable_g7221_codec" = "no"; then
832 [ac_no_g7221_codec=1]
833 AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
834 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
835 fi],
836 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
837
838dnl # Include Speex codec
839AC_SUBST(ac_no_speex_codec)
840AC_ARG_ENABLE(speex-codec,
841 AC_HELP_STRING([--disable-speex-codec],
842 [Exclude Speex codecs in the build]),
843 [if test "$enable_speex_codec" = "no"; then
844 [ac_no_speex_codec=1]
845 AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
846 AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
847 fi],
848 AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
849
850dnl # Include iLBC codec
851AC_SUBST(ac_no_ilbc_codec)
852AC_ARG_ENABLE(ilbc-codec,
853 AC_HELP_STRING([--disable-ilbc-codec],
854 [Exclude iLBC codec in the build]),
855 [if test "$enable_ilbc_codec" = "no"; then
856 [ac_no_ilbc_codec=1]
857 AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
858 AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
859 fi],
860 AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
861
862dnl # Include libsamplerate
863AC_ARG_ENABLE(libsamplerate,
864 AC_HELP_STRING([--enable-libsamplerate],
865 [Link with libsamplerate when available.]),
866 [ AC_CHECK_LIB(samplerate,src_new) ]
867 [ac_pjmedia_resample=libsamplerate],
868 AC_MSG_RESULT([Skipping libsamplerate detection])
869 )
870
871AC_SUBST(ac_resample_dll)
872AC_ARG_ENABLE(resample_dll,
873 AC_HELP_STRING([--enable-resample-dll],
874 [Build libresample as shared library]),
875 [if test "$enable_resample_dll" = "yes"; then
876 [ac_resample_dll=1]
877 AC_MSG_RESULT([Building libresample as shared library... yes])
878 fi],
879 AC_MSG_RESULT([Building libresample as shared library... no])
880 )
881
882dnl # SDL alt prefix
883AC_ARG_WITH(sdl,
884 AC_HELP_STRING([--with-sdl=DIR],
885 [Specify alternate libSDL prefix]),
886 [],
887 [with_sdl=no]
888 )
889
890dnl # Do not use default SDL installation if we are cross-compiling
891if test "x$ac_cross_compile" != "x" -a "x$with_sdl" = "xno"; then
892 enable_sdl=no
893fi
894
895dnl # SDL
896AC_ARG_ENABLE(sdl,
897 AC_HELP_STRING([--disable-sdl],
898 [Disable SDL (default: not disabled)]),
899 [
900 if test "$enable_sdl" = "no"; then
901 AC_MSG_RESULT([Checking if SDL is disabled... yes])
902 fi
903 ],
904 [
905 if test "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
906 AC_MSG_RESULT([Using SDL prefix... $with_sdl])
907 AC_PATH_PROGS(SDL_CONFIG,sdl2-config sdl-config,,$with_sdl/bin)
908 else
909 AC_PATH_PROGS(SDL_CONFIG, sdl2-config sdl-config)
910 fi
911
912 AC_MSG_CHECKING([SDL availability])
913 if test "x$SDL_CONFIG" = "x"; then
914 AC_MSG_RESULT([not found])
915 elif (sh -c "$SDL_CONFIG --version" | grep -e '^1\.3' -e '^2\.') then
916 AC_SUBST(ac_sdl_cflags)
917 AC_SUBST(ac_sdl_ldflags)
918 ac_sdl_cflags=`$SDL_CONFIG --cflags`
919 ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
920 ac_sdl_ldflags=`$SDL_CONFIG --libs`
921 LIBS="$LIBS $ac_sdl_ldflags"
922 else
923 AC_MSG_RESULT([Unsupported SDL version])
924 fi
925 ])
926
927
928AC_ARG_WITH(ffmpeg,
929 AC_HELP_STRING([--with-ffmpeg=DIR],
930 [Specify alternate FFMPEG prefix]),
931 [],
932 [with_ffmpeg=no]
933 )
934
935dnl # Do not use default ffmpeg installation if we are cross-compiling
936if test "x$ac_cross_compile" != "x" -a "x$with_ffmpeg" = "xno"; then
937 enable_ffmpeg=no
938fi
939
940dnl # FFMPEG stuffs
941AC_ARG_ENABLE(ffmpeg,
942 AC_HELP_STRING([--disable-ffmpeg],
943 [Disable ffmpeg (default: not disabled)]),
944 [
945 AC_SUBST(ac_has_ffmpeg,0)
946 if test "$enable_ffmpeg" = "no"; then
947 AC_MSG_RESULT([Checking if ffmpeg is disabled... yes])
948 fi
949 ],
950 [
951 AC_SUBST(ac_ffmpeg_cflags)
952 AC_SUBST(ac_ffmpeg_ldflags)
953
954 FFMPEG_PREFIX=""
955 AC_SUBST(SAVED_PKG_CONFIG_PATH)
956 SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
957 if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
958 FFMPEG_PREFIX=$with_ffmpeg
959 AC_MSG_RESULT([Using ffmpeg prefix... $FFMPEG_PREFIX])
960 export PKG_CONFIG_PATH=$FFMPEG_PREFIX/lib/pkgconfig
961 fi
962
963 AC_CHECK_PROGS(PKG_CONFIG,pkg-config "python pkgconfig.py",none)
964
965 if test "$PKG_CONFIG" != "none"; then
966 AC_MSG_CHECKING([ffmpeg packages])
967 av_pkg=""
968 if $PKG_CONFIG --exists libdevice; then
969 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
970 av_pkg="$av_pkg libdevice"
971 fi
972 if $PKG_CONFIG --exists libavformat; then
973 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
974 av_pkg="$av_pkg libavformat"
975 fi
976 if $PKG_CONFIG --exists libavcodec; then
977 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
978 av_pkg="$av_pkg libavcodec"
979 fi
980 if $PKG_CONFIG --exists libswscale; then
981 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
982 av_pkg="$av_pkg libswscale"
983 fi
984 if $PKG_CONFIG --exists libavutil; then
985 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
986 av_pkg="$av_pkg libavutil"
987 fi
988 if $PKG_CONFIG --exists libavcore; then
989 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
990 av_pkg="$av_pkg libavcore"
991 fi
992
993 if test "x$av_pkg" == "x"; then
994 AC_MSG_RESULT([none detected (check the prefix)! **])
995 else
996 AC_MSG_RESULT([$av_pkg])
997 fi
998
999 ac_ffmpeg_cflags="$ac_ffmpeg_cflags `$PKG_CONFIG --cflags $av_pkg`"
1000 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags `$PKG_CONFIG --libs $av_pkg`"
1001
1002 else
1003 dnl #
1004 dnl # Use hardcoded values to configure ffmpeg
1005 dnl #
1006
1007 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 ***])
1008
1009 LIBS="-L$FFMPEG_PREFIX/lib $LIBS"
1010 LDFLAGS="-L$FFMPEG_PREFIX/lib $LDFLAGS"
1011 CFLAGS="-I$FFMPEG_PREFIX/include $CFLAGS"
1012
1013 AC_CHECK_LIB(avdevice,
1014 avdevice_version,
1015 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
1016 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavdevice"
1017 ]
1018 )
1019 AC_CHECK_LIB(avutil,
1020 av_malloc,
1021 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
1022 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavutil"
1023 ]
1024 )
1025 AC_CHECK_LIB(avcodec,
1026 avcodec_init,
1027 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
1028 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcodec"
1029 ],
1030 [],
1031 [-lavutil]
1032 )
1033 AC_CHECK_LIB(avformat,
1034 av_register_all,
1035 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
1036 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavformat"
1037 ],
1038 [],
1039 [-lavcodec -lavutil]
1040 )
1041 AC_CHECK_LIB(swscale,
1042 sws_scale,
1043 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
1044 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lswscale"
1045 ],
1046 [],
1047 [-lavutil]
1048 )
1049 AC_CHECK_LIB(avcore,
1050 avcore_version,
1051 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
1052 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcore"
1053 ]
1054 )
1055
1056 fi
1057
1058 LIBS="$LIBS $ac_ffmpeg_ldflags"
1059 export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
1060 ]
1061 )
1062
1063dnl # Video for Linux 2
1064AC_ARG_ENABLE(v4l2,
1065 AC_HELP_STRING([--disable-v4l2],
1066 [Disable Video4Linux2 (default: not disabled)]),
1067 [
1068 if test "$enable_v4l2" = "no"; then
1069 AC_MSG_RESULT([Checking if V4L2 is disabled... yes])
1070 fi
1071 ],
1072 [
1073 AC_SUBST(ac_v4l2_cflags)
1074 AC_SUBST(ac_v4l2_ldflags)
1075 AC_CHECK_LIB(v4l2,
1076 v4l2_open,
1077 [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
1078 ac_v4l2_ldflags="-lv4l2"
1079 LIBS="$LIBS -lv4l2"
1080 ]
1081 )
1082 ])
1083
1084dnl ########################################################
1085dnl # Intel IPP support
1086dnl #
1087AC_ARG_ENABLE(ipp,
1088 AC_HELP_STRING([--enable-ipp],
1089 [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]),
1090 [],
1091 [enable_ipp=no]
1092 )
1093
1094AC_ARG_WITH(ipp,
1095 AC_HELP_STRING([--with-ipp=DIR],
1096 [Specify the Intel IPP location]),
1097 [],
1098 [with_ipp=no]
1099 )
1100
1101AC_ARG_WITH(ipp-samples,
1102 AC_HELP_STRING([--with-ipp-samples=DIR],
1103 [Specify the Intel IPP samples location]),
1104 [],
1105 [with_ipp_samples=no]
1106 )
1107
1108AC_ARG_WITH(ipp-arch,
1109 AC_HELP_STRING([--with-ipp-arch=ARCH],
1110 [Specify the Intel IPP ARCH suffix, e.g. "64" or "em64t. Default is blank for IA32"]),
1111 [],
1112 [with_ipp_arch=no]
1113 )
1114
1115if test "x$enable_ipp" != "xno"; then
1116 dnl #
1117 dnl # Verifying Intel IPP path
1118 dnl #
1119 AC_MSG_CHECKING([Intel IPP location])
1120
1121 if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
1122 AC_MSG_RESULT([$with_ipp])
1123 IPPROOT=$with_ipp
1124 elif test "x$IPPROOT" = "x"; then
1125 if test -d /opt/intel/ipp; then
1126 IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
1127 AC_MSG_RESULT([autodetected in $IPPROOT])
1128 fi
1129 else
1130 AC_MSG_RESULT([$IPPROOT])
1131 fi
1132
1133 if test "x$with_ipp_arch" != "xno"; then
1134 IPP_SUFFIX=$with_ipp_arch
1135 AC_MSG_RESULT([IPP arch suffix is set to $IPP_SUFFIX])
1136 else
1137 IPP_SUFFIX=""
1138 AC_MSG_RESULT([IPP arch suffix is set to empty])
1139 fi
1140
1141 if test x$IPPROOT = x; then
1142 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
1143 elif test ! -d $IPPROOT; then
1144 AC_MSG_ERROR([not found])
1145 elif test ! -d $IPPROOT/include; then
1146 AC_MSG_ERROR([directory doesn't seem to be valid])
1147 else
1148 # IPP directory looks okay.
1149 # Remove trailing backslash
1150 IPPROOT=`echo $IPPROOT | sed 's/\/$//'`
1151
1152 SAVED_CFLAGS="$CFLAGS"
1153 SAVED_LDFLAGS="$LDFLAGS"
1154 SAVED_LIBS="$LIBS"
1155
1156 IPP_CFLAGS="-I$IPPROOT/include"
1157 IPP_LIBS="-lippsc${IPP_SUFFIX} -lipps${IPP_SUFFIX} -lippcore${IPP_SUFFIX}"
1158
1159#
1160 # Some differences between Mac OS X and Linux
1161 case $target in
1162 *darwin* )
1163 IPP_LDFLAGS="-L$IPPROOT/Libraries -L$IPPROOT/lib"
1164 ;;
1165 *)
1166 # Find out where the libraries live.
1167 IPP7_ARCH=""
1168 if test -d $IPPROOT/lib/intel64; then
1169 IPP7_ARCH="intel64"
1170 elif test -d $IPPROOT/lib/ia32; then
1171 IPP7_ARCH="ia32"
1172 elif test -d $IPPROOT/lib/mic; then
1173 IPP7_ARCH="mic"
1174 fi
1175
1176 if test -z "$IPP7_ARCH"; then
1177 # IPP6 (and possibly below)
1178 IPP_LDFLAGS="-L$IPPROOT/sharedlib"
1179 IPP_LIBS="$IPP_LIBS -lippsr${IPP_SUFFIX} -lguide"
1180 else
1181 # IPP7
1182 if ! test -d $IPPROOT/../compiler; then
1183 AC_MSG_ERROR([Cannot find $IPPROOT/../compiler directory. Please set IPPROOT variable correctly])
1184 fi
1185 IPP_CFLAGS="$IPP_CFLAGS"
1186 IPP_LDFLAGS="-L$IPPROOT/lib/intel64 -L$IPPROOT/../compiler/lib/$IPP7_ARCH"
1187 IPP_LIBS="$IPP_LIBS -liomp5"
1188 fi
1189 ;;
1190 esac
1191
1192 #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
1193 #Static:
1194 #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
1195
1196 CFLAGS="$CFLAGS $IPP_CFLAGS"
1197 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
1198 LIBS="$IPP_LIBS $LIBS"
1199
1200
1201 AC_MSG_CHECKING([Intel IPP usability])
1202 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
1203 ]],
1204 [ippStaticInit();])],
1205 [AC_MSG_RESULT(ok)],
1206 [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])])
1207
1208 CFLAGS="$SAVED_CFLAGS"
1209 LDFLAGS="$SAVED_LDFLAGS"
1210 LIBS="$SAVED_LIBS"
1211 fi
1212
1213 dnl #
1214 dnl # Verifying Intel IPP samples path
1215 dnl #
1216 AC_MSG_CHECKING([Intel IPP samples location])
1217
1218 if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
1219 AC_MSG_RESULT([$with_ipp_samples])
1220 IPPSAMPLES=$with_ipp_samples
1221 elif test "x$IPPSAMPLES" = "x"; then
1222 if test -d /opt/intel/ipp-samples; then
1223 IPPSAMPLES=/opt/intel/ipp-samples
1224 AC_MSG_RESULT([autodetected in $IPPSAMPLES])
1225 fi
1226 else
1227 AC_MSG_RESULT([$IPPSAMPLES])
1228 fi
1229
1230 if test x$IPPSAMPLES = x; then
1231 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
1232 elif test ! -d $IPPSAMPLES; then
1233 AC_MSG_ERROR([not found])
1234 elif test ! -d $IPPSAMPLES/speech-codecs; then
1235 AC_MSG_ERROR([directory doesn't seem to be valid])
1236 else
1237 # Remove trailing backslash
1238 IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
1239
1240 # Guess the libusc.a/libspeech.a build location
1241 AC_MSG_CHECKING([Intel IPP USC build location])
1242 if test -d $IPPSAMPLES/speech-codecs/bin; then
1243 IPPVER=5
1244 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
1245 elif test -d $IPPSAMPLES/speech-codecs/_bin; then
1246 IPPVER=6
1247 if test -d $IPPSAMPLES/speech-codecs/_bin/*gcc*; then
1248 # gcc compiler
1249 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib | head -1`
1250 elif test -d $IPPSAMPLES/speech-codecs/_bin/*icc*; then
1251 # icc compiler
1252 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*icc*/lib | head -1`
1253 else
1254 AC_MSG_FAILURE([Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?])
1255 fi
1256 else
1257 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?])
1258 fi
1259
1260 # Test the directory
1261 if test ! -d $IPPSAMP_DIR; then
1262 AC_MSG_FAILURE([There's something wrong with this script, directory $IPPSAMP_DIR does not exist])
1263 exit 1;
1264 fi
1265
1266 if test "x$IPPVER" = "x5"; then
1267 IPPSAMP_LIBS="libusc.a"
1268 IPPSAMP_LDLIBS="-lusc"
1269 elif test "x$IPPVER" = "x6"; then
1270 IPPSAMP_LIBS="libspeech.a"
1271 IPPSAMP_LDLIBS="-lspeech"
1272 else
1273 AC_MSG_FAILURE([bug in this script: unsupported IPP version])
1274 fi
1275
1276 if test ! -f $IPPSAMP_DIR/$IPPSAMP_LIBS; then
1277 AC_MSG_FAILURE([$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR])
1278 fi
1279
1280 AC_MSG_RESULT([$IPPSAMP_DIR])
1281
1282 SAVED_CFLAGS="$CFLAGS"
1283 SAVED_LDFLAGS="$LDFLAGS"
1284 SAVED_LIBS="$LIBS"
1285
1286 IPPSAMP_INC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
1287 CFLAGS="$CFLAGS $IPPSAMP_INC"
1288 LDFLAGS="$LDFLAGS -L$IPPSAMP_DIR"
1289 LIBS="$IPPSAMP_LDLIBS $LIBS"
1290
1291 AC_MSG_CHECKING([Intel IPP USC usability])
1292 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
1293 ]],
1294 [extern USC_Fxns USC_G729AFP_Fxns;])],
1295 [AC_MSG_RESULT(ok)],
1296 [AC_MSG_FAILURE(failed)])
1297
1298 CFLAGS="$SAVED_CFLAGS"
1299 LDFLAGS="$IPP_LDFLAGS $SAVED_LDFLAGS"
1300 LIBS="$IPP_LIBS $SAVED_LIBS"
1301
1302 IPP_CFLAGS="$IPP_CFLAGS $IPPSAMP_INC"
1303 IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMP_DIR"
1304 IPP_LIBS="$IPPSAMP_LDLIBS $IPP_LIBS"
1305 fi
1306
1307 CFLAGS="$CFLAGS $IPP_CFLAGS"
1308 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
1309 LIBS="$LIBS $IPP_LIBS"
1310
1311 ac_build_mak_vars="$ac_build_mak_vars\n\
1312export IPP_CFLAGS=$IPP_CFLAGS\n\
1313export IPP_LDFLAGS=$IPP_LDFLAGS\n\
1314export IPP_LIBS=$IPP_LIBS"
1315else
1316 AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
1317fi
1318
1319
1320dnl ##########################################
1321dnl #
1322dnl # PJSIP CONFIG
1323dnl #
1324
1325dnl # SSL alt prefix
1326AC_ARG_WITH(ssl,
1327 AC_HELP_STRING([--with-ssl=DIR],
1328 [Specify alternate libssl prefix]),
1329 [],
1330 [with_ssl=no]
1331 )
1332
1333dnl # Do not use default SSL installation if we are cross-compiling
1334if test "x$ac_cross_compile" != "x" -a "x$with_ssl" = "xno"; then
1335 enable_ssl=no
1336fi
1337
1338dnl # Include SSL support
1339AC_SUBST(ac_no_ssl)
1340AC_ARG_ENABLE(ssl,
1341 AC_HELP_STRING([--disable-ssl],
1342 [Exclude SSL support the build (default: autodetect)])
1343 ,
1344 [
1345 if test "$enable_ssl" = "no"; then
1346 [ac_no_ssl=1]
1347 AC_MSG_RESULT([Checking if SSL support is disabled... yes])
1348 fi
1349 ],
1350 [
1351 AC_MSG_RESULT([checking for OpenSSL installations..])
1352 if test "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then
1353 CFLAGS="$CFLAGS -I$with_ssl/include"
1354 LDFLAGS="$LDFLAGS -L$with_ssl/lib"
1355 AC_MSG_RESULT([Using SSL prefix... $with_ssl])
1356 fi
1357 AC_SUBST(openssl_h_present)
1358 AC_SUBST(libssl_present)
1359 AC_SUBST(libcrypto_present)
1360 AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
1361 AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
1362 AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
1363 if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
1364 AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
1365 # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
1366 #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
1367 AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
1368 else
1369 AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **])
1370 fi
1371 ])
1372
1373dnl # Obsolete option --with-opencore-amrnb
1374AC_ARG_WITH(opencore-amrnb,
1375 AC_HELP_STRING([--with-opencore-amrnb=DIR],
1376 [This option is obsolete and replaced by --with-opencore-amr=DIR]),
1377 [AC_MSG_ERROR(This option is obsolete and replaced by --with-opencore-amr=DIR)],
1378 []
1379 )
1380
1381dnl # opencore-amr alt prefix
1382AC_ARG_WITH(opencore-amr,
1383 AC_HELP_STRING([--with-opencore-amr=DIR],
1384 [Specify alternate libopencore-amr prefix]),
1385 [],
1386 [with_opencore_amr=no]
1387 )
1388
1389dnl # Do not use default opencore-amr installation if we are cross-compiling
1390if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amr" = "xno"; then
1391 enable_opencore_amr=no
1392fi
1393
1394dnl # vo-amrwbenc alt prefix
1395AC_ARG_WITH(opencore-amrwbenc,
1396 AC_HELP_STRING([--with-opencore-amrwbenc=DIR],
1397 [Specify alternate libvo-amrwbenc prefix]),
1398 [],
1399 [with_opencore_amrwbenc=no]
1400 )
1401
1402dnl # Do not use default vo-amrwbenc installation if we are cross-compiling
1403if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amrwbenc" = "xno"; then
1404 enable_opencore_amrwbenc=no
1405fi
1406
1407
1408dnl # Include opencore-amr support
1409AC_SUBST(ac_no_opencore_amrnb)
1410AC_SUBST(ac_no_opencore_amrwb)
1411AC_ARG_ENABLE(opencore_amr,
1412 AC_HELP_STRING([--disable-opencore-amr],
1413 [Exclude OpenCORE AMR support from the build (default: autodetect)])
1414 ,
1415 [
1416 if test "$enable_opencore_amr" = "no"; then
1417 [ac_no_opencore_amrnb=1]
1418 [ac_no_opencore_amrwb=1]
1419 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
1420 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
1421 AC_MSG_RESULT([Checking if OpenCORE AMR support is disabled... yes])
1422 fi
1423 ],
1424 [
1425 AC_MSG_RESULT([checking for OpenCORE AMR installations..])
1426 if test "x$with_opencore_amr" != "xno" -a "x$with_opencore_amr" != "x"; then
1427 CFLAGS="$CFLAGS -I$with_opencore_amr/include"
1428 LDFLAGS="$LDFLAGS -L$with_opencore_amr/lib"
1429 AC_MSG_RESULT([Using OpenCORE AMR prefix... $with_opencore_amr])
1430 fi
1431 if test "x$with_opencore_amrwbenc" != "xno" -a "x$with_opencore_amrwbenc" != "x"; then
1432 CFLAGS="$CFLAGS -I$with_opencore_amrwbenc/include"
1433 LDFLAGS="$LDFLAGS -L$with_opencore_amrwbenc/lib"
1434 AC_MSG_RESULT([Using OpenCORE AMRWB-enc prefix... $with_opencore_amrwbenc])
1435 fi
1436 AC_SUBST(opencore_amrnb_h_present)
1437 AC_SUBST(opencore_amrnb_present)
1438 AC_CHECK_HEADER(opencore-amrnb/interf_enc.h,[opencore_amrnb_h_present=1])
1439 AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1 && LIBS="$LIBS -lopencore-amrnb"])
1440 if test "x$opencore_amrnb_h_present" = "x1" -a "x$opencore_amrnb_present" = "x1"; then
1441 AC_MSG_RESULT([OpenCORE AMR-NB library found, AMR-NB support enabled])
1442 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,1)
1443 else
1444 [ac_no_opencore_amrnb=1]
1445 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
1446 fi
1447 AC_SUBST(opencore_amrwb_enc_h_present)
1448 AC_SUBST(opencore_amrwb_enc_present)
1449 AC_SUBST(opencore_amrwb_dec_h_present)
1450 AC_SUBST(opencore_amrwb_dec_present)
1451 AC_CHECK_HEADER(vo-amrwbenc/enc_if.h,[opencore_amrwb_enc_h_present=1])
1452 AC_CHECK_HEADER(opencore-amrwb/dec_if.h,[opencore_amrwb_dec_h_present=1])
1453 AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"])
1454 AC_CHECK_LIB(vo-amrwbenc,E_IF_init,[opencore_amrwb_enc_present=1 && LIBS="$LIBS -lvo-amrwbenc"])
1455 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
1456 AC_MSG_RESULT([OpenCORE AMR-WB library found, AMR-WB support enabled])
1457 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,1)
1458 else
1459 [ac_no_opencore_amrwb=1]
1460 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
1461 fi
1462
1463 ])
1464
1465dnl # SILK prefix
1466AC_ARG_WITH(silk,
1467 AC_HELP_STRING([--with-silk=DIR],
1468 [Specify alternate SILK prefix]),
1469 [],
1470 [with_silk=no]
1471 )
1472
1473dnl # Do not use default SILK installation if we are cross-compiling
1474if test "x$ac_cross_compile" != "x" -a "x$with_silk" = "xno"; then
1475 enable_silk=no
1476fi
1477
1478dnl # Include SILK support
1479AC_SUBST(ac_no_silk)
1480AC_ARG_ENABLE(silk,
1481 AC_HELP_STRING([--disable-silk],
1482 [Exclude SILK support from the build (default: autodetect)])
1483 ,
1484 [
1485 if test "$enable_silk" = "no"; then
1486 [ac_no_silk=1]
1487 AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
1488 AC_MSG_RESULT([Checking if SILK support is disabled... yes])
1489 fi
1490 ],
1491 [
1492 AC_MSG_RESULT([checking for SILK installations..])
1493 if test "x$with_silk" != "xno" -a "x$with_silk" != "x"; then
1494 CFLAGS="$CFLAGS -I$with_silk/interface"
1495 CPPFLAGS="$CPPFLAGS -I$with_silk/interface"
1496 LDFLAGS="$LDFLAGS -L$with_silk"
1497 AC_MSG_RESULT([Using SILK prefix... $with_silk])
1498 fi
1499 AC_SUBST(silk_h_present)
1500 AC_SUBST(silk_present)
1501 AC_CHECK_HEADER(SKP_Silk_SDK_API.h,[silk_h_present=1])
1502 AC_CHECK_LIB(SKP_SILK_SDK,SKP_Silk_SDK_get_version,[silk_present=1 && LIBS="$LIBS -lSKP_SILK_SDK"])
1503 if test "x$silk_h_present" = "x1" -a "x$silk_present" = "x1"; then
1504 AC_MSG_RESULT([SILK library found, SILK support enabled])
1505 AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,1)
1506 else
1507 [ac_no_silk=1]
1508 AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
1509 fi
1510 ])
1511
1512
1513dnl ##########################################
1514dnl #
1515dnl # MANUAL CONFIG
1516dnl #
1517
1518
1519dnl # Determine if select() requires nfds to be filled up with
1520dnl # correct value (max_fd+1). If zero, nfds will be filled up with
1521dnl # PJ_FD_SETSIZE
1522AC_MSG_CHECKING([if select() needs correct nfds])
1523case $target in
1524 *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
1525 AC_MSG_RESULT(yes)
1526 ;;
1527 *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
1528 AC_MSG_RESULT([no (default)])
1529 AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
1530 ;;
1531esac
1532
1533dnl # Determine if pj_thread_create() should enforce thread stack size when
1534dnl # creating thread. Default is zero, to allow OS to allocate appropriate
1535dnl # thread's stack size.
1536AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
1537case $target in
1538 *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
1539 AC_MSG_RESULT(yes)
1540 ;;
1541 *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
1542 AC_MSG_RESULT([no (default)])
1543 ;;
1544esac
1545
1546dnl # Determine if pj_thread_create() should allocate thread's stack from
1547dnl # the pool. Default is zero, to let OS allocate thread's stack.
1548AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
1549case $target in
1550 *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
1551 AC_MSG_RESULT(yes)
1552 ;;
1553 *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
1554 AC_MSG_RESULT([no (default)])
1555 ;;
1556esac
1557
1558dnl # This value specifies the value set in errno by the OS when a non-blocking
1559dnl # socket recv() can not return immediate data.
1560case $target in
1561 *mingw* | *cygw* | *win32* | *w32* )
1562 AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
1563 ;;
1564 *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
1565 AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
1566 ;;
1567esac
1568
1569dnl # This value specifies the value set in errno by the OS when a non-blocking
1570dnl # socket connect() can not get connected immediately.
1571case $target in
1572 *mingw* | *cygw* | *win32* | *w32* )
1573 AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
1574 ;;
1575 *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
1576 AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
1577 ;;
1578esac
1579
1580
1581AC_SUBST(target)
1582AC_SUBST(ac_linux_poll,select)
1583AC_SUBST(ac_host,unix)
1584AC_SUBST(ac_main_obj)
1585case $target in
1586 *rtems*)
1587 ac_main_obj=main_rtems.o
1588 ;;
1589 *)
1590 ac_main_obj=main.o
1591 ;;
1592esac
1593AC_SUBST(CC)
1594
1595ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
1596AC_OUTPUT()
1597
1598
1599AC_MSG_RESULT([
1600
1601Configurations 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.
1602
1603Further customizations can be put in:
1604 - 'user.mak'
1605 - 'pjlib/include/pj/config_site.h'
1606
1607The next step now is to run 'make dep' and 'make'.
1608])
1609