]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - configure.ac
Change second dh_systemd_enable to _start
[mirror_smartmontools-debian.git] / configure.ac
index e7f083f27b2e12c6c28134b47bebc287158e862c..1eb6d8d40dada11fbc6fbb321d48db93b65e5a09 100644 (file)
@@ -1,25 +1,24 @@
 #
-# $Id: configure.ac 3977 2014-07-26 11:03:24Z chrfranke $
+# $Id: configure.ac 4181 2015-12-07 20:58:40Z chrfranke $
 #
 dnl Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.50)
-AC_INIT(smartmontools, 6.4, smartmontools-support@lists.sourceforge.net)
-AC_CONFIG_SRCDIR(smartctl.cpp)
+AC_PREREQ([2.60])
+AC_INIT(smartmontools, 6.5, smartmontools-support@lists.sourceforge.net)
+AM_INIT_AUTOMAKE([1.10 foreign])
 
-smartmontools_cvs_tag=`echo '$Id: configure.ac 3977 2014-07-26 11:03:24Z chrfranke $'`
-smartmontools_release_date=2014-07-26
-smartmontools_release_time="09:49:11 UTC"
+smartmontools_cvs_tag=`echo '$Id: configure.ac 4181 2015-12-07 20:58:40Z chrfranke $'`
+smartmontools_release_date=2015-06-04
+smartmontools_release_time="16:29:41 UTC"
 
 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_CONFIGURE_ARGS, "$ac_configure_args",            [smartmontools Configure Arguments])
 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_DATE,   "$smartmontools_release_date",   [smartmontools Release Date])
 AC_DEFINE_UNQUOTED(SMARTMONTOOLS_RELEASE_TIME,   "$smartmontools_release_time",   [smartmontools Release Time])
 AC_DEFINE_UNQUOTED(CONFIG_H_CVSID,               "$smartmontools_cvs_tag",        [smartmontools CVS Tag])
-AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE,             "http://smartmontools.sourceforge.net/", [smartmontools Home Page])
+AC_DEFINE_UNQUOTED(PACKAGE_HOMEPAGE,             "http://www.smartmontools.org/", [smartmontools Home Page])
 
+AC_CONFIG_SRCDIR([smartctl.cpp])
 AC_CONFIG_HEADER([config.h])
 
-AM_INIT_AUTOMAKE([foreign])
-
 AM_MAINTAINER_MODE
 
 AC_LANG([C++])
@@ -149,16 +148,9 @@ AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
 AC_SUBST(ASFLAGS)
 
-AC_ARG_WITH(systemdenvfile,
-  [AS_HELP_STRING([--with-systemdenvfile=@<:@FILE|no@:>@],
-    [Path of systemd EnvironmentFile (implies --with-systemdsystemunitdir=yes) [SYSCONFDIR/sysconfig/smartmontools]])],
-  [systemdenvfile=; test "$withval" != "no" && systemdenvfile="$withval"; systemd_default=yes],
-  [systemdenvfile='${sysconfdir}/sysconfig/smartmontools'; systemd_default=auto])
-AC_SUBST(systemdenvfile)
-
 AC_ARG_WITH(systemdsystemunitdir,
   [AS_HELP_STRING([--with-systemdsystemunitdir@<:@=DIR|auto|yes|no@:>@], [Location of systemd service files [auto]])],
-  [], [with_systemdsystemunitdir=$systemd_default])
+  [], [with_systemdsystemunitdir=auto])
 
 systemdsystemunitdir=
 case "$with_systemdsystemunitdir" in
@@ -179,6 +171,30 @@ esac
 AC_SUBST(systemdsystemunitdir)
 AM_CONDITIONAL(INSTALL_SYSTEMDUNIT, [test -n "$systemdsystemunitdir"])
 
