]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - configure.in
Imported Upstream version 5.38+svn2993
[mirror_smartmontools-debian.git] / configure.in
index dd9ee6232ca6785a50bef2c92f4b0fb2a9d6973a..9d6186fd5ef9e65abf1f41149093efd05cb70eba 100644 (file)
@@ -1,15 +1,15 @@
 #
-# $Id: configure.in 2870 2009-08-02 20:38:30Z manfred99 $
+# $Id: configure.in 2992 2009-12-04 17:05:21Z chrfranke $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
 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 2870 2009-08-02 20:38:30Z manfred99 $'`
-smartmontools_release_date=2008/03/10
-smartmontools_release_time="10:44:07 GMT"
+smartmontools_configure_date=`date -u +'%Y-%m-%d %T %Z'`
+smartmontools_cvs_tag=`echo '$Id: configure.in 2992 2009-12-04 17:05:21Z chrfranke $'`
+smartmontools_release_date=2009-11-30
+smartmontools_release_time="20:24:12 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])
@@ -34,8 +34,23 @@ AC_CANONICAL_HOST
 dnl Set flags which may affect AC_CHECK_*.
 case "${host}" in
        *-*-mingw*)
-               CPPFLAGS="$CPPFLAGS -mno-cygwin"
-               LDFLAGS="$LDFLAGS -mno-cygwin"
+               # 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 C and C++ compiler 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*)
@@ -227,7 +242,9 @@ case "${host}" in
                fi;;
        *-*-freebsd*|*-*-dragonfly*|*-*-kfreebsd*-gnu*)
                AC_SUBST([os_deps], ['os_freebsd.o cciss.o']) 
-               AC_SUBST([os_libs], ['-lcam']);;
+               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])
@@ -293,8 +310,8 @@ 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
+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
@@ -307,6 +324,21 @@ if test "x$GCC" = "xyes"; then
       # 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 g++ 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
  case "${host}" in