blob: 185ee0dea5bb8163861551449b77089635785097 [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 Prijono8a9b3b22010-01-14 14:46:54 +000016 pjlib/build/os-auto.mak
17 pjlib-util/build/os-auto.mak
Benny Prijonoc4c61d02006-08-20 20:47:34 +000018 pjmedia/build/os-auto.mak
19 pjsip/build/os-auto.mak
Benny Prijonod9627842007-04-18 09:24:31 +000020 third_party/build/os-auto.mak
Benny Prijono8a9b3b22010-01-14 14:46:54 +000021 third_party/build/portaudio/os-auto.mak
22 ])
Benny Prijonoc1fe23d2006-09-13 09:38:06 +000023
Benny Prijono12483112007-03-12 10:44:38 +000024
Benny Prijonoc1fe23d2006-09-13 09:38:06 +000025dnl
26dnl Setup default CFLAGS
27dnl
28if test "$CFLAGS" = ""; then
Benny Prijonod1459822006-10-04 20:56:39 +000029 CFLAGS="-O2"
Benny Prijonoc1fe23d2006-09-13 09:38:06 +000030else
31 CFLAGS="$CFLAGS"
32fi
33
34CXXFLAGS="$CFLAGS $CXXFLAGS"
35
Benny Prijonoa9b372a2006-07-24 02:07:11 +000036AC_PROG_CC
Benny Prijonoc4c61d02006-08-20 20:47:34 +000037AC_PROG_CXX
Benny Prijonoa9b372a2006-07-24 02:07:11 +000038AC_LANG_C
39
Benny Prijono12483112007-03-12 10:44:38 +000040AC_SUBST(ac_pjdir)
Benny Prijono0822c192008-08-21 20:59:58 +000041AC_SUBST(ac_build_mak_vars)
Benny Prijono53847a32007-09-24 16:10:13 +000042case $target in
43 *mingw* | *cygw* | *win32* | *w32* )
44 ac_pjdir=`pwd -W`
45 ;;
46 *)
47 ac_pjdir=`pwd`
48 ;;
49esac
Benny Prijono12483112007-03-12 10:44:38 +000050
Benny Prijonoc4c61d02006-08-20 20:47:34 +000051AC_CHECK_LIB(pthread,pthread_create)
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +000052AC_CHECK_LIB(wsock32,puts)
53AC_CHECK_LIB(ws2_32,puts)
54AC_CHECK_LIB(ole32,puts)
55AC_CHECK_LIB(winmm,puts)
56AC_CHECK_LIB(socket,puts)
57AC_CHECK_LIB(rt,puts)
58AC_CHECK_LIB(nsl,puts)
Benny Prijono4e48b512007-05-16 13:41:00 +000059AC_CHECK_LIB(uuid,uuid_generate)
60AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
Benny Prijonoc4c61d02006-08-20 20:47:34 +000061
62AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
63AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
64
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +000065dnl
Benny Prijono1d971622006-09-10 22:27:40 +000066dnl Memory alignment detection
67dnl
68AC_MSG_CHECKING([memory alignment])
69case $target in
70 ia64-* | x86_64-* )
71 AC_DEFINE(PJ_POOL_ALIGNMENT, 8)
72 AC_MSG_RESULT([8 bytes])
73 ;;
74 * )
75 AC_DEFINE(PJ_POOL_ALIGNMENT, 4)
76 AC_MSG_RESULT([4 bytes (default)])
77 ;;
78esac
79
80
81dnl
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +000082dnl Endianness detection
83dnl
Benny Prijonob466e232006-09-10 08:53:59 +000084AC_C_BIGENDIAN
Benny Prijonoc4c61d02006-08-20 20:47:34 +000085
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +000086dnl
87dnl Legacy macros
88dnl
89case $target in
90 *mingw* | *cygw* | *win32* | *w32* )
91 AC_DEFINE(PJ_WIN32,1)
92 AC_DEFINE(PJ_WIN32_WINNT,0x0400)
93 AC_DEFINE(WIN32_LEAN_AND_MEAN)
94 ;;
95 *darwin*)
96 AC_DEFINE(PJ_DARWINOS,1)
97 ;;
98 *linux*)
99 AC_DEFINE(PJ_LINUX,1)
100 ;;
101 *rtems*)
102 AC_DEFINE(PJ_RTEMS,1)
103 ;;
104 *sunos* | *solaris* )
105 AC_DEFINE(PJ_SUNOS,1)
106 ;;
107 *)
108 ;;
109esac
110
111
112
113
Benny Prijonob466e232006-09-10 08:53:59 +0000114dnl # --disable-floating-point option
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000115AC_ARG_ENABLE(floating-point,
116 AC_HELP_STRING([--disable-floating-point],
117 [Disable floating point where possible]),
118 [if test "$enable_floating_point" = "no"; then
119 AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
120 AC_MSG_RESULT([Checking if floating point is disabled... yes])
121 fi],
122 [
123 AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
124 AC_MSG_RESULT([Checking if floating point is disabled... no])
125 AC_CHECK_LIB(m,fmod)
126 ])
127
128
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000129AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
130AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
131AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000132
133case $target in
134 *mingw* | *cygw* | *win32* | *w32* )
135 AC_DEFINE(PJ_HAS_ERRNO_H,0)
136 ;;
137 *)
138 AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
139 ;;
140esac
141
Benny Prijono1d481ab2008-01-24 15:27:30 +0000142AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000143AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
144AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
145AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
Benny Prijono37fc9de2008-08-04 14:45:02 +0000146AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000147AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
Benny Prijono37fc9de2008-08-04 14:45:02 +0000148AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
Benny Prijonod5233702010-01-13 13:09:45 +0000149 [#if PJ_HAS_SYS_TYPES_H
150 # include <sys/types.h>
151 #endif
152 #if PJ_HAS_NETINET_IN_SYSTM_H
Benny Prijono37fc9de2008-08-04 14:45:02 +0000153 # include <netinet/in_systm.h>
154 #endif
Benny Prijonod5233702010-01-13 13:09:45 +0000155 #if PJ_HAS_NETINET_IN_H
156 # include <netinet/in.h>
157 #endif
Benny Prijono37fc9de2008-08-04 14:45:02 +0000158 ])
Benny Prijono1d61ba52009-10-24 00:00:40 +0000159AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
Benny Prijono1d65f702007-12-03 04:03:17 +0000160AC_CHECK_HEADER(ifaddrs.h,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000161AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000162AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
163AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
164AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
165AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
Benny Prijonofdafd402008-01-23 14:34:46 +0000166AC_CHECK_HEADER(stdint.h,[AC_DEFINE(PJ_HAS_STDINT_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000167AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
168AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
169AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
170AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
171AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
172AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
173AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
174AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
Benny Prijonoa1aec0e2010-01-13 21:28:06 +0000175AC_CHECK_HEADER(sys/filio.h,[AC_DEFINE(PJ_HAS_SYS_FILIO_H,1)])
176AC_CHECK_HEADER(sys/sockio.h,[AC_DEFINE(PJ_HAS_SYS_SOCKIO_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000177AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
178AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000179AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
180AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000181AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
182 [#if PJ_HAS_WINSOCK2_H
183 # include <winsock2.h>
184 #elif PJ_HAS_WINSOCK_H
185 # include <winsock.h>
186 #endif
187 ])
Benny Prijonoe2746132008-09-27 13:16:35 +0000188AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
Benny Prijono4e48b512007-05-16 13:41:00 +0000189AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000190AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
Benny Prijonod5233702010-01-13 13:09:45 +0000191 [#if PJ_HAS_SYS_TYPES_H
192 # include <sys/types.h>
193 #endif
194 #if PJ_HAS_SYS_SOCKET_H
195
Benny Prijono188ba7e2008-03-25 13:53:16 +0000196 # include <sys/socket.h>
197 #endif
198 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000199AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
200AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
201
202AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
203AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
204
205AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
206AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
207
208AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
209AC_DEFINE(PJ_HAS_MALLOC,1)
210
211AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
212AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
213
214AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
215AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000216
Benny Prijonob466e232006-09-10 08:53:59 +0000217dnl # Determine if inet_aton() is available
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000218AC_MSG_CHECKING([if inet_aton() is available])
219AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
220 #include <sys/socket.h>
221 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000222 [inet_aton(0, 0);])],
223 [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
224 AC_MSG_RESULT(yes)],
225 [AC_MSG_RESULT(no)])
226
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000227dnl # Determine if inet_pton() is available
228AC_MSG_CHECKING([if inet_pton() is available])
229AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
230 #include <sys/socket.h>
231 #include <arpa/inet.h>]],
232 [inet_pton(0, 0, 0);])],
233 [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
234 AC_MSG_RESULT(yes)],
235 [AC_MSG_RESULT(no)])
236
237dnl # Determine if inet_ntop() is available
238AC_MSG_CHECKING([if inet_ntop() is available])
239AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
240 #include <sys/socket.h>
241 #include <arpa/inet.h>]],
242 [inet_ntop(0, 0, 0, 0);])],
243 [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
244 AC_MSG_RESULT(yes)],
245 [AC_MSG_RESULT(no)])
246
247dnl # Determine if getaddrinfo() is available
248AC_MSG_CHECKING([if getaddrinfo() is available])
249AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
250 #include <sys/socket.h>
251 #include <netdb.h>]],
252 [getaddrinfo(0, 0, 0, 0);])],
253 [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
254 AC_MSG_RESULT(yes)],
255 [AC_MSG_RESULT(no)])
256
Benny Prijonob466e232006-09-10 08:53:59 +0000257dnl # Determine if sockaddr_in has sin_len member
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000258AC_MSG_CHECKING([if sockaddr_in has sin_len member])
Benny Prijonob466e232006-09-10 08:53:59 +0000259AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
260 #include <sys/socket.h>
261 #include <netinet/in.h>
262 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000263 [struct sockaddr_in a; a.sin_len=0;])],
264 [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
265 AC_MSG_RESULT(yes)],
266 AC_MSG_RESULT(no))
267
Benny Prijonob466e232006-09-10 08:53:59 +0000268dnl # Determine if socklen_t is available
Benny Prijono30f85c62006-09-09 20:05:33 +0000269AC_MSG_CHECKING([if socklen_t is available])
Benny Prijonod5233702010-01-13 13:09:45 +0000270AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
271 #include <sys/socket.h>]],
Benny Prijono30f85c62006-09-09 20:05:33 +0000272 [socklen_t xxx = 0;])],
273 [AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
274 AC_MSG_RESULT(yes)],
275 AC_MSG_RESULT(no))
276
Benny Prijonob466e232006-09-10 08:53:59 +0000277dnl # Determine if SO_ERROR is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000278AC_MSG_CHECKING([if SO_ERROR is available])
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000279case $target in
280 *mingw* | *cygw* | *win32* | *w32* )
281 AC_DEFINE(PJ_HAS_SO_ERROR,1)
282 AC_MSG_RESULT(yes)
283 ;;
284 *)
285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
286 #include <sys/socket.h>
287 #include <netinet/in.h>
288 #include <arpa/inet.h>]],
289 [int i=SO_ERROR;])],
290 [AC_DEFINE(PJ_HAS_SO_ERROR,1)
291 AC_MSG_RESULT(yes)],
292 AC_MSG_RESULT(no))
293 ;;
294esac
295
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000296
Benny Prijonob466e232006-09-10 08:53:59 +0000297dnl # Determine if RW-mutex is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000298AC_MSG_CHECKING([if pthread_rwlock_t is available])
299AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
300 [pthread_rwlock_t *x;])],
301 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000302 ac_rwmutex="yes"
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000303 AC_MSG_RESULT(yes)],
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000304 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000305 ac_rwmutex="no"
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000306 AC_MSG_RESULT(no)])
307
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000308dnl # If rwmutex is not detected, check again but this time
309dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
310if test "$ac_rwmutex" = "no"; then
311 AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
312 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
313 #include <pthread.h>]],
314 [pthread_rwlock_t *x;])],
315 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
316 CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
317 AC_MSG_RESULT(yes)],
318 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
319 AC_MSG_RESULT(no)])
320fi
321
322dnl # Do we have pthread_mutexattr_settype()?
323AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
324AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
325 [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
326 [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
327 AC_MSG_RESULT(yes)],
328 [AC_MSG_RESULT(no)])
329
330dnl # Does pthread_mutexattr_t has "recursive" member?
331AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
332AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
333 [[pthread_mutexattr_t attr;
334 attr.recursive=1;]])],
335 [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
336 AC_MSG_RESULT(yes)],
337 [AC_MSG_RESULT(no)])
338
Benny Prijono99eec382008-09-18 21:22:16 +0000339dnl ######################
340dnl # ioqueue selection
341dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000342AC_SUBST(ac_os_objs)
Benny Prijono99eec382008-09-18 21:22:16 +0000343AC_MSG_CHECKING([ioqueue backend])
344AC_ARG_ENABLE(epoll,
345 AC_HELP_STRING([--enable-epoll],
Benny Prijono9489e7a2008-09-19 22:18:50 +0000346 [Use /dev/epoll ioqueue on Linux (experimental)]),
Benny Prijono99eec382008-09-18 21:22:16 +0000347 [
348 ac_os_objs=ioqueue_epoll.o
349 AC_MSG_RESULT([/dev/epoll])
350 ],
351 [
352 ac_os_objs=ioqueue_select.o
353 AC_MSG_RESULT([select()])
354 ])
355
356
357dnl ######################
358dnl # OS specific files
359dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000360case $target in
361 *mingw* | *cygw* | *win32* | *w32* )
Benny Prijono99eec382008-09-18 21:22:16 +0000362 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 +0000363 ;;
364 *)
Benny Prijono99eec382008-09-18 21:22:16 +0000365 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 +0000366 # UUID
367 if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
368 ac_os_objs="$ac_os_objs guid_uuid.o"
369 else
370 ac_os_objs="$ac_os_objs guid_simple.o"
371 fi
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000372 ;;
373esac
374
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000375
Benny Prijono4e48b512007-05-16 13:41:00 +0000376
Benny Prijonob466e232006-09-10 08:53:59 +0000377dnl ##########################################
378dnl #
379dnl # PJMEDIA
380dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000381
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000382dnl # Use external Speex installation
383AC_SUBST(ac_external_speex,0)
384AC_ARG_WITH(external-speex,
385 AC_HELP_STRING([--with-external-speex],
386 [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)]),
387 [
388 if test "x$with_external_speex" != "xno"; then
389 # Test Speex installation
390 AC_MSG_CHECKING([if external Speex devkit is installed])
391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
392 #include <speex/speex_echo.h>
393 ]],
394 [speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
395 [AC_MSG_RESULT(yes!!)
396 AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
397 ac_external_speex="1"
398 ],
399 [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])])
400 fi
401 ]
402 )
403
404dnl # Use external GSM codec library installation
405AC_SUBST(ac_external_gsm,0)
406AC_ARG_WITH(external-gsm,
407 AC_HELP_STRING([--with-external-gsm],
408 [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)]),
409 [
410 if test "x$with_external_gsm" != "xno"; then
Benny Prijonod4306432010-05-01 22:05:41 +0000411 # Test GSM library installation
412 AC_MSG_CHECKING([if external GSM devkit is installed as gsm/gsm.h])
413 AC_COMPILE_IFELSE(
414 [AC_LANG_PROGRAM([[#include <gsm/gsm.h> ]], [gsm_create(); ]) ],
415 [AC_MSG_RESULT(yes!!)
416 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
417 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_GSM_H, 1)
418 ac_external_gsm="1"
419 ],
420 [
421 AC_MSG_RESULT(no)
422 AC_MSG_CHECKING([if external GSM devkit is installed as gsm.h])
423 AC_COMPILE_IFELSE(
424 [AC_LANG_PROGRAM([[#include <gsm.h> ]], [gsm_create(); ]) ],
425 [AC_MSG_RESULT(yes!!)
426 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
427 AC_DEFINE(PJMEDIA_EXTERNAL_GSM_H, 1)
428 ac_external_gsm="1"
429 ],
430 [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])
431 ]
432 )
433 ]
434 )
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000435 fi
436 ]
437 )
438
439
440
Benny Prijonob466e232006-09-10 08:53:59 +0000441dnl # Sound device backend selection
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000442AC_SUBST(ac_pjmedia_snd)
Benny Prijono1d971622006-09-10 22:27:40 +0000443AC_ARG_ENABLE(sound,
444 AC_HELP_STRING([--disable-sound],
445 [Exclude sound (i.e. use null sound)]),
446 [if test "$enable_sound" = "no"; then
447 [ac_pjmedia_snd=null]
448 AC_MSG_RESULT([Checking if sound is disabled... yes])
449 fi]
450 )
451
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000452dnl # Use external PortAudio installation
453AC_SUBST(ac_external_pa,0)
454AC_ARG_WITH(external-pa,
455 AC_HELP_STRING([--with-external-pa],
456 [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 +0000457 [
Benny Prijono8a9b3b22010-01-14 14:46:54 +0000458 if test "x$with_external_pa" != "xno"; then
459 # Test PortAudio installation
460 AC_MSG_CHECKING([if external PortAudio devkit is installed])
461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
462 ]],
463 [Pa_Initialize();])],
464 [AC_MSG_RESULT(yes!!)
465 ac_external_pa="1"
466 ],
467 [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 +0000468 fi
469 ]
470 )
471
Benny Prijono39ae2da2006-10-13 17:57:42 +0000472AC_SUBST(ac_pa_cflags)
Benny Prijono27c98722007-04-09 21:28:15 +0000473AC_CHECK_HEADER(sys/soundcard.h,
474 [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
475AC_CHECK_HEADER(linux/soundcard.h,
476 [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
477AC_CHECK_HEADER(machine/soundcard.h,
478 [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
479
Benny Prijono3e091672008-01-09 15:43:02 +0000480if test "x$ac_cv_c_bigendian" = "xyes"; then
481 ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
482else
483 ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
484fi
485
Benny Prijono1d971622006-09-10 22:27:40 +0000486if test "$enable_sound" = "no"; then
487 true;
488else
489 case $target in
Benny Prijonob466e232006-09-10 08:53:59 +0000490 *darwin*)
Benny Prijono39ae2da2006-10-13 17:57:42 +0000491 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
492 if test "`uname -r`" = "6.8"; then
Benny Prijono27c98722007-04-09 21:28:15 +0000493 #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
Benny Prijono39ae2da2006-10-13 17:57:42 +0000494 #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
495 ac_pjmedia_snd=pa_old_darwinos
496 AC_MSG_RESULT([Checking sound device backend... old coreaudio])
497 else
498 ac_pjmedia_snd=pa_darwinos
499 AC_MSG_RESULT([Checking sound device backend... coreaudio])
500 fi
Benny Prijonob466e232006-09-10 08:53:59 +0000501 ;;
502 *cygwin* | *mingw*)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000503 ac_pjmedia_snd=pa_win32
504 AC_MSG_RESULT([Checking sound device backend... win32 sound])
505 ;;
506 *rtems*)
507 ac_pjmedia_snd=null
508 AC_MSG_RESULT([Checking sound device backend... null sound])
509 ;;
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000510 *)
Benny Prijono0b462322008-03-12 22:44:24 +0000511 dnl # Check if ALSA is available
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000512 ac_pjmedia_snd=pa_unix
513 AC_CHECK_HEADER(alsa/version.h,
514 [AC_SUBST(ac_pa_use_alsa,1)
515 LIBS="$LIBS -lasound"
516 ],
517 [AC_SUBST(ac_pa_use_alsa,0)])
518 AC_MSG_RESULT([Checking sound device backend... unix])
Benny Prijono0b462322008-03-12 22:44:24 +0000519
520 dnl # Check if OSS is disabled
521 AC_SUBST(ac_pa_use_oss,1)
522 AC_ARG_ENABLE(oss,
523 AC_HELP_STRING([--disable-oss],
524 [Disable OSS audio (default: not disabled)])
525 ,
526 [
527 if test "$enable_oss" = "no"; then
528 [ac_pa_use_oss=0]
529 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
530 fi
531 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000532 ;;
Benny Prijono1d971622006-09-10 22:27:40 +0000533 esac
534fi
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000535
Benny Prijonoebb2c332008-07-28 23:40:58 +0000536AC_ARG_ENABLE(ext_sound,
537 AC_HELP_STRING([--enable-ext-sound],
538 [PJMEDIA will not provide any sound device backend]),
539 [if test "$enable_ext_sound" = "yes"; then
540 [ac_pjmedia_snd=external]
541 AC_MSG_RESULT([Checking if external sound is set... yes])
542 fi]
543 )
544
Benny Prijonob466e232006-09-10 08:53:59 +0000545dnl # Include resampling small filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000546AC_SUBST(ac_no_small_filter)
547AC_ARG_ENABLE(small-filter,
548 AC_HELP_STRING([--disable-small-filter],
549 [Exclude small filter in resampling]),
550 [if test "$enable_small_filter" = "no"; then
551 [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
552 AC_MSG_RESULT([Checking if small filter is disabled... yes])
553 fi],
554 AC_MSG_RESULT([Checking if small filter is disabled... no]))
555
Benny Prijonob466e232006-09-10 08:53:59 +0000556dnl # Include resampling large filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000557AC_SUBST(ac_no_large_filter)
558AC_ARG_ENABLE(large-filter,
559 AC_HELP_STRING([--disable-large-filter],
560 [Exclude large filter in resampling]),
561 [if test "$enable_large_filter" = "no"; then
562 [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
563 AC_MSG_RESULT([Checking if large filter is disabled... yes])
564 fi],
565 AC_MSG_RESULT([Checking if large filter is disabled... no]))
566
Benny Prijonob466e232006-09-10 08:53:59 +0000567dnl # Include Speex AEC
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000568AC_SUBST(ac_no_speex_aec)
569AC_ARG_ENABLE(speex-aec,
570 AC_HELP_STRING([--disable-speex-aec],
571 [Exclude Speex Acoustic Echo Canceller/AEC]),
572 [if test "$enable_speex_aec" = "no"; then
573 [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
574 AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
575 fi],
576 AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
577
Benny Prijonob466e232006-09-10 08:53:59 +0000578dnl # Include G711 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000579AC_SUBST(ac_no_g711_codec)
580AC_ARG_ENABLE(g711-codec,
581 AC_HELP_STRING([--disable-g711-codec],
582 [Exclude G.711 codecs from the build]),
583 [if test "$enable_g711_codec" = "no"; then
584 [ac_no_g711_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000585 AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000586 AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
587 fi],
588 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
589
590
Benny Prijonob466e232006-09-10 08:53:59 +0000591dnl # Include L16 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000592AC_SUBST(ac_no_l16_codec)
593AC_ARG_ENABLE(l16-codec,
594 AC_HELP_STRING([--disable-l16-codec],
595 [Exclude Linear/L16 codec family from the build]),
596 [if test "$enable_l16_codec" = "no"; then
597 [ac_no_l16_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000598 AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000599 AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
600 fi],
Benny Prijonoc1fe23d2006-09-13 09:38:06 +0000601 AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000602
603
Benny Prijonob466e232006-09-10 08:53:59 +0000604dnl # Include GSM codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000605AC_SUBST(ac_no_gsm_codec)
606AC_ARG_ENABLE(gsm-codec,
607 AC_HELP_STRING([--disable-gsm-codec],
608 [Exclude GSM codec in the build]),
609 [if test "$enable_gsm_codec" = "no"; then
610 [ac_no_gsm_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000611 AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000612 AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
613 fi],
614 AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
615
Benny Prijono71f657d2008-03-17 14:24:21 +0000616dnl # Include G.722 codec
617AC_SUBST(ac_no_g722_codec)
618AC_ARG_ENABLE(g722-codec,
619 AC_HELP_STRING([--disable-g722-codec],
620 [Exclude G.722 codec in the build]),
621 [if test "$enable_g722_codec" = "no"; then
622 [ac_no_g722_codec=1]
623 AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
624 AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
625 fi],
626 AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
627
Nanang Izzuddin56e380a2009-04-15 14:45:41 +0000628dnl # Include G722.1 codec
629AC_SUBST(ac_no_g7221_codec)
630AC_ARG_ENABLE(g7221-codec,
631 AC_HELP_STRING([--disable-g7221-codec],
632 [Exclude G.7221 codec in the build]),
633 [if test "$enable_g7221_codec" = "no"; then
634 [ac_no_g7221_codec=1]
635 AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
636 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
637 fi],
638 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
639
Benny Prijonob466e232006-09-10 08:53:59 +0000640dnl # Include Speex codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000641AC_SUBST(ac_no_speex_codec)
642AC_ARG_ENABLE(speex-codec,
643 AC_HELP_STRING([--disable-speex-codec],
644 [Exclude Speex codecs in the build]),
645 [if test "$enable_speex_codec" = "no"; then
646 [ac_no_speex_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000647 AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000648 AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
649 fi],
650 AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
651
Benny Prijonob466e232006-09-10 08:53:59 +0000652dnl # Include iLBC codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000653AC_SUBST(ac_no_ilbc_codec)
654AC_ARG_ENABLE(ilbc-codec,
655 AC_HELP_STRING([--disable-ilbc-codec],
656 [Exclude iLBC codec in the build]),
657 [if test "$enable_ilbc_codec" = "no"; then
658 [ac_no_ilbc_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000659 AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000660 AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
661 fi],
662 AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
663
Benny Prijono550a1a62007-10-16 08:54:00 +0000664dnl # Include libsamplerate
665AC_ARG_ENABLE(libsamplerate,
666 AC_HELP_STRING([--enable-libsamplerate],
667 [Link with libsamplerate when available. Note that PJMEDIA_RESAMPLE_IMP must also be configured]),
668 [ AC_CHECK_LIB(samplerate,src_new) ],
669 AC_MSG_RESULT([Skipping libsamplerate detection])
670 )
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000671
672
Benny Prijono0822c192008-08-21 20:59:58 +0000673dnl ########################################################
674dnl # Intel IPP support
675dnl #
676AC_ARG_ENABLE(ipp,
677 AC_HELP_STRING([--enable-ipp],
678 [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]),
679 [],
680 [enable_ipp=no]
681 )
682
Benny Prijono3965f192010-02-10 18:46:05 +0000683AC_ARG_WITH(ipp,
Benny Prijono0822c192008-08-21 20:59:58 +0000684 AC_HELP_STRING([--with-ipp=DIR],
685 [Specify the Intel IPP location]),
686 [],
687 [with_ipp=no]
688 )
689
Benny Prijono3965f192010-02-10 18:46:05 +0000690AC_ARG_WITH(ipp-samples,
Benny Prijono0822c192008-08-21 20:59:58 +0000691 AC_HELP_STRING([--with-ipp-samples=DIR],
692 [Specify the Intel IPP samples location]),
693 [],
694 [with_ipp_samples=no]
695 )
696
Benny Prijono3965f192010-02-10 18:46:05 +0000697AC_ARG_WITH(ipp-arch,
698 AC_HELP_STRING([--with-ipp-arch=ARCH],
699 [Specify the Intel IPP ARCH suffix, e.g. "64" or "em64t. Default is blank for IA32"]),
700 [],
701 [with_ipp_arch=no]
702 )
703
Benny Prijono0822c192008-08-21 20:59:58 +0000704if test "x$enable_ipp" != "xno"; then
705 dnl #
706 dnl # Verifying Intel IPP path
707 dnl #
708 AC_MSG_CHECKING([Intel IPP location])
709
710 if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
711 AC_MSG_RESULT([$with_ipp])
712 IPPROOT=$with_ipp
713 elif test "x$IPPROOT" = "x"; then
714 if test -d /opt/intel/ipp; then
715 IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
716 AC_MSG_RESULT([autodetected in $IPPROOT])
717 fi
718 else
719 AC_MSG_RESULT([$IPPROOT])
720 fi
721
Benny Prijono3965f192010-02-10 18:46:05 +0000722 if test "x$with_ipp_arch" != "xno"; then
723 IPP_SUFFIX="em64t"
724 AC_MSG_RESULT([IPP arch suffix is set to $IPP_SUFFIX])
725 else
726 IPP_SUFFIX=""
727 AC_MSG_RESULT([IPP arch suffix is set to empty])
728 fi
729
Benny Prijono0822c192008-08-21 20:59:58 +0000730 if test x$IPPROOT = x; then
731 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
732 elif test ! -d $IPPROOT; then
733 AC_MSG_ERROR([not found])
734 elif test ! -d $IPPROOT/include; then
735 AC_MSG_ERROR([directory doesn't seem to be valid])
736 else
737 # IPP directory looks okay.
738 # Remove trailing backslash
Benny Prijono3965f192010-02-10 18:46:05 +0000739 IPPROOT=`echo $IPPROOT | sed 's/\/$//'`
Benny Prijono0822c192008-08-21 20:59:58 +0000740
741 SAVED_CFLAGS="$CFLAGS"
742 SAVED_LDFLAGS="$LDFLAGS"
743 SAVED_LIBS="$LIBS"
744
745 IPP_CFLAGS="-I$IPPROOT/include"
Benny Prijono46bd0842010-02-12 14:12:41 +0000746 IPP_LIBS="-lippsc${IPP_SUFFIX} -lipps${IPP_SUFFIX} -lippsr${IPP_SUFFIX} -lippcore${IPP_SUFFIX}"
747
748 # Some differences between Mac OS X and Linux
749 case $target in
750 *darwin* )
751 IPP_LDFLAGS="-L$IPPROOT/Libraries -L$IPPROOT/lib"
752 ;;
753 *)
754 IPP_LDFLAGS="-L$IPPROOT/sharedlib"
755 IPP_LIBS="$IPP_LIBS -lguide"
756 ;;
757 esac
758
Benny Prijono0822c192008-08-21 20:59:58 +0000759 #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
Benny Prijono46bd0842010-02-12 14:12:41 +0000760 #Static:
Benny Prijono0822c192008-08-21 20:59:58 +0000761 #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
762
763 CFLAGS="$CFLAGS $IPP_CFLAGS"
764 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
765 LIBS="$IPP_LIBS $LIBS"
766
767
768 AC_MSG_CHECKING([Intel IPP usability])
769 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
770 ]],
771 [ippStaticInit();])],
772 [AC_MSG_RESULT(ok)],
Benny Prijono3965f192010-02-10 18:46:05 +0000773 [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 +0000774
775 CFLAGS="$SAVED_CFLAGS"
776 LDFLAGS="$SAVED_LDFLAGS"
777 LIBS="$SAVED_LIBS"
778 fi
779
780 dnl #
781 dnl # Verifying Intel IPP samples path
782 dnl #
783 AC_MSG_CHECKING([Intel IPP samples location])
784
785 if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
786 AC_MSG_RESULT([$with_ipp_samples])
787 IPPSAMPLES=$with_ipp_samples
788 elif test "x$IPPSAMPLES" = "x"; then
789 if test -d /opt/intel/ipp-samples; then
790 IPPSAMPLES=/opt/intel/ipp-samples
791 AC_MSG_RESULT([autodetected in $IPPSAMPLES])
792 fi
793 else
794 AC_MSG_RESULT([$IPPSAMPLES])
795 fi
796
797 if test x$IPPSAMPLES = x; then
798 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
799 elif test ! -d $IPPSAMPLES; then
800 AC_MSG_ERROR([not found])
801 elif test ! -d $IPPSAMPLES/speech-codecs; then
802 AC_MSG_ERROR([directory doesn't seem to be valid])
803 else
804 # Remove trailing backslash
805 IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
Benny Prijono3965f192010-02-10 18:46:05 +0000806
807 # Guess the libusc.a/libspeech.a build location
Benny Prijono0822c192008-08-21 20:59:58 +0000808 AC_MSG_CHECKING([Intel IPP USC build location])
Benny Prijono3965f192010-02-10 18:46:05 +0000809 if test -d $IPPSAMPLES/speech-codecs/bin; then
810 IPPVER=5
811 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
812 elif test -d $IPPSAMPLES/speech-codecs/_bin; then
813 IPPVER=6
Benny Prijono46bd0842010-02-12 14:12:41 +0000814 if test -d $IPPSAMPLES/speech-codecs/_bin/*gcc*; then
815 # gcc compiler
816 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib | head -1`
817 elif test -d $IPPSAMPLES/speech-codecs/_bin/*icc*; then
818 # icc compiler
819 IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*icc*/lib | head -1`
820 else
821 AC_MSG_FAILURE([Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?])
822 fi
Benny Prijono3965f192010-02-10 18:46:05 +0000823 else
824 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 +0000825 fi
Benny Prijono3965f192010-02-10 18:46:05 +0000826
827 # Test the directory
828 if test ! -d $IPPSAMP_DIR; then
829 AC_MSG_FAILURE([There's something wrong with this script, directory $IPPSAMP_DIR does not exist])
830 exit 1;
Benny Prijono0822c192008-08-21 20:59:58 +0000831 fi
Benny Prijono3965f192010-02-10 18:46:05 +0000832
833 if test "x$IPPVER" = "x5"; then
834 IPPSAMP_LIBS="libusc.a"
835 IPPSAMP_LDLIBS="-lusc"
836 elif test "x$IPPVER" = "x6"; then
837 IPPSAMP_LIBS="libspeech.a"
838 IPPSAMP_LDLIBS="-lspeech"
839 else
840 AC_MSG_FAILURE([bug in this script: unsupported IPP version])
841 fi
842
843 if test ! -f $IPPSAMP_DIR/$IPPSAMP_LIBS; then
844 AC_MSG_FAILURE([$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR])
845 fi
846
847 AC_MSG_RESULT([$IPPSAMP_DIR])
Benny Prijono0822c192008-08-21 20:59:58 +0000848
849 SAVED_CFLAGS="$CFLAGS"
850 SAVED_LDFLAGS="$LDFLAGS"
851 SAVED_LIBS="$LIBS"
852
Benny Prijono3965f192010-02-10 18:46:05 +0000853 IPPSAMP_INC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
854 CFLAGS="$CFLAGS $IPPSAMP_INC"
855 LDFLAGS="$LDFLAGS -L$IPPSAMP_DIR"
856 LIBS="$IPPSAMP_LDLIBS $LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +0000857
858 AC_MSG_CHECKING([Intel IPP USC usability])
859 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
860 ]],
861 [extern USC_Fxns USC_G729AFP_Fxns;])],
862 [AC_MSG_RESULT(ok)],
863 [AC_MSG_FAILURE(failed)])
864
865 CFLAGS="$SAVED_CFLAGS"
Benny Prijono3965f192010-02-10 18:46:05 +0000866 LDFLAGS="$IPP_LDFLAGS $SAVED_LDFLAGS"
867 LIBS="$IPP_LIBS $SAVED_LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +0000868
Benny Prijono3965f192010-02-10 18:46:05 +0000869 IPP_CFLAGS="$IPP_CFLAGS $IPPSAMP_INC"
870 IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMP_DIR"
871 IPP_LIBS="$IPPSAMP_LDLIBS $IPP_LIBS"
Benny Prijono0822c192008-08-21 20:59:58 +0000872 fi
873
Benny Prijono3965f192010-02-10 18:46:05 +0000874 CFLAGS="$CFLAGS $IPP_CFLAGS"
875 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
876 LIBS="$LIBS $IPP_LIBS"
877
Benny Prijono0822c192008-08-21 20:59:58 +0000878 ac_build_mak_vars="$ac_build_mak_vars\n\
879export IPP_CFLAGS=$IPP_CFLAGS\n\
880export IPP_LDFLAGS=$IPP_LDFLAGS\n\
881export IPP_LIBS=$IPP_LIBS"
882else
883 AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
884fi
885
886
Benny Prijonob466e232006-09-10 08:53:59 +0000887dnl ##########################################
888dnl #
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000889dnl # PJSIP CONFIG
890dnl #
891
892dnl # Include SSL support
893AC_SUBST(ac_no_ssl)
894AC_ARG_ENABLE(ssl,
Benny Prijonoce1db762007-02-14 02:21:08 +0000895 AC_HELP_STRING([--disable-ssl],
896 [Exclude SSL support the build (default: autodetect)])
897 ,
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000898 [
899 if test "$enable_ssl" = "no"; then
900 [ac_no_ssl=1]
901 AC_MSG_RESULT([Checking if SSL support is disabled... yes])
902 fi
903 ],
904 [
905 AC_MSG_RESULT([checking for OpenSSL installations..])
906 AC_SUBST(openssl_h_present)
907 AC_SUBST(libssl_present)
908 AC_SUBST(libcrypto_present)
909 AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000910 AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
Benny Prijonod5233702010-01-13 13:09:45 +0000911 AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000912 if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
913 AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
Nanang Izzuddin9c7616f2009-10-28 06:09:15 +0000914 # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
915 #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
Nanang Izzuddinea6d3c42009-10-26 15:47:52 +0000916 AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000917 else
918 AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **])
919 fi
920 ])
921
922
923dnl ##########################################
924dnl #
Benny Prijonob466e232006-09-10 08:53:59 +0000925dnl # MANUAL CONFIG
926dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000927
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000928
Benny Prijonob466e232006-09-10 08:53:59 +0000929dnl # Determine if select() requires nfds to be filled up with
930dnl # correct value (max_fd+1). If zero, nfds will be filled up with
931dnl # PJ_FD_SETSIZE
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000932AC_MSG_CHECKING([if select() needs correct nfds])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000933case $target in
934 *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000935 AC_MSG_RESULT(yes)
936 ;;
937 *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
938 AC_MSG_RESULT([no (default)])
939 AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
940 ;;
941esac
942
Benny Prijonob466e232006-09-10 08:53:59 +0000943dnl # Determine if pj_thread_create() should enforce thread stack size when
944dnl # creating thread. Default is zero, to allow OS to allocate appropriate
945dnl # thread's stack size.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000946AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
947case $target in
948 *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
949 AC_MSG_RESULT(yes)
950 ;;
951 *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
952 AC_MSG_RESULT([no (default)])
953 ;;
954esac
955
Benny Prijonob466e232006-09-10 08:53:59 +0000956dnl # Determine if pj_thread_create() should allocate thread's stack from
957dnl # the pool. Default is zero, to let OS allocate thread's stack.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000958AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
959case $target in
960 *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
961 AC_MSG_RESULT(yes)
962 ;;
963 *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
964 AC_MSG_RESULT([no (default)])
965 ;;
966esac
967
Benny Prijonob466e232006-09-10 08:53:59 +0000968dnl # This value specifies the value set in errno by the OS when a non-blocking
969dnl # socket recv() can not return immediate data.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000970case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000971 *mingw* | *cygw* | *win32* | *w32* )
972 AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
973 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000974 *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
975 AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
976 ;;
977esac
978
Benny Prijonob466e232006-09-10 08:53:59 +0000979dnl # This value specifies the value set in errno by the OS when a non-blocking
980dnl # socket connect() can not get connected immediately.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000981case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000982 *mingw* | *cygw* | *win32* | *w32* )
983 AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
984 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000985 *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
986 AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
987 ;;
988esac
989
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000990
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000991AC_SUBST(target)
992AC_SUBST(ac_cross_compile)
993if test "$build" = "$host"; then
994 ac_cross_compile=
995else
Benny Prijono5b818b22006-09-17 22:58:51 +0000996 ac_cross_compile=${host_orig}-
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000997fi
998AC_SUBST(ac_linux_poll,select)
999AC_SUBST(ac_host,unix)
1000AC_SUBST(ac_main_obj)
1001case $target in
1002 *rtems*)
1003 ac_main_obj=main_rtems.o
1004 ;;
1005 *)
1006 ac_main_obj=main.o
1007 ;;
1008esac
1009AC_SUBST(CC)
Benny Prijono0822c192008-08-21 20:59:58 +00001010
1011ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
Benny Prijonoa9b372a2006-07-24 02:07:11 +00001012AC_OUTPUT()
1013
Benny Prijonod9627842007-04-18 09:24:31 +00001014
1015AC_MSG_RESULT([
1016
Benny Prijonoc16c6e32007-11-18 14:53:47 +00001017Configurations 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 +00001018
Benny Prijonoc16c6e32007-11-18 14:53:47 +00001019Further customizations can be put in:
Benny Prijonod9627842007-04-18 09:24:31 +00001020 - 'user.mak'
1021 - 'pjlib/include/pj/config_site.h'
1022
1023The next step now is to run 'make dep' and 'make'.
1024])
1025