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 ########################################################################
191 dnl set the shared library extension, if not already set
193 if test "x${SHAREDLIBEXT}" = "x" ; then
196 AC_SUBST(SHAREDLIBEXT, $SHAREDLIBEXT)
197 AC_DEFINE([P_SHAREDLIBEXT], [$SHAREDLIBEXT], [shared library extension])
199 dnl ########################################################################
200 dnl check the endianness
202 dnl MSWIN_DISPLAY byteorder,Byte Order
203 dnl MSWIN_DEFINE byteorder,PBYTE_ORDER=PLITTLE_ENDIAN
206 if test ${ac_cv_c_bigendian} = yes ; then
207 PBYTE_ORDER=PBIG_ENDIAN
209 PBYTE_ORDER=PLITTLE_ENDIAN
212 AC_DEFINE_UNQUOTED(PBYTE_ORDER, $PBYTE_ORDER, "byte order")
214 dnl ########################################################################
215 dnl look for compile flags
218 AC_MSG_CHECKING(if linker accepts -felide-constructors)
219 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
220 $CXX $CXXFLAGS -felide-constructors conftest.cc > /dev/null 2>&1
221 if test $? = 0 ; then
223 STDCXXFLAGS="$STDCXXFLAGS -felide-constructors"
228 AC_MSG_CHECKING(if linker accepts -Wreorder)
229 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
230 $STDCXX $CXXFLAGS -Wreorder conftest.cc > /dev/null 2>&1
231 if test $? = 0 ; then
233 STDCXXFLAGS="$STDCXXFLAGS -Wreorder"
238 # AC_MSG_CHECKING(if linker accepts -Woverloaded-virtual)
239 # AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
240 # $CXX $CFLAGS -Woverloaded-virtual conftest.cc > /dev/null 2>&1
241 # if test $? = 0 ; then
243 # STDCCFLAGS="$STDCCFLAGS -Woverloaded-virtual"
250 AC_MSG_CHECKING(if linker accepts --gc-sections)
251 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
252 $CXX $CFLAGS -Wl,--gc-sections conftest.cc > /dev/null 2>&1
253 if test $? = 0 ; then
256 AC_MSG_CHECKING(if compiler accepts -ffunction-sections)
257 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
258 $CXX $CFLAGS -ffunction-sections -c conftest.cc > /dev/null 2>&1
259 if test $? = 0 ; then
261 STDCCFLAGS="$STDCCFLAGS -ffunction-sections"
267 AC_MSG_CHECKING(if compiler accepts -fdata-sections)
268 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
269 $CXX $CFLAGS -fdata-sections -c conftest.cc > /dev/null 2>&1
270 if test $? = 0 ; then
272 STDCCFLAGS="$STDCCFLAGS -fdata-sections"
278 dnl as much as this flag would help, there is no known linker
279 dnl that can handle pwlib when it has been compiled with it
280 dnl AC_MSG_CHECKING(if compiler accepts -fvtable-gc)
281 dnl AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
282 dnl $CXX $CFLAGS -fvtable-gc -c conftest.cc > /dev/null 2>&1
283 dnl if test $? = 0 ; then
284 dnl AC_MSG_RESULT(yes)
285 dnl STDCCFLAGS="$STDCCFLAGS -fvtable-gc"
288 dnl AC_MSG_RESULT(no)
291 if test $GCSECTIONS = 1; then
292 if test "${OSTYPE}" != "Darwin" ; then
293 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -Wl,--gc-sections"
303 dnl ########################################################################
304 dnl check for long double
307 if test $ac_cv_c_long_double != yes ; then
308 AC_DEFINE([PNO_LONG_DOUBLE], [], [No long double])
311 dnl ########################################################################
312 dnl check for number of parms to readdir
313 AC_MSG_CHECKING(if readdir_r has 2 parms)
314 AC_TRY_COMPILE([#define _POSIX_PTHREAD_SEMANTICS
315 #include <dirent.h>],
316 [DIR *s; struct dirent * e; readdir_r(s, e);], P_HAS_POSIX_READDIR_R=2, P_HAS_POSIX_READDIR_R=0)
317 if test ${P_HAS_POSIX_READDIR_R} = 2 ; then
321 AC_MSG_CHECKING(if readdir_r has 3 parms)
322 AC_TRY_COMPILE([#include <dirent.h>],
323 [DIR *s; struct dirent * e; struct dirent * p; readdir_r(s, e, &p);], P_HAS_POSIX_READDIR_R=3, P_HAS_POSIX_READDIR_R=0)
324 if test ${P_HAS_POSIX_READDIR_R} = 3 ; then
330 AC_DEFINE_UNQUOTED(P_HAS_POSIX_READDIR_R, ${P_HAS_POSIX_READDIR_R})
332 dnl ########################################################################
333 dnl check for streams types
336 AC_MSG_CHECKING(if using STL streams)
337 AC_TRY_COMPILE([#include <iostream>],
338 [int v = (int)std::ios_base::seekdir();], P_HAS_STL_STREAMS=1)
339 if test ${P_HAS_STL_STREAMS} = 1 ; then
344 AC_DEFINE_UNQUOTED(P_HAS_STL_STREAMS, ${P_HAS_STL_STREAMS})
346 dnl ########################################################################
347 dnl see if using GNU glibc++, because then we have atomic integer operations
350 P_NEEDS_GNU_CXX_NAMESPACE=0
351 AC_MSG_CHECKING(if atomic integer available)
352 AC_TRY_COMPILE([#include <bits/atomicity.h>],
353 [_Atomic_word val;], P_HAS_ATOMIC_INT=1)
354 if test ${P_HAS_ATOMIC_INT} = 1 ; then
356 AC_MSG_CHECKING(if __exchange_and_add is in __gnu_cxx namespace)
357 AC_TRY_COMPILE([#include <bits/atomicity.h>],
358 [_Atomic_word val; __gnu_cxx::__exchange_and_add(&val, 1)], P_NEEDS_GNU_CXX_NAMESPACE=1)
359 if test ${P_NEEDS_GNU_CXX_NAMESPACE} = 1 ; then
367 AC_DEFINE_UNQUOTED(P_HAS_ATOMIC_INT, ${P_HAS_ATOMIC_INT})
368 AC_DEFINE_UNQUOTED(P_NEEDS_GNU_CXX_NAMESPACE, ${P_NEEDS_GNU_CXX_NAMESPACE})
371 dnl ########################################################################
372 dnl check for Unix semaphores
374 dnl posix semaphore support in darwin/macosx is broken
375 if test ${OSTYPE} != Darwin ; then
376 AC_TRY_COMPILE([#include <semaphore.h>],
377 [sem_t *s; sem_init(s, 0, 0);], P_HAS_SEMAPHORES=1)
378 AC_MSG_CHECKING(if Unix semaphores are available)
379 if test "${P_HAS_SEMAPHORES}x" != "x" ; then
380 AC_DEFINE(P_HAS_SEMAPHORES)
384 AC_MSG_WARN(This host does not support semaphores which are essential)
385 AC_MSG_WARN(to implement 'critical sections'. This feature was added)
386 AC_MSG_WARN(in PWLib 1.7.0 and improves the stability of multithreaded)
387 AC_MSG_WARN(programs. This feature has been disabled for this host)
391 dnl ########################################################################
392 dnl check for pthreads library
394 dnl MSWIN_DISPLAY semaphore,Semaphore Support
395 dnl MSWIN_DEFINE semaphore,P_HAS_SEMAPHORES
397 dnl Linux, Mac OS X use libpthread and -lpthread
398 dnl FreeBSD uses the -pthread compiler option and uses libc_r
400 AC_CHECK_LIB(pthread, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
401 if test ${HAS_PTHREADS} = yes ; then
402 ENDLDLIBS="$ENDLDLIBS -lpthread"
403 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT"
406 AC_CHECK_LIB(c_r, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
407 if test ${HAS_PTHREADS} = yes ; then
408 ENDLDLIBS="$ENDLDLIBS -pthread"
409 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT -pthread"
414 if test ${HAS_PTHREADS} != yes ; then
415 AC_MSG_ERROR(must have pthreads!)
418 dnl ########################################################################
419 dnl check for XPG6 compliant pthreads (timed spinlocks)
421 if test ${HAS_PTHREADS} = yes ; then
422 AC_CHECK_LIB(pthread, pthread_mutex_timedlock, HAS_PTHREADS_XPG6=yes, HAS_PTHREADS_XPG6=no)
423 if test ${HAS_PTHREADS_XPG6} = yes ; then
424 AC_DEFINE(P_PTHREADS_XPG6, 1, "XPG6 compliant pthreads found")
427 AC_CHECK_LIB(pthread, sem_timedwait, HAS_SEMAPHORES_XPG6=yes, HAS_SEMAPHORES_XPG6=no)
428 if test ${HAS_SEMAPHORES_XPG6} = yes ; then
429 AC_MSG_CHECKING(if sem_timedwait is compilable)
430 AC_TRY_COMPILE([#include <semaphore.h>],
431 [sem_t *s; const struct timespec * t; sem_timedwait(s, t);], HAS_SEMAPHORES_XPG6=yes, HAS_SEMAPHORES_XPG6=no)
432 if test ${HAS_SEMAPHORES_XPG6} = yes ; then
433 AC_DEFINE(P_HAS_SEMAPHORES_XPG6, 1, "Supports XPG6 Semaphores")
441 dnl ########################################################################
442 dnl check for recursive mutexes
443 P_HAS_RECURSIVE_MUTEX=0
444 AC_MSG_CHECKING(if recursive mutexes are available)
445 AC_TRY_COMPILE([#include <pthread.h>],
446 [pthread_mutexattr_t attr; pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);], P_HAS_RECURSIVE_MUTEX=1)
447 if test ${P_HAS_RECURSIVE_MUTEX} = 1 ; then
452 AC_DEFINE_UNQUOTED(P_HAS_RECURSIVE_MUTEX, ${P_HAS_RECURSIVE_MUTEX})
455 dnl ########################################################################
456 dnl check for regex library
458 dnl yes this test needs to be outside the if below
459 dnl because autoconf needs to initialise stuff. without this
460 dnl all sorts of strange things happen
461 AC_CHECK_HEADERS(regex.h, HAS_REGEX=yes)
463 AC_ARG_ENABLE(internalregex,
464 [ --enable-internalregex force internal regex library],
465 internalregex=$enableval)
466 if test "$internalregex" = "yes" ; then
467 AC_MSG_NOTICE(Forcing use of internal regex library)
469 if test "$HAS_REGEX" = "yes" ; then
470 AC_CHECK_FUNC(regcomp, HAS_REGEX=yes)
471 if test "$HAS_REGEX" = "yes" ; then
472 AC_SUBST(HAS_REGEX, 1)
473 AC_DEFINE(P_REGEX, 1, "Regex library found")
479 dnl ########################################################################
480 dnl check for dynamic library code (dlopen and friends)
482 dnl MSWIN DLL Support,,P_DYNALINK
487 if test ${OSTYPE} = beos ; then
489 AC_DEFINE(P_DYNALINK, 1, "dlopen implemented inside pwlib in BeOS")
490 elif test ${OSTYPE} = Darwin ; then
492 AC_DEFINE(P_DYNALINK, 1, "dlopen implemented inside pwlib in Darwin")
494 AC_CHECK_HEADERS(dlfcn.h, HAS_DLFCN=yes, HAS_DLFCN=no)
495 if test "$HAS_DLFCN" = yes ; then
496 AC_MSG_CHECKING(if dlopen is available)
497 AC_TRY_COMPILE([#include <dlfcn.h>],
498 [void * p = dlopen("lib", 0);], HAS_DLOPEN=yes, HAS_DLOPEN=no)
499 if test "$HAS_DLOPEN" = no ; then
504 AC_DEFINE(P_DYNALINK, 1, "dlopen found")
505 AC_CHECK_LIB(dl,dlopen,HAS_LIBDL=yes, HAS_LIBDL=no)
510 dnl #########################################################################
511 dnl check to see if plugins enabled
512 dnl MSWIN Plugin Support,,P_HAS_PLUGINS
514 AC_MSG_CHECKING(if plugins support needs to be compiled)
515 AC_ARG_ENABLE(plugins,
516 [ --enable-plugins enable plugins' support in PWLIB],
520 if test "${plugins}" = "no" ; then
522 elif test "${P_DYNALINK:-unset}" = "unset" ; then
523 AC_MSG_RESULT(plugins disabled as dlopen not available)
525 AC_MSG_RESULT(plugins enabled)
527 AC_DEFINE(P_HAS_PLUGINS, 1, "plugins enabled")
530 AC_SUBST(HAS_PLUGINS)
532 if test "x$LIB64" != "x" ; then
533 AC_DEFINE_UNQUOTED([P_DEFAULT_PLUGIN_DIR], ["${INSTALLPREFIX}/lib64/pwlib"], [Default plugin directory])
535 AC_DEFINE_UNQUOTED([P_DEFAULT_PLUGIN_DIR], ["${INSTALLPREFIX}/lib/pwlib"], [Default plugin directory])
538 dnl ########################################################################
539 dnl look for DNS resolver code (must be done before OpenLDAP)
540 dnl on some systems, the resolver is in libc
541 dnl but needs resolv.h included which defines res_search as __res_search
543 dnl MSWIN_DISPLAY resolver,DNS Resolver
544 dnl MSWIN_CHECK_FILE resolver,include\windns.h,P_DNS=1
545 dnl MSWIN_DIR_SYMBOL resolver,DNS_DIR
546 dnl MSWIN_CHECK_DIR resolver,\Program Files\Microsoft SDK\
548 AC_ARG_ENABLE(resolver,
549 [ --disable-resolver disable DNS resolver support in PWLIB],
552 if test "$resolver" = "no" ; then
555 AC_CHECK_FUNC(res_search, HAVE_RESOLVER=1)
556 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
559 AC_MSG_CHECKING([for res_search in -lresolv])
562 #include <netinet/in.h>
564 int main(int argc,char **argv){
565 res_search (NULL, 0, 0, NULL, 0);
567 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
569 RESOLVER_LIBS="-lresolv"
571 AC_SEARCH_LIBS(__res_search, resolv, HAVE_RESOLVER=1)
575 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
576 AC_DEFINE(P_DNS, 1, "resolver libraries found")
580 dnl ########################################################################
583 dnl MSWIN_DISPLAY sasl,Cyrus SASL
584 dnl MSWIN_CHECK_FILE sasl,include\sasl.h,P_SASL=1
585 dnl MSWIN_DIR_SYMBOL sasl,SASL_DIR
586 dnl MSWIN_CHECK_DIR sasl,\cyrus-sasl\
588 dnl Not all Unices have SASL installed as a separate library (Solaris)
589 dnl Some newer Linux boxes have libsasl2 instead of libsasl
590 AC_CHECK_LIB(sasl, sasl_client_auth, HAS_SASL=1, HAS_SASL=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
591 if test ${HAS_SASL:-unset} = "unset" ; then
592 AC_CHECK_LIB(sasl2, sasl_version, HAS_SASL2=1, HAS_SASL2=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
595 if test ${HAS_SASL:-unset} != "unset" ; then
597 ENDLDLIBS="$ENDLDLIBS -lsasl"
599 AC_SUBST(HAS_SASL, 1)
600 elif test ${HAS_SASL2:-unset} != "unset" ; then
602 ENDLDLIBS="$ENDLDLIBS -lsasl2"
604 AC_SUBST(HAS_SASL, 1)
609 dnl ########################################################################
610 dnl look for OpenLDAP (requires SASL)
612 dnl MSWIN_DISPLAY openldap,Open LDAP
613 dnl MSWIN_CHECK_FILE openldap,include\ldap.h|OpenLDAP,P_LDAP=1
614 dnl MSWIN_DIR_SYMBOL openldap,LDAP_DIR
615 dnl MSWIN_CHECK_DIR openldap,..\openldap\
616 dnl MSWIN_CHECK_DIR openldap,..\external\openldap\
617 dnl MSWIN_CHECK_DIR openldap,\openldap\
618 dnl MSWIN_CHECK_DIR openldap,c:\openldap\
620 AC_ARG_ENABLE(openldap,
621 [ --disable-openldap disable OpenLDAP support in PWLIB],
624 if test "$openldap" = "no" ; then
625 AC_SUBST(HAS_OPENLDAP, 0)
627 elif test $HAS_SASL = 0 ; then
628 AC_MSG_NOTICE(OpenLDAP disabled as SASL is not available)
630 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
631 AC_CHECK_HEADERS(ldap.h, HAS_OPENLDAP=1)
633 dnl posix4 is required by libldap_r on Solaris
634 if test "${OSTYPE:-unknown}" = "solaris"; then
635 OPENLDAPSYSLIBS=-lposix4
638 dnl check also for lldap_r presence (required for thread safe OpenLDAP?)
639 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
640 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
642 AC_CHECK_FILE(/usr/local/include/ldap.h, HAS_OPENLDAP=1)
643 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
644 OPENLDAPINCLUDEDIR=/usr/local/include
645 OPENLDAPLIBDIR=/usr/local/lib
646 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-L/usr/local/lib -llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
651 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
652 AC_SUBST(HAS_OPENLDAP, 1)
653 AC_DEFINE(P_LDAP, 1, "OpenLDAP found")
654 ENDLDLIBS="-lldap -lldap_r -llber $ENDLDLIBS"
655 if test "${OPENLDAPINCLUDEDIR}unset" != "unset" ; then
656 STDCCFLAGS="$STDCCFLAGS -I${OPENLDAPINCLUDEDIR}"
658 if test "${OPENLDAPLIBDIR}unset" != "unset" ; then
659 LDFLAGS="$LDFLAGS -L${OPENLDAPLIBDIR}"
665 dnl ########################################################################
667 dnl check for environment variable, then assume standard system install
668 dnl this process is made incredibly more complex by the fact that RedHad 9
669 dnl is completely fscked. The default OpenSSL installation requires Kerberos,
670 dnl even when Kerberos is not installed, requiring an explicit #define to
672 dnl As if that is not enough, autoconf gets very confused if configure.in
673 dnl contains a AC_CHECK_HEADER directive that never gets used. So we have
674 dnl to ensure that it is always called
676 dnl MSWIN_DISPLAY openssl,Open SSL
677 dnl MSWIN_CHECK_FILE openssl,inc32\openssl\ssl.h,P_SSL=1
678 dnl MSWIN_DIR_SYMBOL openssl,SSL_DIR
679 dnl MSWIN_CHECK_DIR openssl,..\openssl\
680 dnl MSWIN_CHECK_DIR openssl,..\external\openssl\
681 dnl MSWIN_CHECK_DIR openssl,\openssl\
682 dnl MSWIN_CHECK_DIR openssl,c:\openssl\
684 AC_ARG_ENABLE(openssl,
685 [ --disable-openssl disable OpenSSL support in PWLIB],
688 if test "$openssl" = "no" ; then
690 AC_SUBST(HAS_OPENSSL, 0)
693 dnl check to see OPENSSLDIR is set
694 dnl if it is, we assume it correct - no further checking required
695 if test ${OPENSSLDIR:-unset} != "unset" ; then
696 AC_MSG_CHECKING([for ${OPENSSLDIR}/include/openssl/ssl.h])
697 if test -e ${OPENSSLDIR}/include/openssl/ssl.h ; then
700 SSLINCLUDEDIR="${OPENSSLDIR}/include"
701 SSLLIBDIR="${OPENSSLDIR}/lib"
708 dnl if OPENSSLDIR is not set, then check to see if OpenSSL
709 dnl is installed in the standard system dirs. And also see if
710 dnl if it works using crazy RedHat checks
711 if test "${SSLHDR:-unset}" = "unset" ; then
712 AC_CHECK_HEADERS(openssl/ssl.h,SSLHDR=1)
713 if test "${SSLHDR:-unset}" = "unset" ; then
714 AC_MSG_CHECKING([if openssl/ssl.h works with OPENSSL_NO_KRB5])
715 AC_COMPILE_IFELSE([[#define OPENSSL_NO_KRB5
716 #include <openssl/ssl.h>
717 int main(int argc,char **argv){}]],SSLHDR=1)
718 if test ${SSLHDR:-unset} != "unset" ; then
720 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
721 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -L/usr/kerberos/lib"
722 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
729 dnl if we have not found OpenSSL so far, then look for it in
730 dnl several standard places, and check for crazy RedHat install too
731 if test "${SSLHDR:-unset}" = "unset" ; then
733 for openssl_dir in /usr/local/openssl /usr/local/ssl ; do
734 AC_MSG_CHECKING([for OpenSSL in $openssl_dir])
735 if test ! -f ${openssl_dir}/include/openssl/ssl.h ; then
738 AC_LANG_CONFTEST([[#include "${openssl_dir}/include/openssl/ssl.h"
739 int main(int argc,char **argv){ return 0; }]])
740 $CXX $CXXFLAGS -I${openssl_dir}/include -c conftest.cc > /dev/null 2>&1
741 if test $? = 0 ; then
745 SSLINCLUDEDIR="${openssl_dir}/include"
746 SSLLIBDIR="${openssl_dir}/lib"
750 AC_MSG_CHECKING([if ${openssl_dir}/include/openssl/ssl.h works with OPENSSL_NO_KRB5...])
751 AC_LANG_CONFTEST([[#define OPENSSL_NO_KRB5
752 #include "${openssl_dir}/include/openssl/ssl.h"
753 int main(int argc,char **argv){}]])
754 $CXX $CXXFLAGS -I${openssl_dir}/openssl/include -c conftest.cc > /dev/null 2>&1
755 if test $? = 0 ; then
758 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
759 SSLINCLUDEDIR="${openssl_dir}/include"
760 SSLLIBDIR="${openssl_dir}/lib"
761 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -L/usr/kerberos/lib"
762 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
772 if test ${SSLHDR:-unset} != "unset" ; then
773 AC_SUBST(HAS_OPENSSL, 1)
774 AC_DEFINE(P_SSL, 1, "OpenSSL found")
775 if test ${SSLINCLUDEDIR:-unset} != "unset" ; then
776 STDCCFLAGS="$STDCCFLAGS -I${SSLINCLUDEDIR}"
778 if test ${SSLLIBDIR:-unset} != "unset" ; then
779 LDFLAGS="$LDFLAGS -L${SSLLIBDIR}"
781 STDCCFLAGS="${STDCCFLAGS}${SSLCCFLAGS}"
782 ENDLDLIBS="$ENDLDLIBS -lssl -lcrypto"
786 AC_SUBST(P_STATIC_ENDLDLIBS)
787 AC_SUBST(P_STATIC_LDFLAGS)
789 dnl ########################################################################
790 dnl look for expat XML parser
792 dnl MSWIN_DISPLAY expat,Expat XML
793 dnl MSWIN_CHECK_FILE expat,lib\expat.h,P_EXPAT=1
794 dnl MSWIN_DIR_SYMBOL expat,EXPAT_DIR
795 dnl MSWIN_CHECK_DIR expat,..\expat\
796 dnl MSWIN_CHECK_DIR expat,..\external\expat\
797 dnl MSWIN_CHECK_DIR expat,\expat
798 dnl MSWIN_CHECK_DIR expat,c:\expat\
801 [ --disable-expat disable XML support in PWLIB],
804 if test "$expat" = "no" ; then
805 AC_SUBST(HAS_EXPAT, 0)
806 AC_DEFINE(P_EXPAT, 0)
809 AC_CHECK_HEADERS(expat.h, HAS_EXPAT=1)
810 if test "${HAS_EXPAT:-unset}" != "unset" ; then
811 AC_CHECK_LIB(expat, XML_ParserCreate, HAS_EXPAT=1, HAS_EXPAT=)
813 AC_CHECK_FILE(/usr/local/include/expat.h, HAS_EXPAT=1)
814 if test "${HAS_EXPAT:-unset}" != "unset" ; then
815 EXPATINCLUDEDIR=/usr/local/include
816 EXPATLIBDIR=/usr/local/lib
820 if test "${HAS_EXPAT:-unset}" != "unset" ; then
821 AC_SUBST(HAS_EXPAT, 1)
822 AC_DEFINE(P_EXPAT, 1, "expat found")
823 if test ${EXPATINCLUDEDIR:-unset} != "unset" ; then
824 STDCCFLAGS="$STDCCFLAGS -I${EXPATINCLUDEDIR}"
826 if test ${EXPATLIBDIR:-unset} != "unset" ; then
827 LDFLAGS="$LDFLAGS -L${EXPATLIBDIR}"
829 ENDLDLIBS="$ENDLDLIBS -lexpat"
834 dnl ########################################################################
837 dnl MSWIN_DISPLAY sapi,Speech API
838 dnl MSWIN_CHECK_FILE sapi,include\sphelper.h,P_SAPI=1
839 dnl MSWIN_DIR_SYMBOL sapi,SAPI_DIR
840 dnl MSWIN_CHECK_DIR sapi,\Program Files\Microsoft Speech SDK 5.1\
843 dnl ########################################################################
844 dnl look for IPV6 functions
846 dnl MSWIN_DISPLAY ipv6,IPv6 Support
847 dnl MSWIN_CHECK_FILE ipv6,ws2tcpip.h|sin6_scope_id,P_HAS_IPV6=1
848 dnl MSWIN_DIR_SYMBOL ipv6,IPV6_DIR
849 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft Visual Studio\VC98\Include\
850 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft SDK\include\
853 [ --disable-ipv6 disable IPV6 support in PWLIB],
856 if test "$ipv6" = "no" ; then
857 AC_DEFINE(P_HAS_IPV6, 0)
858 AC_SUBST(HAS_IPV6, 0)
860 AC_CACHE_CHECK([for IPv6 Support], HAS_IPV6,
861 [AC_TRY_COMPILE([#include <sys/types.h>
862 #include <netinet/in.h>],
863 [struct sockaddr_in6 s; s.sin6_scope_id = 0;], HAS_IPV6=yes, HAS_IPV6=no)])
865 if test $HAS_IPV6 = yes ; then
866 AC_DEFINE(P_HAS_IPV6, 1, "IPV6 enabled")
870 dnl ########################################################################
871 dnl look for QoS functions
873 dnl MSWIN_DISPLAY qos,QoS Support
874 dnl MSWIN_CHECK_FILE qos,qossp.h|QOS_DESTADDR,P_HAS_QOS=1
875 dnl MSWIN_DIR_SYMBOL qos,QOS_DIR
876 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft Visual Studio\VC98\Include\
877 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft SDK\include\
880 [ --disable-qos disable QOS support in PWLIB],
883 if test "$qos" = "no" ; then
884 AC_DEFINE([P_HAS_QOS], [0], [No QOS])
886 AC_DEFINE([P_HAS_QOS], [1], [Have QOS])
890 dnl ########################################################################
891 dnl look for SDL, but only if we have pthreads
893 dnl MSWIN_DISPLAY libsdl,Simple DirectMedia Layer
894 dnl MSWIN_CHECK_FILE libsdl,include\SDL_video.h,P_SDL=1
895 dnl MSWIN_CHECK_FILE libsdl,lib\SDL.lib,P_SDL_LIBDIR="lib"
896 dnl MSWIN_DIR_SYMBOL libsdl,SDL_DIR
897 dnl MSWIN_CHECK_DIR libsdl,..\sdl\
898 dnl MSWIN_CHECK_DIR libsdl,..\external\sdl\
899 dnl MSWIN_CHECK_DIR libsdl,\sdl\
900 dnl MSWIN_CHECK_DIR libsdl,c:\sdl\
903 [ --disable-sdl disable SDL support in PWLIB],
906 if test "$sdl" = "no" ; then
911 if test "${SDLLIB:-unset}" = "unset" ; then
916 AC_CHECK_HEADERS(SDL/SDL.h, HAS_SDL=1)
917 if test "${HAS_SDL:-unset}" != "unset" ; then
918 if test "${X11LIBDIR:-unset}" == "unset" ; then
919 X11LIBDIR=/usr/X11R6/lib
921 AC_CHECK_LIB(SDL, SDL_CreateYUVOverlay, HAS_SDL=1, HAS_SDL=, -L${X11LIBDIR} -lpthread -lX11 -lXext -laa)
924 dnl freeBSD SDL check
925 if test "${HAS_SDL:-unset}" = "unset" ; then
926 AC_CHECK_FILE(/usr/local/include/SDL11/SDL.h, HAS_SDL=1)
927 if test "${HAS_SDL:-unset}" != "unset" ; then
932 if test "${HAS_SDL:-unset}" != "unset" ; then
934 AC_DEFINE(P_SDL, 1, "SDL found")
935 if test ${SDLINCLUDEDIR:-unset} != "unset" ; then
936 STDCCFLAGS="$STDCCFLAGS -I${SDLINCLUDEDIR}"
938 if test ${SDLLIBDIR:-unset} != "unset" ; then
939 LDFLAGS="$LDFLAGS -L${SDLLIBDIR}"
941 ENDLDLIBS="$ENDLDLIBS -l${SDLLIB}"
946 dnl ########################################################################
947 dnl check for video capture support.
948 dnl videodev.h on linux
949 dnl machine/ioctl_meteor on FreeBSD
950 dnl i386/ioctl_meteor on OpenBSD
951 dnl dev/ic/bt8xx on NetBSD
954 [ --disable-video disable non-plugin video device support in PWLIB],
958 if test "$HAS_PLUGINS" = "0" ; then
959 if test "$video" != "no" ; then
960 AC_CHECK_HEADER(linux/videodev.h, HAS_VIDEO_CAPTURE=1)
961 dnl AC_CHECK_HEADER(machine/ioctl_meteor.h, HAS_VIDEO_CAPTURE=1)
962 dnl AC_CHECK_HEADER(i386/ioctl_meteor.h, HAS_VIDEO_CAPTURE=1)
963 dnl AC_CHECK_HEADER(dev/ic/bt8xx.h, HAS_VIDEO_CAPTURE=1)
964 if test "${HAS_VIDEO_CAPTURE}" = "0" ; then
965 AC_MSG_NOTICE(No Video Capture support)
966 AC_DEFINE([NO_VIDEO_CAPTURE], [], [No video capture])
970 AC_SUBST(HAS_VIDEO_CAPTURE)
972 dnl ########################################################################
973 dnl check for various functions
974 AC_ARG_ENABLE(alsa, [ --enable-alsa disable non-plugin ALSA audio support],enable_alsa=$enableval)
977 if test "$HAS_PLUGINS" = "0" ; then
978 if test "$enable_alsa" != "no" ; then
979 AC_CHECK_HEADER(alsa/asoundlib.h, HAS_ALSA=1)
980 AC_MSG_CHECKING(for ALSA sound support)
981 if test "${HAS_ALSA}" = "1"; then
983 ENDLDLIBS="$ENDLDLIBS -lasound"
991 dnl ########################################################################
992 dnl check for various functions
993 dnl According to Andre Schulze <as8@rncmm2.urz.tu-dresden.de>
994 dnl Solaris swab should not be used
995 if test "$OSTYPE" = "solaris" ; then
998 AC_CHECK_FUNC(swab,USE_SYSTEM_SWAB=1)
1000 if test "x$ac_cv_func_swab" = "xyes" ; then
1001 AC_DEFINE([USE_SYSTEM_SWAB], [], [Use system swab()])
1004 dnl ########################################################################
1005 dnl output make directives
1007 dnl resolver needs to be at the end
1008 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
1009 if test "${RESOLVER_LIBS:-unset}" != "unset" ; then
1010 ENDLDLIBS="$ENDLDLIBS $RESOLVER_LIBS"
1014 dnl dl needs to be at the end
1015 if test "${OSTYPE}" != "Darwin" ; then
1016 if test ${HAS_LIBDL} = yes ; then
1017 ENDLDLIBS="$ENDLDLIBS -ldl"
1021 AC_SUBST(STDCCFLAGS)
1022 AC_SUBST(STDCXXFLAGS)
1023 AC_SUBST(OPTSTDCCFLAGS)
1027 AC_CONFIG_FILES(make/ptbuildopts.mak)
1028 AC_CONFIG_FILES([make/ptlib-config], [chmod a+x make/ptlib-config])
1029 AC_CONFIG_FILES(Makefile)
1031 dnl ########################################################################
1032 dnl output header file
1033 #AC_CONFIG_FILES(include/ptbuildopts.h.in)
1034 AC_CONFIG_HEADERS(include/ptbuildopts.h)