From a6f19ecf5f8ef742f91a4573f97cd1f30167c621 Mon Sep 17 00:00:00 2001
From: Michael Wild <themiwi@users.sourceforge.net>
Date: Mon, 20 Aug 2012 14:48:34 +0200
Subject: [PATCH] Fix FE handling in scotchDecomp.C

Signed-off-by: Michael Wild <themiwi@users.sourceforge.net>
---
 src/parallel/decompose/scotchDecomp/scotchDecomp.C |   18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C
index ecfde10..27e5f00 100644
--- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C
+++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C
@@ -135,18 +135,8 @@ extern "C"
 
 // Hack: scotch generates floating point errors so need to switch of error
 //       trapping!
-#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
-#    define LINUX
-#endif
-
-#if defined(LINUX) && defined(__GNUC__)
-#    define LINUX_GNUC
-#endif
-
-#ifdef LINUX_GNUC
-#   ifndef __USE_GNU
-#       define __USE_GNU
-#   endif
+#ifdef __GLIBC__
+#   define _GNU_SOURCE
 #   include <fenv.h>
 #endif
 
@@ -503,7 +493,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
 
 
     // Hack:switch off fpu error trapping
-#   ifdef LINUX_GNUC
+#   ifdef FE_NOMASK_ENV
     int oldExcepts = fedisableexcept
     (
         FE_DIVBYZERO
@@ -526,7 +516,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
         "SCOTCH_graphMap"
     );
 
-#   ifdef LINUX_GNUC
+#   ifdef FE_NOMASK_ENV
     feenableexcept(oldExcepts);
 #   endif
 
-- 
1.7.9.5

