summaryrefslogtreecommitdiff
path: root/aconfigure.ac
blob: a01e4d22929b87f53dceaa0ca4e56a08b17e3fa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
AC_INIT(pjproject,0.5.8)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h
		  pjlib/include/pj/compat/m_auto.h
		 ])
AC_CONFIG_FILES([build.mak 
		 build/os-auto.mak 
	         pjlib/build/os-auto.mak 
	         pjlib-util/build/os-auto.mak 
		 pjmedia/build/os-auto.mak
		 pjsip/build/os-auto.mak
	        ])
AC_PROG_CC
AC_PROG_CXX
AC_LANG_C

AC_CHECK_LIB(pthread,pthread_create)

AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])

# Endianness detection
AC_C_BIGENDIAN([AC_SUBST(ac_bigendian,1)
	        AC_DEFINE(PJ_IS_LITTLE_ENDIAN,0)
	        AC_DEFINE(PJ_IS_BIG_ENDIAN,1)
	       ],
	       [AC_SUBST(ac_bigendian,0)
	        AC_DEFINE(PJ_IS_LITTLE_ENDIAN,1)
	        AC_DEFINE(PJ_IS_BIG_ENDIAN,0)
	       ])

# --disable-floating-point option
AC_ARG_ENABLE(floating-point,
	      AC_HELP_STRING([--disable-floating-point],
			     [Disable floating point where possible]),
	      [if test "$enable_floating_point" = "no"; then
		AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
		AC_MSG_RESULT([Checking if floating point is disabled... yes])
	       fi],
	      [
		AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
	        AC_MSG_RESULT([Checking if floating point is disabled... no]) 
		AC_CHECK_LIB(m,fmod)
	      ])


AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)])
AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])

AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])

AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
AC_DEFINE(PJ_HAS_ERRNO_VAR,1)

AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)

AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
AC_DEFINE(PJ_HAS_MALLOC,1)

AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)

AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)

# Determine if inet_aton() is available
AC_MSG_CHECKING([if inet_aton is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
		    		    #include <netinet/in.h>
		    		    #include <arpa/inet.h>]],
		    		  [inet_aton(0, 0);])],
		  [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
		   AC_MSG_RESULT(yes)],
		  [AC_MSG_RESULT(no)])

# Determine if sockaddr_in has sin_len member
AC_MSG_CHECKING([if sockaddr_in has sin_len member])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
		    		    #include <netinet/in.h>
		    		    #include <arpa/inet.h>]],
		    		  [struct sockaddr_in a; a.sin_len=0;])],
		  [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
		   AC_MSG_RESULT(yes)],
		  AC_MSG_RESULT(no))

# Determine if SO_ERROR is available
AC_MSG_CHECKING([if SO_ERROR is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
		    		    #include <netinet/in.h>
		    		    #include <arpa/inet.h>]],
		    		  [int i=SO_ERROR;])],
		  [AC_DEFINE(PJ_HAS_SO_ERROR,1)
		   AC_MSG_RESULT(yes)],
		  AC_MSG_RESULT(no))

# Determine if RW-mutex is available
AC_MSG_CHECKING([if pthread_rwlock_t is available])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
		    		   [pthread_rwlock_t *x;])],
		  [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
  		   AC_MSG_RESULT(yes)],
		  [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
		   AC_MSG_RESULT(no)])


##########################################
#
# PJMEDIA
#

# Sound device backend selection
AC_SUBST(ac_pjmedia_snd)
case $target in
  *cygwin* | *win* | *mingw*)
	ac_pjmedia_snd=pa_win32
	AC_MSG_RESULT([Checking sound device backend... win32 sound])
	;;
  *rtems*)
	ac_pjmedia_snd=null
	AC_MSG_RESULT([Checking sound device backend... null sound])
	;;
  *darwin*)
	ac_pjmedia_snd=pa_darwin_os
	AC_MSG_RESULT([Checking sound device backend... coreaudio])
	;;
  *)
	ac_pjmedia_snd=pa_unix
	AC_CHECK_HEADER(alsa/version.h,
			[AC_SUBST(ac_pa_use_alsa,1)
			 LIBS="$LIBS -lasound"
			],
		        [AC_SUBST(ac_pa_use_alsa,0)])
	AC_MSG_RESULT([Checking sound device backend... unix])
	;;
esac

