~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.1.0/aconfigure.ac

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AC_INIT(pjproject,2.x)
 
2
 
 
3
host_orig="$host"
 
4
 
 
5
AC_CANONICAL_BUILD
 
6
AC_CANONICAL_HOST
 
7
AC_CANONICAL_TARGET
 
8
AC_CONFIG_HEADER([pjlib/include/pj/compat/os_auto.h
 
9
                  pjlib/include/pj/compat/m_auto.h
 
10
                  pjmedia/include/pjmedia/config_auto.h
 
11
                  pjmedia/include/pjmedia-codec/config_auto.h
 
12
                  pjsip/include/pjsip/sip_autoconf.h
 
13
                 ])
 
14
AC_CONFIG_FILES([build.mak 
 
15
                 build/os-auto.mak 
 
16
                 build/cc-auto.mak
 
17
                 pjlib/build/os-auto.mak 
 
18
                 pjlib-util/build/os-auto.mak 
 
19
                 pjmedia/build/os-auto.mak
 
20
                 pjsip/build/os-auto.mak
 
21
                 third_party/build/os-auto.mak
 
22
                 third_party/build/portaudio/os-auto.mak 
 
23
                 ])
 
24
 
 
25
 
 
26
dnl
 
27
dnl Setup default CFLAGS
 
28
dnl
 
29
if test "$CFLAGS" = ""; then
 
30
  CFLAGS="-O2"
 
31
else
 
32
  CFLAGS="$CFLAGS"
 
33
fi
 
34
 
 
35
CXXFLAGS="$CFLAGS $CXXFLAGS"
 
36
 
 
37
dnl #
 
38
dnl # Configure tools
 
39
dnl #
 
40
AC_PROG_CC
 
41
AC_PROG_CXX
 
42
AC_LANG_C
 
43
 
 
44
dnl #
 
45
dnl # Setup CROSS_COMPILE variable
 
46
dnl #
 
47
if test -z "$CROSS_COMPILE"; then 
 
48
    CROSS_COMPILE=`echo ${CC} | sed 's/gcc//'`
 
49
fi
 
50
 
 
51
if test "$AR" = ""; then AR="${CROSS_COMPILE}ar rv"; fi
 
52
AC_SUBST(AR)
 
53
if test "$LD" = ""; then LD="$CC"; fi
 
54
AC_SUBST(LD)
 
55
if test "$LDOUT" = ""; then LDOUT="-o "; fi
 
56
AC_SUBST(LDOUT)
 
57
if test "$RANLIB" = ""; then RANLIB="${CROSS_COMPILE}ranlib"; fi
 
58
AC_SUBST(RANLIB)
 
59
if test "$OBJEXT" = ""; then OBJEXT='o'; fi
 
60
AC_SUBST(OBJEXT)
 
61
if test "$LIBEXT" = ""; then LIBEXT='a'; fi
 
62
AC_SUBST(LIBEXT)
 
63
if test "$LIBEXT2" = ""; then LIBEXT2=""; fi
 
64
AC_SUBST(LIBEXT2)
 
65
if test "$CC_OUT" = ""; then CC_OUT="-o "; fi
 
66
AC_SUBST(CC_OUT)
 
67
if test "$CC_INC" = ""; then CC_INC="-I"; fi
 
68
AC_SUBST(CC_INC)
 
69
if test "$CC_DEF" = ""; then CC_DEF="-D"; fi
 
70
AC_SUBST(CC_DEF)
 
71
if test "$CC_OPTIMIZE" = ""; then CC_OPTIMIZE="-O2"; fi
 
72
AC_SUBST(CC_OPTIMIZE)
 
73
if test "$CC_CFLAGS" = ""; then CC_CFLAGS="-Wall"; fi
 
74
AC_SUBST(CC_CFLAGS)
 
75
 
 
76
 
 
77
 
 
78
AC_SUBST(ac_pjdir)
 
79
AC_SUBST(ac_build_mak_vars)
 
80
 
 
81
case $host in 
 
82
    *mingw* | *cygw* | *win32* | *w32* )
 
83
        if pwd -W 2&> /dev/null; then
 
84
           ac_pjdir=`pwd -W`
 
85
        else
 
86
           # We're probably cross-compiling mingw on Linux
 
87
           ac_pjdir=`pwd`
 
88
        fi
 
89
        ;;
 
90
    *)
 
91
        ac_pjdir=`pwd`
 
92
        ;;
 
93
esac
 
94
 
 
95
AC_SUBST(ac_shlib_suffix)
 
96
case $target in
 
97
    *mingw* | *cygw* | *win32* | *w32* )
 
98
        ac_shlib_suffix=dll
 
99
        ;;
 
100
    *darwin*)
 
101
        ac_shlib_suffix=dylib
 
102
        ;;
 
103
    *)
 
104
        ac_shlib_suffix=so
 
105
        ;;
 
106
esac
 
107
 
 
108
AC_SUBST(ac_cross_compile)
 
109
if test "$build" = "$host"; then
 
110
    ac_cross_compile=
 
111
else
 
112
    ac_cross_compile=${host_orig}-
 
113
fi
 
114
 
 
115
AC_CHECK_LIB(pthread,pthread_create)
 
116
AC_CHECK_LIB(wsock32,puts)
 
117
AC_CHECK_LIB(ws2_32,puts)
 
118
AC_CHECK_LIB(ole32,puts)
 
119
AC_CHECK_LIB(winmm,puts)
 
120
AC_CHECK_LIB(socket,puts)
 
121
AC_CHECK_LIB(rt,puts)
 
122
AC_CHECK_LIB(nsl,puts)
 
123
AC_CHECK_LIB(uuid,uuid_generate)
 
124
AC_CHECK_LIB(uuid,uuid_generate,[ac_has_uuid_lib=1])
 
125
 
 
126
AC_MSG_RESULT([Setting PJ_M_NAME to $target_cpu])
 
127
AC_DEFINE_UNQUOTED(PJ_M_NAME,["$target_cpu"])
 
128
 
 
129
dnl
 
130
dnl Memory alignment detection
 
131
dnl
 
132
AC_MSG_CHECKING([memory alignment])
 
133
case $target in
 
134
    sparc64-* | ia64-* | x86_64-* )
 
135
        AC_DEFINE(PJ_POOL_ALIGNMENT, 8)
 
136
        AC_MSG_RESULT([8 bytes])
 
137
        ;;
 
138
    * )
 
139
        AC_DEFINE(PJ_POOL_ALIGNMENT, 4)
 
140
        AC_MSG_RESULT([4 bytes (default)])
 
141
        ;;
 
142
esac
 
143
 
 
144
 
 
145
dnl
 
146
dnl Endianness detection
 
147
dnl
 
148
AC_C_BIGENDIAN
 
149
 
 
150
if test "x$ac_cv_c_bigendian" = "xyes"; then
 
151
  CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0"
 
152
else
 
153
  CFLAGS="$CFLAGS -DPJ_IS_BIG_ENDIAN=0 -DPJ_IS_LITTLE_ENDIAN=1"
 
154
fi
 
155
 
 
156
dnl
 
157
dnl Legacy macros
 
158
dnl
 
159
case $target in
 
160
    *mingw* | *cygw* | *win32* | *w32* )
 
161
        AC_DEFINE(PJ_WIN32,1)
 
162
        AC_DEFINE(PJ_WIN32_WINNT,0x0400)
 
163
        AC_DEFINE(WIN32_LEAN_AND_MEAN)
 
164
        ;;
 
165
    *darwin*)
 
166
        AC_DEFINE(PJ_DARWINOS,1)
 
167
        ;;
 
168
    *linux*)
 
169
        AC_DEFINE(PJ_LINUX,1)
 
170
        ;;
 
171
    *rtems*)
 
172
        AC_DEFINE(PJ_RTEMS,1)
 
173
        ;;
 
174
    *sunos* | *solaris* )
 
175
        AC_DEFINE(PJ_SUNOS,1)
 
176
        ;;
 
177
    *)
 
178
        ;;
 
179
esac
 
180
 
 
181
 
 
182
 
 
183
 
 
184
dnl # --disable-floating-point option
 
185
AC_ARG_ENABLE(floating-point,
 
186
              AC_HELP_STRING([--disable-floating-point],
 
187
                             [Disable floating point where possible]),
 
188
              [if test "$enable_floating_point" = "no"; then
 
189
                AC_DEFINE(PJ_HAS_FLOATING_POINT,0)
 
190
                AC_MSG_RESULT([Checking if floating point is disabled... yes])
 
191
               fi],
 
192
              [
 
193
                AC_DEFINE(PJ_HAS_FLOATING_POINT,1)
 
194
                AC_MSG_RESULT([Checking if floating point is disabled... no]) 
 
195
                AC_CHECK_LIB(m,fmod)
 
196
              ])
 
197
 
 
198
 
 
199
AC_CHECK_HEADER(arpa/inet.h,[AC_DEFINE(PJ_HAS_ARPA_INET_H,1)])
 
200
AC_CHECK_HEADER(assert.h,[AC_DEFINE(PJ_HAS_ASSERT_H,1)])
 
201
AC_CHECK_HEADER(ctype.h,[AC_DEFINE(PJ_HAS_CTYPE_H,1)])
 
202
 
 
203
case $target in
 
204
    *mingw* | *cygw* | *win32* | *w32* )
 
205
        AC_DEFINE(PJ_HAS_ERRNO_H,0)
 
206
        ;;
 
207
    *)
 
208
        AC_CHECK_HEADER(errno.h,[AC_DEFINE(PJ_HAS_ERRNO_H,1)])
 
209
        ;;
 
210
esac
 
211
 
 
212
AC_CHECK_HEADER(fcntl.h,[AC_DEFINE(PJ_HAS_FCNTL_H,1)])
 
213
AC_CHECK_HEADER(linux/socket.h,[AC_DEFINE(PJ_HAS_LINUX_SOCKET_H,1)])
 
214
AC_CHECK_HEADER(limits.h,[AC_DEFINE(PJ_HAS_LIMITS_H,1)])
 
215
AC_CHECK_HEADER(malloc.h,[AC_DEFINE(PJ_HAS_MALLOC_H,1)])
 
216
AC_CHECK_HEADER(netdb.h,[AC_DEFINE(PJ_HAS_NETDB_H,1)])
 
217
AC_CHECK_HEADER(netinet/in_systm.h,[AC_DEFINE(PJ_HAS_NETINET_IN_SYSTM_H,1)])
 
