# HG changeset patch # User Rik # Date 1405311807 25200 # Node ID 2c1e8de41649bee0cb5ab748f52d49573ec6383d # Parent 62eb2927917ea882792438092dcdc260aff3c42d# Parent 5999e654f2564cbbb8244e63fd72c3ebf71935c7 maint: Periodic merge of stable to gui-release. diff -r 62eb2927917e -r 2c1e8de41649 src/mkoctfile.in.cc --- 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 +// This mess suggested by the autoconf manual. + +#include + +#if defined HAVE_SYS_WAIT_H +#include +#endif + +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) (static_cast (stat_val) >> 8) +#endif + static std::map 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) {