]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - configure.in
Imported Upstream version 5.38+svn2879
[mirror_smartmontools-debian.git] / configure.in
index 60caaf1067171beef5379c9e709932b243a79f66..dd9ee6232ca6785a50bef2c92f4b0fb2a9d6973a 100644 (file)
@@ -1,13 +1,13 @@
 #
-# $Id: configure.in,v 1.135 2008/03/10 10:44:30 ballen4705 Exp $
+# $Id: configure.in 2870 2009-08-02 20:38:30Z manfred99 $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
-AC_INIT(smartmontools, 5.38, smartmontools-support@lists.sourceforge.net)
+AC_INIT(smartmontools, 5.39, 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.135 2008/03/10 10:44:30 ballen4705 Exp $'`
+smartmontools_cvs_tag=`echo '$Id: configure.in 2870 2009-08-02 20:38:30Z manfred99 $'`
 smartmontools_release_date=2008/03/10
 smartmontools_release_time="10:44:07 GMT"
 
@@ -43,14 +43,28 @@ case "${host}" in
                ;;
 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
+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
+  fi
+fi
+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)
 
 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.
@@ -78,10 +92,16 @@ 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], , [
+  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([getdomainname])
 AC_CHECK_FUNCS([gethostname])
+AC_CHECK_FUNCS([getaddrinfo])
 AC_CHECK_FUNCS([gethostbyname])
 AC_CHECK_FUNCS([sigset])
 AC_CHECK_FUNCS([strtoull])
@@ -124,14 +144,66 @@ AC_SUBST([exampledir], ['${docdir}/examplescripts'])
 
 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'])
 AC_SUBST(initddir)
+AM_CONDITIONAL(INSTALL_INITSCRIPT, [test "$with_initscriptdir" != "no"])
 
 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}'])
 AC_SUBST(docdir)
 
+AC_ARG_ENABLE(drivedb, [AC_HELP_STRING([--enable-drivedb],[Enables drive database file])])
+
+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='.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],[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_SUBST(with_selinux)
+if test "$with_selinux" = "yes"; then
+       AC_DEFINE(WITH_SELINUX, [1], [Define to 1 if SELinux support is enabled])
+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
@@ -143,11 +215,16 @@ 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
 case "${host}" in
        *-*-linux*)
                AC_SUBST([os_deps], ['os_linux.o cciss.o']) 
-               AC_SUBST([os_libs], ['']) ;;
+               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']);;
@@ -184,6 +261,10 @@ case "${host}" in
                AC_SUBST([os_libs], ['']) ;;
 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*)
@@ -194,10 +275,23 @@ case "${os_deps}" in
     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'`
+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])
+
 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])
+AM_CONDITIONAL(OS_FREEBSD, [echo $host_os | grep '^freebsd' > /dev/null])
 
 dnl Add -Wall and -W if using gcc and its not already specified.
 if test "x$GCC" = "xyes"; then
@@ -230,9 +324,8 @@ else
             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