diff m4/acinclude.m4 @ 14725:fa48fd0f160f

Add configure check for templated bitwise operators. * m4/acinclude.m4 (OCTAVE_CXX_BITWISE_OP_TEMPLATES): New macro. * configure.ac: Use it. * src/bitfcns.cc: Define bit_and, bit_or and bit_xor if missing.
author Carlo de Falco <cdf@users.sourceforge.net>
date Tue, 05 Jun 2012 07:39:46 +0200
parents 8a84849ad986
children 295bd3efc065
line wrap: on
line diff
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -105,6 +105,23 @@
 AC_LANG_POP(C++)
 ])
 dnl
+dnl See if the C++ library has the bit_and, bit_or and bit_xor
+dnl templates defined.
+dnl
+AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES],
+[AC_CACHE_CHECK([whether bit_and, bit_or and bit_xor are defined in the c++ library],
+octave_cv_cxx_bitwise_op_templates,
+[AC_LANG_PUSH(C++)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <functional>]],
+[[double x = 0.0, y = 1.0; double z1 = bit_and<double> (x, y); double z2 = bit_or<double> (x, y); double z1 = bit_xor<double> (x, y);]])],
+octave_cv_cxx_bitwise_op_templates=yes, octave_cv_cxx_bitwise_op_templates=no)])
+if test $octave_cv_cxx_bitwise_op_templates = yes; then
+AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES,1,[Define if C++ library has templated bitwise operators])
+fi
+AC_LANG_POP(C++)
+])
+
+dnl
 dnl See if the C++ library has functions to set real and imaginary
 dnl parts of complex numbers independently.
 dnl