[PPL-devel] [GIT] ppl/ppl(master): Some systems do not have <strings.h>.

Roberto Bagnara bagnara at cs.unipr.it
Sat Mar 28 19:07:07 CET 2009


Module: ppl/ppl
Branch: master
Commit: 766fb040b2dc574fa6b366c0374b50c6509924fe
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=766fb040b2dc574fa6b366c0374b50c6509924fe

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sat Mar 28 19:06:01 2009 +0100

Some systems do not have <strings.h>.
On such systems ffs(3) may be defined in <string.h>.

---

 configure.ac           |   19 ++++++++++++++-----
 src/Bit_Row.inlines.hh |    7 ++++++-
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index b88bb7a..1a05bb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -692,8 +692,20 @@ AC_CXX_HAS_REMAINDER_BUG
 # Check whether the C++ compiler supports __attribute__ ((weak)).
 AC_CXX_SUPPORTS_ATTRIBUTE_WEAK
 
+# Checks for header files.
+AC_CHECK_HEADERS([fenv.h ieeefp.h getopt.h signal.h string.h strings.h sys/resource.h sys/time.h sys/types.h unistd.h])
+
 # Checks for the availability of C library functions in C++.
-AC_CHECK_DECLS([ffs], , , [#include <strings.h>])
+AC_CHECK_DECLS([ffs],
+               ,
+               ,
+               [
+#if defined(HAVE_STRINGS_H)
+# include <strings.h>
+#elif defined(HAVE_STRING_H)
+# include <string.h>
+#endif
+               ])
 AC_CHECK_DECLS([getenv,strtof,strtod,strtold,strtoll,strtoull], , , [#include <cstdlib>])
 AC_CHECK_DECLS([fma,fmaf,fmal,rintf,rintl], , , [#include <cmath>])
 
@@ -1424,9 +1436,6 @@ then
 fi
 AC_LANG_POP(C)
 
-# Checks for header files.
-AC_CHECK_HEADERS([fenv.h ieeefp.h getopt.h signal.h sys/resource.h sys/time.h sys/types.h unistd.h])
-
 # Checks for header declarations.
 AC_CHECK_DECLS([RLIMIT_DATA, RLIMIT_RSS, RLIMIT_VMEM, RLIMIT_AS],
                ,
@@ -1435,7 +1444,7 @@ AC_CHECK_DECLS([RLIMIT_DATA, RLIMIT_RSS, RLIMIT_VMEM, RLIMIT_AS],
 #ifdef HAVE_SYS_RESOURCE_H
 # include <sys/resource.h>
 #endif
-])
+               ])
 
 AC_CHECK_DECLS([getrusage],
                ,
diff --git a/src/Bit_Row.inlines.hh b/src/Bit_Row.inlines.hh
index 0224f58..6fc36f7 100644
--- a/src/Bit_Row.inlines.hh
+++ b/src/Bit_Row.inlines.hh
@@ -25,8 +25,13 @@ site: http://www.cs.unipr.it/ppl/ . */
 
 #include "globals.defs.hh"
 #include <cassert>
+
 // For the declaration of ffs(3).
-#include <strings.h>
+#if defined(PPL_HAVE_STRINGS_H)
+# include <strings.h>
+#elif defined(PPL_HAVE_STRING_H)
+# include <string.h>
+#endif
 
 namespace Parma_Polyhedra_Library {
 




More information about the PPL-devel mailing list