From 3e3ee383691d9dac75a7f9068708a3b3adf18e5c Mon Sep 17 00:00:00 2001 From: chrfranke <chrfranke@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Fri, 2 Oct 2009 20:45:54 +0000 Subject: [PATCH] Windows: Check support of gcc '-mno-cygwin' option in configure. Update INSTALL instructions accordingly. git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2925 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- smartmontools/CHANGELOG | 4 ++++ smartmontools/INSTALL | 22 +++++++++++++++++++--- smartmontools/configure.in | 14 ++++++++++++-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/smartmontools/CHANGELOG b/smartmontools/CHANGELOG index ce320f883..3a4d66545 100644 --- a/smartmontools/CHANGELOG +++ b/smartmontools/CHANGELOG @@ -43,6 +43,10 @@ NOTES FOR FUTURE RELEASES: see TODO file. <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE> + [CF] Windows: Check support of gcc '-mno-cygwin' option in configure. + This option has been removed in Cygwin gcc 4.x. Update INSTALL + instructions accordingly. + [CF] Increase SCSI_TIMEOUT_DEFAULT from 6 to 20 seconds to avoid timeouts when a disk spins up from standby mode. diff --git a/smartmontools/INSTALL b/smartmontools/INSTALL index d3f5fae91..7628be6d2 100644 --- a/smartmontools/INSTALL +++ b/smartmontools/INSTALL @@ -434,16 +434,32 @@ Same as Red Hat: instead. This is not necessary for the generated ./configure script. [10] Guidelines for Windows -========================== +=========================== -To compile the Windows release with MinGW, use the following on Cygwin: +To compile the Windows release with MinGW gcc on MSYS, use: - ./configure --build=mingw32 + ./configure make Instead of using "make install", copy the .exe files into some directory in the PATH. +To compile with MinGW gcc 3.x on Cygwin, use: + + ./configure --build=i686-pc-mingw32 + + The above does not work if gcc 4.x is installed and selected as + default by /usr/sbin/alternatives. If the configure command aborts + with error message '... does not support -mno-cygwin', select + gcc 3.x by: + + CC=gcc-3 CXX=g++-3 ./configure --build=i686-pc-mingw32 + + Alternatively, a MinGW-targeted cross-compiler can be used if available: + + ./configure --build=i686-pc-cygwin --host=i686-pc-mingw32 + + To build the Windows binary distribution, use: make dist-win32 diff --git a/smartmontools/configure.in b/smartmontools/configure.in index 990ba2078..8154ae6f4 100644 --- a/smartmontools/configure.in +++ b/smartmontools/configure.in @@ -34,8 +34,18 @@ 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 + if $CC -v -mno-cygwin >/dev/null 2>&1 && \ + $CXX -v -mno-cygwin >/dev/null 2>&1; then + CPPFLAGS="$CPPFLAGS -mno-cygwin" + LDFLAGS="$LDFLAGS -mno-cygwin" + else + AC_MSG_ERROR([$CC and $CXX do not support -mno-cygwin, see INSTALL file for details.]) + fi + fi CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32" ;; *-*-freebsd*) -- GitLab