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 AC_MSG_ERROR("Cannot find pwlib - please install or set PWLIBDIR and try again")
86 if test "${PWLIBDIR:-unset}" = "unset" ; then
87 if test "${PTLIB_CONFIG:-unset}" = "unset" ; then
88 AC_MSG_ERROR("Cannot find ptlib-config - please install and try again")
90 PWLIBDIR=`$PTLIB_CONFIG --prefix`
93 if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then
94 PWLIBDIR="/usr/share/pwlib/"
96 if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then
97 PWLIBDIR="/usr/local/share/pwlib/"
101 echo "PWLib prefix set to.... $PWLIBDIR"
103 if test "${PWLIBDIR:-unset}" = "unset" ; then
104 PWVERSION=`$PTLIB_CONFIG --version`
105 PW_MAJOR_VERSION=`echo $PW_VERSION | cut -d'.' -f1`
106 PW_MINOR_VERSION=`echo $PW_VERSION | cut -d'.' -f2`
107 PW_BUILD_NUMBER=`echo $PW_VERSION | cut -d'.' -f3`
110 PW_MAJOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
111 PW_MINOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
112 PW_BUILD_NUMBER=`cat ${PWLIBDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
113 PWVERSION="${PW_MAJOR_VERSION}.${PW_MINOR_VERSION}.${PW_BUILD_NUMBER}"
116 AC_ARG_ENABLE(versioncheck,
117 [ --disable-versioncheck disable PWLib version check],
118 PWLIB_VERSION_CHECK=$enableval)
120 AC_MSG_CHECKING(Checking PWLib version ${PWVERSION})
121 if test "${PWLIB_VERSION_CHECK}x" = "nox" ; then
122 AC_MSG_RESULT(check disabled)
124 if test $PW_MAJOR_VERSION -lt $REQUIRED_PWLIB_MAJOR ; then
125 AC_MSG_ERROR(Major version less than required $REQUIRED_PWLIB_MAJOR)
127 if test $PW_MINOR_VERSION -lt $REQUIRED_PWLIB_MINOR ; then
128 AC_MSG_ERROR(Minor version less than required $REQUIRED_PWLIB_MINOR)
130 if test $PW_BUILD_NUMBER -lt $REQUIRED_PWLIB_BUILD ; then
131 AC_MSG_ERROR(Build version less than required $REQUIRED_PWLIB_BUILD)
138 dnl ########################################################################
139 dnl get the gcc version
141 if test x$GXX = xyes ; then
143 gcc_version=`$CXX -dumpversion`
144 AC_MSG_NOTICE(gcc version is $gcc_version);
145 GXX_MAJOR=`echo $gcc_version | sed 's/\..*$//'`
146 GXX_MINOR=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.//' -e 's/\..*$//'`]
147 GXX_PATCH=[`echo $gcc_version | sed -e 's/[0-9][0-9]*\.[0-9][0-9]*\.//' -e 's/\..*$//'`]
149 dnl cannot compile for less than gcc 3
150 AC_MSG_CHECKING(checking if gcc version is valid)
151 if test ${GXX_MAJOR} -lt 3 ; then
153 AC_MSG_ERROR([OPAL requires gcc version 3 or later])
160 dnl ########################################################################
161 dnl Look for system libspeex
163 AC_ARG_ENABLE(localspeex,
164 [ --enable-localspeex use local version of Speex library rather than system version],
165 localspeex=$enableval)
167 AC_CHECK_SIZEOF(short)
169 AC_CHECK_SIZEOF(long)
170 AC_CHECK_SIZEOF(long long)
173 $ac_cv_sizeof_short) SIZE16="short";;
174 $ac_cv_sizeof_int) SIZE16="int";;
178 $ac_cv_sizeof_int) SIZE32="int";;
179 $ac_cv_sizeof_long) SIZE32="long";;
180 $ac_cv_sizeof_short) SIZE32="short";;
187 OPAL_HAVE_SPEEX_SPEEX_H=
188 AC_CHECK_HEADERS("speex.h", OPAL_HAVE_SPEEX_H=1)
189 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
190 AC_DEFINE(OPAL_HAVE_SPEEX_H)
192 AC_CHECK_HEADERS("speex/speex.h", OPAL_HAVE_SPEEX_SPEEX_H=1)
193 if test "${OPAL_HAVE_SPEEX_SPEEX_H}x" != "x" ; then
194 AC_DEFINE(OPAL_HAVE_SPEEX_SPEEX_H)
198 if test "${localspeex}" = "yes" ; then
199 AC_MSG_NOTICE(Forcing use of OPAL Speex sources)
200 elif test "${localspeex}" = "no" ; then
201 AC_MSG_NOTICE(Forcing use of system Speex library)
202 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
203 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
205 AC_CHECK_LIB(speex, speex_encoder_destroy, SPEEX=1)
206 if test "${SPEEX}x" != "x" ; then
207 AC_CHECK_LIB(speex, speex_encode_int, SPEEX=1, unset SPEEX)
209 if test "x$SPEEX" = "x" -o \( "${OPAL_HAVE_SPEEX_H}x" = "x" -a "${OPAL_HAVE_SPEEX_SPEEX_H}x" = "x" \); then
210 AC_MSG_NOTICE(Forcing use of OPAL Speex library)
212 AC_MSG_CHECKING(system Speex version)
213 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
214 echo "#include <speex.h>" > t.c
215 echo "#include <speex_header.h>" >> t.c
217 echo "#include <speex/speex.h>" > t.c
218 echo "#include <speex/speex_header.h>" >> t.c
222 int main(int argc,char *argv[])
225 speex_init_header(&header, 1, 1, &speex_nb_mode);
226 printf("%s\n", header.speex_version);
229 cc -o t t.c -lspeex > /dev/null 2>&1
230 if test \! -x t ; then
231 AC_MSG_RESULT(cannot determine - using OPAL version)
234 AC_MSG_RESULT($SYSVER)
235 AC_MSG_CHECKING(library Speex version)
236 LIBVER=`grep "#define SPEEX_VERSION" ./src/codec/speex/libspeex/misc.h | sed -e 's/^.*[Ss][Pp][Ee][Ee][Xx]\-//' -e 's/\"//' -e 's/\/.*//'`
237 AC_MSG_RESULT($LIBVER)
238 AC_MSG_CHECKING(Speex versions)
243 @lib = split /\./, \$libver;
247 @sys = split /\./, \$sysver;
253 if (@sys[\$i] < @lib[\$i]) {
262 SPEEX=`perl t.pl $SYSVER $LIBVER`
264 if test "x$SPEEX" = "x0" ; then
265 AC_MSG_RESULT(OPAL version is more recent)
267 AC_MSG_RESULT(system version is more recent)
268 AC_DEFINE(OPAL_SYSTEM_SPEEX, 1)
269 AC_SUBST(OPAL_SYSTEM_SPEEX, 1)
270 AC_MSG_CHECKING(Speex noise type)
271 if test "${OPAL_HAVE_SPEEX_H}x" != "x" ; then
272 echo "#include <speex.h>" > t.c
273 echo "#include <speex_preprocess.h>" >> t.c
275 echo "#include <speex/speex.h>" > t.c
276 echo "#include <speex/speex_preprocess.h>" >> t.c
280 int main(int argc,char *argv[])
282 struct SpeexPreprocessState *st;
285 speex_preprocess(st, x, echo);
289 cc -Werror -o t t.c -lspeex > /dev/null 2>&1
290 if test \! -x t ; then
291 AC_MSG_RESULT(spx_int32_t)
294 AC_DEFINE(OPAL_SPEEX_FLOAT_NOISE)
302 AC_SUBST(OPAL_HAVE_SPEEX_SPEEX_H)
304 dnl ########################################################################
305 dnl enable audio, video, SIP, H.323 and IAX
307 dnl MSWIN_DISPLAY audio,Audio
308 dnl MSWIN_DEFINE audio,OPAL_AUDIO
312 [ --disable-audio disable audio codec support],
314 AC_MSG_CHECKING(audio codec support)
315 if test "$audio" = "yes" ; then
316 AC_SUBST(OPAL_AUDIO, 1)
317 AC_DEFINE(OPAL_AUDIO)
318 AC_MSG_RESULT(enabled)
320 AC_MSG_RESULT(disabled)
324 dnl MSWIN_DISPLAY video,Video
325 dnl MSWIN_DEFINE video,OPAL_VIDEO
329 [ --disable-video disable video codec support],
331 AC_MSG_CHECKING(video device support)
332 if test "$video" = "yes" ; then
333 AC_SUBST(OPAL_VIDEO, 1)
334 AC_DEFINE(OPAL_VIDEO)
335 AC_MSG_RESULT(enabled)
337 AC_MSG_RESULT(disabled)
341 dnl MSWIN_DISPLAY sip,SIP support
342 dnl MSWIN_DEFINE sip,OPAL_SIP
346 [ --disable-sip disable SIP protocol support],
348 AC_MSG_CHECKING(SIP protocol)
349 if test "$sip" = "yes" ; then
350 AC_SUBST(OPAL_SIP, 1)
352 AC_MSG_RESULT(enabled)
354 AC_MSG_RESULT(disabled)
358 dnl MSWIN_DISPLAY h323,H.323 support
359 dnl MSWIN_DEFINE h323,OPAL_H323
366 [ --disable-h323 disable H.323 protocol support],
368 AC_MSG_CHECKING(H.323 protocol)
369 if test "$h323" = "yes" ; then
370 AC_SUBST(OPAL_H323, 1)
372 AC_MSG_RESULT(enabled)
374 AC_SUBST(OPAL_H323, 0)
375 AC_MSG_RESULT(disabled (T.38, H.224, H.460 also disabled))
380 AC_SUBST(OPAL_H323, $OPAL_H323)
383 dnl MSWIN_DISPLAY iax2,IAX2 support
384 dnl MSWIN_DEFINE iax2,OPAL_IAX2
388 [ --disable-iax disable IAX2 protocol support],
390 AC_MSG_CHECKING(IAX2 protocol)
391 if test "$iax" = "yes" ; then
392 AC_SUBST(OPAL_IAX2, 1)
394 AC_MSG_RESULT(enabled)
396 AC_MSG_RESULT(disabled)
399 dnl MSWIN_DISPLAY h224,H.224 support
400 dnl MSWIN_DEFINE h224,OPAL_H224
403 [ --disable-h224 disable H.224 protocol support],
405 AC_MSG_CHECKING(H224 protocol)
406 if test "$h224" = "yes" ; then
407 AC_SUBST(OPAL_H224, 1)
409 AC_MSG_RESULT(enabled)
411 AC_MSG_RESULT(disabled)
414 dnl ########################################################################
418 dnl MSWIN_DISPLAY t38,T.38
419 dnl MSWIN_DEFINE t38,OPAL_T38FAX
420 dnl MSWIN_IF_FEATURE t38,h323
422 if test "$t38" = "yes" ; then
424 [ --disable-t38 disable T.38 protocol support],
426 AC_MSG_CHECKING(T.38 protocol)
427 if test "$t38" = "yes" ; then
428 AC_SUBST(OPAL_T38FAX, 1)
429 AC_DEFINE(OPAL_T38FAX)
430 AC_MSG_RESULT(enabled)
432 AC_MSG_RESULT(disabled)
437 dnl ########################################################################
441 dnl MSWIN_DISPLAY h460,H.460
442 dnl MSWIN_DEFINE h460,H323_H460
445 if test "$h460" = "yes" ; then
447 [ --disable-h460 disable H.460],
449 AC_MSG_CHECKING(H.460 support)
450 if test "$h460" = "yes" ; then
451 AC_SUBST(H323_H460, 1)
453 AC_MSG_RESULT(enabled)
455 AC_MSG_RESULT(disabled)
460 dnl ########################################################################
462 dnl LID, used for vpb, dialogic etc ...
464 dnl MSWIN_DISPLAY lids,Line Interface Device
465 dnl MSWIN_DEFINE lids,OPAL_LID
469 if test "$lid" = "yes" ; then
471 [ --disable-lid disable LID support],
473 AC_MSG_CHECKING(LID support)
474 if test "$lid" = "yes" ; then
475 AC_DEFINE(OPAL_LID, 1)
477 AC_MSG_RESULT(enabled)
479 AC_MSG_RESULT(disabled)
484 dnl ########################################################################
488 dnl MSWIN_DISPLAY ivr,IVR support
489 dnl MSWIN_DEFINE ivr,OPAL_IVR
493 if test "$ivr" = "yes" ; then
495 [ --disable-ivr disable IVR support],
497 AC_MSG_CHECKING(IVR support)
498 if test "$ivr" = "yes" ; then
499 AC_DEFINE(OPAL_IVR, 1)
501 AC_MSG_RESULT(enabled)
503 AC_MSG_RESULT(disabled)
509 dnl ########################################################################
514 dnl MSWIN_DISPLAY libsrtp,Cisco libSRTP support
515 dnl MSWIN_CHECK_FILE libsrtp,include\srtp.h,HAS_LIBSRTP=1
516 dnl MSWIN_DIR_SYMBOL libsrtp,LIBSRTP_DIR
517 dnl MSWIN_CHECK_DIR libsrtp,.\srtp
518 dnl MSWIN_CHECK_DIR libsrtp,..\external\srtp
519 dnl MSWIN_CHECK_DIR libsrtp,c:\libs
522 AC_MSG_CHECKING(for libSRTP)
523 AC_TRY_COMPILE([#include "srtp/srtp.h"],
524 [int main(int argc, char *argv[]) { crypto_policy_t p; p.cipher_key_len = SRTP_MASTER_KEY_LEN; return 0; }],
526 if test "${HAS_LIBSRTP}" = "1" ; then
528 AC_DEFINE(HAS_LIBSRTP, 1)
535 AC_SUBST(HAS_LIBSRTP)
538 dnl ########################################################################
539 dnl output make directives
546 dnl ########################################################################
547 dnl Output configured files
549 AC_CONFIG_SUBDIRS(plugins)
551 dnl ########################################################################
552 dnl output header file
554 AC_CONFIG_FILES(opal_inc.mak)
555 AC_CONFIG_FILES(Makefile)
556 AC_CONFIG_HEADERS(include/opal/buildopts.h)
558 AC_OUTPUT(src/codec/speex/libspeex/speex_config_types.h)