+AC_ARG_WITH(systemdenvfile,
+  [AS_HELP_STRING([--with-systemdenvfile@<:@=FILE|auto|yes|no@:>@], [Path of systemd EnvironmentFile [auto]])],
+  [], [with_systemdenvfile=auto])
+
+systemdenvfile=
+case "$with_systemdenvfile:$cross_compiling:$systemdsystemunitdir" in
+  auto:no:?*|yes:*:?*)
+    AC_MSG_CHECKING([for path of systemd EnvironmentFile])
+    for dir in sysconfig default; do
+      if test -d /etc/$dir; then
+        systemdenvfile='${sysconfdir}'/$dir/smartmontools
+        break
+      fi
+    done
+    AC_MSG_RESULT([${systemdenvfile:-no}])
+    case "$with_systemdenvfile:$systemdenvfile" in
+      yes:) AC_MSG_ERROR([Path of systemd EnvironmentFile not found]) ;;
+    esac ;;
+  auto:*|no:*) ;;
+  *:*:) AC_MSG_ERROR([Location of systemd service files not found]) ;;
+  *) systemdenvfile="$with_systemdenvfile"
+esac
+AC_SUBST(systemdenvfile)
+
 AC_ARG_WITH(initscriptdir,
   [AS_HELP_STRING([--with-initscriptdir@<:@=DIR|auto|yes|no@:>@], [Location of init scripts [auto]])],
   [], [with_initscriptdir=auto])
@@ -214,31 +230,17 @@ case "${host}" in
 esac
 AC_SUBST(initdfile)
 
-AC_ARG_WITH(docdir,
-  [AS_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_WITH(exampledir,
   [AS_HELP_STRING([--with-exampledir=DIR], [Location of example scripts [DOCDIR/examplescripts]])],
   [exampledir="$withval"], [exampledir='${docdir}/examplescripts'])
 AC_SUBST(exampledir)
 
-AC_ARG_ENABLE(drivedb,
-  [AS_HELP_STRING([--disable-drivedb], [Disables drive database file])],
-  [], [enable_drivedb=yes])
-
+drivedbdir='${datadir}/${PACKAGE}'
 AC_ARG_WITH(drivedbdir,
-  [AS_HELP_STRING([--with-drivedbdir=DIR], [Location of drive database file [DATADIR/smartmontools]])],
-  [drivedbdir="$withval"; enable_drivedb=yes],
-  [drivedbdir=; test "$enable_drivedb" = "yes" && drivedbdir='${datadir}/${PACKAGE}'])
+  [AS_HELP_STRING([--with-drivedbdir@<:@=DIR|yes|no@:>@], [Location of drive database file [DATADIR/smartmontools]])],
+  [case "$withval" in yes) ;; no) drivedbdir= ;; *) drivedbdir="$withval" ;; esac])
 AC_SUBST(drivedbdir)
-AM_CONDITIONAL(ENABLE_DRIVEDB, [test "$enable_drivedb" = "yes"])
+AM_CONDITIONAL(ENABLE_DRIVEDB, [test -n "$drivedbdir"])
 
 AC_ARG_WITH(smartdscriptdir,
   [AS_HELP_STRING([--with-smartdscriptdir=DIR], [Location of smartd_warning.sh script [SYSCONFDIR]])],
@@ -252,29 +254,27 @@ AC_ARG_WITH(smartdplugindir,
   [smartdplugindir='${smartdscriptdir}/smartd_warning.d'])
 AC_SUBST(smartdplugindir)
 
-AC_ARG_ENABLE(savestates, [AS_HELP_STRING([--enable-savestates], [Enables default smartd state files])])
-
+savestates=
 AC_ARG_WITH(savestates,
-  [AS_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.'])
+  [AS_HELP_STRING([--with-savestates@<:@=PREFIX|yes|no@:>@],
+    [Enable default smartd state files [no] (yes=LOCALSTATEDIR/lib/smartmontools/smartd.)])],
+  [case "$withval" in yes) savestates='${localstatedir}/lib/${PACKAGE}/smartd.' ;;
+                      no) ;; *) savestates="$withval" ;; esac])
 savestatesdir="${savestates%/*}"
 AC_SUBST(savestates)
 AC_SUBST(savestatesdir)
