[petsc-dev] Disabling a header in configure based on a bad link?

Satish Balay balay at mcs.anl.gov
Wed Sep 25 11:34:11 CDT 2013


Attached is the patch for this..

Satish

On Wed, 25 Sep 2013, Satish Balay wrote:

> perhaps the appropriate thing is to move the 'fenv.h' from the current
> location to this new test into config/BuildSystem/config/headers.py
> [i.e this code would add fenv.h header if the test is successful]
> 
> Satish
> 
> On Wed, 25 Sep 2013, Aron Ahmadia wrote:
> 
> > Hi folks,
> > 
> > I'm working on a Cygwin64 port of PETSc and I have a question about doing a
> > specific disable in BuildSystem based on a failing link.
> > 
> > The Cygwin folks provide an fenv.h implementation that (as far as I can
> > tell), is currently broken due to an undefined FE_DFL_ENV variable.  My
> > inclination is to disable this functionality in PETSc by declaring that
> > fenv.h is unavailable if a simple link test fails.  I tried to write a test
> > like this (in Configure.py)
> > 
> > def configureCygwin(self):
> >   '''Cygwin specific stuff'''
> >   # detect problem with missing FE_DFL_ENV symbol in Cygwin64
> >   if not self.checkLink('#include <fenv.h>', 'fesetenv(FE_DFL_ENV)'):
> >       self.headers.headers.remove('fenv.h')
> > 
> > 
> > I don't think it worked.  Has anybody had experience with *disabling*
> > functionality in BuildSystem?  Should we be less optimistic about having
> > the header and only enable it if the test passes?  Where would it go?
> > 
> > Cheers,
> > Aron
> > 
> 
> 
-------------- next part --------------
diff --git a/config/BuildSystem/config/libraries.py b/config/BuildSystem/config/libraries.py
index f559e55..351cb0b 100644
--- a/config/BuildSystem/config/libraries.py
+++ b/config/BuildSystem/config/libraries.py
@@ -255,6 +255,14 @@ extern "C" {
       self.logPrint('Warning: tgamma() not found')
     return
 
+  def checkMathFenv(self):
+    '''Checks if <fenv.h> can be used with FE_DFL_ENV'''
+    if not self.math is None and self.check(self.math, ['fesetenv'], prototype = ['#include <fenv.h>'], call = ['fesetenv(FE_DFL_ENV);']):
+      self.addDefine('HAVE_FENV_H', 1)
+    else:
+      self.logPrint('Warning: <fenv.h> with FE_DFL_ENV not found')
+    return
+
   def checkCompression(self):
     '''Check for libz, the compression library'''
     self.compression = None
@@ -440,6 +448,7 @@ int checkInit(void) {
     self.executeTest(self.checkMath)
     self.executeTest(self.checkMathErf)
     self.executeTest(self.checkMathTgamma)
+    self.executeTest(self.checkMathFenv)
     self.executeTest(self.checkCompression)
     self.executeTest(self.checkRealtime)
     self.executeTest(self.checkDynamic)
diff --git a/config/PETSc/Configure.py b/config/PETSc/Configure.py
index 01302fb..73dac05 100644
--- a/config/PETSc/Configure.py
+++ b/config/PETSc/Configure.py
@@ -91,7 +91,7 @@ class Configure(config.base.Configure):
                                             'unistd', 'sys/sysinfo', 'machine/endian', 'sys/param', 'sys/procfs', 'sys/resource',
                                             'sys/systeminfo', 'sys/times', 'sys/utsname','string', 'stdlib','memory',
                                             'sys/socket','sys/wait','netinet/in','netdb','Direct','time','Ws2tcpip','sys/types',
-                                            'WindowsX', 'cxxabi','float','ieeefp','stdint','fenv','sched','pthread','mathimf'])
+                                            'WindowsX', 'cxxabi','float','ieeefp','stdint','sched','pthread','mathimf'])
     functions = ['access', '_access', 'clock', 'drand48', 'getcwd', '_getcwd', 'getdomainname', 'gethostname', 'getpwuid',
                  'gettimeofday', 'getwd', 'memalign', 'memmove', 'mkstemp', 'popen', 'PXFGETARG', 'rand', 'getpagesize',
                  'readlink', 'realpath',  'sigaction', 'signal', 'sigset', 'usleep', 'sleep', '_sleep', 'socket',


More information about the petsc-dev mailing list