You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by sb...@apache.org on 2010/04/11 19:45:14 UTC
svn commit: r932952 - in /hadoop/avro/trunk: ./ lang/c++/
lang/c++/api/buffer/ lang/c++/api/buffer/detail/ lang/c++/m4/ lang/c++/test/
Author: sbanacho
Date: Sun Apr 11 17:45:14 2010
New Revision: 932952
URL: http://svn.apache.org/viewvc?rev=932952&view=rev
Log:
AVRO-515. Fix build and compatibility problems.
Added:
hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_asio.m4
Modified:
hadoop/avro/trunk/CHANGES.txt
hadoop/avro/trunk/lang/c++/Makefile.am
hadoop/avro/trunk/lang/c++/api/buffer/Buffer.hh
hadoop/avro/trunk/lang/c++/api/buffer/BufferPrint.hh
hadoop/avro/trunk/lang/c++/api/buffer/BufferReader.hh
hadoop/avro/trunk/lang/c++/api/buffer/BufferStream.hh
hadoop/avro/trunk/lang/c++/api/buffer/BufferStreambuf.hh
hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetail.hh
hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetailIterator.hh
hadoop/avro/trunk/lang/c++/configure.in
hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_base.m4
hadoop/avro/trunk/lang/c++/test/buffertest.cc
Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Sun Apr 11 17:45:14 2010
@@ -32,6 +32,8 @@ Avro 1.4.0 (unreleased)
AVRO-496. python sample_http_client.py is broken (Jeff Hodges via hammer)
+ AVRO-515. Fix build and compatibility problems. (sbanacho)
+
Avro 1.3.2 (31 March 2010)
IMPROVEMENTS
Modified: hadoop/avro/trunk/lang/c++/Makefile.am
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/Makefile.am?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/Makefile.am (original)
+++ hadoop/avro/trunk/lang/c++/Makefile.am Sun Apr 11 17:45:14 2010
@@ -1,12 +1,14 @@
-AM_CXXFLAGS= -I$(top_srcdir)/api $(BOOST_CPPFLAGS) -Wall -Werror -Wno-invalid-offsetof
-ACLOCAL_AMFLAGS=-I m4
-
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
BOOST_LDFLAGS = @BOOST_LDFLAGS@
BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
PYTHON = @PYTHON@
+AM_CXXFLAGS= -I$(top_srcdir)/api $(BOOST_CPPFLAGS) -Wall -Wno-invalid-offsetof
+# removed -Werror for Cygwin builds, maybe should add a check flag
+
+ACLOCAL_AMFLAGS=-I m4
+
library_includedir=$(includedir)/avrocpp
library_include_HEADERS = \
api/AvroParse.hh \
Modified: hadoop/avro/trunk/lang/c++/api/buffer/Buffer.hh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/buffer/Buffer.hh?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/Buffer.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/Buffer.hh Sun Apr 11 17:45:14 2010
@@ -1,6 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef avro_Buffer_hh__
#define avro_Buffer_hh__
+#include <sys/uio.h>
#include <boost/type_traits.hpp>
#include <vector>
Modified: hadoop/avro/trunk/lang/c++/api/buffer/BufferPrint.hh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/buffer/BufferPrint.hh?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/BufferPrint.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/BufferPrint.hh Sun Apr 11 17:45:14 2010
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef avro_BufferPrint_hh__
#define avro_BufferPrint_hh__
Modified: hadoop/avro/trunk/lang/c++/api/buffer/BufferReader.hh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/buffer/BufferReader.hh?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/BufferReader.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/BufferReader.hh Sun Apr 11 17:45:14 2010
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef avro_BufferReader_hh__
#define avro_BufferReader_hh__
Modified: hadoop/avro/trunk/lang/c++/api/buffer/BufferStream.hh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/buffer/BufferStream.hh?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/BufferStream.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/BufferStream.hh Sun Apr 11 17:45:14 2010
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef avro_BufferStream_hh__
#define avro_BufferStream_hh__
Modified: hadoop/avro/trunk/lang/c++/api/buffer/BufferStreambuf.hh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/buffer/BufferStreambuf.hh?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/BufferStreambuf.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/BufferStreambuf.hh Sun Apr 11 17:45:14 2010
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef avro_BufferStreambuf_hh__
#define avro_BufferStreambuf_HH__
Modified: hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetail.hh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/buffer/detail/BufferDetail.hh?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetail.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetail.hh Sun Apr 11 17:45:14 2010
@@ -1,11 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef avro_BufferDetail_hh__
#define avro_BufferDetail_hh__
#include <boost/shared_ptr.hpp>
#include <boost/shared_array.hpp>
#include <boost/static_assert.hpp>
-#include <boost/asio/buffer.hpp>
#include <boost/function.hpp>
+#ifdef HAVE_BOOST_ASIO
+#include <boost/asio/buffer.hpp>
+#endif
#include <exception>
#include <cassert>
#include <deque>
@@ -23,8 +43,10 @@ namespace detail {
typedef char data_type;
typedef size_t size_type;
+#ifdef HAVE_BOOST_ASIO
typedef boost::asio::const_buffer ConstAsioBuffer;
typedef boost::asio::mutable_buffer MutableAsioBuffer;
+#endif
/// The size in bytes for blocks backing buffer chunks.
const size_type kMinBlockSize = 4096;
Modified: hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetailIterator.hh
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/api/buffer/detail/BufferDetailIterator.hh?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetailIterator.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetailIterator.hh Sun Apr 11 17:45:14 2010
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef avro_BufferDetailIterator_hh__
#define avro_BufferDetailIterator_hh__
@@ -47,9 +65,11 @@ struct InputIteratorHelper
/// Conversion operator. It doesn't check for null, because the only
/// the only time the chunk should be null is when it's the iterator
/// end(), which should never be dereferenced anyway.
+#ifdef BOOST_HAVE_ASIO
operator ConstAsioBuffer() const {
return ConstAsioBuffer(data(), size());
}
+#endif
BufferImpl::ChunkList::const_iterator iter_; ///< the current iterator
};
@@ -88,9 +108,11 @@ struct OutputIteratorHelper
/// Conversion operator. It doesn't check for null, because the only
/// the only time the chunk should be null is when it's the iterator
/// end(), which should never be dereferenced anyway.
+#ifdef HAVE_BOOST_ASIO
operator MutableAsioBuffer() const {
return MutableAsioBuffer(data(), size());
}
+#endif
BufferImpl::ChunkList::const_iterator iter_; ///< the current iterator
};
Modified: hadoop/avro/trunk/lang/c++/configure.in
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/configure.in?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/configure.in (original)
+++ hadoop/avro/trunk/lang/c++/configure.in Sun Apr 11 17:45:14 2010
@@ -18,10 +18,11 @@ AC_CHECK_PROG(DOXYGEN, doxygen, doxygen)
AC_CHECK_PROG(PYTHON, python, python)
# Checks for libraries.
-AX_BOOST_BASE([1.35.0])
+AX_BOOST_BASE([1.32.0])
AX_BOOST_REGEX
AX_BOOST_THREAD
AX_BOOST_SYSTEM
+AX_BOOST_ASIO
# Checks for header files.
AC_FUNC_ALLOCA
Added: hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_asio.m4
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/m4/m4_ax_boost_asio.m4?rev=932952&view=auto
==============================================================================
--- hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_asio.m4 (added)
+++ hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_asio.m4 Sun Apr 11 17:45:14 2010
@@ -0,0 +1,108 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_boost_asio.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_BOOST_ASIO
+#
+# DESCRIPTION
+#
+# Test for Asio library from the Boost C++ libraries. The macro requires a
+# preceding call to AX_BOOST_BASE. Further documentation is available at
+# <http://randspringer.de/boost/index.html>.
+#
+# This macro calls:
+#
+# AC_SUBST(BOOST_ASIO_LIB)
+#
+# And sets:
+#
+# HAVE_BOOST_ASIO
+#
+# LICENSE
+#
+# Copyright (c) 2008 Thomas Porschberg <th...@randspringer.de>
+# Copyright (c) 2008 Pete Greenwell <pe...@mu.org>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 7
+
+AC_DEFUN([AX_BOOST_ASIO],
+[
+ AC_ARG_WITH([boost-asio],
+ AS_HELP_STRING([--with-boost-asio@<:@=special-lib@:>@],
+ [use the ASIO library from boost - it is possible to specify a certain library for the linker
+ e.g. --with-boost-asio=boost_system-gcc41-mt-1_34 ]),
+ [
+ if test "$withval" = "no"; then
+ want_boost="no"
+ elif test "$withval" = "yes"; then
+ want_boost="yes"
+ ax_boost_user_asio_lib=""
+ else
+ want_boost="yes"
+ ax_boost_user_asio_lib="$withval"
+ fi
+ ],
+ [want_boost="yes"]
+ )
+
+ if test "x$want_boost" = "xyes"; then
+ AC_REQUIRE([AC_PROG_CC])
+ CPPFLAGS_SAVED="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+ export CPPFLAGS
+
+ LDFLAGS_SAVED="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+ export LDFLAGS
+
+ AC_CACHE_CHECK(whether the Boost::ASIO library is available,
+ ax_cv_boost_asio,
+ [AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ @%:@include <boost/asio.hpp>
+ ]],
+ [[
+
+ boost::asio::io_service io;
+ boost::system::error_code timer_result;
+ boost::asio::deadline_timer t(io);
+ t.cancel();
+ io.run_one();
+ return 0;
+ ]]),
+ ax_cv_boost_asio=yes, ax_cv_boost_asio=no)
+ AC_LANG_POP([C++])
+ ])
+ if test "x$ax_cv_boost_asio" = "xyes"; then
+ AC_DEFINE(HAVE_BOOST_ASIO,,[define if the Boost::ASIO library is available])
+ BN=boost_system
+ if test "x$ax_boost_user_asio_lib" = "x"; then
+ for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
+ lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
+ $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
+ AC_CHECK_LIB($ax_lib, main, [BOOST_ASIO_LIB="-l$ax_lib" AC_SUBST(BOOST_ASIO_LIB) link_thread="yes" break],
+ [link_thread="no"])
+ done
+ else
+ for ax_lib in $ax_boost_user_asio_lib $BN-$ax_boost_user_asio_lib; do
+ AC_CHECK_LIB($ax_lib, main,
+ [BOOST_ASIO_LIB="-l$ax_lib" AC_SUBST(BOOST_ASIO_LIB) link_asio="yes" break],
+ [link_asio="no"])
+ done
+
+ fi
+ if test "x$link_asio" = "xno"; then
+ AC_MSG_ERROR(Could not link against $ax_lib !)
+ fi
+ fi
+
+ CPPFLAGS="$CPPFLAGS_SAVED"
+ LDFLAGS="$LDFLAGS_SAVED"
+ fi
+])
Modified: hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_base.m4
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/m4/m4_ax_boost_base.m4?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_base.m4 (original)
+++ hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_base.m4 Sun Apr 11 17:45:14 2010
@@ -204,7 +204,7 @@ if test "x$want_boost" = "xyes"; then
if test "$_version" = "0" ; then
AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
- AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
+ AC_MSG_ERROR([Your boost libraries seems too old (version $_version).])
fi
else
AC_SUBST(BOOST_CPPFLAGS)
Modified: hadoop/avro/trunk/lang/c++/test/buffertest.cc
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/test/buffertest.cc?rev=932952&r1=932951&r2=932952&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/test/buffertest.cc (original)
+++ hadoop/avro/trunk/lang/c++/test/buffertest.cc Sun Apr 11 17:45:14 2010
@@ -1,10 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <boost/test/included/unit_test_framework.hpp>
#include <boost/thread.hpp>
#include <boost/bind.hpp>
+#ifdef HAVE_BOOST_ASIO
+#include <boost/asio.hpp>
+#endif
#include <fstream>
#include <iostream>
-#include <boost/asio.hpp>
#define BUFFER_UNITTEST
#include "buffer/BufferStream.hh"
@@ -615,6 +635,7 @@ void TestIterator()
}
}
+#ifdef HAVE_BOOST_ASIO
void server(boost::barrier &b)
{
using boost::asio::ip::tcp;
@@ -714,6 +735,12 @@ void TestAsioBuffer()
t.join();
}
}
+#else
+void TestAsioBuffer()
+{
+ cout << "Skipping asio test\n";
+}
+#endif // HAVE_BOOST_ASIO
void TestSplit()
{