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])
182 dnl ########################################################################
183 dnl Look for system libspeex
185 AC_ARG_ENABLE(localspeex,
186 [ --enable-localspeex use local version of Speex library rather than system version],
187 localspeex=$enableval)
189 AC_CHECK_SIZEOF(short)
191 AC_CHECK_SIZEOF(long)
192 AC_CHECK_SIZEOF(long long)
195 $ac_cv_sizeof_short) SIZE16="short";;
196 $ac_cv_sizeof_int) SIZE16="int";;
200 $ac_cv_sizeof_int) SIZE32="int";;
201 $ac_cv_sizeof_long) SIZE32="long";;
202 $ac_cv_sizeof_short) SIZE32="short";;
209 OPAL_HAVE_SPEEX_SPEEX_H=
210 AC_CHECK_HEADERS("speex.h", OPAL_HAVE_SPEEX_H=1)
211 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
212 AC_DEFINE(OPAL_HAVE_SPEEX_H)
214 AC_CHECK_HEADERS("speex/speex.h", OPAL_HAVE_SPEEX_SPEEX_H=1)
215 if test "${OPAL_HAVE_SPEEX_SPEEX_H}x" != "x" ; then
216 AC_DEFINE(OPAL_HAVE_SPEEX_SPEEX_H)
220 if test "${localspeex}" = "yes" ; then
221 AC_MSG_NOTICE(Forcing use of OPAL Speex sources)
222 elif test "${localspeex}" = "no" ; then
223 AC_MSG_NOTICE(Forcing use of system Speex library)
224 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
225 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
227 AC_CHECK_LIB(speex, speex_encoder_destroy, SPEEX=1)
228 if test "${SPEEX}x" != "x" ; then
229 AC_CHECK_LIB(speex, speex_encode_int, SPEEX=1, unset SPEEX)
231 if test "x$SPEEX" = "x" -o \( "${OPAL_HAVE_SPEEX_H}x" = "x" -a "${OPAL_HAVE_SPEEX_SPEEX_H}x" = "x" \); then
232 AC_MSG_NOTICE(Forcing use of OPAL Speex library)
234 AC_MSG_CHECKING(system Speex version)
235 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
236 echo "#include <speex.h>" > t.c
237 echo "#include <speex_header.h>" >> t.c
239 echo "#include <speex/speex.h>" > t.c
240 echo "#include <speex/speex_header.h>" >> t.c
244 int main(int argc,char *argv[])
247 speex_init_header(&header, 1, 1, &speex_nb_mode);
248 printf("%s\n", header.speex_version);
251 cc -o t t.c -lspeex > /dev/null 2>&1
252 if test \! -x t ; then
253 AC_MSG_RESULT(cannot determine - using OPAL version)
256 AC_MSG_RESULT($SYSVER)
257 AC_MSG_CHECKING(library Speex version)
258 LIBVER=`grep "#define SPEEX_VERSION" ./src/codec/speex/libspeex/misc.h | sed -e 's/^.*[Ss][Pp][Ee][Ee][Xx]\-//' -e 's/\"//' -e 's/\/.*//'`
259 AC_MSG_RESULT($LIBVER)
260 AC_MSG_CHECKING(Speex versions)
265 @lib = split /\./, \$libver;
269 @sys = split /\./, \$sysver;
275 if (@sys[\$i] < @lib[\$i]) {
284 SPEEX=`perl t.pl $SYSVER $LIBVER`
286 if test "x$SPEEX" = "x0" ; then
287 AC_MSG_RESULT(OPAL version is more recent)
289 AC_MSG_RESULT(system version is more recent)
290 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
291 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
292 AC_MSG_CHECKING(Speex noise type)
293 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
294 echo "#include <speex.h>" > t.c
295 echo "#include <speex_preprocess.h>" >> t.c
297 echo "#include <speex/speex.h>" > t.c
298 echo "#include <speex/speex_preprocess.h>" >> t.c
302 int main(int argc,char *argv[])
304 struct SpeexPreprocessState *st;
307 speex_preprocess(st, x, echo);
311 cc -Werror -o t t.c -lspeex > /dev/null 2>&1
312 if test \! -x t ; then
313 AC_MSG_RESULT(spx_int32_t)
316 AC_DEFINE(OPAL_SPEEX_FLOAT_NOISE)
324 AC_SUBST(OPAL_HAVE_SPEEX_SPEEX_H)
326 dnl ########################################################################
327 dnl enable audio, video, SIP, H.323 and IAX
329 dnl MSWIN_DISPLAY audio,Audio
330 dnl MSWIN_DEFINE audio,OPAL_AUDIO
333 [ --disable-audio disable audio codec support],
335 AC_MSG_CHECKING(audio codec support)
336 if test "$audio" = "yes" ; then
337 AC_SUBST(OPAL_AUDIO, 1)
338 AC_DEFINE(OPAL_AUDIO)
339 AC_MSG_RESULT(enabled)
341 AC_MSG_RESULT(disabled)
345 dnl MSWIN_DISPLAY video,Video
346 dnl MSWIN_DEFINE video,OPAL_VIDEO
350 [ --disable-video disable video codec support],
352 AC_MSG_CHECKING(video device support)
353 if test "$video" = "yes" ; then
354 AC_SUBST(OPAL_VIDEO, 1)
355 AC_DEFINE(OPAL_VIDEO)
356 AC_MSG_RESULT(enabled)
358 AC_MSG_RESULT(disabled)
362 dnl MSWIN_DISPLAY sip,SIP support
363 dnl MSWIN_DEFINE sip,OPAL_SIP
366 [ --disable-sip disable SIP protocol support],
368 AC_MSG_CHECKING(SIP protocol)
369 if test "$sip" = "yes" ; then
370 AC_SUBST(OPAL_SIP, 1)
372 AC_MSG_RESULT(enabled)
374 AC_MSG_RESULT(disabled)
378 dnl MSWIN_DISPLAY h323,H.323 support
379 dnl MSWIN_DEFINE h323,OPAL_H323
382 [ --disable-h323 disable H.323 protocol support],
384 AC_MSG_CHECKING(H.323 protocol)
385 if test "$h323" = "yes" ; then
386 AC_SUBST(OPAL_H323, 1)
388 AC_MSG_RESULT(enabled)
390 AC_SUBST(OPAL_H323, 0)
391 AC_MSG_RESULT(disabled (T.38, H.224, H.460 also disabled))
395 AC_SUBST(OPAL_H323, $OPAL_H323)
397 dnl ########################################################################
401 dnl MSWIN_DISPLAY iax2,IAX2 support
402 dnl MSWIN_DEFINE iax2,OPAL_IAX2
405 [ --disable-iax disable IAX2 protocol support],
407 AC_MSG_CHECKING(IAX2 protocol)
408 if test "$iax" = "yes" ; then
409 AC_SUBST(OPAL_IAX2, 1)
411 AC_MSG_RESULT(enabled)
413 AC_MSG_RESULT(disabled)
416 dnl ########################################################################
420 dnl MSWIN_DISPLAY h224,H.224 support
421 dnl MSWIN_DEFINE h224,OPAL_H224
424 [ --disable-h224 disable H.224 protocol support],
426 AC_MSG_CHECKING(H224 protocol)
427 if test "$h224" = "yes" ; then
428 AC_SUBST(OPAL_H224, 1)
430 AC_MSG_RESULT(enabled)
432 AC_MSG_RESULT(disabled)
435 dnl ########################################################################
439 dnl MSWIN_DISPLAY t38,T.38
440 dnl MSWIN_DEFINE t38,OPAL_T38FAX
442 if test "$t38" = "yes" ; then
444 [ --disable-t38 disable T.38 protocol support],
446 AC_MSG_CHECKING(T.38 protocol)
447 if test "$t38" = "yes" ; then
448 AC_SUBST(OPAL_T38FAX, 1)
449 AC_DEFINE(OPAL_T38FAX)
450 AC_MSG_RESULT(enabled)
452 AC_MSG_RESULT(disabled)
457 dnl ########################################################################
461 dnl MSWIN_DISPLAY h450,H.450
462 dnl MSWIN_DEFINE h450,OPAL_H450
463 dnl MSWIN_IF_FEATURE h450,h323
466 if test "$h450" = "yes" ; then
468 [ --disable-h450 disable H.450],
470 AC_MSG_CHECKING(H.450 support)
471 if test "$h450" = "yes" ; then
472 AC_SUBST(OPAL_H450, 1)
474 AC_MSG_RESULT(enabled)
476 AC_MSG_RESULT(disabled)
481 dnl ########################################################################
485 dnl MSWIN_DISPLAY h460,H.460
486 dnl MSWIN_DEFINE h460,OPAL_H460
487 dnl MSWIN_IF_FEATURE h460,h323
490 if test "$h460" = "yes" ; then
492 [ --disable-h460 disable H.460],
494 AC_MSG_CHECKING(H.460 support)
495 if test "$h460" = "yes" ; then
496 AC_SUBST(OPAL_H460, 1)
498 AC_MSG_RESULT(enabled)
500 AC_MSG_RESULT(disabled)
505 dnl ########################################################################
507 dnl LID, used for vpb, dialogic etc ...
509 dnl MSWIN_DISPLAY lids,Line Interface Device
510 dnl MSWIN_DEFINE lids,OPAL_LID
514 if test "$lid" = "yes" ; then
516 [ --disable-lid disable LID support],
518 AC_MSG_CHECKING(LID support)
519 if test "$lid" = "yes" ; then
520 AC_DEFINE(OPAL_LID, 1)
522 AC_MSG_RESULT(enabled)
524 AC_MSG_RESULT(disabled)
529 dnl ########################################################################
533 dnl MSWIN_DISPLAY ivr,IVR support
534 dnl MSWIN_DEFINE ivr,OPAL_IVR
538 if test "$ivr" = "yes" ; then
540 [ --disable-ivr disable IVR support],
542 AC_MSG_CHECKING(IVR support)
543 if test "$ivr" = "yes" ; then
544 AC_DEFINE(OPAL_IVR, 1)
546 AC_MSG_RESULT(enabled)
548 AC_MSG_RESULT(disabled)
556 dnl ########################################################################
558 dnl ZRTP from Phil Zimmermann
561 dnl MSWIN_DISPLAY libzrtp,ZRTP/SRTP support
562 dnl MSWIN_CHECK_FILE libzrtp,include\zrtp_types.h,HAS_LIBZRTP=1
563 dnl MSWIN_DIR_SYMBOL libzrtp,LIBZRTP_DIR
564 dnl MSWIN_CHECK_DIR libsrtp,.\srtp_win32k
565 dnl MSWIN_CHECK_DIR libzrtp,.\zrtp
566 dnl MSWIN_CHECK_DIR libzrtp,..\external\zrtp
567 dnl MSWIN_CHECK_DIR libzrtp,c:\libs
570 dnl AC_MSG_CHECKING(for libZRTP)
571 dnl AC_TRY_COMPILE([#include "srtp/srtp.h"],
572 dnl [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
574 dnl if test "${HAS_LIBSRTP}" = "1" ; then
575 dnl AC_MSG_RESULT(yes)
576 dnl AC_DEFINE(HAS_LIBSRTP, 1)
580 dnl AC_MSG_RESULT(no)
583 AC_SUBST(HAS_LIBZRTP)
586 dnl ########################################################################
591 dnl MSWIN_DISPLAY libsrtp,Cisco libSRTP support
592 dnl MSWIN_IF_FEATURE libsrtp,!libzrtp
593 dnl MSWIN_CHECK_FILE libsrtp,include\srtp.h,HAS_LIBSRTP=1
594 dnl MSWIN_DIR_SYMBOL libsrtp,LIBSRTP_DIR
595 dnl MSWIN_CHECK_DIR libsrtp,.\srtp
596 dnl MSWIN_CHECK_DIR libsrtp,..\external\srtp
597 dnl MSWIN_CHECK_DIR libsrtp,c:\libs
600 AC_MSG_CHECKING(for libSRTP)
601 AC_TRY_COMPILE([#include "srtp/srtp.h"],
602 [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
604 if test "${HAS_LIBSRTP}" = "1" ; then
606 AC_DEFINE(HAS_LIBSRTP, 1)
613 AC_SUBST(HAS_LIBSRTP)
614 dnl ########################################################################
615 dnl output make directives
622 dnl ########################################################################
623 dnl Output configured files
625 AC_CONFIG_SUBDIRS(plugins)
627 dnl ########################################################################
628 dnl output header file
630 AC_CONFIG_FILES(opal_inc.mak)
631 AC_CONFIG_FILES(Makefile)
632 AC_CONFIG_HEADERS(include/opal/buildopts.h)
633 AC_CONFIG_FILES(opal.pc)
634 AC_CONFIG_FILES(opal.spec)
635 AC_CONFIG_FILES(opal_cfg.dxy)
637 AC_OUTPUT(src/codec/speex/libspeex/speex_config_types.h)