changeset 10123:8590f3c51868

Fix a few MSVC-related problems and partially re-enable MSVC compilation.
author Michael Goffioul <michael.goffioul@gmail.com>
date Sun, 17 Jan 2010 20:32:38 +0000
parents 9d1a14e12431
children e5c6600e3400
files ChangeLog bootstrap.conf configure.ac liboctave/ChangeLog liboctave/oct-time.cc
diffstat 5 files changed, 97 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jan 17 13:31:42 2010 +0100
+++ b/ChangeLog	Sun Jan 17 20:32:38 2010 +0000
@@ -1,3 +1,9 @@
+2010-01-17  Michael Goffioul <michael.goffioul@gmail.com>
+
+	* bootstrap.conf: Add round module.
+	* configure.ac: Allow to use MSVC with *mingw* build host. Check for
+	opendir in -ldirent. Add -ladvapi32 to LIBS.
+
 2010-01-15  John W. Eaton  <jwe@octave.org>
 
 	* NEWS: Edit.
--- a/bootstrap.conf	Sun Jan 17 13:31:42 2010 +0100
+++ b/bootstrap.conf	Sun Jan 17 20:32:38 2010 +0000
@@ -28,6 +28,7 @@
   stat
   strftime
   times
+  round
 "
 
 # Additional xgettext options to use.  Use "\\\newline" to break lines.
--- a/configure.ac	Sun Jan 17 13:31:42 2010 +0100
+++ b/configure.ac	Sun Jan 17 20:32:38 2010 +0000
@@ -74,6 +74,22 @@
 
 AC_USE_SYSTEM_EXTENSIONS
 
+### Check for MSVC
+have_msvc=no
+case "$canonical_host_type" in
+  *-*-msdosmsvc)
+    have_msvc=yes
+  ;;
+  *-*-mingw*)
+    AC_MSG_CHECKING([for MSVC compiler])
+    AC_PREPROC_IFELSE([
+#ifndef _MSC_VER
+#error "Not MSVC compiler"
+#endif], have_msvc=yes, have_msvc=no)
+    AC_MSG_RESULT([$have_msvc])
+  ;;
+esac
+
 ### Path separator.
 sepchar=:
 AC_ARG_WITH(sepchar,
@@ -280,6 +296,11 @@
     ;;
     *-*-msdosmsvc)
     ;;
+    *-*-mingw*)
+      if test "$have_msvc" = "no"; then
+	INCLUDE_DEPS=false
+      fi
+    ;;
     *)
       INCLUDE_DEPS=false
     ;;
@@ -349,10 +370,6 @@
 case "$canonical_host_type" in
   ## Keep this pattern first, so that it is preferred over the
   ## following pattern for x86.
-  *-*-msdosmsvc)
-    CXXFLAGS="$CXXFLAGS -EHs -MD"
-    CFLAGS="$CFLAGS -MD"
-  ;;
   i[[3456789]]86-*-*)
     if test "$GCC" = yes; then
       OCTAVE_CC_FLAG(-mieee-fp, [
@@ -660,11 +677,9 @@
    OCTAVE_HDF5_HAS_ENFORCED_16_API
    TEXINFO_HDF5="@set HAVE_HDF5"
    AC_DEFINE(HAVE_HDF5, 1, [Define if HDF5 is available and newer than version 1.6.])
-   case "$canonical_host_type" in
-     *-*-msdosmsvc)
-       OCTAVE_HDF5_DLL
-       ;;
-   esac
+   if test "$have_msvc" = "yes"; then
+     OCTAVE_HDF5_DLL
+   fi
    ])
 CPPFLAGS="$save_CPPFLAGS"
 LIBS="$save_LIBS"
@@ -880,12 +895,10 @@
 fi
 
 XTRA_CRUFT_SH_LDFLAGS=
-case "$canonical_host_type" in
-  *-*-msdosmsvc)
-    FLIBS="$FLIBS -lkernel32"
-    XTRA_CRUFT_SH_LDFLAGS="-Wl,-def:cruft.def"
-  ;;
-esac
+if test "$have_msvc" = "yes"; then
+  FLIBS="$FLIBS -lkernel32"
+  XTRA_CRUFT_SH_LDFLAGS="-Wl,-def:cruft.def"
+fi
 AC_SUBST(XTRA_CRUFT_SH_LDFLAGS)
 
 ### Checks for BLAS and LAPACK libraries:
@@ -1138,17 +1151,45 @@
     ldpreloadsep=":"
   ;;
   *-*-mingw*)