-AM_CONDITIONAL(ENABLE_SAVESTATES, [test "$enable_savestates" = "yes"])
-
-AC_ARG_ENABLE(attributelog, [AS_HELP_STRING([--enable-attributelog], [Enables default smartd attribute log files])])
+AM_CONDITIONAL(ENABLE_SAVESTATES, [test -n "$savestates"])
 
+attributelog=
 AC_ARG_WITH(attributelog,
-  [AS_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.'])
+  [AS_HELP_STRING([--with-attributelog@<:@=PREFIX|yes|no@:>@],
+    [Enable default smartd attribute log files [no] (yes=LOCALSTATEDIR/lib/smartmontools/attrlog.)])],
+  [case "$withval" in yes) attributelog='${localstatedir}/lib/${PACKAGE}/attrlog.' ;;
+                      no) ;; *) attributelog="$withval" ;; esac])
 attributelogdir="${attributelog%/*}"
 AC_SUBST(attributelog)
 AC_SUBST(attributelogdir)
-AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test "$enable_attributelog" = "yes"])
+AM_CONDITIONAL(ENABLE_ATTRIBUTELOG, [test -n "$attributelog"])
 
 AC_ARG_ENABLE(sample,
   [AS_HELP_STRING([--enable-sample], [Enables appending .sample to the installed smartd rc script and configuration file])],
@@ -311,7 +311,7 @@ AC_ARG_WITH(libcap-ng,
 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).])
+    [AC_DEFINE(HAVE_LIBCAP_NG, 1, [Define to 1 if you have the `cap-ng' library (-lcap-ng).]) dnl `vim syntax
      CAPNG_LDADD="-lcap-ng"; use_libcap_ng=yes])
 
   if test "$use_libcap_ng" = "yes"; then
@@ -323,9 +323,23 @@ 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])
 
+AC_ARG_WITH(solaris-sparc-ata,
+  [AS_HELP_STRING([--with-solaris-sparc-ata@<:@=yes|no@:>@],
+    [Enable legacy ATA support on Solaris SPARC (requires os_solaris_ata.s from SVN repository) [no]])])
+
+case "$host:$with_solaris_sparc_ata" in
+  sparc-*-solaris*:yes)
+    if test ! -f "$srcdir/os_solaris_ata.s"; then
+      AC_MSG_ERROR([Missing source file: $srcdir/os_solaris_ata.s
+This file is no longer included in the source tarball but still
+available in the SVN repository.])
+    fi
+    AC_DEFINE(WITH_SOLARIS_SPARC_ATA, 1, [Define to 1 to enable legacy ATA support on Solaris SPARC.])
+    ;;
+esac
+
 # Assume broken snprintf only on Windows with MSVCRT (MinGW without ANSI stdio support)
 libc_have_working_snprintf=yes
 
@@ -357,23 +371,52 @@ AC_ARG_WITH(working-snprintf,
   [libc_have_working_snprintf=$withval])
 
 if test "$libc_have_working_snprintf" = "yes"; then
-  AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane])
+  AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if the `snprintf' function is sane.]) dnl `vim syntax
 fi
 
