changeset 3144:433d1bb3cafb

[MSVC] enable octave compilation
author Michael Goffioul <michael.goffioul@gmail.com>
date Mon, 15 Jul 2013 21:29:42 -0400
parents a2afd94e919f
children fae248a5b181
files src/build-msvctools/lt-postproc src/msvc-octave-1.patch src/octave.mk
diffstat 3 files changed, 538 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/build-msvctools/lt-postproc	Mon Jul 15 21:29:42 2013 -0400
+++ b/src/build-msvctools/lt-postproc	Mon Jul 15 21:29:42 2013 -0400
@@ -2,11 +2,13 @@
 
 prefix=
 suffix=
+no_auto_export=false
 
-while getopts ":p:s:" opt; do
+while getopts ":p:s:x" opt; do
 	case $opt in
 		s) suffix="$OPTARG" ;;
 		p) prefix="$OPTARG" ;;
+		x) no_auto_export=true ;;
 	esac
 done
 shift $((OPTIND-1))
@@ -17,11 +19,18 @@
 	libtool_files="$@"
 fi
 
+SED_ARGS=
+if $no_auto_export; then
+	SED_ARGS="$SED_ARGS -e 's/^always_export_symbols=.*/always_export_symbols=/'"
+fi
+
 for ltfile in $libtool_files; do
 	sed -i \
 		-e "s/^soname_spec=\"\\(.*\\)\\\${shared_ext}\"/soname_spec=\"$prefix\\1$suffix\\\${shared_ext}\"/" \
 		-e "s/\.dll\.lib/\.lib/" \
 		-e "s/^\(deplibs_check_method\)=.*/\1=\"pass_all\"/" \
 		-e "s/-link\\>//" \
+		-e "/^archive_cmds=/ { s/-Wl,-dll~/&,-IMPLIB:\\\\\\\"\\\$tool_output_objdir\\\$libname.lib\\\\\\\"/; }" \
+		$SED_ARGS \
 		$ltfile
 done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/msvc-octave-1.patch	Mon Jul 15 21:29:42 2013 -0400
