]> sjero.net Git - linphone/blob - linphone/oRTP/configure.ac
addc9ca25485e824c1d70222a2bfe71cdc5b9573
[linphone] / linphone / oRTP / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([ortp],[0.16.1])
3 AC_CANONICAL_SYSTEM
4
5 dnl Source packaging numbers
6 ORTP_MAJOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f1)
7 ORTP_MINOR_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f2)
8 ORTP_MICRO_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f3)
9 ORTP_EXTRA_VERSION=$(echo $PACKAGE_VERSION | cut -d. -f4)
10
11 LIBORTP_SO_CURRENT=8 dnl increment this number when you add/change/remove an interface
12 LIBORTP_SO_REVISION=0 dnl increment this number when you change source code, without changing interfaces; set to 0 when incrementing CURRENT
13 LIBORTP_SO_AGE=0 dnl increment this number when you add an interface, set to 0 if you remove an interface
14
15 LIBORTP_SO_VERSION=$LIBORTP_SO_CURRENT:$LIBORTP_SO_REVISION:$LIBORTP_SO_AGE
16 ORTP_VERSION=${ORTP_MAJOR_VERSION}.${ORTP_MINOR_VERSION}.${ORTP_MICRO_VERSION}
17
18 if test -n "$ORTP_EXTRA_VERSION" ; then
19         ORTP_VERSION="${ORTP_VERSION}.${ORTP_EXTRA_VERSION}"
20 fi
21
22 ORTP_PKGCONFIG_VERSION=${ORTP_VERSION}
23
24 AC_SUBST(LIBORTP_SO_VERSION)
25 AC_SUBST(ORTP_VERSION)
26 AC_SUBST(ORTP_PKGCONFIG_VERSION)
27
28
29 PACKAGE=ortp
30
31 AM_INIT_AUTOMAKE([tar-ustar])
32 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
33 AC_CONFIG_HEADERS(ortp-config.h)
34 AC_DEFINE_UNQUOTED(ORTP_MAJOR_VERSION,$ORTP_MAJOR_VERSION, [major version])
35 AC_DEFINE_UNQUOTED(ORTP_MINOR_VERSION,$ORTP_MINOR_VERSION, [minor version])
36 AC_DEFINE_UNQUOTED(ORTP_MICRO_VERSION,$ORTP_MICRO_VERSION, [micro version])
37 AC_DEFINE_UNQUOTED(ORTP_VERSION,"$ORTP_VERSION",[ortp version number])
38
39 AC_SUBST([mkdir_p])
40
41 AC_MSG_CHECKING([warning make an error on compilation])
42 AC_ARG_ENABLE(strict,
43 [  --enable-strict       Enable error on compilation warning [default=yes]],
44 [wall_werror=$enableval],
45 [wall_werror=yes]
46 )
47
48 AC_ARG_ENABLE(perf,
49 [  --enable-perf       Disable costly features to reduce cpu consumtion [default=no]],
50 [perf=$enableval],
51 [perf=no]
52 )
53
54 ORTP_DEFS=
55
56 dnl enable ipv6 support
57 AC_ARG_ENABLE(ipv6,
58       [  --enable-ipv6    Turn on ipv6 support],
59       [case "${enableval}" in
60         yes)  ipv6=true;;
61         no)   ipv6=false;;
62         *) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
63       esac],[ipv6=true])
64 if test x$ipv6 = xtrue ; then
65         ORTP_DEFS="$ORTP_DEFS -DORTP_INET6"
66 fi
67
68 AC_ARG_ENABLE(mode64bit,
69                         [  --enable-mode64bit=[yes/no]   produce a 64-bit library. [default=no]],
70                         [case "${enableval}" in
71                                 yes) mode64bit_enabled=yes;;
72                                 no) mode64bit_enabled=no;;
73                                 *) AC_MSG_ERROR("Bad value for --enable-mode64bit");;
74                         esac],
75                         [mode64bit_enabled=no])
76
77 AC_ARG_ENABLE(debug,
78                         [  --enable-debug=[yes/no]   enables the display of traces showing the execution of the library. [default=yes]],
79                         [case "${enableval}" in
80                                 yes) debug_enabled=yes;;
81                                 no) debug_enabled=no;;
82                                 *) AC_MSG_ERROR("Bad value for --enable-debug");;
83                         esac],
84                         [debug_enabled=no])
85
86
87 hpux_host=no
88 posixtimer_interval=10000
89 PTHREAD_LDFLAGS=
90
91 case "$target_os" in
92         *hpux*) 
93                 hpux_host=yes
94                 AC_DEFINE(NOCONNECT,1,[Defined if we should not use connect() on udp sockets])
95                 CFLAGS="$CFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199506L"
96                 LIBS="$LIBS -lxnet"
97                 ;;
98         *freebsd*)
99                 AC_DEFINE(NOCONNECT,1,[Defined if we should not use connect() on udp sockets])
100                 PTHREAD_LDFLAGS="-pthread"
101                 ;;
102         *mingw32ce)
103                 CFLAGS="$CFLAGS -D_WIN32_WCE -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
104                 LIBS="$LIBS -lws2 -liphlpapi"
105                 build_tests=no
106                 mingw_found=yes
107                 ;;
108         *mingw*)
109                 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0501 -DORTP_STATIC"
110                 LIBS="$LIBS -lws2_32 -liphlpapi -lwinmm"
111                 build_tests=no
112                 ;;
113 esac
114
115 AC_CONFIG_COMMANDS([libtool-hacking],[
116 if test "$mingw_found" = "yes" ; then
117         echo "Hacking libtool to work with mingw..."
118         sed -e 's/\*\" \$a_deplib \"\*/\*/' < ./libtool > libtool.tmp
119         cp -f ./libtool.tmp ./libtool
120         rm -f ./libtool.tmp
121 fi
122 ],[mingw_found=$mingw_found])
123
124 dnl Checks for programs.
125 AC_PROG_CC
126 AC_LIBTOOL_WIN32_DLL
127 AC_PROG_LIBTOOL
128 AC_ENABLE_SHARED(yes)
129 AC_ENABLE_STATIC(no)
130
131 if test "$GCC" != "yes" ; then
132         if test "$hpux_host" = "yes" ; then
133                 dnl we are probably using HPUX cc compiler, so add a +O2 to CFLAGS
134                         CFLAGS="$CFLAGS +O2 -g "
135                 if test x$mode64bit_enabled = xyes ; then
136                         CFLAGS="$CFLAGS +DA2.0W +DS2.0"
137                 fi
138         fi
139 else
140         CFLAGS="$CFLAGS -Wall"  
141 fi
142
143 build_scheduler=yes
144
145 dnl Check if we have seteuid system call
146 AC_CHECK_FUNCS(seteuid)
147
148
149 dnl check if we can use the pthread_library
150 AC_CHECK_LIB(pthread, pthread_mutex_init, [pthread_enabled=yes], [pthread_enabled=no])
151 if test $pthread_enabled = "no" ; then
152         build_scheduler=no
153 else
154         PTHREAD_LIBS="-lpthread"
155         PTHREAD_CFLAGS="-D_REENTRANT"
156         AC_SUBST(PTHREAD_CFLAGS)
157         AC_SUBST(PTHREAD_LIBS)
158         AC_SUBST(PTHREAD_LDFLAGS)
159 fi
160 AC_ARG_WITH(thread-stack-size,
161         AC_HELP_STRING([--with-thread-stack-size=SIZE-IN-BYTES],[Set thread stack size [[default=os-default]]]),
162         [thread_stack_size=$withval], [thread_stack_size=0])
163 AC_DEFINE_UNQUOTED(ORTP_DEFAULT_THREAD_STACK_SIZE, $thread_stack_size, [Default thread stack size (0 = let operating system decide)])
164
165
166 dnl check for libsrtp support (secure rtp)
167 AC_ARG_WITH( srtp,
168       [  --with-srtp      Set prefix where libsrtp can be found (ex:/usr or /usr/local)[default=/usr] ],
169       [ srtp_prefix=${withval}],[ srtp_prefix=/usr ])
170
171
172 if test "${srtp_prefix}" != "/usr" ; then
173         SRTP_CFLAGS="-I${srtp_prefix}/include"
174         SRTP_LIBS="-L${srtp_prefix}/lib"
175 fi
176 SRTP_LIBS="$SRTP_LIBS -lsrtp"
177
178 dnl check srtp headers
179 have_srtp=no
180 CPPFLAGS_save=$CPPFLAGS
181 CPPFLAGS=$SRTP_CFLAGS
182 AC_CHECK_HEADER([srtp/srtp.h],have_srtp_headers=yes)
183 CPPFLAGS=$CPPFLAGS_save
184
185 dnl check for srtp lib
186 LDFLAGS_save=$LDFLAGS
187 LDFLAGS=$SRTP_LIBS
188 LIBS_save=$LIBS
189 AC_CHECK_LIB(srtp,srtp_init,have_srtp_lib=yes)
190 LDFLAGS=$LDFLAGS_save
191 LIBS=$LIBS_save
192
193 if test "$have_srtp_headers$have_srtp_lib" = "yesyes" ; then
194         have_srtp=yes
195         AC_DEFINE(HAVE_SRTP, 1, [Defined when srtp support is compiled])
196 else
197         AC_MSG_NOTICE([Could not find libsrtp headers or lib, cryto transport disabled.])
198         SRTP_CFLAGS=
199         SRTP_LIBS=
200 fi
201
202 AC_SUBST(SRTP_CFLAGS)
203 AC_SUBST(SRTP_LIBS)
204
205 if test $debug_enabled = "yes"; then
206         ORTP_DEFS="$ORTP_DEFS -DORTP_DEBUG_MODE -g"
207         CFLAGS=`echo $CFLAGS | sed 's/-O.//'`
208 fi
209
210 AC_ARG_ENABLE(memcheck,
211                                 [  --enable-memcheck=[yes/no]   enables memory leak detection (HPUX only).],
212                                 [case "${enableval}" in
213                                 yes) memcheck_enabled=yes;;
214                                 no) memcheck_enabled=no;;
215                                 *) AC_MSG_ERROR("Bad value for --enable-memcheck");;
216                         esac],
217                                 [memcheck_enabled=no])
218                                 
219 if test "$memcheck_enabled" = "yes" ; then
220         if test "$hpux_host" = "yes" ; then
221                 AC_DEFINE(ENABLE_MEMCHECK,1,[Defined when memory leak checking if enabled])
222         else
223                 echo "WARNING ************ : the memory check option is only available for HPUX."
224         fi
225 fi
226
227 AC_ARG_ENABLE(so-reuseaddr,
228                                 [  --enable-so-reuseaddr=[yes/no]   enables SO_REUSEADDR socket option in the rtp_session_set_local_addr() function.],
229                                 [case "${enableval}" in
230                                         yes) so_reuseaddr_enabled=yes;;
231                                         no) so_reuseaddr_enabled=no;;
232                                         *) AC_MSG_ERROR("Bad value for --enable-so-reuseaddr");;
233                                 esac],
234                                 [so_reuseaddr_enabled=yes])
235                                 
236 if test "$so_reuseaddr_enabled" = "yes" ; then
237         AC_DEFINE(SO_REUSE_ADDR,1,[Defined when SO_REUSEADDR socket option in the rtp_session_set_local_addr() function is enabled])
238 fi
239
240
241 dnl Checks for header files.
242 AC_HEADER_STDC
243 AC_CHECK_HEADERS(poll.h sys/poll.h sys/uio.h fcntl.h sys/time.h unistd.h sys/audio.h linux/soundcard.h)
244
245 dnl Checks for typedefs, structures, and compiler characteristics.
246 AC_C_CONST
247 AC_C_INLINE
248 AC_HEADER_TIME
249 AC_WORDS_BIGENDIAN
250 if test x$ac_cv_c_bigendian = xyes ; then
251         ORTP_DEFS="$ORTP_DEFS -DORTP_BIGENDIAN"
252 fi
253
254 dnl Checks for library functions.
255 AC_CHECK_FUNCS(select socket strerror)
256
257 if test $hpux_host = "yes" ; then
258 dnl it seems 10 ms is too fast on hpux and it causes trouble 
259                 posixtimer_interval=20000
260 fi
261
262 AC_DEFINE_UNQUOTED(POSIXTIMER_INTERVAL,$posixtimer_interval,[Defines the periodicity of the rtp scheduler in microseconds])
263
264 if test "$perf" = "yes" ; then
265         CFLAGS="$CFLAGS -DPERF"
266 fi
267
268 if test $GCC = yes && test $wall_werror = yes;  then
269         CFLAGS="$CFLAGS -Werror "
270 fi
271
272 AC_ARG_ENABLE(ssl-hmac,
273                                 [  --enable-ssl-hmac=[yes/no]   enables use of ssl/hmac for stun],
274                                 [case "${enableval}" in
275                                         yes) ssl_hmac_enabled=yes;;
276                                         no) ssl_hmac_enabled=no;;
277                                         *) AC_MSG_ERROR("Bad value for --enable-ssl-hmac");;
278                                 esac],
279                                 [ssl_hmac_enabled=yes])
280                                 
281 if test "$ssl_hmac_enabled" = "yes" ; then
282         AC_CHECK_HEADERS(openssl/hmac.h openssl/md5.h)
283         AC_CHECK_LIB(ssl,SSL_CTX_new,[SSL_LIBS="-lssl"])
284         AC_CHECK_LIB(crypto,MD5,[SSL_LIBS="$SSL_LIBS -lcrypto"])
285 fi
286
287
288
289
290
291 AC_SUBST(SSL_LIBS)
292
293 ORTPDEPS_LIBS="$ORTPDEPS_LIBS $PTHREAD_LIBS $PTHREAD_LDFLAGS $SRTP_LIBS $SSL_LIBS"
294 ORTPDEPS_CFLAGS="$ORTPDEPS_CFLAGS $PTHREAD_CFLAGS $ORTP_DEFS $SRTP_CFLAGS"
295 CFLAGS="$CFLAGS $ORTP_DEFS"
296 echo "$ORTPDEPS_CFLAGS" > ortp.defs
297
298
299 dnl ##################################################
300 dnl # Check for doxygen
301 dnl ##################################################
302
303 AC_PATH_PROG(DOXYGEN,doxygen,false)
304 AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
305
306
307 dnl ##################################################
308 dnl # Check for ESP Packager
309 dnl ##################################################
310
311 AC_PATH_PROG(EPM,epm,false)
312 AC_PATH_PROG(MKEPMLIST,mkepmlist,false)
313 AC_PATH_PROG(EPMINSTALL,epminstall,false)
314 AM_CONDITIONAL(WITH_EPM,test $EPM != false && test $MKEPMLIST != false && test $EPMINSTALL != false)
315 AM_CONDITIONAL(BUILD_TESTS,test x$build_tests != xno)
316
317 # Preferred packaging system, as per EPM terminology
318 case $target in
319 *-*-linux*)
320         if test -f /etc/debian_version ; then
321                 EPM_PKG_EXT=deb
322         else
323                 EPM_PKG_EXT=rpm
324         fi
325         ;;
326 *-hp-hpux*)
327         EPM_PKG_EXT=depot.gz;;
328 *-dec-osf*)
329         EPM_PKG_EXT=setld;;
330 esac
331 AC_SUBST(EPM_PKG_EXT)
332
333 # System software User & Group names
334 case $target in
335 *-*-linux*)
336         SYS_USER=root
337         SYS_GROUP=root
338         ;;
339 *-*-hpux*|*-dec-osf*)
340         SYS_USER=bin
341         SYS_GROUP=bin
342         ;;
343 esac
344 AC_SUBST(SYS_USER)
345 AC_SUBST(SYS_GROUP)
346
347 # CPU Architecture
348 case $target_cpu in
349 i?86)           ARCH=i386;;
350 *)              ARCH=$target_cpu;;
351 esac
352 AC_SUBST(ARCH)
353
354 # Various other packaging variables, that can be over-ridden ad `make
355 # package' time
356 SUMMARY="An LGPL implementation of RTP - RFC3550"
357 AC_SUBST(SUMMARY)
358 PACKAGER=anonymous
359 AC_SUBST(PACKAGER)
360 LICENSE=LGPL
361 AC_SUBST(LICENSE)
362 VENDOR=Linphone
363 AC_SUBST(VENDOR)
364 RELEASE=1
365 AC_SUBST(RELEASE)
366
367 AC_SUBST(ORTPDEPS_CFLAGS)
368 AC_SUBST(ORTPDEPS_LIBS)
369 AC_SUBST(ORTPDEPS_LDFLAGS)
370
371 AC_OUTPUT(
372 Makefile
373 include/Makefile
374 include/ortp/Makefile
375 src/Makefile
376 src/tests/Makefile
377 src/tests/win_receiver/Makefile
378 src/tests/win_sender/Makefile
379 build/Makefile
380 build/win32native/Makefile
381 build/wince/Makefile
382 build/winmob/Makefile
383 ortp.pc
384 ortp.spec
385 ortp.doxygen
386 )
387
388 AC_MSG_WARN([ortp-0.15.0 breaks compatibility with older releases, because value returned by rtp_session_recvm_with_ts() has
389         changed. See the API documentation in doc/ for further readings.])