1 AC_INIT(include/opal/manager.h)
17 dnl this must be updated for every minor revision, and for
18 dnl builds when and as necessary
19 REQUIRED_PWLIB_MAJOR=1
20 REQUIRED_PWLIB_MINOR=11
21 REQUIRED_PWLIB_BUILD=0
23 dnl ########################################################################
24 dnl set the OPAL directory to the current directory
29 dnl ########################################################################
30 dnl set the PREFIX accordingly
31 if test "x$prefix" = "xNONE"; then
32 INSTALLPREFIX="/usr/local"
34 INSTALLPREFIX="${prefix}"
37 AC_SUBST(INSTALLPREFIX)
39 dnl ########################################################################
40 dnl set LIBDIR accordingly
45 dnl ########################################################################
46 dnl extract the OPAL version
48 dnl MSWIN_DISPLAY version,Version
49 dnl MSWIN_VERSION version,OPAL_MAJOR=MAJOR_VERSION
50 dnl MSWIN_VERSION version,OPAL_MINOR=MINOR_VERSION
51 dnl MSWIN_VERSION version,OPAL_BUILD=BUILD_NUMBER
52 dnl MSWIN_VERSION version,OPAL_VERSION=VERSION
54 MAJOR_VERSION=`cat ${OPALDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
55 MINOR_VERSION=`cat ${OPALDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
56 BUILD_NUMBER=`cat ${OPALDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
57 OPAL_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}"
58 AC_DEFINE_UNQUOTED(OPAL_MAJOR, ${MAJOR_VERSION})
59 AC_DEFINE_UNQUOTED(OPAL_MINOR, ${MINOR_VERSION})
60 AC_DEFINE_UNQUOTED(OPAL_BUILD, ${BUILD_NUMBER})
61 AC_DEFINE_UNQUOTED(OPAL_VERSION, "$OPAL_VERSION")
63 AC_MSG_NOTICE(Opal version is ${OPAL_VERSION});
65 #use to set the version in opal.pc
66 AC_SUBST(OPAL_VERSION)
68 dnl ########################################################################
69 dnl look for ptlib, use a preference order of explicit PWLIBDIR, directory
70 dnl at same level, home directory, /usr/local or /usr.
72 if test "${PWLIBDIR:-unset}" != "unset" ; then
73 AC_CHECK_FILE(${PWLIBDIR}/version.h, HAS_PTLIB=1)
75 if test "${HAS_PTLIB:-unset}" = "unset" ; then
76 AC_CHECK_FILE(${OPALDIR}/../pwlib/version.h, HAS_PTLIB=1)
77 if test "${HAS_PTLIB:-unset}" != "unset" ; then
78 PWLIBDIR="${OPALDIR}/../pwlib"
80 AC_CHECK_FILE(${HOME}/pwlib/include/ptlib.h, HAS_PTLIB=1)
81 if test "${HAS_PTLIB:-unset}" != "unset" ; then
82 PWLIBDIR="${HOME}/pwlib"
84 AC_CHECK_FILE(/usr/local/include/ptlib.h, HAS_PTLIB=1)
85 if test "${HAS_PTLIB:-unset}" != "unset" ; then
86 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin)
88 AC_CHECK_FILE(/usr/include/ptlib.h, HAS_PTLIB=1)
89 if test "${HAS_PTLIB:-unset}" != "unset" ; then
90 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/share/pwlib/make/)
92 AC_CHECK_FILE(${prefix}/include/ptlib.h, HAS_PTLIB=1)
93 if test "${HAS_PTLIB:-unset}" != "unset" ; then
94 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , ${prefix}/bin)
102 if test "${HAS_PTLIB:-unset}" = "unset" ; then
103 AC_MSG_ERROR("Cannot find pwlib - please install or set PWLIBDIR and try again")
106 if test "${PWLIBDIR:-unset}" = "unset" ; then
107 if test "${PTLIB_CONFIG:-unset}" = "unset" ; then
108 AC_MSG_ERROR("Cannot find ptlib-config - please install and try again")
110 PWLIBDIR=`$PTLIB_CONFIG --prefix`
113 if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
114 PWLIBDIR="/usr/share/pwlib/"
116 if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
117 PWLIBDIR="/usr/local/share/pwlib/"
119 if test "x$PWLIBDIR" = "x${prefix}"; then
120 PWLIBDIR="${prefix}/share/pwlib/"
124 echo "PWLib prefix set to.... $PWLIBDIR"
126 if test "${PWLIBDIR:-unset}" = "unset" ; then
127 PWVERSION=`$PTLIB_CONFIG --version`
128 PW_MAJOR_VERSION=`echo $PW_VERSION | cut -d'.' -f1`
129 PW_MINOR_VERSION=`echo $PW_VERSION | cut -d'.' -f2`
130 PW_BUILD_NUMBER=`echo $PW_VERSION | cut -d'.' -f3`
133 PW_MAJOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
134 PW_MINOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
135 PW_BUILD_NUMBER=`cat ${PWLIBDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
136 PWVERSION="${PW_MAJOR_VERSION}.${PW_MINOR_VERSION}.${PW_BUILD_NUMBER}"
139 AC_ARG_ENABLE(versioncheck,
140 [ --disable-versioncheck disable PWLib version check],
141 PWLIB_VERSION_CHECK=$enableval)
143 AC_MSG_CHECKING(Checking PWLib version ${PWVERSION})
144 if test "${PWLIB_VERSION_CHECK}x" = "nox" ; then
145 AC_MSG_RESULT(check disabled)
147 if test $PW_MAJOR_VERSION -lt $REQUIRED_PWLIB_MAJOR ; then
148 AC_MSG_ERROR(Major version less than required $REQUIRED_PWLIB_MAJOR)
150 if test $PW_MINOR_VERSION -lt $REQUIRED_PWLIB_MINOR ; then
151 AC_MSG_ERROR(Minor version less than required $REQUIRED_PWLIB_MINOR)
153 if test $PW_BUILD_NUMBER -lt $REQUIRED_PWLIB_BUILD ; then
154 AC_MSG_ERROR(Build version less than required $REQUIRED_PWLIB_BUILD)
161 dnl ########################################################################
162 dnl get the gcc version
164 if test x$GXX = xyes ; then
166 gcc_version=`$CXX -dumpversion`
167 AC_MSG_NOTICE(gcc version is $gcc_version);
168 GXX_MAJOR=`echo $gcc_version | sed 's/\..*$//'`
169 GXX_MINOR=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.//' -e 's/\..*$//'`]
170 GXX_PATCH=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.//' -e 's/\..*$//'`]
172 dnl cannot compile for less than gcc 3
173 AC_MSG_CHECKING(checking if gcc version is valid)
174 if test ${GXX_MAJOR} -lt 3 ; then
176 AC_MSG_ERROR([OPAL requires gcc version 3 or later])
182 dnl ########################################################################
183 dnl check for BSR instruction
185 AC_MSG_CHECKING(for working bit scan intrinsic)
188 int main(int argc, char* argv[]) {
190 unsigned int val = 0x00000FF0;
191 if (__builtin_clz(val) == 20)
196 AC_TRY_RUN($BSR_TEST_SRC, GCC_HAS_CLZ=1, GCC_HAS_CLZ=0, GCC_HAS_CLZ=1)
197 if test "${GCC_HAS_CLZ}" = "1" ; then
199 AC_DEFINE(GCC_HAS_CLZ, 1)
204 AC_SUBST(GCC_HAS_CLZ)
207 dnl ########################################################################
208 dnl Look for system libspeex
210 AC_ARG_ENABLE(localspeex,
211 [ --enable-localspeex use local version of Speex library rather than system version],
212 localspeex=$enableval)
214 AC_CHECK_SIZEOF(short)
216 AC_CHECK_SIZEOF(long)
217 AC_CHECK_SIZEOF(long long)
220 $ac_cv_sizeof_short) SIZE16="short";;
221 $ac_cv_sizeof_int) SIZE16="int";;
225 $ac_cv_sizeof_int) SIZE32="int";;
226 $ac_cv_sizeof_long) SIZE32="long";;
227 $ac_cv_sizeof_short) SIZE32="short";;
234 OPAL_HAVE_SPEEX_SPEEX_H=
235 AC_CHECK_HEADERS("speex.h", OPAL_HAVE_SPEEX_H=1)
236 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
237 AC_DEFINE(OPAL_HAVE_SPEEX_H)
239 AC_CHECK_HEADERS("speex/speex.h", OPAL_HAVE_SPEEX_SPEEX_H=1)
240 if test "${OPAL_HAVE_SPEEX_SPEEX_H}x" != "x" ; then
241 AC_DEFINE(OPAL_HAVE_SPEEX_SPEEX_H)
245 if test "${localspeex}" = "yes" ; then
246 AC_MSG_NOTICE(Forcing use of OPAL Speex sources)
247 elif test "${localspeex}" = "no" ; then
248 AC_MSG_NOTICE(Forcing use of system Speex library)
249 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
250 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
252 AC_CHECK_LIB(speex, speex_encoder_destroy, SPEEX=1)
253 if test "${SPEEX}x" != "x" ; then
254 AC_CHECK_LIB(speex, speex_encode_int, SPEEX=1, unset SPEEX)
256 if test "x$SPEEX" = "x" -o \( "${OPAL_HAVE_SPEEX_H}x" = "x" -a "${OPAL_HAVE_SPEEX_SPEEX_H}x" = "x" \); then
257 AC_MSG_NOTICE(Forcing use of OPAL Speex library)
259 AC_MSG_CHECKING(system Speex version)
260 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
261 echo "#include <speex.h>" > t.c
262 echo "#include <speex_header.h>" >> t.c
264 echo "#include <speex/speex.h>" > t.c
265 echo "#include <speex/speex_header.h>" >> t.c
269 int main(int argc,char *argv[])
272 speex_init_header(&header, 1, 1, &speex_nb_mode);
273 printf("%s\n", header.speex_version);
276 cc -o t t.c -lspeex > /dev/null 2>&1
277 if test \! -x t ; then
278 AC_MSG_RESULT(cannot determine - using OPAL version)
281 AC_MSG_RESULT($SYSVER)
282 AC_MSG_CHECKING(OPAL Speex version)
283 LIBVER=`grep "#define SPEEX_VERSION" ./src/codec/speex/libspeex/misc.h | sed -e 's/^.*[Ss][Pp][Ee][Ee][Xx]\-//' -e 's/\"//' -e 's/\/.*//'`
284 AC_MSG_RESULT($LIBVER)
285 AC_MSG_CHECKING(Speex versions)
290 @lib = split /\./, \$libver;
294 @sys = split /\./, \$sysver;
300 if (@sys[\$i] < @lib[\$i]) {
309 SPEEX=`perl t.pl $SYSVER $LIBVER`
311 if test "x$SPEEX" = "x0" ; then
312 AC_MSG_RESULT(OPAL version is more recent)
314 AC_MSG_RESULT(system version is more recent)
315 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
316 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
317 AC_MSG_CHECKING(Speex noise type)
318 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
319 echo "#include <speex.h>" > t.c
320 echo "#include <speex_preprocess.h>" >> t.c
322 echo "#include <speex/speex.h>" > t.c
323 echo "#include <speex/speex_preprocess.h>" >> t.c
327 int main(int argc,char *argv[])
329 struct SpeexPreprocessState *st;
332 speex_preprocess(st, x, echo);
336 cc -Werror -o t t.c -lspeex > /dev/null 2>&1
337 if test \! -x t ; then
338 AC_MSG_RESULT(spx_int32_t)
341 AC_DEFINE(OPAL_SPEEX_FLOAT_NOISE)
349 AC_SUBST(OPAL_HAVE_SPEEX_SPEEX_H)
351 dnl ########################################################################
352 dnl enable audio, video, SIP, H.323 and IAX
354 dnl MSWIN_DISPLAY audio,Audio
355 dnl MSWIN_DEFINE audio,OPAL_AUDIO
358 [ --disable-audio disable audio codec support],
360 AC_MSG_CHECKING(audio codec support)
361 if test "$audio" = "yes" ; then
362 AC_SUBST(OPAL_AUDIO, 1)
363 AC_DEFINE(OPAL_AUDIO)
364 AC_MSG_RESULT(enabled)
366 AC_MSG_RESULT(disabled)
370 dnl MSWIN_DISPLAY video,Video
371 dnl MSWIN_DEFINE video,OPAL_VIDEO
375 [ --disable-video disable video codec support],
377 AC_MSG_CHECKING(video device support)
378 if test "$video" = "yes" ; then
379 AC_SUBST(OPAL_VIDEO, 1)
380 AC_DEFINE(OPAL_VIDEO)
381 AC_MSG_RESULT(enabled)
383 AC_MSG_RESULT(disabled)
388 dnl MSWIN_DISPLAY sip,SIP support
389 dnl MSWIN_DEFINE sip,OPAL_SIP
392 [ --disable-sip disable SIP protocol support],
394 AC_MSG_CHECKING(SIP protocol)
395 if test "$sip" = "yes" ; then
396 AC_SUBST(OPAL_SIP, 1)
398 AC_MSG_RESULT(enabled)
400 AC_MSG_RESULT(disabled)
404 dnl MSWIN_DISPLAY h323,H.323 support
405 dnl MSWIN_DEFINE h323,OPAL_H323
408 [ --disable-h323 disable H.323 protocol support],
410 AC_MSG_CHECKING(H.323 protocol)
411 if test "$h323" = "yes" ; then
412 AC_SUBST(OPAL_H323, 1)
414 AC_MSG_RESULT(enabled)
416 AC_SUBST(OPAL_H323, 0)
417 AC_MSG_RESULT(disabled (T.38, H.224, H.460 also disabled))
421 AC_SUBST(OPAL_H323, $OPAL_H323)
423 dnl ########################################################################
427 dnl MSWIN_DISPLAY iax2,IAX2 support
428 dnl MSWIN_DEFINE iax2,OPAL_IAX2
431 [ --disable-iax disable IAX2 protocol support],
433 AC_MSG_CHECKING(IAX2 protocol)
434 if test "$iax" = "yes" ; then
435 AC_SUBST(OPAL_IAX2, 1)
437 AC_MSG_RESULT(enabled)
439 AC_MSG_RESULT(disabled)
442 dnl ########################################################################
446 dnl MSWIN_DISPLAY h224,H.224 support
447 dnl MSWIN_DEFINE h224,OPAL_H224
450 [ --disable-h224 disable H.224 protocol support],
452 AC_MSG_CHECKING(H224 protocol)
453 if test "$h224" = "yes" ; then
454 AC_SUBST(OPAL_H224, 1)
456 AC_MSG_RESULT(enabled)
458 AC_MSG_RESULT(disabled)
461 dnl ########################################################################
465 dnl MSWIN_DISPLAY t38,T.38
466 dnl MSWIN_DEFINE t38,OPAL_T38FAX
468 if test "$t38" = "yes" ; then
470 [ --disable-t38 disable T.38 protocol support],
472 AC_MSG_CHECKING(T.38 protocol)
473 if test "$t38" = "yes" ; then
474 AC_SUBST(OPAL_T38FAX, 1)
475 AC_DEFINE(OPAL_T38FAX)
476 AC_MSG_RESULT(enabled)
478 AC_MSG_RESULT(disabled)
483 dnl ########################################################################
487 dnl MSWIN_DISPLAY h450,H.450
488 dnl MSWIN_DEFINE h450,OPAL_H450
489 dnl MSWIN_IF_FEATURE h450,h323
492 if test "$h450" = "yes" ; then
494 [ --disable-h450 disable H.450],
496 AC_MSG_CHECKING(H.450 support)
497 if test "$h450" = "yes" ; then
498 AC_SUBST(OPAL_H450, 1)
500 AC_MSG_RESULT(enabled)
502 AC_MSG_RESULT(disabled)
507 dnl ########################################################################
511 dnl MSWIN_DISPLAY h460,H.460
512 dnl MSWIN_DEFINE h460,OPAL_H460
513 dnl MSWIN_IF_FEATURE h460,h323
516 if test "$h460" = "yes" ; then
518 [ --disable-h460 disable H.460],
520 AC_MSG_CHECKING(H.460 support)
521 if test "$h460" = "yes" ; then
522 AC_SUBST(OPAL_H460, 1)
524 AC_MSG_RESULT(enabled)
526 AC_MSG_RESULT(disabled)
531 dnl ########################################################################
533 dnl LID, used for vpb, dialogic etc ...
535 dnl MSWIN_DISPLAY lids,Line Interface Device
536 dnl MSWIN_DEFINE lids,OPAL_LID
540 if test "$lid" = "yes" ; then
542 [ --disable-lid disable LID support],
544 AC_MSG_CHECKING(LID support)
545 if test "$lid" = "yes" ; then
546 AC_DEFINE(OPAL_LID, 1)
548 AC_MSG_RESULT(enabled)
550 AC_MSG_RESULT(disabled)
555 dnl ########################################################################
559 dnl MSWIN_DISPLAY ivr,IVR support
560 dnl MSWIN_DEFINE ivr,OPAL_IVR
563 if test "$ivr" = "yes" ; then
565 [ --disable-ivr disable IVR support],
567 AC_MSG_CHECKING(IVR support)
568 if test "$ivr" = "yes" ; then
569 AC_DEFINE(OPAL_IVR, 1)
571 AC_MSG_RESULT(enabled)
573 AC_MSG_RESULT(disabled)
579 dnl ########################################################################
583 dnl MSWIN_DISPLAY rfc4175,RFC4175 Raw Video support
584 dnl MSWIN_DEFINE rfc4175,OPAL_RFC4175
586 if test "$rfc4175" = "yes" ; then
587 AC_ARG_ENABLE(rfc4175,
588 [ --disable-rfc4175 disable RFC4175 support],
590 AC_MSG_CHECKING(RFC4175 codec)
591 if test "$rfc4175" = "yes" ; then
592 AC_DEFINE(OPAL_RFC4175, 1)
594 AC_MSG_RESULT(enabled)
596 AC_MSG_RESULT(disabled)
599 AC_SUBST(OPAL_RFC4175)
601 dnl ########################################################################
603 dnl ZRTP from Phil Zimmermann
606 dnl MSWIN_DISPLAY libzrtp,ZRTP/SRTP support
607 dnl MSWIN_CHECK_FILE libzrtp,include\zrtp_types.h,HAS_LIBZRTP=1
608 dnl MSWIN_DIR_SYMBOL libzrtp,LIBZRTP_DIR
609 dnl MSWIN_CHECK_DIR libsrtp,.\srtp_win32k
610 dnl MSWIN_CHECK_DIR libzrtp,.\zrtp
611 dnl MSWIN_CHECK_DIR libzrtp,..\external\zrtp
612 dnl MSWIN_CHECK_DIR libzrtp,c:\libs
615 dnl AC_MSG_CHECKING(for libZRTP)
616 dnl AC_TRY_COMPILE([#include "srtp/srtp.h"],
617 dnl [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
619 dnl if test "${HAS_LIBSRTP}" = "1" ; then
620 dnl AC_MSG_RESULT(yes)
621 dnl AC_DEFINE(HAS_LIBSRTP, 1)
625 dnl AC_MSG_RESULT(no)
628 AC_SUBST(HAS_LIBZRTP)
631 dnl ########################################################################
636 dnl MSWIN_DISPLAY libsrtp,Cisco libSRTP support
637 dnl MSWIN_IF_FEATURE libsrtp,!libzrtp
638 dnl MSWIN_CHECK_FILE libsrtp,include\srtp.h,HAS_LIBSRTP=1
639 dnl MSWIN_DIR_SYMBOL libsrtp,LIBSRTP_DIR
640 dnl MSWIN_CHECK_DIR libsrtp,.\srtp
641 dnl MSWIN_CHECK_DIR libsrtp,..\external\srtp
642 dnl MSWIN_CHECK_DIR libsrtp,c:\libs
645 AC_MSG_CHECKING(for libSRTP)
646 AC_TRY_COMPILE([#include "srtp/srtp.h"],
647 [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
649 if test "${HAS_LIBSRTP}" = "1" ; then
651 AC_DEFINE(HAS_LIBSRTP, 1)
658 AC_SUBST(HAS_LIBSRTP)
659 dnl ########################################################################
660 dnl output make directives
667 dnl ########################################################################
668 dnl Output configured files
670 AC_CONFIG_SUBDIRS(plugins)
672 dnl ########################################################################
673 dnl output header file
675 AC_CONFIG_FILES(opal_inc.mak)
676 AC_CONFIG_FILES(Makefile)
677 AC_CONFIG_HEADERS(include/opal/buildopts.h)
678 AC_CONFIG_FILES(opal.pc)
679 AC_CONFIG_FILES(opal.spec)
680 AC_CONFIG_FILES(opal_cfg.dxy)
682 AC_OUTPUT(src/codec/speex/libspeex/speex_config_types.h)