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
223 AC_MSG_CHECKING(if linker accepts -felide-constructors)
224 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
225 $CXX $CFLAGS -felide-constructors conftest.cc > /dev/null 2>&1
226 if test $? = 0 ; then
228 STDCCFLAGS="$STDCCFLAGS -felide-constructors"
233 AC_MSG_CHECKING(if linker accepts -Wreorder)
234 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
235 $CXX $CFLAGS -Wreorder conftest.cc > /dev/null 2>&1
236 if test $? = 0 ; then
238 STDCCFLAGS="$STDCCFLAGS -Wreorder"
243 # AC_MSG_CHECKING(if linker accepts -Woverloaded-virtual)
244 # AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
245 # $CXX $CFLAGS -Woverloaded-virtual conftest.cc > /dev/null 2>&1
246 # if test $? = 0 ; then
248 # STDCCFLAGS="$STDCCFLAGS -Woverloaded-virtual"
255 AC_MSG_CHECKING(if linker accepts --gc-sections)
256 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
257 $CXX $CFLAGS -Wl,--gc-sections conftest.cc > /dev/null 2>&1
258 if test $? = 0 ; then
261 AC_MSG_CHECKING(if compiler accepts -ffunction-sections)
262 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
263 $CXX $CFLAGS -ffunction-sections -c conftest.cc > /dev/null 2>&1
264 if test $? = 0 ; then
266 STDCCFLAGS="$STDCCFLAGS -ffunction-sections"
272 AC_MSG_CHECKING(if compiler accepts -fdata-sections)
273 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
274 $CXX $CFLAGS -fdata-sections -c conftest.cc > /dev/null 2>&1
275 if test $? = 0 ; then
277 STDCCFLAGS="$STDCCFLAGS -fdata-sections"
283 dnl as much as this flag would help, there is no known linker
284 dnl that can handle pwlib when it has been compiled with it
285 dnl AC_MSG_CHECKING(if compiler accepts -fvtable-gc)
286 dnl AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
287 dnl $CXX $CFLAGS -fvtable-gc -c conftest.cc > /dev/null 2>&1
288 dnl if test $? = 0 ; then
289 dnl AC_MSG_RESULT(yes)
290 dnl STDCCFLAGS="$STDCCFLAGS -fvtable-gc"
293 dnl AC_MSG_RESULT(no)
296 if test $GCSECTIONS = 1; then
297 if test "${OSTYPE}" != "Darwin" ; then
298 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -Wl,--gc-sections"
308 dnl ########################################################################
309 dnl check for long double
312 if test $ac_cv_c_long_double != yes ; then
313 AC_DEFINE([PNO_LONG_DOUBLE], [], [No long double])
316 dnl ########################################################################
317 dnl check for number of parms to readdir
318 AC_MSG_CHECKING(if readdir_r has 2 parms)
319 AC_TRY_COMPILE([#define _POSIX_PTHREAD_SEMANTICS
320 #include <dirent.h>],
321 [DIR *s; struct dirent * e; readdir_r(s, e);], P_HAS_POSIX_READDIR_R=2, P_HAS_POSIX_READDIR_R=0)
322 if test ${P_HAS_POSIX_READDIR_R} = 2 ; then
326 AC_MSG_CHECKING(if readdir_r has 3 parms)
327 AC_TRY_COMPILE([#include <dirent.h>],
328 [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)
329 if test ${P_HAS_POSIX_READDIR_R} = 3 ; then
335 AC_DEFINE_UNQUOTED(P_HAS_POSIX_READDIR_R, ${P_HAS_POSIX_READDIR_R})
337 dnl ########################################################################
338 dnl check for streams types
341 AC_MSG_CHECKING(if using STL streams)
342 AC_TRY_COMPILE([#include <iostream>],
343 [int v = (int)std::ios_base::seekdir();], P_HAS_STL_STREAMS=1)
344 if test ${P_HAS_STL_STREAMS} = 1 ; then
349 AC_DEFINE_UNQUOTED(P_HAS_STL_STREAMS, ${P_HAS_STL_STREAMS})
351 dnl ########################################################################
352 dnl see if using GNU glibc++, because then we have atomic integer operations
355 AC_MSG_CHECKING(if atomic integer available)
356 AC_TRY_COMPILE([#include <bits/atomicity.h>],
357 [_Atomic_word val;], P_HAS_ATOMIC_INT=1)
358 if test ${P_HAS_ATOMIC_INT} = 1 ; then
363 AC_DEFINE_UNQUOTED(P_HAS_ATOMIC_INT, ${P_HAS_ATOMIC_INT})
366 dnl ########################################################################
367 dnl check for pthreads library
369 dnl MSWIN_DISPLAY semaphore,Semaphore Support
370 dnl MSWIN_DEFINE semaphore,P_HAS_SEMAPHORES
372 dnl Linux, Mac OS X use libpthread and -lpthread
373 dnl FreeBSD uses the -pthread compiler option and uses libc_r
375 AC_CHECK_LIB(pthread, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
376 if test ${HAS_PTHREADS} = yes ; then
377 ENDLDLIBS="$ENDLDLIBS -lpthread"
378 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT"
381 AC_CHECK_LIB(c_r, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
382 if test ${HAS_PTHREADS} = yes ; then
383 ENDLDLIBS="$ENDLDLIBS -pthread"
384 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT -pthread"
389 if test ${HAS_PTHREADS} != yes ; then
390 AC_MSG_ERROR(must have pthreads!)
393 dnl ########################################################################
394 dnl check for XPG6 compliant pthreads (timed spinlocks)
396 if test ${HAS_PTHREADS} = yes ; then
397 AC_CHECK_LIB(pthread, pthread_mutex_timedlock, HAS_PTHREADS_XPG6=yes, HAS_PTHREADS_XPG6=no)
398 if test ${HAS_PTHREADS_XPG6} = yes ; then
399 AC_DEFINE(P_PTHREADS_XPG6, 1, "XPG6 compliant pthreads found")
402 AC_CHECK_LIB(pthread, sem_timedwait, HAS_SEMAPHORES_XPG6=yes, HAS_SEMAPHORES_XPG6=no)
403 if test ${HAS_SEMAPHORES_XPG6} = yes ; then
404 AC_MSG_CHECKING(if sem_timedwait is compilable)
405 AC_TRY_COMPILE([#include <semaphore.h>],
406 [sem_t *s; const struct timespec * t; sem_timedwait(s, t);], HAS_SEMAPHORES_XPG6=yes, HAS_SEMAPHORES_XPG6=no)
407 if test ${HAS_SEMAPHORES_XPG6} = yes ; then
408 AC_DEFINE(P_HAS_SEMAPHORES_XPG6, 1, "Supports XPG6 Semaphores")
416 dnl ########################################################################
417 dnl check for recursive mutexes
418 P_HAS_RECURSIVE_MUTEX=0
419 AC_MSG_CHECKING(if recursive mutexes are available)
420 AC_TRY_COMPILE([#include <pthread.h>],
421 [pthread_mutexattr_t attr; pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);], P_HAS_RECURSIVE_MUTEX=1)
422 if test ${P_HAS_RECURSIVE_MUTEX} = 1 ; then
427 AC_DEFINE_UNQUOTED(P_HAS_RECURSIVE_MUTEX, ${P_HAS_RECURSIVE_MUTEX})
430 dnl ########################################################################
431 dnl check for regex library
433 dnl yes this test needs to be outside the if below
434 dnl because autoconf needs to initialise stuff. without this
435 dnl all sorts of strange things happen
436 AC_CHECK_HEADERS(regex.h, HAS_REGEX=yes)
438 AC_ARG_ENABLE(internalregex,
439 [ --enable-internalregex force internal regex library],
440 internalregex=$enableval)
441 if test "$internalregex" = "yes" ; then
442 AC_MSG_NOTICE(Forcing use of internal regex library)
444 if test "$HAS_REGEX" = "yes" ; then
445 AC_CHECK_FUNC(regcomp, HAS_REGEX=yes)
446 if test "$HAS_REGEX" = "yes" ; then
447 AC_SUBST(HAS_REGEX, 1)
448 AC_DEFINE(P_REGEX, 1, "Regex library found")
454 dnl ########################################################################
455 dnl check for dynamic library code (dlopen and friends)
457 dnl MSWIN DLL Support,,P_DYNALINK
462 if test ${OSTYPE} = beos ; then
464 AC_DEFINE(P_DYNALINK, 1, "dlopen implemented inside pwlib in BeOS")
465 elif test ${OSTYPE} = Darwin ; then
467 AC_DEFINE(P_DYNALINK, 1, "dlopen implemented inside pwlib in Darwin")
469 AC_CHECK_HEADERS(dlfcn.h, HAS_DLFCN=yes, HAS_DLFCN=no)
470 if test "$HAS_DLFCN" = yes ; then
471 AC_MSG_CHECKING(if dlopen is available)
472 AC_TRY_COMPILE([#include <dlfcn.h>],
473 [void * p = dlopen("lib", 0);], HAS_DLOPEN=yes, HAS_DLOPEN=no)
474 if test "$HAS_DLOPEN" = no ; then
479 AC_DEFINE(P_DYNALINK, 1, "dlopen found")
480 AC_CHECK_LIB(dl,dlopen,HAS_LIBDL=yes, HAS_LIBDL=no)
485 dnl #########################################################################
486 dnl check to see if plugins enabled
487 dnl MSWIN Plugin Support,,P_HAS_PLUGINS
489 AC_MSG_CHECKING(if plugins support needs to be compiled)
490 AC_ARG_ENABLE(plugins,
491 [ --enable-plugins enable plugins' support in PWLIB],
495 if test "${plugins}" = "no" ; then
497 elif test "${P_DYNALINK:-unset}" = "unset" ; then
498 AC_MSG_RESULT(plugins disabled as dlopen not available)
500 AC_MSG_RESULT(plugins enabled)
502 AC_DEFINE(P_HAS_PLUGINS, 1, "plugins enabled")
505 AC_SUBST(HAS_PLUGINS)
507 if test "x$LIB64" != "x" ; then
508 AC_DEFINE_UNQUOTED([P_DEFAULT_PLUGIN_DIR], ["${INSTALLPREFIX}/lib64/pwlib"], [Default plugin directory])
510 AC_DEFINE_UNQUOTED([P_DEFAULT_PLUGIN_DIR], ["${INSTALLPREFIX}/lib/pwlib"], [Default plugin directory])
513 dnl ########################################################################
514 dnl look for DNS resolver code (must be done before OpenLDAP)
515 dnl on some systems, the resolver is in libc
516 dnl but needs resolv.h included which defines res_search as __res_search
518 dnl MSWIN_DISPLAY resolver,DNS Resolver
519 dnl MSWIN_CHECK_FILE resolver,include\windns.h,P_DNS=1
520 dnl MSWIN_DIR_SYMBOL resolver,DNS_DIR
521 dnl MSWIN_CHECK_DIR resolver,\Program Files\Microsoft SDK\
523 AC_ARG_ENABLE(resolver,
524 [ --disable-resolver disable DNS resolver support in PWLIB],
527 if test "$resolver" = "no" ; then
530 AC_CHECK_FUNC(res_search, HAVE_RESOLVER=1)
531 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
534 AC_MSG_CHECKING([for res_search in -lresolv])
537 #include <netinet/in.h>
539 int main(int argc,char **argv){
540 res_search (NULL, 0, 0, NULL, 0);
542 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
544 RESOLVER_LIBS="-lresolv"
546 AC_SEARCH_LIBS(__res_search, resolv, HAVE_RESOLVER=1)
550 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
551 AC_DEFINE(P_DNS, 1, "resolver libraries found")
555 dnl ########################################################################
556 dnl look for OpenLDAP
558 dnl MSWIN_DISPLAY openldap,Open LDAP
559 dnl MSWIN_CHECK_FILE openldap,include\ldap.h|OpenLDAP,P_LDAP=1
560 dnl MSWIN_DIR_SYMBOL openldap,LDAP_DIR
561 dnl MSWIN_CHECK_DIR openldap,..\openldap\
562 dnl MSWIN_CHECK_DIR openldap,..\external\openldap\
563 dnl MSWIN_CHECK_DIR openldap,\openldap\
564 dnl MSWIN_CHECK_DIR openldap,c:\openldap\
566 AC_ARG_ENABLE(openldap,
567 [ --disable-openldap disable OpenLDAP support in PWLIB],
570 if test "$openldap" = "no" ; then
571 AC_SUBST(HAS_OPENLDAP, 0)
574 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
575 AC_CHECK_HEADERS(ldap.h, HAS_OPENLDAP=1)
577 dnl posix4 is required by libldap_r on Solaris
578 if test "${OSTYPE:-unknown}" = "solaris"; then
579 OPENLDAPSYSLIBS=-lposix4
582 dnl check also for lldap_r presence (required for thread safe OpenLDAP?)
583 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
584 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
586 AC_CHECK_FILE(/usr/local/include/ldap.h, HAS_OPENLDAP=1)
587 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
588 OPENLDAPINCLUDEDIR=/usr/local/include
589 OPENLDAPLIBDIR=/usr/local/lib
590 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-L/usr/local/lib -llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
595 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
596 AC_SUBST(HAS_OPENLDAP, 1)
597 AC_DEFINE(P_LDAP, 1, "OpenLDAP found")
598 if test ${OPENLDAPINCLUDEDIR:-unset} != "unset" ; then
599 STDCCFLAGS="$STDCCFLAGS -I${OPENLDAPINCLUDEDIR}"
601 if test ${OPENLDAPLIBDIR:-unset} != "unset" ; then
602 LDFLAGS="$LDFLAGS -L${OPENLDAPLIBDIR}"
605 dnl Not all Unices have SASL installed as a separate library (Solaris)
606 dnl Some newer Linux boxes have libsasl2 instead of libsasl
607 AC_CHECK_LIB(sasl, sasl_client_auth, HAS_SASL=1, HAS_SASL=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
608 if test ${HAS_SASL:-unset} = "unset" ; then
609 AC_CHECK_LIB(sasl2, sasl_version, HAS_SASL2=1, HAS_SASL2=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
611 if test ${HAS_SASL:-unset} != "unset" ; then
612 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber -lsasl"
613 elif test ${HAS_SASL2:-unset} != "unset" ; then
614 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber -lsasl2"
616 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber"
621 dnl ########################################################################
623 dnl check for environment variable, then assume standard system install
624 dnl this process is made incredibly more complex by the fact that RedHad 9
625 dnl is completely fscked. The default OpenSSL installation requires Kerberos,
626 dnl even when Kerberos is not installed, requiring an explicit #define to
628 dnl As if that is not enough, autoconf gets very confused if configure.in
629 dnl contains a AC_CHECK_HEADER directive that never gets used. So we have
630 dnl to ensure that it is always called
632 dnl MSWIN_DISPLAY openssl,Open SSL
633 dnl MSWIN_CHECK_FILE openssl,inc32\openssl\ssl.h,P_SSL=1
634 dnl MSWIN_DIR_SYMBOL openssl,SSL_DIR
635 dnl MSWIN_CHECK_DIR openssl,..\openssl\
636 dnl MSWIN_CHECK_DIR openssl,..\external\openssl\
637 dnl MSWIN_CHECK_DIR openssl,\openssl\
638 dnl MSWIN_CHECK_DIR openssl,c:\openssl\
640 AC_ARG_ENABLE(openssl,
641 [ --disable-openssl disable OpenSSL support in PWLIB],
644 if test "$openssl" = "no" ; then
646 AC_SUBST(HAS_OPENSSL, 0)
649 dnl check to see OPENSSLDIR is set
650 dnl if it is, we assume it correct - no further checking required
651 if test ${OPENSSLDIR:-unset} != "unset" ; then
652 AC_MSG_CHECKING([for ${OPENSSLDIR}/include/openssl/ssl.h])
653 if test -e ${OPENSSLDIR}/include/openssl/ssl.h ; then
656 SSLINCLUDEDIR="${OPENSSLDIR}/include"
657 SSLLIBDIR="${OPENSSLDIR}/lib"
664 dnl if OPENSSLDIR is not set, then check to see if OpenSSL
665 dnl is installed in the standard system dirs. And also see if
666 dnl if it works using crazy RedHat checks
667 if test "${SSLHDR:-unset}" = "unset" ; then
668 AC_CHECK_HEADERS(openssl/ssl.h,SSLHDR=1)
669 if test "${SSLHDR:-unset}" = "unset" ; then
670 AC_MSG_CHECKING([if openssl/ssl.h works with OPENSSL_NO_KRB5])
671 AC_COMPILE_IFELSE([[#define OPENSSL_NO_KRB5
672 #include <openssl/ssl.h>
673 int main(int argc,char **argv){}]],SSLHDR=1)
674 if test ${SSLHDR:-unset} != "unset" ; then
676 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
677 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -L/usr/kerberos/lib"
678 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
685 dnl if we have not found OpenSSL so far, then look for it in
686 dnl several standard places, and check for crazy RedHat install too
687 if test "${SSLHDR:-unset}" = "unset" ; then
689 for openssl_dir in /usr/local/openssl /usr/local/ssl ; do
690 AC_MSG_CHECKING([for OpenSSL in $openssl_dir])
691 if test ! -f ${openssl_dir}/include/openssl/ssl.h ; then
694 AC_LANG_CONFTEST([[#include "${openssl_dir}/include/openssl/ssl.h"
695 int main(int argc,char **argv){ return 0; }]])
696 $CXX $CXXFLAGS -I${openssl_dir}/include -c conftest.cc > /dev/null 2>&1
697 if test $? = 0 ; then
701 SSLINCLUDEDIR="${openssl_dir}/include"
702 SSLLIBDIR="${openssl_dir}/lib"
706 AC_MSG_CHECKING([if ${openssl_dir}/include/openssl/ssl.h works with OPENSSL_NO_KRB5...])
707 AC_LANG_CONFTEST([[#define OPENSSL_NO_KRB5
708 #include "${openssl_dir}/include/openssl/ssl.h"
709 int main(int argc,char **argv){}]])
710 $CXX $CXXFLAGS -I${openssl_dir}/openssl/include -c conftest.cc > /dev/null 2>&1
711 if test $? = 0 ; then
714 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
715 SSLINCLUDEDIR="${openssl_dir}/include"
716 SSLLIBDIR="${openssl_dir}/lib"
717 P_STATIC_LDFLAGS="$P_STATIC_LDFLAGS -L/usr/kerberos/lib"
718 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
728 if test ${SSLHDR:-unset} != "unset" ; then
729 AC_SUBST(HAS_OPENSSL, 1)
730 AC_DEFINE(P_SSL, 1, "OpenSSL found")
731 if test ${SSLINCLUDEDIR:-unset} != "unset" ; then
732 STDCCFLAGS="$STDCCFLAGS -I${SSLINCLUDEDIR}"
734 if test ${SSLLIBDIR:-unset} != "unset" ; then
735 LDFLAGS="$LDFLAGS -L${SSLLIBDIR}"
737 STDCCFLAGS="${STDCCFLAGS}${SSLCCFLAGS}"
738 ENDLDLIBS="$ENDLDLIBS -lssl -lcrypto"
742 AC_SUBST(P_STATIC_ENDLDLIBS)
743 AC_SUBST(P_STATIC_LDFLAGS)
745 dnl ########################################################################
746 dnl look for expat XML parser
748 dnl MSWIN_DISPLAY expat,Expat XML
749 dnl MSWIN_CHECK_FILE expat,lib\expat.h,P_EXPAT=1
750 dnl MSWIN_DIR_SYMBOL expat,EXPAT_DIR
751 dnl MSWIN_CHECK_DIR expat,..\expat\
752 dnl MSWIN_CHECK_DIR expat,..\external\expat\
753 dnl MSWIN_CHECK_DIR expat,\expat
754 dnl MSWIN_CHECK_DIR expat,c:\expat\
757 [ --disable-expat disable XML support in PWLIB],
760 if test "$expat" = "no" ; then
761 AC_SUBST(HAS_EXPAT, 0)
762 AC_DEFINE(P_EXPAT, 0)
765 AC_CHECK_HEADERS(expat.h, HAS_EXPAT=1)
766 if test "${HAS_EXPAT:-unset}" != "unset" ; then
767 AC_CHECK_LIB(expat, XML_ParserCreate, HAS_EXPAT=1, HAS_EXPAT=)
769 AC_CHECK_FILE(/usr/local/include/expat.h, HAS_EXPAT=1)
770 if test "${HAS_EXPAT:-unset}" != "unset" ; then
771 EXPATINCLUDEDIR=/usr/local/include
772 EXPATLIBDIR=/usr/local/lib
776 if test "${HAS_EXPAT:-unset}" != "unset" ; then
777 AC_SUBST(HAS_EXPAT, 1)
778 AC_DEFINE(P_EXPAT, 1, "expat found")
779 if test ${EXPATINCLUDEDIR:-unset} != "unset" ; then
780 STDCCFLAGS="$STDCCFLAGS -I${EXPATINCLUDEDIR}"
782 if test ${EXPATLIBDIR:-unset} != "unset" ; then
783 LDFLAGS="$LDFLAGS -L${EXPATLIBDIR}"
785 ENDLDLIBS="$ENDLDLIBS -lexpat"
790 dnl ########################################################################
793 dnl MSWIN_DISPLAY sapi,Speech API
794 dnl MSWIN_CHECK_FILE sapi,include\sphelper.h,P_SAPI=1
795 dnl MSWIN_DIR_SYMBOL sapi,SAPI_DIR
796 dnl MSWIN_CHECK_DIR sapi,\Program Files\Microsoft Speech SDK 5.1\
798 dnl ########################################################################
799 dnl look for IPV6 functions
801 dnl MSWIN_DISPLAY ipv6,IPv6 Support
802 dnl MSWIN_CHECK_FILE ipv6,ws2tcpip.h|sin6_scope_id,P_HAS_IPV6=1
803 dnl MSWIN_DIR_SYMBOL ipv6,IPV6_DIR
804 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft Visual Studio\VC98\Include\
805 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft SDK\include\
808 [ --disable-ipv6 disable IPV6 support in PWLIB],
811 if test "$ipv6" = "no" ; then
812 AC_DEFINE(P_HAS_IPV6, 0)
813 AC_SUBST(HAS_IPV6, 0)
815 AC_CACHE_CHECK([for IPv6 Support], HAS_IPV6,
816 [AC_TRY_COMPILE([#include <sys/types.h>
817 #include <netinet/in.h>],
818 [struct sockaddr_in6 s; s.sin6_scope_id = 0;], HAS_IPV6=yes, HAS_IPV6=no)])
820 if test $HAS_IPV6 = yes ; then
821 AC_DEFINE(P_HAS_IPV6, 1, "IPV6 enabled")
825 dnl ########################################################################
826 dnl look for QoS functions
828 dnl MSWIN_DISPLAY qos,QoS Support
829 dnl MSWIN_CHECK_FILE qos,qossp.h|QOS_DESTADDR,P_HAS_QOS=1
830 dnl MSWIN_DIR_SYMBOL qos,QOS_DIR
831 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft Visual Studio\VC98\Include\
832 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft SDK\include\
835 [ --disable-qos disable QOS support in PWLIB],
838 if test "$qos" = "no" ; then
839 AC_DEFINE([P_HAS_QOS], [0], [No QOS])
841 AC_DEFINE([P_HAS_QOS], [1], [Have QOS])
845 dnl ########################################################################
846 dnl look for SDL, but only if we have pthreads
848 dnl MSWIN_DISPLAY libsdl,Simple DirectMedia Layer
849 dnl MSWIN_CHECK_FILE libsdl,include\SDL_video.h,P_SDL=1
850 dnl MSWIN_CHECK_FILE libsdl,lib\SDL.lib,P_SDL_LIBDIR="lib"
851 dnl MSWIN_DIR_SYMBOL libsdl,SDL_DIR
852 dnl MSWIN_CHECK_DIR libsdl,..\sdl\
853 dnl MSWIN_CHECK_DIR libsdl,..\external\sdl\
854 dnl MSWIN_CHECK_DIR libsdl,\sdl\
855 dnl MSWIN_CHECK_DIR libsdl,c:\sdl\
858 [ --disable-sdl disable SDL support in PWLIB],
861 if test "$sdl" = "no" ; then
866 if test "${SDLLIB:-unset}" = "unset" ; then
871 AC_CHECK_HEADERS(SDL/SDL.h, HAS_SDL=1)
872 if test "${HAS_SDL:-unset}" != "unset" ; then
873 if test "${X11LIBDIR:-unset}" == "unset" ; then
874 X11LIBDIR=/usr/lib/X11R6
876 AC_CHECK_LIB(SDL, SDL_CreateYUVOverlay, HAS_SDL=1, HAS_SDL=, -L${X11LIBDIR} -lpthread -lX11 -lXext -laa)
879 dnl freeBSD SDL check
880 if test "${HAS_SDL:-unset}" = "unset" ; then
881 AC_CHECK_FILE(/usr/local/include/SDL11/SDL.h, HAS_SDL=1)
882 if test "${HAS_SDL:-unset}" != "unset" ; then
887 if test "${HAS_SDL:-unset}" != "unset" ; then
889 AC_DEFINE(P_SDL, 1, "SDL found")
890 if test ${SDLINCLUDEDIR:-unset} != "unset" ; then
891 STDCCFLAGS="$STDCCFLAGS -I${SDLINCLUDEDIR}"
893 if test ${SDLLIBDIR:-unset} != "unset" ; then
894 LDFLAGS="$LDFLAGS -L${SDLLIBDIR}"
896 ENDLDLIBS="$ENDLDLIBS -l${SDLLIB}"
901 dnl ########################################################################
902 dnl check for video capture support.
903 dnl videodev.h on linux
904 dnl machine/ioctl_meteor on FreeBSD
905 dnl i386/ioctl_meteor on OpenBSD
906 dnl dev/ic/bt8xx on NetBSD
909 [ --disable-video disable non-plugin video device support in PWLIB],
913 if test "$HAS_PLUGINS" = "0" ; then
914 if test "$video" != "no" ; then
915 AC_CHECK_HEADER(linux/videodev.h, HAS_VIDEO_CAPTURE=1)
916 dnl AC_CHECK_HEADER(machine/ioctl_meteor.h, HAS_VIDEO_CAPTURE=1)
917 dnl AC_CHECK_HEADER(i386/ioctl_meteor.h, HAS_VIDEO_CAPTURE=1)
918 dnl AC_CHECK_HEADER(dev/ic/bt8xx.h, HAS_VIDEO_CAPTURE=1)
919 if test "${HAS_VIDEO_CAPTURE}" = "0" ; then
920 AC_MSG_NOTICE(No Video Capture support)
921 AC_DEFINE([NO_VIDEO_CAPTURE], [], [No video capture])
925 AC_SUBST(HAS_VIDEO_CAPTURE)
927 dnl ########################################################################
928 dnl check for various functions
929 AC_ARG_ENABLE(alsa, [ --enable-alsa disable non-plugin ALSA audio support],enable_alsa=$enableval)
932 if test "$HAS_PLUGINS" = "0" ; then
933 if test "$enable_alsa" != "no" ; then
934 AC_CHECK_HEADER(alsa/asoundlib.h, HAS_ALSA=1)
935 AC_MSG_CHECKING(for ALSA sound support)
936 if test "${HAS_ALSA}" = "1"; then
938 ENDLDLIBS="$ENDLDLIBS -lasound"
946 dnl ########################################################################
947 dnl check for various functions
948 dnl According to Andre Schulze <as8@rncmm2.urz.tu-dresden.de>
949 dnl Solaris swab should not be used
950 if test "$OSTYPE" = "solaris" ; then
953 AC_CHECK_FUNC(swab,USE_SYSTEM_SWAB=1)
955 if test "x$ac_cv_func_swab" = "xyes" ; then
956 AC_DEFINE([USE_SYSTEM_SWAB], [], [Use system swab()])
959 dnl ########################################################################
960 dnl output make directives
962 dnl resolver needs to be at the end
963 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
964 if test "${RESOLVER_LIBS:-unset}" != "unset" ; then
965 ENDLDLIBS="$ENDLDLIBS $RESOLVER_LIBS"
969 dnl dl needs to be at the end
970 if test "${OSTYPE}" != "Darwin" ; then
971 if test ${HAS_LIBDL} = yes ; then
972 ENDLDLIBS="$ENDLDLIBS -ldl"
977 AC_SUBST(OPTSTDCCFLAGS)
981 AC_CONFIG_FILES(make/ptbuildopts.mak)
982 AC_CONFIG_FILES([make/ptlib-config], [chmod a+x make/ptlib-config])
983 AC_CONFIG_FILES(Makefile)
985 dnl ########################################################################
986 dnl output header file
987 #AC_CONFIG_FILES(include/ptbuildopts.h.in)
988 AC_CONFIG_HEADERS(include/ptbuildopts.h)