218
AC_CHECK_HEADER(netinet/in.h,[AC_DEFINE(PJ_HAS_NETINET_IN_H,1)])
 
219
AC_CHECK_HEADER(netinet/ip.h,[AC_DEFINE(PJ_HAS_NETINET_IP_H,1)],[],
 
220
                 [#if PJ_HAS_SYS_TYPES_H
 
221
                  #     include <sys/types.h>
 
222
                  #endif
 
223
                  #if PJ_HAS_NETINET_IN_SYSTM_H
 
224
                  #     include <netinet/in_systm.h>
 
225
                  #endif
 
226
                  #if PJ_HAS_NETINET_IN_H
 
227
                  #     include <netinet/in.h>
 
228
                  #endif
 
229
                 ])
 
230
AC_CHECK_HEADER(netinet/tcp.h,[AC_DEFINE(PJ_HAS_NETINET_TCP_H,1)])
 
231
AC_CHECK_HEADER(ifaddrs.h,
 
232
                [AC_CHECK_FUNC(getifaddrs,[AC_DEFINE(PJ_HAS_IFADDRS_H,1)])])
 
233
AC_CHECK_HEADER(semaphore.h,[AC_DEFINE(PJ_HAS_SEMAPHORE_H,1)])
 
234
AC_CHECK_HEADER(setjmp.h,[AC_DEFINE(PJ_HAS_SETJMP_H,1)])
 
235
AC_CHECK_HEADER(stdarg.h,[AC_DEFINE(PJ_HAS_STDARG_H,1)])
 
236
AC_CHECK_HEADER(stddef.h,[AC_DEFINE(PJ_HAS_STDDEF_H,1)])
 
237
AC_CHECK_HEADER(stdio.h,[AC_DEFINE(PJ_HAS_STDIO_H,1)])
 
238
AC_CHECK_HEADER(stdint.h,[AC_DEFINE(PJ_HAS_STDINT_H,1)])
 
239
AC_CHECK_HEADER(stdlib.h,[AC_DEFINE(PJ_HAS_STDLIB_H,1)])
 
240
AC_CHECK_HEADER(string.h,[AC_DEFINE(PJ_HAS_STRING_H,1)])
 
241
AC_CHECK_HEADER(sys/ioctl.h,[AC_DEFINE(PJ_HAS_SYS_IOCTL_H,1)])
 
242
AC_CHECK_HEADER(sys/select.h,[AC_DEFINE(PJ_HAS_SYS_SELECT_H,1)])
 
243
AC_CHECK_HEADER(sys/socket.h,[AC_DEFINE(PJ_HAS_SYS_SOCKET_H,1)])
 
244
AC_CHECK_HEADER(sys/time.h,[AC_DEFINE(PJ_HAS_SYS_TIME_H,1)])
 
245
AC_CHECK_HEADER(sys/timeb.h,[AC_DEFINE(PJ_HAS_SYS_TIMEB_H,1)])
 
246
AC_CHECK_HEADER(sys/types.h,[AC_DEFINE(PJ_HAS_SYS_TYPES_H,1)])
 
247
AC_CHECK_HEADER(sys/filio.h,[AC_DEFINE(PJ_HAS_SYS_FILIO_H,1)])
 
248
AC_CHECK_HEADER(sys/sockio.h,[AC_DEFINE(PJ_HAS_SYS_SOCKIO_H,1)])
 
249
AC_CHECK_HEADER(sys/utsname.h,[AC_DEFINE(PJ_HAS_SYS_UTSNAME_H,1)])
 
250
AC_CHECK_HEADER(time.h,[AC_DEFINE(PJ_HAS_TIME_H,1)])
 
251
AC_CHECK_HEADER(unistd.h,[AC_DEFINE(PJ_HAS_UNISTD_H,1)])
 
252
AC_CHECK_HEADER(winsock.h,[AC_DEFINE(PJ_HAS_WINSOCK_H,1)])
 
253
AC_CHECK_HEADER(winsock2.h,[AC_DEFINE(PJ_HAS_WINSOCK2_H,1)])
 
254
AC_CHECK_HEADER(mswsock.h,[AC_DEFINE(PJ_HAS_MSWSOCK_H,1)],[],
 
255
                 [#if PJ_HAS_WINSOCK2_H
 
256
                  #     include <winsock2.h>
 
257
                  #elif PJ_HAS_WINSOCK_H
 
258
                  #     include <winsock.h>
 
259
                  #endif
 
260
                 ])
 
261
AC_CHECK_HEADER(ws2tcpip.h,[AC_DEFINE(PJ_HAS_WS2TCPIP_H,1)])
 
262
AC_CHECK_HEADER(uuid/uuid.h,[ac_has_uuid_h=1])
 
263
AC_CHECK_HEADER(net/if.h,[AC_DEFINE(PJ_HAS_NET_IF_H,1)],[],
 
264
                 [#if PJ_HAS_SYS_TYPES_H
 
265
                  #     include <sys/types.h>
 
266
                  #endif
 
267
                  #if PJ_HAS_SYS_SOCKET_H
 
268
 
 
269
                  #     include <sys/socket.h>
 
270
                  #endif
 
271
                 ])
 
272
AC_MSG_RESULT([Setting PJ_OS_NAME to $target])
 
273
AC_DEFINE_UNQUOTED(PJ_OS_NAME,["$target"])
 
274
 
 
275
AC_MSG_RESULT([Setting PJ_HAS_ERRNO_VAR to 1])
 
276
AC_DEFINE(PJ_HAS_ERRNO_VAR,1)
 
277
 
 
278
AC_MSG_RESULT([Setting PJ_HAS_HIGH_RES_TIMER to 1])
 
279
AC_DEFINE(PJ_HAS_HIGH_RES_TIMER,1)
 
280
 
 
281
AC_MSG_RESULT([Setting PJ_HAS_MALLOC to 1])
 
282
AC_DEFINE(PJ_HAS_MALLOC,1)
 
283
 
 
284
AC_MSG_RESULT([Setting PJ_NATIVE_STRING_IS_UNICODE to 0])
 
285
AC_DEFINE(PJ_NATIVE_STRING_IS_UNICODE,0)
 
286
 
 
287
AC_MSG_RESULT([Setting PJ_ATOMIC_VALUE_TYPE to long])
 
288
AC_DEFINE(PJ_ATOMIC_VALUE_TYPE,long)
 
289
 
 
290
dnl # Determine if inet_aton() is available
 
291
AC_MSG_CHECKING([if inet_aton() is available])
 
292
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 
293
                                     #include <sys/socket.h>
 
294
                                     #include <arpa/inet.h>]],
 
295
                                  [inet_aton(0, 0);])],
 
296
                  [AC_DEFINE(PJ_SOCK_HAS_INET_ATON,1)
 
297
                   AC_MSG_RESULT(yes)],
 
298
                  [AC_MSG_RESULT(no)])
 
299
 
 
300
dnl # Determine if inet_pton() is available
 
301
AC_MSG_CHECKING([if inet_pton() is available])
 
302
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 
303
                                     #include <sys/socket.h>
 
304
                                     #include <arpa/inet.h>]],
 
305
                                  [inet_pton(0, 0, 0);])],
 
306
                  [AC_DEFINE(PJ_SOCK_HAS_INET_PTON,1)
 
307
                   AC_MSG_RESULT(yes)],
 
308
                  [AC_MSG_RESULT(no)])
 
309
 
 
310
dnl # Determine if inet_ntop() is available
 
311
AC_MSG_CHECKING([if inet_ntop() is available])
 
312
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 
313
                                     #include <sys/socket.h>
 
314
                                     #include <arpa/inet.h>]],
 
315
                                  [inet_ntop(0, 0, 0, 0);])],
 
316
                  [AC_DEFINE(PJ_SOCK_HAS_INET_NTOP,1)
 
317
                   AC_MSG_RESULT(yes)],
 
318
                  [AC_MSG_RESULT(no)])
 
319
 
 
320
dnl # Determine if getaddrinfo() is available
 
321
AC_MSG_CHECKING([if getaddrinfo() is available])
 
322
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 
323
                                     #include <sys/socket.h>
 
324
                                     #include <netdb.h>]],
 
325
                                  [getaddrinfo(0, 0, 0, 0);])],
 
326
                  [AC_DEFINE(PJ_SOCK_HAS_GETADDRINFO,1)
 
327
                   AC_MSG_RESULT(yes)],
 
328
                  [AC_MSG_RESULT(no)])
 
329
 
 
330
dnl # Determine if sockaddr_in has sin_len member
 
331
AC_MSG_CHECKING([if sockaddr_in has sin_len member])
 
332
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 
333
                                     #include <sys/socket.h>
 
334
                                     #include <netinet/in.h>
 
335
                                     #include <arpa/inet.h>]],
 
336
                                  [struct sockaddr_in a; a.sin_len=0;])],
 
337
                  [AC_DEFINE(PJ_SOCKADDR_HAS_LEN,1)
 
338
                   AC_MSG_RESULT(yes)],
 
339
                  AC_MSG_RESULT(no))
 
340
 
 
341
dnl # Determine if socklen_t is available
 
342
AC_MSG_CHECKING([if socklen_t is available])
 
343
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 
344
                                     #include <sys/socket.h>]],
 
345
                                   [socklen_t xxx = 0;])],
 
346
                  [AC_DEFINE(PJ_HAS_SOCKLEN_T,1)
 
347
                   AC_MSG_RESULT(yes)],
 
348
                  AC_MSG_RESULT(no))
 
349
 
 
350
dnl # Determine if SO_ERROR is available
 
351
AC_MSG_CHECKING([if SO_ERROR is available])
 
352
case $target in
 
353
    *mingw* | *cygw* | *win32* | *w32* )
 
354
        AC_DEFINE(PJ_HAS_SO_ERROR,1)
 
355
        AC_MSG_RESULT(yes)
 
356
        ;;
 
357
    *)
 
358
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
 
359
                                             #include <sys/socket.h>
 
360
                                             #include <netinet/in.h>
 
361
                                             #include <arpa/inet.h>]],
 
362
                                          [int i=SO_ERROR;])],
 
363
                          [AC_DEFINE(PJ_HAS_SO_ERROR,1)
 
364
                           AC_MSG_RESULT(yes)],
 
365
                          AC_MSG_RESULT(no))
 
366
        ;;
 
367
esac
 
368
 
 
369
 
 
370
dnl # Determine if RW-mutex is available
 
371
AC_MSG_CHECKING([if pthread_rwlock_t is available])
 
