1 AC_INIT(include/opal/manager.h)
6 dnl this must be updated for every minor revision, and for
7 dnl builds when and as necessary
9 REQUIRED_PWLIB_MINOR=11
10 REQUIRED_PWLIB_BUILD=0
12 dnl ########################################################################
13 dnl set the OPAL directory to the current directory
18 dnl ########################################################################
19 dnl set the PREFIX accordingly
20 if test "x$prefix" = "xNONE"; then
21 INSTALLPREFIX="/usr/local"
23 INSTALLPREFIX="${prefix}"
26 AC_SUBST(INSTALLPREFIX)
28 dnl ########################################################################
29 dnl set LIBDIR accordingly
34 dnl ########################################################################
35 dnl extract the OPAL version
37 dnl MSWIN_DISPLAY version,Version
38 dnl MSWIN_VERSION version,OPAL_MAJOR=MAJOR_VERSION
39 dnl MSWIN_VERSION version,OPAL_MINOR=MINOR_VERSION
40 dnl MSWIN_VERSION version,OPAL_BUILD=BUILD_NUMBER
41 dnl MSWIN_VERSION version,OPAL_VERSION=VERSION
43 MAJOR_VERSION=`cat ${OPALDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
44 MINOR_VERSION=`cat ${OPALDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
45 BUILD_NUMBER=`cat ${OPALDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
46 OPAL_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}"
47 AC_DEFINE_UNQUOTED(OPAL_MAJOR, ${MAJOR_VERSION})
48 AC_DEFINE_UNQUOTED(OPAL_MINOR, ${MINOR_VERSION})
49 AC_DEFINE_UNQUOTED(OPAL_BUILD, ${BUILD_NUMBER})
50 AC_DEFINE_UNQUOTED(OPAL_VERSION, "$OPAL_VERSION")
53 dnl ########################################################################
54 dnl look for ptlib, use a preference order of explicit PWLIBDIR, directory
55 dnl at same level, home directory, /usr/local or /usr.
57 if test "${PWLIBDIR:-unset}" != "unset" ; then
58 AC_CHECK_FILE(${PWLIBDIR}/version.h, HAS_PTLIB=1)
60 if test "${HAS_PTLIB:-unset}" = "unset" ; then
61 AC_CHECK_FILE(${OPALDIR}/../pwlib/version.h, HAS_PTLIB=1)
62 if test "${HAS_PTLIB:-unset}" != "unset" ; then
63 PWLIBDIR="${OPALDIR}/../pwlib"
65 AC_CHECK_FILE(${HOME}/pwlib/include/ptlib.h, HAS_PTLIB=1)
66 if test "${HAS_PTLIB:-unset}" != "unset" ; then
67 PWLIBDIR="${HOME}/pwlib"
69 AC_CHECK_FILE(/usr/local/include/ptlib.h, HAS_PTLIB=1)
70 if test "${HAS_PTLIB:-unset}" != "unset" ; then
71 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin)
73 AC_CHECK_FILE(/usr/include/ptlib.h, HAS_PTLIB=1)
74 if test "${HAS_PTLIB:-unset}" != "unset" ; then
75 AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/share/pwlib/make/)
82 if test "${HAS_PTLIB:-unset}" = "unset" ; then
83 echo "Cannot find pwlib - please install or set PWLIBDIR and try again"
87 if test "${PWLIBDIR:-unset}" = "unset" ; then
88 if test "${PTLIB_CONFIG:-unset}" = "unset" ; then
89 echo "Cannot find ptlib-config - please install and try again"
92 PWLIBDIR=`$PTLIB_CONFIG --prefix`
95 if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
96 PWLIBDIR="/usr/share/pwlib/"
98 if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
99 PWLIBDIR="/usr/local/share/pwlib/"
103 echo "PWLib prefix set to.... $PWLIBDIR"
105 if test "${PWLIBDIR:-unset}" = "unset" ; then
106 PWVERSION=`$PTLIB_CONFIG --version`
107 PW_MAJOR_VERSION=`echo $PW_VERSION | cut -d'.' -f1`
108 PW_MINOR_VERSION=`echo $PW_VERSION | cut -d'.' -f2`
109 PW_BUILD_NUMBER=`echo $PW_VERSION | cut -d'.' -f3`
112 PW_MAJOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
113 PW_MINOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
114 PW_BUILD_NUMBER=`cat ${PWLIBDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
115 PWVERSION="${PW_MAJOR_VERSION}.${PW_MINOR_VERSION}.${PW_BUILD_NUMBER}"
118 AC_ARG_ENABLE(versioncheck,
119 [ --disable-versioncheck disable PWLib version check],
120 PWLIB_VERSION_CHECK=$enableval)
122 AC_MSG_CHECKING(Checking PWLib version ${PWVERSION})
123 if test "${PWLIB_VERSION_CHECK}x" = "nox" ; then
124 AC_MSG_RESULT(check disabled)
126 if test $PW_MAJOR_VERSION -lt $REQUIRED_PWLIB_MAJOR ; then
127 AC_MSG_RESULT(Major version less than required $REQUIRED_PWLIB_MAJOR)
130 if test $PW_MINOR_VERSION -lt $REQUIRED_PWLIB_MINOR ; then
131 AC_MSG_RESULT(Minor version less than required $REQUIRED_PWLIB_MINOR)
134 if test $PW_BUILD_NUMBER -lt $REQUIRED_PWLIB_BUILD ; then
135 AC_MSG_RESULT(Build version less than required $REQUIRED_PWLIB_BUILD)
143 dnl ########################################################################
144 dnl get the gcc version
146 if test x$GXX = xyes ; then
148 gcc_version=`$CXX -dumpversion`
149 AC_MSG_NOTICE(gcc version is $gcc_version);
150 GXX_MAJOR=`echo $gcc_version | sed 's/\..*$//'`
151 GXX_MINOR=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.//' -e 's/\..*$//'`]
152 GXX_PATCH=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.//' -e 's/\..*$//'`]
154 dnl cannot compile for less than gcc 3
155 AC_MSG_CHECKING(checking if gcc version is valid)
156 if test ${GXX_MAJOR} -lt 3 ; then
158 AC_MSG_ERROR([OPAL requires gcc version 3 or later])
165 dnl ########################################################################
166 dnl Look for system libspeex
168 AC_ARG_ENABLE(localspeex,
169 [ --enable-localspeex use local version of Speex library rather than system version],
170 localspeex=$enableval)
172 AC_CHECK_SIZEOF(short)
174 AC_CHECK_SIZEOF(long)
175 AC_CHECK_SIZEOF(long long)
178 $ac_cv_sizeof_short) SIZE16="short";;
179 $ac_cv_sizeof_int) SIZE16="int";;
183 $ac_cv_sizeof_int) SIZE32="int";;
184 $ac_cv_sizeof_long) SIZE32="long";;
185 $ac_cv_sizeof_short) SIZE32="short";;
192 OPAL_HAVE_SPEEX_SPEEX_H=
193 AC_CHECK_HEADERS("speex.h", OPAL_HAVE_SPEEX_H=1)
194 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
195 AC_DEFINE(OPAL_HAVE_SPEEX_H)
197 AC_CHECK_HEADERS("speex/speex.h", OPAL_HAVE_SPEEX_SPEEX_H=1)
198 if test "${OPAL_HAVE_SPEEX_SPEEX_H}x" != "x" ; then
199 AC_DEFINE(OPAL_HAVE_SPEEX_SPEEX_H)
203 if test "${localspeex}" = "yes" ; then
204 AC_MSG_NOTICE(Forcing use of OPAL Speex sources)
205 elif test "${localspeex}" = "no" ; then
206 AC_MSG_NOTICE(Forcing use of system Speex library)
207 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
208 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
210 AC_CHECK_LIB(speex, speex_encoder_destroy, SPEEX=1)
211 if test "${SPEEX}x" != "x" ; then
212 AC_CHECK_LIB(speex, speex_encode_int, SPEEX=1, unset SPEEX)
214 if test "x$SPEEX" = "x" -o \( "${OPAL_HAVE_SPEEX_H}x" = "x" -a "${OPAL_HAVE_SPEEX_SPEEX_H}x" = "x" \); then
215 AC_MSG_NOTICE(Forcing use of OPAL Speex library)
217 AC_MSG_CHECKING(system Speex version)
218 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
219 echo "#include <speex.h>" > t.c
220 echo "#include <speex_header.h>" >> t.c
222 echo "#include <speex/speex.h>" > t.c
223 echo "#include <speex/speex_header.h>" >> t.c
227 int main(int argc,char *argv[])
230 speex_init_header(&header, 1, 1, &speex_nb_mode);
231 printf("%s\n", header.speex_version);
234 cc -o t t.c -lspeex > /dev/null 2>&1
235 if test \! -x t ; then
236 AC_MSG_RESULT(cannot determine - using OPAL version)
239 AC_MSG_RESULT($SYSVER)
240 AC_MSG_CHECKING(library Speex version)
241 LIBVER=`grep "#define SPEEX_VERSION" ./src/codec/speex/libspeex/misc.h | sed -e 's/^.*[Ss][Pp][Ee][Ee][Xx]\-//' -e 's/\"//' -e 's/\/.*//'`
242 AC_MSG_RESULT($LIBVER)
243 AC_MSG_CHECKING(Speex versions)
248 @lib = split /\./, \$libver;
252 @sys = split /\./, \$sysver;
258 if (@sys[\$i] < @lib[\$i]) {
267 SPEEX=`perl t.pl $SYSVER $LIBVER`
269 if test "x$SPEEX" = "x0" ; then
270 AC_MSG_RESULT(OPAL version is more recent)
272 AC_MSG_RESULT(system version is more recent)
273 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
274 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
275 AC_MSG_CHECKING(Speex noise type)
276 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
277 echo "#include <speex.h>" > t.c
278 echo "#include <speex_preprocess.h>" >> t.c
280 echo "#include <speex/speex.h>" > t.c
281 echo "#include <speex/speex_preprocess.h>" >> t.c
285 int main(int argc,char *argv[])
287 struct SpeexPreprocessState *st;
290 speex_preprocess(st, x, echo);
294 cc -Werror -o t t.c -lspeex > /dev/null 2>&1
295 if test \! -x t ; then
296 AC_MSG_RESULT(spx_int32_t)
299 AC_DEFINE(OPAL_SPEEX_FLOAT_NOISE)
307 AC_SUBST(OPAL_HAVE_SPEEX_SPEEX_H)
309 dnl ########################################################################
310 dnl enable audio, video, SIP, H.323 and IAX
312 dnl MSWIN_DISPLAY audio,Audio
313 dnl MSWIN_DEFINE audio,OPAL_AUDIO
317 [ --disable-audio disable audio codec support],
319 AC_MSG_CHECKING(audio codec support)
320 if test "$audio" = "yes" ; then
321 AC_SUBST(OPAL_AUDIO, 1)
322 AC_DEFINE(OPAL_AUDIO)
323 AC_MSG_RESULT(enabled)
325 AC_MSG_RESULT(disabled)
329 dnl MSWIN_DISPLAY video,Video
330 dnl MSWIN_DEFINE video,OPAL_VIDEO
334 [ --disable-video disable video codec support],
336 AC_MSG_CHECKING(video device support)
337 if test "$video" = "yes" ; then
338 AC_SUBST(OPAL_VIDEO, 1)
339 AC_DEFINE(OPAL_VIDEO)
340 AC_MSG_RESULT(enabled)
342 AC_MSG_RESULT(disabled)
346 dnl MSWIN_DISPLAY sip,SIP support
347 dnl MSWIN_DEFINE sip,OPAL_SIP
351 [ --disable-sip disable SIP protocol support],
353 AC_MSG_CHECKING(SIP protocol)
354 if test "$sip" = "yes" ; then
355 AC_SUBST(OPAL_SIP, 1)
357 AC_MSG_RESULT(enabled)
359 AC_MSG_RESULT(disabled)
363 dnl MSWIN_DISPLAY h323,H.323 support
364 dnl MSWIN_DEFINE h323,OPAL_H323
371 [ --disable-h323 disable H.323 protocol support],
373 AC_MSG_CHECKING(H.323 protocol)
374 if test "$h323" = "yes" ; then
375 AC_SUBST(OPAL_H323, 1)
377 AC_MSG_RESULT(enabled)
379 AC_SUBST(OPAL_H323, 0)
380 AC_MSG_RESULT(disabled (T.38, H.224, H.460 also disabled))
385 AC_SUBST(OPAL_H323, $OPAL_H323)
388 dnl MSWIN_DISPLAY iax2,IAX2 support
389 dnl MSWIN_DEFINE iax2,OPAL_IAX2
393 [ --disable-iax disable IAX2 protocol support],
395 AC_MSG_CHECKING(IAX2 protocol)
396 if test "$iax" = "yes" ; then
397 AC_SUBST(OPAL_IAX2, 1)
399 AC_MSG_RESULT(enabled)
401 AC_MSG_RESULT(disabled)
404 dnl MSWIN_DISPLAY h224,H.224 support
405 dnl MSWIN_DEFINE h224,OPAL_H224
408 [ --disable-h224 disable H.224 protocol support],
410 AC_MSG_CHECKING(H224 protocol)
411 if test "$h224" = "yes" ; then
412 AC_SUBST(OPAL_H224, 1)
414 AC_MSG_RESULT(enabled)
416 AC_MSG_RESULT(disabled)
419 dnl ########################################################################
423 dnl MSWIN_DISPLAY t38,T.38
424 dnl MSWIN_DEFINE t38,OPAL_T38FAX
425 dnl MSWIN_IF_FEATURE t38,h323
427 if test "$t38" = "yes" ; then
429 [ --disable-t38 disable T.38 protocol support],
431 AC_MSG_CHECKING(T.38 protocol)
432 if test "$t38" = "yes" ; then
433 AC_SUBST(OPAL_T38FAX, 1)
434 AC_DEFINE(OPAL_T38FAX)
435 AC_MSG_RESULT(enabled)
437 AC_MSG_RESULT(disabled)
442 dnl ########################################################################
446 dnl MSWIN_DISPLAY h460,H.460
447 dnl MSWIN_DEFINE h460,H323_H460
450 if test "$h460" = "yes" ; then
452 [ --disable-h460 disable H.460],
454 AC_MSG_CHECKING(H.460 support)
455 if test "$h460" = "yes" ; then
456 AC_SUBST(H323_H460, 1)
458 AC_MSG_RESULT(enabled)
460 AC_MSG_RESULT(disabled)
465 dnl ########################################################################
467 dnl LID, used for vpb, dialogic etc ...
469 dnl MSWIN_DISPLAY lids,Line Interface Device
470 dnl MSWIN_DEFINE lids,OPAL_LID
474 if test "$lid" = "yes" ; then
476 [ --disable-lid disable LID support],
478 AC_MSG_CHECKING(LID support)
479 if test "$lid" = "yes" ; then
480 AC_DEFINE(OPAL_LID, 1)
482 AC_MSG_RESULT(enabled)
484 AC_MSG_RESULT(disabled)
489 dnl ########################################################################
493 dnl MSWIN_DISPLAY ivr,IVR support
494 dnl MSWIN_DEFINE ivr,OPAL_IVR
498 if test "$ivr" = "yes" ; then
500 [ --disable-ivr disable IVR support],
502 AC_MSG_CHECKING(IVR support)
503 if test "$ivr" = "yes" ; then
504 AC_DEFINE(OPAL_IVR, 1)
506 AC_MSG_RESULT(enabled)
508 AC_MSG_RESULT(disabled)
514 dnl ########################################################################
519 dnl MSWIN_DISPLAY libsrtp,Cisco libSRTP support
520 dnl MSWIN_CHECK_FILE libsrtp,include\srtp.h,HAS_LIBSRTP=1
521 dnl MSWIN_DIR_SYMBOL libsrtp,LIBSRTP_DIR
522 dnl MSWIN_CHECK_DIR libsrtp,.\srtp
523 dnl MSWIN_CHECK_DIR libsrtp,..\external\srtp
524 dnl MSWIN_CHECK_DIR libsrtp,c:\libs
527 AC_MSG_CHECKING(for libSRTP)
528 AC_TRY_COMPILE([#include "srtp/srtp.h"],
529 [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
531 if test "${HAS_LIBSRTP}" = "1" ; then
533 AC_DEFINE(HAS_LIBSRTP, 1)
540 AC_SUBST(HAS_LIBSRTP)
543 dnl ########################################################################
544 dnl output make directives
551 dnl ########################################################################
552 dnl Output configured files
554 AC_CONFIG_SUBDIRS(plugins)
556 dnl ########################################################################
557 dnl output header file
559 AC_CONFIG_FILES(opal_inc.mak)
560 AC_CONFIG_FILES(Makefile)
561 AC_CONFIG_HEADERS(include/opal/buildopts.h)
563 AC_OUTPUT(src/codec/speex/libspeex/speex_config_types.h)