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/17 18:33:09 UTC

svn commit: r935204 - in /hadoop/avro/trunk: CHANGES.txt lang/c++/Makefile.am lang/c++/api/buffer/detail/BufferDetailIterator.hh lang/c++/configure.in lang/c++/m4/m4_ax_boost_filesystem.m4

Author: sbanacho
Date: Sat Apr 17 16:33:09 2010
New Revision: 935204

URL: http://svn.apache.org/viewvc?rev=935204&view=rev
Log:
AVRO-518. Add link to boost filesystem library.  Contributed by John Plevyak.

Added:
    hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_filesystem.m4
Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/lang/c++/Makefile.am
    hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetailIterator.hh
    hadoop/avro/trunk/lang/c++/configure.in

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=935204&r1=935203&r2=935204&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Sat Apr 17 16:33:09 2010
@@ -41,6 +41,8 @@ Avro 1.4.0 (unreleased)
     AVRO-516. Ruby socket RPC should use big endian buffer lengths.
     (jmhodges)
 
+    AVRO-518. Add link to boost filesystem library.  (John Plevyak via 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=935204&r1=935203&r2=935204&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/Makefile.am (original)
+++ hadoop/avro/trunk/lang/c++/Makefile.am Sat Apr 17 16:33:09 2010
@@ -101,7 +101,7 @@ testgen_LDADD = $(top_builddir)/libavroc
 
 buffertest_SOURCES = test/buffertest.cc 
 buffertest_LDFLAGS = -static -no-install $(BOOST_LDFLAGS)
-buffertest_LDADD = $(top_builddir)/libavrocpp.la $(BOOST_REGEX_LIB) $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB)
+buffertest_LDADD = $(top_builddir)/libavrocpp.la $(BOOST_REGEX_LIB) $(BOOST_THREAD_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB)
 
 # Make sure we never package up '.svn' directories
 dist-hook:

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=935204&r1=935203&r2=935204&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetailIterator.hh (original)
+++ hadoop/avro/trunk/lang/c++/api/buffer/detail/BufferDetailIterator.hh Sat Apr 17 16:33:09 2010
@@ -65,7 +65,7 @@ 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
+#ifdef HAVE_BOOST_ASIO
     operator ConstAsioBuffer() const {
         return ConstAsioBuffer(data(), size());
     }

Modified: hadoop/avro/trunk/lang/c++/configure.in
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/configure.in?rev=935204&r1=935203&r2=935204&view=diff
==============================================================================
--- hadoop/avro/trunk/lang/c++/configure.in (original)
+++ hadoop/avro/trunk/lang/c++/configure.in Sat Apr 17 16:33:09 2010
@@ -23,6 +23,7 @@ AX_BOOST_REGEX
 AX_BOOST_THREAD
 AX_BOOST_SYSTEM
 AX_BOOST_ASIO
+AX_BOOST_FILESYSTEM
 
 # Checks for header files.
 AC_FUNC_ALLOCA

Added: hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_filesystem.m4
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/lang/c%2B%2B/m4/m4_ax_boost_filesystem.m4?rev=935204&view=auto
==============================================================================
--- hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_filesystem.m4 (added)
+++ hadoop/avro/trunk/lang/c++/m4/m4_ax_boost_filesystem.m4 Sat Apr 17 16:33:09 2010
@@ -0,0 +1,115 @@
+# ===========================================================================
+#    http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_FILESYSTEM
+#
+# DESCRIPTION
+#
+#   Test for Filesystem 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_FILESYSTEM_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_FILESYSTEM
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Thomas Porschberg <th...@randspringer.de>
+#   Copyright (c) 2009 Michael Tindal
+#   Copyright (c) 2009 Roman Rybalko <li...@romanr.info>
+#
+#   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 13
+
+AC_DEFUN([AX_BOOST_FILESYSTEM],
+[
+	AC_ARG_WITH([boost-filesystem],
+	AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
+                   [use the Filesystem library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_filesystem_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_filesystem_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
+
+		LIBS_SAVED=$LIBS
+		LIBS="$LIBS $BOOST_SYSTEM_LIB"
+		export LIBS
+
+        AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
+					   ax_cv_boost_filesystem,
+        [AC_LANG_PUSH([C++])
+         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
+                                   [[using namespace boost::filesystem;
+                                   path my_path( "foo/bar/data.txt" );
+                                   return 0;]]),
+            				       ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
+         AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_filesystem" = "xyes"; then
+			AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+            if test "x$ax_boost_user_filesystem_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.{so,dylib,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                 [link_filesystem="no"])
+  				done
+                if test "x$link_program_options" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                 [link_filesystem="no"])
+  				done
+	            fi
+            else
+               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
+				      AC_CHECK_LIB($ax_lib, exit,
+                                   [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                   [link_filesystem="no"])
+                  done
+
+            fi
+			if test "x$link_filesystem" != "xyes"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    		LDFLAGS="$LDFLAGS_SAVED"
+		LIBS="$LIBS_SAVED"
+	fi
+])