pkg_modules="gobject-2.0 >= 2.0.0"
PKG_CHECK_MODULES(GOBJECT, [$pkg_modules])
-PKG_CHECK_MODULES(BABELTRACE, [babeltrace >= 1.1.0])
+PKG_CHECK_MODULES(BABELTRACE, [babeltrace >= 1.1.0], [],
+ [AC_CHECK_LIB([babeltrace], [bt_context_create], [],
+ [AC_MSG_ERROR([Cannot find the babeltrace library.])]
+ )
+
+# Check for libbabeltrace-ctf
+AC_CHECK_LIB([babeltrace-ctf], [bt_ctf_iter_create], [],
+ [AC_MSG_ERROR([Cannot find the babeltrace-ctf library.])]
+ )
+])
AC_CHECK_LIB([babeltrace], [bt_iter_equals_pos],
[AC_DEFINE([HAVE_BT_ITER_EQUALS_POS],[],[Have equal function])], [])