@@ -0,0 +1,501 @@
+diff -ur octave-3.7.5-orig/configure.ac octave-3.7.5/configure.ac
+--- octave-3.7.5-orig/configure.ac	2013-05-14 03:12:10 -0400
++++ octave-3.7.5/configure.ac	2013-07-15 20:59:36 -0400
+@@ -752,7 +752,7 @@
+     dnl Use -isystem so we don't get warnings from llvm headers
+     LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
+     LLVM_CXXFLAGS=
+-    LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
++    LLVM_LDFLAGS="`$LLVM_CONFIG --ldflags`"
+     LLVM_LIBS=`$LLVM_CONFIG --libs`
+ 
+     dnl
+@@ -1186,7 +1186,7 @@
+ XTRA_CRUFT_SH_LDFLAGS=
+ if test $have_msvc = yes; then
+   FLIBS="$FLIBS -lkernel32"
+-  XTRA_CRUFT_SH_LDFLAGS="-Wl,-def:cruft/cruft.def"
++  XTRA_CRUFT_SH_LDFLAGS="-Wl,cruft/cruft.def"
+ fi
+ AC_SUBST(XTRA_CRUFT_SH_LDFLAGS)
+ 
+diff -ur octave-3.7.5-orig/libgui/qterminal-module.mk octave-3.7.5/libgui/qterminal-module.mk
+--- octave-3.7.5-orig/libgui/qterminal-module.mk	2013-05-12 15:01:12 -0400
++++ octave-3.7.5/libgui/qterminal-module.mk	2013-07-15 20:59:36 -0400
+@@ -50,7 +50,7 @@
+ qterminal_libqterminal_la_MOC += \
+   qterminal/libqterminal/win32/moc-QWinTerminalImpl.cc
+ 
+-qterminal_libqterminal_la_CPPFLAGS += -DUNICODE
++qterminal_libqterminal_la_CPPFLAGS += -DUNICODE -Zc:wchar_t-
+ 
+ # This flag is required to let MOC know about Q_OS_WIN32.
+ MOC_CPPFLAGS += -DQ_OS_WIN32
+diff -ur octave-3.7.5-orig/libgui/src/module.mk octave-3.7.5/libgui/src/module.mk
+--- octave-3.7.5-orig/libgui/src/module.mk	2013-05-12 17:21:10 -0400
++++ octave-3.7.5/libgui/src/module.mk	2013-07-15 20:59:36 -0400
+@@ -152,7 +152,7 @@
+ 
+ nodist_src_libgui_src_la_SOURCES = $(octave_gui_MOC) $(octave_gui_RC)
+ 
+-src_libgui_src_la_CPPFLAGS = \
++src_libgui_src_la_CPPFLAGS = -DQSCINTILLA_DLL \
+   $(AM_CPPFLAGS) \
+   @OCTGUI_DLL_DEFS@ \
+   @QT_CPPFLAGS@ \
+diff -ur octave-3.7.5-orig/libinterp/Makefile.am octave-3.7.5/libinterp/Makefile.am
+--- octave-3.7.5-orig/libinterp/Makefile.am	2013-04-16 11:26:09 -0400
++++ octave-3.7.5/libinterp/Makefile.am	2013-07-15 20:59:36 -0400
+@@ -185,6 +185,7 @@
+   interpfcn/libinterpfcn.la \
+   corefcn/libcorefcn.la \
+   $(top_builddir)/liboctave/liboctave.la \
++  $(top_builddir)/libgnu/libgnu.la \
+   $(LIBOCTINTERP_LINK_DEPS)
+ 
+ # Increment these as needed and according to the rules in the libtool manual:
+diff -ur octave-3.7.5-orig/libinterp/corefcn/gcd.cc octave-3.7.5/libinterp/corefcn/gcd.cc
+--- octave-3.7.5-orig/libinterp/corefcn/gcd.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/libinterp/corefcn/gcd.cc	2013-07-15 20:59:36 -0400
+@@ -74,7 +74,7 @@
+ 
+ template <typename FP>
+ static std::complex<FP>
+-simple_gcd (const std::complex<FP>& a, const std::complex<FP>& b)
++simple_gcd_cplx (const std::complex<FP>& a, const std::complex<FP>& b)
+ {
+   if (! xisinteger (a.real ()) || ! xisinteger (a.imag ())
+       || ! xisinteger (b.real ()) || ! xisinteger (b.imag ()))
+@@ -100,7 +100,7 @@
+ 
+ template <class T>
+ static octave_int<T>
+-simple_gcd (const octave_int<T>& a, const octave_int<T>& b)
++simple_gcd_int (const octave_int<T>& a, const octave_int<T>& b)
+ {
+   T aa = a.abs ().value ();
+   T bb = b.abs ().value ();
+@@ -153,8 +153,8 @@
+ 
+ template <typename FP>
+ static std::complex<FP>
+-extended_gcd (const std::complex<FP>& a, const std::complex<FP>& b,
+-              std::complex<FP>& x, std::complex<FP>& y)
++extended_gcd_cplx (const std::complex<FP>& a, const std::complex<FP>& b,
++                   std::complex<FP>& x, std::complex<FP>& y)
+ {
+   if (! xisinteger (a.real ()) || ! xisinteger (a.imag ())
+       || ! xisinteger (b.real ()) || ! xisinteger (b.imag ()))
+@@ -199,8 +199,8 @@
+ 
+ template <class T>
+ static octave_int<T>
+-extended_gcd (const octave_int<T>& a, const octave_int<T>& b,
+-              octave_int<T>& x, octave_int<T>& y)
++extended_gcd_int (const octave_int<T>& a, const octave_int<T>& b,
++                  octave_int<T>& x, octave_int<T>& y)
+ {
+   T aa = a.abs ().value ();
+   T bb = b.abs ().value ();
+@@ -229,9 +229,9 @@
+   return aa;
+ }
+ 
+-template<class NDA>
++template<class NDA, class F>
+ static octave_value
+-do_simple_gcd (const octave_value& a, const octave_value& b)
++do_simple_gcd (const octave_value& a, const octave_value& b, F fcn)
+ {
+   typedef typename NDA::element_type T;
+   octave_value retval;
+@@ -241,13 +241,13 @@
+       // Optimize scalar case.
+       T aa = octave_value_extract<T> (a);
+       T bb = octave_value_extract<T> (b);
+-      retval = simple_gcd (aa, bb);
++      retval = fcn (aa, bb);
+     }
+   else
+     {
+       NDA aa = octave_value_extract<NDA> (a);
+       NDA bb = octave_value_extract<NDA> (b);
+-      retval = binmap<T> (aa, bb, simple_gcd, "gcd");
++      retval = binmap<T> (aa, bb, fcn, "gcd");
+     }
+ 
+   return retval;
+@@ -265,18 +265,18 @@
+     case btyp_double:
+       if (a.is_sparse_type () && b.is_sparse_type ())
+         {
+-          retval = do_simple_gcd<SparseMatrix> (a, b);
++          retval = do_simple_gcd<SparseMatrix> (a, b, simple_gcd);
+           break;
+         }
+       // fall through!
+ 
+     case btyp_float:
+-      retval = do_simple_gcd<NDArray> (a, b);
++      retval = do_simple_gcd<NDArray> (a, b, simple_gcd);
+       break;
+ 
+ #define MAKE_INT_BRANCH(X) \
+     case btyp_ ## X: \
+-      retval = do_simple_gcd<X ## NDArray> (a, b); \
++      retval = do_simple_gcd<X ## NDArray> (a, b, simple_gcd_int<X ## _t>); \
+       break
+ 
+     MAKE_INT_BRANCH (int8);
+@@ -291,11 +291,11 @@
+ #undef MAKE_INT_BRANCH
+ 
+     case btyp_complex:
+-      retval = do_simple_gcd<ComplexNDArray> (a, b);
++      retval = do_simple_gcd<ComplexNDArray> (a, b, simple_gcd_cplx<double>);
+       break;
+ 
+     case btyp_float_complex:
+-      retval = do_simple_gcd<FloatComplexNDArray> (a, b);
++      retval = do_simple_gcd<FloatComplexNDArray> (a, b, simple_gcd_cplx<float>);
+       break;
+ 
+     default:
+@@ -309,10 +309,10 @@
+   return retval;
+ }
+ 
+-template<class NDA>
++template<class NDA, class F>
+ static octave_value
+ do_extended_gcd (const octave_value& a, const octave_value& b,
+-                 octave_value& x, octave_value& y)
++                 octave_value& x, octave_value& y, F fcn)
+ {
+   typedef typename NDA::element_type T;
+   octave_value retval;
+@@ -323,7 +323,7 @@
+       T aa = octave_value_extract<T> (a);
+       T bb = octave_value_extract<T> (b);
+       T xx, yy;
+-      retval = extended_gcd (aa, bb, xx, yy);
++      retval = fcn (aa, bb, xx, yy);
+       x = xx;
+       y = yy;
+     }
+@@ -354,7 +354,7 @@
+         {
+           octave_quit ();
+ 
+-          *gptr++ = extended_gcd (*aptr, *bptr, *xptr++, *yptr++);
++          *gptr++ = fcn (*aptr, *bptr, *xptr++, *yptr++);
+ 
+           aptr += inca;
+           bptr += incb;
+@@ -382,12 +382,12 @@
+     {
+     case btyp_double:
+     case btyp_float:
+-      retval = do_extended_gcd<NDArray> (a, b, x, y);
++      retval = do_extended_gcd<NDArray> (a, b, x, y, extended_gcd);
+       break;
+ 
+ #define MAKE_INT_BRANCH(X) \
+     case btyp_ ## X: \
+-      retval = do_extended_gcd<X ## NDArray> (a, b, x, y); \
++      retval = do_extended_gcd<X ## NDArray> (a, b, x, y, extended_gcd_int<X ## _t>); \
+       break
+ 
+     MAKE_INT_BRANCH (int8);
+@@ -402,11 +402,11 @@
+ #undef MAKE_INT_BRANCH
+ 
+     case btyp_complex:
+-      retval = do_extended_gcd<ComplexNDArray> (a, b, x, y);
++      retval = do_extended_gcd<ComplexNDArray> (a, b, x, y, extended_gcd_cplx<double>);
+       break;
+ 
+     case btyp_float_complex:
+-      retval = do_extended_gcd<FloatComplexNDArray> (a, b, x, y);
++      retval = do_extended_gcd<FloatComplexNDArray> (a, b, x, y, extended_gcd_cplx<float>);
+       break;
+ 
+     default:
+diff -ur octave-3.7.5-orig/libinterp/dldfcn/config-module.awk octave-3.7.5/libinterp/dldfcn/config-module.awk
+--- octave-3.7.5-orig/libinterp/dldfcn/config-module.awk	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/libinterp/dldfcn/config-module.awk	2013-07-15 20:59:36 -0400
+@@ -71,7 +71,7 @@
+       }
+     printf ("dldfcn_%s_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) %s $(OCT_LINK_OPTS)\n",
+             basename, ldflags[i]);
+-    printf ("dldfcn_%s_la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) ../liboctave/liboctave.la %s $(OCT_LINK_DEPS)\n",
++    printf ("dldfcn_%s_la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) ../liboctave/liboctave.la ../libgnu/libgnu.la %s $(OCT_LINK_DEPS)\n",
+             basename, libraries[i]);
+   }
+ }
+diff -ur octave-3.7.5-orig/libinterp/interpfcn/graphics.cc octave-3.7.5/libinterp/interpfcn/graphics.cc
+--- octave-3.7.5-orig/libinterp/interpfcn/graphics.cc	2013-04-16 11:26:09 -0400
++++ octave-3.7.5/libinterp/interpfcn/graphics.cc	2013-07-15 20:59:36 -0400
+@@ -10304,7 +10304,11 @@
+                     break;
+                 }
+ 
++#if defined (WIN32) && ! defined (__CYGWIN__)
++              Sleep (100);
++#else
+               octave_usleep (100000);
++#endif
+ 
+               OCTAVE_QUIT;
+ 
+diff -ur octave-3.7.5-orig/liboctave/array/CColVector.cc octave-3.7.5/liboctave/array/CColVector.cc
+--- octave-3.7.5-orig/liboctave/array/CColVector.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/array/CColVector.cc	2013-07-15 20:59:36 -0400
+@@ -236,13 +236,13 @@
+ ColumnVector
+ ComplexColumnVector::abs (void) const
+ {
+-  return do_mx_unary_map<double, Complex, std::abs> (*this);
++  return do_mx_unary_map_ref<double, Complex, std::abs> (*this);
+ }
+ 
+ ComplexColumnVector
+ conj (const ComplexColumnVector& a)
+ {
+-  return do_mx_unary_map<Complex, Complex, std::conj<double> > (a);
++  return do_mx_unary_map_ref<Complex, Complex, std::conj<double> > (a);
+ }
+ 
+ // resize is the destructive equivalent for this one
+diff -ur octave-3.7.5-orig/liboctave/array/CMatrix.cc octave-3.7.5/liboctave/array/CMatrix.cc
+--- octave-3.7.5-orig/liboctave/array/CMatrix.cc	2013-04-16 11:26:09 -0400
++++ octave-3.7.5/liboctave/array/CMatrix.cc	2013-07-15 20:59:36 -0400
+@@ -921,7 +921,7 @@
+ ComplexMatrix
+ conj (const ComplexMatrix& a)
+ {
+-  return do_mx_unary_map<Complex, Complex, std::conj<double> > (a);
++  return do_mx_unary_map_ref<Complex, Complex, std::conj<double> > (a);
+ }
+ 
+ // resize is the destructive equivalent for this one
+@@ -3219,7 +3219,7 @@
+ 
+ Matrix ComplexMatrix::abs (void) const
+ {
+-  return do_mx_unary_map<double, Complex, std::abs> (*this);
++  return do_mx_unary_map_ref<double, Complex, std::abs> (*this);
+ }
+ 
+ ComplexMatrix
+diff -ur octave-3.7.5-orig/liboctave/array/CNDArray.cc octave-3.7.5/liboctave/array/CNDArray.cc
+--- octave-3.7.5-orig/liboctave/array/CNDArray.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/array/CNDArray.cc	2013-07-15 20:59:36 -0400
+@@ -720,31 +720,31 @@
+ NDArray
+ ComplexNDArray::abs (void) const
+ {
+-  return do_mx_unary_map<double, Complex, std::abs> (*this);
++  return do_mx_unary_map_ref<double, Complex, std::abs> (*this);
+ }
+ 
+ boolNDArray
+ ComplexNDArray::isnan (void) const
+ {
+-  return do_mx_unary_map<bool, Complex, xisnan> (*this);
++  return do_mx_unary_map_ref<bool, Complex, xisnan> (*this);
+ }
+ 
+ boolNDArray
+ ComplexNDArray::isinf (void) const
+ {
+-  return do_mx_unary_map<bool, Complex, xisinf> (*this);
++  return do_mx_unary_map_ref<bool, Complex, xisinf> (*this);
+ }
+ 
+ boolNDArray
+ ComplexNDArray::isfinite (void) const
+ {
+-  return do_mx_unary_map<bool, Complex, xfinite> (*this);
++  return do_mx_unary_map_ref<bool, Complex, xfinite> (*this);
+ }
+ 
+ ComplexNDArray
+ conj (const ComplexNDArray& a)
+ {
+-  return do_mx_unary_map<Complex, Complex, std::conj<double> > (a);
++  return do_mx_unary_map_ref<Complex, Complex, std::conj<double> > (a);
+ }
+ 
+ ComplexNDArray&
+diff -ur octave-3.7.5-orig/liboctave/array/CRowVector.cc octave-3.7.5/liboctave/array/CRowVector.cc
+--- octave-3.7.5-orig/liboctave/array/CRowVector.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/array/CRowVector.cc	2013-07-15 20:59:36 -0400
+@@ -234,7 +234,7 @@
+ ComplexRowVector
+ conj (const ComplexRowVector& a)
+ {
+-  return do_mx_unary_map<Complex, Complex, std::conj<double> > (a);
++  return do_mx_unary_map_ref<Complex, Complex, std::conj<double> > (a);
+ }
+ 
+ // resize is the destructive equivalent for this one
+diff -ur octave-3.7.5-orig/liboctave/array/fCColVector.cc octave-3.7.5/liboctave/array/fCColVector.cc
+--- octave-3.7.5-orig/liboctave/array/fCColVector.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/array/fCColVector.cc	2013-07-15 20:59:36 -0400
+@@ -236,13 +236,13 @@
+ FloatColumnVector
+ FloatComplexColumnVector::abs (void) const
+ {
+-  return do_mx_unary_map<float, FloatComplex, std::abs> (*this);
++  return do_mx_unary_map_ref<float, FloatComplex, std::abs> (*this);
+ }
+ 
+ FloatComplexColumnVector
+ conj (const FloatComplexColumnVector& a)
+ {
+-  return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float> > (a);
++  return do_mx_unary_map_ref<FloatComplex, FloatComplex, std::conj<float> > (a);
+ }
+ 
+ // resize is the destructive equivalent for this one
+diff -ur octave-3.7.5-orig/liboctave/array/fCMatrix.cc octave-3.7.5/liboctave/array/fCMatrix.cc
+--- octave-3.7.5-orig/liboctave/array/fCMatrix.cc	2013-04-16 11:26:09 -0400
++++ octave-3.7.5/liboctave/array/fCMatrix.cc	2013-07-15 20:59:36 -0400
+@@ -923,7 +923,7 @@
+ FloatComplexMatrix
+ conj (const FloatComplexMatrix& a)
+ {
+-  return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float> > (a);
++  return do_mx_unary_map_ref<FloatComplex, FloatComplex, std::conj<float> > (a);
+ }
+ 
+ // resize is the destructive equivalent for this one
+@@ -3215,7 +3215,7 @@
+ 
+ FloatMatrix FloatComplexMatrix::abs (void) const
+ {
+-  return do_mx_unary_map<float, FloatComplex, std::abs> (*this);
++  return do_mx_unary_map_ref<float, FloatComplex, std::abs> (*this);
+ }
+ 
+ FloatComplexMatrix
+diff -ur octave-3.7.5-orig/liboctave/array/fCNDArray.cc octave-3.7.5/liboctave/array/fCNDArray.cc
+--- octave-3.7.5-orig/liboctave/array/fCNDArray.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/array/fCNDArray.cc	2013-07-15 20:59:36 -0400
+@@ -717,31 +717,31 @@
+ FloatNDArray
+ FloatComplexNDArray::abs (void) const
+ {
+-  return do_mx_unary_map<float, FloatComplex, std::abs> (*this);
++  return do_mx_unary_map_ref<float, FloatComplex, std::abs> (*this);
+ }
+ 
+ boolNDArray
+ FloatComplexNDArray::isnan (void) const
+ {
+-  return do_mx_unary_map<bool, FloatComplex, xisnan> (*this);
++  return do_mx_unary_map_ref<bool, FloatComplex, xisnan> (*this);
+ }
+ 
+ boolNDArray
+ FloatComplexNDArray::isinf (void) const
+ {
+-  return do_mx_unary_map<bool, FloatComplex, xisinf> (*this);
++  return do_mx_unary_map_ref<bool, FloatComplex, xisinf> (*this);
+ }
+ 
+ boolNDArray
+ FloatComplexNDArray::isfinite (void) const
+ {
+-  return do_mx_unary_map<bool, FloatComplex, xfinite> (*this);
++  return do_mx_unary_map_ref<bool, FloatComplex, xfinite> (*this);
+ }
+ 
+ FloatComplexNDArray
+ conj (const FloatComplexNDArray& a)
+ {
+-  return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float> > (a);
++  return do_mx_unary_map_ref<FloatComplex, FloatComplex, std::conj<float> > (a);
+ }
+ 
+ FloatComplexNDArray&
+diff -ur octave-3.7.5-orig/liboctave/array/fCRowVector.cc octave-3.7.5/liboctave/array/fCRowVector.cc
+--- octave-3.7.5-orig/liboctave/array/fCRowVector.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/array/fCRowVector.cc	2013-07-15 20:59:36 -0400
+@@ -234,7 +234,7 @@
+ FloatComplexRowVector
+ conj (const FloatComplexRowVector& a)
+ {
+-  return do_mx_unary_map<FloatComplex, FloatComplex, std::conj<float> > (a);
++  return do_mx_unary_map_ref<FloatComplex, FloatComplex, std::conj<float> > (a);
+ }
+ 
+ // resize is the destructive equivalent for this one
+diff -ur octave-3.7.5-orig/liboctave/numeric/dbleQR.cc octave-3.7.5/liboctave/numeric/dbleQR.cc
+--- octave-3.7.5-orig/liboctave/numeric/dbleQR.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/numeric/dbleQR.cc	2013-07-15 20:59:36 -0400
+@@ -95,7 +95,9 @@
+ #endif
+ }
+ 
+-const QR::type QR::raw, QR::std, QR::economy;
++const QR::type QR::raw = qr_type_raw;
++const QR::type QR::std = qr_type_std;
++const QR::type QR::economy = qr_type_economy;
+ 
+ QR::QR (const Matrix& a, qr_type_t qr_type)
+ {
+diff -ur octave-3.7.5-orig/liboctave/numeric/dbleQR.h octave-3.7.5/liboctave/numeric/dbleQR.h
+--- octave-3.7.5-orig/liboctave/numeric/dbleQR.h	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/numeric/dbleQR.h	2013-07-15 20:59:37 -0400
+@@ -40,9 +40,9 @@
+   // Import them here to allow the QR:: prefix.
+   typedef qr_type_t type;
+ 
+-  static const type std = qr_type_std;
+-  static const type raw = qr_type_raw;
+-  static const type economy = qr_type_economy;
++  static const type std;
++  static const type raw;
++  static const type economy;
+ 
+   QR (void) : base_qr<Matrix> () { }
+ 
+diff -ur octave-3.7.5-orig/liboctave/operators/mx-inlines.cc octave-3.7.5/liboctave/operators/mx-inlines.cc
+--- octave-3.7.5-orig/liboctave/operators/mx-inlines.cc	2013-02-16 18:52:27 -0500
++++ octave-3.7.5/liboctave/operators/mx-inlines.cc	2013-07-15 20:59:37 -0400
+@@ -316,7 +316,7 @@
+ { for (size_t i = 0; i < n; i++) r[i] = fun (x[i]); }
+ 
+ template <class R, class X, R fun (const X& x)>
+-inline void mx_inline_map (size_t n, R *r, const X *x) throw ()
++inline void mx_inline_map_ref (size_t n, R *r, const X *x) throw ()
+ { for (size_t i = 0; i < n; i++) r[i] = fun (x[i]); }
+ 
+ // Appliers. Since these call the operation just once, we pass it as
+@@ -343,9 +343,9 @@
+ 
+ template <class R, class X, R fun (const X&)>
+ inline Array<R>
+-do_mx_unary_map (const Array<X>& x)
++do_mx_unary_map_ref (const Array<X>& x)
+ {
+-  return do_mx_unary_op<R, X> (x, mx_inline_map<R, X, fun>);
++  return do_mx_unary_op<R, X> (x, mx_inline_map_ref<R, X, fun>);
+ }
+ 
+ template <class R>
+diff -ur octave-3.7.5-orig/src/Makefile.am octave-3.7.5/src/Makefile.am
+--- octave-3.7.5-orig/src/Makefile.am	2013-04-16 11:26:10 -0400
++++ octave-3.7.5/src/Makefile.am	2013-07-15 20:59:37 -0400
+@@ -49,7 +49,8 @@
+ 
+ OCTAVE_CORE_LIBS = \
+   $(top_builddir)/libinterp/liboctinterp.la \
+-  $(top_builddir)/liboctave/liboctave.la
++  $(top_builddir)/liboctave/liboctave.la \
++  $(top_builddir)/libgnu/libgnu.la
+ 
+ include ../libgui/link-deps.mk
+ 
--- a/src/octave.mk	Mon Jul 15 21:29:42 2013 -0400
+++ b/src/octave.mk	Mon Jul 15 21:29:42 2013 -0400
@@ -10,6 +10,7 @@
 $(PKG)_DEPS     := arpack curl fftw fltk fontconfig glpk gnuplot graphicsmagick hdf5 lapack pcre pstoedit qhull qrupdate qscintilla qt readline suitesparse texinfo zlib
 ifeq ($(ENABLE_JIT),yes)
   $(PKG)_DEPS += llvm
+$(PKG)_ENABLE_JIT_CONFIGURE_OPTIONS := --enable-jit
 endif
 
 ifeq ($(ENABLE_OPENBLAS),yes)
@@ -35,6 +36,22 @@
   endif
 endif
 
+ifeq ($(MXE_SYSTEM),msvc)
+  $(PKG)_PREFIX := '$(HOST_PREFIX)/local/$($(PKG)_SUBDIR)'
+  # - Enable atomic refcount (required for QtHandles)
+  # - Skip configure test for pow and sqrt, MSVC fails to compile them
+  #   because it uses intrinsics (with -O2 flag) and bump on the fake
+  #   "char FUNC()" forward declaration.
+  $(PKG)_EXTRA_CONFIGURE_OPTIONS := \
+    --enable-atomic-refcount \
+    ac_cv_func_pow=yes ac_cv_func_sqrt=yes
+  $(PKG)_CONFIGURE_POST_HOOK := $(CONFIGURE_POST_HOOK) -x
+else
+  $(PKG)_PREFIX := '$(HOST_PREFIX)'
+  $(PKG)_EXTRA_CONFIGURE_OPTIONS := \
+    LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR)'
+endif
+
 define $(PKG)_UPDATE
     echo 'Warning: Updates are temporarily disabled for package octave.' >&2;
     echo $(octave_VERSION)
