1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(WvStreams, 4.5.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]))
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
148 (cd argp && ./configure "$@")
157 AC_CHECK_HEADERS(execinfo.h)
160 AC_CHECK_HEADERS([argz.h errno.h])
161 AC_CHECK_TYPE(error_t,, [AC_DEFINE([error_t], [int],
162 [Define to a type to use for `error_t' if it is not otherwise available.])
163 AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h
164 does not typedef error_t.])],dnl `
173 # Check for size of ethernet addresses
174 AC_CHECK_HEADERS([sys/socket.h])
175 AC_CHECK_HEADERS([net/if.h], [], [],
185 #if HAVE_SYS_SOCKET_H
186 # include <sys/socket.h>
189 AC_CHECK_HEADERS([net/ethernet.h], [], [],
199 #if HAVE_SYS_SOCKET_H
200 # include <sys/socket.h>
203 AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
213 #if HAVE_SYS_SOCKET_H
214 # include <sys/socket.h>
220 AC_CHECK_DECL(ETHER_ADDR_LEN,,
221 AC_CHECK_TYPE(ether_addr_t,
222 AC_DEFINE([ETHER_ADDR_LEN], [sizeof(ether_addr_t)],
223 [Size of ethernet address]),
224 AC_DEFINE([ETHER_ADDR_LEN], [6]),
227 # include <sys/types.h>
237 #if HAVE_SYS_SOCKET_H
238 # include <sys/socket.h>
240 #if HAVE_NET_ETHERNET_H
241 # include <net/ethernet.h>
246 #if HAVE_NETINET_IF_ETHER_H
247 # include <netinet/if_ether.h>
252 # include <sys/types.h>
262 #if HAVE_SYS_SOCKET_H
263 # include <sys/socket.h>
265 #if HAVE_NET_ETHERNET_H
266 # include <net/ethernet.h>
271 #if HAVE_NETINET_IF_ETHER_H
272 # include <netinet/if_ether.h>
276 # Check for basic Internet support
277 AC_CHECK_HEADERS([netdb.h])
278 AC_CHECK_HEADERS([netinet/in.h])
279 AC_CHECK_HEADERS([netinet/in_systm.h])
280 AC_CHECK_HEADERS([netinet/ip.h], [], [],
283 # include <sys/types.h>
293 #if HAVE_NETINET_IN_H
294 # include <netinet/in.h>
296 #if HAVE_NETINET_IN_SYSTM_H
297 # include <netinet/in_systm.h>
300 AC_CHECK_HEADERS([netinet/tcp.h])
302 # Check for advanced Linux-style modem support
303 AC_CHECK_HEADERS([linux/serial.h])
304 AC_CHECK_FUNCS([cfmakeraw])
306 # Detect hard-linking based on LN_S's behaviour
307 AC_MSG_CHECKING([whether ln works...])
315 AC_MSG_RESULT([no, using $LN])
320 # Setting the default language to C++ means that CXX and CXXCPP will be
321 # used for compile tests.
324 # __libc_stack_end isn't available to shared libraries with some libc versions
325 AC_MSG_CHECKING([whether __libc_stack_end is public])
326 AH_TEMPLATE([HAVE_LIBC_STACK_END], [Whether libc supports __libc_stack_end])
327 LDFLAGS_save="$LDFLAGS"
328 WV_APPEND(LDFLAGS, [-Wl,-z,defs -shared])
329 HAVE_LIBC_STACK_END=no
330 AC_TRY_LINK([extern const void *__libc_stack_end; ],
331 [volatile const void *x = __libc_stack_end; ],
332 [HAVE_LIBC_STACK_END=yes; ])
333 if test "$HAVE_LIBC_STACK_END" = "yes"; then
334 AC_DEFINE([HAVE_LIBC_STACK_END])
336 AC_MSG_RESULT([$HAVE_LIBC_STACK_END])
337 LDFLAGS="$LDFLAGS_save"
340 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
341 if test "$PKGCONFIG" = "no"; then
342 AC_MSG_WARN([pkg-config is not installed])
345 if test "$enable_debug" != "no"; then
346 AC_DEFINE_UNQUOTED(VER_STRING_EXTRA, [" (`whoami`@`hostname`$VER_STRING_EXTRA)"], [Extra version string.])
350 if test "$enable_resolver_fork" = "no"; then
351 AC_DEFINE(WVRESOLVER_SKIP_FORK,,
352 [Define to disable WvResolver forking for debugging with gdb.])
355 # xplc delete detector
356 if test "$enable_delete_detector" = "yes"; then
357 AC_DEFINE(ENABLE_DELETE_DETECTOR,,
358 [Define to enable the XPLC delete detector.])
362 if test "$with_dbus" != "no"; then
363 WV_APPEND(CPPFLAGS, -DDBUS_API_SUBJECT_TO_CHANGE -Iinclude/dbus-upstream)
364 if test "$with_dbus" = "" -o "$with_dbus" = "yes"; then
365 DBUS_LIBDIR="$(pkg-config --variable=libdir dbus-1)"
366 if test -z "$DBUS_LIBDIR"; then
367 DBUS_LIBDIR=/usr/lib # Default path for static linking
369 WV_APPEND(CPPFLAGS, [`pkg-config --cflags dbus-1`])
370 WV_APPEND(LDFLAGS, [`pkg-config --libs-only-L dbus-1`])
372 DBUS_LIBDIR=$with_dbus/dbus/.libs
373 WV_APPEND(CPPFLAGS, -I$with_dbus)
374 WV_APPEND(LDFLAGS, -L$DBUS_LIBDIR)
377 AC_CHECK_HEADERS(dbus/dbus.h,, [with_dbus=no])
379 LIBS="$LIBS $DBUS_LIBDIR/libdbus-1.a"
381 AC_TRY_LINK([extern "C" void dbus_message_new(); ],
382 [dbus_message_new(); ],
386 if test "$with_dbus" != "no"; then
387 AC_DEFINE(WITH_DBUS,,
388 [Define to enable DBUS support.])
389 LIBS_DBUS=$DBUS_LIBDIR/libdbus-1.a
393 # BSD sockets, if you're on Solaris
394 AC_CHECK_LIB(socket, bind)
397 if test "$with_openssl" != "no"; then
398 if test "$with_openssl" != ""; then
399 WV_APPEND(CPPFLAGS, [-I$with_openssl/include])
400 WV_APPEND(LDFLAGS, [-L$with_openssl])
402 AC_CHECK_HEADERS(openssl/ssl.h,, [with_openssl=no],
403 [#define OPENSSL_NO_KRB5])
405 AC_CHECK_LIB(crypto, X509_free)
406 AC_CHECK_LIB(ssl, SSL_has_matching_session_id,, [with_openssl=no])
407 AC_CHECK_LIB(ssl, POLICY_MAPPING_new,, [with_openssl_policy_mapping=no])
408 if test "$with_openssl_policy_mapping" != "no"; then
409 AC_DEFINE([HAVE_OPENSSL_POLICY_MAPPING], [1],
410 [Whether libssl has the POLICY_MAPPING features (0.9.8 and up)])
413 if test "$with_openssl" != "no"; then
414 LIBS_SSL="-lcrypto -lssl"
419 if test "$with_readline" != "no"; then
420 AC_CHECK_HEADERS(readline/readline.h,, [with_readline=no])
421 AC_CHECK_LIB(readline, readline,, [with_readline=no])
425 if test "$with_pam" != "no"; then
426 AC_CHECK_HEADERS(security/pam_appl.h,, [with_pam=no])
428 AC_CHECK_LIB(pam, pam_start,, [with_pam=no])
429 AC_MSG_CHECKING(for sane PAM implementation)
431 [#include "confdefs.h"
432 #if HAVE_SECURITY_PAM_APPL_H
433 # include <security/pam_appl.h>
436 /* noconv: null PAM conversation function */
437 int noconv(int num_msg, const struct pam_message **msgm,
438 struct pam_response **response, void *userdata)
440 // if you need to ask things, it won't work
451 [AC_MSG_RESULT([yes])
452 AC_DEFINE([HAVE_BROKEN_PAM], [0])],
454 AC_DEFINE([HAVE_BROKEN_PAM], [1],
455 [Solaris has a broken PAM implementation])])
457 if test "$with_pam" != "no" -a "$HAVE_BROKEN_PAM" != "1"; then
463 if test "$with_tcl" != "no"; then
464 CPPFLAGS_save="$CPPFLAGS"
465 WV_APPEND(CPPFLAGS, -I/usr/include/tcl8.3)
466 AC_CHECK_HEADERS(tcl.h,, [with_tcl=no])
468 AC_CHECK_LIB(tcl8.3, TclInterpInit,, [with_tcl=no])
470 if test "$with_tcl" != "no"; then
471 CPPFLAGS="$CPPFLAGS_save"
477 if test "$with_qt" != "no"; then
478 test "$with_qt" = yes && with_qt=
479 AC_CACHE_CHECK([for Qt], [wv_cv_with_qt], [
481 CPPFLAGS_save="$CPPFLAGS"
482 LDFLAGS_save="$LDFLAGS"
484 for wv_qtdir in $with_qt $QTDIR $QT_SEARCH_PATH $(pkg-config --variable=prefix qt-mt); do
485 eval wv_qtdir="$wv_qtdir"
486 CPPFLAGS="$CPPFLAGS_save -I$wv_qtdir/include -I$wv_qtdir/include/qt3"
487 LDFLAGS="$LDFLAGS_save -L$wv_qtdir/lib"
488 LIBS="$LIBS_save -lqt-mt"
489 AC_TRY_LINK([#include <qstring.h>],
490 [QString x("hello"); return 0; ],
491 [wv_cv_with_qt=$wv_qtdir; break])
493 CPPFLAGS="$CPPFLAGS_save"
494 LDFLAGS="$LDFLAGS_save"
497 with_qt=$wv_cv_with_qt
498 if test "$with_qt" != no; then
499 WV_APPEND(CPPFLAGS, -I$with_qt/include -I$with_qt/include/qt3)
500 if test "$wv_qtdir" != "/usr" ; then
501 # never explicitly include /usr/lib
502 WV_APPEND(LDFLAGS, -L$with_qt/lib)
504 WV_APPEND(LIBS_QT, -lqt-mt)
506 AC_PATH_PROG(MOC, moc, [moc not found], $with_qt/bin)
510 if test "$with_valgrind" != "no"; then
511 AC_CHECK_PROG(VALGRIND, valgrind, valgrind)
512 AC_CHECK_HEADERS(valgrind/memcheck.h)
516 if test "$with_zlib" != "no"; then
517 AC_CHECK_HEADERS(zlib.h,, [with_zlib=no])
518 AC_CHECK_LIB(z, compress,, [with_zlib=no])
521 # Find out whether TR1 or Boost are available.
522 AC_CHECK_HEADERS(tr1/functional)
523 AC_CHECK_HEADERS(boost/function.hpp)
525 # When compiling with exceptions disabled and Boost, applications need
526 # to provide an "exception handler", declared here.
527 AC_CHECK_HEADERS(boost/throw_exception.hpp)
529 # check for missing packages
532 if test "$with_dbus" = "no"; then
533 AC_MSG_WARN([DBUS is missing.])
536 if test "$with_pam" = "no"; then
537 AC_MSG_WARN([PAM is missing.])
540 if test "$with_qt" = "no"; then
541 AC_MSG_WARN([Qt is missing.])
544 if test "$VALGRIND" = ""; then
545 AC_MSG_WARN([Valgrind is missing.])
547 if test "$with_openssl" = "no"; then
548 AC_MSG_WARN([OpenSSL is missing.])
549 missing_required="$missing_required OpenSSL>=0.9.7"
551 if test "$with_readline" = "no"; then
552 AC_MSG_WARN([readline is missing.])
554 if test "$with_zlib" = "no"; then
555 AC_MSG_WARN([zlib is missing.])
556 missing_required="$missing_required zlib"
558 if test "$ac_cv_header_tr1_functional" != "yes" \
559 -a "$ac_cv_header_boost_function_hpp" != "yes"; then
560 AC_MSG_WARN([both tr1/functional and boost/function.hpp are missing.])
561 missing_required="$missing_required boost/function.hpp"
564 if test -n "$missing_required"; then
565 AC_MSG_ERROR([Required dependencies missing:$missing_required])
568 if test "$VALGRIND" != ""; then
569 VALGRIND="valgrind --tool=memcheck --leak-check=yes --num-callers=10 --suppressions=\$(WVSTREAMS_SRC)/wvstreams.supp"
570 if valgrind --help | grep log-file >/dev/null; then
571 VALGRIND="$VALGRIND --log-file=valgrind.log"
573 VALGRIND="$VALGRIND --logfile=valgrind.log"
578 # Compiler is always posix if invoking this configure script
579 COMPILER_STANDARD=posix
583 AC_SUBST(USE_WVSTREAMS_ARGP)
585 AC_SUBST(enable_debug)
586 AC_SUBST(enable_optimization)
587 AC_SUBST(enable_resolver_fork)
588 AC_SUBST(enable_delete_detector)
589 AC_SUBST(enable_warnings)
590 AC_SUBST(enable_testgui)
593 AC_SUBST(with_openssl)
594 AC_SUBST(with_openssl_policy_mapping)
596 AC_SUBST(with_readline)
607 AC_SUBST(COMPILER_STANDARD)
609 AC_DEFINE_UNQUOTED([VERBOSE_PACKAGE_VERSION],["$PACKAGE_VERSION$WEAVER_BUILD_INFO"],[Verbose package version])
611 AC_CONFIG_FILES(config.mk)
612 AC_CONFIG_FILES([pkgconfig/libuniconf.pc
613 pkgconfig/libuniconf-uninstalled.pc
614 pkgconfig/libwvbase.pc
615 pkgconfig/libwvbase-uninstalled.pc
616 pkgconfig/libwvdbus.pc
617 pkgconfig/libwvdbus-uninstalled.pc
619 pkgconfig/libwvqt-uninstalled.pc
620 pkgconfig/libwvstreams.pc
621 pkgconfig/libwvstreams-uninstalled.pc
622 pkgconfig/libwvutils.pc
623 pkgconfig/libwvutils-uninstalled.pc
624 pkgconfig/libwvtest.pc
625 pkgconfig/libwvtest-uninstalled.pc])
627 AC_CONFIG_HEADERS(include/wvautoconf.h)
631 # Now convert PACKAGE_* macros into WVPACKAGE_* in include/wvautoconf.h
632 sed 's,\(\#define.*\)PACKAGE,\1WVPACKAGE,' include/wvautoconf.h > include/wvautoconf.h.new
633 if test "x$?" = "x0"; then
634 if ! diff include/wvautoconf.h include/wvautoconf.h.new >/dev/null; then
635 mv include/wvautoconf.h.new include/wvautoconf.h
637 rm include/wvautoconf.h.new