372
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
 
373
                                   [pthread_rwlock_t *x;])],
 
374
                  [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
 
375
                   ac_rwmutex="yes"
 
376
                   AC_MSG_RESULT(yes)],
 
377
                  [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
 
378
                   ac_rwmutex="no"
 
379
                   AC_MSG_RESULT(no)])
 
380
 
 
381
dnl # If rwmutex is not detected, check again but this time
 
382
dnl # with _POSIX_READER_WRITER_LOCKS defined (newlib needs this)
 
383
if test "$ac_rwmutex" = "no"; then
 
384
    AC_MSG_CHECKING([if pthread_rwlock_t is available with _POSIX_READER_WRITER_LOCKS])
 
385
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_READER_WRITER_LOCKS
 
386
                                         #include <pthread.h>]],
 
387
                                       [pthread_rwlock_t *x;])],
 
388
                      [AC_DEFINE(PJ_EMULATE_RWMUTEX,0)
 
389
                       CFLAGS="$CFLAGS -D_POSIX_THREADS -D_POSIX_READER_WRITER_LOCKS"
 
390
                       AC_MSG_RESULT(yes)],
 
391
                      [AC_DEFINE(PJ_EMULATE_RWMUTEX,1)
 
392
                       AC_MSG_RESULT(no)])
 
393
fi
 
394
 
 
395
dnl # Do we have pthread_mutexattr_settype()?
 
396
AC_MSG_CHECKING([if pthread_mutexattr_settype() is available])
 
397
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
 
398
                                   [pthread_mutexattr_settype(0,PTHREAD_MUTEX_FAST_NP);])],
 
399
                  [AC_DEFINE(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE,1)
 
400
                   AC_MSG_RESULT(yes)],
 
401
                  [AC_MSG_RESULT(no)])
 
402
 
 
403
dnl # Does pthread_mutexattr_t has "recursive" member?
 
404
AC_MSG_CHECKING([if pthread_mutexattr_t has recursive member])
 
405
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
 
406
                                   [[pthread_mutexattr_t attr;
 
407
                                     attr.recursive=1;]])],
 
408
                  [AC_DEFINE(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE,1)
 
409
                   AC_MSG_RESULT(yes)],
 
410
                  [AC_MSG_RESULT(no)])
 
411
 
 
412
dnl ######################
 
413
dnl # ioqueue selection
 
414
dnl # 
 
415
AC_SUBST(ac_os_objs)
 
416
AC_MSG_CHECKING([ioqueue backend])
 
417
AC_ARG_ENABLE(epoll,
 
418
              AC_HELP_STRING([--enable-epoll],
 
419
                             [Use /dev/epoll ioqueue on Linux (experimental)]),
 
420
              [
 
421
                ac_os_objs=ioqueue_epoll.o
 
422
                AC_MSG_RESULT([/dev/epoll])
 
423
              ],
 
424
              [
 
425
                ac_os_objs=ioqueue_select.o
 
426
                AC_MSG_RESULT([select()]) 
 
427
              ])
 
428
 
 
429
 
 
430
dnl ######################
 
431
dnl # OS specific files
 
432
dnl #
 
433
case $target in
 
434
  *mingw* | *cygw* | *win32* | *w32* )
 
435
        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"
 
436
        ;;
 
437
  *)
 
438
        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"
 
439
        case $target in
 
440
          arm-apple-darwin*)
 
441
                ac_os_objs="$ac_os_objs os_info_iphone.o"
 
442
                ;;
 
443
        esac
 
444
        # UUID
 
445
        if test "$ac_has_uuid_lib" = "1" -a "$ac_has_uuid_h" = "1"; then
 
446
                ac_os_objs="$ac_os_objs guid_uuid.o"
 
447
        else
 
448
                ac_os_objs="$ac_os_objs guid_simple.o"
 
449
        fi
 
450
        ;;
 
451
esac
 
452
 
 
453
case $target in
 
454
  *darwin*)
 
455
        ac_os_objs="$ac_os_objs os_core_darwin.o"
 
456
        ;;
 
457
esac
 
458
 
 
459
dnl ##########################################
 
460
dnl #
 
461
dnl # PJMEDIA
 
462
dnl #
 
463
 
 
464
dnl # Use external Speex installation
 
465
AC_SUBST(ac_external_speex,0)
 
466
AC_ARG_WITH(external-speex,
 
467
    AC_HELP_STRING([--with-external-speex],
 
468
                   [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)]),
 
469
    [
 
470
        if test "x$with_external_speex" != "xno"; then
 
471
                # Test Speex installation
 
472
                AC_MSG_CHECKING([if external Speex devkit is installed])
 
473
                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <speex/speex.h>
 
474
                                                     #include <speex/speex_echo.h>
 
475
                                                     ]],
 
476
                                                  [speex_echo_state_init(0, 0); speex_encoder_init(0); ])],
 
477
                                  [AC_MSG_RESULT(yes!!)
 
478
                                   AC_DEFINE(PJMEDIA_EXTERNAL_SPEEX_CODEC, 1)
 
479
                                   ac_external_speex="1"
 
480
                                   ],
 
481
                                  [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])])
 
482
        fi
 
483
    ]
 
484
    )
 
485
 
 
486
dnl # Use external GSM codec library installation
 
487
AC_SUBST(ac_external_gsm,0)
 
488
AC_ARG_WITH(external-gsm,
 
489
    AC_HELP_STRING([--with-external-gsm],
 
490
                   [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)]),
 
491
    [
 
492
        if test "x$with_external_gsm" != "xno"; then
 
493
                # Test GSM library installation
 
494
                AC_MSG_CHECKING([if external GSM devkit is installed as gsm/gsm.h])
 
495
                AC_COMPILE_IFELSE(
 
496
                    [AC_LANG_PROGRAM([[#include <gsm/gsm.h> ]], [gsm_create(); ]) ],
 
497
                    [AC_MSG_RESULT(yes!!)
 
498
                     AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
 
499
                     AC_DEFINE(PJMEDIA_EXTERNAL_GSM_GSM_H, 1)
 
500
                     ac_external_gsm="1"
 
501
                    ],
 
502
                    [
 
503
                     AC_MSG_RESULT(no)
 
504
                     AC_MSG_CHECKING([if external GSM devkit is installed as gsm.h])
 
505
                     AC_COMPILE_IFELSE(
 
506
                        [AC_LANG_PROGRAM([[#include <gsm.h> ]], [gsm_create(); ]) ],
 
507
                        [AC_MSG_RESULT(yes!!)
 
508
                         AC_DEFINE(PJMEDIA_EXTERNAL_GSM_CODEC, 1)
 
509
                         AC_DEFINE(PJMEDIA_EXTERNAL_GSM_H, 1)
 
510
                         ac_external_gsm="1"
 
511
                        ],
 
512
                        [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])
 
513
                        ]
 
514
                     )
 
515
                    ]
 
516
                )
 
517
        fi
 
518
    ]
 
519
    )
 
520
 
 
521
 
 
522
 
 
523
dnl # Sound device backend selection
 
524
AC_SUBST(ac_pjmedia_snd)
 
525
AC_ARG_ENABLE(sound,
 
526
              AC_HELP_STRING([--disable-sound],
 
527
                             [Exclude sound (i.e. use null sound)]),
 
528
              [if test "$enable_sound" = "no"; then
 
529
                [ac_pjmedia_snd=null]
 
530
                AC_MSG_RESULT([Checking if sound is disabled... yes])
 
531
               fi]
 
532
              )
 
533
 
 
534
dnl # Use external PortAudio installation
 
535
AC_SUBST(ac_external_pa,0)
 
536
AC_ARG_WITH(external-pa,
 
537
    AC_HELP_STRING([--with-external-pa],
 
538
                   [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)]),
 
539
    [
 
540
        if test "x$with_external_pa" != "xno"; then
 
541
                # Test PortAudio installation
 
542
                AC_MSG_CHECKING([if external PortAudio devkit is installed])
 
543
                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <portaudio.h>
 
544
                                                     ]],
 
545
                                                  [Pa_Initialize();])],
 
546
                                  [AC_MSG_RESULT(yes!!)
 
547
                                   ac_external_pa="1"
 
548
                                   ],
 
549
                                  [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])])
 
550
        fi
 
551
    ]
 
552
    )
 
553
 
 
554
AC_SUBST(ac_pa_cflags)
 
555
AC_CHECK_HEADER(sys/soundcard.h,
 
556
                [ac_pa_cflags="$ac_pa_cflags -DHAVE_SYS_SOUNDCARD_H"])
 
557
AC_CHECK_HEADER(linux/soundcard.h,
 
558
                [ac_pa_cflags="$ac_pa_cflags -DHAVE_LINUX_SOUNDCARD_H"])
 
559
AC_CHECK_HEADER(machine/soundcard.h,
 
560
                [ac_pa_cflags="$ac_pa_cflags -DHAVE_MACHINE_SOUNDCARD_H"])
 
561
 
 
562
if test "x$ac_cv_c_bigendian" = "xyes"; then
 
563
  ac_pa_cflags="$ac_pa_cflags -DPA_BIG_ENDIAN"
 
564
else
 
565
  ac_pa_cflags="$ac_pa_cflags -DPA_LITTLE_ENDIAN"
 
566
fi
 
567
 
 
568
if test "$enable_sound" = "no"; then
 
569
  true;
 
570
else
 
571
 case $target in
 
572
  arm-apple-darwin*)
 
573
        LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework AudioToolbox -framework CFNetwork -framework UIKit"
 
574
        AC_MSG_RESULT([Checking sound device backend... AudioUnit])
 
575
        ;;
 
576
  *darwin*)
 
577
        LIBS="$LIBS -framework CoreAudio -framework CoreServices -framework AudioUnit -framework AudioToolbox"
 
578
        if test "`uname -r`" = "6.8"; then
 
579
                #ac_pa_cflags="$ac_pa_cflags -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS"
 
580
                #AC_MSG_RESULT([Setting additional PortAudio CFLAGS.. -DPA_OLD_CORE_AUDIO -DMOSX_USE_NON_ATOMIC_FLAG_BITS])
 
581
                ac_pjmedia_snd=pa_old_darwinos
 
582
                AC_MSG_RESULT([Checking sound device backend... old coreaudio])
 
583
        else
 
584
                ac_pjmedia_snd=pa_darwinos
 
585
                AC_MSG_RESULT([Checking sound device backend... coreaudio])
 
586
        fi
 
