diff --git a/mex/build/loglikelihood.am b/mex/build/loglikelihood.am
index 4664b4bf27af3f7e5c01b965570bbaba68d03547..7c97bf104675e70c62893a0ac1ec0b3fa639bd7e 100644
--- a/mex/build/loglikelihood.am
+++ b/mex/build/loglikelihood.am
@@ -1,7 +1,8 @@
 vpath %.cc $(top_srcdir)/../../sources/estimation $(top_srcdir)/../../sources/estimation/libmat $(top_srcdir)/../../sources/estimation/utils
 vpath %.hh $(top_srcdir)/../../sources/estimation $(top_srcdir)/../../sources/estimation/libmat
 
-CPPFLAGS += -I$(top_srcdir)/../../sources/estimation/libmat -I$(top_srcdir)/../../sources/estimation/utils
+CPPFLAGS += -I$(top_srcdir)/../../sources/estimation/libmat -I$(top_srcdir)/../../sources/estimation/utils $(BOOST_CPPFLAGS)
+LDFLAGS += $(BOOST_LDFLAGS)
 
 noinst_PROGRAMS = loglikelihood
 
diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac
index e39f90c5695a67fdde646795cf51aaabc5e9c29d..e4bea1f1e7967356d1fdb0993710581007c28467 100644
--- a/mex/build/matlab/configure.ac
+++ b/mex/build/matlab/configure.ac
@@ -59,6 +59,15 @@ AC_PROG_RANLIB
 AX_PROG_LN_S
 AC_PROG_MKDIR_P
 AX_PTHREAD
+# Check for boost libraries used in estimation DLL
+AC_LANG_PUSH([C++])
+AX_BOOST_BASE([1.34])
+CPPFLAGS_SAVED="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+AC_CHECK_HEADER([boost/random/linear_congruential.hpp], [], [AC_MSG_ERROR([Can't find Boost Random Library])])
+AC_CHECK_HEADER([boost/math/distributions/beta.hpp], [], [AC_MSG_ERROR([Can't find Boost Math Library])])
+CPPFLAGS="$CPPFLAGS_SAVED"
+AC_LANG_POP([C++])
 # Check for dlopen(), needed by k_order_perturbation DLL
 AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
 AC_SUBST([LIBADD_DLOPEN])
diff --git a/mex/build/octave/configure.ac b/mex/build/octave/configure.ac
index 626ea6eda56c464c4fd4db4927ae439181488889..a7826460ab13b0e4a81649bd792f22381048e2ab 100644
--- a/mex/build/octave/configure.ac
+++ b/mex/build/octave/configure.ac
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-dnl Copyright (C) 2009 Dynare Team
+dnl Copyright (C) 2009-2010 Dynare Team
 dnl
 dnl This file is part of Dynare.
 dnl
@@ -40,6 +40,15 @@ AC_PROG_RANLIB
 AX_PROG_LN_S
 AC_PROG_MKDIR_P
 AX_PTHREAD
+# Check for boost libraries used in estimation DLL
+AC_LANG_PUSH([C++])
+AX_BOOST_BASE([1.34])
+CPPFLAGS_SAVED="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+AC_CHECK_HEADER([boost/random/linear_congruential.hpp], [], [AC_MSG_ERROR([Can't find Boost Random Library])])
+AC_CHECK_HEADER([boost/math/distributions/beta.hpp], [], [AC_MSG_ERROR([Can't find Boost Math Library])])
+CPPFLAGS="$CPPFLAGS_SAVED"
+AC_LANG_POP([C++])
 # Check for dlopen(), needed by k_order_perturbation DLL
 AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
 AC_SUBST([LIBADD_DLOPEN])