1 AC_INIT(include/ptlib.h)
3 AC_CONFIG_SUBDIRS(plugins)
7 dnl ########################################################################
8 dnl set the PWLIB directory to the current directory
12 dnl set the pwlib installation dir for pwlib-config
15 dnl ########################################################################
16 dnl set the PREFIX accordingly
17 if test "x$prefix" = "xNONE"; then
18 INSTALLPREFIX="/usr/local"
20 INSTALLPREFIX="${prefix}"
23 AC_SUBST(INSTALLPREFIX)
26 dnl ########################################################################
27 dnl set LIBDIR accordingly
32 dnl ########################################################################
33 dnl extract the PWLIB version
34 MAJOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MAJOR_VERSION | cut -f3 -d' '`
35 MINOR_VERSION=`cat ${PWLIBDIR}/version.h | grep MINOR_VERSION | cut -f3 -d' '`
36 BUILD_NUMBER=`cat ${PWLIBDIR}/version.h | grep BUILD_NUMBER | cut -f3 -d' '`
37 PWLIB_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}"
38 AC_SUBST(MAJOR_VERSION)
39 AC_SUBST(MINOR_VERSION)
40 AC_SUBST(BUILD_NUMBER)
41 AC_SUBST(PWLIB_VERSION)
42 AC_SUBST(MAJOR_VERSION, $MAJOR_VERSION)
43 AC_SUBST(MINOR_VERSION, $MINOR_VERSION)
44 AC_SUBST(BUILD_NUMBER, $BUILD_NUMBER)
46 AC_MSG_NOTICE(PTLib version is ${PWLIB_VERSION});
48 AC_DEFINE_UNQUOTED(PWLIB_MAJOR, $MAJOR_VERSION)
49 AC_DEFINE_UNQUOTED(PWLIB_MINOR, $MINOR_VERSION)
50 AC_DEFINE_UNQUOTED(PWLIB_BUILD, $BUILD_NUMBER)
51 AC_DEFINE_UNQUOTED(PWLIB_VERSION, "$PWLIB_VERSION")
53 dnl ########################################################################
54 dnl set the OSTYPE and MACHTYPE
62 linux*) OSTYPE=linux ;
63 OSRELEASE=`uname -r` ;
65 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
68 freebsd* ) OSTYPE=FreeBSD ;
70 if test "x$OSRELEASE" = "x"; then
71 OSRELEASE=`sysctl -n kern.osreldate` ;
73 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
76 openbsd* ) OSTYPE=OpenBSD ;
78 OSRELEASE=`sysctl -n kern.osrevision` ;
79 ENDLDLIBS="-lossaudio" ;
80 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
83 netbsd* ) OSTYPE=NetBSD ;
85 OSRELEASE=`/sbin/sysctl -n kern.osrevision` ;
86 ENDLDLIBS="-lossaudio" ;
87 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
90 solaris* | sunos ) OSTYPE=solaris ;
92 OSRELEASE=`uname -r | sed "s/5\.//g"` ;
93 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
96 darwin* ) OSTYPE=Darwin ;
98 OSRELEASE=`uname -r | sed "s/\.//g"` ;
100 STDCCFLAGS="$STDCCFLAGS -DP_USE_PRAGMA"
103 * ) OSTYPE="$target_os" ;
104 OS_TAG="P_UNKNOWN_OS" ;
105 OSRELEASE="${OSTYPE}_`uname -r`" ;
106 AC_MSG_WARN("OS $target_os not recognized - proceed with caution!") ;
112 case "$target_cpu" in
113 x86 | i686 | i586 | i486 | i386 ) MACHTYPE=x86
116 x86_64) MACHTYPE=x86_64 ;
120 alpha | alphaev56) MACHTYPE=alpha ;
124 sparc ) MACHTYPE=sparc ;
127 powerpc ) MACHTYPE=ppc ;
130 powerpc64 ) MACHTYPE=ppc ;
134 ppc64 ) MACHTYPE=ppc ;
141 ia64) MACHTYPE=ia64 ;
145 s390x) MACHTYPE=s390x ;
149 * ) MACHTYPE=$target_cpu ;
150 AC_MSG_WARN("CPU $target_cpu not recognized - proceed with caution!") ;;
153 AC_MSG_NOTICE(OSTYPE set to $OSTYPE);
154 AC_MSG_NOTICE(OSRELEASE set to $OSRELEASE);
155 AC_MSG_NOTICE(MACHTYPE set to $MACHTYPE);
157 AC_SUBST(MACHTYPE, $MACHTYPE)
158 AC_SUBST(OSTYPE, $OSTYPE)
159 AC_SUBST(OSRELEASE, $OSRELEASE)
160 AC_SUBST(TARGETDIR, $TARGETDIR)
162 AC_DEFINE_UNQUOTED($OS_TAG, "$OSRELEASE")
164 AC_DEFINE(PHAS_TEMPLATES, 1)
166 if test "x$P_64BIT" != "x" ; then
167 AC_DEFINE(P_64BIT, 1)
170 AC_DEFINE(P_PTHREADS, 1, "PThreads found")
172 dnl posix semaphore support in darwin/macosx is broken
174 if test ${OSTYPE} != Darwin ; then
175 AC_DEFINE(P_HAS_SEMAPHORES, 1, "using semaphores")
178 dnl ########################################################################
179 dnl set the shared library extension, if not already set
181 if test "x${SHAREDLIBEXT}" = "x" ; then
184 AC_SUBST(SHAREDLIBEXT, $SHAREDLIBEXT)
185 AC_DEFINE(P_SHAREDLIBEXT, $SHAREDLIBEXT, "shared library extension")
187 dnl ########################################################################
188 dnl check the endianness
190 dnl MSWIN_DISPLAY byteorder,Byte Order
191 dnl MSWIN_DEFINE byteorder,PBYTE_ORDER=PLITTLE_ENDIAN
194 if test ${ac_cv_c_bigendian} = yes ; then
195 PBYTE_ORDER=PBIG_ENDIAN
197 PBYTE_ORDER=PLITTLE_ENDIAN
200 AC_DEFINE_UNQUOTED(PBYTE_ORDER, $PBYTE_ORDER, "byte order")
202 dnl ########################################################################
203 dnl look for compile flags
206 dnl AC_MSG_CHECKING(if compiler accepts -fno-rtti)
207 dnl AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
208 dnl $CC $CFLAGS -fno-rtti -c conftest.c > /dev/null 2>&1
209 dnl if test $? = 0 ; then
210 dnl AC_MSG_RESULT(yes)
211 dnl STDCCFLAGS="$STDCCFLAGS -fno-rtti"
213 dnl AC_MSG_RESULT(no)
218 AC_MSG_CHECKING(if linker accepts --gc-sections)
219 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
220 $CC $CFLAGS -Wl,--gc-sections conftest.c > /dev/null 2>&1
221 if test $? = 0 ; then
224 AC_MSG_CHECKING(if compiler accepts -ffunction-sections)
225 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
226 $CC $CFLAGS -ffunction-sections -c conftest.c > /dev/null 2>&1
227 if test $? = 0 ; then
229 STDCCFLAGS="$STDCCFLAGS -ffunction-sections"
235 AC_MSG_CHECKING(if compiler accepts -fdata-sections)
236 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
237 $CC $CFLAGS -fdata-sections -c conftest.c > /dev/null 2>&1
238 if test $? = 0 ; then
240 STDCCFLAGS="$STDCCFLAGS -fdata-sections"
246 AC_MSG_CHECKING(if compiler accepts -fvtable-gc)
247 AC_LANG_CONFTEST([[int main(int ac,char **av) { return 0; }]])
248 $CPLUSPLUS $CFLAGS -fvtable-gc -c conftest.c > /dev/null 2>&1
249 if test $? = 0 ; then
251 STDCCFLAGS="$STDCCFLAGS -fvtable-gc"
257 if test $GCSECTIONS = 1; then
258 if test "${OSTYPE}" != "Darwin" ; then
259 LDFLAGS="$LDFLAGS -Wl,--gc-sections"
267 dnl ########################################################################
268 dnl check for long double
271 if test $ac_cv_c_long_double != yes ; then
272 AC_DEFINE(PNO_LONG_DOUBLE)
275 dnl ########################################################################
276 dnl check for pthreads library
278 dnl MSWIN_DISPLAY semaphore,Semaphore Support
279 dnl MSWIN_DEFINE semaphore,P_HAS_SEMAPHORES
281 dnl Linux, Mac OS X use libpthread and -lpthread
282 dnl FreeBSD uses the -pthread compiler option and uses libc_r
284 AC_CHECK_LIB(pthread, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
285 if test ${HAS_PTHREADS} = yes ; then
286 ENDLDLIBS="$ENDLDLIBS -lpthread"
287 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT"
290 AC_CHECK_LIB(c_r, pthread_create, HAS_PTHREADS=yes, HAS_PTHREADS=no)
291 if test ${HAS_PTHREADS} = yes ; then
292 ENDLDLIBS="$ENDLDLIBS -pthread"
293 STDCCFLAGS="$STDCCFLAGS -D_REENTRANT -pthread"
298 if test ${HAS_PTHREADS} != yes ; then
299 AC_MSG_ERROR(must have pthreads!)
302 dnl ########################################################################
303 dnl check for regex library
304 AC_CHECK_FUNC(regcomp,HAS_REGEX=1)
305 if test "x$HAS_REGEX" != "x" ; then
306 AC_CHECK_HEADERS(regex.h, HAS_REGEX=1, HAS_REGEX=)
309 AC_DEFINE_UNQUOTED(P_REGEX, $HAS_REGEX, "Regex library found")
312 dnl ########################################################################
313 dnl check for dynamic library code (dlopen end friends)
315 dnl MSWIN DLL Support,,P_DYNALINK
320 if test ${OSTYPE} = Darwin ; then
322 AC_DEFINE(P_DYNALINK, 1, "dlopen implemented inside pwlib in darwin")
324 AC_CHECK_HEADERS(dlfcn.h, HAS_DLFCN=yes, HAS_DLFCN=no)
325 if test "$HAS_DLFCN" = yes ; then
326 AC_MSG_CHECKING(if dlopen is available)
327 AC_TRY_COMPILE([#include <dlfcn.h>],
328 [void * p = dlopen("lib", 0);], HAS_DLOPEN=yes, HAS_DLOPEN=no)
329 if test "$HAS_DLOPEN" = no ; then
334 AC_DEFINE(P_DYNALINK, 1, "dlopen found")
335 AC_CHECK_LIB(dl,dlopen,HAS_LIBDL=yes, HAS_LIBDL=no)
340 dnl #########################################################################
341 dnl check to see if plugins enabled
342 dnl MSWIN Plugin Support,,P_HAS_PLUGINS
344 AC_MSG_CHECKING(if plugins support needs to be compiled)
345 AC_ARG_ENABLE(plugins,
346 [ --enable-plugins enable plugins' support in PWLIB],
349 if test "${plugins}" = "no" ; then
351 AC_SUBST(HAS_PLUGINS, 0)
352 elif test "${P_DYNALINK:-unset}" = "unset" ; then
353 AC_MSG_RESULT(plugins disabled as dlopen not available)
354 AC_SUBST(HAS_PLUGINS, 0)
356 AC_MSG_RESULT(plugins enabled)
357 AC_SUBST(HAS_PLUGINS, 1)
358 AC_DEFINE(P_HAS_PLUGINS, 1, "plugins enabled")
361 AC_DEFINE_UNQUOTED(P_DEFAULT_PLUGIN_DIR, "${INSTALLPREFIX}/lib/pwlib")
363 dnl ########################################################################
364 dnl look for DNS resolver code (must be done before OpenLDAP)
365 dnl on some systems, the resolver is in libc
366 dnl but needs resolv.h included which defines res_search as __res_search
368 dnl MSWIN_DISPLAY resolver,DNS Resolver
369 dnl MSWIN_CHECK_FILE resolver,include\windns.h,P_DNS=1
370 dnl MSWIN_DIR_SYMBOL resolver,DNS_DIR
371 dnl MSWIN_CHECK_DIR resolver,\Program Files\Microsoft SDK\
373 AC_ARG_ENABLE(resolver,
374 [ --disable-resolver disable DNS resolver support in PWLIB],
377 if test "$resolver" = "no" ; then
380 AC_CHECK_FUNC(res_search, HAVE_RESOLVER=1)
381 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
384 AC_MSG_CHECKING([for res_search in -lresolv])
387 #include <netinet/in.h>
389 int main(int argc,char **argv){
390 res_search (NULL, 0, 0, NULL, 0);
392 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
394 RESOLVER_LIBS="-lresolv"
396 AC_SEARCH_LIBS(__res_search, resolv, HAVE_RESOLVER=1)
400 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
401 AC_DEFINE(P_DNS, 1, "resolver libraries found")
405 dnl ########################################################################
406 dnl look for OpenLDAP
408 dnl MSWIN_DISPLAY openldap,Open LDAP
409 dnl MSWIN_CHECK_FILE openldap,include\ldap.h|OpenLDAP,P_LDAP=1
410 dnl MSWIN_DIR_SYMBOL openldap,LDAP_DIR
411 dnl MSWIN_CHECK_DIR openldap,..\openldap\
412 dnl MSWIN_CHECK_DIR openldap,..\external\openldap\
413 dnl MSWIN_CHECK_DIR openldap,\openldap\
414 dnl MSWIN_CHECK_DIR openldap,c:\openldap\
416 AC_ARG_ENABLE(openldap,
417 [ --disable-openldap disable OpenLDAP support in PWLIB],
420 if test "$openldap" = "no" ; then
421 AC_SUBST(HAS_OPENLDAP, 0)
424 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
425 AC_CHECK_HEADERS(ldap.h, HAS_OPENLDAP=1)
427 dnl posix4 is required by libldap_r on Solaris
428 if test "${OSTYPE:-unknown}" = "solaris"; then
429 OPENLDAPSYSLIBS=-lposix4
432 dnl check also for lldap_r presence (required for thread safe OpenLDAP?)
433 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
434 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
436 AC_CHECK_FILE(/usr/local/include/ldap.h, HAS_OPENLDAP=1)
437 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
438 OPENLDAPINCLUDEDIR=/usr/local/include
439 OPENLDAPLIBDIR=/usr/local/lib
440 AC_CHECK_LIB(ldap, ldap_open, HAS_OPENLDAP=1, HAS_OPENLDAP=,-L/usr/local/lib -llber -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENLDAPSYSLIBS)
445 if test "${HAS_OPENLDAP:-unset}" != "unset" ; then
446 AC_SUBST(HAS_OPENLDAP, 1)
447 AC_DEFINE(P_LDAP, 1, "OpenLDAP found")
448 if test ${OPENLDAPINCLUDEDIR:-unset} != "unset" ; then
449 STDCCFLAGS="$STDCCFLAGS -I${OPENLDAPINCLUDEDIR}"
451 if test ${OPENLDAPLIBDIR:-unset} != "unset" ; then
452 LDFLAGS="$LDFLAGS -L${OPENLDAPLIBDIR}"
455 dnl Not all Unices have SASL installed as a separate library (Solaris)
456 dnl Some newer Linux boxes have libsasl2 instead of libsasl
457 AC_CHECK_LIB(sasl, sasl_client_auth, HAS_SASL=1, HAS_SASL=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
458 if test ${HAS_SASL:-unset} = "unset" ; then
459 AC_CHECK_LIB(sasl2, sasl_version, HAS_SASL2=1, HAS_SASL2=,$LDFLAGS -llber -lldap -lldap_r $RESOLVER_LIBS $ENDLDLIBS $OPENDLAPSYSLIBS)
461 if test ${HAS_SASL:-unset} != "unset" ; then
462 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber -lsasl"
463 elif test ${HAS_SASL2:-unset} != "unset" ; then
464 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber -lsasl2"
466 ENDLDLIBS="$ENDLDLIBS -lldap -lldap_r -llber"
471 dnl ########################################################################
473 dnl check for environment variable, then assume standard system install
474 dnl this process is made incredibly more complex by the fact that RedHad 9
475 dnl is completely fscked. The default OpenSSL installation requires Kerberos,
476 dnl even when Kerberos is not installed, requiring an explicit #define to
478 dnl As if that is not enough, autoconf gets very confused if configure.in
479 dnl contains a AC_CHECK_HEADER directive that never gets used. So we have
480 dnl to ensure that it is always called
482 dnl MSWIN_DISPLAY openssl,Open SSL
483 dnl MSWIN_CHECK_FILE openssl,inc32\openssl\ssl.h,P_SSL=1
484 dnl MSWIN_DIR_SYMBOL openssl,SSL_DIR
485 dnl MSWIN_CHECK_DIR openssl,..\openssl\
486 dnl MSWIN_CHECK_DIR openssl,..\external\openssl\
487 dnl MSWIN_CHECK_DIR openssl,\openssl\
488 dnl MSWIN_CHECK_DIR openssl,c:\openssl\
490 AC_ARG_ENABLE(openldap,
491 [ --disable-openssl disable OpenSSL support in PWLIB],
494 if test "$openssl" = "no" ; then
496 AC_SUBST(HAS_OPENSSL, 0)
499 dnl check to see OPENSSLDIR is set
500 dnl if it is, we assume it correct - no further checking required
501 if test ${OPENSSLDIR:-unset} != "unset" ; then
502 AC_MSG_CHECKING([for ${OPENSSLDIR}/include/openssl/ssl.h])
503 if test -e ${OPENSSLDIR}/include/openssl/ssl.h ; then
506 SSLINCLUDEDIR="${OPENSSLDIR}/include"
507 SSLLIBDIR="${OPENSSLDIR}/lib"
514 dnl if OPENSSLDIR is not set, then check to see if OpenSSL
515 dnl is installed in the standard system dirs. And also see if
516 dnl if it works using crazy RedHat checks
517 if test "${SSLHDR:-unset}" = "unset" ; then
518 AC_CHECK_HEADERS(openssl/ssl.h,SSLDIR=1)
519 if test "${SSLHDR:-unset}" = "unset" ; then
520 AC_MSG_CHECKING([if openssl/ssl.h works with OPENSSL_NO_KRB5])
521 AC_COMPILE_IFELSE([[#define OPENSSL_NO_KRB5
522 #include <openssl/ssl.h>
523 int main(int argc,char **argv){}]],SSLHDR=1)
524 if test ${SSLHDR:-unset} != "unset" ; then
526 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
527 P_STATIC_LDFLAGS="-L/usr/kerberos/lib"
528 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
535 AC_SUBST(P_STATIC_ENDLDLIBS)
536 AC_SUBST(P_STATIC_LDFLAGS)
538 dnl if we have not found OpenSSL so far, then look for it in
539 dnl several standard places, and check for crazy RedHat install too
540 if test "${SSLHDR:-unset}" = "unset" ; then
542 dnl We want to switch to C language to get .c extension for conftest files
545 for openssl_dir in /usr/local/openssl /usr/local/ssl ; do
546 AC_MSG_CHECKING([for OpenSSL in $openssl_dir])
547 if test ! -f ${openssl_dir}/include/openssl/ssl.h ; then
550 AC_LANG_CONFTEST([[#include "${openssl_dir}/include/openssl/ssl.h"
551 int main(int argc,char **argv){ return 0; }]])
552 $CC $CFLAGS -I${openssl_dir}/include -c conftest.c > /dev/null 2>&1
553 if test $? = 0 ; then
557 SSLINCLUDEDIR="${openssl_dir}/include"
558 SSLLIBDIR="${openssl_dir}/lib"
562 AC_MSG_CHECKING([if ${openssl_dir}/include/openssl/ssl.h works with OPENSSL_NO_KRB5...])
563 AC_LANG_CONFTEST([[#define OPENSSL_NO_KRB5
564 #include "${openssl_dir}/include/openssl/ssl.h"
565 int main(int argc,char **argv){}]])
566 $CC $CFLAGS -I${openssl_dir}/openssl/include -c conftest.c > /dev/null 2>&1
567 if test $? = 0 ; then
570 SSLCCFLAGS=" -DOPENSSL_NO_KRB5"
571 SSLINCLUDEDIR="${openssl_dir}/include"
572 SSLLIBDIR="${openssl_dir}/lib"
573 P_STATIC_LDFLAGS="-L/usr/kerberos/lib"
574 P_STATIC_ENDLDLIBS="-lkrb5 -lk5crypto -lcom_err"
585 if test ${SSLHDR:-unset} != "unset" ; then
586 AC_SUBST(HAS_OPENSSL, 1)
587 AC_DEFINE(P_SSL, 1, "OpenSSL found")
588 if test ${SSLINCLUDEDIR:-unset} != "unset" ; then
589 STDCCFLAGS="$STDCCFLAGS -I${SSLINCLUDEDIR}"
591 if test ${SSLLIBDIR:-unset} != "unset" ; then
592 LDFLAGS="$LDFLAGS -L${SSLLIBDIR}"
594 STDCCFLAGS="${STDCCFLAGS}${SSLCCFLAGS}"
595 ENDLDLIBS="$ENDLDLIBS -lssl -lcrypto"
599 dnl ########################################################################
600 dnl look for expat XML parser
602 dnl MSWIN_DISPLAY expat,Expat XML
603 dnl MSWIN_CHECK_FILE expat,lib\expat.h,P_EXPAT=1
604 dnl MSWIN_DIR_SYMBOL expat,EXPAT_DIR
605 dnl MSWIN_CHECK_DIR expat,..\expat\
606 dnl MSWIN_CHECK_DIR expat,..\external\expat\
607 dnl MSWIN_CHECK_DIR expat,\expat
608 dnl MSWIN_CHECK_DIR expat,c:\expat\
611 [ --disable-expat disable XML support in PWLIB],
614 if test "$expat" = "no" ; then
615 AC_SUBST(HAS_EXPAT, 0)
616 AC_DEFINE(P_EXPAT, 0)
619 AC_CHECK_HEADERS(expat.h, HAS_EXPAT=1)
620 if test "${HAS_EXPAT:-unset}" != "unset" ; then
621 AC_CHECK_LIB(expat, XML_ParserCreate, HAS_EXPAT=1, HAS_EXPAT=)
623 AC_CHECK_FILE(/usr/local/include/expat.h, HAS_EXPAT=1)
624 if test "${HAS_EXPAT:-unset}" != "unset" ; then
625 EXPATINCLUDEDIR=/usr/local/include
626 EXPATLIBDIR=/usr/local/lib
630 if test "${HAS_EXPAT:-unset}" != "unset" ; then
631 AC_SUBST(HAS_EXPAT, 1)
632 AC_DEFINE(P_EXPAT, 1, "expat found")
633 if test ${EXPATINCLUDEDIR:-unset} != "unset" ; then
634 STDCCFLAGS="$STDCCFLAGS -I${EXPATINCLUDEDIR}"
636 if test ${EXPATLIBDIR:-unset} != "unset" ; then
637 LDFLAGS="$LDFLAGS -L${EXPATLIBDIR}"
639 ENDLDLIBS="$ENDLDLIBS -lexpat"
644 dnl ########################################################################
647 dnl MSWIN_DISPLAY sapi,Speech API
648 dnl MSWIN_CHECK_FILE sapi,include\sphelper.h,P_SAPI=1
649 dnl MSWIN_DIR_SYMBOL sapi,SAPI_DIR
650 dnl MSWIN_CHECK_DIR sapi,\Program Files\Microsoft Speech SDK 5.1\
653 dnl ########################################################################
654 dnl look for SDL, but only if we have pthreads
656 dnl MSWIN_DISPLAY libsdl,Simple DirectMedia Layer
657 dnl MSWIN_CHECK_FILE libsdl,include\SDL_video.h,P_SDL=1
658 dnl MSWIN_CHECK_FILE libsdl,lib\SDL.lib,P_SDL_LIBDIR="lib"
659 dnl MSWIN_DIR_SYMBOL libsdl,SDL_DIR
660 dnl MSWIN_CHECK_DIR libsdl,..\sdl\
661 dnl MSWIN_CHECK_DIR libsdl,..\external\sdl\
662 dnl MSWIN_CHECK_DIR libsdl,\sdl\
663 dnl MSWIN_CHECK_DIR libsdl,c:\sdl\
666 [ --disable-sdl disable SDL support in PWLIB],
669 if test "$sdl" = "no" ; then
674 if test "${SDLLIB:-unset}" = "unset" ; then
679 AC_CHECK_HEADERS(SDL/SDL.h, HAS_SDL=1)
680 if test "${HAS_SDL:-unset}" != "unset" ; then
681 AC_CHECK_LIB(SDL, SDL_CreateYUVOverlay, HAS_SDL=1, HAS_SDL=, -lpthread)
684 dnl freeBSD SDL check
685 if test "${HAS_SDL:-unset}" = "unset" ; then
686 AC_CHECK_FILE(/usr/local/include/SDL11/SDL.h, HAS_SDL=1)
687 if test "${HAS_SDL:-unset}" != "unset" ; then
692 if test "${HAS_SDL:-unset}" != "unset" ; then
694 AC_DEFINE(P_SDL, 1, "SDL found")
695 if test ${SDLINCLUDEDIR:-unset} != "unset" ; then
696 STDCCFLAGS="$STDCCFLAGS -I${SDLINCLUDEDIR}"
698 if test ${SDLLIBDIR:-unset} != "unset" ; then
699 LDFLAGS="$LDFLAGS -L${SDLLIBDIR}"
701 ENDLDLIBS="$ENDLDLIBS -l${SDLLIB}"
706 dnl ########################################################################
707 dnl look for IPV6 functions
709 dnl MSWIN_DISPLAY ipv6,IPv6 Support
710 dnl MSWIN_CHECK_FILE ipv6,ws2tcpip.h|sin6_scope_id,P_HAS_IPV6=1
711 dnl MSWIN_DIR_SYMBOL ipv6,IPV6_DIR
712 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft Visual Studio\VC98\Include\
713 dnl MSWIN_CHECK_DIR ipv6,\Program Files\Microsoft SDK\include\
716 [ --disable-ipv6 disable IPV6 support in PWLIB],
719 if test "$ipv6" = "no" ; then
720 AC_DEFINE(P_HAS_IPV6, 0)
721 AC_SUBST(HAS_IPV6, 0)
723 AC_CACHE_CHECK([for IPv6 Support], HAS_IPV6,
724 [AC_TRY_COMPILE([#include <sys/types.h>
725 #include <netinet/in.h>],
726 [struct sockaddr_in6 s; s.sin6_scope_id = 0;], HAS_IPV6=yes, HAS_IPV6=no)])
728 if test $HAS_IPV6 = yes ; then
729 AC_DEFINE(P_HAS_IPV6, 1, "IPV6 enabled")
733 dnl ########################################################################
734 dnl look for QoS functions
736 dnl MSWIN_DISPLAY qos,QoS Support
737 dnl MSWIN_CHECK_FILE qos,qossp.h|QOS_DESTADDR,P_HAS_QOS=1
738 dnl MSWIN_DIR_SYMBOL qos,QOS_DIR
739 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft Visual Studio\VC98\Include\
740 dnl MSWIN_CHECK_DIR qos,\Program Files\Microsoft SDK\include\
743 [ --disable-qos disable QOS support in PWLIB],
746 if test "$qos" = "no" ; then
747 AC_DEFINE(P_HAS_QOS, 0)
749 AC_DEFINE(P_HAS_QOS, 1)
752 dnl ########################################################################
753 dnl check for video capture support.
754 dnl videodev.h on linux
755 dnl machine/ioctl_meteor on FreeBSD
756 dnl i386/ioctl_meteor on OpenBSD
757 dnl dev/ic/bt8xx on NetBSD
760 [ --disable-video disable video device support in PWLIB],
763 if test "$video" = "no" ; then
764 AC_DEFINE(NO_VIDEO_CAPTURE, 0)
767 AC_CHECK_HEADER(linux/videodev.h, HAS_VIDEO_CAPTURE=yes)
768 AC_CHECK_HEADER(machine/ioctl_meteor.h, HAS_VIDEO_CAPTURE=yes)
769 AC_CHECK_HEADER(i386/ioctl_meteor.h, HAS_VIDEO_CAPTURE=yes)
770 AC_CHECK_HEADER(dev/ic/bt8xx.h, HAS_VIDEO_CAPTURE=yes)
771 if test "${HAS_VIDEO_CAPTURE}" != "yes" ; then
772 AC_DEFINE(NO_VIDEO_CAPTURE, 1, "No Linux/BSD video capture")
773 AC_MSG_NOTICE(No Video Capture support)
778 dnl ########################################################################
779 dnl check for various functions
780 dnl According to Andre Schulze <as8@rncmm2.urz.tu-dresden.de>
781 dnl Solaris swab should not be used
782 if test "$OSTYPE" = "solaris" ; then
785 AC_CHECK_FUNC(swab,USE_SYSTEM_SWAB=1)
787 if test "x$ac_cv_func_swab" = "xyes" ; then
788 AC_DEFINE(USE_SYSTEM_SWAB)
791 dnl ########################################################################
792 dnl output make directives
794 dnl resolver needs to be at the end
795 if test "${HAVE_RESOLVER:-unset}" != "unset" ; then
796 if test "${RESOLVER_LIBS:-unset}" != "unset" ; then
797 ENDLDLIBS="$ENDLDLIBS $RESOLVER_LIBS"
801 dnl dl needs to be at the end
802 if test "${OSTYPE}" != "Darwin" ; then
803 if test ${HAS_LIBDL} = yes ; then
804 ENDLDLIBS="$ENDLDLIBS -ldl"
809 AC_SUBST(OPTSTDCCFLAGS)
813 AC_CONFIG_FILES(make/ptbuildopts.mak)
814 AC_CONFIG_FILES([make/ptlib-config], [chmod a+x make/ptlib-config])
815 AC_CONFIG_FILES(Makefile)
817 dnl ########################################################################
818 dnl output header file
819 #AC_CONFIG_FILES(include/ptbuildopts.h.in)
820 AC_CONFIG_HEADERS(include/ptbuildopts.h)