1 AC_INIT(include/ptlib.h)
3 AC_CONFIG_SUBDIRS(plugins)
9 dnl ########################################################################
10 dnl set the PWLIB directory to the current directory
14 dnl set the pwlib installation dir for pwlib-config
17 dnl ########################################################################
18 dnl set the PREFIX accordingly
19 if test "x$prefix" = "xNONE"; then
20 INSTALLPREFIX="/usr/local"
22 INSTALLPREFIX="${prefix}"
25 AC_SUBST(INSTALLPREFIX)
28 dnl ########################################################################
29 dnl set LIBDIR accordingly
34 dnl ########################################################################
35 dnl extract the PWLIB version
36 MAJOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
37 MINOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
38 BUILD_NUMBER=`cat ${PWLIBDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
39 PWLIB_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}"
40 AC_SUBST(MAJOR_VERSION)
41 AC_SUBST(MINOR_VERSION)
42 AC_SUBST(BUILD_NUMBER)
43 AC_SUBST(PWLIB_VERSION)
44 AC_SUBST(MAJOR_VERSION, $MAJOR_VERSION)
45 AC_SUBST(MINOR_VERSION, $MINOR_VERSION)
46 AC_SUBST(BUILD_NUMBER, $BUILD_NUMBER)
48 AC_MSG_NOTICE(PTLib version is ${PWLIB_VERSION});
50 AC_DEFINE_UNQUOTED([PWLIB_MAJOR], [$MAJOR_VERSION], [Major version])
51 AC_DEFINE_UNQUOTED([PWLIB_MINOR], [$MINOR_VERSION], [Minor version])
52 AC_DEFINE_UNQUOTED([PWLIB_BUILD], [$BUILD_NUMBER], [Build number])
53 AC_DEFINE_UNQUOTED([PWLIB_VERSION], ["$PWLIB_VERSION"], [pwlib version])
55 dnl ########################################################################
56 dnl set the OSTYPE and MACHTYPE
64 linux*) OSTYPE=linux ;
65 OSRELEASE="\"`uname -r`\"";
67 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
70 freebsd* ) OSTYPE=FreeBSD ;
72 if test "x$OSRELEASE" = "x"; then
73 OSRELEASE="`sysctl -n kern.osreldate`" ;
75 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
78 openbsd* ) OSTYPE=OpenBSD ;
80 OSRELEASE="`sysctl -n kern.osrevision`" ;
81 ENDLDLIBS="-lossaudio" ;
82 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
85 netbsd* ) OSTYPE=NetBSD ;
87 OSRELEASE="`/sbin/sysctl -n kern.osrevision`" ;
88 ENDLDLIBS="-lossaudio" ;
89 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
92 solaris* | sunos* ) OSTYPE=solaris ;
94 OSRELEASE=`uname -r | sed "s/5\.//g"` ;
95 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
98 darwin* ) OSTYPE=Darwin ;
100 OSRELEASE="`uname -r | sed 's/\.//g'`" ;
101 SHAREDLIBEXT="dylib";
102 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
107 OSRELEASE=`uname -r` ;
108 STDCCFLAGS="$STDCCFLAGS -D__BEOS__"
111 * ) OSTYPE="$target_os" ;
112 OS_TAG="P_UNKNOWN_OS" ;
113 OSRELEASE="\"${OSTYPE}_`uname -r`\"" ;
114 AC_MSG_WARN("OS $target_os not recognized - proceed with caution!") ;
120 case "$target_cpu" in
121 x86 | i686 | i586 | i486 | i386 ) MACHTYPE=x86
124 x86_64) MACHTYPE=x86_64 ;
129 alpha | alphaev56 | alphaev6 | alphaev67 | alphaev7) MACHTYPE=alpha ;
133 sparc ) MACHTYPE=sparc ;
136 powerpc ) MACHTYPE=ppc ;
142 powerpc64 ) MACHTYPE=ppc64 ;
147 ppc64 ) MACHTYPE=ppc64 ;
152 ia64) MACHTYPE=ia64 ;
156 s390x) MACHTYPE=s390x ;
161 s390) MACHTYPE=s390 ;
164 * ) MACHTYPE=$target_cpu ;
165 AC_MSG_WARN("CPU $target_cpu not recognized - proceed with caution!") ;;
168 AC_MSG_NOTICE(OSTYPE set to $OSTYPE);
169 AC_MSG_NOTICE(OSRELEASE set to $OSRELEASE);
170 AC_MSG_NOTICE(MACHTYPE set to $MACHTYPE);
172 AC_SUBST(MACHTYPE, $MACHTYPE)
173 AC_SUBST(OSTYPE, $OSTYPE)
174 AC_SUBST(OSRELEASE, $OSRELEASE)
175 AC_SUBST(TARGETDIR, $TARGETDIR)
177 AC_DEFINE_UNQUOTED($OS_TAG, $OSRELEASE)
179 AC_DEFINE([PHAS_TEMPLATES], [1], [Templates found])
181 if test "x$P_64BIT" != "x" ; then
182 AC_DEFINE([P_64BIT], [1], [64bit architecture])
185 dnl BeOS has it;s own threading system
186 if test ${OSTYPE} != beos ; then
187 AC_DEFINE(P_PTHREADS, 1, "PThreads found")
190 dnl posix semaphore support in darwin/macosx is broken
191 if test ${OSTYPE} != Darwin ; then
192 AC_DEFINE([P_HAS_SEMAPHORES], [1], [using semaphores])
195 dnl ########################################################################
196 dnl set the shared library extension, if not already set
198 if test "x${SHAREDLIBEXT}" = "x" ; then
201 AC_SUBST(SHAREDLIBEXT, $SHAREDLIBEXT)
202 AC_DEFINE([P_SHAREDLIBEXT], [$SHAREDLIBEXT], [shared library extension])
204 dnl ########################################################################
205 dnl check the endianness
207 dnl MSWIN_DISPLAY byteorder,Byte Order
208 dnl MSWIN_DEFINE byteorder,PBYTE_ORDER=PLITTLE_ENDIAN
211 if test ${ac_cv_c_bigendian} = yes ; then
212 PBYTE_ORDER=PBIG_ENDIAN
214 PBYTE_ORDER=PLITTLE_ENDIAN
217 AC_DEFINE_UNQUOTED(PBYTE_ORDER, $PBYTE_ORDER, "byte order")
219 dnl ########################################################################
220 dnl look for compile flags
224 [ --enable-rtti enables RTTI support],
226 if test "$rtti" = "yes" ; then
227 AC_MSG_NOTICE(Not disabling RTTI)
229 AC_MSG_CHECKING(if compiler accepts -fno-rtti)
230 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
231 $CXX $CFLAGS -fno-rtti -c conftest.cc > /dev/null 2>&1
232 if test $? = 0 ; then
234 STDCCFLAGS="$STDCCFLAGS -fno-rtti"
242 AC_MSG_CHECKING(if linker accepts --gc-sections)
243 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
244 $CXX $CFLAGS -Wl,--gc-sections conftest.cc > /dev/null 2>&1
245 if test $? = 0 ; then
248 AC_MSG_CHECKING(if compiler accepts -ffunction-sections)
249 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
250 $CXX $CFLAGS -ffunction-sections -c conftest.cc > /dev/null 2>&1
251 if test $? = 0 ; then
253 STDCCFLAGS="$STDCCFLAGS -ffunction-sections"
259 AC_MSG_CHECKING(if compiler accepts -fdata-sections)
260 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
261 $CXX $CFLAGS -fdata-sections -c conftest.cc > /dev/null 2>&1
262 if test $? = 0 ; then
264 STDCCFLAGS="$STDCCFLAGS -fdata-sections"
270 dnl as much as this flag would help, there is no known linker
271 dnl that can handle pwlib when it has been compiled with it
272 dnl AC_MSG_CHECKING(if compiler accepts -fvtable-gc)
273 dnl AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
274 dnl $CXX $CFLAGS -fvtable-gc -c conftest.cc > /dev/null 2>&1
275 dnl if test $? = 0 ; then
276 dnl AC_MSG_RESULT(yes)
277 dnl STDCCFLAGS="$STDCCFLAGS -fvtable-gc"
280 dnl AC_MSG_RESULT(no)
283 if test $GCSECTIONS = 1; then
284 if test "${OSTYPE}" != "Darwin" ; then
285 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -Wl,--gc-sections"
295 dnl ########################################################################
296 dnl check for long double
299 if test $ac_cv_c_long_double != yes ; then
300 AC_DEFINE([PNO_LONG_DOUBLE], [], [No long double])
303 dnl ########################################################################
304 dnl check for pthreads library
306 dnl MSWIN_DISPLAY semaphore,Semaphore Support
307 dnl MSWIN_DEFINE semaphore,P_HAS_SEMAPHORES
309 dnl Linux, Mac OS X use libpthread and -lpthread
310 dnl FreeBSD uses the -pthread compiler option and uses libc_r
312 AC_CHECK_LIB(pthread, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
313 if test ${HAS_PTHREADS} = yes ; then
314 ENDLDLIBS="$ENDLDLIBS -lpthread"
315 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT"
318 AC_CHECK_LIB(c_r, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
319 if test ${HAS_PTHREADS} = yes ; then
320 ENDLDLIBS="$ENDLDLIBS -pthread"
321 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT -pthread"
326 if test ${HAS_PTHREADS} != yes ; then
327 AC_MSG_ERROR(must have pthreads!)
330 dnl ########################################################################
331 dnl check for XPG6 compliant pthreads (timed spinlocks)
333 if test ${HAS_PTHREADS} = yes ; then
334 AC_CHECK_LIB(pthread, pthread_mutex_timedlock, HAS_PTHREADS_XPG6=yes, HAS_PTHREADS_XPG6=no)
335 if test ${HAS_PTHREADS_XPG6} = yes ; then
336 AC_DEFINE(P_PTHREADS_XPG6, 1, "XPG6 compliant pthreads found")
339 AC_CHECK_LIB(pthread, sem_timedwait, HAS_SEMAPHORES_XPG6=yes, HAS_SEMAPHORES_XPG6=no)
340 if test ${HAS_SEMAPHORES_XPG6} = yes ; then
341 AC_MSG_CHECKING(if sem_timedwait will compile)
342 AC_TRY_COMPILE([#include <semaphore.h>],
343 [sem_t *s; const struct timespec * t; sem_timedwait(s, t);], HAS_SEMAPHORES_XPG6=yes, HAS_SEMAPHORES_XPG6=no)
344 if test ${HAS_SEMAPHORES_XPG6} = yes ; then
345 AC_DEFINE(P_HAS_SEMAPHORES_XPG6, 1, "Supports XPG6 Semaphores")
353 dnl ########################################################################
354 dnl check for regex library
356 dnl yes this test needs to be outside the if below
357 dnl because autoconf needs to initialise stuff. without this
358 dnl all sorts of strange things happen
359 AC_CHECK_HEADERS(regex.h, HAS_REGEX=yes)
361 AC_ARG_ENABLE(internalregex,
362 [ --enable-internalregex force internal regex library],
363 internalregex=$enableval)
364 if test "$internalregex" = "yes" ; then
365 AC_MSG_NOTICE(Forcing use of internal regex library)
367 if test "$HAS_REGEX" = "yes" ; then
368 AC_CHECK_FUNC(regcomp, HAS_REGEX=yes)
369 if test "$HAS_REGEX" = "yes" ; then
370 AC_SUBST(HAS_REGEX, 1)
371 AC_DEFINE(P_REGEX, 1, "Regex library found")
377 dnl ########################################################################
378 dnl check for dynamic library code (dlopen and friends)
380 dnl MSWIN DLL Support,,P_DYNALINK
385 if test ${OSTYPE} = beos ; then
387 AC_DEFINE(P_DYNALINK, 1, "dlopen implemented inside pwlib in BeOS")
388 elif test ${OSTYPE} = Darwin ; then
390 AC_DEFINE(P_DYNALINK, 1, "dlopen implemented inside pwlib in Darwin")
392 AC_CHECK_HEADERS(dlfcn.h, HAS_DLFCN=yes, HAS_DLFCN=no)
393 if test "$HAS_DLFCN" = yes ; then
394 AC_MSG_CHECKING(if dlopen is available)
395 AC_TRY_COMPILE([#include <dlfcn.h>],
396 [void * p = dlopen("lib", 0);], HAS_DLOPEN=yes, HAS_DLOPEN=no)
397 if test "$HAS_DLOPEN" = no ; then
402 AC_DEFINE(P_DYNALINK, 1, "dlopen found")
403 AC_CHECK_LIB(dl,dlopen,HAS_LIBDL=yes, HAS_LIBDL=no)
408 dnl #########################################################################
409 dnl check to see if plugins enabled
410 dnl MSWIN Plugin Support,,P_HAS_PLUGINS
412 AC_MSG_CHECKING(if plugins support needs to be compiled)
413 AC_ARG_ENABLE(plugins,
414 [ --enable-plugins enable plugins' support in PWLIB],
418 if test "${plugins}" = "no" ; then
420 elif test "${P_DYNALINK:-unset}" = "unset" ; then
421 AC_MSG_RESULT(plugins disabled as dlopen not available)
423 AC_MSG_RESULT(plugins enabled)
425 AC_DEFINE(P_HAS_PLUGINS, 1, "plugins enabled")
428 AC_SUBST(HAS_PLUGINS)
430 if test "x$LIB64" != "x" ; then
431 AC_DEFINE_UNQUOTED([P_DEFAULT_PLUGIN_DIR], ["${INSTALLPREFIX}/lib64/pwlib"], [Default plugin directory])
433 AC_DEFINE_UNQUOTED([P_DEFAULT_PLUGIN_DIR], ["${INSTALLPREFIX}/lib/pwlib"], [Default plugin directory])
436 dnl ########################################################################
437 dnl look for DNS resolver code (must be done before OpenLDAP)
438 dnl on some systems, the resolver is in libc
439 dnl but needs resolv.h included which defines res_search as __res_search
441 dnl MSWIN_DISPLAY resolver,DNS Resolver
442 dnl MSWIN_CHECK_FILE resolver,include\windns.h,P_DNS=1
443 dnl MSWIN_DIR_SYMBOL resolver,DNS_DIR
444 dnl MSWIN_CHECK_DIR resolver,\Program Files\Microsoft SDK\
446 AC_ARG_ENABLE(resolver,
447 [ --disable-resolver disable DNS resolver support in PWLIB],
450 if test "$resolver" = "no" ; then
453 AC_CHECK_FUNC(res_search, HAVE_RESOLVER=1)
454 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
457 AC_MSG_CHECKING([for res_search in -lresolv])
460 #include <netinet/in.h>
462 int main(int argc,char **argv){
463 res_search (NULL, 0, 0, NULL, 0);
465 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
467 RESOLVER_LIBS="-lresolv"
469 AC_SEARCH_LIBS(__res_search, resolv, HAVE_RESOLVER=1)
473 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
474 AC_DEFINE(P_DNS, 1, "resolver libraries found")
478 dnl ########################################################################
479 dnl look for OpenLDAP
481 dnl MSWIN_DISPLAY openldap,Open LDAP
482 dnl MSWIN_CHECK_FILE openldap,include\ldap.h|OpenLDAP,P_LDAP=1
483 dnl MSWIN_DIR_SYMBOL openldap,LDAP_DIR
484 dnl MSWIN_CHECK_DIR openldap,..\openldap\
485 dnl MSWIN_CHECK_DIR openldap,..\external\openldap\
486 dnl MSWIN_CHECK_DIR openldap,\openldap\
487 dnl MSWIN_CHECK_DIR openldap,c:\openldap\
489 AC_ARG_ENABLE(openldap,
490 [ --disable-openldap disable OpenLDAP support in PWLIB],
493 if test "$openldap" = "no" ; then
494 AC_SUBST(HAS_OPENLDAP, 0)
497 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
498 AC_CHECK_HEADERS(ldap.h, HAS_OPENLDAP=1)
500 dnl posix4 is required by libldap_r on Solaris
501 if test "${OSTYPE:-unknown}" = "solaris"; then
502 OPENLDAPSYSLIBS=-lposix4
505 dnl check also for lldap_r presence (required for thread safe OpenLDAP?)
506 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
507 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
509 AC_CHECK_FILE(/usr/local/include/ldap.h, HAS_OPENLDAP=1)
510 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
511 OPENLDAPINCLUDEDIR=/usr/local/include
512 OPENLDAPLIBDIR=/usr/local/lib
513 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-L/usr/local/lib -llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
518 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
519 AC_SUBST(HAS_OPENLDAP, 1)
520 AC_DEFINE(P_LDAP, 1, "OpenLDAP found")
521 if test ${OPENLDAPINCLUDEDIR:-unset} != "unset" ; then
522 STDCCFLAGS="$STDCCFLAGS -I${OPENLDAPINCLUDEDIR}"
524 if test ${OPENLDAPLIBDIR:-unset} != "unset" ; then
525 LDFLAGS="$LDFLAGS -L${OPENLDAPLIBDIR}"
528 dnl Not all Unices have SASL installed as a separate library (Solaris)
529 dnl Some newer Linux boxes have libsasl2 instead of libsasl
530 AC_CHECK_LIB(sasl, sasl_client_auth, HAS_SASL=1, HAS_SASL=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
531 if test ${HAS_SASL:-unset} = "unset" ; then
532 AC_CHECK_LIB(sasl2, sasl_version, HAS_SASL2=1, HAS_SASL2=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
534 if test ${HAS_SASL:-unset} != "unset" ; then
535 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber -lsasl"
536 elif test ${HAS_SASL2:-unset} != "unset" ; then
537 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber -lsasl2"
539 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber"
544 dnl ########################################################################
546 dnl check for environment variable, then assume standard system install
547 dnl this process is made incredibly more complex by the fact that RedHad 9
548 dnl is completely fscked. The default OpenSSL installation requires Kerberos,
549 dnl even when Kerberos is not installed, requiring an explicit #define to
551 dnl As if that is not enough, autoconf gets very confused if configure.in
552 dnl contains a AC_CHECK_HEADER directive that never gets used. So we have
553 dnl to ensure that it is always called
555 dnl MSWIN_DISPLAY openssl,Open SSL
556 dnl MSWIN_CHECK_FILE openssl,inc32\openssl\ssl.h,P_SSL=1
557 dnl MSWIN_DIR_SYMBOL openssl,SSL_DIR
558 dnl MSWIN_CHECK_DIR openssl,..\openssl\
559 dnl MSWIN_CHECK_DIR openssl,..\external\openssl\
560 dnl MSWIN_CHECK_DIR openssl,\openssl\
561 dnl MSWIN_CHECK_DIR openssl,c:\openssl\
563 AC_ARG_ENABLE(openssl,
564 [ --disable-openssl disable OpenSSL support in PWLIB],
567 if test "$openssl" = "no" ; then
569 AC_SUBST(HAS_OPENSSL, 0)
572 dnl check to see OPENSSLDIR is set
573 dnl if it is, we assume it correct - no further checking required
574 if test ${OPENSSLDIR:-unset} != "unset" ; then
575 AC_MSG_CHECKING([for ${OPENSSLDIR}/include/openssl/ssl.h])
576 if test -e ${OPENSSLDIR}/include/openssl/ssl.h ; then
579 SSLINCLUDEDIR="${OPENSSLDIR}/include"
580 SSLLIBDIR="${OPENSSLDIR}/lib"
587 dnl if OPENSSLDIR is not set, then check to see if OpenSSL
588 dnl is installed in the standard system dirs. And also see if
589 dnl if it works using crazy RedHat checks
590 if test "${SSLHDR:-unset}" = "unset" ; then
591 AC_CHECK_HEADERS(openssl/ssl.h,SSLHDR=1)
592 if test "${SSLHDR:-unset}" = "unset" ; then
593 AC_MSG_CHECKING([if openssl/ssl.h works with OPENSSL_NO_KRB5])
594 AC_COMPILE_IFELSE([[#define OPENSSL_NO_KRB5
595 #include <openssl/ssl.h>
596 int main(int argc,char **argv){}]],SSLHDR=1)
597 if test ${SSLHDR:-unset} != "unset" ; then
599 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
600 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -L/usr/kerberos/lib"
601 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
608 dnl if we have not found OpenSSL so far, then look for it in
609 dnl several standard places, and check for crazy RedHat install too
610 if test "${SSLHDR:-unset}" = "unset" ; then
612 dnl We want to switch to C language to get .c extension for conftest files
615 for openssl_dir in /usr/local/openssl /usr/local/ssl ; do
616 AC_MSG_CHECKING([for OpenSSL in $openssl_dir])
617 if test ! -f ${openssl_dir}/include/openssl/ssl.h ; then
620 AC_LANG_CONFTEST([[#include "${openssl_dir}/include/openssl/ssl.h"
621 int main(int argc,char **argv){ return 0; }]])
622 $CC $CFLAGS -I${openssl_dir}/include -c conftest.c > /dev/null 2>&1
623 if test $? = 0 ; then
627 SSLINCLUDEDIR="${openssl_dir}/include"
628 SSLLIBDIR="${openssl_dir}/lib"
632 AC_MSG_CHECKING([if ${openssl_dir}/include/openssl/ssl.h works with OPENSSL_NO_KRB5...])
633 AC_LANG_CONFTEST([[#define OPENSSL_NO_KRB5
634 #include "${openssl_dir}/include/openssl/ssl.h"
635 int main(int argc,char **argv){}]])
636 $CC $CFLAGS -I${openssl_dir}/openssl/include -c conftest.c > /dev/null 2>&1
637 if test $? = 0 ; then
640 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
641 SSLINCLUDEDIR="${openssl_dir}/include"
642 SSLLIBDIR="${openssl_dir}/lib"
643 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -L/usr/kerberos/lib"
644 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
655 if test ${SSLHDR:-unset} != "unset" ; then
656 AC_SUBST(HAS_OPENSSL, 1)
657 AC_DEFINE(P_SSL, 1, "OpenSSL found")
658 if test ${SSLINCLUDEDIR:-unset} != "unset" ; then
659 STDCCFLAGS="$STDCCFLAGS -I${SSLINCLUDEDIR}"
661 if test ${SSLLIBDIR:-unset} != "unset" ; then
662 LDFLAGS="$LDFLAGS -L${SSLLIBDIR}"
664 STDCCFLAGS="${STDCCFLAGS}${SSLCCFLAGS}"
665 ENDLDLIBS="$ENDLDLIBS -lssl -lcrypto"
669 AC_SUBST(P_STATIC_ENDLDLIBS)
670 AC_SUBST(P_STATIC_LDFLAGS)
672 dnl ########################################################################
673 dnl look for expat XML parser
675 dnl MSWIN_DISPLAY expat,Expat XML
676 dnl MSWIN_CHECK_FILE expat,lib\expat.h,P_EXPAT=1
677 dnl MSWIN_DIR_SYMBOL expat,EXPAT_DIR
678 dnl MSWIN_CHECK_DIR expat,..\expat\
679 dnl MSWIN_CHECK_DIR expat,..\external\expat\
680 dnl MSWIN_CHECK_DIR expat,\expat
681 dnl MSWIN_CHECK_DIR expat,c:\expat\
684 [ --disable-expat disable XML support in PWLIB],
687 if test "$expat" = "no" ; then
688 AC_SUBST(HAS_EXPAT, 0)
689 AC_DEFINE(P_EXPAT, 0)
692 AC_CHECK_HEADERS(expat.h, HAS_EXPAT=1)
693 if test "${HAS_EXPAT:-unset}" != "unset" ; then
694 AC_CHECK_LIB(expat, XML_ParserCreate, HAS_EXPAT=1, HAS_EXPAT=)
696 AC_CHECK_FILE(/usr/local/include/expat.h, HAS_EXPAT=1)
697 if test "${HAS_EXPAT:-unset}" != "unset" ; then
698 EXPATINCLUDEDIR=/usr/local/include
699 EXPATLIBDIR=/usr/local/lib
703 if test "${HAS_EXPAT:-unset}" != "unset" ; then
704 AC_SUBST(HAS_EXPAT, 1)
705 AC_DEFINE(P_EXPAT, 1, "expat found")
706 if test ${EXPATINCLUDEDIR:-unset} != "unset" ; then
707 STDCCFLAGS="$STDCCFLAGS -I${EXPATINCLUDEDIR}"
709 if test ${EXPATLIBDIR:-unset} != "unset" ; then
710 LDFLAGS="$LDFLAGS -L${EXPATLIBDIR}"
712 ENDLDLIBS="$ENDLDLIBS -lexpat"
717 dnl ########################################################################
720 dnl MSWIN_DISPLAY sapi,Speech API
721 dnl MSWIN_CHECK_FILE sapi,include\sphelper.h,P_SAPI=1
722 dnl MSWIN_DIR_SYMBOL sapi,SAPI_DIR
723 dnl MSWIN_CHECK_DIR sapi,\Program Files\Microsoft Speech SDK 5.1\
725 dnl ########################################################################
726 dnl look for IPV6 functions
728 dnl MSWIN_DISPLAY ipv6,IPv6 Support
729 dnl MSWIN_CHECK_FILE ipv6,ws2tcpip.h|sin6_scope_id,P_HAS_IPV6=1
730 dnl MSWIN_DIR_SYMBOL ipv6,IPV6_DIR
731 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft Visual Studio\VC98\Include\
732 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft SDK\include\
735 [ --disable-ipv6 disable IPV6 support in PWLIB],
738 if test "$ipv6" = "no" ; then
739 AC_DEFINE(P_HAS_IPV6, 0)
740 AC_SUBST(HAS_IPV6, 0)
742 AC_CACHE_CHECK([for IPv6 Support], HAS_IPV6,
743 [AC_TRY_COMPILE([#include <sys/types.h>
744 #include <netinet/in.h>],
745 [struct sockaddr_in6 s; s.sin6_scope_id = 0;], HAS_IPV6=yes, HAS_IPV6=no)])
747 if test $HAS_IPV6 = yes ; then
748 AC_DEFINE(P_HAS_IPV6, 1, "IPV6 enabled")
752 dnl ########################################################################
753 dnl look for QoS functions
755 dnl MSWIN_DISPLAY qos,QoS Support
756 dnl MSWIN_CHECK_FILE qos,qossp.h|QOS_DESTADDR,P_HAS_QOS=1
757 dnl MSWIN_DIR_SYMBOL qos,QOS_DIR
758 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft Visual Studio\VC98\Include\
759 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft SDK\include\
762 [ --disable-qos disable QOS support in PWLIB],
765 if test "$qos" = "no" ; then
766 AC_DEFINE([P_HAS_QOS], [0], [No QOS])
768 AC_DEFINE([P_HAS_QOS], [1], [Have QOS])
772 dnl ########################################################################
773 dnl look for SDL, but only if we have pthreads
775 dnl MSWIN_DISPLAY libsdl,Simple DirectMedia Layer
776 dnl MSWIN_CHECK_FILE libsdl,include\SDL_video.h,P_SDL=1
777 dnl MSWIN_CHECK_FILE libsdl,lib\SDL.lib,P_SDL_LIBDIR="lib"
778 dnl MSWIN_DIR_SYMBOL libsdl,SDL_DIR
779 dnl MSWIN_CHECK_DIR libsdl,..\sdl\
780 dnl MSWIN_CHECK_DIR libsdl,..\external\sdl\
781 dnl MSWIN_CHECK_DIR libsdl,\sdl\
782 dnl MSWIN_CHECK_DIR libsdl,c:\sdl\
785 [ --disable-sdl disable SDL support in PWLIB],
788 if test "$sdl" = "no" ; then
793 if test "${SDLLIB:-unset}" = "unset" ; then
798 AC_CHECK_HEADERS(SDL/SDL.h, HAS_SDL=1)
799 if test "${HAS_SDL:-unset}" != "unset" ; then
800 if test "${X11LIBDIR:-unset}" == "unset" ; then
801 X11LIBDIR=/usr/lib/X11R6
803 AC_CHECK_LIB(SDL, SDL_CreateYUVOverlay, HAS_SDL=1, HAS_SDL=, -L${X11LIBDIR} -lpthread -lX11 -lXext -laa)
806 dnl freeBSD SDL check
807 if test "${HAS_SDL:-unset}" = "unset" ; then
808 AC_CHECK_FILE(/usr/local/include/SDL11/SDL.h, HAS_SDL=1)
809 if test "${HAS_SDL:-unset}" != "unset" ; then
814 if test "${HAS_SDL:-unset}" != "unset" ; then
816 AC_DEFINE(P_SDL, 1, "SDL found")
817 if test ${SDLINCLUDEDIR:-unset} != "unset" ; then
818 STDCCFLAGS="$STDCCFLAGS -I${SDLINCLUDEDIR}"
820 if test ${SDLLIBDIR:-unset} != "unset" ; then
821 LDFLAGS="$LDFLAGS -L${SDLLIBDIR}"
823 ENDLDLIBS="$ENDLDLIBS -l${SDLLIB}"
828 dnl ########################################################################
829 dnl check for video capture support.
830 dnl videodev.h on linux
831 dnl machine/ioctl_meteor on FreeBSD
832 dnl i386/ioctl_meteor on OpenBSD
833 dnl dev/ic/bt8xx on NetBSD
836 [ --disable-video disable non-plugin video device support in PWLIB],
840 if test "$HAS_PLUGINS" = "0" ; then
841 if test "$video" != "no" ; then
842 AC_CHECK_HEADER(linux/videodev.h, HAS_VIDEO_CAPTURE=1)
843 dnl AC_CHECK_HEADER(machine/ioctl_meteor.h, HAS_VIDEO_CAPTURE=1)
844 dnl AC_CHECK_HEADER(i386/ioctl_meteor.h, HAS_VIDEO_CAPTURE=1)
845 dnl AC_CHECK_HEADER(dev/ic/bt8xx.h, HAS_VIDEO_CAPTURE=1)
846 if test "${HAS_VIDEO_CAPTURE}" = "0" ; then
847 AC_MSG_NOTICE(No Video Capture support)
848 AC_DEFINE([NO_VIDEO_CAPTURE], [], [No video capture])
852 AC_SUBST(HAS_VIDEO_CAPTURE)
854 dnl ########################################################################
855 dnl check for various functions
856 AC_ARG_ENABLE(alsa, [ --enable-alsa disable non-plugin ALSA audio support],enable_alsa=$enableval)
859 if test "$HAS_PLUGINS" = "0" ; then
860 if test "$enable_alsa" != "no" ; then
861 AC_CHECK_HEADER(alsa/asoundlib.h, HAS_ALSA=1)
862 AC_MSG_CHECKING(for ALSA sound support)
863 if test "${HAS_ALSA}" = "1"; then
865 ENDLDLIBS="$ENDLDLIBS -lasound"
873 dnl ########################################################################
874 dnl check for various functions
875 dnl According to Andre Schulze <as8@rncmm2.urz.tu-dresden.de>
876 dnl Solaris swab should not be used
877 if test "$OSTYPE" = "solaris" ; then
880 AC_CHECK_FUNC(swab,USE_SYSTEM_SWAB=1)
882 if test "x$ac_cv_func_swab" = "xyes" ; then
883 AC_DEFINE([USE_SYSTEM_SWAB], [], [Use system swab()])
886 dnl ########################################################################
887 dnl output make directives
889 dnl resolver needs to be at the end
890 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
891 if test "${RESOLVER_LIBS:-unset}" != "unset" ; then
892 ENDLDLIBS="$ENDLDLIBS $RESOLVER_LIBS"
896 dnl dl needs to be at the end
897 if test "${OSTYPE}" != "Darwin" ; then
898 if test ${HAS_LIBDL} = yes ; then
899 ENDLDLIBS="$ENDLDLIBS -ldl"
904 AC_SUBST(OPTSTDCCFLAGS)
908 AC_CONFIG_FILES(make/ptbuildopts.mak)
909 AC_CONFIG_FILES([make/ptlib-config], [chmod a+x make/ptlib-config])
910 AC_CONFIG_FILES(Makefile)
912 dnl ########################################################################
913 dnl output header file
914 #AC_CONFIG_FILES(include/ptbuildopts.h.in)
915 AC_CONFIG_HEADERS(include/ptbuildopts.h)