]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - configure.in
Updated changelog
[mirror_smartmontools-debian.git] / configure.in
index 9db5131b1e252d387fc80cf014bd842f88780bff..5c3d352f1b82d37598618a8e3f9a972bf55d655b 100644 (file)
@@ -1,15 +1,15 @@
 #
-# $Id: configure.in 3074 2010-03-05 23:00:30Z chrfranke $
+# $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.40, 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 3074 2010-03-05 23:00:30Z chrfranke $'`
-smartmontools_release_date=2009-12-09
-smartmontools_release_time="21:00:32 UTC"
+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,43 +30,53 @@ 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*)
-               # If building on Cygwin and not cross-compiling add '-mno-cygwin'
-               # to select MinGW gcc. This does no longer work for gcc 4.x.
-               if test "${build}" = "${host}" && test -x /usr/bin/uname && \
-                  /usr/bin/uname | grep -i '^CYGWIN' >/dev/null; then
-                 AC_MSG_CHECKING([whether $CC and $CXX support -mno-cygwin])
-                 gcc_support_m_no_cygwin=no
-                 if $CC  -v -mno-cygwin >/dev/null 2>&1 && \
-                    $CXX -v -mno-cygwin >/dev/null 2>&1; then
-                   gcc_support_m_no_cygwin=yes
-                 fi
-                 AC_MSG_RESULT([$gcc_support_m_no_cygwin])
-                 if test "$gcc_support_m_no_cygwin" != "yes"; then
-                   AC_MSG_ERROR([$CC and $CXX do not support -mno-cygwin, see INSTALL file for details.])
-                 fi
-                 CPPFLAGS="$CPPFLAGS -mno-cygwin"
-                 LDFLAGS="$LDFLAGS -mno-cygwin"
-               fi
-               CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32"
-               ;;
-       *-*-freebsd*)
-               CPPFLAGS="$CPPFLAGS -I/usr/src/sys"
-               ;;
+  *-*-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
 
 # 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])
 
@@ -78,6 +88,10 @@ 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([dev/ata/atavar.h])
@@ -92,27 +106,33 @@ 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 Check for FreeBSD ciss include files...
-AC_CHECK_HEADERS([dev/ciss/cissio.h])
 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_long], , [
-  AC_MSG_NOTICE([smartmontools does no longer support platforms without getopt_long().])
-  AC_MSG_NOTICE([Please inform ${PACKAGE_BUGREPORT},])
-  AC_MSG_NOTICE([including details about your build environment.])
-  AC_MSG_ERROR([function getopt_long() not found])
-])
+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])
@@ -121,33 +141,35 @@ 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))])
+# (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 a { int b; } __attribute__((packed));]])],
-                  [gcc_have_attr_packed=yes], [gcc_have_attr_packed=no])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [[#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-#error "Sun's compiler cannot handle __attribute__((packed))!"
-#endif]])],
-                  [true], [gcc_have_attr_packed=no])
+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])
 
@@ -155,34 +177,86 @@ 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])
+
+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],[Location of init scripts [SYSCONFDIR/rc.d/init.d]])],
-  [initddir="$withval"],[initddir='${sysconfdir}/rc.d/init.d'])
+  [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 "$with_initscriptdir" != "no"])
+AM_CONDITIONAL(INSTALL_INITSCRIPT, [test -n "$initddir"])
+
+# use different init script templates for different OS
+case "${host}" in
+  *-*-freebsd*)
+    initdfile="smartd.freebsd.initd"
+    ;;
+  *)
+    initdfile="smartd.initd"
+    ;;
+esac
+AC_SUBST(initdfile)
 
-docdir_is_default=no
 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}'
-      docdir_is_default=yes
-    elif test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}'; then
-      # autoconf 2.6x '--docdir' default
-      docdir_is_default=yes
     fi
   ])
 AC_SUBST(docdir)
 
-AC_ARG_ENABLE(drivedb, [AC_HELP_STRING([--enable-drivedb],[Enables drive database file])])
+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="$withval"; enable_drivedb=yes],
   [drivedbdir=; test "$enable_drivedb" = "yes" && drivedbdir='${datadir}/${PACKAGE}'])
 AC_SUBST(drivedbdir)
 AM_CONDITIONAL(ENABLE_DRIVEDB, [test "$enable_drivedb" = "yes"])
@@ -209,9 +283,11 @@ 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='.sample'],[smartd_suffix=''])
+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]])],
@@ -223,20 +299,21 @@ AC_ARG_WITH(os-deps,
     done
   ],[])
 