@@ -45,17 +62,23 @@
     cd '$(1)' && autoreconf -W none
     cd '$(1)/.build' && $($(PKG)_CONFIGURE_ENV) '$(1)/configure' \
         $(CONFIGURE_CPPFLAGS) \
-        LDFLAGS='-Wl,-rpath-link,$(HOST_LIBDIR) -L$(HOST_LIBDIR)' \
         $(HOST_AND_BUILD_CONFIGURE_OPTIONS) \
-        --prefix='$(HOST_PREFIX)' \
+        --prefix='$($(PKG)_PREFIX)' \
         $($(PKG)_BLAS_OPTION) \
 	$($(PKG)_CROSS_CONFIG_OPTIONS) \
-        $($(PKG)_ENABLE_64_CONFIGURE_OPTIONS)
+        $($(PKG)_ENABLE_64_CONFIGURE_OPTIONS) \
+        $($(PKG)_ENABLE_JIT_CONFIGURE_OPTIONS) \
+	$($(PKG)_EXTRA_CONFIGURE_OPTIONS) \
+	PKG_CONFIG='$(MXE_PKG_CONFIG)' \
+	PKG_CONFIG_PATH='$(HOST_LIBDIR)/pkgconfig' \
+        && $($(PKG)_CONFIGURE_POST_HOOK)
 
     ## We want both of these install steps so that we install in the
     ## location set by the configure --prefix option, and the other
     ## in a directory tree that will have just Octave files.
     $(MAKE) -C '$(1)/.build' -j '$(JOBS)' install
-    $(MAKE) -C '$(1)/.build' -j '$(JOBS)' DESTDIR=$(TOP_DIR)/octave install
+    if [ $(MXE_SYSTEM) != msvc ]; then \
+        $(MAKE) -C '$(1)/.build' -j '$(JOBS)' DESTDIR=$(TOP_DIR)/octave install; \
+    fi
 endef