1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(WvStreams, 4.4.1, wvstreams-devel@googlegroups.com, wvstreams)
5 # append to a variable without introducing superfluous white space
30 AC_CONFIG_SRCDIR(streams/wvstream.cc)
33 AC_HELP_STRING([--disable-debug],
34 [strip debug information]))
36 AC_ARG_ENABLE(fatal-warnings,
37 AC_HELP_STRING([--enable-fatal-warnings],
38 [turn warnings into errors]))
40 AC_ARG_ENABLE(optimization,
41 AC_HELP_STRING([--disable-optimization],
42 [optimization options]))
44 AC_ARG_ENABLE(resolver-fork,
45 AC_HELP_STRING([--disable-resolver-fork],
46 [WvResolver background name resolution (debugging)]))
48 AC_ARG_ENABLE(delete-detector,
49 AC_HELP_STRING([--enable-delete-detector],
50 [Delete detector (reference counting)]))
52 AC_ARG_ENABLE(warnings,
53 AC_HELP_STRING([--disable-warnings],
56 AC_ARG_ENABLE(testgui,
57 AC_HELP_STRING([--disable-testgui],
58 [GUI for unit tests]))
60 AC_ARG_WITH(dbus, AC_HELP_STRING([--with-dbus], [DBUS]))
61 AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl], [OpenSSL >= 0.9.7 (required)]))
62 AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam], [PAM]))
63 AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl], [Tcl]))
64 AC_ARG_WITH(qt, AC_HELP_STRING([--with-qt], [Qt]))
66 if ! pkg-config --modversion xplc-${xplc_version}; then
69 AC_ARG_WITH(xplc, AC_HELP_STRING([--with-xplc], [XPLC ${xplc_version} (required)]))
70 AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [zlib (required)]))
71 AC_ARG_WITH(argp, AC_HELP_STRING([--with-argp], [argp (required)]))
73 AC_ARG_VAR(MOC, [Qt meta object compiler])
74 AC_ARG_VAR(WEAVER_BUILD_INFO, [Extra version info])
76 # avoid autoconf's default values, but keep those the user might have given
89 # Detect target build environment
93 ARCH_SUBDIRS="linuxstreams"
97 ac_libs="-lstdc++ -lgcc_s -ldl -lm -lc"
104 AC_SUBST(ARCH_SUBDIRS)
109 # Look for __attribute__ ((deprecated))
110 CPPFLAGS_save="$CPPFLAGS"
111 WV_APPEND(CPPFLAGS, -Werror)
112 AC_MSG_CHECKING(for __attribute__ ((deprecated)))
114 [#include "confdefs.h"
115 void f() __attribute__ ((deprecated));
125 [AC_MSG_RESULT([yes])
126 AC_DEFINE([ATTR_DEPRECATED],
127 [__attribute__ ((deprecated))],
128 [Compiler warning on deprecated functions])],
130 AC_DEFINE([ATTR_DEPRECATED], [],
131 [Compiler warning on deprecated functions])])
132 CPPFLAGS="$CPPFLAGS_save"
137 AC_CHECK_HEADERS(execinfo.h)
140 AC_CHECK_HEADERS([argz.h errno.h])
141 AC_CHECK_TYPE(error_t,, [AC_DEFINE([error_t], [int],
142 [Define to a type to use for `error_t' if it is not otherwise available.])
143 AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h
144 does not typedef error_t.])],dnl `
153 # Check for size of ethernet addresses
154 AC_CHECK_HEADERS([sys/socket.h])
155 AC_CHECK_HEADERS([net/if.h], [], [],
165 #if HAVE_SYS_SOCKET_H
166 # include <sys/socket.h>
169 AC_CHECK_HEADERS([net/ethernet.h], [], [],
179 #if HAVE_SYS_SOCKET_H
180 # include <sys/socket.h>
183 AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
193 #if HAVE_SYS_SOCKET_H
194 # include <sys/socket.h>
200 AC_CHECK_DECL(ETHER_ADDR_LEN,,
201 AC_CHECK_TYPE(ether_addr_t,
202 AC_DEFINE([ETHER_ADDR_LEN], [sizeof(ether_addr_t)],
203 [Size of ethernet address]),
204 AC_DEFINE([ETHER_ADDR_LEN], [6]),
207 # include <sys/types.h>
217 #if HAVE_SYS_SOCKET_H
218 # include <sys/socket.h>
220 #if HAVE_NET_ETHERNET_H
221 # include <net/ethernet.h>
226 #if HAVE_NETINET_IF_ETHER_H
227 # include <netinet/if_ether.h>
232 # include <sys/types.h>
242 #if HAVE_SYS_SOCKET_H
243 # include <sys/socket.h>
245 #if HAVE_NET_ETHERNET_H
246 # include <net/ethernet.h>
251 #if HAVE_NETINET_IF_ETHER_H
252 # include <netinet/if_ether.h>
256 # Check for basic Internet support
257 AC_CHECK_HEADERS([netdb.h])
258 AC_CHECK_HEADERS([netinet/in.h])
259 AC_CHECK_HEADERS([netinet/in_systm.h])
260 AC_CHECK_HEADERS([netinet/ip.h], [], [],
263 # include <sys/types.h>
273 #if HAVE_NETINET_IN_H
274 # include <netinet/in.h>
276 #if HAVE_NETINET_IN_SYSTM_H
277 # include <netinet/in_systm.h>
280 AC_CHECK_HEADERS([netinet/tcp.h])
282 # Check for advanced Linux-style modem support
283 AC_CHECK_HEADERS([linux/serial.h])
284 AC_CHECK_FUNCS([cfmakeraw])
286 # Detect hard-linking based on LN_S's behaviour
287 AC_MSG_CHECKING([whether ln works...])
295 AC_MSG_RESULT([no, using $LN])
300 # Setting the default language to C++ means that CXX and CXXCPP will be
301 # used for compile tests.
304 # __libc_stack_end isn't available to shared libraries with some libc versions
305 AC_MSG_CHECKING([whether __libc_stack_end is public])
306 AH_TEMPLATE([HAVE_LIBC_STACK_END], [Whether libc supports __libc_stack_end])
307 LDFLAGS_save="$LDFLAGS"
308 WV_APPEND(LDFLAGS, [-Wl,-z,defs -shared])
309 HAVE_LIBC_STACK_END=no
310 AC_TRY_LINK([extern const void *__libc_stack_end; ],
311 [volatile const void *x = __libc_stack_end; ],
312 [HAVE_LIBC_STACK_END=yes; ])
313 if test "$HAVE_LIBC_STACK_END" = "yes"; then
314 AC_DEFINE([HAVE_LIBC_STACK_END])
316 AC_MSG_RESULT([$HAVE_LIBC_STACK_END])
317 LDFLAGS="$LDFLAGS_save"
320 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
321 if test "$PKGCONFIG" = "no"; then
322 if test "$with_xplc" = ""; then
323 AC_MSG_ERROR([pkg-config is not installed])
325 AC_MSG_WARN([pkg-config is not installed])
329 if test "$enable_debug" != "no"; then
330 AC_DEFINE_UNQUOTED(VER_STRING_EXTRA, [" (`whoami`@`hostname`$VER_STRING_EXTRA)"], [Extra version string.])
334 if test "$enable_resolver_fork" = "no"; then
335 AC_DEFINE(WVRESOLVER_SKIP_FORK,,
336 [Define to disable WvResolver forking for debugging with gdb.])
340 if test "$enable_delete_detector" = "yes"; then
341 AC_DEFINE(ENABLE_DELETE_DETECTOR,,
342 [Define to enable the XPLC delete detector.])
346 if test "$with_dbus" != "no"; then
347 WV_APPEND(CPPFLAGS, -DDBUS_API_SUBJECT_TO_CHANGE -Iinclude/dbus-upstream)
348 if test "$with_dbus" = ""; then
349 DBUS_LIBDIR="$(pkg-config --libs-only-L dbus-1 | sed 's/^-L//' | awk '{print $1}')"
350 if test -z "$DBUS_LIBDIR"; then
351 DBUS_LIBDIR=/usr/lib # Default path for static linking
353 WV_APPEND(CPPFLAGS, [`pkg-config --cflags dbus-1`])
354 WV_APPEND(LDFLAGS, [`pkg-config --libs-only-L dbus-1`])
356 DBUS_LIBDIR=$with_dbus/dbus/.libs
357 WV_APPEND(CPPFLAGS, -I$with_dbus)
358 WV_APPEND(LDFLAGS, -L$DBUS_LIBDIR)
361 AC_CHECK_HEADERS(dbus/dbus.h,, [with_dbus=no])
363 LIBS="$LIBS $DBUS_LIBDIR/libdbus-1.a"
365 AC_TRY_LINK([extern "C" void dbus_message_new(); ],
366 [dbus_message_new(); ],
370 if test "$with_dbus" != "no"; then
371 AC_DEFINE(WITH_DBUS,,
372 [Define to enable DBUS support.])
373 LIBS_DBUS=$DBUS_LIBDIR/libdbus-1.a
377 # BSD sockets, if you're on Solaris
378 AC_CHECK_LIB(socket, bind)
381 if test "$with_openssl" != "no"; then
382 if test "$with_openssl" != ""; then
383 WV_APPEND(CPPFLAGS, [-I$with_openssl/include])
384 WV_APPEND(LDFLAGS, [-L$with_openssl])
386 AC_CHECK_HEADERS(openssl/ssl.h,, [with_openssl=no],
387 [#define OPENSSL_NO_KRB5])
389 AC_CHECK_LIB(crypto, X509_free)
390 AC_CHECK_LIB(ssl, SSL_has_matching_session_id,, [with_openssl=no])
391 AC_CHECK_LIB(ssl, POLICY_MAPPING_new,, [with_openssl_policy_mapping=no])
392 if test "$with_openssl_policy_mapping" != "no"; then
393 AC_DEFINE([HAVE_OPENSSL_POLICY_MAPPING], [1],
394 [Whether libssl has the POLICY_MAPPING features (0.9.8 and up)])
397 if test "$with_openssl" != "no"; then
398 LIBS_SSL="-lcrypto -lssl"
403 if test "$with_readline" != "no"; then
404 AC_CHECK_HEADERS(readline/readline.h,, [with_readline=no])
405 AC_CHECK_LIB(readline, readline,, [with_readline=no])
409 if test "$with_pam" != "no"; then
410 AC_CHECK_HEADERS(security/pam_appl.h,, [with_pam=no])
412 AC_CHECK_LIB(pam, pam_start,, [with_pam=no])
413 AC_MSG_CHECKING(for sane PAM implementation)
415 [#include "confdefs.h"
416 #if HAVE_SECURITY_PAM_APPL_H
417 # include <security/pam_appl.h>
420 /* noconv: null PAM conversation function */
421 int noconv(int num_msg, const struct pam_message **msgm,
422 struct pam_response **response, void *userdata)
424 // if you need to ask things, it won't work
435 [AC_MSG_RESULT([yes])
436 AC_DEFINE([HAVE_BROKEN_PAM], [0])],
438 AC_DEFINE([HAVE_BROKEN_PAM], [1],
439 [Solaris has a broken PAM implementation])])
441 if test "$with_pam" != "no" -a "$HAVE_BROKEN_PAM" != "1"; then
447 if test "$with_tcl" != "no"; then
448 CPPFLAGS_save="$CPPFLAGS"
449 WV_APPEND(CPPFLAGS, -I/usr/include/tcl8.3)
450 AC_CHECK_HEADERS(tcl.h,, [with_tcl=no])
452 AC_CHECK_LIB(tcl8.3, TclInterpInit,, [with_tcl=no])
454 if test "$with_tcl" != "no"; then
455 CPPFLAGS="$CPPFLAGS_save"
461 if test "$with_qt" != "no"; then
462 test "$with_qt" = yes && with_qt=
463 AC_CACHE_CHECK([for Qt], [wv_cv_with_qt], [
465 CPPFLAGS_save="$CPPFLAGS"
466 LDFLAGS_save="$LDFLAGS"
468 for wv_qtdir in $with_qt $QTDIR $QT_SEARCH_PATH; do
469 eval wv_qtdir="$wv_qtdir"
470 CPPFLAGS="$CPPFLAGS_save -I$wv_qtdir/include -I$wv_qtdir/include/qt3"
471 LDFLAGS="$LDFLAGS_save -L$wv_qtdir/lib"
472 LIBS="$LIBS_save -lqt-mt"
473 AC_TRY_LINK([#include <qstring.h>],
474 [QString x("hello"); return 0; ],
475 [wv_cv_with_qt=$wv_qtdir; break])
477 CPPFLAGS="$CPPFLAGS_save"
478 LDFLAGS="$LDFLAGS_save"
481 with_qt=$wv_cv_with_qt
482 if test "$with_qt" != no; then
483 WV_APPEND(CPPFLAGS, -I$with_qt/include -I$with_qt/include/qt3)
484 if [ "$wv_qtdir" != "/usr" ]; then
485 # never explicitly include /usr/lib
486 WV_APPEND(LDFLAGS, -L$with_qt/lib)
488 WV_APPEND(LIBS_QT, -lqt-mt)
490 AC_PATH_PROG(MOC, moc, [moc not found], $with_qt/bin)
494 AC_CHECK_PROG(VALGRIND, valgrind, valgrind)
495 AC_CHECK_HEADERS(valgrind/memcheck.h)
498 if test "$with_xplc" != "no"; then
499 if test "$with_xplc" = ""; then
500 if pkg-config --modversion xplc-${xplc_version}; then
501 WV_APPEND(CPPFLAGS, [`pkg-config --cflags xplc-${xplc_version}`])
502 WV_APPEND(LDFLAGS, [`pkg-config --libs-only-L xplc-${xplc_version}`])
503 AC_CHECK_HEADERS(xplc/core.h,, [with_xplc=no], [#define UNSTABLE])
505 AC_CHECK_LIB(xplc, XPLC_getServiceManager,
506 [LIBS_XPLC="-lxplc-cxx -lxplc"],
509 xplc_pc="xplc-${xplc_version}"
514 WV_APPEND(CPPFLAGS, [-I$with_xplc/include])
515 WV_APPEND(LDFLAGS, [-L$with_xplc])
516 AC_CHECK_HEADERS(xplc/core.h,, [with_xplc=no], [#define UNSTABLE])
518 AC_CHECK_LIB(xplc, XPLC_getServiceManager,
519 [LIBS_XPLC="-lxplc-cxx -lxplc"],
522 xplc_pc="xplc-${xplc_version}"
527 if test "$with_zlib" != "no"; then
528 AC_CHECK_HEADERS(zlib.h,, [with_zlib=no])
529 AC_CHECK_LIB(z, compress,, [with_zlib=no])
533 if test "$with_argp" != "no"; then
534 AC_CHECK_HEADERS(argp.h,, [with_argp=no])
537 # Find out whether TR1 or Boost are available.
538 AC_CHECK_HEADERS(tr1/functional)
539 AC_CHECK_HEADERS(boost/function.hpp)
541 # When compiling with exceptions disabled and Boost, applications need
542 # to provide an "exception handler", declared here.
543 AC_CHECK_HEADERS(boost/throw_exception.hpp)
545 # check for missing packages
548 if test "$with_dbus" = "no"; then
549 AC_MSG_WARN([DBUS is missing.])
552 if test "$with_pam" = "no"; then
553 AC_MSG_WARN([PAM is missing.])
556 if test "$with_qt" = "no"; then
557 AC_MSG_WARN([Qt is missing.])
560 if test "$with_xplc" = "no"; then
561 AC_MSG_WARN([XPLC is missing.])
562 missing_required="$missing_required XPLC"
564 if test "$VALGRIND" = ""; then
565 AC_MSG_WARN([Valgrind is missing.])
567 if test "$with_openssl" = "no"; then
568 AC_MSG_WARN([OpenSSL is missing.])
569 missing_required="$missing_required OpenSSL>=0.9.7"
571 if test "$with_readline" = "no"; then
572 AC_MSG_WARN([readline is missing.])
574 if test "$with_zlib" = "no"; then
575 AC_MSG_WARN([zlib is missing.])
576 missing_required="$missing_required zlib"
578 if test "$with_argp" = "no"; then
579 AC_MSG_WARN([argp is missing.])
580 missing_required="$missing_required argp"
582 if test "$ac_cv_header_tr1_functional" != "yes" \
583 -a "$ac_cv_header_boost_function_hpp" != "yes"; then
584 AC_MSG_WARN([both tr1/functional and boost/function.hpp are missing.])
585 missing_required="$missing_required boost/function.hpp"
588 if test -n "$missing_required"; then
589 AC_MSG_ERROR([Required dependencies missing:$missing_required])
592 if test "$VALGRIND" != ""; then
593 VALGRIND="valgrind --tool=memcheck --leak-check=yes --num-callers=10 --suppressions=\$(WVSTREAMS_SRC)/wvstreams.supp"
594 if valgrind --help | grep log-file >/dev/null; then
595 VALGRIND="$VALGRIND --log-file=valgrind.log"
597 VALGRIND="$VALGRIND --logfile=valgrind.log"
602 # Compiler is always posix if invoking this configure script
603 COMPILER_STANDARD=posix
607 AC_SUBST(enable_debug)
608 AC_SUBST(enable_optimization)
609 AC_SUBST(enable_resolver_fork)
610 AC_SUBST(enable_delete_detector)
611 AC_SUBST(enable_warnings)
612 AC_SUBST(enable_testgui)
615 AC_SUBST(with_openssl)
616 AC_SUBST(with_openssl_policy_mapping)
618 AC_SUBST(with_readline)
634 AC_SUBST(COMPILER_STANDARD)
636 AC_DEFINE_UNQUOTED([VERBOSE_PACKAGE_VERSION],["$PACKAGE_VERSION$WEAVER_BUILD_INFO"],[Verbose package version])
638 AC_CONFIG_FILES(config.mk)
639 AC_CONFIG_FILES([pkgconfig/libuniconf.pc
640 pkgconfig/libuniconf-uninstalled.pc
641 pkgconfig/libwvbase.pc
642 pkgconfig/libwvbase-uninstalled.pc
643 pkgconfig/libwvdbus.pc
644 pkgconfig/libwvdbus-uninstalled.pc
646 pkgconfig/libwvqt-uninstalled.pc
647 pkgconfig/libwvstreams.pc
648 pkgconfig/libwvstreams-uninstalled.pc
649 pkgconfig/libwvutils.pc
650 pkgconfig/libwvutils-uninstalled.pc
651 pkgconfig/libwvtest.pc
652 pkgconfig/libwvtest-uninstalled.pc])
654 AC_CONFIG_HEADERS(include/wvautoconf.h)
658 # Now convert PACKAGE_* macros into WVPACKAGE_* in include/wvautoconf.h
659 sed 's,\(\#define.*\)PACKAGE,\1WVPACKAGE,' include/wvautoconf.h > include/wvautoconf.h.new
660 if test "x$?" = "x0"; then
661 if ! diff include/wvautoconf.h include/wvautoconf.h.new >/dev/null; then
662 mv include/wvautoconf.h.new include/wvautoconf.h
664 rm include/wvautoconf.h.new