changeset 25504:ace13ff63b90

undo previous change; use 0 instead of O_BINARY * mkoctfile.in.cc: Don't include <fcntl.h>. Pass 0 instead of O_BINARY to mkostemps. Add some explanation about the CROSS macro usage.
author John W. Eaton <jwe@octave.org>
date Tue, 26 Jun 2018 11:13:38 -0400
parents ec2492a2af6a
children 46836dd20f25
files src/mkoctfile.in.cc
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/mkoctfile.in.cc	Tue Jun 26 09:52:19 2018 -0400
+++ b/src/mkoctfile.in.cc	Tue Jun 26 11:13:38 2018 -0400
@@ -36,13 +36,22 @@
 #include <vector>
 #include <cstdlib>
 
+// Programming note:  The CROSS macro here refers to building a
+// cross-compiler aware version of mkoctfile that can be used to cross
+// compile .oct file for Windows builds of Octave, not that mkoctfile
+// itself is being cross compiled.
+//
+// We don't use the wrapper and gnulib functions when we are building
+// with CROSS defined.  This configuration is only expected to work on
+// modern systems that should not need to have gnulib to fix POSIX
+// portability problems.  So we just assume a working POSIX system when
+// CROSS is defined.
+
 #if defined (CROSS)
-#  include <fcntl.h>
 #  include <stdlib.h>
 #  include <sys/types.h>
 #  include <sys/wait.h>
 #  include <unistd.h>
-
 #  ifndef OCTAVE_UNUSED
 #    define OCTAVE_UNUSED
 #  endif
@@ -73,7 +82,7 @@
 static int
 octave_mkostemps_wrapper (char *tmpl, int suffixlen)
 {
-  return mkostemps (tmpl, suffixlen, O_BINARY);
+  return mkostemps (tmpl, suffixlen, 0);
 }
 
 static int
@@ -173,10 +182,10 @@
 
   std::string DEFAULT_LFLAGS;
 
-#if defined (OCTAVE_USE_WINDOWS_API) || defined(CROSS)
+#if defined (OCTAVE_USE_WINDOWS_API) || defined (CROSS)
 
-  // We'll be linking with -loctinterp and -loctave, so we need to know
-  // where to find them.
+  // We'll be linking the files we compile with -loctinterp and
+  // -loctave, so we need to know where to find them.
 
   DEFAULT_LFLAGS += "-L" + quote_path (vars["OCTLIBDIR"]);
 #endif