]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - configure.in
Imported Upstream version 5.42+svn3561
[mirror_smartmontools-debian.git] / configure.in
index d3cfaff5bd699ce2bd5744e2f7ff231921aabd8b..5c3d352f1b82d37598618a8e3f9a972bf55d655b 100644 (file)
@@ -1,15 +1,15 @@
 #
-# $Id: configure.in,v 1.122 2006/12/20 20:39:25 chrfranke Exp $
+# $Id: configure.in 3527 2012-03-25 16:42:24Z chrfranke $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
-AC_INIT(smartmontools, 5.37, smartmontools-support@lists.sourceforge.net)
+AC_INIT(smartmontools, 5.43, smartmontools-support@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(smartctl.cpp)
 
-smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
-smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.122 2006/12/20 20:39:25 chrfranke Exp $'`
-smartmontools_release_date=2006/12/20
-smartmontools_release_time="20:37:59 UTC"
+smartmontools_configure_date=`date -u +'%Y-%m-%d %T %Z'`
+smartmontools_cvs_tag=`echo '$Id: configure.in 3527 2012-03-25 16:42:24Z chrfranke $'`
+smartmontools_release_date=2011-10-20
+smartmontools_release_time="19:19:34 UTC"
 
 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args",            [smartmontools Configure Arguments])
 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_DATE, "$smartmontools_configure_date", [smartmontools Configure Date])
@@ -20,7 +20,7 @@ AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE,             "http://smartmontools.sourcefor
 
 AM_CONFIG_HEADER(config.h)
 
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
 
 AM_MAINTAINER_MODE
 
@@ -30,23 +30,70 @@ AC_PROG_CXX
 AM_PROG_AS
 AC_PROG_INSTALL
 
+m4_pattern_forbid([^PKG_PROG_])
+if test "$cross_compiling" = "no"; then
+  m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG],
+    [AC_MSG_WARN([m4/pkg.m4 missing, systemd detection disabled])])
+fi
+
+AC_ARG_VAR(WINDMC, [Windows message compiler command])
+AC_ARG_VAR(WINDRES, [Windows resource compiler command])
+AC_ARG_VAR(MAKENSIS, [NSIS compiler command])
+
 AC_CANONICAL_HOST
-dnl Set flags which may affect AC_CHECK_*.
 case "${host}" in
-       *-*-mingw*)
-               CPPFLAGS="$CPPFLAGS -mno-cygwin"
-               LDFLAGS="$LDFLAGS -mno-cygwin"
-               CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32"
+  *-*-mingw*)
+    # Cygwin gcc 4.x does no longer support '-mno-cygwin' to select MinGW gcc.
+    if test "${build}" = "${host}" && test -x /usr/bin/uname && \
+    /usr/bin/uname | grep -i '^CYGWIN' >/dev/null; then
+      AC_MSG_ERROR([Build with MinGW on Cygwin requires cross-compilation, see INSTALL file.])
+    fi
+    AC_CHECK_PROGS(WINDMC, [${host}-windmc windmc])
+    AC_CHECK_PROGS(WINDRES, [${host}-windres windres])
+
+    AC_MSG_CHECKING([checking for makensis])
+    if test -z "$MAKENSIS"; then
+      if test -n "$PROGRAMFILES" && "$PROGRAMFILES/NSIS/makensis" -VERSION >/dev/null 2>&1; then
+        MAKENSIS="$PROGRAMFILES/NSIS/makensis"
+      elif makensis -VERSION >/dev/null 2>&1; then
+        MAKENSIS=makensis
+      fi
+    fi
+    AC_MSG_RESULT([${MAKENSIS:-no}])
+    ;;
 esac
 
