1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(WvStreams, 4.6, 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]))
65 AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [zlib (required)]))
66 AC_ARG_WITH(valgrind, AC_HELP_STRING([--with-valgrind], [Valgrind]))
68 AC_ARG_VAR(MOC, [Qt meta object compiler])
69 AC_ARG_VAR(WEAVER_BUILD_INFO, [Extra version info])
71 # avoid autoconf's default values, but keep those the user might have given
84 # Detect target build environment
88 ARCH_SUBDIRS="linuxstreams"
93 ac_libs="-lstdc++ -lgcc_s -ldl -lm -lc"
111 AC_SUBST(ARCH_SUBDIRS)
117 # Look for __attribute__ ((deprecated))
118 CPPFLAGS_save="$CPPFLAGS"
119 WV_APPEND(CPPFLAGS, -Werror)
120 AC_MSG_CHECKING(for __attribute__ ((deprecated)))
122 [#include "confdefs.h"
123 void f() __attribute__ ((deprecated));
133 [AC_MSG_RESULT([yes])
134 AC_DEFINE([ATTR_DEPRECATED],
135 [__attribute__ ((deprecated))],
136 [Compiler warning on deprecated functions])],
138 AC_DEFINE([ATTR_DEPRECATED], [],
139 [Compiler warning on deprecated functions])])
140 CPPFLAGS="$CPPFLAGS_save"
144 AC_CHECK_HEADERS(argp.h)
145 AC_CHECK_FUNC(argp_parse)
146 if test "$ac_cv_func_argp_parse" != yes \
147 -o "$ac_cv_header_argp_h" != yes ; then
150 echo 'configuring argp...'
152 ./configure --host=$host_cpu-$host_os || exit $?
153 echo 'argp configured.'
164 AC_CHECK_HEADERS(execinfo.h)
167 AC_CHECK_HEADERS([argz.h errno.h])
168 AC_CHECK_TYPE(error_t,, [AC_DEFINE([error_t], [int],
169 [Define to a type to use for `error_t' if it is not otherwise available.])
170 AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h
171 does not typedef error_t.])],dnl `
180 # Check for size of ethernet addresses
181 AC_CHECK_HEADERS([sys/socket.h])
182 AC_CHECK_HEADERS([net/if.h], [], [],
192 #if HAVE_SYS_SOCKET_H
193 # include <sys/socket.h>
196 AC_CHECK_HEADERS([net/ethernet.h], [], [],
206 #if HAVE_SYS_SOCKET_H
207 # include <sys/socket.h>
210 AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
220 #if HAVE_SYS_SOCKET_H
221 # include <sys/socket.h>
227 AC_CHECK_DECL(ETHER_ADDR_LEN,,
228 AC_CHECK_TYPE(ether_addr_t,
229 AC_DEFINE([ETHER_ADDR_LEN], [sizeof(ether_addr_t)],
230 [Size of ethernet address]),
231 AC_DEFINE([ETHER_ADDR_LEN], [6]),
234 # include <sys/types.h>
244 #if HAVE_SYS_SOCKET_H
245 # include <sys/socket.h>
247 #if HAVE_NET_ETHERNET_H
248 # include <net/ethernet.h>
253 #if HAVE_NETINET_IF_ETHER_H
254 # include <netinet/if_ether.h>
259 # include <sys/types.h>
269 #if HAVE_SYS_SOCKET_H
270 # include <sys/socket.h>
272 #if HAVE_NET_ETHERNET_H
273 # include <net/ethernet.h>
278 #if HAVE_NETINET_IF_ETHER_H
279 # include <netinet/if_ether.h>
283 # Check for basic Internet support
284 AC_CHECK_HEADERS([netdb.h])
285 AC_CHECK_HEADERS([netinet/in.h])
286 AC_CHECK_HEADERS([netinet/in_systm.h])
287 AC_CHECK_HEADERS([netinet/ip.h], [], [],
290 # include <sys/types.h>
300 #if HAVE_NETINET_IN_H
301 # include <netinet/in.h>
303 #if HAVE_NETINET_IN_SYSTM_H
304 # include <netinet/in_systm.h>
307 AC_CHECK_HEADERS([netinet/tcp.h])
309 # Check for advanced Linux-style modem support
310 AC_CHECK_HEADERS([linux/serial.h])
311 AC_CHECK_FUNCS([cfmakeraw])
313 # Detect hard-linking based on LN_S's behaviour
314 AC_MSG_CHECKING([whether ln works...])
322 AC_MSG_RESULT([no, using $LN])
327 # Setting the default language to C++ means that CXX and CXXCPP will be
328 # used for compile tests.
331 # __libc_stack_end isn't available to shared libraries with some libc versions
332 AC_MSG_CHECKING([whether __libc_stack_end is public])
333 AH_TEMPLATE([HAVE_LIBC_STACK_END], [Whether libc supports __libc_stack_end])
334 LDFLAGS_save="$LDFLAGS"
335 WV_APPEND(LDFLAGS, [-Wl,-z,defs -shared])
336 HAVE_LIBC_STACK_END=no
337 AC_TRY_LINK([extern const void *__libc_stack_end; ],
338 [volatile const void *x = __libc_stack_end; ],
339 [HAVE_LIBC_STACK_END=yes; ])
340 if test "$HAVE_LIBC_STACK_END" = "yes"; then
341 AC_DEFINE([HAVE_LIBC_STACK_END])
343 AC_MSG_RESULT([$HAVE_LIBC_STACK_END])
344 LDFLAGS="$LDFLAGS_save"
347 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
348 if test "$PKGCONFIG" = "no"; then
349 AC_MSG_WARN([pkg-config is not installed])
352 if test "$enable_debug" != "no"; then
353 AC_DEFINE_UNQUOTED(VER_STRING_EXTRA, [" (`whoami`@`hostname`$VER_STRING_EXTRA)"], [Extra version string.])
357 if test "$enable_resolver_fork" = "no"; then
358 AC_DEFINE(WVRESOLVER_SKIP_FORK,,
359 [Define to disable WvResolver forking for debugging with gdb.])
362 # xplc delete detector
363 if test "$enable_delete_detector" = "yes"; then
364 AC_DEFINE(ENABLE_DELETE_DETECTOR,,
365 [Define to enable the XPLC delete detector.])
369 if test "$with_dbus" != "no"; then
370 if test "$with_dbus" = "" -o "$with_dbus" = "yes"; then
371 AC_MSG_CHECKING([Checking that D-Bus version greater than 1.2.14 installed.])
372 if pkg-config --atleast-version 1.2.14 dbus-1; then
373 WV_APPEND(CPPFLAGS, [`pkg-config --cflags dbus-1`])
374 WV_APPEND(LDFLAGS, [`pkg-config --libs dbus-1`])
381 # no version check when doing --with-dbus
382 DBUS_LIBDIR=$with_dbus/dbus/.libs
383 WV_APPEND(CPPFLAGS, -I$with_dbus)
384 WV_APPEND(LDFLAGS, -L$DBUS_LIBDIR)
385 WV_APPEND(LIBS, -ldbus-1)
388 # double check that we actually have D-Bus
389 if test "$with_dbus" != "no"; then
390 AC_CHECK_HEADERS(dbus/dbus.h,, [with_dbus=no])
392 AC_TRY_LINK([extern "C" void dbus_message_new(); ],
393 [dbus_message_new(); ],
397 if test "$with_dbus" != "no"; then
398 AC_DEFINE(WITH_DBUS,,
399 [Define to enable DBUS support.])
400 LIBS_DBUS=$DBUS_LIBDIR/libdbus-1.a
404 # BSD sockets, if you're on Solaris
405 AC_CHECK_LIB(socket, bind)
408 if test "$with_openssl" != "no"; then
409 if test "$with_openssl" != ""; then
410 WV_APPEND(CPPFLAGS, [-I$with_openssl/include])
411 WV_APPEND(LDFLAGS, [-L$with_openssl])
413 AC_CHECK_HEADERS(openssl/ssl.h,, [with_openssl=no],
414 [#define OPENSSL_NO_KRB5])
416 AC_CHECK_LIB(crypto, X509_free)
417 AC_CHECK_LIB(ssl, SSL_has_matching_session_id,, [with_openssl=no])
418 AC_CHECK_LIB(ssl, POLICY_MAPPING_new,, [with_openssl_policy_mapping=no])
419 if test "$with_openssl_policy_mapping" != "no"; then
420 AC_DEFINE([HAVE_OPENSSL_POLICY_MAPPING], [1],
421 [Whether libssl has the POLICY_MAPPING features (0.9.8 and up)])
424 if test "$with_openssl" != "no"; then
425 LIBS_SSL="-lcrypto -lssl"
430 if test "$with_readline" != "no"; then
431 AC_CHECK_HEADERS(readline/readline.h,, [with_readline=no])
432 AC_CHECK_LIB(readline, readline,, [with_readline=no])
436 if test "$with_pam" != "no"; then
437 AC_CHECK_HEADERS(security/pam_appl.h,, [with_pam=no])
439 AC_CHECK_LIB(pam, pam_start,, [with_pam=no])
440 AC_MSG_CHECKING(for sane PAM implementation)
442 [#include "confdefs.h"
443 #if HAVE_SECURITY_PAM_APPL_H
444 # include <security/pam_appl.h>
447 /* noconv: null PAM conversation function */
448 int noconv(int num_msg, const struct pam_message **msgm,
449 struct pam_response **response, void *userdata)
451 // if you need to ask things, it won't work
462 [AC_MSG_RESULT([yes])
463 AC_DEFINE([HAVE_BROKEN_PAM], [0])],
465 AC_DEFINE([HAVE_BROKEN_PAM], [1],
466 [Solaris has a broken PAM implementation])])
468 if test "$with_pam" != "no" -a "$HAVE_BROKEN_PAM" != "1"; then
474 if test "$with_tcl" != "no"; then
475 CPPFLAGS_save="$CPPFLAGS"
476 WV_APPEND(CPPFLAGS, -I/usr/include/tcl8.3)
477 AC_CHECK_HEADERS(tcl.h,, [with_tcl=no])
479 AC_CHECK_LIB(tcl8.3, TclInterpInit,, [with_tcl=no])
481 if test "$with_tcl" != "no"; then
482 CPPFLAGS="$CPPFLAGS_save"
488 if test "$with_qt" != "no"; then
489 test "$with_qt" = yes && with_qt=
490 AC_CACHE_CHECK([for Qt], [wv_cv_with_qt], [
492 CPPFLAGS_save="$CPPFLAGS"
493 LDFLAGS_save="$LDFLAGS"
495 for wv_qtdir in $with_qt $QTDIR $QT_SEARCH_PATH $(pkg-config --variable=prefix qt-mt); do
496 eval wv_qtdir="$wv_qtdir"
497 CPPFLAGS="$CPPFLAGS_save -I$wv_qtdir/include -I$wv_qtdir/include/qt3"
498 LDFLAGS="$LDFLAGS_save -L$wv_qtdir/lib"
499 LIBS="$LIBS_save -lqt-mt"
500 AC_TRY_LINK([#include <qstring.h>],
501 [QString x("hello"); return 0; ],
502 [wv_cv_with_qt=$wv_qtdir; break])
504 CPPFLAGS="$CPPFLAGS_save"
505 LDFLAGS="$LDFLAGS_save"
508 with_qt=$wv_cv_with_qt
509 if test "$with_qt" != no; then
510 WV_APPEND(CPPFLAGS, -I$with_qt/include -I$with_qt/include/qt3)
511 if test "$wv_qtdir" != "/usr" ; then
512 # never explicitly include /usr/lib
513 WV_APPEND(LDFLAGS, -L$with_qt/lib)
515 WV_APPEND(LIBS_QT, -lqt-mt)
517 AC_PATH_PROG(MOC, moc, [moc not found], $with_qt/bin)
521 if test "$with_valgrind" != "no"; then
522 AC_CHECK_PROG(VALGRIND, valgrind, valgrind)
523 AC_CHECK_HEADERS(valgrind/memcheck.h)
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])
532 # Find out whether TR1 or Boost are available.
533 AC_CHECK_HEADERS(tr1/functional)
534 AC_CHECK_HEADERS(boost/function.hpp)
536 # When compiling with exceptions disabled and Boost, applications need
537 # to provide an "exception handler", declared here.
538 AC_CHECK_HEADERS(boost/throw_exception.hpp)
540 # check for missing packages
543 if test "$with_dbus" = "no"; then
544 AC_MSG_WARN([DBUS is missing.])
547 if test "$with_pam" = "no"; then
548 AC_MSG_WARN([PAM is missing.])
551 if test "$with_qt" = "no"; then
552 AC_MSG_WARN([Qt is missing.])
555 if test "$VALGRIND" = ""; then
556 AC_MSG_WARN([Valgrind is missing.])
558 if test "$with_openssl" = "no"; then
559 AC_MSG_WARN([OpenSSL is missing.])
560 missing_required="$missing_required OpenSSL>=0.9.7"
562 if test "$with_readline" = "no"; then
563 AC_MSG_WARN([readline is missing.])
565 if test "$with_zlib" = "no"; then
566 AC_MSG_WARN([zlib is missing.])
567 missing_required="$missing_required zlib"
569 if test "$ac_cv_header_tr1_functional" != "yes" \
570 -a "$ac_cv_header_boost_function_hpp" != "yes"; then
571 AC_MSG_WARN([both tr1/functional and boost/function.hpp are missing.])
572 missing_required="$missing_required boost/function.hpp"
575 if test -n "$missing_required"; then
576 AC_MSG_ERROR([Required dependencies missing:$missing_required])
579 if test "$VALGRIND" != ""; then
580 VALGRIND="valgrind --tool=memcheck --leak-check=yes --num-callers=10 --suppressions=\$(WVSTREAMS_SRC)/wvstreams.supp"
581 if valgrind --help | grep log-file >/dev/null; then
582 VALGRIND="$VALGRIND --log-file=valgrind.log"
584 VALGRIND="$VALGRIND --logfile=valgrind.log"
589 # Compiler is always posix if invoking this configure script
590 COMPILER_STANDARD=posix
594 AC_SUBST(USE_WVSTREAMS_ARGP)
596 AC_SUBST(enable_debug)
597 AC_SUBST(enable_optimization)
598 AC_SUBST(enable_resolver_fork)
599 AC_SUBST(enable_delete_detector)
600 AC_SUBST(enable_warnings)
601 AC_SUBST(enable_testgui)
604 AC_SUBST(with_openssl)
605 AC_SUBST(with_openssl_policy_mapping)
607 AC_SUBST(with_readline)
618 AC_SUBST(COMPILER_STANDARD)
620 AC_DEFINE_UNQUOTED([VERBOSE_PACKAGE_VERSION],["$PACKAGE_VERSION$WEAVER_BUILD_INFO"],[Verbose package version])
622 AC_CONFIG_FILES(config.mk)
623 AC_CONFIG_FILES([pkgconfig/libuniconf.pc
624 pkgconfig/libuniconf-uninstalled.pc
625 pkgconfig/libwvbase.pc
626 pkgconfig/libwvbase-uninstalled.pc
627 pkgconfig/libwvdbus.pc
628 pkgconfig/libwvdbus-uninstalled.pc
630 pkgconfig/libwvqt-uninstalled.pc
631 pkgconfig/libwvstreams.pc
632 pkgconfig/libwvstreams-uninstalled.pc
633 pkgconfig/libwvutils.pc
634 pkgconfig/libwvutils-uninstalled.pc
635 pkgconfig/libwvtest.pc
636 pkgconfig/libwvtest-uninstalled.pc])
638 AC_CONFIG_HEADERS(include/wvautoconf.h)
642 # Now convert PACKAGE_* macros into WVPACKAGE_* in include/wvautoconf.h
643 sed 's,\(\#define.*\)PACKAGE,\1WVPACKAGE,' include/wvautoconf.h > include/wvautoconf.h.new
644 if test "x$?" = "x0"; then
645 if ! diff include/wvautoconf.h include/wvautoconf.h.new >/dev/null; then
646 mv include/wvautoconf.h.new include/wvautoconf.h
648 rm include/wvautoconf.h.new