587
        ;;
 
588
  *cygwin* | *mingw*)
 
589
        ac_pjmedia_snd=pa_win32
 
590
        AC_MSG_RESULT([Checking sound device backend... win32 sound])
 
591
        ;;
 
592
  *rtems*)
 
593
        ac_pjmedia_snd=null
 
594
        AC_MSG_RESULT([Checking sound device backend... null sound])
 
595
        ;;
 
596
  *)
 
597
        dnl # Check if ALSA is available
 
598
        ac_pjmedia_snd=pa_unix
 
599
        AC_CHECK_HEADER(alsa/version.h,
 
600
                        [AC_SUBST(ac_pa_use_alsa,1)
 
601
                         LIBS="$LIBS -lasound"
 
602
                        ],
 
603
                        [AC_SUBST(ac_pa_use_alsa,0)])
 
604
        AC_MSG_RESULT([Checking sound device backend... unix])
 
605
 
 
606
        dnl # Check if OSS is disabled
 
607
        AC_SUBST(ac_pa_use_oss,1)
 
608
        AC_ARG_ENABLE(oss,
 
609
                      AC_HELP_STRING([--disable-oss],
 
610
                                     [Disable OSS audio (default: not disabled)]),
 
611
                      [
 
612
                        if test "$enable_oss" = "no"; then
 
613
                         [ac_pa_use_oss=0]
 
614
                         AC_MSG_RESULT([Checking if OSS audio is disabled... yes])
 
615
                        fi
 
616
                      ])
 
617
        ;;
 
618
 esac
 
619
fi
 
620
 
 
621
AC_SUBST(ac_pjmedia_video)
 
622
 
 
623
dnl # --disable-video option
 
624
AC_ARG_ENABLE(video,
 
625
              AC_HELP_STRING([--disable-video],
 
626
                             [Disable video feature]),
 
627
              [if test "$enable_video" = "no"; then
 
628
                #AC_DEFINE(PJMEDIA_HAS_VIDEO,0)
 
629
                AC_MSG_RESULT([Video is disabled]) 
 
630
                enable_sdl="no"
 
631
                enable_ffmpeg="no"
 
632
                enable_v4l2="no"
 
633
               fi],
 
634
              [])
 
635
 
 
636
case $target in
 
637
 arm-apple-darwin*)
 
638
        LIBS="$LIBS -framework UIKit"
 
639
        ;;
 
640
 *darwin*)
 
641
        LIBS="$LIBS -framework Foundation -framework AppKit"
 
642
        ;;
 
643
esac
 
644
 
 
645
if test "$enable_video" = "no"; then
 
646
  true;
 
647
else
 
648
 case $target in
 
649
  arm-apple-darwin*)
 
650
        ac_pjmedia_video=iphone_os
 
651
        AC_SUBST(ac_pjmedia_video_has_ios)
 
652
        AC_SUBST(ac_ios_cflags)
 
653
        SAVED_LIBS="$LIBS"
 
654
        LIBS="-framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
 
655
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_ios=yes],[ac_pjmedia_video_has_ios=no])
 
656
        LIBS="$SAVED_LIBS"
 
657
        if test "$ac_pjmedia_video_has_ios" = "yes"; then
 
658
          ac_ios_cflags="-DPJMEDIA_VIDEO_DEV_HAS_IOS=1"
 
659
          LIBS="$LIBS -framework AVFoundation -framework CoreGraphics -framework QuartzCore -framework CoreVideo -framework CoreMedia"
 
660
          AC_MSG_RESULT([Checking if AVFoundation framework is available... yes])
 
661
        else
 
662
          AC_MSG_RESULT([Checking if AVFoundation framework is available... no])
 
663
        fi
 
664
        ;;
 
665
  *darwin*)
 
666
        ac_pjmedia_video=mac_os
 
667
        AC_SUBST(ac_pjmedia_video_has_qt)
 
668
        AC_SUBST(ac_qt_cflags)
 
669
        SAVED_LIBS="$LIBS"
 
670
        LIBS="-framework QTKit"
 
671
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [])],[ac_pjmedia_video_has_qt=yes],[ac_pjmedia_video_has_qt=no])
 
672
        LIBS="$SAVED_LIBS"
 
673
        if test "$ac_pjmedia_video_has_qt" = "yes"; then
 
674
          ac_qt_cflags="-DPJMEDIA_VIDEO_DEV_HAS_QT=1"
 
675
          LIBS="$LIBS -framework QTKit -framework QuartzCore -framework OpenGL"
 
676
          AC_MSG_RESULT([Checking if QTKit framework is available... yes])
 
677
        else
 
678
          AC_MSG_RESULT([Checking if QTKit framework is available... no])
 
679
        fi
 
680
        ;;
 
681
 esac
 
682
fi
 
683
 
 
684
AC_ARG_ENABLE(ext_sound,
 
685
              AC_HELP_STRING([--enable-ext-sound],
 
686
                             [PJMEDIA will not provide any sound device backend]),
 
687
              [if test "$enable_ext_sound" = "yes"; then
 
688
                [ac_pjmedia_snd=external]
 
689
                AC_MSG_RESULT([Checking if external sound is set... yes])
 
690
               fi]
 
691
              )
 
692
 
 
693
dnl # Include resampling small filter
 
694
AC_SUBST(ac_no_small_filter)
 
695
AC_ARG_ENABLE(small-filter,
 
696
              AC_HELP_STRING([--disable-small-filter],
 
697
                             [Exclude small filter in resampling]),
 
698
              [if test "$enable_small_filter" = "no"; then
 
699
                [ac_no_small_filter='-DPJMEDIA_HAS_SMALL_FILTER=0']
 
700
                AC_MSG_RESULT([Checking if small filter is disabled... yes])
 
701
               fi],
 
702
              AC_MSG_RESULT([Checking if small filter is disabled... no]))
 
703
 
 
704
dnl # Include resampling large filter
 
705
AC_SUBST(ac_no_large_filter)
 
706
AC_ARG_ENABLE(large-filter,
 
707
              AC_HELP_STRING([--disable-large-filter],
 
708
                             [Exclude large filter in resampling]),
 
709
              [if test "$enable_large_filter" = "no"; then
 
710
                [ac_no_large_filter='-DPJMEDIA_HAS_LARGE_FILTER=0']
 
711
                AC_MSG_RESULT([Checking if large filter is disabled... yes])
 
712
               fi],
 
713
              AC_MSG_RESULT([Checking if large filter is disabled... no]))
 
714
 
 
715
dnl # Include Speex AEC
 
716
AC_SUBST(ac_no_speex_aec)
 
717
AC_ARG_ENABLE(speex-aec,
 
718
              AC_HELP_STRING([--disable-speex-aec],
 
719
                             [Exclude Speex Acoustic Echo Canceller/AEC]),
 
720
              [if test "$enable_speex_aec" = "no"; then
 
721
                [ac_no_speex_aec='-DPJMEDIA_HAS_SPEEX_AEC=0']
 
722
                AC_MSG_RESULT([Checking if Speex AEC is disabled...yes])
 
723
               fi],
 
724
              AC_MSG_RESULT([Checking if Speex AEC is disabled...no]))
 
725
 
 
726
dnl # Include G711 codec
 
727
AC_SUBST(ac_no_g711_codec)
 
728
AC_ARG_ENABLE(g711-codec,
 
729
              AC_HELP_STRING([--disable-g711-codec],
 
730
                             [Exclude G.711 codecs from the build]),
 
731
              [if test "$enable_g711_codec" = "no"; then
 
732
                [ac_no_g711_codec=1]
 
733
                AC_DEFINE(PJMEDIA_HAS_G711_CODEC,0)
 
734
                AC_MSG_RESULT([Checking if G.711 codec is disabled...yes])
 
735
               fi],
 
736
              AC_MSG_RESULT([Checking if G.711 codec is disabled...no]))
 
737
 
 
738
 
 
739
dnl # Include L16 codec
 
740
AC_SUBST(ac_no_l16_codec)
 
741
AC_ARG_ENABLE(l16-codec,
 
742
              AC_HELP_STRING([--disable-l16-codec],
 
743
                             [Exclude Linear/L16 codec family from the build]),
 
744
              [if test "$enable_l16_codec" = "no"; then
 
745
                [ac_no_l16_codec=1]
 
746
                AC_DEFINE(PJMEDIA_HAS_L16_CODEC,0)
 
747
                AC_MSG_RESULT([Checking if L16 codecs are disabled...yes])
 
748
               fi],
 
749
              AC_MSG_RESULT([Checking if L16 codec is disabled...no]))
 
750
 
 
751
 
 
752
dnl # Include GSM codec
 
753
AC_SUBST(ac_no_gsm_codec)
 
754
AC_ARG_ENABLE(gsm-codec,
 
755
              AC_HELP_STRING([--disable-gsm-codec],
 
756
                             [Exclude GSM codec in the build]),
 
757
              [if test "$enable_gsm_codec" = "no"; then
 
758
                [ac_no_gsm_codec=1]
 
759
                AC_DEFINE(PJMEDIA_HAS_GSM_CODEC,0)
 
760
                AC_MSG_RESULT([Checking if GSM codec is disabled...yes])
 
761
               fi],
 
762
              AC_MSG_RESULT([Checking if GSM codec is disabled...no]))
 
763
 
 
764
dnl # Include G.722 codec
 
765
AC_SUBST(ac_no_g722_codec)
 
766
AC_ARG_ENABLE(g722-codec,
 
767
              AC_HELP_STRING([--disable-g722-codec],
 
768
                             [Exclude G.722 codec in the build]),
 
769
              [if test "$enable_g722_codec" = "no"; then
 
770
                [ac_no_g722_codec=1]
 
771
                AC_DEFINE(PJMEDIA_HAS_G722_CODEC,0)
 
772
                AC_MSG_RESULT([Checking if G.722 codec is disabled...yes])
 
773
               fi],
 
774
              AC_MSG_RESULT([Checking if G.722 codec is disabled...no]))
 
775
 
 
776
dnl # Include G722.1 codec
 
777
AC_SUBST(ac_no_g7221_codec)
 
778
AC_ARG_ENABLE(g7221-codec,
 
779
              AC_HELP_STRING([--disable-g7221-codec],
 
780
                             [Exclude G.7221 codec in the build]),
 
781
              [if test "$enable_g7221_codec" = "no"; then
 
782
                [ac_no_g7221_codec=1]
 
783
                AC_DEFINE(PJMEDIA_HAS_G7221_CODEC,0)
 
784
                AC_MSG_RESULT([Checking if G.722.1 codec is disabled...yes])
 
785
               fi],
 
786
              AC_MSG_RESULT([Checking if G.722.1 codec is disabled...no]))
 