-if test "$prefix" = "NONE"; then
-    dnl no prefix and no mandir, so use ${prefix}/share/man as default
-    if test "$mandir" = '${prefix}/man'; then
-       AC_SUBST([mandir], ['${prefix}/share/man'])
-    fi
+os_win32_manifest=
+case "$host" in
+  *-*-mingw*)
+    # Newer MinGW may add a default manifest
+    AC_MSG_CHECKING([whether $CC adds an application manifest])
+    cc_adds_manifest=no
+    AC_LINK_IFELSE([AC_LANG_PROGRAM()], [
+        if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '^1.*RT_MANIFEST' >/dev/null 2>&1; then
+          cc_adds_manifest=incomplete
+          # Manifest must provide a Win 10 compatibility ID
+          if "$WINDRES" -O rc conftest.exe 2>/dev/null | grep '{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}' >/dev/null 2>&1; then
+            cc_adds_manifest=yes
+          fi
+        fi],
+      [AC_MSG_ERROR([test compile failed])])
+    AC_MSG_RESULT([$cc_adds_manifest])
+    test "$cc_adds_manifest" = "yes" || os_win32_manifest='default.manifest.o'
+    ;;
+esac
+
+# TODO: Remove after smartmontools 6.5
+AC_ARG_WITH(docdir,
+  [AS_HELP_STRING([--with-docdir=DIR], [(removed, use --docdir=DIR instead)])],
+  [AC_MSG_ERROR([--with-docdir is no longer supported, use --docdir instead])])
+AC_ARG_ENABLE(drivedb,
+  [AS_HELP_STRING([--disable-drivedb], [(removed, use --without-drivedbdir instead)])])
+AC_ARG_ENABLE(savestates,
+  [AS_HELP_STRING([--enable-savestates], [(removed, use --with-savestates@<:@=yes@:>@ instead)])])
+AC_ARG_ENABLE(attributelog,
+  [AS_HELP_STRING([--enable-attributelog], [(removed, use --with-attributelog@<:@=yes@:>@ instead)])])
+if test -n "${enable_drivedb+set}${enable_savestates+set}${enable_attributelog+set}"; then
+  AC_MSG_ERROR([Options --disable-drivedb, --enable-savestates, --enable-attributelog are no longer supported.
+Use --without-drivedbdir, --with-savestates, --with-attributelog instead.])
 fi
 
+
 AC_SUBST(releaseversion,['${PACKAGE}-${VERSION}'])
 AC_SUBST(smartmontools_release_date)
 AC_SUBST(smartmontools_release_time)
 
 # Set platform-specific modules and symbols
 os_libs=
-os_dltools='curl wget lynx'
+os_dltools='curl wget lynx svn'
 os_mailer=mail
 os_hostname="'hostname'"
 os_dnsdomainname=
@@ -394,12 +437,14 @@ case "${host}" in
   *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
     os_deps='os_freebsd.o cciss.o dev_areca.o'
     os_libs='-lcam'
-    os_dltools='curl wget lynx fetch'
+    os_dltools='curl wget lynx fetch svn'
     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_deps='os_solaris.o'
+    test "$with_solaris_sparc_ata" = "yes" \
+      && os_deps="$os_deps os_solaris_ata.o"
     os_mailer='mailx'
     os_solaris=yes
     os_man_filter=Solaris
@@ -418,7 +463,7 @@ case "${host}" in
   *-*-openbsd*)
     os_deps='os_openbsd.o'
     os_libs='-lutil'
-    os_dltools='curl wget lynx ftp'
+    os_dltools='curl wget lynx ftp svn'
     os_man_filter=OpenBSD
     ;;
   *-*-cygwin*)
@@ -480,6 +525,7 @@ AC_SUBST([os_hostname])
 AC_SUBST([os_dnsdomainname])
 AC_SUBST([os_nisdomainname])
 AC_SUBST([os_man_filter])
+AC_SUBST([os_win32_manifest])
 
 # 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,' \
@@ -551,6 +597,7 @@ echo "OS specific modules:    $os_deps $os_libs $LIBS" >&AS_MESSAGE_FD
 
 case "$host_os" in
   mingw*)
+    echo "application manifest:   ${os_win32_manifest:-built-in}" >&AS_MESSAGE_FD
     echo "resource compiler:      $WINDRES" >&AS_MESSAGE_FD
     echo "message compiler:       $WINDMC" >&AS_MESSAGE_FD
     echo "NSIS compiler:          $MAKENSIS" >&AS_MESSAGE_FD
@@ -620,3 +667,15 @@ case "$host_os" in
     ;;
 esac
 echo "-----------------------------------------------------------------------------" >&AS_MESSAGE_FD
+
+# TODO: Remove after smartmontools 6.5
+case "$host:${with_solaris_sparc_ata+set}" in
+  sparc-*-solaris*:)
+    AC_MSG_WARN([
+Legacy ATA support is no longer enabled by default on Solaris SPARC.
+The required source file 'os_solaris_ata.s' is no longer included in
+the source tarball but still available in the SVN repository.
+Use option '--with-solaris-sparc-ata' to enable legacy ATA support.
+Use option '--without-solaris-sparc-ata' to suppress this warning.])
+    ;;
+esac