blob: 771fd6a0e9e63bd56f05c4242ed280b7a8870104 [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 Prijonofe3bf0e2010-08-05 06:27:20 +000044dnl #
45dnl # Setup CROSS_COMPILE variable
46dnl #
47if test -z "$CROSS_COMPILE"; then
48 CROSS_COMPILE=`echo ${CC} | sed 's/gcc//'`
49fi
50
Benny Prijono2d1f1b62010-05-17 16:09:12 +000051if test "$AR" = ""; then AR="${CROSS_COMPILE}ar rv"; fi
Benny Prijono8ec5eae2010-05-12 10:59:20 +000052AC_SUBST(AR)
53if test "$LD" = ""; then LD="$CC"; fi
54AC_SUBST(LD)
55if test "$LDOUT" = ""; then LDOUT="-o"; fi
56AC_SUBST(LDOUT)
Benny Prijono2d1f1b62010-05-17 16:09:12 +000057if test "$RANLIB" = ""; then RANLIB="${CROSS_COMPILE}ranlib"; fi
Benny Prijono8ec5eae2010-05-12 10:59:20 +000058AC_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
Benny Prijono12483112007-03-12 10:44:38 +000078AC_SUBST(ac_pjdir)
Benny Prijono0822c192008-08-21 20:59:58 +000079AC_SUBST(ac_build_mak_vars)
Benny Prijonofe3bf0e2010-08-05 06:27:20 +000080
81case $host in
Benny Prijono53847a32007-09-24 16:10:13 +000082 *mingw* | *cygw* | *win32* | *w32* )
Benny Prijonofe3bf0e2010-08-05 06:27:20 +000083 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
Benny Prijono53847a32007-09-24 16:10:13 +000089 ;;
90 *)
91 ac_pjdir=`pwd`
92 ;;
93esac
Benny Prijono12483112007-03-12 10:44:38 +000094
Benny Prijonoc4c61d02006-08-20 20:47:34 +000095AC_CHECK_LIB(pthread,pthread_create)
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +000096AC_CHECK_LIB(wsock32,puts)
97AC_CHECK_LIB(ws2_32,puts)
98AC_CHECK_LIB(ole32,puts)
99AC_CHECK_LIB(winmm,puts)
100AC_CHECK_LIB(socket,puts)
101AC_CHECK_LIB(rt,puts)
102AC_CHECK_LIB(nsl,puts)
Benny Prijono4e48b512007-05-16 13:41:00 +0000103AC_CHECK_LIB(uuid,uuid_generate)
104AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000105
106AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
107AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
108
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000109dnl
Benny Prijono1d971622006-09-10 22:27:40 +0000110dnl Memory alignment detection
111dnl
112AC_MSG_CHECKING([memory alignment])
113case $target in
Benny Prijonob18e9502010-05-19 05:51:38 +0000114 sparc64-* | ia64-* | x86_64-* )
Benny Prijono1d971622006-09-10 22:27:40 +0000115 AC_DEFINE(PJ_POOL_ALIGNMENT, 8)
116 AC_MSG_RESULT([8 bytes])
117 ;;
118 * )
119 AC_DEFINE(PJ_POOL_ALIGNMENT, 4)
120 AC_MSG_RESULT([4 bytes (default)])
121 ;;
122esac
123
124
125dnl
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000126dnl Endianness detection
127dnl
Benny Prijonob466e232006-09-10 08:53:59 +0000128AC_C_BIGENDIAN
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000129
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000130dnl
131dnl Legacy macros
132dnl
133case $target in
134 *mingw* | *cygw* | *win32* | *w32* )
135 AC_DEFINE(PJ_WIN32,1)
136 AC_DEFINE(PJ_WIN32_WINNT,0x0400)
137 AC_DEFINE(WIN32_LEAN_AND_MEAN)
138 ;;
139 *darwin*)
140 AC_DEFINE(PJ_DARWINOS,1)
141 ;;
142 *linux*)
143 AC_DEFINE(PJ_LINUX,1)
144 ;;
145 *rtems*)
146 AC_DEFINE(PJ_RTEMS,1)
147 ;;
148 *sunos* | *solaris* )
149 AC_DEFINE(PJ_SUNOS,1)
150 ;;
151 *)
152 ;;
153esac
154
155
156
157
Benny Prijonob466e232006-09-10 08:53:59 +0000158dnl # --disable-floating-point option
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000159AC_ARG_ENABLE(floating-point,
160 AC_HELP_STRING([--disable-floating-point],
161 [Disable floating point where possible]),
162 [if test "$enable_floating_point" = "no"; then
163 AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
164 AC_MSG_RESULT([Checking if floating point is disabled... yes])
165 fi],
166 [
167 AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
168 AC_MSG_RESULT([Checking if floating point is disabled... no])
169 AC_CHECK_LIB(m,fmod)
170 ])
171
172
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000173AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
174AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
175AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000176
177case $target in
178 *mingw* | *cygw* | *win32* | *w32* )
179 AC_DEFINE(PJ_HAS_ERRNO_H,0)
180 ;;
181 *)
182 AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
183 ;;
184esac
185
Benny Prijono1d481ab2008-01-24 15:27:30 +0000186AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000187AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
Benny Prijonoe3e65802011-02-28 07:44:19 +0000188AC_CHECK_HEADER(limits.h,[AC_DEFINE(PJ_HAS_LIMITS_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000189AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
190AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
Benny Prijono37fc9de2008-08-04 14:45:02 +0000191AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000192AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
Benny Prijono37fc9de2008-08-04 14:45:02 +0000193AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
Benny Prijonod5233702010-01-13 13:09:45 +0000194 [#if PJ_HAS_SYS_TYPES_H
195 # include <sys/types.h>
196 #endif
197 #if PJ_HAS_NETINET_IN_SYSTM_H
Benny Prijono37fc9de2008-08-04 14:45:02 +0000198 # include <netinet/in_systm.h>
199 #endif
Benny Prijonod5233702010-01-13 13:09:45 +0000200 #if PJ_HAS_NETINET_IN_H
201 # include <netinet/in.h>
202 #endif
Benny Prijono37fc9de2008-08-04 14:45:02 +0000203 ])
Benny Prijono1d61ba52009-10-24 00:00:40 +0000204AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
Benny Prijono5bbebc02010-06-15 05:21:43 +0000205AC_CHECK_HEADER(ifaddrs.h,
206 [AC_CHECK_FUNC(getifaddrs,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])])
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000207AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000208AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
209AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
210AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
211AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
Benny Prijonofdafd402008-01-23 14:34:46 +0000212AC_CHECK_HEADER(stdint.h,[AC_DEFINE(PJ_HAS_STDINT_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000213AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
214AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
215AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
216AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
217AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
218AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
219AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
220AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
Benny Prijonoa1aec0e2010-01-13 21:28:06 +0000221AC_CHECK_HEADER(sys/filio.h,[AC_DEFINE(PJ_HAS_SYS_FILIO_H,1)])
222AC_CHECK_HEADER(sys/sockio.h,[AC_DEFINE(PJ_HAS_SYS_SOCKIO_H,1)])
Benny Prijonoe3e65802011-02-28 07:44:19 +0000223AC_CHECK_HEADER(sys/utsname.h,[AC_DEFINE(PJ_HAS_SYS_UTSNAME_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000224AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
225AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000226AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
227AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000228AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
229 [#if PJ_HAS_WINSOCK2_H
230 # include <winsock2.h>
231 #elif PJ_HAS_WINSOCK_H
232 # include <winsock.h>
233 #endif
234 ])
Benny Prijonoe2746132008-09-27 13:16:35 +0000235AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
Benny Prijono4e48b512007-05-16 13:41:00 +0000236AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000237AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
Benny Prijonod5233702010-01-13 13:09:45 +0000238 [#if PJ_HAS_SYS_TYPES_H
239 # include <sys/types.h>
240 #endif
241 #if PJ_HAS_SYS_SOCKET_H
242
Benny Prijono188ba7e2008-03-25 13:53:16 +0000243 # include <sys/socket.h>
244 #endif
245 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000246AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
247AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
248
249AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
250AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
251
252AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
253AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
254
255AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
256AC_DEFINE(PJ_HAS_MALLOC,1)
257
258AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
259AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
260
261AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
262AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000263
Benny Prijonob466e232006-09-10 08:53:59 +0000264dnl # Determine if inet_aton() is available
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000265AC_MSG_CHECKING([if inet_aton() is available])
266AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
267 #include <sys/socket.h>
268 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000269 [inet_aton(0, 0);])],
270 [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
271 AC_MSG_RESULT(yes)],
272 [AC_MSG_RESULT(no)])
273
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000274dnl # Determine if inet_pton() is available
275AC_MSG_CHECKING([if inet_pton() is available])
276AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
277 #include <sys/socket.h>
278 #include <arpa/inet.h>]],
279 [inet_pton(0, 0, 0);])],
280 [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
281 AC_MSG_RESULT(yes)],
282 [AC_MSG_RESULT(no)])
283
284dnl # Determine if inet_ntop() is available
285AC_MSG_CHECKING([if inet_ntop() is available])
286AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
287 #include <sys/socket.h>
288 #include <arpa/inet.h>]],
289 [inet_ntop(0, 0, 0, 0);])],
290 [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
291 AC_MSG_RESULT(yes)],
292 [AC_MSG_RESULT(no)])
293
294dnl # Determine if getaddrinfo() is available
295AC_MSG_CHECKING([if getaddrinfo() is available])
296AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
297 #include <sys/socket.h>
298 #include <netdb.h>]],
299 [getaddrinfo(0, 0, 0, 0);])],
300 [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
301 AC_MSG_RESULT(yes)],
302 [AC_MSG_RESULT(no)])
303
Benny Prijonob466e232006-09-10 08:53:59 +0000304dnl # Determine if sockaddr_in has sin_len member
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000305AC_MSG_CHECKING([if sockaddr_in has sin_len member])
Benny Prijonob466e232006-09-10 08:53:59 +0000306AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
307 #include <sys/socket.h>
308 #include <netinet/in.h>
309 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000310 [struct sockaddr_in a; a.sin_len=0;])],
311 [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
312 AC_MSG_RESULT(yes)],
313 AC_MSG_RESULT(no))
314
Benny Prijonob466e232006-09-10 08:53:59 +0000315dnl # Determine if socklen_t is available
Benny Prijono30f85c62006-09-09 20:05:33 +0000316AC_MSG_CHECKING([if socklen_t is available])
Benny Prijonod5233702010-01-13 13:09:45 +0000317AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
318 #include <sys/socket.h>]],
Benny Prijono30f85c62006-09-09 20:05:33 +0000319 [socklen_t xxx = 0;])],
320 [AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
321 AC_MSG_RESULT(yes)],
322 AC_MSG_RESULT(no))
323
Benny Prijonob466e232006-09-10 08:53:59 +0000324dnl # Determine if SO_ERROR is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000325AC_MSG_CHECKING([if SO_ERROR is available])
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000326case $target in
327 *mingw* | *cygw* | *win32* | *w32* )
328 AC_DEFINE(PJ_HAS_SO_ERROR,1)
329 AC_MSG_RESULT(yes)
330 ;;
331 *)
332 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
333 #include <sys/socket.h>
334 #include <netinet/in.h>
335 #include <arpa/inet.h>]],
336 [int i=SO_ERROR;])],
337 [AC_DEFINE(PJ_HAS_SO_ERROR,1)
338 AC_MSG_RESULT(yes)],
339 AC_MSG_RESULT(no))
340 ;;
341esac
342
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000343
Benny Prijonob466e232006-09-10 08:53:59 +0000344dnl # Determine if RW-mutex is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000345AC_MSG_CHECKING([if pthread_rwlock_t is available])
346AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
347 [pthread_rwlock_t *x;])],
348 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000349 ac_rwmutex="yes"
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000350 AC_MSG_RESULT(yes)],
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000351 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000352 ac_rwmutex="no"
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000353 AC_MSG_RESULT(no)])
354
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000355dnl # If rwmutex is not detected, check again but this time
356dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
357if test "$ac_rwmutex" = "no"; then
358 AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
359 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
360 #include <pthread.h>]],
361 [pthread_rwlock_t *x;])],
362 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
363 CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
364 AC_MSG_RESULT(yes)],
365 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
366 AC_MSG_RESULT(no)])
367fi
368
369dnl # Do we have pthread_mutexattr_settype()?
370AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
371AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
372 [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
373 [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
374 AC_MSG_RESULT(yes)],
375 [AC_MSG_RESULT(no)])
376
377dnl # Does pthread_mutexattr_t has "recursive" member?
378AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
379AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
380 [[pthread_mutexattr_t attr;
381 attr.recursive=1;]])],
382 [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
383 AC_MSG_RESULT(yes)],
384 [AC_MSG_RESULT(no)])
385
Benny Prijono99eec382008-09-18 21:22:16 +0000386dnl ######################
387dnl # ioqueue selection
388dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000389AC_SUBST(ac_os_objs)
Benny Prijono99eec382008-09-18 21:22:16 +0000390AC_MSG_CHECKING([ioqueue backend])
391AC_ARG_ENABLE(epoll,
392 AC_HELP_STRING([--enable-epoll],
Benny Prijono9489e7a2008-09-19 22:18:50 +0000393 [Use /dev/epoll ioqueue on Linux (experimental)]),
Benny Prijono99eec382008-09-18 21:22:16 +0000394 [
395 ac_os_objs=ioqueue_epoll.o
396 AC_MSG_RESULT([/dev/epoll])
397 ],
398 [
399 ac_os_objs=ioqueue_select.o
400 AC_MSG_RESULT([select()])
401 ])
402
403
404dnl ######################
405dnl # OS specific files
406dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000407case $target in
408 *mingw* | *cygw* | *win32* | *w32* )
Benny Prijono99eec382008-09-18 21:22:16 +0000409 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 +0000410 ;;
411 *)
Benny Prijono99eec382008-09-18 21:22:16 +0000412 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"
Sauw Ming6a970a32011-03-01 05:25:27 +0000413 case $target in
414 arm-apple-darwin*)
415 ac_os_objs="$ac_os_objs os_info_iphone.o"
416 ;;
417 esac
Benny Prijono4e48b512007-05-16 13:41:00 +0000418 # UUID
419 if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
420 ac_os_objs="$ac_os_objs guid_uuid.o"
421 else
422 ac_os_objs="$ac_os_objs guid_simple.o"
423 fi
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000424 ;;
425esac
426
Sauw Ming68c14572011-07-20 03:00:48 +0000427case $target in
428 *darwin*)
429 ac_os_objs="$ac_os_objs os_core_darwin.o"
430 ;;
431esac
Benny Prijono4e48b512007-05-16 13:41:00 +0000432
Benny Prijonob466e232006-09-10 08:53:59 +0000433dnl ##########################################
434dnl #
435dnl # PJMEDIA
436dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000437
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000438dnl # Use external Speex installation
439AC_SUBST(ac_external_speex,0)
440AC_ARG_WITH(external-speex,
441 AC_HELP_STRING([--with-external-speex],
442 [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)]),
443 [
444 if test "x$with_external_speex" != "xno"; then
445 # Test Speex installation
446 AC_MSG_CHECKING([if external Speex devkit is installed])
447 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
448 #include <speex/speex_echo.h>
449 ]],
450 [speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
451 [AC_MSG_RESULT(yes!!)
452 AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
453 ac_external_speex="1"
454 ],
455 [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])])
456 fi
457 ]
458 )
459
460dnl # Use external GSM codec library installation
461AC_SUBST(ac_external_gsm,0)
462AC_ARG_WITH(external-gsm,
463 AC_HELP_STRING([--with-external-gsm],
464 [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)]),
465 [
466 if test "x$with_external_gsm" != "xno"; then
Benny Prijonod4306432010-05-01 22:05:41 +0000467 # Test GSM library installation
468 AC_MSG_CHECKING([if external GSM devkit is installed as gsm/gsm.h])
469 AC_COMPILE_IFELSE(
470 [AC_LANG_PROGRAM([[#include <gsm/gsm.h> ]], [gsm_create(); ]) ],
471 [AC_MSG_RESULT(yes!!)
472 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
473 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_GSM_H, 1)
474 ac_external_gsm="1"
475 ],
476 [
477 AC_MSG_RESULT(no)
478 AC_MSG_CHECKING([if external GSM devkit is installed as gsm.h])
479 AC_COMPILE_IFELSE(
480 [AC_LANG_PROGRAM([[#include <gsm.h> ]], [gsm_create(); ]) ],
481 [AC_MSG_RESULT(yes!!)
482 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
483 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_H, 1)
484 ac_external_gsm="1"
485 ],
486 [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])
487 ]
488 )
489 ]
490 )
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000491 fi
492 ]
493 )
494
495
496
Benny Prijonob466e232006-09-10 08:53:59 +0000497dnl # Sound device backend selection
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000498AC_SUBST(ac_pjmedia_snd)
Benny Prijono1d971622006-09-10 22:27:40 +0000499AC_ARG_ENABLE(sound,
500 AC_HELP_STRING([--disable-sound],
501 [Exclude sound (i.e. use null sound)]),
502 [if test "$enable_sound" = "no"; then
503 [ac_pjmedia_snd=null]
504 AC_MSG_RESULT([Checking if sound is disabled... yes])
505 fi]
506 )
507
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000508dnl # Use external PortAudio installation
509AC_SUBST(ac_external_pa,0)
510AC_ARG_WITH(external-pa,
511 AC_HELP_STRING([--with-external-pa],
512 [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 +0000513 [
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000514 if test "x$with_external_pa" != "xno"; then
515 # Test PortAudio installation
516 AC_MSG_CHECKING([if external PortAudio devkit is installed])
517 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
518 ]],
519 [Pa_Initialize();])],
520 [AC_MSG_RESULT(yes!!)
521 ac_external_pa="1"
522 ],
523 [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 +0000524 fi
525 ]
526 )
527
Benny Prijono39ae2da2006-10-13 17:57:42 +0000528AC_SUBST(ac_pa_cflags)
Benny Prijono27c98722007-04-09 21:28:15 +0000529AC_CHECK_HEADER(sys/soundcard.h,
530 [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
531AC_CHECK_HEADER(linux/soundcard.h,
532 [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
533AC_CHECK_HEADER(machine/soundcard.h,
534 [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
535
Benny Prijono3e091672008-01-09 15:43:02 +0000536if test "x$ac_cv_c_bigendian" = "xyes"; then
537 ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
538else
539 ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
540fi
541
Benny Prijono1d971622006-09-10 22:27:40 +0000542if test "$enable_sound" = "no"; then
543 true;
544else
545 case $target in
Benny Prijono8ec5eae2010-05-12 10:59:20 +0000546 arm-apple-darwin*)
Sauw Ming6a970a32011-03-01 05:25:27 +0000547 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox -framework CFNetwork -framework UIKit"
Benny Prijono8ec5eae2010-05-12 10:59:20 +0000548 AC_MSG_RESULT([Checking sound device backend... AudioUnit])
549 ;;
Benny Prijonob466e232006-09-10 08:53:59 +0000550 *darwin*)
Benny Prijono39ae2da2006-10-13 17:57:42 +0000551 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
552 if test "`uname -r`" = "6.8"; then
Benny Prijono27c98722007-04-09 21:28:15 +0000553 #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
Benny Prijono39ae2da2006-10-13 17:57:42 +0000554 #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
555 ac_pjmedia_snd=pa_old_darwinos
556 AC_MSG_RESULT([Checking sound device backend... old coreaudio])
557 else
558 ac_pjmedia_snd=pa_darwinos
559 AC_MSG_RESULT([Checking sound device backend... coreaudio])
560 fi
Benny Prijonob466e232006-09-10 08:53:59 +0000561 ;;
562 *cygwin* | *mingw*)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000563 ac_pjmedia_snd=pa_win32
564 AC_MSG_RESULT([Checking sound device backend... win32 sound])
565 ;;
566 *rtems*)
567 ac_pjmedia_snd=null
568 AC_MSG_RESULT([Checking sound device backend... null sound])
569 ;;
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000570 *)
Benny Prijono0b462322008-03-12 22:44:24 +0000571 dnl # Check if ALSA is available
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000572 ac_pjmedia_snd=pa_unix
573 AC_CHECK_HEADER(alsa/version.h,
574 [AC_SUBST(ac_pa_use_alsa,1)
575 LIBS="$LIBS -lasound"
576 ],
577 [AC_SUBST(ac_pa_use_alsa,0)])
578 AC_MSG_RESULT([Checking sound device backend... unix])
Benny Prijono0b462322008-03-12 22:44:24 +0000579
580 dnl # Check if OSS is disabled
581 AC_SUBST(ac_pa_use_oss,1)
582 AC_ARG_ENABLE(oss,
583 AC_HELP_STRING([--disable-oss],
Benny Prijonoc45d9512010-12-10 11:04:30 +0000584 [Disable OSS audio (default: not disabled)]),
Benny Prijono0b462322008-03-12 22:44:24 +0000585 [
586 if test "$enable_oss" = "no"; then
587 [ac_pa_use_oss=0]
588 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
589 fi
590 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000591 ;;
Benny Prijono1d971622006-09-10 22:27:40 +0000592 esac
593fi
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000594
Sauw Ming6e6c2152010-12-14 13:03:10 +0000595AC_SUBST(ac_pjmedia_video)
596if test "$enable_video" = "no"; then
597 true;
598else
599 case $target in
600 arm-apple-darwin*)
601 ac_pjmedia_video=iphone_os
Sauw Ming24c39a32011-08-16 05:44:46 +0000602 AC_SUBST(ac_pjmedia_video_has_ios)
Sauw Ming6e6c2152010-12-14 13:03:10 +0000603 AC_SUBST(ac_ios_cflags)
Sauw Ming24c39a32011-08-16 05:44:46 +0000604 SAVED_LIBS="$LIBS"
605 LIBS="-framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
606 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_ios=yes],[ac_pjmedia_video_has_ios=no])
607 LIBS="$SAVED_LIBS"
608 if test "$ac_pjmedia_video_has_ios" = "yes"; then
609 ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
610 LIBS="$LIBS -framework AVFoundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
611 AC_MSG_RESULT([Checking if AVFoundation framework is available... yes])
612 else
613 AC_MSG_RESULT([Checking if AVFoundation framework is available... no])
614 fi
Sauw Ming6e6c2152010-12-14 13:03:10 +0000615 ;;
616 *darwin*)
617 ac_pjmedia_video=mac_os
618 AC_SUBST(ac_pjmedia_video_has_qt)
619 AC_SUBST(ac_qt_cflags)
620 SAVED_LIBS="$LIBS"
621 LIBS="-framework QTKit"
622 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_qt=yes],[ac_pjmedia_video_has_qt=no])
623 LIBS="$SAVED_LIBS"
624 if test "$ac_pjmedia_video_has_qt" = "yes"; then
625 ac_qt_cflags="-DPJMEDIA_VIDEO_DEV_HAS_QT=1"
Sauw Ming21bd3fd2011-04-06 11:30:18 +0000626 LIBS="$LIBS -framework QTKit -framework Foundation -framework AppKit -framework QuartzCore -framework OpenGL"
Sauw Ming6e6c2152010-12-14 13:03:10 +0000627 AC_MSG_RESULT([Checking if QTKit framework is available... yes])
628 else
629 AC_MSG_RESULT([Checking if QTKit framework is available... no])
630 fi
631 ;;
632 esac
633fi
634
Benny Prijonoebb2c332008-07-28 23:40:58 +0000635AC_ARG_ENABLE(ext_sound,
636 AC_HELP_STRING([--enable-ext-sound],
637 [PJMEDIA will not provide any sound device backend]),
638 [if test "$enable_ext_sound" = "yes"; then
639 [ac_pjmedia_snd=external]
640 AC_MSG_RESULT([Checking if external sound is set... yes])
641 fi]
642 )
643
Benny Prijonob466e232006-09-10 08:53:59 +0000644dnl # Include resampling small filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000645AC_SUBST(ac_no_small_filter)
646AC_ARG_ENABLE(small-filter,
647 AC_HELP_STRING([--disable-small-filter],
648 [Exclude small filter in resampling]),
649 [if test "$enable_small_filter" = "no"; then
650 [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
651 AC_MSG_RESULT([Checking if small filter is disabled... yes])
652 fi],
653 AC_MSG_RESULT([Checking if small filter is disabled... no]))
654
Benny Prijonob466e232006-09-10 08:53:59 +0000655dnl # Include resampling large filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000656AC_SUBST(ac_no_large_filter)
657AC_ARG_ENABLE(large-filter,
658 AC_HELP_STRING([--disable-large-filter],
659 [Exclude large filter in resampling]),
660 [if test "$enable_large_filter" = "no"; then
661 [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
662 AC_MSG_RESULT([Checking if large filter is disabled... yes])
663 fi],
664 AC_MSG_RESULT([Checking if large filter is disabled... no]))
665
Benny Prijonob466e232006-09-10 08:53:59 +0000666dnl # Include Speex AEC
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000667AC_SUBST(ac_no_speex_aec)
668AC_ARG_ENABLE(speex-aec,
669 AC_HELP_STRING([--disable-speex-aec],
670 [Exclude Speex Acoustic Echo Canceller/AEC]),
671 [if test "$enable_speex_aec" = "no"; then
672 [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
673 AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
674 fi],
675 AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
676
Benny Prijonob466e232006-09-10 08:53:59 +0000677dnl # Include G711 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000678AC_SUBST(ac_no_g711_codec)
679AC_ARG_ENABLE(g711-codec,
680 AC_HELP_STRING([--disable-g711-codec],
681 [Exclude G.711 codecs from the build]),
682 [if test "$enable_g711_codec" = "no"; then
683 [ac_no_g711_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000684 AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000685 AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
686 fi],
687 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
688
689
Benny Prijonob466e232006-09-10 08:53:59 +0000690dnl # Include L16 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000691AC_SUBST(ac_no_l16_codec)
692AC_ARG_ENABLE(l16-codec,
693 AC_HELP_STRING([--disable-l16-codec],
694 [Exclude Linear/L16 codec family from the build]),
695 [if test "$enable_l16_codec" = "no"; then
696 [ac_no_l16_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000697 AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000698 AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
699 fi],
Benny Prijonoc1fe23d2006-09-13 09:38:06 +0000700 AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000701
702
Benny Prijonob466e232006-09-10 08:53:59 +0000703dnl # Include GSM codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000704AC_SUBST(ac_no_gsm_codec)
705AC_ARG_ENABLE(gsm-codec,
706 AC_HELP_STRING([--disable-gsm-codec],
707 [Exclude GSM codec in the build]),
708 [if test "$enable_gsm_codec" = "no"; then
709 [ac_no_gsm_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000710 AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000711 AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
712 fi],
713 AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
714
Benny Prijono71f657d2008-03-17 14:24:21 +0000715dnl # Include G.722 codec
716AC_SUBST(ac_no_g722_codec)
717AC_ARG_ENABLE(g722-codec,
718 AC_HELP_STRING([--disable-g722-codec],
719 [Exclude G.722 codec in the build]),
720 [if test "$enable_g722_codec" = "no"; then
721 [ac_no_g722_codec=1]
722 AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
723 AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
724 fi],
725 AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
726
Nanang Izzuddin56e380a2009-04-15 14:45:41 +0000727dnl # Include G722.1 codec
728AC_SUBST(ac_no_g7221_codec)
729AC_ARG_ENABLE(g7221-codec,
730 AC_HELP_STRING([--disable-g7221-codec],
731 [Exclude G.7221 codec in the build]),
732 [if test "$enable_g7221_codec" = "no"; then
733 [ac_no_g7221_codec=1]
734 AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
735 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
736 fi],
737 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
738
Benny Prijonob466e232006-09-10 08:53:59 +0000739dnl # Include Speex codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000740AC_SUBST(ac_no_speex_codec)
741AC_ARG_ENABLE(speex-codec,
742 AC_HELP_STRING([--disable-speex-codec],
743 [Exclude Speex codecs in the build]),
744 [if test "$enable_speex_codec" = "no"; then
745 [ac_no_speex_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000746 AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000747 AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
748 fi],
749 AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
750
Benny Prijonob466e232006-09-10 08:53:59 +0000751dnl # Include iLBC codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000752AC_SUBST(ac_no_ilbc_codec)
753AC_ARG_ENABLE(ilbc-codec,
754 AC_HELP_STRING([--disable-ilbc-codec],
755 [Exclude iLBC codec in the build]),
756 [if test "$enable_ilbc_codec" = "no"; then
757 [ac_no_ilbc_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000758 AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000759 AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
760 fi],
761 AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
762
Benny Prijono550a1a62007-10-16 08:54:00 +0000763dnl # Include libsamplerate
764AC_ARG_ENABLE(libsamplerate,
765 AC_HELP_STRING([--enable-libsamplerate],
766 [Link with libsamplerate when available. Note that PJMEDIA_RESAMPLE_IMP must also be configured]),
767 [ AC_CHECK_LIB(samplerate,src_new) ],
768 AC_MSG_RESULT([Skipping libsamplerate detection])
769 )
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000770
Benny Prijono5b0af632011-07-20 03:16:25 +0000771dnl # SDL alt prefix
772AC_ARG_WITH(sdl,
773 AC_HELP_STRING([--with-sdl=DIR],
774 [Specify alternate libSDL prefix]),
775 [],
776 [with_sdl=no]
777 )
778
Benny Prijonoc45d9512010-12-10 11:04:30 +0000779dnl # SDL
780AC_ARG_ENABLE(sdl,
781 AC_HELP_STRING([--disable-sdl],
782 [Disable SDL (default: not disabled)]),
783 [
784 if test "$enable_sdl" = "no"; then
785 AC_MSG_RESULT([Checking if SDL is disabled... yes])
786 fi
787 ],
788 [
Benny Prijono5b0af632011-07-20 03:16:25 +0000789 SDL_CONFIG="sdl-config"
790 if test "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
791 SDL_CONFIG=$with_sdl/bin/sdl-config
792 AC_MSG_RESULT([Using SDL prefix... $with_sdl])
793 fi
794
Benny Prijonoc45d9512010-12-10 11:04:30 +0000795 AC_MSG_CHECKING([SDL availability..])
Sauw Ming1d8ceb12011-08-24 05:54:25 +0000796 if (sh -c "$SDL_CONFIG --version" | grep 1.3) then
Benny Prijono5b0af632011-07-20 03:16:25 +0000797 AC_SUBST(ac_sdl_cflags)
Benny Prijonoc45d9512010-12-10 11:04:30 +0000798 AC_SUBST(ac_sdl_ldflags)
Benny Prijono5b0af632011-07-20 03:16:25 +0000799 ac_sdl_cflags=`$SDL_CONFIG --cflags`
Benny Prijonoc45d9512010-12-10 11:04:30 +0000800 ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
Benny Prijono5b0af632011-07-20 03:16:25 +0000801 ac_sdl_ldflags=`$SDL_CONFIG --libs`
Benny Prijono69b1f822010-12-10 11:33:01 +0000802 LIBS="$LIBS $ac_sdl_ldflags"
Sauw Ming1d8ceb12011-08-24 05:54:25 +0000803 else
804 AC_MSG_RESULT([Unsupported SDL version])
Benny Prijonoc45d9512010-12-10 11:04:30 +0000805 fi
806 ])
807
808
809dnl # FFMPEG stuffs
810AC_ARG_ENABLE(ffmpeg,
811 AC_HELP_STRING([--disable-ffmpeg],
812 [Disable ffmpeg (default: not disabled)]),
813 [
814 AC_SUBST(ac_has_ffmpeg,0)
815 if test "$enable_ffmpeg" = "no"; then
816 AC_MSG_RESULT([Checking if ffmpeg is disabled... yes])
817 fi
818 ],
819 [
820 AC_SUBST(ac_ffmpeg_cflags)
821 AC_SUBST(ac_ffmpeg_ldflags)
822
Benny Prijonoc8ef0ac2011-04-13 19:13:56 +0000823 FFMPEG_PREFIX=""
824 if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
825 FFMPEG_PREFIX=$with_ffmpeg
826 AC_MSG_RESULT([Using ffmpeg prefix... $FFMPEG_PREFIX])
827 LIBS="-L$FFMPEG_PREFIX/lib $LIBS"
828 LDFLAGS="-L$FFMPEG_PREFIX/lib $LDFLAGS"
829 CFLAGS="-I$FFMPEG_PREFIX/include $CFLAGS"
830 fi
831
Benny Prijonoc45d9512010-12-10 11:04:30 +0000832 AC_CHECK_LIB(avdevice,
833 avdevice_version,
834 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
835 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavdevice"
836 ]
837 )
838 AC_CHECK_LIB(avformat,
839 av_register_all,
840 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
841 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavformat"
Sauw Mingd8aa67c2011-08-09 04:31:41 +0000842 ],
843 [],
844 [-lavcodec -lavutil]
Benny Prijonoc45d9512010-12-10 11:04:30 +0000845 )
846 AC_CHECK_LIB(avcodec,
847 avcodec_init,
848 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
849 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcodec"
Sauw Mingd8aa67c2011-08-09 04:31:41 +0000850 ],
851 [],
852 [-lavutil]
Benny Prijonoc45d9512010-12-10 11:04:30 +0000853 )
854 AC_CHECK_LIB(swscale,
855 sws_scale,
856 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
857 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lswscale"
Sauw Mingd8aa67c2011-08-09 04:31:41 +0000858 ],
859 [],
860 [-lavutil]
Benny Prijonoc45d9512010-12-10 11:04:30 +0000861 )
862 AC_CHECK_LIB(avutil,
863 av_malloc,
864 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
865 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavutil"
866 ]
867 )
868 AC_CHECK_LIB(avcore,
869 avcore_version,
870 [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
871 ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcore"
872 ]
873 )
Benny Prijono69b1f822010-12-10 11:33:01 +0000874 LIBS="$LIBS $ac_ffmpeg_ldflags"
Benny Prijonoc45d9512010-12-10 11:04:30 +0000875 ]
876 )
877
Benny Prijonoc8ef0ac2011-04-13 19:13:56 +0000878AC_ARG_WITH(ffmpeg,
879 AC_HELP_STRING([--with-ffmpeg=DIR],
880 [Specify alternate FFMPEG prefix]),
881 [],
882 [with_ffmpeg=no]
883 )
884
885
Benny Prijonoc45d9512010-12-10 11:04:30 +0000886dnl # Video for Linux 2
887AC_ARG_ENABLE(v4l2,
888 AC_HELP_STRING([--disable-v4l2],
889 [Disable Video4Linux2 (default: not disabled)]),
890 [
891 if test "$enable_v4l2" = "no"; then
892 AC_MSG_RESULT([Checking if V4L2 is disabled... yes])
893 fi
894 ],
895 [
896 AC_SUBST(ac_v4l2_cflags)
897 AC_SUBST(ac_v4l2_ldflags)
898 AC_CHECK_LIB(v4l2,
899 v4l2_open,
900 [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
901 ac_v4l2_ldflags="-lv4l2"
Benny Prijono69b1f822010-12-10 11:33:01 +0000902 LIBS="$LIBS -lv4l2"
Benny Prijonoc45d9512010-12-10 11:04:30 +0000903 ]
904 )
905 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000906
Benny Prijono0822c192008-08-21 20:59:58 +0000907dnl ########################################################
908dnl # Intel IPP support
909dnl #
910AC_ARG_ENABLE(ipp,
911 AC_HELP_STRING([--enable-ipp],
912 [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]),
913 [],
914 [enable_ipp=no]
915 )
916
Benny Prijono3965f192010-02-10 18:46:05 +0000917AC_ARG_WITH(ipp,
Benny Prijono0822c192008-08-21 20:59:58 +0000918 AC_HELP_STRING([--with-ipp=DIR],
919 [Specify the Intel IPP location]),
920 [],
921 [with_ipp=no]
922 )
923
Benny Prijono3965f192010-02-10 18:46:05 +0000924AC_ARG_WITH(ipp-samples,
Benny Prijono0822c192008-08-21 20:59:58 +0000925 AC_HELP_STRING([--with-ipp-samples=DIR],
926 [Specify the Intel IPP samples location]),
927 [],
928 [with_ipp_samples=no]
929 )
930
Benny Prijono3965f192010-02-10 18:46:05 +0000931AC_ARG_WITH(ipp-arch,
932 AC_HELP_STRING([--with-ipp-arch=ARCH],
933 [Specify the Intel IPP ARCH suffix, e.g. "64" or "em64t. Default is blank for IA32"]),
934 [],
935 [with_ipp_arch=no]
936 )
937
Benny Prijono0822c192008-08-21 20:59:58 +0000938if test "x$enable_ipp" != "xno"; then
939 dnl #
940 dnl # Verifying Intel IPP path
941 dnl #
942 AC_MSG_CHECKING([Intel IPP location])
943
944 if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
945 AC_MSG_RESULT([$with_ipp])
946 IPPROOT=$with_ipp
947 elif test "x$IPPROOT" = "x"; then
948 if test -d /opt/intel/ipp; then
949 IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
950 AC_MSG_RESULT([autodetected in $IPPROOT])
951 fi
952 else
953 AC_MSG_RESULT([$IPPROOT])
954 fi
955
Benny Prijono3965f192010-02-10 18:46:05 +0000956 if test "x$with_ipp_arch" != "xno"; then
Benny Prijono896be292010-08-17 12:16:46 +0000957 IPP_SUFFIX=$with_ipp_arch
Benny Prijono3965f192010-02-10 18:46:05 +0000958 AC_MSG_RESULT([IPP arch suffix is set to $IPP_SUFFIX])
959 else
960 IPP_SUFFIX=""
961 AC_MSG_RESULT([IPP arch suffix is set to empty])
962 fi
963
Benny Prijono0822c192008-08-21 20:59:58 +0000964 if test x$IPPROOT = x; then
965 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
966 elif test ! -d $IPPROOT; then
967 AC_MSG_ERROR([not found])
968 elif test ! -d $IPPROOT/include; then
969 AC_MSG_ERROR([directory doesn't seem to be valid])
970 else
971 # IPP directory looks okay.
972 # Remove trailing backslash
Benny Prijono3965f192010-02-10 18:46:05 +0000973 IPPROOT=`echo $IPPROOT | sed 's/\/$//'`
Benny Prijono0822c192008-08-21 20:59:58 +0000974
975 SAVED_CFLAGS="$CFLAGS"
976 SAVED_LDFLAGS="$LDFLAGS"
977 SAVED_LIBS="$LIBS"
978
979 IPP_CFLAGS="-I$IPPROOT/include"
Benny Prijonocd62c4e2011-03-18 08:33:29 +0000980 IPP_LIBS="-lippsc${IPP_SUFFIX} -lipps${IPP_SUFFIX} -lippcore${IPP_SUFFIX}"
Benny Prijono46bd0842010-02-12 14:12:41 +0000981
Benny Prijonocd62c4e2011-03-18 08:33:29 +0000982#
Benny Prijono46bd0842010-02-12 14:12:41 +0000983 # Some differences between Mac OS X and Linux
984 case $target in
985 *darwin* )
986 IPP_LDFLAGS="-L$IPPROOT/Libraries -L$IPPROOT/lib"
987 ;;
988 *)
Benny Prijonocd62c4e2011-03-18 08:33:29 +0000989 # Find out where the libraries live.
990 IPP7_ARCH=""
991 if test -d $IPPROOT/lib/intel64; then
992 IPP7_ARCH="intel64"
993 elif test -d $IPPROOT/lib/ia32; then
994 IPP7_ARCH="ia32"
995 elif test -d $IPPROOT/lib/mic; then
996 IPP7_ARCH="mic"
997 fi
998
999 if test -z "$IPP7_ARCH"; then
1000 # IPP6 (and possibly below)
1001 IPP_LDFLAGS="-L$IPPROOT/sharedlib"
1002 IPP_LIBS="$IPP_LIBS -lippsr${IPP_SUFFIX} -lguide"
1003 else
1004 # IPP7
1005 if ! test -d $IPPROOT/../compiler; then
1006 AC_MSG_ERROR([Cannot find $IPPROOT/../compiler directory. Please set IPPROOT variable correctly])
1007 fi
1008 IPP_CFLAGS="$IPP_CFLAGS"
1009 IPP_LDFLAGS="-L$IPPROOT/lib/intel64 -L$IPPROOT/../compiler/lib/$IPP7_ARCH"
1010 IPP_LIBS="$IPP_LIBS -liomp5"
1011 fi
Benny Prijono46bd0842010-02-12 14:12:41 +00001012 ;;
1013 esac
1014
Benny Prijono0822c192008-08-21 20:59:58 +00001015 #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
Benny Prijono46bd0842010-02-12 14:12:41 +00001016 #Static:
Benny Prijono0822c192008-08-21 20:59:58 +00001017 #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
1018
1019 CFLAGS="$CFLAGS $IPP_CFLAGS"
1020 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
1021 LIBS="$IPP_LIBS $LIBS"
1022
1023
1024 AC_MSG_CHECKING([Intel IPP usability])
1025 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
1026 ]],
1027 [ippStaticInit();])],
1028 [AC_MSG_RESULT(ok)],
Benny Prijono3965f192010-02-10 18:46:05 +00001029 [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 +00001030
1031 CFLAGS="$SAVED_CFLAGS"
1032 LDFLAGS="$SAVED_LDFLAGS"
1033 LIBS="$SAVED_LIBS"
1034 fi
1035
1036 dnl #
1037 dnl # Verifying Intel IPP samples path
1038 dnl #
1039 AC_MSG_CHECKING([Intel IPP samples location])
1040
1041 if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
1042 AC_MSG_RESULT([$with_ipp_samples])
1043 IPPSAMPLES=$with_ipp_samples
1044 elif test "x$IPPSAMPLES" = "x"; then
1045 if test -d /opt/intel/ipp-samples; then
1046 IPPSAMPLES=/opt/intel/ipp-samples
1047 AC_MSG_RESULT([autodetected in $IPPSAMPLES])
1048 fi
1049 else
1050 AC_MSG_RESULT([$IPPSAMPLES])
1051 fi
1052
1053 if test x$IPPSAMPLES = x; then
1054 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
1055 elif test ! -d $IPPSAMPLES; then
1056 AC_MSG_ERROR([not found])
1057 elif test ! -d $IPPSAMPLES/speech-codecs; then
1058 AC_MSG_ERROR([directory doesn't seem to be valid])
1059 else
1060 # Remove trailing backslash
1061 IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
Benny Prijono3965f192010-02-10 18:46:05 +00001062
1063 # Guess the libusc.a/libspeech.a build location
Benny Prijono0822c192008-08-21 20:59:58 +00001064 AC_MSG_CHECKING([Intel IPP USC build location])
Benny Prijono3965f192010-02-10 18:46:05 +00001065 if test -d $IPPSAMPLES/speech-codecs/bin; then
1066 IPPVER=5
1067 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
1068 elif test -d $IPPSAMPLES/speech-codecs/_bin; then
1069 IPPVER=6
Benny Prijono46bd0842010-02-12 14:12:41 +00001070 if test -d $IPPSAMPLES/speech-codecs/_bin/*gcc*; then
1071 # gcc compiler
1072 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib | head -1`
1073 elif test -d $IPPSAMPLES/speech-codecs/_bin/*icc*; then
1074 # icc compiler
1075 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*icc*/lib | head -1`
1076 else
1077 AC_MSG_FAILURE([Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?])
1078 fi
Benny Prijono3965f192010-02-10 18:46:05 +00001079 else
1080 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 +00001081 fi
Benny Prijono3965f192010-02-10 18:46:05 +00001082
1083 # Test the directory
1084 if test ! -d $IPPSAMP_DIR; then
1085 AC_MSG_FAILURE([There's something wrong with this script, directory $IPPSAMP_DIR does not exist])
1086 exit 1;
Benny Prijono0822c192008-08-21 20:59:58 +00001087 fi
Benny Prijono3965f192010-02-10 18:46:05 +00001088
1089 if test "x$IPPVER" = "x5"; then
1090 IPPSAMP_LIBS="libusc.a"
1091 IPPSAMP_LDLIBS="-lusc"
1092 elif test "x$IPPVER" = "x6"; then
1093 IPPSAMP_LIBS="libspeech.a"
1094 IPPSAMP_LDLIBS="-lspeech"
1095 else
1096 AC_MSG_FAILURE([bug in this script: unsupported IPP version])
1097 fi
1098
1099 if test ! -f $IPPSAMP_DIR/$IPPSAMP_LIBS; then
1100 AC_MSG_FAILURE([$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR])
1101 fi
1102
1103 AC_MSG_RESULT([$IPPSAMP_DIR])
Benny Prijono0822c192008-08-21 20:59:58 +00001104
1105 SAVED_CFLAGS="$CFLAGS"
1106 SAVED_LDFLAGS="$LDFLAGS"
1107 SAVED_LIBS="$LIBS"
1108
Benny Prijono3965f192010-02-10 18:46:05 +00001109 IPPSAMP_INC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
1110 CFLAGS="$CFLAGS $IPPSAMP_INC"
1111 LDFLAGS="$LDFLAGS -L$IPPSAMP_DIR"
1112 LIBS="$IPPSAMP_LDLIBS $LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +00001113
1114 AC_MSG_CHECKING([Intel IPP USC usability])
1115 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
1116 ]],
1117 [extern USC_Fxns USC_G729AFP_Fxns;])],
1118 [AC_MSG_RESULT(ok)],
1119 [AC_MSG_FAILURE(failed)])
1120
1121 CFLAGS="$SAVED_CFLAGS"
Benny Prijono3965f192010-02-10 18:46:05 +00001122 LDFLAGS="$IPP_LDFLAGS $SAVED_LDFLAGS"
1123 LIBS="$IPP_LIBS $SAVED_LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +00001124
Benny Prijono3965f192010-02-10 18:46:05 +00001125 IPP_CFLAGS="$IPP_CFLAGS $IPPSAMP_INC"
1126 IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMP_DIR"
1127 IPP_LIBS="$IPPSAMP_LDLIBS $IPP_LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +00001128 fi
1129
Benny Prijono3965f192010-02-10 18:46:05 +00001130 CFLAGS="$CFLAGS $IPP_CFLAGS"
1131 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
1132 LIBS="$LIBS $IPP_LIBS"
1133
Benny Prijono0822c192008-08-21 20:59:58 +00001134 ac_build_mak_vars="$ac_build_mak_vars\n\
1135export IPP_CFLAGS=$IPP_CFLAGS\n\
1136export IPP_LDFLAGS=$IPP_LDFLAGS\n\
1137export IPP_LIBS=$IPP_LIBS"
1138else
1139 AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
1140fi
1141
1142
Benny Prijonob466e232006-09-10 08:53:59 +00001143dnl ##########################################
1144dnl #
Benny Prijono7e0d75f2006-12-25 20:34:14 +00001145dnl # PJSIP CONFIG
1146dnl #
1147
1148dnl # Include SSL support
1149AC_SUBST(ac_no_ssl)
1150AC_ARG_ENABLE(ssl,
Benny Prijonoce1db762007-02-14 02:21:08 +00001151 AC_HELP_STRING([--disable-ssl],
1152 [Exclude SSL support the build (default: autodetect)])
1153 ,
Benny Prijono7e0d75f2006-12-25 20:34:14 +00001154 [
1155 if test "$enable_ssl" = "no"; then
1156 [ac_no_ssl=1]
1157 AC_MSG_RESULT([Checking if SSL support is disabled... yes])
1158 fi
1159 ],
1160 [
1161 AC_MSG_RESULT([checking for OpenSSL installations..])
1162 AC_SUBST(openssl_h_present)
1163 AC_SUBST(libssl_present)
1164 AC_SUBST(libcrypto_present)
1165 AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
Benny Prijono7e0d75f2006-12-25 20:34:14 +00001166 AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
Benny Prijonod5233702010-01-13 13:09:45 +00001167 AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
Benny Prijono7e0d75f2006-12-25 20:34:14 +00001168 if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
1169 AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
Nanang Izzuddin9c7616f2009-10-28 06:09:15 +00001170 # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
1171 #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
Nanang Izzuddinea6d3c42009-10-26 15:47:52 +00001172 AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
Benny Prijono7e0d75f2006-12-25 20:34:14 +00001173 else
1174 AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **])
1175 fi
1176 ])
1177
1178
1179dnl ##########################################
1180dnl #
Benny Prijonob466e232006-09-10 08:53:59 +00001181dnl # MANUAL CONFIG
1182dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +00001183
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001184
Benny Prijonob466e232006-09-10 08:53:59 +00001185dnl # Determine if select() requires nfds to be filled up with
1186dnl # correct value (max_fd+1). If zero, nfds will be filled up with
1187dnl # PJ_FD_SETSIZE
Benny Prijonoc4c61d02006-08-20 20:47:34 +00001188AC_MSG_CHECKING([if select() needs correct nfds])
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001189case $target in
1190 *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001191 AC_MSG_RESULT(yes)
1192 ;;
1193 *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
1194 AC_MSG_RESULT([no (default)])
1195 AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
1196 ;;
1197esac
1198
Benny Prijonob466e232006-09-10 08:53:59 +00001199dnl # Determine if pj_thread_create() should enforce thread stack size when
1200dnl # creating thread. Default is zero, to allow OS to allocate appropriate
1201dnl # thread's stack size.
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001202AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
1203case $target in
1204 *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
1205 AC_MSG_RESULT(yes)
1206 ;;
1207 *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
1208 AC_MSG_RESULT([no (default)])
1209 ;;
1210esac
1211
Benny Prijonob466e232006-09-10 08:53:59 +00001212dnl # Determine if pj_thread_create() should allocate thread's stack from
1213dnl # the pool. Default is zero, to let OS allocate thread's stack.
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001214AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
1215case $target in
1216 *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
1217 AC_MSG_RESULT(yes)
1218 ;;
1219 *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
1220 AC_MSG_RESULT([no (default)])
1221 ;;
1222esac
1223
Benny Prijonob466e232006-09-10 08:53:59 +00001224dnl # This value specifies the value set in errno by the OS when a non-blocking
1225dnl # socket recv() can not return immediate data.
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001226case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +00001227 *mingw* | *cygw* | *win32* | *w32* )
1228 AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
1229 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001230 *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
1231 AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
1232 ;;
1233esac
1234
Benny Prijonob466e232006-09-10 08:53:59 +00001235dnl # This value specifies the value set in errno by the OS when a non-blocking
1236dnl # socket connect() can not get connected immediately.
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001237case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +00001238 *mingw* | *cygw* | *win32* | *w32* )
1239 AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
1240 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001241 *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
1242 AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
1243 ;;
1244esac
1245
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001246
Benny Prijonoc4c61d02006-08-20 20:47:34 +00001247AC_SUBST(target)
1248AC_SUBST(ac_cross_compile)
1249if test "$build" = "$host"; then
1250 ac_cross_compile=
1251else
Benny Prijono5b818b22006-09-17 22:58:51 +00001252 ac_cross_compile=${host_orig}-
Benny Prijonoc4c61d02006-08-20 20:47:34 +00001253fi
1254AC_SUBST(ac_linux_poll,select)
1255AC_SUBST(ac_host,unix)
1256AC_SUBST(ac_main_obj)
1257case $target in
1258 *rtems*)
1259 ac_main_obj=main_rtems.o
1260 ;;
1261 *)
1262 ac_main_obj=main.o
1263 ;;
1264esac
1265AC_SUBST(CC)
Benny Prijono0822c192008-08-21 20:59:58 +00001266
1267ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001268AC_OUTPUT()
1269
Benny Prijonod9627842007-04-18 09:24:31 +00001270
1271AC_MSG_RESULT([
1272
Benny Prijonoc16c6e32007-11-18 14:53:47 +00001273Configurations 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 +00001274
Benny Prijonoc16c6e32007-11-18 14:53:47 +00001275Further customizations can be put in:
Benny Prijonod9627842007-04-18 09:24:31 +00001276 - 'user.mak'
1277 - 'pjlib/include/pj/config_site.h'
1278
1279The next step now is to run 'make dep' and 'make'.
1280])
1281