787
 
 
788
dnl # Include Speex codec
 
789
AC_SUBST(ac_no_speex_codec)
 
790
AC_ARG_ENABLE(speex-codec,
 
791
              AC_HELP_STRING([--disable-speex-codec],
 
792
                             [Exclude Speex codecs in the build]),
 
793
              [if test "$enable_speex_codec" = "no"; then
 
794
                [ac_no_speex_codec=1]
 
795
                AC_DEFINE(PJMEDIA_HAS_SPEEX_CODEC,0)
 
796
                AC_MSG_RESULT([Checking if Speex codec is disabled...yes])
 
797
               fi],
 
798
              AC_MSG_RESULT([Checking if Speex codec is disabled...no]))
 
799
 
 
800
dnl # Include iLBC codec
 
801
AC_SUBST(ac_no_ilbc_codec)
 
802
AC_ARG_ENABLE(ilbc-codec,
 
803
              AC_HELP_STRING([--disable-ilbc-codec],
 
804
                             [Exclude iLBC codec in the build]),
 
805
              [if test "$enable_ilbc_codec" = "no"; then
 
806
                [ac_no_ilbc_codec=1]
 
807
                AC_DEFINE(PJMEDIA_HAS_ILBC_CODEC,0)
 
808
                AC_MSG_RESULT([Checking if iLBC codec is disabled...yes])
 
809
               fi],
 
810
              AC_MSG_RESULT([Checking if iLBC codec is disabled...no]))
 
811
 
 
812
dnl # Include libsamplerate
 
813
AC_ARG_ENABLE(libsamplerate,
 
814
              AC_HELP_STRING([--enable-libsamplerate],
 
815
                             [Link with libsamplerate when available. Note that PJMEDIA_RESAMPLE_IMP must also be configured]),
 
816
              [ AC_CHECK_LIB(samplerate,src_new) ],
 
817
              AC_MSG_RESULT([Skipping libsamplerate detection])
 
818
             )
 
819
 
 
820
dnl # Include libsamplerate
 
821
AC_SUBST(ac_resample_dll)
 
822
AC_ARG_ENABLE(resample_dll,
 
823
              AC_HELP_STRING([--enable-resample-dll],
 
824
                             [Build libresample as shared library]),
 
825
              [if test "$enable_resample_dll" = "yes"; then
 
826
                [ac_resample_dll=1]
 
827
                AC_MSG_RESULT([Building libresample as shared library... yes])
 
828
               fi],
 
829
              AC_MSG_RESULT([Building libresample as shared library... no])
 
830
              )
 
831
 
 
832
dnl # SDL alt prefix
 
833
AC_ARG_WITH(sdl,
 
834
    AC_HELP_STRING([--with-sdl=DIR],
 
835
                   [Specify alternate libSDL prefix]),
 
836
    [],
 
837
    [with_sdl=no]
 
838
    )
 
839
 
 
840
dnl # Do not use default SDL installation if we are cross-compiling
 
841
if test "x$ac_cross_compile" != "x" -a "x$with_sdl" = "xno"; then
 
842
    enable_sdl=no
 
843
fi
 
844
 
 
845
dnl # SDL
 
846
AC_ARG_ENABLE(sdl,
 
847
              AC_HELP_STRING([--disable-sdl],
 
848
                             [Disable SDL (default: not disabled)]),
 
849
              [
 
850
                if test "$enable_sdl" = "no"; then
 
851
                  AC_MSG_RESULT([Checking if SDL is disabled... yes])
 
852
                fi
 
853
              ],
 
854
              [
 
855
                  if test "x$with_sdl" != "xno" -a "x$with_sdl" != "x"; then
 
856
                        AC_MSG_RESULT([Using SDL prefix... $with_sdl])
 
857
                        AC_PATH_PROGS(SDL_CONFIG,sdl2-config sdl-config,,$with_sdl/bin)
 
858
                  else
 
859
                        AC_PATH_PROGS(SDL_CONFIG, sdl2-config sdl-config)
 
860
                  fi
 
861
                  
 
862
                  AC_MSG_CHECKING([SDL availability])
 
863
                  if test "x$SDL_CONFIG" = "x"; then
 
864
                        AC_MSG_RESULT([not found])
 
865
                  elif (sh -c "$SDL_CONFIG --version" | grep -e '^1\.3' -e '^2\.') then
 
866
                        AC_SUBST(ac_sdl_cflags)
 
867
                        AC_SUBST(ac_sdl_ldflags)
 
868
                        ac_sdl_cflags=`$SDL_CONFIG --cflags`
 
869
                        ac_sdl_cflags="-DPJMEDIA_VIDEO_DEV_HAS_SDL=1 $ac_sdl_cflags"
 
870
                        ac_sdl_ldflags=`$SDL_CONFIG --libs`
 
871
                        LIBS="$LIBS $ac_sdl_ldflags"
 
872
                  else
 
873
                        AC_MSG_RESULT([Unsupported SDL version])
 
874
                  fi
 
875
              ])
 
876
 
 
877
 
 
878
AC_ARG_WITH(ffmpeg,
 
879
    AC_HELP_STRING([--with-ffmpeg=DIR],
 
880
                   [Specify alternate FFMPEG prefix]),
 
881
    [],
 
882
    [with_ffmpeg=no]
 
883
    )
 
884
 
 
885
dnl # Do not use default ffmpeg installation if we are cross-compiling
 
886
if test "x$ac_cross_compile" != "x" -a "x$with_ffmpeg" = "xno"; then
 
887
    enable_ffmpeg=no
 
888
fi
 
889
 
 
890
dnl # FFMPEG stuffs
 
891
AC_ARG_ENABLE(ffmpeg,
 
892
              AC_HELP_STRING([--disable-ffmpeg],
 
893
                             [Disable ffmpeg (default: not disabled)]),
 
894
              [
 
895
                AC_SUBST(ac_has_ffmpeg,0)
 
896
                if test "$enable_ffmpeg" = "no"; then
 
897
                        AC_MSG_RESULT([Checking if ffmpeg is disabled... yes])
 
898
                fi
 
899
              ],
 
900
              [
 
901
                AC_SUBST(ac_ffmpeg_cflags)
 
902
                AC_SUBST(ac_ffmpeg_ldflags)
 
903
 
 
904
                FFMPEG_PREFIX=""
 
905
                AC_SUBST(SAVED_PKG_CONFIG_PATH)
 
906
                SAVED_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
 
907
                if test "x$with_ffmpeg" != "xno" -a "x$with_ffmpeg" != "x"; then
 
908
                        FFMPEG_PREFIX=$with_ffmpeg
 
909
                        AC_MSG_RESULT([Using ffmpeg prefix... $FFMPEG_PREFIX])
 
910
                        export PKG_CONFIG_PATH=$FFMPEG_PREFIX/lib/pkgconfig
 
911
                fi
 
912
 
 
913
                AC_CHECK_PROGS(PKG_CONFIG,pkg-config "python pkgconfig.py",none)
 
914
 
 
915
                if test "$PKG_CONFIG" != "none"; then
 
916
                        AC_MSG_CHECKING([ffmpeg packages])
 
917
                        av_pkg=""
 
918
                        if $PKG_CONFIG --exists libdevice; then
 
919
                                ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
 
920
                                av_pkg="$av_pkg libdevice"
 
921
                        fi
 
922
                        if $PKG_CONFIG --exists libavformat; then
 
923
                                ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
 
924
                                av_pkg="$av_pkg libavformat"
 
925
                        fi
 
926
                        if $PKG_CONFIG --exists libavcodec; then
 
927
                                ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
 
928
                                av_pkg="$av_pkg libavcodec"
 
929
                        fi
 
930
                        if $PKG_CONFIG --exists libswscale; then
 
931
                                ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
 
932
                                av_pkg="$av_pkg libswscale"
 
933
                        fi
 
934
                        if $PKG_CONFIG --exists libavutil; then
 
935
                                ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
 
936
                                av_pkg="$av_pkg libavutil"
 
937
                        fi
 
938
                        if $PKG_CONFIG --exists libavcore; then
 
939
                                ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
 
940
                                av_pkg="$av_pkg libavcore"
 
941
                        fi
 
942
                        
 
943
                        if test "x$av_pkg" == "x"; then
 
944
                           AC_MSG_RESULT([none detected (check the prefix)! **])
 
945
                        else
 
946
                           AC_MSG_RESULT([$av_pkg])
 
947
                        fi
 
948
                        
 
949
                        ac_ffmpeg_cflags="$ac_ffmpeg_cflags `$PKG_CONFIG --cflags $av_pkg`"
 
950
                        ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags `$PKG_CONFIG --libs $av_pkg`"
 
951
 
 
952
                else
 
953
                        dnl #
 
954
                        dnl # Use hardcoded values to configure ffmpeg
 
955
                        dnl #
 
956
                        
 
957
                        AC_MSG_RESULT([*** Warning: neither pkg-config nor python is available, ffmpeg dependency cannot be calculated. If ffmpeg libraries are not detected, you need to specify the correct CFLAGS and LDFLAGS settings for ffmpeg prior to invoking configure ***])
 
958
                        
 
959
                        LIBS="-L$FFMPEG_PREFIX/lib $LIBS"
 
960
                        LDFLAGS="-L$FFMPEG_PREFIX/lib $LDFLAGS"
 
961
                        CFLAGS="-I$FFMPEG_PREFIX/include $CFLAGS"
 
962
                        
 
963
                        AC_CHECK_LIB(avdevice,
 
964
                                     avdevice_version,
 
965
                                     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVDEVICE=1"
 
966
                                      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavdevice"
 
967
                                     ]
 
968
                                     )
 
969
                        AC_CHECK_LIB(avutil,
 
970
                                     av_malloc,
 
971
                                     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVUTIL=1"
 
972
                                      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavutil"
 
973
                                     ]
 
974
                                     )
 
975
                        AC_CHECK_LIB(avcodec,
 
976
                                     avcodec_init,
 
977
                                     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCODEC=1"
 
978
                                      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcodec"
 
979
                                     ],
 
980
                                     [],
 
981
                                     [-lavutil]
 
982
                                     )
 
983
                        AC_CHECK_LIB(avformat,
 
984
                                     av_register_all,
 
985
                                     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVFORMAT=1"
 
986
                                      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavformat"
 
987
                                     ],
 