-dnl Checks for libraries.needed for gethostbyname (Solaris needs
+# Check for SVN.
+AC_MSG_CHECKING([whether this is a build from SVN])
+is_svn_build=no
+svn_deps=
+if test -f "$srcdir/.svn/entries"; then
+  is_svn_build=unknown
+  if (cd "$srcdir" && svn --version && svnversion && svn info) >/dev/null 2>&1; then
+    is_svn_build=yes
+    svn_deps='${srcdir}/.svn/entries'
+    # SVN 1.7 working copy?
+    test -f "$srcdir/.svn/wc.db" && svn_deps='${srcdir}/.svn/wc.db'
+  fi
+fi
+AC_SUBST([svn_deps])
+AM_CONDITIONAL(IS_SVN_BUILD, [test "$is_svn_build" = "yes"])
+AC_MSG_RESULT([$is_svn_build])
+
+dnl Checks for libraries needed for name services (Solaris needs
 dnl libnsl, might in the future also need libsocket)
 #  AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
-AC_SEARCH_LIBS(gethostbyname, nsl, , AC_SEARCH_LIBS(gethostbyname, nsl, , , -lsocket), , )
+AC_SEARCH_LIBS(socket, socket)
+AC_SEARCH_LIBS(gethostbyname, nsl)
+AC_SEARCH_LIBS(getaddrinfo, nsl)
+AC_SEARCH_LIBS(getdomainname, nsl)
+
+# Note: On Linux, clock_gettime() requires -lrt which implies -lpthreads
+# Check ommitted for now, gettimeofday() provides reasonable precision
+# AC_SEARCH_LIBS(clock_gettime, rt)
 
 dnl Checks for header files.
 AC_CHECK_HEADERS([locale.h])
-AC_CHECK_HEADERS([getopt.h])
 AC_CHECK_HEADERS([dev/ata/atavar.h])
 AC_CHECK_HEADERS([netdb.h])
 dnl we need [u]int64_t and friends.
@@ -59,44 +106,70 @@ AC_CHECK_HEADERS([sys/tweio.h])
 AC_CHECK_HEADERS([sys/twereg.h])
 dnl Check for FreeBSD twa include files...
 AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
-dnl This header file needed at least for SuSE LINUX
+dnl This header file is needed for cciss_ioctl.h at least on SuSE LINUX
 AC_CHECK_HEADERS([linux/compiler.h])
+dnl Check for the FreeBSD CCISS system header and use internal one if not found
+AC_CHECK_HEADERS([dev/ciss/cissio.h],
+    [AC_DEFINE([CISS_LOCATION],[<dev/ciss/cissio.h>],[freebsd ciss header location])],
+    [AC_DEFINE([CISS_LOCATION],["cissio_freebsd.h"],[freebsd ciss header location])]
+    )
+dnl Check for Linux CCISS include file
+AC_CHECK_HEADERS([linux/cciss_ioctl.h], [], [], [AC_INCLUDES_DEFAULT
+#ifdef HAVE_LINUX_COMPILER_H
+# include <linux/compiler.h>
+#endif
+])
+dnl Check for Windows DDK and WMI header files
+AC_CHECK_HEADERS([ntdddisk.h ddk/ntdddisk.h], [], [], [AC_INCLUDES_DEFAULT
+#include <windows.h>
+])
+AC_CHECK_HEADERS([wbemcli.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_CHECK_TYPES([int64_t, uint64_t])
 
 dnl Checks for library functions.
-AC_CHECK_FUNCS([getopt])
-AC_CHECK_FUNCS([getopt_long])
+AC_CHECK_FUNCS([getopt_long], [need_getopt_long=no], [need_getopt_long=yes])
+AM_CONDITIONAL(NEED_GETOPT_LONG, [test "$need_getopt_long" = "yes"])
+AC_CHECK_FUNCS([regcomp], [need_regex=no], [need_regex=yes])
+AM_CONDITIONAL(NEED_REGEX, [test "$need_regex" = "yes"])
+
 AC_CHECK_FUNCS([getdomainname])
 AC_CHECK_FUNCS([gethostname])
+AC_CHECK_FUNCS([getaddrinfo])
 AC_CHECK_FUNCS([gethostbyname])
 AC_CHECK_FUNCS([sigset])
 AC_CHECK_FUNCS([strtoull])
 AC_CHECK_FUNCS([uname])
+AC_CHECK_FUNCS([clock_gettime ftime gettimeofday])
+
+# Check byte ordering (defines WORDS_BIGENDIAN)
+AC_C_BIGENDIAN
 
 # Check whether snprintf appends null char and returns expected length on overflow
-AH_TEMPLATE(HAVE_WORKING_SNPRINTF, [Define to 1 if the `snprintf' function is sane])
 AC_MSG_CHECKING([for working snprintf])
 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[ char buf[]="ABCDEFGHI";
                int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8); ]])],
               [libc_have_working_snprintf=yes],
-             [libc_have_working_snprintf=no],
-             [libc_have_working_snprintf=no])
+              [libc_have_working_snprintf=no],
+              [libc_have_working_snprintf=unknown])
 AC_SUBST(libc_have_working_snprintf)
 if test "$libc_have_working_snprintf" = "yes"; then
-  AC_DEFINE(HAVE_WORKING_SNPRINTF)
+  AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane])
 fi
 AC_MSG_RESULT([$libc_have_working_snprintf])
 
 # check for __attribute__((packed))
-AH_TEMPLATE(HAVE_ATTR_PACKED, [Define to 1 if C++ compiler supports __attribute__((packed))])
-AC_MSG_CHECKING([whether C++ compiler supports __attribute__((packed))])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[struct a { int b; } __attribute__((packed));]])],
-                  [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
+# (sizeof() check is required to avoid false positives if other
+# __attribute__((x)) are supported)
+AC_MSG_CHECKING([whether $CXX supports __attribute__((packed))])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[
+    struct s { char a; short b; } __attribute__((packed));
+    typedef char t[sizeof(struct s) == 3 ? 1 : -1];]])],
+  [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
 AC_SUBST(gcc_have_attr_packed)
 if test "$gcc_have_attr_packed" = "yes"; then
-  AC_DEFINE(HAVE_ATTR_PACKED)
+  AC_DEFINE(HAVE_ATTR_PACKED, 1, [Define to 1 if C++ compiler supports __attribute__((packed))])
 fi
 AC_MSG_RESULT([$gcc_have_attr_packed])
 
@@ -104,17 +177,161 @@ AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
 AC_SUBST(ASFLAGS)
 
-AC_SUBST([exampledir], ['${docdir}/examplescripts'])
+AC_ARG_WITH(systemdsystemunitdir,
+  [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])],
+  [], [with_systemdsystemunitdir=auto])
 
-AC_ARG_WITH(initscriptdir,[AC_HELP_STRING([--with-initscriptdir=dir],[Location of init scripts (default is ${sysconfdir}/rc.d/init.d)])],[initddir="$withval"],[initddir='${sysconfdir}/rc.d/init.d'])
+systemdsystemunitdir=
+case "$with_systemdsystemunitdir" in
+ auto|yes)
+   if test -n "$PKG_CONFIG"; then
+     AC_MSG_CHECKING([for systemdsystemunitdir])
+     systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
+     AC_MSG_RESULT([${systemdsystemunitdir:-no}])
+   fi
+   case "$with_systemdsystemunitdir:$sysconfdir:$systemdsystemunitdir" in
+     yes:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
+     yes:*:*|auto:*:|auto:/etc:*) ;;
+     *) systemdsystemunitdir='${prefix}'$systemdsystemunitdir ;;
+   esac ;;
+ no) ;;
+ *) systemdsystemunitdir="$with_systemdsystemunitdir" ;;
+esac
+AC_SUBST(systemdsystemunitdir)
+AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"])
+
+AC_ARG_WITH(initscriptdir,
+  [AC_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
+  [], [with_initscriptdir=auto])
+
+initddir=
+case "$with_initscriptdir:$cross_compiling:$systemdsystemunitdir" in
+  auto:no:|yes:*)
+    AC_MSG_CHECKING([for init (rc) directory])
+    for dir in rc.d/init.d init.d rc.d; do
+      if test -d /etc/$dir; then
+        initddir='${sysconfdir}'/$dir
+        break
+      fi
+    done
+    AC_MSG_RESULT([${initddir:-no}])
+    case "$with_initscriptdir:$initddir" in
+      yes:) AC_MSG_ERROR([Location of init scripts not found]) ;;
+    esac ;;
+  auto:*|no:*) ;;
+  *) initddir="$with_initscriptdir" ;;
+esac
 AC_SUBST(initddir)
+AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"])
 
-AC_ARG_WITH(docdir,[AC_HELP_STRING([--with-docdir=dir],[Location of documentation (default is ${prefix}/share/doc/smartmontools-5.X)])],[docdir="$withval"],[docdir='${prefix}/share/doc/${PACKAGE}-${VERSION}'])
+# use different init script templates for different OS
+case "${host}" in
+  *-*-freebsd*)
+    initdfile="smartd.freebsd.initd"
+    ;;
+  *)
+    initdfile="smartd.initd"
+    ;;
+esac
+AC_SUBST(initdfile)
+
+AC_ARG_WITH(docdir,
+  [AC_HELP_STRING([--with-docdir=DIR],[Location of documentation [DATADIR/doc/smartmontools]])],
+  [docdir="$withval"],
+  [ if test -z "$docdir"; then
+      # autoconf 2.5x without '--docdir' support
+      docdir='${datadir}/doc/${PACKAGE}'
+    fi
+  ])
 AC_SUBST(docdir)
 
-AC_ARG_ENABLE(sample,[AC_HELP_STRING([--enable-sample],[Enables appending .sample to the installed smartd rc script and configuration file])],[smartd_suffix='.sample'],[smartd_suffix=''])
+AC_ARG_WITH(exampledir,
+  [AC_HELP_STRING([--with-exampledir=DIR],[Location of example scripts [DOCDIR/examplescripts]])],
+  [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
+AC_SUBST(exampledir)
+
+AC_ARG_ENABLE(drivedb,
+  [AC_HELP_STRING([--disable-drivedb],[Disables drive database file])],
+  [], [enable_drivedb=yes])
+
+AC_ARG_WITH(drivedbdir,
+  [AC_HELP_STRING([--with-drivedbdir=DIR],[Location of drive database file (implies --enable-drivedb) [DATADIR/smartmontools]])],
+  [drivedbdir="$withval"; enable_drivedb=yes],
+  [drivedbdir=; test "$enable_drivedb" = "yes" && drivedbdir='${datadir}/${PACKAGE}'])
+AC_SUBST(drivedbdir)
+AM_CONDITIONAL(ENABLE_DRIVEDB, [test "$enable_drivedb" = "yes"])
+
+AC_ARG_ENABLE(savestates, [AC_HELP_STRING([--enable-savestates],[Enables default smartd state files])])
+
+AC_ARG_WITH(savestates,
+  [AC_HELP_STRING([--with-savestates=PREFIX],[Prefix for default smartd state files (implies --enable-savestates) [LOCALSTATEDIR/lib/smartmontools/smartd.]])],
+  [savestates="$withval"; enable_savestates="yes"],
+  [savestates=; test "$enable_savestates" = "yes" && savestates='${localstatedir}/lib/${PACKAGE}/smartd.'])
+savestatesdir="${savestates%/*}"
+AC_SUBST(savestates)
+AC_SUBST(savestatesdir)
+AM_CONDITIONAL(ENABLE_SAVESTATES, [test "$enable_savestates" = "yes"])
+
+AC_ARG_ENABLE(attributelog, [AC_HELP_STRING([--enable-attributelog],[Enables default smartd attribute log files])])
+
+AC_ARG_WITH(attributelog,
+  [AC_HELP_STRING([--with-attributelog=PREFIX],[Prefix for default smartd attribute log files (implies --enable-attributelog) [LOCALSTATEDIR/lib/smartmontools/attrlog.]])],
+  [attributelog="$withval"; enable_attributelog="yes"],
+  [attributelog=; test "$enable_attributelog" = "yes" && attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.'])
+attributelogdir="${attributelog%/*}"
+AC_SUBST(attributelog)
+AC_SUBST(attributelogdir)
+AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test "$enable_attributelog" = "yes"])
+
+AC_ARG_ENABLE(sample,
+  [AC_HELP_STRING([--enable-sample],[Enables appending .sample to the installed smartd rc script and configuration file])],
+  [smartd_suffix=; test "$enableval" = "yes" && smartd_suffix=".sample"],
+  [smartd_suffix=;])
 AC_SUBST(smartd_suffix)
-AM_CONDITIONAL(SMARTD_SUFFIX, test $smartd_suffix)
+
+AC_ARG_WITH(os-deps,
+  [AC_HELP_STRING([--with-os-deps='os_module.o ...'],[Specify OS dependent module(s) [guessed]])],
+  [ for x in $with_os_deps; do
+      case $x in
+        *.o) ;;
+        *) AC_MSG_ERROR([non-object file specified by --with-os-deps]) ;;
+      esac
+    done
+  ],[])
+
+AC_ARG_WITH(selinux,
+  [AC_HELP_STRING([--with-selinux@<:@=yes|no@:>@],[Enables SELinux support [no]])],
+  [ if test "$withval" = "yes"; then
+      AC_CHECK_HEADERS([selinux/selinux.h], [], [AC_MSG_ERROR([Missing SELinux header files])])
+      AC_CHECK_LIB(selinux, matchpathcon, [], [AC_MSG_ERROR([Missing or incorrect SELinux library files])])
+    fi
+  ],[])
+AC_SUBST(with_selinux)
+if test "$with_selinux" = "yes"; then
+  AC_DEFINE(WITH_SELINUX, 1, [Define to 1 if SELinux support is enabled])
+fi
+
+AC_ARG_WITH(libcap-ng,
+  [AC_HELP_STRING([--with-libcap-ng@<:@=auto|yes|no@:>@],[Add Libcap-ng support to smartd [auto]])],
+  [], [with_libcap_ng=auto])
+
+use_libcap_ng=no
+if test "$with_libcap_ng" != "no"; then
+  AC_CHECK_LIB(cap-ng, capng_clear,
+    [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).])
+     CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes])
+
+  if test "$use_libcap_ng" = "yes"; then
+    AC_CHECK_HEADER(cap-ng.h, [], [AC_MSG_ERROR([libcap-ng libraries found but headers are missing])])
+  elif test "$with_libcap_ng" = "yes"; then
+    AC_MSG_ERROR([libcap-ng support was requested but the library was not found])
+  fi
+fi
+
+AC_MSG_CHECKING([whether to use libcap-ng])
+AC_SUBST(CAPNG_LDADD)
+AM_CONDITIONAL(ENABLE_CAPABILITIES, [test "$use_libcap_ng" = "yes"])
+AC_MSG_RESULT([$use_libcap_ng])
 
 if test "$prefix" = "NONE"; then
     dnl no prefix and no mandir, so use ${prefix}/share/man as default
@@ -127,63 +344,125 @@ AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
 AC_SUBST(smartmontools_release_date)
 AC_SUBST(smartmontools_release_time)
 
-dnl if OS not recognized, then use the os_generic modules
+# Set platform-specific modules and symbols
+os_libs=
+os_dltools='curl wget lynx'
+os_mailer=
+os_darwin=no
+os_solaris=no
+os_win32=no
+os_win32_mingw=no
+os_win64=no
+os_man_filter=
 case "${host}" in
-       *-*-linux-gnu*) 
-               AC_SUBST([os_deps], ['os_linux.o']) 
-               AC_SUBST([os_libs], ['']) ;;
-       *-*-linux*)
-               AC_SUBST([os_deps], ['os_linux.o']) 
-               AC_SUBST([os_libs], ['']) ;;
-       *-*-freebsd*)
-               AC_SUBST([os_deps], ['os_freebsd.o']) 
-               AC_SUBST([os_libs], ['-lcam']);;
-       sparc-*-solaris*) 
-               AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer])
-               AC_DEFINE_UNQUOTED(NEED_SOLARIS_ATA_CODE, "os_solaris_ata.s", [need assembly code os_solaris_ata.s])
-               AC_SUBST([os_deps], ['os_solaris.o os_solaris_ata.o']) 
-               AC_SUBST([os_libs], ['']) ;;
-       *-pc-solaris*) 
-               AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer]) 
-               AC_SUBST([os_deps], ['os_solaris.o']) 
-               AC_SUBST([os_libs], ['']) ;;
-       *-*-netbsd*)
-               AC_SUBST([os_deps], ['os_netbsd.o']) 
-               AC_SUBST([os_libs], ['-lutil']) ;;
-       *-*-openbsd*)
-               AC_SUBST([os_deps], ['os_openbsd.o'])
-               AC_SUBST([os_libs], ['-lutil']) ;;
-       *-*-cygwin*)
-               AC_SUBST([os_deps], ['os_win32.o'])
-               AC_SUBST([os_libs], ['']) ;;
-       *-*-mingw*)
-               AC_SUBST([os_deps], ['os_win32.o'])
-               AC_SUBST([os_libs], ['']) ;;
-       *-*-darwin*)
-               AC_SUBST([os_deps], ['os_darwin.o'])
-               AC_SUBST([os_libs], ['-framework CoreFoundation -framework IOKit']) ;;
-       *)
-               AC_SUBST([os_deps], ['os_generic.o']) 
-               AC_SUBST([os_libs], ['']) ;;
+  *-*-linux*)
+    os_deps='os_linux.o cciss.o'
+    os_man_filter=Linux
+    ;;
+  *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
+    os_deps='os_freebsd.o cciss.o'
+    os_libs='-lcam'
+    os_dltools='curl wget lynx fetch'
+    AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
+    os_man_filter=FreeBSD
+    ;;
+  sparc-*-solaris*)
+    os_deps='os_solaris.o os_solaris_ata.o'
+    os_mailer='mailx'
+    os_solaris=yes
+    os_man_filter=Solaris
+    ;;
+  *-pc-solaris*)
+    os_deps='os_solaris.o'
+    os_mailer='mailx'
+    os_solaris=yes
+    os_man_filter=Solaris
+    ;;
+  *-*-netbsd*)
+    os_deps='os_netbsd.o'
+    os_libs='-lutil'
+    os_man_filter=NetBSD
+    ;;
+  *-*-openbsd*)
+    os_deps='os_openbsd.o'
+    os_libs='-lutil'
+    os_dltools='curl wget lynx ftp'
+    os_man_filter=OpenBSD
+    ;;
+  *-*-cygwin*)
+    os_deps='os_win32.o'
+    os_win32=yes
+    os_man_filter=Cygwin
+    ;;
+  x86_64-*-mingw*)
+    os_deps='os_win32.o'
+    os_win32=yes
+    os_win32_mingw=yes
+    os_win64=yes
+    os_man_filter=Windows
+    ;;
+  *-*-mingw*)
+    os_deps='os_win32.o'
+    os_win32=yes
+    os_win32_mingw=yes
+    os_man_filter=Windows
+    ;;
+  *-*-darwin*)
+    os_deps='os_darwin.o'
+    os_libs='-framework CoreFoundation -framework IOKit'
+    os_darwin=yes
+    os_man_filter=Darwin
+    ;;
+  *-*-nto-qnx*)
+    os_deps='os_qnxnto.o'
+    ;;
+  *)
+    os_deps='os_generic.o'
+    ;;
 esac
 
-# Define symbols for optional functions in OS specific module
-case "${os_deps}" in
-  os_win32*)
-    AC_DEFINE(HAVE_ATA_IDENTIFY_IS_CACHED, 1, [Define to 1 if you have the `ata_identify_is_cached' function in os_*.c.]) ;;
-esac
-case "${os_deps}" in
-  os_win32*)
-    AC_DEFINE(HAVE_GET_OS_VERSION_STR, 1, [Define to 1 if you have the `get_os_version_str' function in os_*.c.]) ;;
-esac
+# Replace if '--with-os-deps' was specified
+test -z "$with_os_deps" || os_deps="$with_os_deps"
+
+# Check if we need adapter to old interface (dev_legacy.cpp)
+os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'`
+AC_MSG_CHECKING([whether ${os_src} uses new interface])
+if grep "smart_interface" "${srcdir}/${os_src}" >/dev/null 2>&1; then
+  os_new_interface=yes
+else
+  os_new_interface=no
+  os_deps="${os_deps} dev_legacy.o"
+  AC_DEFINE(OLD_INTERFACE, 1, [Define to 1 if os_*.cpp still uses the old interface])
+fi
+AC_MSG_RESULT([$os_new_interface])
+
+AC_SUBST([os_deps])
+AC_SUBST([os_libs])
+AC_SUBST([os_dltools])
+AC_SUBST([os_man_filter])
+if test -n "$os_mailer"; then
+  AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "$os_mailer", [Default mailer if "mail" is unavailable])
+fi
 
-dnl Define platform-specific symbol.
-AM_CONDITIONAL(OS_DARWIN, [echo $host_os | grep '^darwin' > /dev/null])
-AM_CONDITIONAL(OS_SOLARIS, [echo $host_os | grep '^solaris' > /dev/null])
-AM_CONDITIONAL(OS_WIN32_MINGW, [echo $host_os | grep '^mingw' > /dev/null])
+# Create drivedb.h update branch name from version: 5.41[.X] -> RELEASE_5_41_DRIVEDB
+DRIVEDB_BRANCH=`echo $VERSION | sed 's,^\([[0-9]]*\.[[0-9]]*\)\..*$,\1,' \
+                | sed -n 's,^\([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\)$,RELEASE_\1_\2_DRIVEDB,p'`
+if test -z "$DRIVEDB_BRANCH"; then
+  AC_MSG_ERROR([Unable to create DRIVEDB_BRANCH from VERSION=$VERSION])
+fi
+AC_SUBST([DRIVEDB_BRANCH])
+
+# Enable platform-specific makefile sections
+AM_CONDITIONAL(OS_DARWIN, [test "$os_darwin" = "yes"])
+AM_CONDITIONAL(OS_SOLARIS, [test "$os_solaris" = "yes"])
+AM_CONDITIONAL(OS_WIN32, [test "$os_win32" = "yes"])
+AM_CONDITIONAL(OS_WIN32_MINGW, [test "$os_win32_mingw" = "yes"])
+AM_CONDITIONAL(OS_WIN32_NSIS, [test -n "$MAKENSIS"])
+AM_CONDITIONAL(OS_WIN32_WINDMC, [test -n "$WINDMC" && test "$WINDMC" != "no" && test -n "$WINDRES"])
+AM_CONDITIONAL(OS_WIN64, [test "$os_win64" = "yes"])
 
-dnl Add -Wall and -W if using gcc and its not already specified.
-if test "x$GCC" = "xyes"; then
+dnl Add -Wall and -W if using g++ and its not already specified.
+if test "$GXX" = "yes"; then
   if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
       CXXFLAGS="$CXXFLAGS -Wall"
   fi
@@ -191,28 +470,26 @@ if test "x$GCC" = "xyes"; then
   if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then
       CXXFLAGS="$CXXFLAGS -W"
   fi
-  case "${host}" in
-    *-*-mingw*)
-      # MinGW uses MSVCRT.DLL which uses printf format "%I64d" and not "%lld" for int64_t
-      CXXFLAGS="$CXXFLAGS -Wno-format";;
-  esac
+
 else
  dnl We are NOT using gcc, so enable host-specific compiler flags
  case "${host}" in
-       *-*-solaris*) 
-          dnl set CXXFLAGS for Solaris C++ compiler
+       sparc*-*-solaris*) 
+          dnl set CXXFLAGS for Solaris/SPARC C++ compiler
           if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
             dnl we have to tell the compilers about packed ATA structures
             CXXFLAGS="-xmemalign=1i $CXXFLAGS"
           fi
+ esac
+ case "${host}" in
+       *-*-solaris*) 
           if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
             dnl turn on optimization if user has not explicitly set its value
             CXXFLAGS="-xO2 $CXXFLAGS"
           fi
           if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then
-           dnl suppress warnings on use of string literal (const char[]) as
-           dnl char*. TODO: Sun Studio 10 (Sun C++ 5.7) or above only?
-           CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w $CXXFLAGS"
+           dnl suppress trivial warnings
+           CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w,badargtype2w $CXXFLAGS"
          fi
  esac
 fi
@@ -221,5 +498,78 @@ AC_DEFINE_UNQUOTED(SMARTMONTOOLS_BUILD_HOST,     "${host}",
 
 AC_SUBST(CXXFLAGS)
 
-AC_OUTPUT(Makefile examplescripts/Makefile)
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
 AC_PROG_MAKE_SET
+
+echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD
+echo "${PACKAGE}-${VERSION} configuration:" >&AS_MESSAGE_FD
+echo "host operating system:  $host" >&AS_MESSAGE_FD
+echo "C++ compiler:           $CXX" >&AS_MESSAGE_FD
+echo "C compiler:             $CC" >&AS_MESSAGE_FD
+echo "preprocessor flags:     $CPPFLAGS" >&AS_MESSAGE_FD
+echo "C++ compiler flags:     $CXXFLAGS" >&AS_MESSAGE_FD
+echo "C compiler flags:       $CFLAGS" >&AS_MESSAGE_FD
+echo "linker flags:           $LDFLAGS" >&AS_MESSAGE_FD
+echo "OS specific modules:    $os_deps $os_libs $LIBS" >&AS_MESSAGE_FD
+
+case "$host_os" in
+  mingw*)
+    echo "resource compiler:      $WINDRES" >&AS_MESSAGE_FD
+    echo "message compiler:       $WINDMC" >&AS_MESSAGE_FD
+    echo "NSIS compiler:          $MAKENSIS" >&AS_MESSAGE_FD
+    if test -n "$drivedbdir"; then
+      echo "drive database file:    EXEDIR/drivedb.h" >&AS_MESSAGE_FD
+      if test -n "$MAKENSIS"; then
+        echo "database update tool:   EXEDIR/update-smart-drivedb.exe" >&AS_MESSAGE_FD
+      fi
+    else
+      echo "drive database file:    [[disabled]]" >&AS_MESSAGE_FD
+    fi
+    if test -n "$savestates"; then
+      echo "smartd save files:      `eval eval eval echo $savestates`MODEL-SERIAL.TYPE.state" >&AS_MESSAGE_FD
+    fi
+    if test -n "$attributelog"; then
+      echo "smartd attribute logs:  `eval eval eval echo $attributelog`MODEL-SERIAL.TYPE.csv" >&AS_MESSAGE_FD
+    fi
+    ;;
+
+  *)
+    echo "binary install path:    `eval eval eval echo $sbindir`" >&AS_MESSAGE_FD
+    echo "man page install path:  `eval eval eval echo $mandir`" >&AS_MESSAGE_FD
+    echo "doc file install path:  `eval eval eval echo $docdir`" >&AS_MESSAGE_FD
+    echo "examples install path:  `eval eval eval echo $exampledir`" >&AS_MESSAGE_FD
+    if test -n "$drivedbdir"; then
+      echo "drive database file:    `eval eval eval echo $drivedbdir`/drivedb.h" >&AS_MESSAGE_FD
+      echo "database update script: `eval eval eval echo $sbindir`/update-smart-drivedb" >&AS_MESSAGE_FD
+      echo "download tools:         `eval eval eval echo $os_dltools`" >&AS_MESSAGE_FD
+    else
+      echo "drive database file:    [[disabled]]" >&AS_MESSAGE_FD
+    fi
+    echo "local drive database:   `eval eval eval echo $sysconfdir`/smart_drivedb.h" >&AS_MESSAGE_FD
+    echo "smartd config file:     `eval eval eval echo $sysconfdir`/smartd.conf${smartd_suffix}" >&AS_MESSAGE_FD
+    if test -n "$initddir"; then
+      echo "smartd initd script:    `eval eval eval echo $initddir`/smartd${smartd_suffix}" >&AS_MESSAGE_FD
+    elif test -z "$systemdsystemunitdir"; then
+      echo "smartd initd script:    [[disabled]]" >&AS_MESSAGE_FD
+    fi
+    if test -n "$systemdsystemunitdir"; then
+      echo "smartd systemd file:    `eval eval eval echo $systemdsystemunitdir`/smartd.service" >&AS_MESSAGE_FD
+    fi
+    if test -n "$savestates"; then
+      echo "smartd save files:      `eval eval eval echo $savestates`MODEL-SERIAL.TYPE.state" >&AS_MESSAGE_FD
+    else
+      echo "smartd save files:      [[disabled]]" >&AS_MESSAGE_FD
+    fi
+    if test -n "$attributelog"; then
+      echo "smartd attribute logs:  `eval eval eval echo $attributelog`MODEL-SERIAL.TYPE.csv" >&AS_MESSAGE_FD
+    else
+      echo "smartd attribute logs:  [[disabled]]" >&AS_MESSAGE_FD
+    fi
+    echo "libcap-ng support:      $use_libcap_ng" >&AS_MESSAGE_FD
+    case "$host_os" in
+      linux*) echo "SELinux support:        ${with_selinux-no}" >&AS_MESSAGE_FD ;;
+    esac
+    ;;
+esac
+echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD