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