988
                                     [],
 
989
                                     [-lavcodec -lavutil]
 
990
                                     )
 
991
                        AC_CHECK_LIB(swscale,
 
992
                                     sws_scale,
 
993
                                     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBSWSCALE=1"
 
994
                                      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lswscale"
 
995
                                     ],
 
996
                                     [],
 
997
                                     [-lavutil]
 
998
                                     )
 
999
                        AC_CHECK_LIB(avcore,
 
1000
                                     avcore_version,
 
1001
                                     [ac_ffmpeg_cflags="$ac_ffmpeg_cflags -DPJMEDIA_HAS_LIBAVCORE=1"
 
1002
                                      ac_ffmpeg_ldflags="$ac_ffmpeg_ldflags -lavcore"
 
1003
                                     ]
 
1004
                                     )
 
1005
                        
 
1006
                fi
 
1007
                
 
1008
                LIBS="$LIBS $ac_ffmpeg_ldflags"
 
1009
                export PKG_CONFIG_PATH=$SAVED_PKG_CONFIG_PATH
 
1010
              ]
 
1011
              )
 
1012
 
 
1013
dnl # Video for Linux 2
 
1014
AC_ARG_ENABLE(v4l2,
 
1015
              AC_HELP_STRING([--disable-v4l2],
 
1016
                             [Disable Video4Linux2 (default: not disabled)]),
 
1017
              [
 
1018
                if test "$enable_v4l2" = "no"; then
 
1019
                  AC_MSG_RESULT([Checking if V4L2 is disabled... yes])
 
1020
                fi
 
1021
              ],
 
1022
              [
 
1023
                AC_SUBST(ac_v4l2_cflags)
 
1024
                AC_SUBST(ac_v4l2_ldflags)
 
1025
                AC_CHECK_LIB(v4l2,
 
1026
                             v4l2_open,
 
1027
                             [ac_v4l2_cflags="-DPJMEDIA_VIDEO_DEV_HAS_V4L2=1"
 
1028
                              ac_v4l2_ldflags="-lv4l2"
 
1029
                              LIBS="$LIBS -lv4l2"
 
1030
                             ]
 
1031
                             )
 
1032
              ])
 
1033
 
 
1034
dnl ########################################################
 
1035
dnl # Intel IPP support
 
1036
dnl #
 
1037
AC_ARG_ENABLE(ipp,
 
1038
    AC_HELP_STRING([--enable-ipp],
 
1039
                   [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]),
 
1040
    [],
 
1041
    [enable_ipp=no]
 
1042
    )
 
1043
 
 
1044
AC_ARG_WITH(ipp,
 
1045
    AC_HELP_STRING([--with-ipp=DIR],
 
1046
                   [Specify the Intel IPP location]),
 
1047
    [],
 
1048
    [with_ipp=no]
 
1049
    )
 
1050
 
 
1051
AC_ARG_WITH(ipp-samples,
 
1052
    AC_HELP_STRING([--with-ipp-samples=DIR],
 
1053
                   [Specify the Intel IPP samples location]),
 
1054
    [],
 
1055
    [with_ipp_samples=no]
 
1056
    )
 
1057
 
 
1058
AC_ARG_WITH(ipp-arch,
 
1059
    AC_HELP_STRING([--with-ipp-arch=ARCH],
 
1060
                   [Specify the Intel IPP ARCH suffix, e.g. "64" or "em64t. Default is blank for IA32"]),
 
1061
    [],
 
1062
    [with_ipp_arch=no]
 
1063
    )
 
1064
 
 
1065
if test "x$enable_ipp" != "xno"; then
 
1066
    dnl # 
 
1067
    dnl # Verifying Intel IPP path
 
1068
    dnl #
 
1069
    AC_MSG_CHECKING([Intel IPP location])
 
1070
 
 
1071
    if test "x$with_ipp" != "xno" -a "x$with_ipp" != "x"; then
 
1072
        AC_MSG_RESULT([$with_ipp])
 
1073
        IPPROOT=$with_ipp
 
1074
    elif test "x$IPPROOT" = "x"; then
 
1075
        if test -d /opt/intel/ipp; then
 
1076
            IPPROOT=`ls -d /opt/intel/ipp/*/* | head -1`
 
1077
            AC_MSG_RESULT([autodetected in $IPPROOT])
 
1078
        fi
 
1079
    else
 
1080
        AC_MSG_RESULT([$IPPROOT])
 
1081
    fi
 
1082
 
 
1083
    if test "x$with_ipp_arch" != "xno"; then
 
1084
        IPP_SUFFIX=$with_ipp_arch
 
1085
        AC_MSG_RESULT([IPP arch suffix is set to $IPP_SUFFIX])
 
1086
    else
 
1087
        IPP_SUFFIX=""
 
1088
        AC_MSG_RESULT([IPP arch suffix is set to empty])
 
1089
    fi
 
1090
 
 
1091
    if test x$IPPROOT = x; then
 
1092
        AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPROOT env var or with --with-ipp option])
 
1093
    elif test ! -d $IPPROOT; then
 
1094
        AC_MSG_ERROR([not found])
 
1095
    elif test ! -d $IPPROOT/include; then
 
1096
        AC_MSG_ERROR([directory doesn't seem to be valid])
 
1097
    else
 
1098
        # IPP directory looks okay.
 
1099
        # Remove trailing backslash
 
1100
        IPPROOT=`echo $IPPROOT | sed 's/\/$//'`
 
1101
 
 
1102
        SAVED_CFLAGS="$CFLAGS"
 
1103
        SAVED_LDFLAGS="$LDFLAGS"
 
1104
        SAVED_LIBS="$LIBS"
 
1105
 
 
1106
        IPP_CFLAGS="-I$IPPROOT/include"
 
1107
        IPP_LIBS="-lippsc${IPP_SUFFIX} -lipps${IPP_SUFFIX} -lippcore${IPP_SUFFIX}"
 
1108
 
 
1109
#
 
1110
        # Some differences between Mac OS X and Linux
 
1111
        case $target in 
 
1112
            *darwin* )
 
1113
                IPP_LDFLAGS="-L$IPPROOT/Libraries -L$IPPROOT/lib"
 
1114
                ;;
 
1115
            *)
 
1116
                # Find out where the libraries live.
 
1117
                IPP7_ARCH=""
 
1118
                if test -d $IPPROOT/lib/intel64; then
 
1119
                   IPP7_ARCH="intel64"
 
1120
                elif test -d $IPPROOT/lib/ia32; then
 
1121
                   IPP7_ARCH="ia32"
 
1122
                elif test -d $IPPROOT/lib/mic; then
 
1123
                   IPP7_ARCH="mic"
 
1124
                fi
 
1125
 
 
1126
                if test -z "$IPP7_ARCH"; then
 
1127
                   # IPP6 (and possibly below)
 
1128
                   IPP_LDFLAGS="-L$IPPROOT/sharedlib"
 
1129
                   IPP_LIBS="$IPP_LIBS  -lippsr${IPP_SUFFIX} -lguide"
 
1130
                else
 
1131
                   # IPP7
 
1132
                   if ! test -d $IPPROOT/../compiler; then
 
1133
                        AC_MSG_ERROR([Cannot find $IPPROOT/../compiler directory. Please set IPPROOT variable correctly])
 
1134
                   fi
 
1135
                   IPP_CFLAGS="$IPP_CFLAGS"
 
1136
                   IPP_LDFLAGS="-L$IPPROOT/lib/intel64 -L$IPPROOT/../compiler/lib/$IPP7_ARCH"
 
1137
                   IPP_LIBS="$IPP_LIBS -liomp5"
 
1138
                fi
 
1139
                ;;
 
1140
        esac
 
1141
 
 
1142
        #IPP_LDFLAGS="-L$IPPROOT/sharedlib"
 
1143
        #Static:
 
1144
        #IPP_LIBS="-lippscmerged -lippsrmerged -lippsmerged -lippcore"
 
1145
 
 
1146
        CFLAGS="$CFLAGS $IPP_CFLAGS"
 
1147
        LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
 
1148
        LIBS="$IPP_LIBS $LIBS"
 
1149
 
 
1150
 
 
1151
        AC_MSG_CHECKING([Intel IPP usability])
 
1152
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ippcore.h>
 
1153
                                           ]],
 
1154
                                           [ippStaticInit();])],
 
1155
                  [AC_MSG_RESULT(ok)],
 
1156
                  [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])])
 
1157
 
 
1158
        CFLAGS="$SAVED_CFLAGS"
 
1159
        LDFLAGS="$SAVED_LDFLAGS"
 
1160
        LIBS="$SAVED_LIBS"
 
1161
    fi
 
1162
 
 
1163
    dnl # 
 
1164
    dnl # Verifying Intel IPP samples path
 
1165
    dnl #
 
1166
    AC_MSG_CHECKING([Intel IPP samples location])
 
1167
 
 
1168
    if test "x$with_ipp_samples" != "xno" -a "x$with_ipp_samples" != "x"; then
 
1169
        AC_MSG_RESULT([$with_ipp_samples])
 
1170
        IPPSAMPLES=$with_ipp_samples
 
1171
    elif test "x$IPPSAMPLES" = "x"; then
 
1172
        if test -d /opt/intel/ipp-samples; then
 
1173
            IPPSAMPLES=/opt/intel/ipp-samples
 
1174
            AC_MSG_RESULT([autodetected in $IPPSAMPLES])
 
1175
        fi
 
1176
    else
 
1177
        AC_MSG_RESULT([$IPPSAMPLES])
 
1178
    fi
 
1179
 
 
1180
    if test x$IPPSAMPLES = x; then
 
1181
        AC_MSG_ERROR([the location is neither specified nor can be guessed. Please specify with IPPSAMPLES env var or with --with-ipp-samples option])
 
1182
    elif test ! -d $IPPSAMPLES; then
 
1183
        AC_MSG_ERROR([not found])
 
1184
    elif test ! -d $IPPSAMPLES/speech-codecs; then
 
