changeset 18919:2c1e8de41649 gui-release

maint: Periodic merge of stable to gui-release.
author Rik <rik@octave.org>
date Sun, 13 Jul 2014 21:23:27 -0700
parents 62eb2927917e (current diff) 5999e654f256 (diff)
children c4def7ab39e7 1802dc60fb4a
files
diffstat 1 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/mkoctfile.in.cc	Sun Jul 13 19:59:56 2014 -0700
+++ b/src/mkoctfile.in.cc	Sun Jul 13 21:23:27 2014 -0700
@@ -37,6 +37,22 @@
 
 #include <unistd.h>
 
+// This mess suggested by the autoconf manual.
+
+#include <sys/types.h>
+
+#if defined HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) (static_cast<unsigned> (stat_val) >> 8)
+#endif
+
 static std::map<std::string, std::string> vars;
 
 #ifndef OCTAVE_VERSION
@@ -344,7 +360,13 @@
 {
   if (debug)
     std::cout << cmd << std::endl;
-  return system (cmd.c_str ());
+
+  int result = system (cmd.c_str ());
+
+  if (WIFEXITED (result))
+    result = WEXITSTATUS (result);
+
+  return result;
 }
 
 bool
@@ -626,7 +648,7 @@
       return 0;
     }
 
-  for (it = f77files.begin (); it != f77files.end (); ++it)
+  for (it = f77files.begin (); it != f77files.end () && !result; ++it)
     {
       std::string f = *it, b = basename (f, true);
       if (!vars["F77"].empty ())
@@ -655,7 +677,7 @@
         }
     }
 
-  for (it = cfiles.begin (); it != cfiles.end (); ++it)
+  for (it = cfiles.begin (); it != cfiles.end () && !result; ++it)
     {
       std::string f = *it;
       if (!vars["CC"].empty ())
@@ -685,7 +707,7 @@
         }
     }
 
-  for (it = ccfiles.begin (); it != ccfiles.end (); ++it)
+  for (it = ccfiles.begin (); it != ccfiles.end () && !result; ++it)
     {
       std::string f = *it;
       if (!vars["CXX"].empty ())
@@ -715,7 +737,7 @@
         }
     }
 
-  if (link && !objfiles.empty ())
+  if (link && !objfiles.empty () && !result)
     {
       if (link_stand_alone)
         {