blob: 0eedcfc6751d023d8a5e7597e9d9095827c15b69 [file] [log] [blame]
Benny Prijono0822c192008-08-21 20:59:58 +00001AC_INIT(pjproject,1.0)
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
16 pjlib/build/os-auto.mak
17 pjlib-util/build/os-auto.mak
18 pjmedia/build/os-auto.mak
19 pjsip/build/os-auto.mak
Benny Prijonod9627842007-04-18 09:24:31 +000020 third_party/build/portaudio/os-auto.mak
21 third_party/build/os-auto.mak
Benny Prijonoc4c61d02006-08-20 20:47:34 +000022 ])
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)])
175AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
176AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000177AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
178AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000179AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
180 [#if PJ_HAS_WINSOCK2_H
181 # include <winsock2.h>
182 #elif PJ_HAS_WINSOCK_H
183 # include <winsock.h>
184 #endif
185 ])
Benny Prijonoe2746132008-09-27 13:16:35 +0000186AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
Benny Prijono4e48b512007-05-16 13:41:00 +0000187AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
Benny Prijonoa9948e62008-03-25 14:03:01 +0000188AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
Benny Prijonod5233702010-01-13 13:09:45 +0000189 [#if PJ_HAS_SYS_TYPES_H
190 # include <sys/types.h>
191 #endif
192 #if PJ_HAS_SYS_SOCKET_H
193
Benny Prijono188ba7e2008-03-25 13:53:16 +0000194 # include <sys/socket.h>
195 #endif
196 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000197AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
198AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
199
200AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
201AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
202
203AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
204AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
205
206AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
207AC_DEFINE(PJ_HAS_MALLOC,1)
208
209AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
210AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
211
212AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
213AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000214
Benny Prijonob466e232006-09-10 08:53:59 +0000215dnl # Determine if inet_aton() is available
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000216AC_MSG_CHECKING([if inet_aton() is available])
217AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
218 #include <sys/socket.h>
219 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000220 [inet_aton(0, 0);])],
221 [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
222 AC_MSG_RESULT(yes)],
223 [AC_MSG_RESULT(no)])
224
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000225dnl # Determine if inet_pton() is available
226AC_MSG_CHECKING([if inet_pton() is available])
227AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
228 #include <sys/socket.h>
229 #include <arpa/inet.h>]],
230 [inet_pton(0, 0, 0);])],
231 [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
232 AC_MSG_RESULT(yes)],
233 [AC_MSG_RESULT(no)])
234
235dnl # Determine if inet_ntop() is available
236AC_MSG_CHECKING([if inet_ntop() is available])
237AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
238 #include <sys/socket.h>
239 #include <arpa/inet.h>]],
240 [inet_ntop(0, 0, 0, 0);])],
241 [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
242 AC_MSG_RESULT(yes)],
243 [AC_MSG_RESULT(no)])
244
245dnl # Determine if getaddrinfo() is available
246AC_MSG_CHECKING([if getaddrinfo() is available])
247AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
248 #include <sys/socket.h>
249 #include <netdb.h>]],
250 [getaddrinfo(0, 0, 0, 0);])],
251 [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
252 AC_MSG_RESULT(yes)],
253 [AC_MSG_RESULT(no)])
254
Benny Prijonob466e232006-09-10 08:53:59 +0000255dnl # Determine if sockaddr_in has sin_len member
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000256AC_MSG_CHECKING([if sockaddr_in has sin_len member])
Benny Prijonob466e232006-09-10 08:53:59 +0000257AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
258 #include <sys/socket.h>
259 #include <netinet/in.h>
260 #include <arpa/inet.h>]],
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000261 [struct sockaddr_in a; a.sin_len=0;])],
262 [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
263 AC_MSG_RESULT(yes)],
264 AC_MSG_RESULT(no))
265
Benny Prijonob466e232006-09-10 08:53:59 +0000266dnl # Determine if socklen_t is available
Benny Prijono30f85c62006-09-09 20:05:33 +0000267AC_MSG_CHECKING([if socklen_t is available])
Benny Prijonod5233702010-01-13 13:09:45 +0000268AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
269 #include <sys/socket.h>]],
Benny Prijono30f85c62006-09-09 20:05:33 +0000270 [socklen_t xxx = 0;])],
271 [AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
272 AC_MSG_RESULT(yes)],
273 AC_MSG_RESULT(no))
274
Benny Prijonob466e232006-09-10 08:53:59 +0000275dnl # Determine if SO_ERROR is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000276AC_MSG_CHECKING([if SO_ERROR is available])
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000277case $target in
278 *mingw* | *cygw* | *win32* | *w32* )
279 AC_DEFINE(PJ_HAS_SO_ERROR,1)
280 AC_MSG_RESULT(yes)
281 ;;
282 *)
283 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
284 #include <sys/socket.h>
285 #include <netinet/in.h>
286 #include <arpa/inet.h>]],
287 [int i=SO_ERROR;])],
288 [AC_DEFINE(PJ_HAS_SO_ERROR,1)
289 AC_MSG_RESULT(yes)],
290 AC_MSG_RESULT(no))
291 ;;
292esac
293
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000294
Benny Prijonob466e232006-09-10 08:53:59 +0000295dnl # Determine if RW-mutex is available
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000296AC_MSG_CHECKING([if pthread_rwlock_t is available])
297AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
298 [pthread_rwlock_t *x;])],
299 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000300 ac_rwmutex="yes"
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000301 AC_MSG_RESULT(yes)],
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000302 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000303 ac_rwmutex="no"
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000304 AC_MSG_RESULT(no)])
305
Benny Prijono1c5f4e42008-02-07 13:11:39 +0000306dnl # If rwmutex is not detected, check again but this time
307dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
308if test "$ac_rwmutex" = "no"; then
309 AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
311 #include <pthread.h>]],
312 [pthread_rwlock_t *x;])],
313 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
314 CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
315 AC_MSG_RESULT(yes)],
316 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
317 AC_MSG_RESULT(no)])
318fi
319
320dnl # Do we have pthread_mutexattr_settype()?
321AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
322AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
323 [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
324 [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
325 AC_MSG_RESULT(yes)],
326 [AC_MSG_RESULT(no)])
327
328dnl # Does pthread_mutexattr_t has "recursive" member?
329AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
330AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
331 [[pthread_mutexattr_t attr;
332 attr.recursive=1;]])],
333 [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
334 AC_MSG_RESULT(yes)],
335 [AC_MSG_RESULT(no)])
336
Benny Prijono99eec382008-09-18 21:22:16 +0000337dnl ######################
338dnl # ioqueue selection
339dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000340AC_SUBST(ac_os_objs)
Benny Prijono99eec382008-09-18 21:22:16 +0000341AC_MSG_CHECKING([ioqueue backend])
342AC_ARG_ENABLE(epoll,
343 AC_HELP_STRING([--enable-epoll],
Benny Prijono9489e7a2008-09-19 22:18:50 +0000344 [Use /dev/epoll ioqueue on Linux (experimental)]),
Benny Prijono99eec382008-09-18 21:22:16 +0000345 [
346 ac_os_objs=ioqueue_epoll.o
347 AC_MSG_RESULT([/dev/epoll])
348 ],
349 [
350 ac_os_objs=ioqueue_select.o
351 AC_MSG_RESULT([select()])
352 ])
353
354
355dnl ######################
356dnl # OS specific files
357dnl #
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000358case $target in
359 *mingw* | *cygw* | *win32* | *w32* )
Benny Prijono99eec382008-09-18 21:22:16 +0000360 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 +0000361 ;;
362 *)
Benny Prijono99eec382008-09-18 21:22:16 +0000363 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 +0000364 # UUID
365 if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
366 ac_os_objs="$ac_os_objs guid_uuid.o"
367 else
368 ac_os_objs="$ac_os_objs guid_simple.o"
369 fi
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000370 ;;
371esac
372
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000373
Benny Prijono4e48b512007-05-16 13:41:00 +0000374
Benny Prijonob466e232006-09-10 08:53:59 +0000375dnl ##########################################
376dnl #
377dnl # PJMEDIA
378dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000379
Benny Prijonob466e232006-09-10 08:53:59 +0000380dnl # Sound device backend selection
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000381AC_SUBST(ac_pjmedia_snd)
Benny Prijono1d971622006-09-10 22:27:40 +0000382AC_ARG_ENABLE(sound,
383 AC_HELP_STRING([--disable-sound],
384 [Exclude sound (i.e. use null sound)]),
385 [if test "$enable_sound" = "no"; then
386 [ac_pjmedia_snd=null]
387 AC_MSG_RESULT([Checking if sound is disabled... yes])
388 fi]
389 )
390
Benny Prijono39ae2da2006-10-13 17:57:42 +0000391AC_SUBST(ac_pa_cflags)
Benny Prijono27c98722007-04-09 21:28:15 +0000392AC_CHECK_HEADER(sys/soundcard.h,
393 [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
394AC_CHECK_HEADER(linux/soundcard.h,
395 [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
396AC_CHECK_HEADER(machine/soundcard.h,
397 [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
398
Benny Prijono3e091672008-01-09 15:43:02 +0000399if test "x$ac_cv_c_bigendian" = "xyes"; then
400 ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
401else
402 ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
403fi
404
Benny Prijono1d971622006-09-10 22:27:40 +0000405if test "$enable_sound" = "no"; then
406 true;
407else
408 case $target in
Benny Prijonob466e232006-09-10 08:53:59 +0000409 *darwin*)
Benny Prijono39ae2da2006-10-13 17:57:42 +0000410 LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
411 if test "`uname -r`" = "6.8"; then
Benny Prijono27c98722007-04-09 21:28:15 +0000412 #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
Benny Prijono39ae2da2006-10-13 17:57:42 +0000413 #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
414 ac_pjmedia_snd=pa_old_darwinos
415 AC_MSG_RESULT([Checking sound device backend... old coreaudio])
416 else
417 ac_pjmedia_snd=pa_darwinos
418 AC_MSG_RESULT([Checking sound device backend... coreaudio])
419 fi
Benny Prijonob466e232006-09-10 08:53:59 +0000420 ;;
421 *cygwin* | *mingw*)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000422 ac_pjmedia_snd=pa_win32
423 AC_MSG_RESULT([Checking sound device backend... win32 sound])
424 ;;
425 *rtems*)
426 ac_pjmedia_snd=null
427 AC_MSG_RESULT([Checking sound device backend... null sound])
428 ;;
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000429 *)
Benny Prijono0b462322008-03-12 22:44:24 +0000430 dnl # Check if ALSA is available
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000431 ac_pjmedia_snd=pa_unix
432 AC_CHECK_HEADER(alsa/version.h,
433 [AC_SUBST(ac_pa_use_alsa,1)
434 LIBS="$LIBS -lasound"
435 ],
436 [AC_SUBST(ac_pa_use_alsa,0)])
437 AC_MSG_RESULT([Checking sound device backend... unix])
Benny Prijono0b462322008-03-12 22:44:24 +0000438
439 dnl # Check if OSS is disabled
440 AC_SUBST(ac_pa_use_oss,1)
441 AC_ARG_ENABLE(oss,
442 AC_HELP_STRING([--disable-oss],
443 [Disable OSS audio (default: not disabled)])
444 ,
445 [
446 if test "$enable_oss" = "no"; then
447 [ac_pa_use_oss=0]
448 AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
449 fi
450 ])
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000451 ;;
Benny Prijono1d971622006-09-10 22:27:40 +0000452 esac
453fi
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000454
Benny Prijonoebb2c332008-07-28 23:40:58 +0000455AC_ARG_ENABLE(ext_sound,
456 AC_HELP_STRING([--enable-ext-sound],
457 [PJMEDIA will not provide any sound device backend]),
458 [if test "$enable_ext_sound" = "yes"; then
459 [ac_pjmedia_snd=external]
460 AC_MSG_RESULT([Checking if external sound is set... yes])
461 fi]
462 )
463
Benny Prijonob466e232006-09-10 08:53:59 +0000464dnl # Include resampling small filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000465AC_SUBST(ac_no_small_filter)
466AC_ARG_ENABLE(small-filter,
467 AC_HELP_STRING([--disable-small-filter],
468 [Exclude small filter in resampling]),
469 [if test "$enable_small_filter" = "no"; then
470 [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
471 AC_MSG_RESULT([Checking if small filter is disabled... yes])
472 fi],
473 AC_MSG_RESULT([Checking if small filter is disabled... no]))
474
Benny Prijonob466e232006-09-10 08:53:59 +0000475dnl # Include resampling large filter
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000476AC_SUBST(ac_no_large_filter)
477AC_ARG_ENABLE(large-filter,
478 AC_HELP_STRING([--disable-large-filter],
479 [Exclude large filter in resampling]),
480 [if test "$enable_large_filter" = "no"; then
481 [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
482 AC_MSG_RESULT([Checking if large filter is disabled... yes])
483 fi],
484 AC_MSG_RESULT([Checking if large filter is disabled... no]))
485
Benny Prijonob466e232006-09-10 08:53:59 +0000486dnl # Include Speex AEC
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000487AC_SUBST(ac_no_speex_aec)
488AC_ARG_ENABLE(speex-aec,
489 AC_HELP_STRING([--disable-speex-aec],
490 [Exclude Speex Acoustic Echo Canceller/AEC]),
491 [if test "$enable_speex_aec" = "no"; then
492 [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
493 AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
494 fi],
495 AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
496
Benny Prijonob466e232006-09-10 08:53:59 +0000497dnl # Include G711 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000498AC_SUBST(ac_no_g711_codec)
499AC_ARG_ENABLE(g711-codec,
500 AC_HELP_STRING([--disable-g711-codec],
501 [Exclude G.711 codecs from the build]),
502 [if test "$enable_g711_codec" = "no"; then
503 [ac_no_g711_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000504 AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000505 AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
506 fi],
507 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
508
509
Benny Prijonob466e232006-09-10 08:53:59 +0000510dnl # Include L16 codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000511AC_SUBST(ac_no_l16_codec)
512AC_ARG_ENABLE(l16-codec,
513 AC_HELP_STRING([--disable-l16-codec],
514 [Exclude Linear/L16 codec family from the build]),
515 [if test "$enable_l16_codec" = "no"; then
516 [ac_no_l16_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000517 AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000518 AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
519 fi],
Benny Prijonoc1fe23d2006-09-13 09:38:06 +0000520 AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000521
522
Benny Prijonob466e232006-09-10 08:53:59 +0000523dnl # Include GSM codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000524AC_SUBST(ac_no_gsm_codec)
525AC_ARG_ENABLE(gsm-codec,
526 AC_HELP_STRING([--disable-gsm-codec],
527 [Exclude GSM codec in the build]),
528 [if test "$enable_gsm_codec" = "no"; then
529 [ac_no_gsm_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000530 AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000531 AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
532 fi],
533 AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
534
Benny Prijono71f657d2008-03-17 14:24:21 +0000535dnl # Include G.722 codec
536AC_SUBST(ac_no_g722_codec)
537AC_ARG_ENABLE(g722-codec,
538 AC_HELP_STRING([--disable-g722-codec],
539 [Exclude G.722 codec in the build]),
540 [if test "$enable_g722_codec" = "no"; then
541 [ac_no_g722_codec=1]
542 AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
543 AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
544 fi],
545 AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
546
Nanang Izzuddin56e380a2009-04-15 14:45:41 +0000547dnl # Include G722.1 codec
548AC_SUBST(ac_no_g7221_codec)
549AC_ARG_ENABLE(g7221-codec,
550 AC_HELP_STRING([--disable-g7221-codec],
551 [Exclude G.7221 codec in the build]),
552 [if test "$enable_g7221_codec" = "no"; then
553 [ac_no_g7221_codec=1]
554 AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
555 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
556 fi],
557 AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
558
Benny Prijonob466e232006-09-10 08:53:59 +0000559dnl # Include Speex codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000560AC_SUBST(ac_no_speex_codec)
561AC_ARG_ENABLE(speex-codec,
562 AC_HELP_STRING([--disable-speex-codec],
563 [Exclude Speex codecs in the build]),
564 [if test "$enable_speex_codec" = "no"; then
565 [ac_no_speex_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000566 AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000567 AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
568 fi],
569 AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
570
Benny Prijonob466e232006-09-10 08:53:59 +0000571dnl # Include iLBC codec
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000572AC_SUBST(ac_no_ilbc_codec)
573AC_ARG_ENABLE(ilbc-codec,
574 AC_HELP_STRING([--disable-ilbc-codec],
575 [Exclude iLBC codec in the build]),
576 [if test "$enable_ilbc_codec" = "no"; then
577 [ac_no_ilbc_codec=1]
Benny Prijonofe9bffd2007-01-27 17:44:13 +0000578 AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000579 AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
580 fi],
581 AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
582
Benny Prijono550a1a62007-10-16 08:54:00 +0000583dnl # Include libsamplerate
584AC_ARG_ENABLE(libsamplerate,
585 AC_HELP_STRING([--enable-libsamplerate],
586 [Link with libsamplerate when available. Note that PJMEDIA_RESAMPLE_IMP must also be configured]),
587 [ AC_CHECK_LIB(samplerate,src_new) ],
588 AC_MSG_RESULT([Skipping libsamplerate detection])
589 )
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000590
591
Benny Prijono0822c192008-08-21 20:59:58 +0000592dnl ########################################################
593dnl # Intel IPP support
594dnl #
595AC_ARG_ENABLE(ipp,
596 AC_HELP_STRING([--enable-ipp],
597 [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]),
598 [],
599 [enable_ipp=no]
600 )
601
602AC_ARG_ENABLE(ipp,
603 AC_HELP_STRING([--with-ipp=DIR],
604 [Specify the Intel IPP location]),
605 [],
606 [with_ipp=no]
607 )
608
609AC_ARG_ENABLE(ipp-samples,
610 AC_HELP_STRING([--with-ipp-samples=DIR],
611 [Specify the Intel IPP samples location]),
612 [],
613 [with_ipp_samples=no]
614 )
615
616if test "x$enable_ipp" != "xno"; then
617 dnl #
618 dnl # Verifying Intel IPP path
619 dnl #
620 AC_MSG_CHECKING([Intel IPP location])
621
622 if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
623 AC_MSG_RESULT([$with_ipp])
624 IPPROOT=$with_ipp
625 elif test "x$IPPROOT" = "x"; then
626 if test -d /opt/intel/ipp; then
627 IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
628 AC_MSG_RESULT([autodetected in $IPPROOT])
629 fi
630 else
631 AC_MSG_RESULT([$IPPROOT])
632 fi
633
634 if test x$IPPROOT = x; then
635 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
636 elif test ! -d $IPPROOT; then
637 AC_MSG_ERROR([not found])
638 elif test ! -d $IPPROOT/include; then
639 AC_MSG_ERROR([directory doesn't seem to be valid])
640 else
641 # IPP directory looks okay.
642 # Remove trailing backslash
643 IPPROOT=`echo $IPPROOT/ | sed 's/\/$//'`
644
645 SAVED_CFLAGS="$CFLAGS"
646 SAVED_LDFLAGS="$LDFLAGS"
647 SAVED_LIBS="$LIBS"
648
649 IPP_CFLAGS="-I$IPPROOT/include"
650 IPP_LDFLAGS="-L$IPPROOT/sharedlib"
651 IPP_LIBS="-lippsc -lipps -lippsr -lippcore -lguide"
652 #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
653 #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
654
655 CFLAGS="$CFLAGS $IPP_CFLAGS"
656 LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
657 LIBS="$IPP_LIBS $LIBS"
658
659
660 AC_MSG_CHECKING([Intel IPP usability])
661 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
662 ]],
663 [ippStaticInit();])],
664 [AC_MSG_RESULT(ok)],
665 [AC_MSG_FAILURE(failed)])
666
667 CFLAGS="$SAVED_CFLAGS"
668 LDFLAGS="$SAVED_LDFLAGS"
669 LIBS="$SAVED_LIBS"
670 fi
671
672 dnl #
673 dnl # Verifying Intel IPP samples path
674 dnl #
675 AC_MSG_CHECKING([Intel IPP samples location])
676
677 if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
678 AC_MSG_RESULT([$with_ipp_samples])
679 IPPSAMPLES=$with_ipp_samples
680 elif test "x$IPPSAMPLES" = "x"; then
681 if test -d /opt/intel/ipp-samples; then
682 IPPSAMPLES=/opt/intel/ipp-samples
683 AC_MSG_RESULT([autodetected in $IPPSAMPLES])
684 fi
685 else
686 AC_MSG_RESULT([$IPPSAMPLES])
687 fi
688
689 if test x$IPPSAMPLES = x; then
690 AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
691 elif test ! -d $IPPSAMPLES; then
692 AC_MSG_ERROR([not found])
693 elif test ! -d $IPPSAMPLES/speech-codecs; then
694 AC_MSG_ERROR([directory doesn't seem to be valid])
695 else
696 # Remove trailing backslash
697 IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
698
699 # Guess the libusc.a build location
700 AC_MSG_CHECKING([Intel IPP USC build location])
701 IPPSAMPLESLIB=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
702 if test ! -d $IPPSAMPLESLIB; then
703 AC_MSG_FAILURE([the $IPPSAMPLES/speech-codecs/bin/*gcc*/lib directory not found. Have you built the samples?])
704 fi
705 if test ! -f $IPPSAMPLESLIB/libusc.a; then
706 AC_MSG_FAILURE([libusc.a doesn't exist in $IPPSAMPLESLIB])
707 fi
708 AC_MSG_RESULT([$IPPSAMPLESLIB])
709
710 SAVED_CFLAGS="$CFLAGS"
711 SAVED_LDFLAGS="$LDFLAGS"
712 SAVED_LIBS="$LIBS"
713
714 IPPSAMPLESINC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
715 CFLAGS="$CFLAGS $IPPSAMPLESINC"
716 LDFLAGS="$LDFLAGS -L$IPPSAMPLESLIB"
717 LIBS="-lusc $LIBS"
718
719 AC_MSG_CHECKING([Intel IPP USC usability])
720 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
721 ]],
722 [extern USC_Fxns USC_G729AFP_Fxns;])],
723 [AC_MSG_RESULT(ok)],
724 [AC_MSG_FAILURE(failed)])
725
726 CFLAGS="$SAVED_CFLAGS"
727 LDFLAGS="\$(IPP_LDFLAGS) $SAVED_LDFLAGS"
728 LIBS="\$(IPP_LIBS) $SAVED_LIBS"
729
730 IPP_CFLAGS="$IPP_CFLAGS $IPPSAMPLESINC"
731 IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMPLESLIB"
732 IPP_LIBS="-lusc $IPP_LIBS"
733 fi
734
735 ac_build_mak_vars="$ac_build_mak_vars\n\
736export IPP_CFLAGS=$IPP_CFLAGS\n\
737export IPP_LDFLAGS=$IPP_LDFLAGS\n\
738export IPP_LIBS=$IPP_LIBS"
739else
740 AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
741fi
742
743
Benny Prijonob466e232006-09-10 08:53:59 +0000744dnl ##########################################
745dnl #
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000746dnl # PJSIP CONFIG
747dnl #
748
749dnl # Include SSL support
750AC_SUBST(ac_no_ssl)
751AC_ARG_ENABLE(ssl,
Benny Prijonoce1db762007-02-14 02:21:08 +0000752 AC_HELP_STRING([--disable-ssl],
753 [Exclude SSL support the build (default: autodetect)])
754 ,
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000755 [
756 if test "$enable_ssl" = "no"; then
757 [ac_no_ssl=1]
758 AC_MSG_RESULT([Checking if SSL support is disabled... yes])
759 fi
760 ],
761 [
762 AC_MSG_RESULT([checking for OpenSSL installations..])
763 AC_SUBST(openssl_h_present)
764 AC_SUBST(libssl_present)
765 AC_SUBST(libcrypto_present)
766 AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000767 AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
Benny Prijonod5233702010-01-13 13:09:45 +0000768 AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000769 if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
770 AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
Nanang Izzuddin9c7616f2009-10-28 06:09:15 +0000771 # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
772 #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
Nanang Izzuddinea6d3c42009-10-26 15:47:52 +0000773 AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
Benny Prijono7e0d75f2006-12-25 20:34:14 +0000774 else
775 AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **])
776 fi
777 ])
778
779
780dnl ##########################################
781dnl #
Benny Prijonob466e232006-09-10 08:53:59 +0000782dnl # MANUAL CONFIG
783dnl #
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000784
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000785
Benny Prijonob466e232006-09-10 08:53:59 +0000786dnl # Determine if select() requires nfds to be filled up with
787dnl # correct value (max_fd+1). If zero, nfds will be filled up with
788dnl # PJ_FD_SETSIZE
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000789AC_MSG_CHECKING([if select() needs correct nfds])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000790case $target in
791 *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000792 AC_MSG_RESULT(yes)
793 ;;
794 *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
795 AC_MSG_RESULT([no (default)])
796 AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
797 ;;
798esac
799
Benny Prijonob466e232006-09-10 08:53:59 +0000800dnl # Determine if pj_thread_create() should enforce thread stack size when
801dnl # creating thread. Default is zero, to allow OS to allocate appropriate
802dnl # thread's stack size.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000803AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
804case $target in
805 *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
806 AC_MSG_RESULT(yes)
807 ;;
808 *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
809 AC_MSG_RESULT([no (default)])
810 ;;
811esac
812
Benny Prijonob466e232006-09-10 08:53:59 +0000813dnl # Determine if pj_thread_create() should allocate thread's stack from
814dnl # the pool. Default is zero, to let OS allocate thread's stack.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000815AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
816case $target in
817 *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
818 AC_MSG_RESULT(yes)
819 ;;
820 *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
821 AC_MSG_RESULT([no (default)])
822 ;;
823esac
824
Benny Prijonob466e232006-09-10 08:53:59 +0000825dnl # This value specifies the value set in errno by the OS when a non-blocking
826dnl # socket recv() can not return immediate data.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000827case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000828 *mingw* | *cygw* | *win32* | *w32* )
829 AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
830 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000831 *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
832 AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
833 ;;
834esac
835
Benny Prijonob466e232006-09-10 08:53:59 +0000836dnl # This value specifies the value set in errno by the OS when a non-blocking
837dnl # socket connect() can not get connected immediately.
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000838case $target in
Benny Prijonoc5b6dbf2006-09-10 16:33:48 +0000839 *mingw* | *cygw* | *win32* | *w32* )
840 AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
841 ;;
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000842 *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
843 AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
844 ;;
845esac
846
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000847
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000848AC_SUBST(target)
849AC_SUBST(ac_cross_compile)
850if test "$build" = "$host"; then
851 ac_cross_compile=
852else
Benny Prijono5b818b22006-09-17 22:58:51 +0000853 ac_cross_compile=${host_orig}-
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000854fi
855AC_SUBST(ac_linux_poll,select)
856AC_SUBST(ac_host,unix)
857AC_SUBST(ac_main_obj)
858case $target in
859 *rtems*)
860 ac_main_obj=main_rtems.o
861 ;;
862 *)
863 ac_main_obj=main.o
864 ;;
865esac
866AC_SUBST(CC)
Benny Prijono0822c192008-08-21 20:59:58 +0000867
868ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000869AC_OUTPUT()
870
Benny Prijonod9627842007-04-18 09:24:31 +0000871
872AC_MSG_RESULT([
873
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000874Configurations 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 +0000875
Benny Prijonoc16c6e32007-11-18 14:53:47 +0000876Further customizations can be put in:
Benny Prijonod9627842007-04-18 09:24:31 +0000877 - 'user.mak'
878 - 'pjlib/include/pj/config_site.h'
879
880The next step now is to run 'make dep' and 'make'.
881])
882