In common.h, define func_lib for function objects.  In configure.ac, define HAVE_STD_FUNCTION and HAVE_BOOST_FUNCTION.  Include function headers in ndnboost.
diff --git a/ndnboost/function/detail/function_iterate.hpp b/ndnboost/function/detail/function_iterate.hpp
new file mode 100644
index 0000000..5c41196
--- /dev/null
+++ b/ndnboost/function/detail/function_iterate.hpp
@@ -0,0 +1,16 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2003. Use, modification and
+//  distribution is subject to the Boost Software License, Version
+//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt)
+
+// For more information, see http://www.boost.org
+#if !defined(BOOST_PP_IS_ITERATING)
+# error Boost.Function - do not include this file!
+#endif
+
+#define BOOST_FUNCTION_NUM_ARGS BOOST_PP_ITERATION()
+#include <ndnboost/function/detail/maybe_include.hpp>
+#undef BOOST_FUNCTION_NUM_ARGS
+
diff --git a/ndnboost/function/detail/gen_maybe_include.pl b/ndnboost/function/detail/gen_maybe_include.pl
new file mode 100644
index 0000000..ab4367d
--- /dev/null
+++ b/ndnboost/function/detail/gen_maybe_include.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -w
+#
+# Boost.Function library
+#
+# Copyright (C) 2001-2003 Douglas Gregor (gregod@cs.rpi.edu)
+#
+# Permission to copy, use, sell and distribute this software is granted
+# provided this copyright notice appears in all copies.
+# Permission to modify the code and to distribute modified code is granted
+# provided this copyright notice appears in all copies, and a notice
+# that the code was modified is included with the copyright notice.
+#
+# This software is provided "as is" without express or implied warranty,
+# and with no claim as to its suitability for any purpose.
+#
+# For more information, see http://www.boost.org
+use English;
+
+$max_args = $ARGV[0];
+
+open (OUT, ">maybe_include.hpp") or die("Cannot write to maybe_include.hpp");
+for($on_arg = 0; $on_arg <= $max_args; ++$on_arg) {
+    if ($on_arg == 0) {
+	print OUT "#if";
+    }
+    else {
+	print OUT "#elif";
+    }
+    print OUT " BOOST_FUNCTION_NUM_ARGS == $on_arg\n";
+    print OUT "#  ifndef BOOST_FUNCTION_$on_arg\n";
+    print OUT "#    define BOOST_FUNCTION_$on_arg\n";
+    print OUT "#    include <ndnboost/function/function_template.hpp>\n";
+    print OUT "#  endif\n";
+}
+print OUT "#else\n";
+print OUT "#  error Cannot handle Boost.Function objects that accept more than $max_args arguments!\n";
+print OUT "#endif\n";
diff --git a/ndnboost/function/detail/maybe_include.hpp b/ndnboost/function/detail/maybe_include.hpp
new file mode 100644
index 0000000..a2f003e
--- /dev/null
+++ b/ndnboost/function/detail/maybe_include.hpp
@@ -0,0 +1,267 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2003. Use, modification and
+//  distribution is subject to the Boost Software License, Version
+//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt)
+
+// For more information, see http://www.boost.org
+
+#if BOOST_FUNCTION_NUM_ARGS == 0
+#  ifndef BOOST_FUNCTION_0
+#    define BOOST_FUNCTION_0
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 1
+#  ifndef BOOST_FUNCTION_1
+#    define BOOST_FUNCTION_1
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 2
+#  ifndef BOOST_FUNCTION_2
+#    define BOOST_FUNCTION_2
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 3
+#  ifndef BOOST_FUNCTION_3
+#    define BOOST_FUNCTION_3
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 4
+#  ifndef BOOST_FUNCTION_4
+#    define BOOST_FUNCTION_4
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 5
+#  ifndef BOOST_FUNCTION_5
+#    define BOOST_FUNCTION_5
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 6
+#  ifndef BOOST_FUNCTION_6
+#    define BOOST_FUNCTION_6
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 7
+#  ifndef BOOST_FUNCTION_7
+#    define BOOST_FUNCTION_7
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 8
+#  ifndef BOOST_FUNCTION_8
+#    define BOOST_FUNCTION_8
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 9
+#  ifndef BOOST_FUNCTION_9
+#    define BOOST_FUNCTION_9
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 10
+#  ifndef BOOST_FUNCTION_10
+#    define BOOST_FUNCTION_10
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 11
+#  ifndef BOOST_FUNCTION_11
+#    define BOOST_FUNCTION_11
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 12
+#  ifndef BOOST_FUNCTION_12
+#    define BOOST_FUNCTION_12
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 13
+#  ifndef BOOST_FUNCTION_13
+#    define BOOST_FUNCTION_13
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 14
+#  ifndef BOOST_FUNCTION_14
+#    define BOOST_FUNCTION_14
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 15
+#  ifndef BOOST_FUNCTION_15
+#    define BOOST_FUNCTION_15
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 16
+#  ifndef BOOST_FUNCTION_16
+#    define BOOST_FUNCTION_16
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 17
+#  ifndef BOOST_FUNCTION_17
+#    define BOOST_FUNCTION_17
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 18
+#  ifndef BOOST_FUNCTION_18
+#    define BOOST_FUNCTION_18
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 19
+#  ifndef BOOST_FUNCTION_19
+#    define BOOST_FUNCTION_19
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 20
+#  ifndef BOOST_FUNCTION_20
+#    define BOOST_FUNCTION_20
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 21
+#  ifndef BOOST_FUNCTION_21
+#    define BOOST_FUNCTION_21
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 22
+#  ifndef BOOST_FUNCTION_22
+#    define BOOST_FUNCTION_22
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 23
+#  ifndef BOOST_FUNCTION_23
+#    define BOOST_FUNCTION_23
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 24
+#  ifndef BOOST_FUNCTION_24
+#    define BOOST_FUNCTION_24
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 25
+#  ifndef BOOST_FUNCTION_25
+#    define BOOST_FUNCTION_25
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 26
+#  ifndef BOOST_FUNCTION_26
+#    define BOOST_FUNCTION_26
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 27
+#  ifndef BOOST_FUNCTION_27
+#    define BOOST_FUNCTION_27
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 28
+#  ifndef BOOST_FUNCTION_28
+#    define BOOST_FUNCTION_28
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 29
+#  ifndef BOOST_FUNCTION_29
+#    define BOOST_FUNCTION_29
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 30
+#  ifndef BOOST_FUNCTION_30
+#    define BOOST_FUNCTION_30
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 31
+#  ifndef BOOST_FUNCTION_31
+#    define BOOST_FUNCTION_31
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 32
+#  ifndef BOOST_FUNCTION_32
+#    define BOOST_FUNCTION_32
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 33
+#  ifndef BOOST_FUNCTION_33
+#    define BOOST_FUNCTION_33
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 34
+#  ifndef BOOST_FUNCTION_34
+#    define BOOST_FUNCTION_34
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 35
+#  ifndef BOOST_FUNCTION_35
+#    define BOOST_FUNCTION_35
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 36
+#  ifndef BOOST_FUNCTION_36
+#    define BOOST_FUNCTION_36
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 37
+#  ifndef BOOST_FUNCTION_37
+#    define BOOST_FUNCTION_37
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 38
+#  ifndef BOOST_FUNCTION_38
+#    define BOOST_FUNCTION_38
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 39
+#  ifndef BOOST_FUNCTION_39
+#    define BOOST_FUNCTION_39
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 40
+#  ifndef BOOST_FUNCTION_40
+#    define BOOST_FUNCTION_40
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 41
+#  ifndef BOOST_FUNCTION_41
+#    define BOOST_FUNCTION_41
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 42
+#  ifndef BOOST_FUNCTION_42
+#    define BOOST_FUNCTION_42
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 43
+#  ifndef BOOST_FUNCTION_43
+#    define BOOST_FUNCTION_43
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 44
+#  ifndef BOOST_FUNCTION_44
+#    define BOOST_FUNCTION_44
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 45
+#  ifndef BOOST_FUNCTION_45
+#    define BOOST_FUNCTION_45
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 46
+#  ifndef BOOST_FUNCTION_46
+#    define BOOST_FUNCTION_46
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 47
+#  ifndef BOOST_FUNCTION_47
+#    define BOOST_FUNCTION_47
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 48
+#  ifndef BOOST_FUNCTION_48
+#    define BOOST_FUNCTION_48
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 49
+#  ifndef BOOST_FUNCTION_49
+#    define BOOST_FUNCTION_49
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#elif BOOST_FUNCTION_NUM_ARGS == 50
+#  ifndef BOOST_FUNCTION_50
+#    define BOOST_FUNCTION_50
+#    include <ndnboost/function/function_template.hpp>
+#  endif
+#else
+#  error Cannot handle Boost.Function objects that accept more than 50 arguments!
+#endif
diff --git a/ndnboost/function/detail/prologue.hpp b/ndnboost/function/detail/prologue.hpp
new file mode 100644
index 0000000..458324c
--- /dev/null
+++ b/ndnboost/function/detail/prologue.hpp
@@ -0,0 +1,26 @@
+// Boost.Function library
+
+//  Copyright Douglas Gregor 2002-2003. Use, modification and
+//  distribution is subject to the Boost Software License, Version
+//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt)
+
+// For more information, see http://www.boost.org
+
+#ifndef BOOST_FUNCTION_PROLOGUE_HPP
+#define BOOST_FUNCTION_PROLOGUE_HPP
+#  include <cassert>
+#  include <algorithm>
+#  include <ndnboost/config/no_tr1/functional.hpp> // unary_function, binary_function
+#  include <ndnboost/throw_exception.hpp>
+#  include <ndnboost/config.hpp>
+#  include <ndnboost/function/function_base.hpp>
+#  include <ndnboost/mem_fn.hpp>
+#  include <ndnboost/type_traits/is_integral.hpp>
+#  include <ndnboost/preprocessor/enum.hpp>
+#  include <ndnboost/preprocessor/enum_params.hpp>
+#  include <ndnboost/preprocessor/cat.hpp>
+#  include <ndnboost/preprocessor/repeat.hpp>
+#  include <ndnboost/preprocessor/inc.hpp>
+#  include <ndnboost/type_traits/is_void.hpp>
+#endif // BOOST_FUNCTION_PROLOGUE_HPP