-    CPICFLAG=
-    CXXPICFLAG=
-    FPICFLAG=
-    SHLEXT=dll
-    SHLLIB=dll.a
-    SHLBIN=dll
-    DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
-    SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
-    SONAME_FLAGS='-Wl,--out-implib=$@.a'
-    library_path_var=PATH
-    SCRIPTS_EXE_SUFFIX='$(EXEEXT)'
+    if test "$have_msvc" = "yes"; then
+      DL_LDFLAGS="-shared"
+      CPICFLAG=
+      CXXPICFLAG=
+      FPICFLAG=
+      SHLEXT=dll
+      SHLLIB=lib
+      SHLBIN=dll
+      LIBPRE=
+      SHLPRE=
+      SHLLIBPRE=
+      SHLBINPRE=
+      SH_LDFLAGS="-shared"
+      if test -n "`echo $CFLAGS | grep -e '-g'`" -o -n "`echo $CXXFLAGS | grep -e '-g'`"; then
+        DL_LDFLAGS="$DL_LDFLAGS -g"
+        SH_LDFLAGS="$SH_LDFLAGS -g"
+      fi
+      NO_OCT_FILE_STRIP=true
+      library_path_var=PATH
+      NO_OCT_FILE_STRIP=true
+      ## Extra compilation flags.
+      CRUFT_DLL_DEFS="-DCRUFT_DLL"
+      OCTAVE_DLL_DEFS="-DOCTAVE_DLL"
+      OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL"
+      OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL"
+      SCRIPTS_EXE_SUFFIX='$(EXEEXT)'
+    else
+      CPICFLAG=
+      CXXPICFLAG=
+      FPICFLAG=
+      SHLEXT=dll
+      SHLLIB=dll.a
+      SHLBIN=dll
+      DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
+      SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
+      SONAME_FLAGS='-Wl,--out-implib=$@.a'
+      library_path_var=PATH
+      SCRIPTS_EXE_SUFFIX='$(EXEEXT)'
+    fi
   ;;
 
   *-*-msdosmsvc)
@@ -1164,7 +1205,7 @@
     SHLLIBPRE=
     SHLBINPRE=
     SH_LDFLAGS="-shared"
-      if test -n "`echo $CFLAGS | grep -e '-g'`" -o -n "`echo $CXXFLAGS | grep -e '-g'`"; then
+    if test -n "`echo $CFLAGS | grep -e '-g'`" -o -n "`echo $CXXFLAGS | grep -e '-g'`"; then
       DL_LDFLAGS="$DL_LDFLAGS -g"
       SH_LDFLAGS="$SH_LDFLAGS -g"
     fi
@@ -1342,10 +1383,23 @@
    AC_CHECK_LIB(wsock32, gethostname)
    LIBS="$LIBS -lwsock32"
   ;;
-  *-*-msdosmsvc* | *-*-mingw*)
+  *-*-mingw*)
+    if test "$have_msvc" = "yes"; then
+      AC_CHECK_LIB(dirent, opendir)
+      LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
+      NO_UNDEFINED_LDFLAG=-no-undefined
+    else
+      LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
+      NO_UNDEFINED_LDFLAG=-no-undefined
+    fi
     LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
     NO_UNDEFINED_LDFLAG=-no-undefined
   ;;
+  *-*-msdosmsvc*)
+    AC_CHECK_LIB(dirent, opendir)
+    LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
+    NO_UNDEFINED_LDFLAG=-no-undefined
+  ;;
 esac
 AC_SUBST(NO_UNDEFINED_LDFLAG)
 
--- a/liboctave/ChangeLog	Sun Jan 17 13:31:42 2010 +0100
+++ b/liboctave/ChangeLog	Sun Jan 17 20:32:38 2010 +0000
@@ -1,3 +1,9 @@
+2010-01-16  Michael Goffioul  <michael.goffioul@gmail.com>
+
+	* oct-time.cc: Avoid to include nonneeded headers from Win32 API,
+	especially winsock.h. Include <sys/time.h> unconditionally, as it is
+	now provided by gnulib, in order to get gettimeofday defined.
+
 2010-01-15  Jaroslav Hajek  <highegg@gmail.com>
 
 	* Array.cc (Array<T>::insert): Rewrite using assign.
--- a/liboctave/oct-time.cc	Sun Jan 17 13:31:42 2010 +0100
+++ b/liboctave/oct-time.cc	Sun Jan 17 20:32:38 2010 +0000
@@ -35,11 +35,13 @@
 #endif
 
 #if defined (OCTAVE_USE_WINDOWS_API)
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #undef min
 #undef max
 #endif
 
+#include <sys/time.h>
 #include "strftime.h"
 
 #include "lo-error.h"