# HG changeset patch # User John W. Eaton # Date 1403903368 14400 # Node ID 4586051a5ff11e2ee5c1b29b171d96b1257a3295 # Parent 2b82d2f29a7b564dca8fc9a509c73aedbda88ecb WIFEXITED and WEXITSTATUS macros for mkoctfile.cc * mkoctfile.in.cc (WIFEXITED, WEXITSTATUS): Define for systems that don't have these macros. diff -r 2b82d2f29a7b -r 4586051a5ff1 src/mkoctfile.in.cc --- a/src/mkoctfile.in.cc Fri Jun 27 11:56:19 2014 -0400 +++ b/src/mkoctfile.in.cc Fri Jun 27 17:09:28 2014 -0400 @@ -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,9 +360,12 @@ { if (debug) std::cout << cmd << std::endl; + int result = system (cmd.c_str ()); + if (WIFEXITED (result)) result = WEXITSTATUS (result); + return result; }