1 AC_INIT(include/opal/manager.h)
16 dnl this must be updated for every minor revision, and for
17 dnl builds when and as necessary
18 REQUIRED_PWLIB_MAJOR=1
19 REQUIRED_PWLIB_MINOR=11
20 REQUIRED_PWLIB_BUILD=0
22 dnl ########################################################################
23 dnl set the OPAL directory to the current directory
28 dnl ########################################################################
29 dnl set the PREFIX accordingly
30 if test "x$prefix" = "xNONE"; then
31 INSTALLPREFIX="/usr/local"
33 INSTALLPREFIX="${prefix}"
36 AC_SUBST(INSTALLPREFIX)
38 dnl ########################################################################
39 dnl set LIBDIR accordingly
44 dnl ########################################################################
45 dnl extract the OPAL version
47 dnl MSWIN_DISPLAY version,Version
48 dnl MSWIN_VERSION version,OPAL_MAJOR=MAJOR_VERSION
49 dnl MSWIN_VERSION version,OPAL_MINOR=MINOR_VERSION
50 dnl MSWIN_VERSION version,OPAL_BUILD=BUILD_NUMBER
51 dnl MSWIN_VERSION version,OPAL_VERSION=VERSION
53 MAJOR_VERSION=`cat ${OPALDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
54 MINOR_VERSION=`cat ${OPALDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
55 BUILD_NUMBER=`cat ${OPALDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
56 OPAL_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}"
57 AC_DEFINE_UNQUOTED(OPAL_MAJOR, ${MAJOR_VERSION})
58 AC_DEFINE_UNQUOTED(OPAL_MINOR, ${MINOR_VERSION})
59 AC_DEFINE_UNQUOTED(OPAL_BUILD, ${BUILD_NUMBER})
60 AC_DEFINE_UNQUOTED(OPAL_VERSION, "$OPAL_VERSION")
62 AC_MSG_NOTICE(Opal version is ${OPAL_VERSION});
64 #use to set the version in opal.pc
65 AC_SUBST(OPAL_VERSION)
67 dnl ########################################################################
68 dnl look for ptlib, use a preference order of explicit PWLIBDIR, directory
69 dnl at same level, home directory, /usr/local or /usr.
71 if test "${PWLIBDIR:-unset}" != "unset" ; then
72 AC_CHECK_FILE(${PWLIBDIR}/version.h, HAS_PTLIB=1)
74 if test "${HAS_PTLIB:-unset}" = "unset" ; then
75 AC_CHECK_FILE(${OPALDIR}/../pwlib/version.h, HAS_PTLIB=1)
76 if test "${HAS_PTLIB:-unset}" != "unset" ; then
77 PWLIBDIR="${OPALDIR}/../pwlib"
79 AC_CHECK_FILE(${HOME}/pwlib/include/ptlib.h, HAS_PTLIB=1)
80 if test "${HAS_PTLIB:-unset}" != "unset" ; then
81 PWLIBDIR="${HOME}/pwlib"
83 AC_CHECK_FILE(/usr/local/include/ptlib.h, HAS_PTLIB=1)
84 if test "${HAS_PTLIB:-unset}" != "unset" ; then
85 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin)
87 AC_CHECK_FILE(/usr/include/ptlib.h, HAS_PTLIB=1)
88 if test "${HAS_PTLIB:-unset}" != "unset" ; then
89 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/share/pwlib/make/)
91 AC_CHECK_FILE(${prefix}/include/ptlib.h, HAS_PTLIB=1)
92 if test "${HAS_PTLIB:-unset}" != "unset" ; then
93 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , ${prefix}/bin)
101 if test "${HAS_PTLIB:-unset}" = "unset" ; then
102 AC_MSG_ERROR("Cannot find pwlib - please install or set PWLIBDIR and try again")
105 if test "${PWLIBDIR:-unset}" = "unset" ; then
106 if test "${PTLIB_CONFIG:-unset}" = "unset" ; then
107 AC_MSG_ERROR("Cannot find ptlib-config - please install and try again")
109 PWLIBDIR=`$PTLIB_CONFIG --prefix`
112 if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
113 PWLIBDIR="/usr/share/pwlib/"
115 if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
116 PWLIBDIR="/usr/local/share/pwlib/"
118 if test "x$PWLIBDIR" = "x${prefix}"; then
119 PWLIBDIR="${prefix}/share/pwlib/"
123 echo "PWLib prefix set to.... $PWLIBDIR"
125 if test "${PWLIBDIR:-unset}" = "unset" ; then
126 PWVERSION=`$PTLIB_CONFIG --version`
127 PW_MAJOR_VERSION=`echo $PW_VERSION | cut -d'.' -f1`
128 PW_MINOR_VERSION=`echo $PW_VERSION | cut -d'.' -f2`
129 PW_BUILD_NUMBER=`echo $PW_VERSION | cut -d'.' -f3`
132 PW_MAJOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
133 PW_MINOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
134 PW_BUILD_NUMBER=`cat ${PWLIBDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
135 PWVERSION="${PW_MAJOR_VERSION}.${PW_MINOR_VERSION}.${PW_BUILD_NUMBER}"
138 AC_ARG_ENABLE(versioncheck,
139 [ --disable-versioncheck disable PWLib version check],
140 PWLIB_VERSION_CHECK=$enableval)
142 AC_MSG_CHECKING(Checking PWLib version ${PWVERSION})
143 if test "${PWLIB_VERSION_CHECK}x" = "nox" ; then
144 AC_MSG_RESULT(check disabled)
146 if test $PW_MAJOR_VERSION -lt $REQUIRED_PWLIB_MAJOR ; then
147 AC_MSG_ERROR(Major version less than required $REQUIRED_PWLIB_MAJOR)
149 if test $PW_MINOR_VERSION -lt $REQUIRED_PWLIB_MINOR ; then
150 AC_MSG_ERROR(Minor version less than required $REQUIRED_PWLIB_MINOR)
152 if test $PW_BUILD_NUMBER -lt $REQUIRED_PWLIB_BUILD ; then
153 AC_MSG_ERROR(Build version less than required $REQUIRED_PWLIB_BUILD)
160 dnl ########################################################################
161 dnl get the gcc version
163 if test x$GXX = xyes ; then
165 gcc_version=`$CXX -dumpversion`
166 AC_MSG_NOTICE(gcc version is $gcc_version);
167 GXX_MAJOR=`echo $gcc_version | sed 's/\..*$//'`
168 GXX_MINOR=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.//' -e 's/\..*$//'`]
169 GXX_PATCH=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.//' -e 's/\..*$//'`]
171 dnl cannot compile for less than gcc 3
172 AC_MSG_CHECKING(checking if gcc version is valid)
173 if test ${GXX_MAJOR} -lt 3 ; then
175 AC_MSG_ERROR([OPAL requires gcc version 3 or later])
181 dnl ########################################################################
182 dnl check for BSR instruction
184 AC_MSG_CHECKING(for working bit scan intrinsic)
187 int main(int argc, char* argv[]) {
189 unsigned int val = 0x00000FF0;
190 if (__builtin_clz(val) == 20)
195 AC_TRY_RUN($BSR_TEST_SRC, GCC_HAS_CLZ=1, GCC_HAS_CLZ=0, GCC_HAS_CLZ=1)
196 if test "${GCC_HAS_CLZ}" = "1" ; then
198 AC_DEFINE(GCC_HAS_CLZ, 1)
203 AC_SUBST(GCC_HAS_CLZ)
206 dnl ########################################################################
207 dnl Look for system libspeex
209 AC_ARG_ENABLE(localspeex,
210 [ --enable-localspeex use local version of Speex library rather than system version],
211 localspeex=$enableval)
213 AC_CHECK_SIZEOF(short)
215 AC_CHECK_SIZEOF(long)
216 AC_CHECK_SIZEOF(long long)
219 $ac_cv_sizeof_short) SIZE16="short";;
220 $ac_cv_sizeof_int) SIZE16="int";;
224 $ac_cv_sizeof_int) SIZE32="int";;
225 $ac_cv_sizeof_long) SIZE32="long";;
226 $ac_cv_sizeof_short) SIZE32="short";;
233 OPAL_HAVE_SPEEX_SPEEX_H=
234 AC_CHECK_HEADERS("speex.h", OPAL_HAVE_SPEEX_H=1)
235 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
236 AC_DEFINE(OPAL_HAVE_SPEEX_H)
238 AC_CHECK_HEADERS("speex/speex.h", OPAL_HAVE_SPEEX_SPEEX_H=1)
239 if test "${OPAL_HAVE_SPEEX_SPEEX_H}x" != "x" ; then
240 AC_DEFINE(OPAL_HAVE_SPEEX_SPEEX_H)
244 if test "${localspeex}" = "yes" ; then
245 AC_MSG_NOTICE(Forcing use of OPAL Speex sources)
246 elif test "${localspeex}" = "no" ; then
247 AC_MSG_NOTICE(Forcing use of system Speex library)
248 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
249 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
251 AC_CHECK_LIB(speex, speex_encoder_destroy, SPEEX=1)
252 if test "${SPEEX}x" != "x" ; then
253 AC_CHECK_LIB(speex, speex_encode_int, SPEEX=1, unset SPEEX)
255 if test "x$SPEEX" = "x" -o \( "${OPAL_HAVE_SPEEX_H}x" = "x" -a "${OPAL_HAVE_SPEEX_SPEEX_H}x" = "x" \); then
256 AC_MSG_NOTICE(Forcing use of OPAL Speex library)
258 AC_MSG_CHECKING(system Speex version)
259 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
260 echo "#include <speex.h>" > t.c
261 echo "#include <speex_header.h>" >> t.c
263 echo "#include <speex/speex.h>" > t.c
264 echo "#include <speex/speex_header.h>" >> t.c
268 int main(int argc,char *argv[])
271 speex_init_header(&header, 1, 1, &speex_nb_mode);
272 printf("%s\n", header.speex_version);
275 cc -o t t.c -lspeex > /dev/null 2>&1
276 if test \! -x t ; then
277 AC_MSG_RESULT(cannot determine - using OPAL version)
280 AC_MSG_RESULT($SYSVER)
281 AC_MSG_CHECKING(library Speex version)
282 LIBVER=`grep "#define SPEEX_VERSION" ./src/codec/speex/libspeex/misc.h | sed -e 's/^.*[Ss][Pp][Ee][Ee][Xx]\-//' -e 's/\"//' -e 's/\/.*//'`
283 AC_MSG_RESULT($LIBVER)
284 AC_MSG_CHECKING(Speex versions)
289 @lib = split /\./, \$libver;
293 @sys = split /\./, \$sysver;
299 if (@sys[\$i] < @lib[\$i]) {
308 SPEEX=`perl t.pl $SYSVER $LIBVER`
310 if test "x$SPEEX" = "x0" ; then
311 AC_MSG_RESULT(OPAL version is more recent)
313 AC_MSG_RESULT(system version is more recent)
314 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
315 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
316 AC_MSG_CHECKING(Speex noise type)
317 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
318 echo "#include <speex.h>" > t.c
319 echo "#include <speex_preprocess.h>" >> t.c
321 echo "#include <speex/speex.h>" > t.c
322 echo "#include <speex/speex_preprocess.h>" >> t.c
326 int main(int argc,char *argv[])
328 struct SpeexPreprocessState *st;
331 speex_preprocess(st, x, echo);
335 cc -Werror -o t t.c -lspeex > /dev/null 2>&1
336 if test \! -x t ; then
337 AC_MSG_RESULT(spx_int32_t)
340 AC_DEFINE(OPAL_SPEEX_FLOAT_NOISE)
348 AC_SUBST(OPAL_HAVE_SPEEX_SPEEX_H)
350 dnl ########################################################################
351 dnl enable audio, video, SIP, H.323 and IAX
353 dnl MSWIN_DISPLAY audio,Audio
354 dnl MSWIN_DEFINE audio,OPAL_AUDIO
357 [ --disable-audio disable audio codec support],
359 AC_MSG_CHECKING(audio codec support)
360 if test "$audio" = "yes" ; then
361 AC_SUBST(OPAL_AUDIO, 1)
362 AC_DEFINE(OPAL_AUDIO)
363 AC_MSG_RESULT(enabled)
365 AC_MSG_RESULT(disabled)
369 dnl MSWIN_DISPLAY video,Video
370 dnl MSWIN_DEFINE video,OPAL_VIDEO
374 [ --disable-video disable video codec support],
376 AC_MSG_CHECKING(video device support)
377 if test "$video" = "yes" ; then
378 AC_SUBST(OPAL_VIDEO, 1)
379 AC_DEFINE(OPAL_VIDEO)
380 AC_MSG_RESULT(enabled)
382 AC_MSG_RESULT(disabled)
386 dnl MSWIN_DISPLAY sip,SIP support
387 dnl MSWIN_DEFINE sip,OPAL_SIP
390 [ --disable-sip disable SIP protocol support],
392 AC_MSG_CHECKING(SIP protocol)
393 if test "$sip" = "yes" ; then
394 AC_SUBST(OPAL_SIP, 1)
396 AC_MSG_RESULT(enabled)
398 AC_MSG_RESULT(disabled)
402 dnl MSWIN_DISPLAY h323,H.323 support
403 dnl MSWIN_DEFINE h323,OPAL_H323
406 [ --disable-h323 disable H.323 protocol support],
408 AC_MSG_CHECKING(H.323 protocol)
409 if test "$h323" = "yes" ; then
410 AC_SUBST(OPAL_H323, 1)
412 AC_MSG_RESULT(enabled)
414 AC_SUBST(OPAL_H323, 0)
415 AC_MSG_RESULT(disabled (T.38, H.224, H.460 also disabled))
419 AC_SUBST(OPAL_H323, $OPAL_H323)
421 dnl ########################################################################
425 dnl MSWIN_DISPLAY iax2,IAX2 support
426 dnl MSWIN_DEFINE iax2,OPAL_IAX2
429 [ --disable-iax disable IAX2 protocol support],
431 AC_MSG_CHECKING(IAX2 protocol)
432 if test "$iax" = "yes" ; then
433 AC_SUBST(OPAL_IAX2, 1)
435 AC_MSG_RESULT(enabled)
437 AC_MSG_RESULT(disabled)
440 dnl ########################################################################
444 dnl MSWIN_DISPLAY h224,H.224 support
445 dnl MSWIN_DEFINE h224,OPAL_H224
448 [ --disable-h224 disable H.224 protocol support],
450 AC_MSG_CHECKING(H224 protocol)
451 if test "$h224" = "yes" ; then
452 AC_SUBST(OPAL_H224, 1)
454 AC_MSG_RESULT(enabled)
456 AC_MSG_RESULT(disabled)
459 dnl ########################################################################
463 dnl MSWIN_DISPLAY t38,T.38
464 dnl MSWIN_DEFINE t38,OPAL_T38FAX
466 if test "$t38" = "yes" ; then
468 [ --disable-t38 disable T.38 protocol support],
470 AC_MSG_CHECKING(T.38 protocol)
471 if test "$t38" = "yes" ; then
472 AC_SUBST(OPAL_T38FAX, 1)
473 AC_DEFINE(OPAL_T38FAX)
474 AC_MSG_RESULT(enabled)
476 AC_MSG_RESULT(disabled)
481 dnl ########################################################################
485 dnl MSWIN_DISPLAY h450,H.450
486 dnl MSWIN_DEFINE h450,OPAL_H450
487 dnl MSWIN_IF_FEATURE h450,h323
490 if test "$h450" = "yes" ; then
492 [ --disable-h450 disable H.450],
494 AC_MSG_CHECKING(H.450 support)
495 if test "$h450" = "yes" ; then
496 AC_SUBST(OPAL_H450, 1)
498 AC_MSG_RESULT(enabled)
500 AC_MSG_RESULT(disabled)
505 dnl ########################################################################
509 dnl MSWIN_DISPLAY h460,H.460
510 dnl MSWIN_DEFINE h460,OPAL_H460
511 dnl MSWIN_IF_FEATURE h460,h323
514 if test "$h460" = "yes" ; then
516 [ --disable-h460 disable H.460],
518 AC_MSG_CHECKING(H.460 support)
519 if test "$h460" = "yes" ; then
520 AC_SUBST(OPAL_H460, 1)
522 AC_MSG_RESULT(enabled)
524 AC_MSG_RESULT(disabled)
529 dnl ########################################################################
531 dnl LID, used for vpb, dialogic etc ...
533 dnl MSWIN_DISPLAY lids,Line Interface Device
534 dnl MSWIN_DEFINE lids,OPAL_LID
538 if test "$lid" = "yes" ; then
540 [ --disable-lid disable LID support],
542 AC_MSG_CHECKING(LID support)
543 if test "$lid" = "yes" ; then
544 AC_DEFINE(OPAL_LID, 1)
546 AC_MSG_RESULT(enabled)
548 AC_MSG_RESULT(disabled)
553 dnl ########################################################################
557 dnl MSWIN_DISPLAY ivr,IVR support
558 dnl MSWIN_DEFINE ivr,OPAL_IVR
562 if test "$ivr" = "yes" ; then
564 [ --disable-ivr disable IVR support],
566 AC_MSG_CHECKING(IVR support)
567 if test "$ivr" = "yes" ; then
568 AC_DEFINE(OPAL_IVR, 1)
570 AC_MSG_RESULT(enabled)
572 AC_MSG_RESULT(disabled)
580 dnl ########################################################################
582 dnl ZRTP from Phil Zimmermann
585 dnl MSWIN_DISPLAY libzrtp,ZRTP/SRTP support
586 dnl MSWIN_CHECK_FILE libzrtp,include\zrtp_types.h,HAS_LIBZRTP=1
587 dnl MSWIN_DIR_SYMBOL libzrtp,LIBZRTP_DIR
588 dnl MSWIN_CHECK_DIR libsrtp,.\srtp_win32k
589 dnl MSWIN_CHECK_DIR libzrtp,.\zrtp
590 dnl MSWIN_CHECK_DIR libzrtp,..\external\zrtp
591 dnl MSWIN_CHECK_DIR libzrtp,c:\libs
594 dnl AC_MSG_CHECKING(for libZRTP)
595 dnl AC_TRY_COMPILE([#include "srtp/srtp.h"],
596 dnl [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
598 dnl if test "${HAS_LIBSRTP}" = "1" ; then
599 dnl AC_MSG_RESULT(yes)
600 dnl AC_DEFINE(HAS_LIBSRTP, 1)
604 dnl AC_MSG_RESULT(no)
607 AC_SUBST(HAS_LIBZRTP)
610 dnl ########################################################################
615 dnl MSWIN_DISPLAY libsrtp,Cisco libSRTP support
616 dnl MSWIN_IF_FEATURE libsrtp,!libzrtp
617 dnl MSWIN_CHECK_FILE libsrtp,include\srtp.h,HAS_LIBSRTP=1
618 dnl MSWIN_DIR_SYMBOL libsrtp,LIBSRTP_DIR
619 dnl MSWIN_CHECK_DIR libsrtp,.\srtp
620 dnl MSWIN_CHECK_DIR libsrtp,..\external\srtp
621 dnl MSWIN_CHECK_DIR libsrtp,c:\libs
624 AC_MSG_CHECKING(for libSRTP)
625 AC_TRY_COMPILE([#include "srtp/srtp.h"],
626 [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
628 if test "${HAS_LIBSRTP}" = "1" ; then
630 AC_DEFINE(HAS_LIBSRTP, 1)
637 AC_SUBST(HAS_LIBSRTP)
638 dnl ########################################################################
639 dnl output make directives
646 dnl ########################################################################
647 dnl Output configured files
649 AC_CONFIG_SUBDIRS(plugins)
651 dnl ########################################################################
652 dnl output header file
654 AC_CONFIG_FILES(opal_inc.mak)
655 AC_CONFIG_FILES(Makefile)
656 AC_CONFIG_HEADERS(include/opal/buildopts.h)
657 AC_CONFIG_FILES(opal.pc)
658 AC_CONFIG_FILES(opal.spec)
659 AC_CONFIG_FILES(opal_cfg.dxy)
661 AC_OUTPUT(src/codec/speex/libspeex/speex_config_types.h)