# Include resampling small filter
AC_SUBST(ac_no_small_filter)
AC_ARG_ENABLE(small-filter,
	      AC_HELP_STRING([--disable-small-filter],
			     [Exclude small filter in resampling]),
	      [if test "$enable_small_filter" = "no"; then
		[ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
		AC_MSG_RESULT([Checking if small filter is disabled... yes])
	       fi],
	      AC_MSG_RESULT([Checking if small filter is disabled... no]))

# Include resampling large filter
AC_SUBST(ac_no_large_filter)
AC_ARG_ENABLE(large-filter,
	      AC_HELP_STRING([--disable-large-filter],
			     [Exclude large filter in resampling]),
	      [if test "$enable_large_filter" = "no"; then
		[ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
		AC_MSG_RESULT([Checking if large filter is disabled... yes])
	       fi],
	      AC_MSG_RESULT([Checking if large filter is disabled... no]))

# Include G.711 Annex A PLC
AC_SUBST(ac_no_g711_plc)
AC_ARG_ENABLE(g711-plc,
	      AC_HELP_STRING([--disable-g711-plc],
			     [Exclude G.711 Annex A PLC]),
	      [if test "$enable_g711_plc" = "no"; then
		[ac_no_g711_plc='-DPJMEDIA_HAS_G711_PLC=0']
		AC_MSG_RESULT([Checking if G.711 Annex A PLC is disabled...yes])
	       fi],
	      AC_MSG_RESULT([Checking if G.711 Annex A PLC is disabled...no]))

# Include Speex AEC
AC_SUBST(ac_no_speex_aec)
AC_ARG_ENABLE(speex-aec,
	      AC_HELP_STRING([--disable-speex-aec],
			     [Exclude Speex Acoustic Echo Canceller/AEC]),
	      [if test "$enable_speex_aec" = "no"; then
		[ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
		AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
	       fi],
	      AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))

# Include G711 codec
AC_SUBST(ac_no_g711_codec)
AC_ARG_ENABLE(g711-codec,
	      AC_HELP_STRING([--disable-g711-codec],
			     [Exclude G.711 codecs from the build]),
	      [if test "$enable_g711_codec" = "no"; then
		[ac_no_g711_codec=1]
		AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
	       fi],
	      AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))


# Include L16 codec
AC_SUBST(ac_no_l16_codec)
AC_ARG_ENABLE(l16-codec,
	      AC_HELP_STRING([--disable-l16-codec],
			     [Exclude Linear/L16 codec family from the build]),
	      [if test "$enable_l16_codec" = "no"; then
		[ac_no_l16_codec=1]
		AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
	       fi],
	      AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))


# Include GSM codec
AC_SUBST(ac_no_gsm_codec)
AC_ARG_ENABLE(gsm-codec,
	      AC_HELP_STRING([--disable-gsm-codec],
			     [Exclude GSM codec in the build]),
	      [if test "$enable_gsm_codec" = "no"; then
		[ac_no_gsm_codec=1]
		AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
	       fi],
	      AC_MSG_RESULT([Checking if GSM codec is disabled...no]))

# Include Speex codec
AC_SUBST(ac_no_speex_codec)
AC_ARG_ENABLE(speex-codec,
	      AC_HELP_STRING([--disable-speex-codec],
			     [Exclude Speex codecs in the build]),
	      [if test "$enable_speex_codec" = "no"; then
		[ac_no_speex_codec=1]
		AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
	       fi],
	      AC_MSG_RESULT([Checking if Speex codec is disabled...no]))

# Include iLBC codec
AC_SUBST(ac_no_ilbc_codec)
AC_ARG_ENABLE(ilbc-codec,
	      AC_HELP_STRING([--disable-ilbc-codec],
			     [Exclude iLBC codec in the build]),
	      [if test "$enable_ilbc_codec" = "no"; then
		[ac_no_ilbc_codec=1]
		AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
	       fi],
	      AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))



##########################################
#
# MANUAL CONFIG
#


# Determine if select() requires nfds to be filled up with
# correct value (max_fd+1). If zero, nfds will be filled up with
# PJ_FD_SETSIZE
AC_MSG_CHECKING([if select() needs correct nfds])
case $target in
  *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
	   AC_MSG_RESULT(yes)
	;;
  *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
     AC_MSG_RESULT([no (default)])
     AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
	;;
esac

# Determine if pj_thread_create() should enforce thread stack size when
# creating thread. Default is zero, to allow OS to allocate appropriate
# thread's stack size.
AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
case $target in
  *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
	   AC_MSG_RESULT(yes)
	;;
  *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
     AC_MSG_RESULT([no (default)])
	;;
esac

# Determine if pj_thread_create() should allocate thread's stack from
# the pool. Default is zero, to let OS allocate thread's stack.
AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
case $target in
  *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
	   AC_MSG_RESULT(yes)
	;;
  *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
     AC_MSG_RESULT([no (default)])
	;;
esac

# This value specifies the value set in errno by the OS when a non-blocking
# socket recv() can not return immediate data.
case $target in
  *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
     AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
	;;
esac

# This value specifies the value set in errno by the OS when a non-blocking
# socket connect() can not get connected immediately.
case $target in
  *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
     AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
	;;
esac


AC_SUBST(target)
AC_SUBST(ac_cross_compile)
if test "$build" = "$host"; then
    ac_cross_compile=
else
    ac_cross_compile=${host}-
fi
AC_SUBST(ac_linux_poll,select)
AC_SUBST(ac_host,unix)
AC_SUBST(ac_main_obj)
case $target in
  *rtems*)
	ac_main_obj=main_rtems.o
	;;
  *)
	ac_main_obj=main.o
	;;
esac
AC_SUBST(CC)
AC_OUTPUT()