1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(WvStreams, 4.4.1, wvstreams-devel@googlegroups.com, wvstreams)
8 while test $# -gt 0; do
14 echo $0 $ARGS '"$@"' >reconfigure
20 # append to a variable without introducing superfluous white space
21 AC_DEFUN([WV_APPEND],[
22 if test -z "$$1"; then
45 AC_CONFIG_SRCDIR(streams/wvstream.cc)
48 AC_HELP_STRING([--disable-debug],
49 [strip debug information]))
52 AC_HELP_STRING([--enable-devel],
56 AC_HELP_STRING([--enable-efence],
57 [link against Electric Fence]))
59 AC_ARG_ENABLE(fatal-warnings,
60 AC_HELP_STRING([--enable-fatal-warnings],
61 [turn warnings into errors]))
63 AC_ARG_ENABLE(optimization,
64 AC_HELP_STRING([--disable-optimization],
65 [optimization options]))
67 AC_ARG_ENABLE(resolver-fork,
68 AC_HELP_STRING([--disable-resolver-fork],
69 [WvResolver background name resolution (debugging)]))
71 AC_ARG_ENABLE(delete-detector,
72 AC_HELP_STRING([--enable-delete-detector],
73 [Delete detector (reference counting)]))
75 AC_ARG_ENABLE(verbose,
76 AC_HELP_STRING([--enable-verbose],
77 [verbose compilation output]))
79 AC_ARG_ENABLE(warnings,
80 AC_HELP_STRING([--disable-warnings],
83 AC_ARG_ENABLE(testgui,
84 AC_HELP_STRING([--disable-testgui],
85 [GUI for unit tests]))
87 AC_ARG_WITH(dbus, AC_HELP_STRING([--with-dbus], [DBUS]))
88 AC_ARG_WITH(openssl, AC_HELP_STRING([--with-openssl], [OpenSSL >= 0.9.7 (required)]))
89 AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam], [PAM]))
90 AC_ARG_WITH(tcl, AC_HELP_STRING([--with-tcl], [Tcl]))
91 AC_ARG_WITH(qt, AC_HELP_STRING([--with-qt], [Qt]))
93 AC_ARG_WITH(xplc, AC_HELP_STRING([--with-xplc], [XPLC ${xplc_version} (required)]))
94 AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [zlib (required)]))
96 AC_ARG_VAR(MOC, [Qt meta object compiler])
97 AC_ARG_VAR(WEAVER_BUILD_INFO, [Extra version info])
99 # avoid autoconf's default values, but keep those the user might have given
100 CFLAGS="-fPIC $CFLAGS"
101 CXXFLAGS="-fPIC $CXXFLAGS"
115 # Detect target build environment
119 ARCH_SUBDIRS="linuxstreams"
123 ac_libs="-lstdc++ -lgcc_s -ldl -lm -lc"
130 AC_SUBST(ARCH_SUBDIRS)
135 # Look for __attribute__ ((deprecated))
136 CPPFLAGS_save="$CPPFLAGS"
137 WV_APPEND(CPPFLAGS, -Werror)
138 AC_MSG_CHECKING(for __attribute__ ((deprecated)))
140 [#include "confdefs.h"
141 void f() __attribute__ ((deprecated));
151 [AC_MSG_RESULT([yes])
152 AC_DEFINE([ATTR_DEPRECATED],
153 [__attribute__ ((deprecated))],
154 [Compiler warning on deprecated functions])],
156 AC_DEFINE([ATTR_DEPRECATED], [],
157 [Compiler warning on deprecated functions])])
158 CPPFLAGS="$CPPFLAGS_save"
163 AC_CHECK_HEADERS(execinfo.h)
169 AC_CHECK_HEADERS([argz.h errno.h])
170 AC_CHECK_TYPE(error_t,, [AC_DEFINE([error_t], [int],
171 [Define to a type to use for `error_t' if it is not otherwise available.])
172 AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h
173 does not typedef error_t.])],dnl `
182 # Check for size of ethernet addresses
183 AC_CHECK_HEADERS([sys/socket.h])
184 AC_CHECK_HEADERS([net/if.h], [], [],
194 #if HAVE_SYS_SOCKET_H
195 # include <sys/socket.h>
198 AC_CHECK_HEADERS([net/ethernet.h], [], [],
208 #if HAVE_SYS_SOCKET_H
209 # include <sys/socket.h>
212 AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
222 #if HAVE_SYS_SOCKET_H
223 # include <sys/socket.h>
229 AC_CHECK_DECL(ETHER_ADDR_LEN,,
230 AC_CHECK_TYPE(ether_addr_t,
231 AC_DEFINE([ETHER_ADDR_LEN], [sizeof(ether_addr_t)],
232 [Size of ethernet address]),
233 AC_DEFINE([ETHER_ADDR_LEN], [6]),
236 # include <sys/types.h>
246 #if HAVE_SYS_SOCKET_H
247 # include <sys/socket.h>
249 #if HAVE_NET_ETHERNET_H
250 # include <net/ethernet.h>
255 #if HAVE_NETINET_IF_ETHER_H
256 # include <netinet/if_ether.h>
261 # include <sys/types.h>
271 #if HAVE_SYS_SOCKET_H
272 # include <sys/socket.h>
274 #if HAVE_NET_ETHERNET_H
275 # include <net/ethernet.h>
280 #if HAVE_NETINET_IF_ETHER_H
281 # include <netinet/if_ether.h>
285 # Check for basic Internet support
286 AC_CHECK_HEADERS([netdb.h])
287 AC_CHECK_HEADERS([netinet/in.h])
288 AC_CHECK_HEADERS([netinet/in_systm.h])
289 AC_CHECK_HEADERS([netinet/ip.h], [], [],
292 # include <sys/types.h>
302 #if HAVE_NETINET_IN_H
303 # include <netinet/in.h>
305 #if HAVE_NETINET_IN_SYSTM_H
306 # include <netinet/in_systm.h>
309 AC_CHECK_HEADERS([netinet/tcp.h])
311 # Check for advanced Linux-style modem support
312 AC_CHECK_HEADERS([linux/serial.h])
313 AC_CHECK_FUNCS([cfmakeraw])
315 # Detect hard-linking based on LN_S's behaviour
316 AC_MSG_CHECKING([whether ln works...])
324 AC_MSG_RESULT([no, using $LN])
329 # Setting the default language to C++ means that CXX and CXXCPP will be
330 # used for compile tests.
334 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
335 if test "$PKGCONFIG" = "no"; then
336 if test "$with_xplc" = ""; then
337 AC_MSG_ERROR([pkg-config is not installed])
339 AC_MSG_WARN([pkg-config is not installed])
344 if test "$enable_devel" = "yes"; then
346 enable_fatal_warnings=yes
350 if test "$enable_debug" != "no"; then
351 AC_DEFINE_UNQUOTED(VER_STRING_EXTRA, [" (`whoami`@`hostname`$VER_STRING_EXTRA)"], [Extra version string.])
355 if test "$enable_resolver_fork" = "no"; then
356 AC_DEFINE(WVRESOLVER_SKIP_FORK,,
357 [Define to disable WvResolver forking for debugging with gdb.])
361 if test "$enable_delete_detector" = "yes"; then
362 AC_DEFINE(ENABLE_DELETE_DETECTOR,,
363 [Define to enable the XPLC delete detector.])
367 if test "$with_dbus" != "no"; then
368 WV_APPEND(CPPFLAGS, -DDBUS_API_SUBJECT_TO_CHANGE -Iinclude/dbus-upstream)
369 if test "$with_dbus" = ""; then
370 DBUS_LIBDIR="$(pkg-config --libs-only-L dbus-1 | sed 's/^-L//' | awk '{print $1}')"
371 if test -z "$DBUS_LIBDIR"; then
372 DBUS_LIBDIR=/usr/lib # Default path for static linking
374 WV_APPEND(CPPFLAGS, [`pkg-config --cflags dbus-1`])
375 WV_APPEND(LDFLAGS, [`pkg-config --libs-only-L dbus-1`])
377 DBUS_LIBDIR=$with_dbus/dbus/.libs
378 WV_APPEND(CPPFLAGS, -I$with_dbus)
379 WV_APPEND(LDFLAGS, -L$DBUS_LIBDIR)
382 AC_CHECK_HEADERS(dbus/dbus.h,, [with_dbus=no])
384 LIBS="$LIBS $DBUS_LIBDIR/libdbus-1.a"
386 AC_TRY_LINK([extern "C" void dbus_message_new(); ],
387 [dbus_message_new(); ],
391 if test "$with_dbus" != "no"; then
392 AC_DEFINE(WITH_DBUS,,
393 [Define to enable DBUS support.])
394 LIBS_DBUS=$DBUS_LIBDIR/libdbus-1.a
399 #if test "$with_gtk" != "no"; then
400 # CPPFLAGS_save="$CPPFLAGS"
401 # WV_APPEND(CPPFLAGS,`pkg-config --cflags gtk+ 2>/dev/null`)
402 # AC_CHECK_HEADERS(gtk/gtk.h,, [with_gtk=no])
403 # AC_CHECK_LIB(gdk, gdk_init,, [with_gtk=no])
404 # AC_CHECK_LIB(gtk, gtk_main,, [with_gtk=no])
405 # test "$with_gtk" = no && CPPFLAGS="$CPPFLAGS_save"
408 # BSD sockets, if you're on Solaris
409 AC_CHECK_LIB(socket, bind)
412 if test "$with_openssl" != "no"; then
413 if test "$with_openssl" != ""; then
414 WV_APPEND(CPPFLAGS, [-I$with_openssl/include])
415 WV_APPEND(LDFLAGS, [-L$with_openssl])
417 AC_CHECK_HEADERS(openssl/ssl.h,, [with_openssl=no],
418 [#define OPENSSL_NO_KRB5])
420 AC_CHECK_LIB(crypto, X509_free)
421 AC_CHECK_LIB(ssl, SSL_has_matching_session_id,, [with_openssl=no])
423 if test "$with_openssl" != "no"; then
424 LIBS_SSL="-lcrypto -lssl"
429 if test "$with_readline" != "no"; then
430 AC_CHECK_HEADERS(readline/readline.h,, [with_readline=no])
431 AC_CHECK_LIB(readline, readline,, [with_readline=no])
435 if test "$with_pam" != "no"; then
436 AC_CHECK_HEADERS(security/pam_appl.h,, [with_pam=no])
438 AC_CHECK_LIB(pam, pam_start,, [with_pam=no])
439 AC_MSG_CHECKING(for sane PAM implementation)
441 [#include "confdefs.h"
442 #if HAVE_SECURITY_PAM_APPL_H
443 # include <security/pam_appl.h>
446 /* noconv: null PAM conversation function */
447 int noconv(int num_msg, const struct pam_message **msgm,
448 struct pam_response **response, void *userdata)
450 // if you need to ask things, it won't work
461 [AC_MSG_RESULT([yes])
462 AC_DEFINE([HAVE_BROKEN_PAM], [0])],
464 AC_DEFINE([HAVE_BROKEN_PAM], [1],
465 [Solaris has a broken PAM implementation])])
467 if test "$with_pam" != "no" -a "$HAVE_BROKEN_PAM" != "1"; then
473 if test "$with_tcl" != "no"; then
474 CPPFLAGS_save="$CPPFLAGS"
475 WV_APPEND(CPPFLAGS, -I/usr/include/tcl8.3)
476 AC_CHECK_HEADERS(tcl.h,, [with_tcl=no])
478 AC_CHECK_LIB(tcl8.3, TclInterpInit,, [with_tcl=no])
480 if test "$with_tcl" != "no"; then
481 CPPFLAGS="$CPPFLAGS_save"
487 if test "$with_qt" != "no"; then
488 test "$with_qt" = yes && with_qt=
489 AC_CACHE_CHECK([for Qt], [wv_cv_with_qt], [
491 CPPFLAGS_save="$CPPFLAGS"
492 LDFLAGS_save="$LDFLAGS"
494 for wv_qtdir in $with_qt $QTDIR $QT_SEARCH_PATH; do
495 eval wv_qtdir="$wv_qtdir"
496 CPPFLAGS="$CPPFLAGS_save -I$wv_qtdir/include -I$wv_qtdir/include/qt3"
497 LDFLAGS="$LDFLAGS_save -L$wv_qtdir/lib"
498 LIBS="$LIBS_save -lqt-mt"
499 AC_TRY_LINK([#include <qstring.h>],
500 [QString x("hello"); return 0; ],
501 [wv_cv_with_qt=$wv_qtdir; break])
503 CPPFLAGS="$CPPFLAGS_save"
504 LDFLAGS="$LDFLAGS_save"
507 with_qt=$wv_cv_with_qt
508 if test "$with_qt" != no; then
509 WV_APPEND(CPPFLAGS, -I$with_qt/include -I$with_qt/include/qt3)
510 if [ "$wv_qtdir" != "/usr" ]; then
511 # never explicitly include /usr/lib
512 WV_APPEND(LDFLAGS, -L$with_qt/lib)
514 WV_APPEND(LIBS_QT, -lqt-mt)
516 AC_PATH_PROG(MOC, moc, [moc not found], $with_qt/bin)
520 AC_CHECK_PROG(VALGRIND, valgrind, valgrind)
521 AC_CHECK_HEADERS(valgrind/memcheck.h)
524 if test "$with_xplc" != "no"; then
525 if test "$with_xplc" = ""; then
526 if pkg-config --modversion xplc-${xplc_version}; then
527 WV_APPEND(CPPFLAGS, [`pkg-config --cflags xplc-${xplc_version}`])
528 WV_APPEND(LDFLAGS, [`pkg-config --libs-only-L xplc-${xplc_version}`])
529 AC_CHECK_HEADERS(xplc/core.h,, [with_xplc=no], [#define UNSTABLE])
531 AC_CHECK_LIB(xplc, XPLC_getServiceManager,
532 [LIBS_XPLC="-lxplc-cxx -lxplc"],
535 xplc_pc="xplc-${xplc_version}"
540 WV_APPEND(CPPFLAGS, [-I$with_xplc/include])
541 WV_APPEND(LDFLAGS, [-L$with_xplc])
542 AC_CHECK_HEADERS(xplc/core.h,, [with_xplc=no], [#define UNSTABLE])
544 AC_CHECK_LIB(xplc, XPLC_getServiceManager,
545 [LIBS_XPLC="-lxplc-cxx -lxplc"],
548 xplc_pc="xplc-${xplc_version}"
550 # Not already on the system? Try building our own.
551 if test "$with_xplc" = "no" && test -d xplc; then
552 WV_APPEND(CPPFLAGS, [-I\$(WVSTREAMS)/xplc/include])
553 WV_APPEND(LDFLAGS, [-L\$(WVSTREAMS)/xplc])
554 AC_CONFIG_SUBDIRS(xplc)
556 with_xplc='$(WVSTREAMS)/xplc'
558 LIBS_XPLC="-lxplc-cxx -lxplc"
563 if test "$with_zlib" != "no"; then
564 AC_CHECK_HEADERS(zlib.h,, [with_zlib=no])
565 AC_CHECK_LIB(z, compress,, [with_zlib=no])
568 # check for missing packages
571 if test "$with_dbus" = "no"; then
572 AC_MSG_WARN([DBUS is missing.])
575 if test "$with_pam" = "no"; then
576 AC_MSG_WARN([PAM is missing.])
579 if test "$with_qt" = "no"; then
580 AC_MSG_WARN([Qt is missing.])
583 if test "$with_xplc" = "no"; then
584 AC_MSG_WARN([XPLC is missing.])
585 missing_required="$missing_required XPLC"
587 if test "$VALGRIND" = ""; then
588 AC_MSG_WARN([Valgrind is missing.])
590 if test "$with_openssl" = "no"; then
591 AC_MSG_WARN([OpenSSL is missing.])
592 missing_required="$missing_required OpenSSL>=0.9.7"
594 if test "$with_readline" = "no"; then
595 AC_MSG_WARN([readline is missing.])
597 if test "$with_zlib" = "no"; then
598 AC_MSG_WARN([zlib is missing.])
599 missing_required="$missing_required zlib"
602 if test -n "$missing_required"; then
603 AC_MSG_ERROR([Required dependencies missing:$missing_required])
606 if test "$enable_devel" = "yes"; then
607 if test -n "$missing_devel"; then
608 AC_MSG_ERROR([Some packages required in developer mode are missing.])
612 if test "$VALGRIND" != ""; then
613 VALGRIND="valgrind --tool=memcheck --leak-check=yes --num-callers=10 --suppressions=\$(WVSTREAMS_SRC)/wvstreams.supp"
614 if valgrind --help | grep log-file >/dev/null; then
615 VALGRIND="$VALGRIND --log-file=valgrind.log"
617 VALGRIND="$VALGRIND --logfile=valgrind.log"
622 # Find out whether TR1 or Boost are available.
623 AC_CHECK_HEADERS(tr1/functional)
624 AC_CHECK_HEADERS(boost/function.hpp)
626 # When compiling with exceptions disabled and Boost, applications need
627 # to provide an "exception handler", declared here.
628 AC_CHECK_HEADERS(boost/throw_exception.hpp)
630 # Compiler is always posix if invoking this configure script
631 COMPILER_STANDARD=posix
635 AC_SUBST(enable_debug)
636 AC_SUBST(enable_devel)
637 AC_SUBST(enable_efence)
638 AC_SUBST(enable_fatal_warnings)
639 AC_SUBST(enable_optimization)
640 AC_SUBST(enable_resolver_fork)
641 AC_SUBST(enable_delete_detector)
642 AC_SUBST(enable_verbose)
643 AC_SUBST(enable_warnings)
644 AC_SUBST(enable_testgui)
648 AC_SUBST(with_openssl)
650 AC_SUBST(with_readline)
666 AC_SUBST(COMPILER_STANDARD)
668 AC_DEFINE_UNQUOTED([VERBOSE_PACKAGE_VERSION],["$PACKAGE_VERSION$WEAVER_BUILD_INFO"],[Verbose package version])
670 AC_CONFIG_FILES(config.mk)
671 AC_CONFIG_FILES(gnulib/Makefile)
672 AC_CONFIG_FILES([pkgconfig/libuniconf.pc
673 pkgconfig/libuniconf-uninstalled.pc
674 pkgconfig/libwvbase.pc
675 pkgconfig/libwvbase-uninstalled.pc
677 pkgconfig/libwvqt-uninstalled.pc
678 pkgconfig/libwvstreams.pc
679 pkgconfig/libwvstreams-uninstalled.pc
680 pkgconfig/libwvutils.pc
681 pkgconfig/libwvutils-uninstalled.pc
682 pkgconfig/libwvtest.pc
683 pkgconfig/libwvtest-uninstalled.pc])
685 if test "$xplc_pc" = "wvxplc"; then
686 AC_CONFIG_FILES([pkgconfig/wvxplc.pc])
688 AC_CONFIG_HEADERS(include/wvautoconf.h)
692 # Now remove PACKAGE_* macros from include/wvautoconf.h
693 sed 's,^#.*define.*PACKAGE_.*$,/* & */,' include/wvautoconf.h > include/wvautoconf.h.new
694 if test "x$?" = "x0"; then
695 if ! diff include/wvautoconf.h include/wvautoconf.h >/dev/null; then
696 mv include/wvautoconf.h.new include/wvautoconf.h
698 rm include/wvautoconf.h.new