blob: a01e4d22929b87f53dceaa0ca4e56a08b17e3fa7 [file] [log] [blame]
Benny Prijonoc4c61d02006-08-20 20:47:34 +00001AC_INIT(pjproject,0.5.8)
2AC_CANONICAL_BUILD
3AC_CANONICAL_HOST
Benny Prijonoa9b372a2006-07-24 02:07:11 +00004AC_CANONICAL_TARGET
Benny Prijonoc4c61d02006-08-20 20:47:34 +00005AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h
6 pjlib/include/pj/compat/m_auto.h
7 ])
8AC_CONFIG_FILES([build.mak
9 build/os-auto.mak
10 pjlib/build/os-auto.mak
11 pjlib-util/build/os-auto.mak
12 pjmedia/build/os-auto.mak
13 pjsip/build/os-auto.mak
14 ])
Benny Prijonoa9b372a2006-07-24 02:07:11 +000015AC_PROG_CC
Benny Prijonoc4c61d02006-08-20 20:47:34 +000016AC_PROG_CXX
Benny Prijonoa9b372a2006-07-24 02:07:11 +000017AC_LANG_C
18
Benny Prijonoc4c61d02006-08-20 20:47:34 +000019AC_CHECK_LIB(pthread,pthread_create)
20
21AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
22AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
23
24# Endianness detection
25AC_C_BIGENDIAN([AC_SUBST(ac_bigendian,1)
26 AC_DEFINE(PJ_IS_LITTLE_ENDIAN,0)
27 AC_DEFINE(PJ_IS_BIG_ENDIAN,1)
28 ],
29 [AC_SUBST(ac_bigendian,0)
30 AC_DEFINE(PJ_IS_LITTLE_ENDIAN,1)
31 AC_DEFINE(PJ_IS_BIG_ENDIAN,0)
32 ])
33
34# --disable-floating-point option
35AC_ARG_ENABLE(floating-point,
36 AC_HELP_STRING([--disable-floating-point],
37 [Disable floating point where possible]),
38 [if test "$enable_floating_point" = "no"; then
39 AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
40 AC_MSG_RESULT([Checking if floating point is disabled... yes])
41 fi],
42 [
43 AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
44 AC_MSG_RESULT([Checking if floating point is disabled... no])
45 AC_CHECK_LIB(m,fmod)
46 ])
47
48
Benny Prijonoa9b372a2006-07-24 02:07:11 +000049AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
50AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
51AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
52AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
53AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
54AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
55AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
56AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
57AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
58AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
59AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
60AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
61AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
62AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
63AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
64AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
65AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
66AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
67AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
68AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
69AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
70AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
71AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)])
72AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
73AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
74
Benny Prijonoc4c61d02006-08-20 20:47:34 +000075AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
76AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
77
78AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
79AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
80
81AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
82AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
83
84AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
85AC_DEFINE(PJ_HAS_MALLOC,1)
86
87AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
88AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
89
90AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
91AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
Benny Prijonoa9b372a2006-07-24 02:07:11 +000092
93# Determine if inet_aton() is available
94AC_MSG_CHECKING([if inet_aton is available])
95AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
96 #include <netinet/in.h>
97 #include <arpa/inet.h>]],
98 [inet_aton(0, 0);])],
99 [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
100 AC_MSG_RESULT(yes)],
101 [AC_MSG_RESULT(no)])
102
103# Determine if sockaddr_in has sin_len member
104AC_MSG_CHECKING([if sockaddr_in has sin_len member])
105AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
106 #include <netinet/in.h>
107 #include <arpa/inet.h>]],
108 [struct sockaddr_in a; a.sin_len=0;])],
109 [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
110 AC_MSG_RESULT(yes)],
111 AC_MSG_RESULT(no))
112
113# Determine if SO_ERROR is available
114AC_MSG_CHECKING([if SO_ERROR is available])
115AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
116 #include <netinet/in.h>
117 #include <arpa/inet.h>]],
118 [int i=SO_ERROR;])],
119 [AC_DEFINE(PJ_HAS_SO_ERROR,1)
120 AC_MSG_RESULT(yes)],
121 AC_MSG_RESULT(no))
122
123# Determine if RW-mutex is available
124AC_MSG_CHECKING([if pthread_rwlock_t is available])
125AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
126 [pthread_rwlock_t *x;])],
127 [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
128 AC_MSG_RESULT(yes)],
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000129 [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
130 AC_MSG_RESULT(no)])
131
132
133##########################################
134#
135# PJMEDIA
136#
137
138# Sound device backend selection
139AC_SUBST(ac_pjmedia_snd)
140case $target in
141 *cygwin* | *win* | *mingw*)
142 ac_pjmedia_snd=pa_win32
143 AC_MSG_RESULT([Checking sound device backend... win32 sound])
144 ;;
145 *rtems*)
146 ac_pjmedia_snd=null
147 AC_MSG_RESULT([Checking sound device backend... null sound])
148 ;;
149 *darwin*)
150 ac_pjmedia_snd=pa_darwin_os
151 AC_MSG_RESULT([Checking sound device backend... coreaudio])
152 ;;
153 *)
154 ac_pjmedia_snd=pa_unix
155 AC_CHECK_HEADER(alsa/version.h,
156 [AC_SUBST(ac_pa_use_alsa,1)
157 LIBS="$LIBS -lasound"
158 ],
159 [AC_SUBST(ac_pa_use_alsa,0)])
160 AC_MSG_RESULT([Checking sound device backend... unix])
161 ;;
162esac
163
164# Include resampling small filter
165AC_SUBST(ac_no_small_filter)
166AC_ARG_ENABLE(small-filter,
167 AC_HELP_STRING([--disable-small-filter],
168 [Exclude small filter in resampling]),
169 [if test "$enable_small_filter" = "no"; then
170 [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
171 AC_MSG_RESULT([Checking if small filter is disabled... yes])
172 fi],
173 AC_MSG_RESULT([Checking if small filter is disabled... no]))
174
175# Include resampling large filter
176AC_SUBST(ac_no_large_filter)
177AC_ARG_ENABLE(large-filter,
178 AC_HELP_STRING([--disable-large-filter],
179 [Exclude large filter in resampling]),
180 [if test "$enable_large_filter" = "no"; then
181 [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
182 AC_MSG_RESULT([Checking if large filter is disabled... yes])
183 fi],
184 AC_MSG_RESULT([Checking if large filter is disabled... no]))
185
186# Include G.711 Annex A PLC
187AC_SUBST(ac_no_g711_plc)
188AC_ARG_ENABLE(g711-plc,
189 AC_HELP_STRING([--disable-g711-plc],
190 [Exclude G.711 Annex A PLC]),
191 [if test "$enable_g711_plc" = "no"; then
192 [ac_no_g711_plc='-DPJMEDIA_HAS_G711_PLC=0']
193 AC_MSG_RESULT([Checking if G.711 Annex A PLC is disabled...yes])
194 fi],
195 AC_MSG_RESULT([Checking if G.711 Annex A PLC is disabled...no]))
196
197# Include Speex AEC
198AC_SUBST(ac_no_speex_aec)
199AC_ARG_ENABLE(speex-aec,
200 AC_HELP_STRING([--disable-speex-aec],
201 [Exclude Speex Acoustic Echo Canceller/AEC]),
202 [if test "$enable_speex_aec" = "no"; then
203 [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
204 AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
205 fi],
206 AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
207
208# Include G711 codec
209AC_SUBST(ac_no_g711_codec)
210AC_ARG_ENABLE(g711-codec,
211 AC_HELP_STRING([--disable-g711-codec],
212 [Exclude G.711 codecs from the build]),
213 [if test "$enable_g711_codec" = "no"; then
214 [ac_no_g711_codec=1]
215 AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
216 fi],
217 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
218
219
220# Include L16 codec
221AC_SUBST(ac_no_l16_codec)
222AC_ARG_ENABLE(l16-codec,
223 AC_HELP_STRING([--disable-l16-codec],
224 [Exclude Linear/L16 codec family from the build]),
225 [if test "$enable_l16_codec" = "no"; then
226 [ac_no_l16_codec=1]
227 AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
228 fi],
229 AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
230
231
232# Include GSM codec
233AC_SUBST(ac_no_gsm_codec)
234AC_ARG_ENABLE(gsm-codec,
235 AC_HELP_STRING([--disable-gsm-codec],
236 [Exclude GSM codec in the build]),
237 [if test "$enable_gsm_codec" = "no"; then
238 [ac_no_gsm_codec=1]
239 AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
240 fi],
241 AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
242
243# Include Speex codec
244AC_SUBST(ac_no_speex_codec)
245AC_ARG_ENABLE(speex-codec,
246 AC_HELP_STRING([--disable-speex-codec],
247 [Exclude Speex codecs in the build]),
248 [if test "$enable_speex_codec" = "no"; then
249 [ac_no_speex_codec=1]
250 AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
251 fi],
252 AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
253
254# Include iLBC codec
255AC_SUBST(ac_no_ilbc_codec)
256AC_ARG_ENABLE(ilbc-codec,
257 AC_HELP_STRING([--disable-ilbc-codec],
258 [Exclude iLBC codec in the build]),
259 [if test "$enable_ilbc_codec" = "no"; then
260 [ac_no_ilbc_codec=1]
261 AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
262 fi],
263 AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
264
265
266
267##########################################
268#
269# MANUAL CONFIG
270#
271
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000272
273# Determine if select() requires nfds to be filled up with
274# correct value (max_fd+1). If zero, nfds will be filled up with
275# PJ_FD_SETSIZE
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000276AC_MSG_CHECKING([if select() needs correct nfds])
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000277case $target in
278 *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000279 AC_MSG_RESULT(yes)
280 ;;
281 *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
282 AC_MSG_RESULT([no (default)])
283 AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
284 ;;
285esac
286
287# Determine if pj_thread_create() should enforce thread stack size when
288# creating thread. Default is zero, to allow OS to allocate appropriate
289# thread's stack size.
290AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
291case $target in
292 *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
293 AC_MSG_RESULT(yes)
294 ;;
295 *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
296 AC_MSG_RESULT([no (default)])
297 ;;
298esac
299
300# Determine if pj_thread_create() should allocate thread's stack from
301# the pool. Default is zero, to let OS allocate thread's stack.
302AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
303case $target in
304 *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
305 AC_MSG_RESULT(yes)
306 ;;
307 *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
308 AC_MSG_RESULT([no (default)])
309 ;;
310esac
311
312# This value specifies the value set in errno by the OS when a non-blocking
313# socket recv() can not return immediate data.
314case $target in
315 *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
316 AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
317 ;;
318esac
319
320# This value specifies the value set in errno by the OS when a non-blocking
321# socket connect() can not get connected immediately.
322case $target in
323 *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
324 AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
325 ;;
326esac
327
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000328
Benny Prijonoc4c61d02006-08-20 20:47:34 +0000329AC_SUBST(target)
330AC_SUBST(ac_cross_compile)
331if test "$build" = "$host"; then
332 ac_cross_compile=
333else
334 ac_cross_compile=${host}-
335fi
336AC_SUBST(ac_linux_poll,select)
337AC_SUBST(ac_host,unix)
338AC_SUBST(ac_main_obj)
339case $target in
340 *rtems*)
341 ac_main_obj=main_rtems.o
342 ;;
343 *)
344 ac_main_obj=main.o
345 ;;
346esac
347AC_SUBST(CC)
Benny Prijonoa9b372a2006-07-24 02:07:11 +0000348AC_OUTPUT()
349