blob: 4e54ade8ab8e5ba622506cd51e5306136d757be0 [file] [log] [blame]
Benny Prijono8a9b3b22010-01-14 14:46:54 +00001AC_INIT(pjproject,1.x)
Benny Prijono5b818b22006-09-17 22:58:51 +00002
3host_orig="$host"
4
Benny Prijonoc4c61d02006-08-20 20:47:34 +00005AC_CANONICAL_BUILD
6AC_CANONICAL_HOST
Benny Prijonoa9b372a2006-07-24 02:07:11 +00007AC_CANONICAL_TARGET
Benny Prijonoc4c61d02006-08-20 20:47:34 +00008AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h
9 pjlib/include/pj/compat/m_auto.h
Benny Prijonofe9bffd2007-01-27 17:44:13 +000010 pjmedia/include/pjmedia/config_auto.h
11 pjmedia/include/pjmedia-codec/config_auto.h
Benny Prijono7e0d75f2006-12-25 20:34:14 +000012 pjsip/include/pjsip/sip_autoconf.h
Benny Prijonoc4c61d02006-08-20 20:47:34 +000013 ])
14AC_CONFIG_FILES([build.mak
15 build/os-auto.mak
Benny Prijono8ec5eae2010-05-12 10:59:20 +000016 build/cc-auto.mak
Benny Prijono8a9b3b22010-01-14 14:46:54 +000017 pjlib/build/os-auto.mak
18 pjlib-util/build/os-auto.mak
Benny Prijonoc4c61d02006-08-20 20:47:34 +000019 pjmedia/build/os-auto.mak
20 pjsip/build/os-auto.mak
Benny Prijonod9627842007-04-18 09:24:31 +000021 third_party/build/os-auto.mak
Benny Prijono8a9b3b22010-01-14 14:46:54 +000022 third_party/build/portaudio/os-auto.mak
23 ])
Benny Prijonoc1fe23d2006-09-13 09:38:06 +000024
Benny Prijono12483112007-03-12 10:44:38 +000025
Benny Prijonoc1fe23d2006-09-13 09:38:06 +000026dnl
27dnl Setup default CFLAGS
28dnl
29if test "$CFLAGS" = ""; then
Benny Prijonod1459822006-10-04 20:56:39 +000030 CFLAGS="-O2"
Benny Prijonoc1fe23d2006-09-13 09:38:06 +000031else
32 CFLAGS="$CFLAGS"
33fi
34
35CXXFLAGS="$CFLAGS $CXXFLAGS"
36
Benny Prijono8ec5eae2010-05-12 10:59:20 +000037dnl #
38dnl # Configure tools
39dnl #
Benny Prijonoa9b372a2006-07-24 02:07:11 +000040AC_PROG_CC
Benny Prijonoc4c61d02006-08-20 20:47:34 +000041AC_PROG_CXX
Benny Prijonoa9b372a2006-07-24 02:07:11 +000042AC_LANG_C
43
Benny Prijono2d1f1b62010-05-17 16:09:12 +000044if test "$AR" = ""; then AR="${CROSS_COMPILE}ar rv"; fi
Benny Prijono8ec5eae2010-05-12 10:59:20 +000045AC_SUBST(AR)
46if test "$LD" = ""; then LD="$CC"; fi
47AC_SUBST(LD)
48if test "$LDOUT" = ""; then LDOUT="-o"; fi
49AC_SUBST(LDOUT)
Benny Prijono2d1f1b62010-05-17 16:09:12 +000050if test "$RANLIB" = ""; then RANLIB="${CROSS_COMPILE}ranlib"; fi
Benny Prijono8ec5eae2010-05-12 10:59:20 +000051AC_SUBST(RANLIB)
52if test "$OBJEXT" = ""; then OBJEXT='o'; fi
53AC_SUBST(OBJEXT)
54if test "$LIBEXT" = ""; then LIBEXT='a'; fi
55AC_SUBST(LIBEXT)
56if test "$LIBEXT2" = ""; then LIBEXT2=""; fi
57AC_SUBST(LIBEXT2)
58if test "$CC_OUT" = ""; then CC_OUT="-o"; fi
59AC_SUBST(CC_OUT)
60if test "$CC_INC" = ""; then CC_INC="-I"; fi
61AC_SUBST(CC_INC)
62if test "$CC_DEF" = ""; then CC_DEF="-D"; fi
63AC_SUBST(CC_DEF)
64if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi
65AC_SUBST(CC_OPTIMIZE)
66if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
67AC_SUBST(CC_CFLAGS)
68
69
70
Benny Prijono12483112007-03-12 10:44:38 +000071AC_SUBST(ac_pjdir)
Benny Prijono0822c192008-08-21 20:59:58 +000072AC_SUBST(ac_build_mak_vars)
Benny Prijono53847a32007-09-24 16:10:13 +000073case $target in
74 *mingw* | *cygw* | *win32* | *w32* )
75 ac_pjdir=`pwd -W`
76 ;;
77 *)
78 ac_pjdir=`pwd`
79 ;;
80esac
Benny Prijono12483112007-03-12 10:44:38 +000081
Benny Prijonoc4c61d02006-08-20 20:47:34 +000082AC_CHECK_LIB(pthread,pthread_create)
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +000083AC_CHECK_LIB(wsock32,puts)
84AC_CHECK_LIB(ws2_32,puts)
85AC_CHECK_LIB(ole32,puts)
86AC_CHECK_LIB(winmm,puts)
87AC_CHECK_LIB(socket,puts)
88AC_CHECK_LIB(rt,puts)
89AC_CHECK_LIB(nsl,puts)
Benny Prijono4e48b512007-05-16 13:41:00 +000090AC_CHECK_LIB(uuid,uuid_generate)
91AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
Benny Prijonoc4c61d02006-08-20 20:47:34 +000092
93AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
94AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
95
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +000096dnl
Benny Prijono1d971622006-09-10 22:27:40 +000097dnl Memory alignment detection
98dnl
99AC_MSG_CHECKING([memory alignment])
100case $target in
Benny Prijonob18e9502010-05-19 05:51:38 +0000101 sparc64-* | ia64-* | x86_64-* )
Benny Prijono1d971622006-09-10 22:27:40 +0000102 AC_DEFINE(PJ_POOL_ALIGNMENT, 8)
103 AC_MSG_RESULT([8 bytes])
104 ;;
105 * )
106 AC_DEFINE(PJ_POOL_ALIGNMENT, 4)
107 AC_MSG_RESULT([4 bytes (default)])
108 ;;
109esac
110
111
112dnl
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000113dnl Endianness detection
114dnl
Benny Prijonob466e232006-09-10 08:53:59 +0000115AC_C_BIGENDIAN
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000116
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000117dnl
118dnl Legacy macros
119dnl
120case $target in
121 *mingw* | *cygw* | *win32* | *w32* )
122 AC_DEFINE(PJ_WIN32,1)
123 AC_DEFINE(PJ_WIN32_WINNT,0x0400)
124 AC_DEFINE(WIN32_LEAN_AND_MEAN)
125 ;;
126 *darwin*)
127 AC_DEFINE(PJ_DARWINOS,1)
128 ;;
129 *linux*)
130 AC_DEFINE(PJ_LINUX,1)
131 ;;
132 *rtems*)
133 AC_DEFINE(PJ_RTEMS,1)
134 ;;
135 *sunos* | *solaris* )
136 AC_DEFINE(PJ_SUNOS,1)
137 ;;
138 *)
139 ;;
140esac
141
142
143
144
Benny Prijonob466e232006-09-10 08:53:59 +0000145dnl # --disable-floating-point option
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000146AC_ARG_ENABLE(floating-point,
147 AC_HELP_STRING([--disable-floating-point],
148 [Disable floating point where possible]),
149 [if test "$enable_floating_point" = "no"; then
150 AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
151 AC_MSG_RESULT([Checking if floating point is disabled... yes])
152 fi],
153 [
154 AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
155 AC_MSG_RESULT([Checking if floating point is disabled... no])
156 AC_CHECK_LIB(m,fmod)
157 ])
158
159
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000160AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
161AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
162AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000163
164case $target in
165 *mingw* | *cygw* | *win32* | *w32* )
166 AC_DEFINE(PJ_HAS_ERRNO_H,0)
167 ;;
168 *)
169 AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
170 ;;
171esac
172
Benny Prijono1d481ab2008-01-24 15:27:30 +0000173AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000174AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
175AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
176AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
Benny Prijono37fc9de2008-08-04 14:45:02 +0000177AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000178AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
Benny Prijono37fc9de2008-08-04 14:45:02 +0000179AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
Benny Prijonod5233702010-01-13 13:09:45 +0000180 [#if PJ_HAS_SYS_TYPES_H
181 # include <sys/types.h>
182 #endif
183 #if PJ_HAS_NETINET_IN_SYSTM_H
Benny Prijono37fc9de2008-08-04 14:45:02 +0000184 # include <netinet/in_systm.h>
185 #endif
Benny Prijonod5233702010-01-13 13:09:45 +0000186 #if PJ_HAS_NETINET_IN_H
187 # include <netinet/in.h>
188 #endif
Benny Prijono37fc9de2008-08-04 14:45:02 +0000189 ])
Benny Prijono1d61ba52009-10-24 00:00:40 +0000190AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
Benny Prijono5bbebc02010-06-15 05:21:43 +0000191AC_CHECK_HEADER(ifaddrs.h,
192 [AC_CHECK_FUNC(getifaddrs,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])])
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000193AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000194AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
195AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
196AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
197AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
Benny Prijonofdafd402008-01-23 14:34:46 +0000198AC_CHECK_HEADER(stdint.h,[AC_DEFINE(PJ_HAS_STDINT_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000199AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
200AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
201AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
202AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
203AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
204AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
205AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
206AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
Benny Prijonoa1aec0e2010-01-13 21:28:06 +0000207AC_CHECK_HEADER(sys/filio.h,[AC_DEFINE(PJ_HAS_SYS_FILIO_H,1)])
208AC_CHECK_HEADER(sys/sockio.h,[AC_DEFINE(PJ_HAS_SYS_SOCKIO_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000209AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
210AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000211AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
212AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000213AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
214 [#if PJ_HAS_WINSOCK2_H
215 # include <winsock2.h>
216 #elif PJ_HAS_WINSOCK_H
217 # include <winsock.h>
218 #endif
219 ])
Benny Prijonoe2746132008-09-27 13:16:35 +0000220AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
Benny Prijono4e48b512007-05-16 13:41:00 +0000221AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000222AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
Benny Prijonod5233702010-01-13 13:09:45 +0000223 [#if PJ_HAS_SYS_TYPES_H
224 # include <sys/types.h>
225 #endif
226 #if PJ_HAS_SYS_SOCKET_H
227
Benny Prijono188ba7e2008-03-25 13:53:16 +0000228 # include <sys/socket.h>
229 #endif
230 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000231AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
232AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
233
234AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
235AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
236
237AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
238AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
239
240AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
241AC_DEFINE(PJ_HAS_MALLOC,1)
242
243AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
244AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
245
246AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
247AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000248
Benny Prijonob466e232006-09-10 08:53:59 +0000249dnl # Determine if inet_aton() is available
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000250AC_MSG_CHECKING([if inet_aton() is available])
251AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
252 #include <sys/socket.h>
253 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000254 [inet_aton(0, 0);])],
255 [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
256 AC_MSG_RESULT(yes)],
257 [AC_MSG_RESULT(no)])
258
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000259dnl # Determine if inet_pton() is available
260AC_MSG_CHECKING([if inet_pton() is available])
261AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
262 #include <sys/socket.h>
263 #include <arpa/inet.h>]],
264 [inet_pton(0, 0, 0);])],
265 [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
266 AC_MSG_RESULT(yes)],
267 [AC_MSG_RESULT(no)])
268
269dnl # Determine if inet_ntop() is available
270AC_MSG_CHECKING([if inet_ntop() is available])
271AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
272 #include <sys/socket.h>
273 #include <arpa/inet.h>]],
274 [inet_ntop(0, 0, 0, 0);])],
275 [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
276 AC_MSG_RESULT(yes)],
277 [AC_MSG_RESULT(no)])
278
279dnl # Determine if getaddrinfo() is available
280AC_MSG_CHECKING([if getaddrinfo() is available])
281AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
282 #include <sys/socket.h>
283 #include <netdb.h>]],
284 [getaddrinfo(0, 0, 0, 0);])],
285 [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
286 AC_MSG_RESULT(yes)],
287 [AC_MSG_RESULT(no)])
288
Benny Prijonob466e232006-09-10 08:53:59 +0000289dnl # Determine if sockaddr_in has sin_len member
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000290AC_MSG_CHECKING([if sockaddr_in has sin_len member])
Benny Prijonob466e232006-09-10 08:53:59 +0000291AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
292 #include <sys/socket.h>
293 #include <netinet/in.h>
294 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000295 [struct sockaddr_in a; a.sin_len=0;])],
296 [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
297 AC_MSG_RESULT(yes)],
298 AC_MSG_RESULT(no))
299
Benny Prijonob466e232006-09-10 08:53:59 +0000300dnl # Determine if socklen_t is available
Benny Prijono30f85c62006-09-09 20:05:33 +0000301AC_MSG_CHECKING([if socklen_t is available])
Benny Prijonod5233702010-01-13 13:09:45 +0000302AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
303 #include <sys/socket.h>]],
Benny Prijono30f85c62006-09-09 20:05:33 +0000304 [socklen_t xxx = 0;])],
305 [AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
306 AC_MSG_RESULT(yes)],
307 AC_MSG_RESULT(no))
308
Benny Prijonob466e232006-09-10 08:53:59 +0000309dnl # Determine if SO_ERROR is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000310AC_MSG_CHECKING([if SO_ERROR is available])
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000311case $target in
312 *mingw* | *cygw* | *win32* | *w32* )
313 AC_DEFINE(PJ_HAS_SO_ERROR,1)
314 AC_MSG_RESULT(yes)
315 ;;
316 *)
317 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
318 #include <sys/socket.h>
319 #include <netinet/in.h>
320 #include <arpa/inet.h>]],
321 [int i=SO_ERROR;])],
322 [AC_DEFINE(PJ_HAS_SO_ERROR,1)
323 AC_MSG_RESULT(yes)],
324 AC_MSG_RESULT(no))
325 ;;
326esac
327
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000328
Benny Prijonob466e232006-09-10 08:53:59 +0000329dnl # Determine if RW-mutex is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000330AC_MSG_CHECKING([if pthread_rwlock_t is available])
331AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
332 [pthread_rwlock_t *x;])],
333 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000334 ac_rwmutex="yes"
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000335 AC_MSG_RESULT(yes)],
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000336 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000337 ac_rwmutex="no"
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000338 AC_MSG_RESULT(no)])
339
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000340dnl # If rwmutex is not detected, check again but this time
341dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
342if test "$ac_rwmutex" = "no"; then
343 AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
344 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
345 #include <pthread.h>]],
346 [pthread_rwlock_t *x;])],
347 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
348 CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
349 AC_MSG_RESULT(yes)],
350 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
351 AC_MSG_RESULT(no)])
352fi
353
354dnl # Do we have pthread_mutexattr_settype()?
355AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
356AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
357 [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
358 [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
359 AC_MSG_RESULT(yes)],
360 [AC_MSG_RESULT(no)])
361
362dnl # Does pthread_mutexattr_t has "recursive" member?
363AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
364AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
365 [[pthread_mutexattr_t attr;
366 attr.recursive=1;]])],
367 [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
368 AC_MSG_RESULT(yes)],
369 [AC_MSG_RESULT(no)])
370
Benny Prijono99eec382008-09-18 21:22:16 +0000371dnl ######################
372dnl # ioqueue selection
373dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000374AC_SUBST(ac_os_objs)
Benny Prijono99eec382008-09-18 21:22:16 +0000375AC_MSG_CHECKING([ioqueue backend])
376AC_ARG_ENABLE(epoll,
377 AC_HELP_STRING([--enable-epoll],
Benny Prijono9489e7a2008-09-19 22:18:50 +0000378 [Use /dev/epoll ioqueue on Linux (experimental)]),
Benny Prijono99eec382008-09-18 21:22:16 +0000379 [
380 ac_os_objs=ioqueue_epoll.o
381 AC_MSG_RESULT([/dev/epoll])
382 ],
383 [
384 ac_os_objs=ioqueue_select.o
385 AC_MSG_RESULT([select()])
386 ])
387
388
389dnl ######################
390dnl # OS specific files
391dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000392case $target in
393 *mingw* | *cygw* | *win32* | *w32* )
Benny Prijono99eec382008-09-18 21:22:16 +0000394 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"
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000395 ;;
396 *)
Benny Prijono99eec382008-09-18 21:22:16 +0000397 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"
Benny Prijono4e48b512007-05-16 13:41:00 +0000398 # UUID
399 if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
400 ac_os_objs="$ac_os_objs guid_uuid.o"
401 else
402 ac_os_objs="$ac_os_objs guid_simple.o"
403 fi
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000404 ;;
405esac
406
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000407
Benny Prijono4e48b512007-05-16 13:41:00 +0000408
Benny Prijonob466e232006-09-10 08:53:59 +0000409dnl ##########################################
410dnl #
411dnl # PJMEDIA
412dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000413
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000414dnl # Use external Speex installation
415AC_SUBST(ac_external_speex,0)
416AC_ARG_WITH(external-speex,
417 AC_HELP_STRING([--with-external-speex],
418 [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)]),
419 [
420 if test "x$with_external_speex" != "xno"; then
421 # Test Speex installation
422 AC_MSG_CHECKING([if external Speex devkit is installed])
423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
424 #include <speex/speex_echo.h>
425 ]],
426 [speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
427 [AC_MSG_RESULT(yes!!)
428 AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
429 ac_external_speex="1"
430 ],
431 [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])])
432 fi
433 ]
434 )
435
436dnl # Use external GSM codec library installation
437AC_SUBST(ac_external_gsm,0)
438AC_ARG_WITH(external-gsm,
439 AC_HELP_STRING([--with-external-gsm],
440 [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)]),
441 [
442 if test "x$with_external_gsm" != "xno"; then
Benny Prijonod4306432010-05-01 22:05:41 +0000443 # Test GSM library installation
444 AC_MSG_CHECKING([if external GSM devkit is installed as gsm/gsm.h])
445 AC_COMPILE_IFELSE(
446 [AC_LANG_PROGRAM([[#include <gsm/gsm.h> ]], [gsm_create(); ]) ],
447 [AC_MSG_RESULT(yes!!)
448 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
449 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_GSM_H, 1)
450 ac_external_gsm="1"
451 ],
452 [
453 AC_MSG_RESULT(no)
454 AC_MSG_CHECKING([if external GSM devkit is installed as gsm.h])
455 AC_COMPILE_IFELSE(
456 [AC_LANG_PROGRAM([[#include <gsm.h> ]], [gsm_create(); ]) ],
457 [AC_MSG_RESULT(yes!!)
458 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
459 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_H, 1)
460 ac_external_gsm="1"
461 ],
462 [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])
463 ]
464 )
465 ]
466 )
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000467 fi
468 ]
469 )
470
471
472
Benny Prijonob466e232006-09-10 08:53:59 +0000473dnl # Sound device backend selection
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000474AC_SUBST(ac_pjmedia_snd)
Benny Prijono1d971622006-09-10 22:27:40 +0000475AC_ARG_ENABLE(sound,
476 AC_HELP_STRING([--disable-sound],
477 [Exclude sound (i.e. use null sound)]),
478 [if test "$enable_sound" = "no"; then
479 [ac_pjmedia_snd=null]
480 AC_MSG_RESULT([Checking if sound is disabled... yes])
481 fi]
482 )
483
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000484dnl # Use external PortAudio installation
485AC_SUBST(ac_external_pa,0)
486AC_ARG_WITH(external-pa,
487 AC_HELP_STRING([--with-external-pa],
488 [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)]),
Benny Prijonofe0c1272010-01-13 16:28:15 +0000489 [
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000490 if test "x$with_external_pa" != "xno"; then
491 # Test PortAudio installation
492 AC_MSG_CHECKING([if external PortAudio devkit is installed])
493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
494 ]],
495 [Pa_Initialize();])],
496 [AC_MSG_RESULT(yes!!)
497 ac_external_pa="1"
498 ],
499 [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])])
Benny Prijonofe0c1272010-01-13 16:28:15 +0000500 fi
501 ]
502 )
503
Benny Prijono39ae2da2006-10-13 17:57:42 +0000504AC_SUBST(ac_pa_cflags)
Benny Prijono27c98722007-04-09 21:28:15 +0000505AC_CHECK_HEADER(sys/soundcard.h,
506 [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
507AC_CHECK_HEADER(linux/soundcard.h,
508 [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
509AC_CHECK_HEADER(machine/soundcard.h,
510 [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
511
Benny Prijono3e091672008-01-09 15:43:02 +0000512if test "x$ac_cv_c_bigendian" = "xyes"; then
513 ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
514else
515 ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
516fi
517
Benny Prijono1d971622006-09-10 22:27:40 +0000518if test "$enable_sound" = "no"; then
519 true;
520else
521 case $target in
Benny Prijono8ec5eae2010-05-12 10:59:20 +0000522 arm-apple-darwin*)
523 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox"
524 AC_MSG_RESULT([Checking sound device backend... AudioUnit])
525 ;;
Benny Prijonob466e232006-09-10 08:53:59 +0000526 *darwin*)
Benny Prijono39ae2da2006-10-13 17:57:42 +0000527 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
528 if test "`uname -r`" = "6.8"; then
Benny Prijono27c98722007-04-09 21:28:15 +0000529 #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
Benny Prijono39ae2da2006-10-13 17:57:42 +0000530 #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
531 ac_pjmedia_snd=pa_old_darwinos
532 AC_MSG_RESULT([Checking sound device backend... old coreaudio])
533 else
534 ac_pjmedia_snd=pa_darwinos
535 AC_MSG_RESULT([Checking sound device backend... coreaudio])
536 fi
Benny Prijonob466e232006-09-10 08:53:59 +0000537 ;;
538 *cygwin* | *mingw*)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000539 ac_pjmedia_snd=pa_win32
540 AC_MSG_RESULT([Checking sound device backend... win32 sound])
541 ;;
542 *rtems*)
543 ac_pjmedia_snd=null
544 AC_MSG_RESULT([Checking sound device backend... null sound])
545 ;;
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000546 *)
Benny Prijono0b462322008-03-12 22:44:24 +0000547 dnl # Check if ALSA is available
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000548 ac_pjmedia_snd=pa_unix
549 AC_CHECK_HEADER(alsa/version.h,
550 [AC_SUBST(ac_pa_use_alsa,1)
551 LIBS="$LIBS -lasound"
552 ],
553 [AC_SUBST(ac_pa_use_alsa,0)])
554 AC_MSG_RESULT([Checking sound device backend... unix])
Benny Prijono0b462322008-03-12 22:44:24 +0000555
556 dnl # Check if OSS is disabled
557 AC_SUBST(ac_pa_use_oss,1)
558 AC_ARG_ENABLE(oss,
559 AC_HELP_STRING([--disable-oss],
560 [Disable OSS audio (default: not disabled)])
561 ,
562 [
563 if test "$enable_oss" = "no"; then
564 [ac_pa_use_oss=0]
565 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
566 fi
567 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000568 ;;
Benny Prijono1d971622006-09-10 22:27:40 +0000569 esac
570fi
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000571
Benny Prijonoebb2c332008-07-28 23:40:58 +0000572AC_ARG_ENABLE(ext_sound,
573 AC_HELP_STRING([--enable-ext-sound],
574 [PJMEDIA will not provide any sound device backend]),
575 [if test "$enable_ext_sound" = "yes"; then
576 [ac_pjmedia_snd=external]
577 AC_MSG_RESULT([Checking if external sound is set... yes])
578 fi]
579 )
580
Benny Prijonob466e232006-09-10 08:53:59 +0000581dnl # Include resampling small filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000582AC_SUBST(ac_no_small_filter)
583AC_ARG_ENABLE(small-filter,
584 AC_HELP_STRING([--disable-small-filter],
585 [Exclude small filter in resampling]),
586 [if test "$enable_small_filter" = "no"; then
587 [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
588 AC_MSG_RESULT([Checking if small filter is disabled... yes])
589 fi],
590 AC_MSG_RESULT([Checking if small filter is disabled... no]))
591
Benny Prijonob466e232006-09-10 08:53:59 +0000592dnl # Include resampling large filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000593AC_SUBST(ac_no_large_filter)
594AC_ARG_ENABLE(large-filter,
595 AC_HELP_STRING([--disable-large-filter],
596 [Exclude large filter in resampling]),
597 [if test "$enable_large_filter" = "no"; then
598 [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
599 AC_MSG_RESULT([Checking if large filter is disabled... yes])
600 fi],
601 AC_MSG_RESULT([Checking if large filter is disabled... no]))
602
Benny Prijonob466e232006-09-10 08:53:59 +0000603dnl # Include Speex AEC
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000604AC_SUBST(ac_no_speex_aec)
605AC_ARG_ENABLE(speex-aec,
606 AC_HELP_STRING([--disable-speex-aec],
607 [Exclude Speex Acoustic Echo Canceller/AEC]),
608 [if test "$enable_speex_aec" = "no"; then
609 [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
610 AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
611 fi],
612 AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
613
Benny Prijonob466e232006-09-10 08:53:59 +0000614dnl # Include G711 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000615AC_SUBST(ac_no_g711_codec)
616AC_ARG_ENABLE(g711-codec,
617 AC_HELP_STRING([--disable-g711-codec],
618 [Exclude G.711 codecs from the build]),
619 [if test "$enable_g711_codec" = "no"; then
620 [ac_no_g711_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000621 AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000622 AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
623 fi],
624 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
625
626
Benny Prijonob466e232006-09-10 08:53:59 +0000627dnl # Include L16 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000628AC_SUBST(ac_no_l16_codec)
629AC_ARG_ENABLE(l16-codec,
630 AC_HELP_STRING([--disable-l16-codec],
631 [Exclude Linear/L16 codec family from the build]),
632 [if test "$enable_l16_codec" = "no"; then
633 [ac_no_l16_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000634 AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000635 AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
636 fi],
Benny Prijonoc1fe23d2006-09-13 09:38:06 +0000637 AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000638
639
Benny Prijonob466e232006-09-10 08:53:59 +0000640dnl # Include GSM codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000641AC_SUBST(ac_no_gsm_codec)
642AC_ARG_ENABLE(gsm-codec,
643 AC_HELP_STRING([--disable-gsm-codec],
644 [Exclude GSM codec in the build]),
645 [if test "$enable_gsm_codec" = "no"; then
646 [ac_no_gsm_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000647 AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000648 AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
649 fi],
650 AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
651
Benny Prijono71f657d2008-03-17 14:24:21 +0000652dnl # Include G.722 codec
653AC_SUBST(ac_no_g722_codec)
654AC_ARG_ENABLE(g722-codec,
655 AC_HELP_STRING([--disable-g722-codec],
656 [Exclude G.722 codec in the build]),
657 [if test "$enable_g722_codec" = "no"; then
658 [ac_no_g722_codec=1]
659 AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
660 AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
661 fi],
662 AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
663
Nanang Izzuddin56e380a2009-04-15 14:45:41 +0000664dnl # Include G722.1 codec
665AC_SUBST(ac_no_g7221_codec)
666AC_ARG_ENABLE(g7221-codec,
667 AC_HELP_STRING([--disable-g7221-codec],
668 [Exclude G.7221 codec in the build]),
669 [if test "$enable_g7221_codec" = "no"; then
670 [ac_no_g7221_codec=1]
671 AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
672 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
673 fi],
674 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
675
Benny Prijonob466e232006-09-10 08:53:59 +0000676dnl # Include Speex codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000677AC_SUBST(ac_no_speex_codec)
678AC_ARG_ENABLE(speex-codec,
679 AC_HELP_STRING([--disable-speex-codec],
680 [Exclude Speex codecs in the build]),
681 [if test "$enable_speex_codec" = "no"; then
682 [ac_no_speex_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000683 AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000684 AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
685 fi],
686 AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
687
Benny Prijonob466e232006-09-10 08:53:59 +0000688dnl # Include iLBC codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000689AC_SUBST(ac_no_ilbc_codec)
690AC_ARG_ENABLE(ilbc-codec,
691 AC_HELP_STRING([--disable-ilbc-codec],
692 [Exclude iLBC codec in the build]),
693 [if test "$enable_ilbc_codec" = "no"; then
694 [ac_no_ilbc_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000695 AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000696 AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
697 fi],
698 AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
699
Benny Prijono550a1a62007-10-16 08:54:00 +0000700dnl # Include libsamplerate
701AC_ARG_ENABLE(libsamplerate,
702 AC_HELP_STRING([--enable-libsamplerate],
703 [Link with libsamplerate when available. Note that PJMEDIA_RESAMPLE_IMP must also be configured]),
704 [ AC_CHECK_LIB(samplerate,src_new) ],
705 AC_MSG_RESULT([Skipping libsamplerate detection])
706 )
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000707
708
Benny Prijono0822c192008-08-21 20:59:58 +0000709dnl ########################################################
710dnl # Intel IPP support
711dnl #
712AC_ARG_ENABLE(ipp,
713 AC_HELP_STRING([--enable-ipp],
714 [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]),
715 [],
716 [enable_ipp=no]
717 )
718
Benny Prijono3965f192010-02-10 18:46:05 +0000719AC_ARG_WITH(ipp,
Benny Prijono0822c192008-08-21 20:59:58 +0000720 AC_HELP_STRING([--with-ipp=DIR],
721 [Specify the Intel IPP location]),
722 [],
723 [with_ipp=no]
724 )
725
Benny Prijono3965f192010-02-10 18:46:05 +0000726AC_ARG_WITH(ipp-samples,
Benny Prijono0822c192008-08-21 20:59:58 +0000727 AC_HELP_STRING([--with-ipp-samples=DIR],
728 [Specify the Intel IPP samples location]),
729 [],
730 [with_ipp_samples=no]
731 )
732
Benny Prijono3965f192010-02-10 18:46:05 +0000733AC_ARG_WITH(ipp-arch,
734 AC_HELP_STRING([--with-ipp-arch=ARCH],
735 [Specify the Intel IPP ARCH suffix, e.g. "64" or "em64t. Default is blank for IA32"]),
736 [],
737 [with_ipp_arch=no]
738 )
739
Benny Prijono0822c192008-08-21 20:59:58 +0000740if test "x$enable_ipp" != "xno"; then
741 dnl #
742 dnl # Verifying Intel IPP path
743 dnl #
744 AC_MSG_CHECKING([Intel IPP location])
745
746 if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
747 AC_MSG_RESULT([$with_ipp])
748 IPPROOT=$with_ipp
749 elif test "x$IPPROOT" = "x"; then
750 if test -d /opt/intel/ipp; then
751 IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
752 AC_MSG_RESULT([autodetected in $IPPROOT])
753 fi
754 else
755 AC_MSG_RESULT([$IPPROOT])
756 fi
757
Benny Prijono3965f192010-02-10 18:46:05 +0000758 if test "x$with_ipp_arch" != "xno"; then
759 IPP_SUFFIX="em64t"
760 AC_MSG_RESULT([IPP arch suffix is set to $IPP_SUFFIX])
761 else
762 IPP_SUFFIX=""
763 AC_MSG_RESULT([IPP arch suffix is set to empty])
764 fi
765
Benny Prijono0822c192008-08-21 20:59:58 +0000766 if test x$IPPROOT = x; then
767 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
768 elif test ! -d $IPPROOT; then
769 AC_MSG_ERROR([not found])
770 elif test ! -d $IPPROOT/include; then
771 AC_MSG_ERROR([directory doesn't seem to be valid])
772 else
773 # IPP directory looks okay.
774 # Remove trailing backslash
Benny Prijono3965f192010-02-10 18:46:05 +0000775 IPPROOT=`echo $IPPROOT | sed 's/\/$//'`
Benny Prijono0822c192008-08-21 20:59:58 +0000776
777 SAVED_CFLAGS="$CFLAGS"
778 SAVED_LDFLAGS="$LDFLAGS"
779 SAVED_LIBS="$LIBS"
780
781 IPP_CFLAGS="-I$IPPROOT/include"
Benny Prijono46bd0842010-02-12 14:12:41 +0000782 IPP_LIBS="-lippsc${IPP_SUFFIX} -lipps${IPP_SUFFIX} -lippsr${IPP_SUFFIX} -lippcore${IPP_SUFFIX}"
783
784 # Some differences between Mac OS X and Linux
785 case $target in
786 *darwin* )
787 IPP_LDFLAGS="-L$IPPROOT/Libraries -L$IPPROOT/lib"
788 ;;
789 *)
790 IPP_LDFLAGS="-L$IPPROOT/sharedlib"
791 IPP_LIBS="$IPP_LIBS -lguide"
792 ;;
793 esac
794
Benny Prijono0822c192008-08-21 20:59:58 +0000795 #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
Benny Prijono46bd0842010-02-12 14:12:41 +0000796 #Static:
Benny Prijono0822c192008-08-21 20:59:58 +0000797 #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
798
799 CFLAGS="$CFLAGS $IPP_CFLAGS"
800 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
801 LIBS="$IPP_LIBS $LIBS"
802
803
804 AC_MSG_CHECKING([Intel IPP usability])
805 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
806 ]],
807 [ippStaticInit();])],
808 [AC_MSG_RESULT(ok)],
Benny Prijono3965f192010-02-10 18:46:05 +0000809 [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)])
Benny Prijono0822c192008-08-21 20:59:58 +0000810
811 CFLAGS="$SAVED_CFLAGS"
812 LDFLAGS="$SAVED_LDFLAGS"
813 LIBS="$SAVED_LIBS"
814 fi
815
816 dnl #
817 dnl # Verifying Intel IPP samples path
818 dnl #
819 AC_MSG_CHECKING([Intel IPP samples location])
820
821 if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
822 AC_MSG_RESULT([$with_ipp_samples])
823 IPPSAMPLES=$with_ipp_samples
824 elif test "x$IPPSAMPLES" = "x"; then
825 if test -d /opt/intel/ipp-samples; then
826 IPPSAMPLES=/opt/intel/ipp-samples
827 AC_MSG_RESULT([autodetected in $IPPSAMPLES])
828 fi
829 else
830 AC_MSG_RESULT([$IPPSAMPLES])
831 fi
832
833 if test x$IPPSAMPLES = x; then
834 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
835 elif test ! -d $IPPSAMPLES; then
836 AC_MSG_ERROR([not found])
837 elif test ! -d $IPPSAMPLES/speech-codecs; then
838 AC_MSG_ERROR([directory doesn't seem to be valid])
839 else
840 # Remove trailing backslash
841 IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
Benny Prijono3965f192010-02-10 18:46:05 +0000842
843 # Guess the libusc.a/libspeech.a build location
Benny Prijono0822c192008-08-21 20:59:58 +0000844 AC_MSG_CHECKING([Intel IPP USC build location])
Benny Prijono3965f192010-02-10 18:46:05 +0000845 if test -d $IPPSAMPLES/speech-codecs/bin; then
846 IPPVER=5
847 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
848 elif test -d $IPPSAMPLES/speech-codecs/_bin; then
849 IPPVER=6
Benny Prijono46bd0842010-02-12 14:12:41 +0000850 if test -d $IPPSAMPLES/speech-codecs/_bin/*gcc*; then
851 # gcc compiler
852 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib | head -1`
853 elif test -d $IPPSAMPLES/speech-codecs/_bin/*icc*; then
854 # icc compiler
855 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*icc*/lib | head -1`
856 else
857 AC_MSG_FAILURE([Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?])
858 fi
Benny Prijono3965f192010-02-10 18:46:05 +0000859 else
860 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?])
Benny Prijono0822c192008-08-21 20:59:58 +0000861 fi
Benny Prijono3965f192010-02-10 18:46:05 +0000862
863 # Test the directory
864 if test ! -d $IPPSAMP_DIR; then
865 AC_MSG_FAILURE([There's something wrong with this script, directory $IPPSAMP_DIR does not exist])
866 exit 1;
Benny Prijono0822c192008-08-21 20:59:58 +0000867 fi
Benny Prijono3965f192010-02-10 18:46:05 +0000868
869 if test "x$IPPVER" = "x5"; then
870 IPPSAMP_LIBS="libusc.a"
871 IPPSAMP_LDLIBS="-lusc"
872 elif test "x$IPPVER" = "x6"; then
873 IPPSAMP_LIBS="libspeech.a"
874 IPPSAMP_LDLIBS="-lspeech"
875 else
876 AC_MSG_FAILURE([bug in this script: unsupported IPP version])
877 fi
878
879 if test ! -f $IPPSAMP_DIR/$IPPSAMP_LIBS; then
880 AC_MSG_FAILURE([$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR])
881 fi
882
883 AC_MSG_RESULT([$IPPSAMP_DIR])
Benny Prijono0822c192008-08-21 20:59:58 +0000884
885 SAVED_CFLAGS="$CFLAGS"
886 SAVED_LDFLAGS="$LDFLAGS"
887 SAVED_LIBS="$LIBS"
888
Benny Prijono3965f192010-02-10 18:46:05 +0000889 IPPSAMP_INC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
890 CFLAGS="$CFLAGS $IPPSAMP_INC"
891 LDFLAGS="$LDFLAGS -L$IPPSAMP_DIR"
892 LIBS="$IPPSAMP_LDLIBS $LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +0000893
894 AC_MSG_CHECKING([Intel IPP USC usability])
895 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
896 ]],
897 [extern USC_Fxns USC_G729AFP_Fxns;])],
898 [AC_MSG_RESULT(ok)],
899 [AC_MSG_FAILURE(failed)])
900
901 CFLAGS="$SAVED_CFLAGS"
Benny Prijono3965f192010-02-10 18:46:05 +0000902 LDFLAGS="$IPP_LDFLAGS $SAVED_LDFLAGS"
903 LIBS="$IPP_LIBS $SAVED_LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +0000904
Benny Prijono3965f192010-02-10 18:46:05 +0000905 IPP_CFLAGS="$IPP_CFLAGS $IPPSAMP_INC"
906 IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMP_DIR"
907 IPP_LIBS="$IPPSAMP_LDLIBS $IPP_LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +0000908 fi
909
Benny Prijono3965f192010-02-10 18:46:05 +0000910 CFLAGS="$CFLAGS $IPP_CFLAGS"
911 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
912 LIBS="$LIBS $IPP_LIBS"
913
Benny Prijono0822c192008-08-21 20:59:58 +0000914 ac_build_mak_vars="$ac_build_mak_vars\n\
915export IPP_CFLAGS=$IPP_CFLAGS\n\
916export IPP_LDFLAGS=$IPP_LDFLAGS\n\
917export IPP_LIBS=$IPP_LIBS"
918else
919 AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
920fi
921
922
Benny Prijonob466e232006-09-10 08:53:59 +0000923dnl ##########################################
924dnl #
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000925dnl # PJSIP CONFIG
926dnl #
927
928dnl # Include SSL support
929AC_SUBST(ac_no_ssl)
930AC_ARG_ENABLE(ssl,
Benny Prijonoce1db762007-02-14 02:21:08 +0000931 AC_HELP_STRING([--disable-ssl],
932 [Exclude SSL support the build (default: autodetect)])
933 ,
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000934 [
935 if test "$enable_ssl" = "no"; then
936 [ac_no_ssl=1]
937 AC_MSG_RESULT([Checking if SSL support is disabled... yes])
938 fi
939 ],
940 [
941 AC_MSG_RESULT([checking for OpenSSL installations..])
942 AC_SUBST(openssl_h_present)
943 AC_SUBST(libssl_present)
944 AC_SUBST(libcrypto_present)
945 AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000946 AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
Benny Prijonod5233702010-01-13 13:09:45 +0000947 AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000948 if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
949 AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
Nanang Izzuddin9c7616f2009-10-28 06:09:15 +0000950 # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
951 #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
Nanang Izzuddinea6d3c42009-10-26 15:47:52 +0000952 AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000953 else
954 AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **])
955 fi
956 ])
957
958
959dnl ##########################################
960dnl #
Benny Prijonob466e232006-09-10 08:53:59 +0000961dnl # MANUAL CONFIG
962dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000963
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000964
Benny Prijonob466e232006-09-10 08:53:59 +0000965dnl # Determine if select() requires nfds to be filled up with
966dnl # correct value (max_fd+1). If zero, nfds will be filled up with
967dnl # PJ_FD_SETSIZE
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000968AC_MSG_CHECKING([if select() needs correct nfds])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000969case $target in
970 *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000971 AC_MSG_RESULT(yes)
972 ;;
973 *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
974 AC_MSG_RESULT([no (default)])
975 AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
976 ;;
977esac
978
Benny Prijonob466e232006-09-10 08:53:59 +0000979dnl # Determine if pj_thread_create() should enforce thread stack size when
980dnl # creating thread. Default is zero, to allow OS to allocate appropriate
981dnl # thread's stack size.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000982AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
983case $target in
984 *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
985 AC_MSG_RESULT(yes)
986 ;;
987 *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
988 AC_MSG_RESULT([no (default)])
989 ;;
990esac
991
Benny Prijonob466e232006-09-10 08:53:59 +0000992dnl # Determine if pj_thread_create() should allocate thread's stack from
993dnl # the pool. Default is zero, to let OS allocate thread's stack.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000994AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
995case $target in
996 *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
997 AC_MSG_RESULT(yes)
998 ;;
999 *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
1000 AC_MSG_RESULT([no (default)])
1001 ;;
1002esac
1003
Benny Prijonob466e232006-09-10 08:53:59 +00001004dnl # This value specifies the value set in errno by the OS when a non-blocking
1005dnl # socket recv() can not return immediate data.
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001006case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +00001007 *mingw* | *cygw* | *win32* | *w32* )
1008 AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
1009 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001010 *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
1011 AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
1012 ;;
1013esac
1014
Benny Prijonob466e232006-09-10 08:53:59 +00001015dnl # This value specifies the value set in errno by the OS when a non-blocking
1016dnl # socket connect() can not get connected immediately.
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001017case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +00001018 *mingw* | *cygw* | *win32* | *w32* )
1019 AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
1020 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001021 *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
1022 AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
1023 ;;
1024esac
1025
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001026
Benny Prijonoc4c61d02006-08-20 20:47:34 +00001027AC_SUBST(target)
1028AC_SUBST(ac_cross_compile)
1029if test "$build" = "$host"; then
1030 ac_cross_compile=
1031else
Benny Prijono5b818b22006-09-17 22:58:51 +00001032 ac_cross_compile=${host_orig}-
Benny Prijonoc4c61d02006-08-20 20:47:34 +00001033fi
1034AC_SUBST(ac_linux_poll,select)
1035AC_SUBST(ac_host,unix)
1036AC_SUBST(ac_main_obj)
1037case $target in
1038 *rtems*)
1039 ac_main_obj=main_rtems.o
1040 ;;
1041 *)
1042 ac_main_obj=main.o
1043 ;;
1044esac
1045AC_SUBST(CC)
Benny Prijono0822c192008-08-21 20:59:58 +00001046
1047ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001048AC_OUTPUT()
1049
Benny Prijonod9627842007-04-18 09:24:31 +00001050
1051AC_MSG_RESULT([
1052
Benny Prijonoc16c6e32007-11-18 14:53:47 +00001053Configurations 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.
Benny Prijonod9627842007-04-18 09:24:31 +00001054
Benny Prijonoc16c6e32007-11-18 14:53:47 +00001055Further customizations can be put in:
Benny Prijonod9627842007-04-18 09:24:31 +00001056 - 'user.mak'
1057 - 'pjlib/include/pj/config_site.h'
1058
1059The next step now is to run 'make dep' and 'make'.
1060])
1061