-AC_ARG_WITH(selinux,[AC_HELP_STRING([--with-selinux],[Enables SELinux support])],
-       [
-               AC_CHECK_HEADERS([selinux/selinux.h], [], [echo "*** Error: Missing SELinux header files";exit 1])
-               AC_CHECK_LIB(selinux, matchpathcon, [with_selinux=yes], [echo "*** Error: Missing or incorrect SELinux library files"; exit 1],)
-       ],[])
+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])
+  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="$withval"],
-  [with_libcap_ng=auto])
+  [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
@@ -267,69 +344,85 @@ AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
 AC_SUBST(smartmontools_release_date)
 AC_SUBST(smartmontools_release_time)
 
-AC_MSG_CHECKING([for OS dependent modules and libraries])
-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*)
-               AC_SUBST([os_deps], ['os_linux.o cciss.o']) 
-               if test "$with_selinux" = "yes"; then
-                       AC_SUBST([os_libs], ['-lselinux'])
-               else
-                       AC_SUBST([os_libs], [''])
-               fi;;
-       *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
-               AC_SUBST([os_deps], ['os_freebsd.o cciss.o']) 
-               AC_SUBST([os_libs], ['-lcam'])
-               AC_CHECK_LIB(usb, libusb20_dev_get_device_desc)
-               ;;
-       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], [''])
-               test "$host_cpu" = "x86_64" && os_win64=yes ;;
-       *-*-darwin*)
-               AC_SUBST([os_deps], ['os_darwin.o'])
-               AC_SUBST([os_libs], ['-framework CoreFoundation -framework IOKit']) ;;
-       *-*-nto-qnx*)
-               AC_SUBST([os_deps], ['os_qnxnto.o'])
-               AC_SUBST([os_libs], ['']) ;;
-               
-       *)
-               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
 
 # Replace if '--with-os-deps' was specified
 test -z "$with_os_deps" || os_deps="$with_os_deps"
-AC_MSG_RESULT([$os_deps $os_libs])
-
-# 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
 
 # Check if we need adapter to old interface (dev_legacy.cpp)
 os_src=`echo "${os_deps}"|sed -n 's,^\([[^ .]]*\)\.o.*$,\1.cpp,p'`
@@ -343,12 +436,30 @@ else
 fi
 AC_MSG_RESULT([$os_new_interface])
 
-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])
+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
+
+# 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"])
-AM_CONDITIONAL(OS_FREEBSD, [echo $host_os | grep '^freebsd' > /dev/null])
 
 dnl Add -Wall and -W if using g++ and its not already specified.
 if test "$GXX" = "yes"; then
@@ -359,25 +470,6 @@ if test "$GXX" = "yes"; 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
-
-  # Disable strict aliasing rules by default (see ticket #23).
-  if test -z "`echo "$CXXFLAGS" | grep "\-f[[no-]]*strict-aliasing" 2> /dev/null`" ; then
-    AC_MSG_CHECKING([whether $CXX supports -fno-strict-aliasing])
-    ac_save_CXXFLAGS="$CXXFLAGS"
-    CXXFLAGS="-fno-strict-aliasing"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
-      [gcc_have_fno_strict_aliasing=yes], [gcc_have_fno_strict_aliasing=no])
-    CXXFLAGS="$ac_save_CXXFLAGS"
-    if test "$gcc_have_fno_strict_aliasing" = "yes"; then
-      CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
-    fi
-    AC_MSG_RESULT([$gcc_have_fno_strict_aliasing])
-  fi
 
 else
  dnl We are NOT using gcc, so enable host-specific compiler flags
@@ -406,18 +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
 
-# Print note that the docdir default value has changed
-# TODO: Remove this after next release
-if test "$docdir_is_default" = "yes"; then
-  old_def_docdir='${prefix}/share/doc/${PACKAGE}-${VERSION}'
-  old_def_docdir_eval="`eval eval eval echo $old_def_docdir`"
-  docdir_eval="`eval eval eval echo $docdir`"
-  AC_MSG_NOTICE([********** PLEASE NOTE **********])
-  AC_MSG_NOTICE(['docdir' default has changed])
-  AC_MSG_NOTICE([from: $old_def_docdir_eval])
-  AC_MSG_NOTICE([to:   $docdir_eval])
-  AC_MSG_NOTICE([*********************************])
-fi
+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