octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New autoconf bitfcns test failing


From: John W. Eaton
Subject: Re: New autoconf bitfcns test failing
Date: Tue, 5 Jun 2012 14:14:10 -0400

On  5-Jun-2012, c. wrote:

| 
| On 5 Jun 2012, at 17:56, Rik wrote:
| 
| > Carlo,
| > 
| > In the following changeset you added autoconf checking for templated bit
| > functions like bit_and, bit_or, and bit_xor.
| > 
| > changeset:   14725:fa48fd0f160f
| > user:        Carlo de Falco <address@hidden>
| > date:        Tue Jun 05 07:39:46 2012 +0200
| > summary:     Add configure check for templated bitwise operators.
| > 
| > Unfortunately, I now can't compile on a straight Linux distribution (Ubuntu
| > 10.04).  I get the following errors when trying to compile src/bitfcns.cc
| > 
| > bitfcns.cc:51: error: redefinition of ‘struct std::bit_and<_Tp>’
| > /usr/include/c++/4.4/bits/stl_function.h:293: error: previous definition of
| > ‘struct std::bit_and<_Tp>’
| > bitfcns.cc:58: error: redefinition of ‘struct std::bit_or<_Tp>’
| > /usr/include/c++/4.4/bits/stl_function.h:301: error: previous definition of
| > ‘struct std::bit_or<_Tp>’
| > bitfcns.cc:65: error: redefinition of ‘struct std::bit_xor<_Tp>’
| > /usr/include/c++/4.4/bits/stl_function.h:309: error: previous definition of
| > ‘struct std::bit_xor<_Tp>’
| > make[3]: *** [liboctinterp_la-bitfcns.lo] Error 1
| > 
| > If I look at config.h it shows that HAVE_CXX_BITWISE_OP_TEMPLATES is
| > undefined so the templates get re-defined at the start of bitfcns.cc.  It
| > looks like it must be something with the test program in acinclude.m4 which
| > is returning the wrong result.
| > 
| > --Rik
| 
| Rik,
| thanks for reporting this.
| can you please also send me your config.log?

I think the following change will fix the problem.

jwe


diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -113,7 +113,11 @@
 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);]])],
+[[int x = 0;
+int y = 1;
+int z1 = std::bit_and<int>() (x, y);
+int z2 = std::bit_or<int>() (x, y);
+int z3 = std::bit_xor<int>() (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])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]