[PPL-devel] [GIT] ppl/ppl(master): Detect whether the plain char type is signed.

Roberto Bagnara bagnara at cs.unipr.it
Mon Feb 14 11:00:40 CET 2011


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

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sun Jan 30 20:06:05 2011 +0100

Detect whether the plain char type is signed.

---

 configure.ac                      |    3 ++
 m4/Makefile.am                    |    1 +
 m4/ac_cxx_plain_char_is_signed.m4 |   55 +++++++++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 68934ec..6fd60e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -666,6 +666,9 @@ AC_SEARCH_LIBS([sqrt], [m])
 # Check for the possibility to control the FPU.
 AC_CHECK_FPU_CONTROL
 
+# Check whether for the C++ compiler the plain char type is signed.
+AC_CXX_PLAIN_CHAR_IS_SIGNED
+
 # Check whether the C++ compiler provides proper long doubles.
 AC_CXX_PROVIDES_PROPER_LONG_DOUBLE
 
diff --git a/m4/Makefile.am b/m4/Makefile.am
index a69425f..313d28a 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -46,6 +46,7 @@ ac_cxx_ieee_inexact_flag.m4 \
 ac_cxx_limit_memory.m4 \
 ac_cxx_long_double_binary_format.m4 \
 ac_cxx_long_double_exact_output.m4 \
+ac_cxx_plain_char_is_signed.m4 \
 ac_cxx_proper_long_double.m4 \
 ac_cxx_remainder_bug.m4 \
 ac_prog_jar.m4 \
diff --git a/m4/ac_cxx_plain_char_is_signed.m4 b/m4/ac_cxx_plain_char_is_signed.m4
new file mode 100644
index 0000000..bc0b086
--- /dev/null
+++ b/m4/ac_cxx_plain_char_is_signed.m4
@@ -0,0 +1,55 @@
+dnl A function to check whether the plain char type is signed.
+dnl Copyright (C) 2001-2010 Roberto Bagnara <bagnara at cs.unipr.it>
+dnl Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com)
+dnl
+dnl This file is part of the Parma Polyhedra Library (PPL).
+dnl
+dnl The PPL is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the
+dnl Free Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl The PPL is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software Foundation,
+dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
+dnl
+dnl For the most up-to-date information see the Parma Polyhedra Library
+dnl site: http://www.cs.unipr.it/ppl/ .
+
+AC_DEFUN([AC_CXX_PLAIN_CHAR_IS_SIGNED],
+[
+ac_save_CPPFLAGS="$CPPFLAGS"
+ac_save_LIBS="$LIBS"
+AC_LANG_PUSH(C++)
+
+AC_MSG_CHECKING([whether the plain char type is signed])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <limits>
+
+int foo[std::numeric_limits<char>::is_signed ? 1 : -1];
+]])],
+  AC_MSG_RESULT(yes)
+  ac_cxx_plain_char_is_signed=yes,
+  AC_MSG_RESULT(no)
+  ac_cxx_plain_char_is_signed=no,
+  AC_MSG_RESULT(no)
+  ac_cxx_plain_char_is_signed=no)
+
+if test x"$ac_cxx_plain_char_is_signed" = xyes
+then
+  value=1
+else
+  value=0
+fi
+AC_DEFINE_UNQUOTED(PPL_CXX_PLAIN_CHAR_IS_SIGNED, $value,
+  [Not zero if the the plain char type is signed.])
+
+AC_LANG_POP(C++)
+CPPFLAGS="$ac_save_CPPFLAGS"
+LIBS="$ac_save_LIBS"
+])




More information about the PPL-devel mailing list