changeset 6080:40ab35ab651c

[project @ 2006-10-25 03:26:36 by jwe]
author jwe
date Wed, 25 Oct 2006 03:26:36 +0000
parents 802aec2b1a2e
children cd98c1e18d48
files src/ChangeLog src/Makefile.in src/sysdep.cc
diffstat 3 files changed, 62 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Oct 25 01:40:26 2006 +0000
+++ b/src/ChangeLog	Wed Oct 25 03:26:36 2006 +0000
@@ -1,3 +1,16 @@
+2006-10-24  Michael Goffioul  <michael.goffioul@swing.be>
+
+	* Makefile.in: Filter out $(XTRA_CXXDEFS) from $(ALL_CXXFLAGS) for
+	$(DLD_PICOBJ).
+
+2006-10-24  John W. Eaton  <jwe@octave.org>
+
+	* sysdep.cc (MSC_init): New function.
+	(sysdep_init): Call it.
+	(w32_set_octave_home): New function, based on code from Michael
+	Goffioul <michael.goffioul@swing.be>.
+	(MINGW_init): Call w32_set_octave_home here too.
+
 2006-10-23  John W. Eaton  <jwe@octave.org>
 
 	* symtab.cc (symbol_table::clear_mex_functions): New function.
--- a/src/Makefile.in	Wed Oct 25 01:40:26 2006 +0000
+++ b/src/Makefile.in	Wed Oct 25 03:26:36 2006 +0000
@@ -264,6 +264,9 @@
 lex.o parse.o __gnuplot_raw__.o pic/lex.o pic/parse.o pic/__gnuplot_raw__.o: \
 	ALL_CXXFLAGS := $(filter-out -Wold-style-cast, $(ALL_CXXFLAGS))
 
+$(DLD_PICOBJ): \
+	ALL_CXXFLAGS := $(filter-out $(XTRA_CXXDEFS), $(ALL_CXXFLAGS))
+
 XERBLA = ../libcruft/blas-xtra/xerbla.o
 ifdef FPICFLAG
   PIC_XERBLA = ../libcruft/blas-xtra/pic/xerbla.o
--- a/src/sysdep.cc	Wed Oct 25 01:40:26 2006 +0000
+++ b/src/sysdep.cc	Wed Oct 25 03:26:36 2006 +0000
@@ -106,6 +106,40 @@
 }
 #endif
 
+static void
+w32_set_octave_home (void)
+{
+#if defined (__WIN32__) && ! defined (_POSIX_VERSION)
+  int n = 1024;
+
+  std::string bin_dir (' ', n);
+
+  while (true)
+    {
+      int status = GetModuleFileName (0, &bin_dir[0], n);
+
+      if (status < n)
+	{
+	  bin_dir.resize (status);
+	  break;
+	}
+      else
+	{
+	  n *= 2;
+	  bin_dir.resize (n);
+	}
+    }
+
+  if (! bin_dir.empty ())
+    {
+      size_t pos = bin_dir.rfind ("\\bin\\");
+
+      if (pos != NPOS)
+	octave_env::putenv ("OCTAVE_HOME", bin_dir.substr (0, pos));
+    }
+#endif
+}
+
 void
 w32_set_quiet_shutdown (void)
 {
@@ -132,6 +166,8 @@
 static void
 MINGW_init (void)
 {
+  w32_set_octave_home ();
+
   // Init mutex to protect setjmp/longjmp and get main thread context
   w32_sigint_init ();
 
@@ -139,6 +175,14 @@
 }
 #endif
 
+#if defined (_MSC_VER)
+static void
+MSVC_init (void)
+{
+  w32_set_octave_home ();
+}
+#endif
+
 #if defined (__CYGWIN__)
 
 #include <limits.h>
@@ -236,6 +280,8 @@
   CYGWIN_init ();
 #elif defined (__MINGW32__)
   MINGW_init ();
+#elif defined (_MSC_VER)
+  MSVC_init ();
 #elif defined (NeXT)
   NeXT_init ();
 #elif defined (__EMX__)