blob: 8d77ffa35a8e02c026567d43e942f4dca55c0ff4 [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001AC_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
Alexandre Lision8af73cb2013-12-10 14:11:20 -050044AC_PROG_RANLIB
45AC_CHECK_TOOLS([AR], [ar gar], :)
Tristan Matthews0a329cc2013-07-17 13:20:14 -040046
Alexandre Lision8af73cb2013-12-10 14:11:20 -050047if test "$AR_FLAGS" = ""; then AR_FLAGS="rv"; fi
48AC_SUBST(AR_FLAGS)
Tristan Matthews0a329cc2013-07-17 13:20:14 -040049if test "$LD" = ""; then LD="$CC"; fi
50AC_SUBST(LD)
51if test "$LDOUT" = ""; then LDOUT="-o "; fi
52AC_SUBST(LDOUT)
Tristan Matthews0a329cc2013-07-17 13:20:14 -040053if 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)
Alexandre Lision8af73cb2013-12-10 14:11:20 -0500117AC_CHECK_LIB(m,sin)
Tristan Matthews0a329cc2013-07-17 13:20:14 -0400118AC_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])
Tristan Matthews0a329cc2013-07-17 13:20:14 -0400193 ])
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
Alexandre Lision8af73cb2013-12-10 14:11:20 -0500426AC_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
Tristan Matthews0a329cc2013-07-17 13:20:14 -0400438
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
531
532dnl # Sound device backend selection
533AC_SUBST(ac_pjmedia_snd)
534AC_ARG_ENABLE(sound,
535 AC_HELP_STRING([--disable-sound],
536 [Exclude sound (i.e. use null sound)]),
537 [if test "$enable_sound" = "no"; then
538 [ac_pjmedia_snd=null]
539 AC_MSG_RESULT([Checking if sound is disabled... yes])
540 fi]
541 )
542
543dnl # Use external PortAudio installation
544AC_SUBST(ac_external_pa,0)
545AC_ARG_WITH(external-pa,
546 AC_HELP_STRING([--with-external-pa],
547 [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)]),
548 [
549 if test "x$with_external_pa" != "xno"; then
550 # Test PortAudio installation
551 AC_MSG_CHECKING([if external PortAudio devkit is installed])
552 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
553 ]],
554 [Pa_Initialize();])],
555 [AC_MSG_RESULT(yes!!)
556 ac_external_pa="1"
557 ],
558 [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])])
559 fi
560 ]
561 )
562
563AC_SUBST(ac_pa_cflags)
564AC_CHECK_HEADER(sys/soundcard.h,
565 [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
566AC_CHECK_HEADER(linux/soundcard.h,
567 [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
568AC_CHECK_HEADER(machine/soundcard.h,
569 [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
570
571if test "x$ac_cv_c_bigendian" = "xyes"; then
572 ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
573else
574 ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
575fi
576
577if test "$enable_sound" = "no"; then
578 true;
579else
Alexandre Lision8af73cb2013-12-10 14:11:20 -0500580 AC_SUBST(ac_pjmedia_audiodev_objs)
Tristan Matthews0a329cc2013-07-17 13:20:14 -0400581 case $target in
582 *android*)
583 LIBS="$LIBS -lOpenSLES"
584 AC_MSG_RESULT([Checking sound device backend... OpenSL ES])
585 ;;
586 arm-apple-darwin*)
587 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox -framework CFNetwork -framework UIKit"
Alexandre Lision8af73cb2013-12-10 14:11:20 -0500588 ac_pjmedia_audiodev_objs="coreaudio_dev.o"
Tristan Matthews0a329cc2013-07-17 13:20:14 -0400589 AC_MSG_RESULT([Checking sound device backend... AudioUnit])
590 ;;
591 *darwin*)
592 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
Alexandre Lision8af73cb2013-12-10 14:11:20 -0500593 ac_pjmedia_audiodev_objs="coreaudio_dev.o"
Tristan Matthews0a329cc2013-07-17 13:20:14 -0400594 if test "`uname -r`" = "6.8"; then
595 #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
596 #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
597 ac_pjmedia_snd=pa_old_darwinos
598 AC_MSG_RESULT([Checking sound device backend... old coreaudio])
599 else
600 ac_pjmedia_snd=pa_darwinos
601 AC_MSG_RESULT([Checking sound device backend... coreaudio])
602 fi
603 ;;
604 *cygwin* | *mingw*)
605 ac_pjmedia_snd=pa_win32
606 AC_MSG_RESULT([Checking sound device backend... win32 sound])
607 ;;
608 *rtems*)
609 ac_pjmedia_snd=null
610 AC_MSG_RESULT([Checking sound device backend... null sound])
611 ;;
612 *)
613 dnl # Check if ALSA is available
614 ac_pjmedia_snd=pa_unix
615 AC_CHECK_HEADER(alsa/version.h,
616 [AC_SUBST(ac_pa_use_alsa,1)
617 LIBS="$LIBS -lasound"
618 ],
619 [AC_SUBST(ac_pa_use_alsa,0)])
620 AC_MSG_RESULT([Checking sound device backend... unix])
621
622 dnl # Check if OSS is disabled
623 AC_SUBST(ac_pa_use_oss,1)
624 AC_ARG_ENABLE(oss,
625 AC_HELP_STRING([--disable-oss],
626 [Disable OSS audio (default: not disabled)]),
627 [
628 if test "$enable_oss" = "no"; then
629 [ac_pa_use_oss=0]
630 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
631 fi
632 ])
633 ;;
634 esac
635fi
636
637AC_SUBST(ac_pjmedia_video)
638
639dnl # --disable-video option
640AC_ARG_ENABLE(video,
641 AC_HELP_STRING([--disable-video],
642 [Disable video feature]),
643 [if test "$enable_video" = "no"; then
644 #AC_DEFINE(PJMEDIA_HAS_VIDEO,0)
645 AC_MSG_RESULT([Video is disabled])
646 enable_sdl="no"
647 enable_ffmpeg="no"
648 enable_v4l2="no"
649 fi],
650 [])
651
652case $target in
653 *android*)
654 LIBS="$LIBS -llog -lgcc"
655 ;;
656 arm-apple-darwin*)
657 LIBS="$LIBS -framework UIKit"
658 ;;
659 *darwin*)
660 LIBS="$LIBS -framework Foundation -framework AppKit"
661 ;;
662esac
663
664if test "$enable_video" = "no"; then
665 true;
666else
667 case $target in
668 arm-apple-darwin*)
669 ac_pjmedia_video=iphone_os
670 AC_SUBST(ac_pjmedia_video_has_ios)
671 AC_SUBST(ac_ios_cflags)
672 SAVED_LIBS="$LIBS"
673 LIBS="-framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
674 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_ios=yes],[ac_pjmedia_video_has_ios=no])
675 LIBS="$SAVED_LIBS"
676 if test "$ac_pjmedia_video_has_ios" = "yes"; then
677 ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
678 LIBS="$LIBS -framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
679 AC_MSG_RESULT([Checking if AVFoundation framework is available... yes])
680 else
681 AC_MSG_RESULT([Checking if AVFoundation framework is available... no])
682 fi
683 ;;
684 *darwin*)
685 ac_pjmedia_video=mac_os
686 AC_SUBST(ac_pjmedia_video_has_qt)
687 AC_SUBST(ac_qt_cflags)
688 SAVED_LIBS="$LIBS"
689 LIBS="-framework QTKit"
690 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_qt=yes],[ac_pjmedia_video_has_qt=no])
691 LIBS="$SAVED_LIBS"
692 if test "$ac_pjmedia_video_has_qt" = "yes"; then
693 ac_qt_cflags="-DPJMEDIA_VIDEO_DEV_HAS_QT=1"
694 LIBS="$LIBS -framework QTKit -framework QuartzCore -framework OpenGL"
695 AC_MSG_RESULT([Checking if QTKit framework is available... yes])
696 else
697 AC_MSG_RESULT([Checking if QTKit framework is available... no])
698 fi
699 ;;
700 esac
701fi
702
703AC_ARG_ENABLE(ext_sound,
704 AC_HELP_STRING([--enable-ext-sound],
705 [PJMEDIA will not provide any sound device backend]),
706 [if test "$enable_ext_sound" = "yes"; then
707 [ac_pjmedia_snd=external]
708 AC_MSG_RESULT([Checking if external sound is set... yes])
709 fi]
710 )
711
712dnl # Include resampling small filter
713AC_SUBST(ac_no_small_filter)
714AC_ARG_ENABLE(small-filter,
715 AC_HELP_STRING([--disable-small-filter],
716 [Exclude small filter in resampling]),
717 [if test "$enable_small_filter" = "no"; then
718 [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
719 AC_MSG_RESULT([Checking if small filter is disabled... yes])
720 fi],
721 AC_MSG_RESULT([Checking if small filter is disabled... no]))
722
723dnl # Include resampling large filter
724AC_SUBST(ac_no_large_filter)
725AC_ARG_ENABLE(large-filter,
726 AC_HELP_STRING([--disable-large-filter],
727 [Exclude large filter in resampling]),
728 [if test "$enable_large_filter" = "no"; then
729 [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
730 AC_MSG_RESULT([Checking if large filter is disabled... yes])
731 fi],
732 AC_MSG_RESULT([Checking if large filter is disabled... no]))
733
734dnl # Include Speex AEC
735AC_SUBST(ac_no_speex_aec)
736AC_ARG_ENABLE(speex-aec,
737 AC_HELP_STRING([--disable-speex-aec],
738 [Exclude Speex Acoustic Echo Canceller/AEC]),
739 [if test "$enable_speex_aec" = "no"; then
740 [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
741 AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
742 fi],
743 AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
744
745dnl # Include G711 codec
746AC_SUBST(ac_no_g711_codec)
747AC_ARG_ENABLE(g711-codec,
748 AC_HELP_STRING([--disable-g711-codec],
749 [Exclude G.711 codecs from the build]),
750 [if test "$enable_g711_codec" = "no"; then
751 [ac_no_g711_codec=1]
752 AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
753 AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
754 fi],
755 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
756
757
758dnl # Include L16 codec
759AC_SUBST(ac_no_l16_codec)
760AC_ARG_ENABLE(l16-codec,
761 AC_HELP_STRING([--disable-l16-codec],
762 [Exclude Linear/L16 codec family from the build]),
763 [if test "$enable_l16_codec" = "no"; then
764 [ac_no_l16_codec=1]
765 AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
766 AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
767 fi],
768 AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
769
770
771dnl # Include GSM codec
772AC_SUBST(ac_no_gsm_codec)
773AC_ARG_ENABLE(gsm-codec,
774 AC_HELP_STRING([--disable-gsm-codec],
775 [Exclude GSM codec in the build]),
776 [if test "$enable_gsm_codec" = "no"; then
777 [ac_no_gsm_codec=1]
778 AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
779 AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
780 fi],
781 AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
782
783dnl # Include G.722 codec
784AC_SUBST(ac_no_g722_codec)
785AC_ARG_ENABLE(g722-codec,
786 AC_HELP_STRING([--disable-g722-codec],
787 [Exclude G.722 codec in the build]),
788 [if test "$enable_g722_codec" = "no"; then
789 [ac_no_g722_codec=1]
790 AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
791 AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
792 fi],
793 AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
794
795dnl # Include G722.1 codec
796AC_SUBST(ac_no_g7221_codec)
797AC_ARG_ENABLE(g7221-codec,
798 AC_HELP_STRING([--disable-g7221-codec],
799 [Exclude G.7221 codec in the build]),
800 [if test "$enable_g7221_codec" = "no"; then
801 [ac_no_g7221_codec=1]
802 AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
803 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
804 fi],
805 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
806
807dnl # Include Speex codec
808AC_SUBST(ac_no_speex_codec)
809AC_ARG_ENABLE(speex-codec,
810 AC_HELP_STRING([--disable-speex-codec],
811 [Exclude Speex codecs in the build]),
812 [if test "$enable_speex_codec" = "no"; then
813 [ac_no_speex_codec=1]
814 AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
815 AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
816 fi],
817 AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
818
819dnl # Include iLBC codec
820AC_SUBST(ac_no_ilbc_codec)
821AC_ARG_ENABLE(ilbc-codec,
822 AC_HELP_STRING([--disable-ilbc-codec],
823 [Exclude iLBC codec in the build]),
824 [if test "$enable_ilbc_codec" = "no"; then
825 [ac_no_ilbc_codec=1]
826 AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
827 AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
828 fi],
829 AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
830
831dnl # Include libsamplerate
832AC_ARG_ENABLE(libsamplerate,
833 AC_HELP_STRING([--enable-libsamplerate],
834 [Link with libsamplerate when available. Note that PJMEDIA_RESAMPLE_IMP must also be configured]),
835 [ AC_CHECK_LIB(samplerate,src_new) ],
836 AC_MSG_RESULT([Skipping libsamplerate detection])
837 )
838
Tristan Matthews0a329cc2013-07-17 13:20:14 -0400839AC_SUBST(ac_resample_dll)
840AC_ARG_ENABLE(resample_dll,
841 AC_HELP_STRING([--enable-resample-dll],
842 [Build libresample as shared library]),
843 [if test "$enable_resample_dll" = "yes"; then
844 [ac_resample_dll=1]
845 AC_MSG_RESULT([Building libresample as shared library... yes])
846 fi],
847 AC_MSG_RESULT([Building libresample as shared library... no])
848 )
849
850dnl # SDL alt prefix
851AC_ARG_WITH(sdl,
852 AC_HELP_STRING([--with-sdl=DIR],
853 [Specify alternate libSDL prefix]),
854 [],
855 [with_sdl=no]
856 )
857
858dnl # Do not use default SDL installation if we are cross-compiling
859if test "x$ac_cross_compile" != "x" -a "x$with_sdl" = "xno"; then
860 enable_sdl=no
861fi
862
863dnl # SDL
864AC_ARG_ENABLE(sdl,
865 AC_HELP_STRING([--disable-sdl],
866 [Disable SDL (default: not disabled)]),
867 [
868 if test "$enable_sdl" = "no"; then
869 AC_MSG_RESULT([Checking if SDL is disabled... yes])
870 fi
871 ],
872 [
873 if test "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
874 AC_MSG_RESULT([Using SDL prefix... $with_sdl])
875 AC_PATH_PROGS(SDL_CONFIG,sdl2-config sdl-config,,$with_sdl/bin)
876 else
877 AC_PATH_PROGS(SDL_CONFIG, sdl2-config sdl-config)
878 fi
879
880 AC_MSG_CHECKING([SDL availability])
881 if test "x$SDL_CONFIG" = "x"; then
882 AC_MSG_RESULT([not found])
883 elif (sh -c "$SDL_CONFIG --version" | grep -e '^1\.3' -e '^2\.') then
884 AC_SUBST(ac_sdl_cflags)
885 AC_SUBST(ac_sdl_ldflags)
886 ac_sdl_cflags=`$SDL_CONFIG --cflags`
887 ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
888 ac_sdl_ldflags=`$SDL_CONFIG --libs`
889 LIBS="$LIBS $ac_sdl_ldflags"
890 else
891 AC_MSG_RESULT([Unsupported SDL version])
892 fi
893 ])
894
895
896AC_ARG_WITH(ffmpeg,
897 AC_HELP_STRING([--with-ffmpeg=DIR],
898 [Specify alternate FFMPEG prefix]),
899 [],
900 [with_ffmpeg=no]
901 )
902
903dnl # Do not use default ffmpeg installation if we are cross-compiling
904if test "x$ac_cross_compile" != "x" -a "x$with_ffmpeg" = "xno"; then
905 enable_ffmpeg=no
906fi
907
908dnl # FFMPEG stuffs
909AC_ARG_ENABLE(ffmpeg,
910 AC_HELP_STRING([--disable-ffmpeg],
911 [Disable ffmpeg (default: not disabled)]),
912 [
913 AC_SUBST(ac_has_ffmpeg,0)
914 if test "$enable_ffmpeg" = "no"; then
915 AC_MSG_RESULT([Checking if ffmpeg is disabled... yes])
916 fi
917 ],
918 [
919 AC_SUBST(ac_ffmpeg_cflags)
920 AC_SUBST(ac_ffmpeg_ldflags)
921
922 FFMPEG_PREFIX=""
923 AC_SUBST(SAVED_PKG_CONFIG_PATH)
924 SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
925 if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
926 FFMPEG_PREFIX=$with_ffmpeg
927 AC_MSG_RESULT([Using ffmpeg prefix... $FFMPEG_PREFIX])
928 export PKG_CONFIG_PATH=$FFMPEG_PREFIX/lib/pkgconfig
929 fi
930
931 AC_CHECK_PROGS(PKG_CONFIG,pkg-config "python pkgconfig.py",none)
932
933 if test "$PKG_CONFIG" != "none"; then
934 AC_MSG_CHECKING([ffmpeg packages])
935 av_pkg=""
936 if $PKG_CONFIG --exists libdevice; then
937 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
938 av_pkg="$av_pkg libdevice"
939 fi
940 if $PKG_CONFIG --exists libavformat; then
941 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
942 av_pkg="$av_pkg libavformat"
943 fi
944 if $PKG_CONFIG --exists libavcodec; then
945 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
946 av_pkg="$av_pkg libavcodec"
947 fi
948 if $PKG_CONFIG --exists libswscale; then
949 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
950 av_pkg="$av_pkg libswscale"
951 fi
952 if $PKG_CONFIG --exists libavutil; then
953 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
954 av_pkg="$av_pkg libavutil"
955 fi
956 if $PKG_CONFIG --exists libavcore; then
957 ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
958 av_pkg="$av_pkg libavcore"
959 fi
960
961 if test "x$av_pkg" == "x"; then
962 AC_MSG_RESULT([none detected (check the prefix)! **])
963 else
964 AC_MSG_RESULT([$av_pkg])
965 fi
966
967 ac_ffmpeg_cflags="$ac_ffmpeg_cflags `$PKG_CONFIG --cflags $av_pkg`"
968 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags `$PKG_CONFIG --libs $av_pkg`"
969
970 else
971 dnl #
972 dnl # Use hardcoded values to configure ffmpeg
973 dnl #
974
975 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 ***])
976
977 LIBS="-L$FFMPEG_PREFIX/lib $LIBS"
978 LDFLAGS="-L$FFMPEG_PREFIX/lib $LDFLAGS"
979 CFLAGS="-I$FFMPEG_PREFIX/include $CFLAGS"
980
981 AC_CHECK_LIB(avdevice,
982 avdevice_version,
983 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
984 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavdevice"
985 ]
986 )
987 AC_CHECK_LIB(avutil,
988 av_malloc,
989 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
990 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavutil"
991 ]
992 )
993 AC_CHECK_LIB(avcodec,
994 avcodec_init,
995 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
996 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcodec"
997 ],
998 [],
999 [-lavutil]
1000 )
1001 AC_CHECK_LIB(avformat,
1002 av_register_all,
1003 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
1004 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavformat"
1005 ],
1006 [],
1007 [-lavcodec -lavutil]
1008 )
1009 AC_CHECK_LIB(swscale,
1010 sws_scale,
1011 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
1012 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lswscale"
1013 ],
1014 [],
1015 [-lavutil]
1016 )
1017 AC_CHECK_LIB(avcore,
1018 avcore_version,
1019 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
1020 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcore"
1021 ]
1022 )
1023
1024 fi
1025
1026 LIBS="$LIBS $ac_ffmpeg_ldflags"
1027 export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
1028 ]
1029 )
1030
1031dnl # Video for Linux 2
1032AC_ARG_ENABLE(v4l2,
1033 AC_HELP_STRING([--disable-v4l2],
1034 [Disable Video4Linux2 (default: not disabled)]),
1035 [
1036 if test "$enable_v4l2" = "no"; then
1037 AC_MSG_RESULT([Checking if V4L2 is disabled... yes])
1038 fi
1039 ],
1040 [
1041 AC_SUBST(ac_v4l2_cflags)
1042 AC_SUBST(ac_v4l2_ldflags)
1043 AC_CHECK_LIB(v4l2,
1044 v4l2_open,
1045 [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
1046 ac_v4l2_ldflags="-lv4l2"
1047 LIBS="$LIBS -lv4l2"
1048 ]
1049 )
1050 ])
1051
1052dnl ########################################################
1053dnl # Intel IPP support
1054dnl #
1055AC_ARG_ENABLE(ipp,
1056 AC_HELP_STRING([--enable-ipp],
1057 [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]),
1058 [],
1059 [enable_ipp=no]
1060 )
1061
1062AC_ARG_WITH(ipp,
1063 AC_HELP_STRING([--with-ipp=DIR],
1064 [Specify the Intel IPP location]),
1065 [],
1066 [with_ipp=no]
1067 )
1068
1069AC_ARG_WITH(ipp-samples,
1070 AC_HELP_STRING([--with-ipp-samples=DIR],
1071 [Specify the Intel IPP samples location]),
1072 [],
1073 [with_ipp_samples=no]
1074 )
1075
1076AC_ARG_WITH(ipp-arch,
1077 AC_HELP_STRING([--with-ipp-arch=ARCH],
1078 [Specify the Intel IPP ARCH suffix, e.g. "64" or "em64t. Default is blank for IA32"]),
1079 [],
1080 [with_ipp_arch=no]
1081 )
1082
1083if test "x$enable_ipp" != "xno"; then
1084 dnl #
1085 dnl # Verifying Intel IPP path
1086 dnl #
1087 AC_MSG_CHECKING([Intel IPP location])
1088
1089 if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
1090 AC_MSG_RESULT([$with_ipp])
1091 IPPROOT=$with_ipp
1092 elif test "x$IPPROOT" = "x"; then
1093 if test -d /opt/intel/ipp; then
1094 IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
1095 AC_MSG_RESULT([autodetected in $IPPROOT])
1096 fi
1097 else
1098 AC_MSG_RESULT([$IPPROOT])
1099 fi
1100
1101 if test "x$with_ipp_arch" != "xno"; then
1102 IPP_SUFFIX=$with_ipp_arch
1103 AC_MSG_RESULT([IPP arch suffix is set to $IPP_SUFFIX])
1104 else
1105 IPP_SUFFIX=""
1106 AC_MSG_RESULT([IPP arch suffix is set to empty])
1107 fi
1108
1109 if test x$IPPROOT = x; then
1110 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
1111 elif test ! -d $IPPROOT; then
1112 AC_MSG_ERROR([not found])
1113 elif test ! -d $IPPROOT/include; then
1114 AC_MSG_ERROR([directory doesn't seem to be valid])
1115 else
1116 # IPP directory looks okay.
1117 # Remove trailing backslash
1118 IPPROOT=`echo $IPPROOT | sed 's/\/$//'`
1119
1120 SAVED_CFLAGS="$CFLAGS"
1121 SAVED_LDFLAGS="$LDFLAGS"
1122 SAVED_LIBS="$LIBS"
1123
1124 IPP_CFLAGS="-I$IPPROOT/include"
1125 IPP_LIBS="-lippsc${IPP_SUFFIX} -lipps${IPP_SUFFIX} -lippcore${IPP_SUFFIX}"
1126
1127#
1128 # Some differences between Mac OS X and Linux
1129 case $target in
1130 *darwin* )
1131 IPP_LDFLAGS="-L$IPPROOT/Libraries -L$IPPROOT/lib"
1132 ;;
1133 *)
1134 # Find out where the libraries live.
1135 IPP7_ARCH=""
1136 if test -d $IPPROOT/lib/intel64; then
1137 IPP7_ARCH="intel64"
1138 elif test -d $IPPROOT/lib/ia32; then
1139 IPP7_ARCH="ia32"
1140 elif test -d $IPPROOT/lib/mic; then
1141 IPP7_ARCH="mic"
1142 fi
1143
1144 if test -z "$IPP7_ARCH"; then
1145 # IPP6 (and possibly below)
1146 IPP_LDFLAGS="-L$IPPROOT/sharedlib"
1147 IPP_LIBS="$IPP_LIBS -lippsr${IPP_SUFFIX} -lguide"
1148 else
1149 # IPP7
1150 if ! test -d $IPPROOT/../compiler; then
1151 AC_MSG_ERROR([Cannot find $IPPROOT/../compiler directory. Please set IPPROOT variable correctly])
1152 fi
1153 IPP_CFLAGS="$IPP_CFLAGS"
1154 IPP_LDFLAGS="-L$IPPROOT/lib/intel64 -L$IPPROOT/../compiler/lib/$IPP7_ARCH"
1155 IPP_LIBS="$IPP_LIBS -liomp5"
1156 fi
1157 ;;
1158 esac
1159
1160 #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
1161 #Static:
1162 #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
1163
1164 CFLAGS="$CFLAGS $IPP_CFLAGS"
1165 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
1166 LIBS="$IPP_LIBS $LIBS"
1167
1168
1169 AC_MSG_CHECKING([Intel IPP usability])
1170 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
1171 ]],
1172 [ippStaticInit();])],
1173 [AC_MSG_RESULT(ok)],
1174 [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])])
1175
1176 CFLAGS="$SAVED_CFLAGS"
1177 LDFLAGS="$SAVED_LDFLAGS"
1178 LIBS="$SAVED_LIBS"
1179 fi
1180
1181 dnl #
1182 dnl # Verifying Intel IPP samples path
1183 dnl #
1184 AC_MSG_CHECKING([Intel IPP samples location])
1185
1186 if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
1187 AC_MSG_RESULT([$with_ipp_samples])
1188 IPPSAMPLES=$with_ipp_samples
1189 elif test "x$IPPSAMPLES" = "x"; then
1190 if test -d /opt/intel/ipp-samples; then
1191 IPPSAMPLES=/opt/intel/ipp-samples
1192 AC_MSG_RESULT([autodetected in $IPPSAMPLES])
1193 fi
1194 else
1195 AC_MSG_RESULT([$IPPSAMPLES])
1196 fi
1197
1198 if test x$IPPSAMPLES = x; then
1199 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
1200 elif test ! -d $IPPSAMPLES; then
1201 AC_MSG_ERROR([not found])
1202 elif test ! -d $IPPSAMPLES/speech-codecs; then
1203 AC_MSG_ERROR([directory doesn't seem to be valid])
1204 else
1205 # Remove trailing backslash
1206 IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
1207
1208 # Guess the libusc.a/libspeech.a build location
1209 AC_MSG_CHECKING([Intel IPP USC build location])
1210 if test -d $IPPSAMPLES/speech-codecs/bin; then
1211 IPPVER=5
1212 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
1213 elif test -d $IPPSAMPLES/speech-codecs/_bin; then
1214 IPPVER=6
1215 if test -d $IPPSAMPLES/speech-codecs/_bin/*gcc*; then
1216 # gcc compiler
1217 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib | head -1`
1218 elif test -d $IPPSAMPLES/speech-codecs/_bin/*icc*; then
1219 # icc compiler
1220 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*icc*/lib | head -1`
1221 else
1222 AC_MSG_FAILURE([Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?])
1223 fi
1224 else
1225 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?])
1226 fi
1227
1228 # Test the directory
1229 if test ! -d $IPPSAMP_DIR; then
1230 AC_MSG_FAILURE([There's something wrong with this script, directory $IPPSAMP_DIR does not exist])
1231 exit 1;
1232 fi
1233
1234 if test "x$IPPVER" = "x5"; then
1235 IPPSAMP_LIBS="libusc.a"
1236 IPPSAMP_LDLIBS="-lusc"
1237 elif test "x$IPPVER" = "x6"; then
1238 IPPSAMP_LIBS="libspeech.a"
1239 IPPSAMP_LDLIBS="-lspeech"
1240 else
1241 AC_MSG_FAILURE([bug in this script: unsupported IPP version])
1242 fi
1243
1244 if test ! -f $IPPSAMP_DIR/$IPPSAMP_LIBS; then
1245 AC_MSG_FAILURE([$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR])
1246 fi
1247
1248 AC_MSG_RESULT([$IPPSAMP_DIR])
1249
1250 SAVED_CFLAGS="$CFLAGS"
1251 SAVED_LDFLAGS="$LDFLAGS"
1252 SAVED_LIBS="$LIBS"
1253
1254 IPPSAMP_INC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
1255 CFLAGS="$CFLAGS $IPPSAMP_INC"
1256 LDFLAGS="$LDFLAGS -L$IPPSAMP_DIR"
1257 LIBS="$IPPSAMP_LDLIBS $LIBS"
1258
1259 AC_MSG_CHECKING([Intel IPP USC usability])
1260 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
1261 ]],
1262 [extern USC_Fxns USC_G729AFP_Fxns;])],
1263 [AC_MSG_RESULT(ok)],
1264 [AC_MSG_FAILURE(failed)])
1265
1266 CFLAGS="$SAVED_CFLAGS"
1267 LDFLAGS="$IPP_LDFLAGS $SAVED_LDFLAGS"
1268 LIBS="$IPP_LIBS $SAVED_LIBS"
1269
1270 IPP_CFLAGS="$IPP_CFLAGS $IPPSAMP_INC"
1271 IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMP_DIR"
1272 IPP_LIBS="$IPPSAMP_LDLIBS $IPP_LIBS"
1273 fi
1274
1275 CFLAGS="$CFLAGS $IPP_CFLAGS"
1276 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
1277 LIBS="$LIBS $IPP_LIBS"
1278
1279 ac_build_mak_vars="$ac_build_mak_vars\n\
1280export IPP_CFLAGS=$IPP_CFLAGS\n\
1281export IPP_LDFLAGS=$IPP_LDFLAGS\n\
1282export IPP_LIBS=$IPP_LIBS"
1283else
1284 AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
1285fi
1286
1287
1288dnl ##########################################
1289dnl #
1290dnl # PJSIP CONFIG
1291dnl #
1292
1293dnl # SSL alt prefix
1294AC_ARG_WITH(ssl,
1295 AC_HELP_STRING([--with-ssl=DIR],
1296 [Specify alternate libssl prefix]),
1297 [],
1298 [with_ssl=no]
1299 )
1300
1301dnl # Do not use default SSL installation if we are cross-compiling
1302if test "x$ac_cross_compile" != "x" -a "x$with_ssl" = "xno"; then
1303 enable_ssl=no
1304fi
1305
1306dnl # Include SSL support
1307AC_SUBST(ac_no_ssl)
1308AC_ARG_ENABLE(ssl,
1309 AC_HELP_STRING([--disable-ssl],
1310 [Exclude SSL support the build (default: autodetect)])
1311 ,
1312 [
1313 if test "$enable_ssl" = "no"; then
1314 [ac_no_ssl=1]
1315 AC_MSG_RESULT([Checking if SSL support is disabled... yes])
1316 fi
1317 ],
1318 [
1319 AC_MSG_RESULT([checking for OpenSSL installations..])
1320 if test "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then
1321 CFLAGS="$CFLAGS -I$with_ssl/include"
1322 LDFLAGS="$LDFLAGS -L$with_ssl/lib"
1323 AC_MSG_RESULT([Using SSL prefix... $with_ssl])
1324 fi
1325 AC_SUBST(openssl_h_present)
1326 AC_SUBST(libssl_present)
1327 AC_SUBST(libcrypto_present)
1328 AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
1329 AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
1330 AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
1331 if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
1332 AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
1333 # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
1334 #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
1335 AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
1336 else
1337 AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **])
1338 fi
1339 ])
1340
1341dnl # Obsolete option --with-opencore-amrnb
1342AC_ARG_WITH(opencore-amrnb,
1343 AC_HELP_STRING([--with-opencore-amrnb=DIR],
1344 [This option is obsolete and replaced by --with-opencore-amr=DIR]),
1345 [AC_MSG_ERROR(This option is obsolete and replaced by --with-opencore-amr=DIR)],
1346 []
1347 )
1348
1349dnl # opencore-amr alt prefix
1350AC_ARG_WITH(opencore-amr,
1351 AC_HELP_STRING([--with-opencore-amr=DIR],
1352 [Specify alternate libopencore-amr prefix]),
1353 [],
1354 [with_opencore_amr=no]
1355 )
1356
1357dnl # Do not use default opencore-amr installation if we are cross-compiling
1358if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amr" = "xno"; then
1359 enable_opencore_amr=no
1360fi
1361
1362dnl # vo-amrwbenc alt prefix
1363AC_ARG_WITH(opencore-amrwbenc,
1364 AC_HELP_STRING([--with-opencore-amrwbenc=DIR],
1365 [Specify alternate libvo-amrwbenc prefix]),
1366 [],
1367 [with_opencore_amrwbenc=no]
1368 )
1369
1370dnl # Do not use default vo-amrwbenc installation if we are cross-compiling
1371if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amrwbenc" = "xno"; then
1372 enable_opencore_amrwbenc=no
1373fi
1374
1375
1376dnl # Include opencore-amr support
1377AC_SUBST(ac_no_opencore_amrnb)
1378AC_SUBST(ac_no_opencore_amrwb)
1379AC_ARG_ENABLE(opencore_amr,
1380 AC_HELP_STRING([--disable-opencore-amr],
1381 [Exclude OpenCORE AMR support from the build (default: autodetect)])
1382 ,
1383 [
1384 if test "$enable_opencore_amr" = "no"; then
1385 [ac_no_opencore_amrnb=1]
1386 [ac_no_opencore_amrwb=1]
1387 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
1388 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
1389 AC_MSG_RESULT([Checking if OpenCORE AMR support is disabled... yes])
1390 fi
1391 ],
1392 [
1393 AC_MSG_RESULT([checking for OpenCORE AMR installations..])
1394 if test "x$with_opencore_amr" != "xno" -a "x$with_opencore_amr" != "x"; then
1395 CFLAGS="$CFLAGS -I$with_opencore_amr/include"
1396 LDFLAGS="$LDFLAGS -L$with_opencore_amr/lib"
1397 AC_MSG_RESULT([Using OpenCORE AMR prefix... $with_opencore_amr])
1398 fi
1399 if test "x$with_opencore_amrwbenc" != "xno" -a "x$with_opencore_amrwbenc" != "x"; then
1400 CFLAGS="$CFLAGS -I$with_opencore_amrwbenc/include"
1401 LDFLAGS="$LDFLAGS -L$with_opencore_amrwbenc/lib"
1402 AC_MSG_RESULT([Using OpenCORE AMRWB-enc prefix... $with_opencore_amrwbenc])
1403 fi
1404 AC_SUBST(opencore_amrnb_h_present)
1405 AC_SUBST(opencore_amrnb_present)
1406 AC_CHECK_HEADER(opencore-amrnb/interf_enc.h,[opencore_amrnb_h_present=1])
1407 AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1 && LIBS="$LIBS -lopencore-amrnb"])
1408 if test "x$opencore_amrnb_h_present" = "x1" -a "x$opencore_amrnb_present" = "x1"; then
1409 AC_MSG_RESULT([OpenCORE AMR-NB library found, AMR-NB support enabled])
1410 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,1)
1411 else
1412 [ac_no_opencore_amrnb=1]
1413 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
1414 fi
1415 AC_SUBST(opencore_amrwb_enc_h_present)
1416 AC_SUBST(opencore_amrwb_enc_present)
1417 AC_SUBST(opencore_amrwb_dec_h_present)
1418 AC_SUBST(opencore_amrwb_dec_present)
1419 AC_CHECK_HEADER(vo-amrwbenc/enc_if.h,[opencore_amrwb_enc_h_present=1])
1420 AC_CHECK_HEADER(opencore-amrwb/dec_if.h,[opencore_amrwb_dec_h_present=1])
1421 AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"])
1422 AC_CHECK_LIB(vo-amrwbenc,E_IF_init,[opencore_amrwb_enc_present=1 && LIBS="$LIBS -lvo-amrwbenc"])
1423 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
1424 AC_MSG_RESULT([OpenCORE AMR-WB library found, AMR-WB support enabled])
1425 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,1)
1426 else
1427 [ac_no_opencore_amrwb=1]
1428 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
1429 fi
1430
1431 ])
1432
1433dnl # SILK prefix
1434AC_ARG_WITH(silk,
1435 AC_HELP_STRING([--with-silk=DIR],
1436 [Specify alternate SILK prefix]),
1437 [],
1438 [with_silk=no]
1439 )
1440
1441dnl # Do not use default SILK installation if we are cross-compiling
1442if test "x$ac_cross_compile" != "x" -a "x$with_silk" = "xno"; then
1443 enable_silk=no
1444fi
1445
1446dnl # Include SILK support
1447AC_SUBST(ac_no_silk)
1448AC_ARG_ENABLE(silk,
1449 AC_HELP_STRING([--disable-silk],
1450 [Exclude SILK support from the build (default: autodetect)])
1451 ,
1452 [
1453 if test "$enable_silk" = "no"; then
1454 [ac_no_silk=1]
1455 AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
1456 AC_MSG_RESULT([Checking if SILK support is disabled... yes])
1457 fi
1458 ],
1459 [
1460 AC_MSG_RESULT([checking for SILK installations..])
1461 if test "x$with_silk" != "xno" -a "x$with_silk" != "x"; then
1462 CFLAGS="$CFLAGS -I$with_silk/interface"
1463 CPPFLAGS="$CPPFLAGS -I$with_silk/interface"
1464 LDFLAGS="$LDFLAGS -L$with_silk"
1465 AC_MSG_RESULT([Using SILK prefix... $with_silk])
1466 fi
1467 AC_SUBST(silk_h_present)
1468 AC_SUBST(silk_present)
1469 AC_CHECK_HEADER(SKP_Silk_SDK_API.h,[silk_h_present=1])
1470 AC_CHECK_LIB(SKP_SILK_SDK,SKP_Silk_SDK_get_version,[silk_present=1 && LIBS="$LIBS -lSKP_SILK_SDK"])
1471 if test "x$silk_h_present" = "x1" -a "x$silk_present" = "x1"; then
1472 AC_MSG_RESULT([SILK library found, SILK support enabled])
1473 AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,1)
1474 else
1475 [ac_no_silk=1]
1476 AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
1477 fi
1478 ])
1479
1480
1481dnl ##########################################
1482dnl #
1483dnl # MANUAL CONFIG
1484dnl #
1485
1486
1487dnl # Determine if select() requires nfds to be filled up with
1488dnl # correct value (max_fd+1). If zero, nfds will be filled up with
1489dnl # PJ_FD_SETSIZE
1490AC_MSG_CHECKING([if select() needs correct nfds])
1491case $target in
1492 *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
1493 AC_MSG_RESULT(yes)
1494 ;;
1495 *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
1496 AC_MSG_RESULT([no (default)])
1497 AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
1498 ;;
1499esac
1500
1501dnl # Determine if pj_thread_create() should enforce thread stack size when
1502dnl # creating thread. Default is zero, to allow OS to allocate appropriate
1503dnl # thread's stack size.
1504AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
1505case $target in
1506 *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
1507 AC_MSG_RESULT(yes)
1508 ;;
1509 *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
1510 AC_MSG_RESULT([no (default)])
1511 ;;
1512esac
1513
1514dnl # Determine if pj_thread_create() should allocate thread's stack from
1515dnl # the pool. Default is zero, to let OS allocate thread's stack.
1516AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
1517case $target in
1518 *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
1519 AC_MSG_RESULT(yes)
1520 ;;
1521 *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
1522 AC_MSG_RESULT([no (default)])
1523 ;;
1524esac
1525
1526dnl # This value specifies the value set in errno by the OS when a non-blocking
1527dnl # socket recv() can not return immediate data.
1528case $target in
1529 *mingw* | *cygw* | *win32* | *w32* )
1530 AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
1531 ;;
1532 *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
1533 AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
1534 ;;
1535esac
1536
1537dnl # This value specifies the value set in errno by the OS when a non-blocking
1538dnl # socket connect() can not get connected immediately.
1539case $target in
1540 *mingw* | *cygw* | *win32* | *w32* )
1541 AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
1542 ;;
1543 *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
1544 AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
1545 ;;
1546esac
1547
1548
1549AC_SUBST(target)
1550AC_SUBST(ac_linux_poll,select)
1551AC_SUBST(ac_host,unix)
1552AC_SUBST(ac_main_obj)
1553case $target in
1554 *rtems*)
1555 ac_main_obj=main_rtems.o
1556 ;;
1557 *)
1558 ac_main_obj=main.o
1559 ;;
1560esac
1561AC_SUBST(CC)
1562
1563ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
1564AC_OUTPUT()
1565
1566
1567AC_MSG_RESULT([
1568
1569Configurations 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.
1570
1571Further customizations can be put in:
1572 - 'user.mak'
1573 - 'pjlib/include/pj/config_site.h'
1574
1575The next step now is to run 'make dep' and 'make'.
1576])
1577