diff --git a/configure.ac b/configure.ac
index 2ff1919c8f9a39f11c3ddde4913dc38929a630c2..d9723a15af853fa8cf5afaa9df7f79178e412cd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,15 +240,25 @@ AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
 
 
 dnl Check for IAX
-AC_ARG_ENABLE(iax2,
- AS_HELP_STRING(
-   [--disable-iax2],
-   [disable iax2 library support @<:@default=no@:>@]
- ),
- [with_iax2=$enableval],
- [with_iax2=yes]
-)
-AM_CONDITIONAL(USE_IAX, test x$with_iax2 = xyes)
+AC_ARG_WITH([iax2],
+  [AS_HELP_STRING([--without-iax2],
+    [disable support for the iax2 protocol])],
+  [],
+  [with_iax2=yes])
+
+LIBIAX2=
+AS_IF([test "x$with_iax2" != xno],
+  [AC_CHECK_HEADER([iax2.h], , AC_MSG_FAILURE([Unable to find the libiax2 headers (you may need to install the dev package).    You may use --without-iax2 to compile without iax2 protocol support.]))]
+  [AC_CHECK_LIB([iax2], [speex_decode_int],
+    [],
+    [AC_MSG_FAILURE(
+       [libiax2 link test failed.   You may use --without-iax2 to compile without iax2 protocol support.])]
+       )
+   ]
+   )
+    
+AC_DEFINE([HAVE_IAX2], test "x$with_iax2" = "xyes", [Define if you have libiax2])
+AM_CONDITIONAL(USE_IAX2, test "x$with_iax2" = "xyes" )
 
 dnl Check for readline
 GNUPG_CHECK_READLINE
diff --git a/src/Makefile.am b/src/Makefile.am
index 23eea1f2648a4a4921ffaf8adf15da13c1d441be..bc9cb7aa7ec07fa55ee5093646baf71949c44198 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -14,7 +14,6 @@ endif
 
 if USE_IAX
 # Use the global instead of locally built
-IAX_LIBS = $(top_builddir)/libs/libiax2/src/libiax.la
 #IAX_LIBS =
 IAX_FLAGS = -DUSE_IAX
 #IAX_CFLAGS = -I$(top_srcdir)/libs/libiax2/src/
diff --git a/src/accountcreator.cpp b/src/accountcreator.cpp
index 069644dd8a25c3f2d435023cf452b9b040541778..847dcd502e480a7fe061a2909ece38a8e7402644 100644
--- a/src/accountcreator.cpp
+++ b/src/accountcreator.cpp
@@ -19,7 +19,9 @@
  */
 #include "accountcreator.h"
 #include "sipaccount.h"
+#ifdef HAVE_IAX2
 #include "iaxaccount.h"
+#endif
 
 AccountCreator::AccountCreator()
 {
@@ -37,10 +39,11 @@ AccountCreator::createAccount(AccountType type, AccountID accountID)
     case SIP_ACCOUNT:
       return new SIPAccount(accountID);
     break;
-
+#ifdef HAVE_IAX2
     case IAX_ACCOUNT:
       return new IAXAccount(accountID);
     break;
+#endif
   }
   return 0;
 }
diff --git a/src/audio/codecs/Makefile.am b/src/audio/codecs/Makefile.am
index a6c8c39c39b468f18a4f3308a5b04d0613884d45..80e466d14389feb6623ae66ca00a10051c123725 100644
--- a/src/audio/codecs/Makefile.am
+++ b/src/audio/codecs/Makefile.am
@@ -1,16 +1,18 @@
 sflcodecdir = $(libdir)/sflphone/codecs
 if BUILD_GSM
-	GSM_LIB = libcodec_gsm.so
-	libcodec_gsm_so_SOURCES = gsmcodec.cpp
-	libcodec_gsm_so_CFLAGS = -fPIC -g -Wall
-	libcodec_gsm_so_LDFLAGS = -shared -lc -lgsm
+GSM_LIB = libcodec_gsm.so
+libcodec_gsm_so_SOURCES = gsmcodec.cpp
+libcodec_gsm_so_CFLAGS = -fPIC -g -Wall
+libcodec_gsm_so_LDFLAGS = -shared -lc -lgsm
+INSTALL_GSM_RULE = install-libcodec_gsm_so
 endif
 
 if BUILD_SPEEX
-	SPEEX_LIB = libcodec_speex.so
-	libcodec_speex_so_SOURCES = speexcodec.cpp
-	libcodec_speex_so_CFLAGS = -fPIC -g -Wall
-	libcodec_speex_so_LDFLAGS = -shared -lc -lspeex
+SPEEX_LIB = libcodec_speex.so
+libcodec_speex_so_SOURCES = speexcodec.cpp
+libcodec_speex_so_CFLAGS = -fPIC -g -Wall
+libcodec_speex_so_LDFLAGS = -shared -lc -lspeex
+INSTALL_SPEEX_RULE = install-libcodec_speex_so
 endif
 
 noinst_PROGRAMS = libcodec_ulaw.so libcodec_alaw.so $(GSM_LIB) $(SPEEX_LIB) libcodec_ilbc.so
@@ -31,7 +33,7 @@ libcodec_ilbc_so_LDFLAGS = -shared ilbc/*.o -lc
 
 SUBDIRS = ilbc
 
-install-exec-local:     install-libcodec_ulaw_so install-libcodec_alaw_so install-libcodec_gsm_so install-libcodec_speex_so install-libcodec_ilbc_so
+install-exec-local:  install-libcodec_ulaw_so install-libcodec_alaw_so $(INSTALL_GSM_RULE) $(INSTALL_SPEEX_RULE) install-libcodec_ilbc_so
 uninstall-local:  uninstall-libcodec_ulaw_so uninstall-libcodec_alaw_so uninstall-libcodec_gsm_so uninstall-libcodec_speex_so uninstall-libcodec_ilbc_so
 
 install-libcodec_ulaw_so: libcodec_ulaw.so