#
-# $Id: configure.in 3296 2011-03-16 22:17:51Z 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.41, 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 3296 2011-03-16 22:17:51Z chrfranke $'`
-smartmontools_release_date=2010-10-16
-smartmontools_release_time="16:34:38 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])
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
AM_MAINTAINER_MODE
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*)
# Cygwin gcc 4.x does no longer support '-mno-cygwin' to select MinGW gcc.
fi
fi
AC_MSG_RESULT([${MAKENSIS:-no}])
-
- CPPFLAGS="$CPPFLAGS -I$srcdir/os_win32"
- ;;
- *-*-freebsd*)
- CPPFLAGS="$CPPFLAGS -I/usr/src/sys"
;;
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])
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])
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
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
AC_MSG_RESULT([$libc_have_working_snprintf])
# check for __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, 1, [Define to 1 if C++ compiler supports __attribute__((packed))])
AC_SUBST(LDFLAGS)
AC_SUBST(ASFLAGS)
+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)
AC_ARG_WITH(docdir,
[AC_HELP_STRING([--with-docdir=DIR],[Location of documentation [DATADIR/doc/smartmontools]])],
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])
+ [], [with_libcap_ng=auto])
use_libcap_ng=no
if test "$with_libcap_ng" != "no"; then
os_win32=no
os_win32_mingw=no
os_win64=no
+os_man_filter=
case "${host}" in
*-*-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'
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
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
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
- echo "smartd initd script: `eval eval eval echo $initddir`/smartd${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