changeset 21961:307a2d7ff29b

fix cross build of mkoctfile * mkoctfile.in.cc: Directly include <sys/types.h>, <sys/wait.h>, and <unistd.h> instead of liboctave/wrappers headers when building cross version. (octave_unlink_wrapper, octave_wifexited_wrapper, octave_wexitstatus_wrapper): New static functions for cross version. * src/module.mk: Define CROSS=1 when building cross versions of mkoctfile and octave-config.
author John W. Eaton <jwe@octave.org>
date Tue, 21 Jun 2016 13:10:44 -0400
parents 63f8e75e3043
children 0de2c2839623
files src/mkoctfile.in.cc src/module.mk
diffstat 2 files changed, 32 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/mkoctfile.in.cc	Tue Jun 21 13:07:12 2016 -0400
+++ b/src/mkoctfile.in.cc	Tue Jun 21 13:10:44 2016 -0400
@@ -35,8 +35,14 @@
 #include <vector>
 #include <cstdlib>
 
-#include "unistd-wrappers.h"
-#include "wait-wrappers.h"
+#if defined (CROSS)
+#  include <sys/types.h>
+#  include <sys/wait.h>
+#  include <unistd.h>
+#else
+#  include "unistd-wrappers.h"
+#  include "wait-wrappers.h"
+#endif
 
 static std::map<std::string, std::string> vars;
 
@@ -50,6 +56,28 @@
 
 #include "shared-fcns.h"
 
+#if defined (CROSS)
+
+static int
+octave_unlink_wrapper (const char *nm)
+{
+  return unlink (nm);
+}
+
+static bool
+octave_wifexited_wrapper (int status)
+{
+  return WIFEXITED (status);
+}
+
+static int
+octave_wexitstatus_wrapper (int status)
+{
+  return WEXITSTATUS (status);
+}
+
+#endif
+
 static std::string
 get_line (FILE *fp)
 {
--- a/src/module.mk	Tue Jun 21 13:07:12 2016 -0400
+++ b/src/module.mk	Tue Jun 21 13:10:44 2016 -0400
@@ -178,7 +178,7 @@
 OCTAVE_CROSS_TOOLS += src/$(host_triplet)-mkoctfile$(BUILD_EXEEXT)
 
 src/$(host_triplet)-mkoctfile$(BUILD_EXEEXT): src/$(host_triplet)-mkoctfile.cc
-	$(BUILD_CXX) -o src/$(host_triplet)-mkoctfile$(BUILD_EXEEXT) -Dgnulib='' -Doctave_idx_type=int $(DEFAULT_INCLUDES) $(BUILD_CXXFLAGS) $(BUILD_LDFLAGS) -I$(srcdir)/src src/$(host_triplet)-mkoctfile.cc
+	$(BUILD_CXX) -o src/$(host_triplet)-mkoctfile$(BUILD_EXEEXT) -DCROSS=1 $(DEFAULT_INCLUDES) $(BUILD_CXXFLAGS) $(BUILD_LDFLAGS) -I$(srcdir)/src src/$(host_triplet)-mkoctfile.cc
 
 src/$(host_triplet)-mkoctfile.cc: src/mkoctfile.in.cc build-aux/subst-cross-config-vals.sh | src/$(octave_dirstamp)
 	$(AM_V_GEN)$(call simple-filter-rule,build-aux/subst-cross-config-vals.sh)
@@ -188,7 +188,7 @@
 OCTAVE_CROSS_TOOLS += src/$(host_triplet)-octave-config$(BUILD_EXEEXT)
 
 src/$(host_triplet)-octave-config$(BUILD_EXEEXT): src/$(host_triplet)-octave-config.cc
-	$(BUILD_CXX) -o src/$(host_triplet)-octave-config$(BUILD_EXEEXT) -Dgnulib='' -Doctave_idx_type=int $(DEFAULT_INCLUDES) $(BUILD_CXXFLAGS) $(BUILD_LDFLAGS) -I$(srcdir)/src src/$(host_triplet)-octave-config.cc
+	$(BUILD_CXX) -o src/$(host_triplet)-octave-config$(BUILD_EXEEXT) -DCROSS=1 $(DEFAULT_INCLUDES) $(BUILD_CXXFLAGS) $(BUILD_LDFLAGS) -I$(srcdir)/src src/$(host_triplet)-octave-config.cc
 
 src/$(host_triplet)-octave-config.cc: src/octave-config.in.cc build-aux/subst-default-vals.sh | src/$(octave_dirstamp)
 	$(AM_V_GEN)$(call simple-filter-rule,build-aux/subst-default-vals.sh)