diff --git a/daemon/configure.ac b/daemon/configure.ac
index ffbd9a7a479768e353b707554b0cc23c70502eec..56746b3599fd584044226320581ac373ea099db1 100644
--- a/daemon/configure.ac
+++ b/daemon/configure.ac
@@ -349,7 +349,6 @@ AC_ARG_WITH([instant_messaging],
            dnl Fallback to older version
            [with_instant_messaging=no])
     ]);
-AS_IF([test "$with_instant_messaging" != "yes"], [AC_MSG_ERROR([Missing libexpat development files])], [])
 
 AC_DEFINE_UNQUOTED([HAVE_INSTANT_MESSAGING], `if test "x$with_instant_messaging" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have instant messaging support])
 AM_CONDITIONAL(BUILD_INSTANT_MESSAGING, test "x$with_instant_messaging" = "xyes" )
diff --git a/daemon/src/iax/iaxvoiplink.cpp b/daemon/src/iax/iaxvoiplink.cpp
index ccd79ba8b167a028490c7d04f3a712c83d17c3d1..1ca6d675dd6269e0a457c551283e6096edb03d4e 100644
--- a/daemon/src/iax/iaxvoiplink.cpp
+++ b/daemon/src/iax/iaxvoiplink.cpp
@@ -244,12 +244,14 @@ IAXVoIPLink::handleBusy(IAXCall& call)
     call.removeCall();
 }
 
+#if HAVE_INSTANT_MESSAGING
 void
 IAXVoIPLink::handleMessage(iax_event* event, IAXCall& call)
 {
     Manager::instance().incomingMessage(call.getCallId(), call.getPeerNumber(),
                                         std::string((const char*) event->data));
 }
+#endif
 
 void
 IAXVoIPLink::handleRinging(IAXCall& call)
diff --git a/daemon/src/iax/iaxvoiplink.h b/daemon/src/iax/iaxvoiplink.h
index 5f946ae2bea74e0485b50c17e2b561d78d311a9b..1e4a0aef1661bcfbaa3e05a1dc98ed29f65626db 100644
--- a/daemon/src/iax/iaxvoiplink.h
+++ b/daemon/src/iax/iaxvoiplink.h
@@ -94,7 +94,9 @@ class IAXVoIPLink {
         void handleRinging(IAXCall& call);
         void handleAnswerTransfer(iax_event* event, IAXCall& call);
         void handleBusy(IAXCall& call);
+#if HAVE_INSTANT_MESSAGING
         void handleMessage(iax_event* event, IAXCall& call);
+#endif
         void handleHangup(IAXCall& call);
 
         /*