1185
        AC_MSG_ERROR([directory doesn't seem to be valid])
 
1186
    else
 
1187
        # Remove trailing backslash
 
1188
        IPPSAMPLES=`echo $IPPSAMPLES | sed 's/\/$//'`
 
1189
        
 
1190
        # Guess the libusc.a/libspeech.a build location
 
1191
        AC_MSG_CHECKING([Intel IPP USC build location])
 
1192
        if test -d $IPPSAMPLES/speech-codecs/bin; then
 
1193
            IPPVER=5 
 
1194
            IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/bin/*gcc*/lib | head -1`
 
1195
        elif test -d $IPPSAMPLES/speech-codecs/_bin; then
 
1196
            IPPVER=6
 
1197
            if test -d $IPPSAMPLES/speech-codecs/_bin/*gcc*; then
 
1198
                # gcc compiler
 
1199
                IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*gcc*/lib | head -1`
 
1200
            elif test -d $IPPSAMPLES/speech-codecs/_bin/*icc*; then
 
1201
                # icc compiler
 
1202
                IPPSAMP_DIR=`ls -d $IPPSAMPLES/speech-codecs/_bin/*icc*/lib | head -1`
 
1203
            else
 
1204
                AC_MSG_FAILURE([Unable to find to find built binaries under $IPPSAMPLES/speech-codecs/{bin,_bin}. Have you built the IPP samples?])
 
1205
            fi
 
1206
        else
 
1207
            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?])
 
1208
        fi
 
1209
 
 
1210
        # Test the directory
 
1211
        if test ! -d $IPPSAMP_DIR; then
 
1212
            AC_MSG_FAILURE([There's something wrong with this script, directory $IPPSAMP_DIR does not exist])
 
1213
            exit 1;
 
1214
        fi
 
1215
 
 
1216
        if test "x$IPPVER" = "x5"; then
 
1217
            IPPSAMP_LIBS="libusc.a"
 
1218
            IPPSAMP_LDLIBS="-lusc"
 
1219
        elif test "x$IPPVER" = "x6"; then
 
1220
            IPPSAMP_LIBS="libspeech.a"
 
1221
            IPPSAMP_LDLIBS="-lspeech"
 
1222
        else
 
1223
            AC_MSG_FAILURE([bug in this script: unsupported IPP version])
 
1224
        fi
 
1225
 
 
1226
        if test ! -f $IPPSAMP_DIR/$IPPSAMP_LIBS; then
 
1227
            AC_MSG_FAILURE([$IPPSAMP_LIBS doesn't exist in $IPPSAMP_DIR])
 
1228
        fi
 
1229
 
 
1230
        AC_MSG_RESULT([$IPPSAMP_DIR])
 
1231
 
 
1232
        SAVED_CFLAGS="$CFLAGS"
 
1233
        SAVED_LDFLAGS="$LDFLAGS"
 
1234
        SAVED_LIBS="$LIBS"
 
1235
 
 
1236
        IPPSAMP_INC="-I$IPPSAMPLES/speech-codecs/core/usc/include"
 
1237
        CFLAGS="$CFLAGS $IPPSAMP_INC"
 
1238
        LDFLAGS="$LDFLAGS -L$IPPSAMP_DIR"
 
1239
        LIBS="$IPPSAMP_LDLIBS $LIBS"
 
1240
 
 
1241
        AC_MSG_CHECKING([Intel IPP USC usability])
 
1242
        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <usc.h>
 
1243
                                           ]],
 
1244
                                           [extern USC_Fxns USC_G729AFP_Fxns;])],
 
1245
                  [AC_MSG_RESULT(ok)],
 
1246
                  [AC_MSG_FAILURE(failed)])
 
1247
 
 
1248
        CFLAGS="$SAVED_CFLAGS"
 
1249
        LDFLAGS="$IPP_LDFLAGS $SAVED_LDFLAGS"
 
1250
        LIBS="$IPP_LIBS $SAVED_LIBS"
 
1251
 
 
1252
        IPP_CFLAGS="$IPP_CFLAGS $IPPSAMP_INC"
 
1253
        IPP_LDFLAGS="$IPP_LDFLAGS -L$IPPSAMP_DIR"
 
1254
        IPP_LIBS="$IPPSAMP_LDLIBS $IPP_LIBS"
 
1255
    fi
 
1256
 
 
1257
    CFLAGS="$CFLAGS $IPP_CFLAGS"
 
1258
    LDFLAGS="$LDFLAGS $IPP_LDFLAGS"
 
1259
    LIBS="$LIBS $IPP_LIBS"
 
1260
 
 
1261
    ac_build_mak_vars="$ac_build_mak_vars\n\
 
1262
export IPP_CFLAGS=$IPP_CFLAGS\n\
 
1263
export IPP_LDFLAGS=$IPP_LDFLAGS\n\
 
1264
export IPP_LIBS=$IPP_LIBS"
 
1265
else
 
1266
    AC_MSG_RESULT([Skipping Intel IPP settings (not wanted)])
 
1267
fi
 
1268
 
 
1269
 
 
1270
dnl ##########################################
 
1271
dnl #
 
1272
dnl # PJSIP CONFIG
 
1273
dnl #
 
1274
 
 
1275
dnl # SSL alt prefix
 
1276
AC_ARG_WITH(ssl,
 
1277
    AC_HELP_STRING([--with-ssl=DIR],
 
1278
                   [Specify alternate libssl prefix]),
 
1279
    [],
 
1280
    [with_ssl=no]
 
1281
    )
 
1282
 
 
1283
dnl # Do not use default SSL installation if we are cross-compiling
 
1284
if test "x$ac_cross_compile" != "x" -a "x$with_ssl" = "xno"; then
 
1285
    enable_ssl=no
 
1286
fi
 
1287
 
 
1288
dnl # Include SSL support
 
1289
AC_SUBST(ac_no_ssl)
 
1290
AC_ARG_ENABLE(ssl,
 
1291
              AC_HELP_STRING([--disable-ssl],
 
1292
                             [Exclude SSL support the build (default: autodetect)])
 
1293
              ,
 
1294
              [
 
1295
                if test "$enable_ssl" = "no"; then
 
1296
                 [ac_no_ssl=1]
 
1297
                 AC_MSG_RESULT([Checking if SSL support is disabled... yes])
 
1298
                fi
 
1299
              ],
 
1300
              [
 
1301
                AC_MSG_RESULT([checking for OpenSSL installations..])
 
1302
                if test "x$with_ssl" != "xno" -a "x$with_ssl" != "x"; then
 
1303
                    CFLAGS="$CFLAGS -I$with_ssl/include"
 
1304
                    LDFLAGS="$LDFLAGS -L$with_ssl/lib"
 
1305
                    AC_MSG_RESULT([Using SSL prefix... $with_ssl])
 
1306
                fi
 
1307
                AC_SUBST(openssl_h_present)
 
1308
                AC_SUBST(libssl_present)
 
1309
                AC_SUBST(libcrypto_present)
 
1310
                AC_CHECK_HEADER(openssl/ssl.h,[openssl_h_present=1])
 
1311
                AC_CHECK_LIB(crypto,ERR_load_BIO_strings,[libcrypto_present=1 && LIBS="$LIBS -lcrypto"])
 
1312
                AC_CHECK_LIB(ssl,SSL_library_init,[libssl_present=1 && LIBS="$LIBS -lssl"])
 
1313
                if test "x$openssl_h_present" = "x1" -a "x$libssl_present" = "x1" -a "x$libcrypto_present" = "x1"; then
 
1314
                        AC_MSG_RESULT([OpenSSL library found, SSL support enabled])
 
1315
                        # PJSIP_HAS_TLS_TRANSPORT setting follows PJ_HAS_SSL_SOCK
 
1316
                        #AC_DEFINE(PJSIP_HAS_TLS_TRANSPORT, 1)
 
1317
                        AC_DEFINE(PJ_HAS_SSL_SOCK, 1)
 
1318
                else
 
1319
                        AC_MSG_RESULT([** OpenSSL libraries not found, disabling SSL support **])
 
1320
                fi
 
1321
              ])
 
1322
 
 
1323
dnl # Obsolete option --with-opencore-amrnb
 
1324
AC_ARG_WITH(opencore-amrnb,
 
1325
    AC_HELP_STRING([--with-opencore-amrnb=DIR],
 
1326
                   [This option is obsolete and replaced by --with-opencore-amr=DIR]),
 
1327
    [AC_MSG_ERROR(This option is obsolete and replaced by --with-opencore-amr=DIR)],
 
1328
    []
 
1329
    )
 
1330
 
 
1331
dnl # opencore-amr alt prefix
 
1332
AC_ARG_WITH(opencore-amr,
 
1333
    AC_HELP_STRING([--with-opencore-amr=DIR],
 
1334
                   [Specify alternate libopencore-amr prefix]),
 
1335
    [],
 
1336
    [with_opencore_amr=no]
 
1337
    )
 
1338
 
 
1339
dnl # Do not use default opencore-amr installation if we are cross-compiling
 
1340
if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amr" = "xno"; then
 
1341
    enable_opencore_amr=no
 
1342
fi
 
1343
 
 
1344
dnl # vo-amrwbenc alt prefix
 
1345
AC_ARG_WITH(opencore-amrwbenc,
 
1346
    AC_HELP_STRING([--with-opencore-amrwbenc=DIR],
 
1347
                   [Specify alternate libvo-amrwbenc prefix]),
 
1348
    [],
 
1349
    [with_opencore_amrwbenc=no]
 
1350
    )
 
1351
 
 
1352
dnl # Do not use default vo-amrwbenc installation if we are cross-compiling
 
1353
if test "x$ac_cross_compile" != "x" -a "x$with_opencore_amrwbenc" = "xno"; then
 
1354
    enable_opencore_amrwbenc=no
 
1355
fi
 
1356
 
 
1357
 
 
1358
dnl # Include opencore-amr support
 
1359
AC_SUBST(ac_no_opencore_amrnb)
 
1360
AC_SUBST(ac_no_opencore_amrwb)
 
1361
AC_ARG_ENABLE(opencore_amr,
 
1362
              AC_HELP_STRING([--disable-opencore-amr],
 
1363
                             [Exclude OpenCORE AMR support from the build (default: autodetect)])
 
1364
              ,
 
1365
              [
 
1366
                if test "$enable_opencore_amr" = "no"; then
 
1367
                 [ac_no_opencore_amrnb=1]
 
1368
                 [ac_no_opencore_amrwb=1]
 
1369
                 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
 
1370
                 AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
 
1371
                 AC_MSG_RESULT([Checking if OpenCORE AMR support is disabled... yes])
 
1372
                fi
 
1373
              ],
 
1374
              [
 
1375
                AC_MSG_RESULT([checking for OpenCORE AMR installations..])
 
1376
                if test "x$with_opencore_amr" != "xno" -a "x$with_opencore_amr" != "x"; then
 
1377
                    CFLAGS="$CFLAGS -I$with_opencore_amr/include"
 
1378
                    LDFLAGS="$LDFLAGS -L$with_opencore_amr/lib"
 
1379
                    AC_MSG_RESULT([Using OpenCORE AMR prefix... $with_opencore_amr])
 
1380
                fi
 
1381
                if test "x$with_opencore_amrwbenc" != "xno" -a "x$with_opencore_amrwbenc" != "x"; then
 
1382
                    CFLAGS="$CFLAGS -I$with_opencore_amrwbenc/include"
 
1383
                    LDFLAGS="$LDFLAGS -L$with_opencore_amrwbenc/lib"
 
1384
                    AC_MSG_RESULT([Using OpenCORE AMRWB-enc prefix... $with_opencore_amrwbenc])
 
1385
                fi
 
1386
                AC_SUBST(opencore_amrnb_h_present)
 
1387
                AC_SUBST(opencore_amrnb_present)
 
1388
                AC_CHECK_HEADER(opencore-amrnb/interf_enc.h,[opencore_amrnb_h_present=1])
 
1389
                AC_CHECK_LIB(opencore-amrnb,Encoder_Interface_init,[opencore_amrnb_present=1 && LIBS="$LIBS -lopencore-amrnb"])
 
1390
                if test "x$opencore_amrnb_h_present" = "x1" -a "x$opencore_amrnb_present" = "x1"; then
 
1391
                        AC_MSG_RESULT([OpenCORE AMR-NB library found, AMR-NB support enabled])
 
1392
                        AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,1)
 
1393
                else
 
1394
                        [ac_no_opencore_amrnb=1]
 
1395
                        AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRNB_CODEC,0)
 
1396
                fi
 
1397
                AC_SUBST(opencore_amrwb_enc_h_present)
 
1398
                AC_SUBST(opencore_amrwb_enc_present)
 
1399
                AC_SUBST(opencore_amrwb_dec_h_present)
 
1400
                AC_SUBST(opencore_amrwb_dec_present)
 
1401
                AC_CHECK_HEADER(vo-amrwbenc/enc_if.h,[opencore_amrwb_enc_h_present=1])
 
1402
                AC_CHECK_HEADER(opencore-amrwb/dec_if.h,[opencore_amrwb_dec_h_present=1])
 
1403
                AC_CHECK_LIB(opencore-amrwb,D_IF_init,[opencore_amrwb_dec_present=1 && LIBS="$LIBS -lopencore-amrwb"])
 
1404
                AC_CHECK_LIB(vo-amrwbenc,E_IF_init,[opencore_amrwb_enc_present=1 && LIBS="$LIBS -lvo-amrwbenc"])
 
1405
                if test "x$opencore_amrwb_enc_h_present" = "x1" -a "x$opencore_amrwb_dec_h_present" = "x1" -a "x$opencore_amrwb_enc_present" = "x1" -a "x$opencore_amrwb_dec_present" = "x1"; then
 
1406
                        AC_MSG_RESULT([OpenCORE AMR-WB library found, AMR-WB support enabled])
 
1407
                        AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,1)
 
1408
                else
 
1409
                        [ac_no_opencore_amrwb=1]
 
1410
                        AC_DEFINE(PJMEDIA_HAS_OPENCORE_AMRWB_CODEC,0)
 
1411
                fi
 
1412
 
 
1413
              ])
 
1414
 
 
1415
dnl # SILK prefix
 
1416
AC_ARG_WITH(silk,
 
1417
    AC_HELP_STRING([--with-silk=DIR],
 
1418
                   [Specify alternate SILK prefix]),
 
1419
    [],
 
1420
    [with_silk=no]
 
1421
    )
 
1422
 
 
1423
dnl # Do not use default SILK installation if we are cross-compiling
 
1424
if test "x$ac_cross_compile" != "x" -a "x$with_silk" = "xno"; then
 
1425
    enable_silk=no
 
1426
fi
 
1427
 
 
1428
dnl # Include SILK support
 
1429
AC_SUBST(ac_no_silk)
 
1430
AC_ARG_ENABLE(silk,
 
1431
              AC_HELP_STRING([--disable-silk],
 
1432
                             [Exclude SILK support from the build (default: autodetect)])
 
1433
              ,
 
1434
              [
 
1435
                if test "$enable_silk" = "no"; then
 
1436
                 [ac_no_silk=1]
 
1437
                 AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
 
1438
                 AC_MSG_RESULT([Checking if SILK support is disabled... yes])
 
1439
                fi
 
1440
              ],
 
1441
              [
 
1442
                AC_MSG_RESULT([checking for SILK installations..])
 
1443
                if test "x$with_silk" != "xno" -a "x$with_silk" != "x"; then
 
1444
                    CFLAGS="$CFLAGS -I$with_silk/interface"
 
1445
                    CPPFLAGS="$CPPFLAGS -I$with_silk/interface"
 
1446
                    LDFLAGS="$LDFLAGS -L$with_silk"
 
1447
                    AC_MSG_RESULT([Using SILK prefix... $with_silk])
 
1448
                fi                
 
1449
                AC_SUBST(silk_h_present)
 
1450
                AC_SUBST(silk_present)
 
1451
                AC_CHECK_HEADER(SKP_Silk_SDK_API.h,[silk_h_present=1])
 
1452
                AC_CHECK_LIB(SKP_SILK_SDK,SKP_Silk_SDK_get_version,[silk_present=1 && LIBS="$LIBS -lSKP_SILK_SDK"])
 
1453
                if test "x$silk_h_present" = "x1" -a "x$silk_present" = "x1"; then
 
1454
                        AC_MSG_RESULT([SILK library found, SILK support enabled])
 
1455
                        AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,1)
 
1456
                else
 
1457
                        [ac_no_silk=1]
 
1458
                        AC_DEFINE(PJMEDIA_HAS_SILK_CODEC,0)
 
1459
                fi
 
1460
              ])
 
1461
 
 
1462
 
 
1463
dnl ##########################################
 
1464
dnl #
 
1465
dnl # MANUAL CONFIG
 
1466
dnl #
 
1467
 
 
1468
 
 
1469
dnl # Determine if select() requires nfds to be filled up with
 
1470
dnl # correct value (max_fd+1). If zero, nfds will be filled up with
 
1471
dnl # PJ_FD_SETSIZE
 
1472
AC_MSG_CHECKING([if select() needs correct nfds])
 
1473
case $target in
 
1474
  *rtems*) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,1)
 
1475
           AC_MSG_RESULT(yes)
 
1476
        ;;
 
1477
  *) AC_DEFINE(PJ_SELECT_NEEDS_NFDS,0)
 
1478
     AC_MSG_RESULT([no (default)])
 
1479
     AC_MSG_RESULT([** Decided that select() doesn't need correct nfds (please check)])
 
1480
        ;;
 
1481
esac
 
1482
 
 
1483
dnl # Determine if pj_thread_create() should enforce thread stack size when
 
1484
dnl # creating thread. Default is zero, to allow OS to allocate appropriate
 
1485
dnl # thread's stack size.
 
1486
AC_MSG_CHECKING([if pj_thread_create() should enforce stack size])
 
1487
case $target in
 
1488
  *rtems*) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,1)
 
1489
           AC_MSG_RESULT(yes)
 
1490
        ;;
 
1491
  *) AC_DEFINE(PJ_THREAD_SET_STACK_SIZE,0)
 
1492
     AC_MSG_RESULT([no (default)])
 
1493
        ;;
 
1494
esac
 
1495
 
 
1496
dnl # Determine if pj_thread_create() should allocate thread's stack from
 
1497
dnl # the pool. Default is zero, to let OS allocate thread's stack.
 
1498
AC_MSG_CHECKING([if pj_thread_create() should allocate stack])
 
1499
case $target in
 
1500
  *rtems*) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,1)
 
1501
           AC_MSG_RESULT(yes)
 
1502
        ;;
 
1503
  *) AC_DEFINE(PJ_THREAD_ALLOCATE_STACK,0)
 
1504
     AC_MSG_RESULT([no (default)])
 
1505
        ;;
 
1506
esac
 
1507
 
 
1508
dnl # This value specifies the value set in errno by the OS when a non-blocking
 
1509
dnl # socket recv() can not return immediate data.
 
1510
case $target in
 
1511
  *mingw* | *cygw* | *win32* | *w32* )
 
1512
        AC_DEFINE(PJ_BLOCKING_ERROR_VAL,WSAEWOULDBLOCK)
 
1513
        ;;
 
1514
  *) AC_DEFINE(PJ_BLOCKING_ERROR_VAL,EAGAIN)
 
1515
     AC_MSG_RESULT([** Setting non-blocking recv() retval to EAGAIN (please check)])
 
1516
        ;;
 
1517
esac
 
1518
 
 
1519
dnl # This value specifies the value set in errno by the OS when a non-blocking
 
1520
dnl # socket connect() can not get connected immediately.
 
1521
case $target in
 
1522
  *mingw* | *cygw* | *win32* | *w32* )
 
1523
        AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,WSAEWOULDBLOCK)
 
1524
        ;;
 
1525
  *) AC_DEFINE(PJ_BLOCKING_CONNECT_ERROR_VAL,EINPROGRESS)
 
1526
     AC_MSG_RESULT([** Setting non-blocking connect() retval to EINPROGRESS (please check)])
 
1527
        ;;
 
1528
esac
 
1529
 
 
1530
 
 
1531
AC_SUBST(target)
 
1532
AC_SUBST(ac_linux_poll,select)
 
1533
AC_SUBST(ac_host,unix)
 
1534
AC_SUBST(ac_main_obj)
 
1535
case $target in
 
1536
  *rtems*)
 
1537
        ac_main_obj=main_rtems.o
 
1538
        ;;
 
1539
  *)
 
1540
        ac_main_obj=main.o
 
1541
        ;;
 
1542
esac
 
1543
AC_SUBST(CC)
 
1544
 
 
1545
ac_build_mak_vars=`echo $ac_build_mak_vars | sed 's/\\\\n/\n/g'`
 
1546
AC_OUTPUT()
 
1547
 
 
1548
 
 
1549
AC_MSG_RESULT([
 
1550
 
 
1551
Configurations 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.
 
1552
 
 
1553
Further customizations can be put in:
 
1554
  - 'user.mak'
 
1555
  - 'pjlib/include/pj/config_site.h'
 
1556
 
 
1557
The next step now is to run 'make dep' and 'make'.
 
1558
])
 
1559