diff --git a/.gitignore b/.gitignore
index 38beb5d7dae69d41a269a0fed6c93a4e2bab2ff9..123da9aae877b89bf3a2d1f659a422bf1fe292c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@
 *.Po
 *.Plo
 *.loT
-*.m4
 *.Tpo
 Makefile.in
 Makefile
diff --git a/daemon/.gitignore b/daemon/.gitignore
index 01bcf84a048c656b051dc1a8621adf1c628b4b83..33f0a2cc742f82740882b07dbd8c45d49cc824f3 100644
--- a/daemon/.gitignore
+++ b/daemon/.gitignore
@@ -1,3 +1,4 @@
+aclocal.m4
 
 src/dbus/org.sflphone.SFLphone.service
 src/sflphoned
diff --git a/daemon/configure.ac b/daemon/configure.ac
index e714868aa2824886ac1b85a82ae1d484e6e1cb0d..5196ba421be4d9b964f8c7264bd33db2a091e450 100644
--- a/daemon/configure.ac
+++ b/daemon/configure.ac
@@ -25,24 +25,24 @@ AC_CONFIG_MACRO_DIR([m4])
 dnl What to generate
 AC_CONFIG_FILES([Makefile])
 AC_CONFIG_FILES([libs/Makefile \
-		libs/utilspp/Makefile \
-		libs/utilspp/singleton/Makefile \
-		libs/iax2/Makefile])
+                 libs/utilspp/Makefile \
+                 libs/utilspp/singleton/Makefile \
+                 libs/iax2/Makefile])
 
 AC_CONFIG_FILES([src/Makefile \
-		src/sip/Makefile \
-		src/im/Makefile \
-		src/iax/Makefile \
-		src/audio/Makefile \
-		src/audio/audiortp/Makefile \
-		src/audio/pulseaudio/Makefile \
-		src/audio/alsa/Makefile \
-		src/audio/sound/Makefile \
-		src/audio/codecs/Makefile \
-		src/config/Makefile \
-		src/dbus/Makefile \
-		src/hooks/Makefile \
-		src/history/Makefile])
+        src/sip/Makefile \
+        src/im/Makefile \
+        src/iax/Makefile \
+        src/audio/Makefile \
+        src/audio/audiortp/Makefile \
+        src/audio/pulseaudio/Makefile \
+        src/audio/alsa/Makefile \
+        src/audio/sound/Makefile \
+        src/audio/codecs/Makefile \
+        src/config/Makefile \
+        src/dbus/Makefile \
+        src/hooks/Makefile \
+        src/history/Makefile])
 
 dnl Unit tests section
 AC_CONFIG_FILES([test/Makefile])
@@ -96,17 +96,17 @@ AC_FUNC_MALLOC
 AC_FUNC_MEMCMP
 AC_FUNC_REALLOC
 AC_FUNC_SELECT_ARGTYPES
-	AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
+AC_DIAGNOSE([obsolete],[your code may safely assume C89 semantics that RETSIGTYPE is void.
 Remove this warning and the `AC_CACHE_CHECK' when you adjust the code.])dnl
 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
 [AC_LANG_PROGRAM([#include <sys/types.h>
 #include <signal.h>
 ],
-		 [return *(signal (0, 0)) (0) == 1;])],
-		   [ac_cv_type_signal=int],
-		   [ac_cv_type_signal=void])])
+         [return *(signal (0, 0)) (0) == 1;])],
+           [ac_cv_type_signal=int],
+           [ac_cv_type_signal=void])])
 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
-		    (`int' or `void').])
+            (`int' or `void').])
 
 AC_FUNC_STAT
 AC_FUNC_UTIME_NULL
@@ -158,113 +158,81 @@ dnl pkg-config doesn't like 0.6.0-pre1 version number, it assumes that it is
 dnl more recent than (unreleased) 0.6.0
 DBUS_CPP_REQUIRED_VERSION=0.6.0-pre1
 PKG_CHECK_MODULES(DBUSCPP, dbus-c++-1,,
-	AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)]))
+AC_MSG_ERROR([You need the DBus-c++ libraries (version $DBUS_CPP_REQUIRED_VERSION or better)]))
 
 CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Weffc++ -Wfatal-errors"
 
-AC_SEARCH_LIBS([XML_ParserCreate_MM], [expat], [], [
-        AC_MSG_ERROR([Unable to find libexpat development files])
-])
-
-xml_CFLAGS=
-xml_LIBS=-lexpat
-
-AC_SUBST(xml_CFLAGS)
-AC_SUBST(xml_LIBS)
-
-AC_CHECK_LIB([yaml], yaml_parser_initialize,
-        [AC_CHECK_HEADERS(yaml.h, have_yaml=true, have_yaml=false)],
-        have_yaml=false)
-
-test "$have_yaml" = "false" && AC_MSG_ERROR([libyaml development files missing])
-
-yaml_CFLAGS=
-yaml_LIBS=-lyaml
-AC_SUBST(yaml_CFLAGS)
-AC_SUBST(yaml_LIBS)
+AX_LIB_EXPAT
 
-AC_CHECK_LIB([pthread], pthread_create,
-		[AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)],
-		have_pthread=false)
-
-test "$have_pthread" = "false" && AC_MSG_ERROR([You need the POSIX Thread library (pthreads)])	
-
-AC_CHECK_LIB([pcre], pcre_free,
-		[AC_CHECK_HEADERS(pcre.h, have_pcre=true, have_pcre=false)],
-		have_pcre=false)
+AC_SEARCH_LIBS([yaml_parser_initialize], [yaml], [], [
+    AC_MSG_ERROR([Unable to find yaml development files])
+])
 
-test "$have_pcre" = "false" && AC_MSG_ERROR([You need the Perl-Compatible Regular Expressions library (pcre)])	
+AX_PTHREAD
 
-PCRE_LIBS=-lpcre
-PCRE_CFLAGS=
-AC_SUBST(PCRE_LIBS)
-AC_SUBST(PCRE_CFLAGS)
+AX_PATH_LIB_PCRE
 
 dnl Check for libcppunit-dev
 CPPUNIT_MIN_VERSION=1.12
 PKG_CHECK_MODULES(CPPUNIT, cppunit >= ${CPPUNIT_MIN_VERSION}, AM_CONDITIONAL(BUILD_TEST, test 1 = 1 ), AM_CONDITIONAL(BUILD_TEST, test 0 = 1 ))
 
-# check for libgsm1 (doesn't use pkg-config)
-	dnl Check for libgsm
+dnl check for libgsm1 (doesn't use pkg-config)
+dnl Check for libgsm
 AC_ARG_WITH([gsm], [AS_HELP_STRING([--without-gsm],
-			[disable support for gsm codec])], [], [with_gsm=yes])
+            [disable support for gsm codec])], [], [with_gsm=yes])
 
 LIBGSM=
 AS_IF([test "x$with_gsm" != xno],
-		[AC_CHECK_HEADER([gsm/gsm.h], , AC_MSG_FAILURE([Unable to find the libgsm1 headers (you may need to install the dev package).  You may use --without-gsm to compile without gsm codec support.]))]
-		[AC_CHECK_LIB([gsm], [gsm_decode],
-			[],
-			[AC_MSG_FAILURE(
-				[libgsm link test failed.   You may use --without-gsm to compile without gsm codec support.])]
-			)
-		]
-	 )
+        [AC_CHECK_HEADER([gsm/gsm.h], , AC_MSG_FAILURE([Unable to find the libgsm1 headers (you may need to install the dev package).  You may use --without-gsm to compile without gsm codec support.]))]
+        [AC_CHECK_LIB([gsm], [gsm_decode], [], [
+            AC_MSG_FAILURE([libgsm link test failed. You may use --without-gsm to compile without gsm codec support.])
+        ])
+    ])
 
 AC_DEFINE_UNQUOTED([HAVE_GSM], `if test "x$with_gsm" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libgsm])
 AM_CONDITIONAL(BUILD_GSM, test "x$with_gsm" = "xyes" )
 
 dnl Check for libspeex
 AC_ARG_WITH([speex],
-		[AS_HELP_STRING([--without-speex],
-		[disable support for speex codec])],
-		[],
-		[with_speex=yes])
+        [AS_HELP_STRING([--without-speex],
+        [disable support for speex codec])],
+        [],
+        [with_speex=yes])
 
 AS_IF([test "x$with_speex" != xno],
-		[AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Unable to find the libspeex headers (you may need to install the dev package).  You may use --without-speex to compile without speex codec support.]))]
-		[AC_CHECK_LIB([speex], [speex_decode_int],
-		[],
-		[AC_MSG_FAILURE([libspeex link test failed.   You may use --without-speex to compile without speex codec support.])])
-		])
-		
+        [AC_CHECK_HEADER([speex/speex.h], , AC_MSG_FAILURE([Unable to find the libspeex headers (you may need to install the dev package).  You may use --without-speex to compile without speex codec support.]))]
+        [AC_CHECK_LIB([speex], [speex_decode_int],
+        [],
+        [AC_MSG_FAILURE([libspeex link test failed.   You may use --without-speex to compile without speex codec support.])])
+        ])
+
 AC_DEFINE_UNQUOTED([HAVE_SPEEX], `if test "x$with_speex" = "xyes"; then echo 1; else echo 0; fi`, [Define if you have libspeex])
 AM_CONDITIONAL(BUILD_SPEEX, test "x$with_speex" = "xyes" )
 
 dnl check in case the libspeexdsp is not installed
 AC_CHECK_HEADER([speex/speex_preprocess.h], , AC_MSG_FAILURE([Unable to find the libspeexdsp headers (you may need to install the libspeexdsp-dev package) used for Noise Suppression and Automatic Gain Control.]))
-AC_CHECK_LIB(speexdsp, speex_preprocess_run, [], [], [])
+AC_SEARCH_LIBS([speex_preprocess_run], [speexdsp], [], [
+       AC_MSG_ERROR([Unable to find speexdsp development files])
+])
 
 # check for libcelt
-AC_ARG_WITH([celt],
-		[AS_HELP_STRING([--without-celt],
-		[disable support for celt codec])],
-		[],
-		[with_celt=yes])
+AC_ARG_WITH([celt], [AS_HELP_STRING([--without-celt],
+            [disable support for celt codec])], [], [with_celt=yes])
 
 AS_IF([test "x$with_celt" != xno],
-	[PKG_CHECK_MODULES(CELT, celt >= 0.9.1,
-		[
-			with_celt_91=yes; AC_MSG_NOTICE([Using celt 0.9.1])
-    	],
-    	[
-			PKG_CHECK_MODULES(CELT, celt >= 0.7.1,
+    [PKG_CHECK_MODULES(CELT, celt >= 0.9.1,
+        [
+            with_celt_91=yes; AC_MSG_NOTICE([Using celt 0.9.1])
+        ],
+        [
+            PKG_CHECK_MODULES(CELT, celt >= 0.7.1,
             [
                 with_celt_71=yes; AC_MSG_NOTICE([Using celt 0.7.1])
             ],
             [
                 AC_MSG_FAILURE([libcelt link test failed.   You may use --without-celt to compile without celt codec support.])
             ])
-    	])]
+        ])]
 )
 
 AM_CONDITIONAL(BUILD_CELT_91, test "x$with_celt_91" = "xyes" )
@@ -277,9 +245,9 @@ AC_ARG_WITH([iax2], [AS_HELP_STRING([--without-iax2],
 AC_DEFINE_UNQUOTED([HAVE_IAX], `if test "x$with_iax2" = "xyes"; then echo 1; else echo 0;fi`, [Define if you have libiax2])
 AM_CONDITIONAL(USE_IAX, test "x$with_iax2" = "xyes" )
 
-	dnl Check for network-manager
+    dnl Check for network-manager
 AC_ARG_WITH([networkmanager], [AS_HELP_STRING([--without-networkmanager],
-			[disable support for network-manager events])], [],
+            [disable support for network-manager events])], [],
             [with_networkmanager=yes])
 
 AM_CONDITIONAL(USE_NETWORKMANAGER, test "x$with_networkmanager" = "xyes" )
@@ -296,7 +264,7 @@ AC_DEFUN([BB_ENABLE_DOXYGEN],
         AC_PATH_PROG(DOT, dot, , $PATH)
         test x$DOT = x -a "x$enable_dot" = xyes && AC_MSG_ERROR([could not find dot])
     fi
-	AM_CONDITIONAL(ENABLE_DOXYGEN, test x$DOXYGEN = xyes)
+    AM_CONDITIONAL(ENABLE_DOXYGEN, test x$DOXYGEN = xyes)
 ])
 # Acutally perform the doxygen check
 BB_ENABLE_DOXYGEN
diff --git a/daemon/m4/.gitignore b/daemon/m4/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..464ba5caa6814008d91053646b3d634a4323f2e9
--- /dev/null
+++ b/daemon/m4/.gitignore
@@ -0,0 +1,5 @@
+libtool.m4
+lt~obsolete.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
diff --git a/daemon/m4/ax_lib_expat.m4 b/daemon/m4/ax_lib_expat.m4
new file mode 100644
index 0000000000000000000000000000000000000000..16e66de5d79b39884772eafaa66266ea267e7ee2
--- /dev/null
+++ b/daemon/m4/ax_lib_expat.m4
@@ -0,0 +1,275 @@
+# ===========================================================================
+#       http://www.gnu.org/software/autoconf-archive/ax_lib_expat.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_LIB_EXPAT([MINIMUM-VERSION])
+#
+# DESCRIPTION
+#
+#   This macro provides tests of availability of Expat XML Parser of
+#   particular version or newer. This macro checks for Expat XML Parser
+#   headers and libraries and defines compilation flags
+#
+#   Macro supports following options and their values:
+#
+#   1) Single-option usage:
+#
+#     --with-expat      -- yes, no, or path to Expat XML Parser
+#                          installation prefix
+#
+#   2) Three-options usage (all options are required):
+#
+#     --with-expat=yes
+#     --with-expat-inc  -- path to base directory with Expat headers
+#     --with-expat-lib  -- linker flags for Expat
+#
+#   This macro calls:
+#
+#     AC_SUBST(EXPAT_CFLAGS)
+#     AC_SUBST(EXPAT_LIBS)
+#     AC_SUBST(EXPAT_VERSION)  -- only if version requirement is used
+#
+#   And sets:
+#
+#     HAVE_EXPAT
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Mateusz Loskot <mateusz@loskot.net>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 9
+
+AC_DEFUN([AX_LIB_EXPAT],
+[
+    AC_ARG_WITH([expat],
+        AS_HELP_STRING([--with-expat=@<:@ARG@:>@],
+            [use Expat XML Parser from given prefix (ARG=path); check standard prefixes (ARG=yes); disable (ARG=no)]
+        ),
+        [
+        if test "$withval" = "yes"; then
+            if test -f /usr/local/include/expat.h ; then
+                expat_prefix=/usr/local
+            elif test -f /usr/include/expat.h ; then
+                expat_prefix=/usr
+            else
+                expat_prefix=""
+            fi
+            expat_requested="yes"
+        elif test -d "$withval"; then
+            expat_prefix="$withval"
+            expat_requested="yes"
+        else
+            expat_prefix=""
+            expat_requested="no"
+        fi
+        ],
+        [
+        dnl Default behavior is implicit yes
+        if test -f /usr/local/include/expat.h ; then
+            expat_prefix=/usr/local
+        elif test -f /usr/include/expat.h ; then
+            expat_prefix=/usr
+        else
+            expat_prefix=""
+        fi
+        ]
+    )
+
+    AC_ARG_WITH([expat-inc],
+        AS_HELP_STRING([--with-expat-inc=@<:@DIR@:>@],
+            [path to Expat XML Parser headers]
+        ),
+        [expat_include_dir="$withval"],
+        [expat_include_dir=""]
+    )
+    AC_ARG_WITH([expat-lib],
+        AS_HELP_STRING([--with-expat-lib=@<:@ARG@:>@],
+            [link options for Expat XML Parser libraries]
+        ),
+        [expat_lib_flags="$withval"],
+        [expat_lib_flags=""]
+    )
+
+    EXPAT_CFLAGS=""
+    EXPAT_LIBS=""
+    EXPAT_VERSION=""
+
+    dnl
+    dnl Collect include/lib paths and flags
+    dnl
+    run_expat_test="no"
+
+    if test -n "$expat_prefix"; then
+        expat_include_dir="$expat_prefix/include"
+        expat_lib_flags="-L$expat_prefix/lib -lexpat"
+        run_expat_test="yes"
+    elif test "$expat_requested" = "yes"; then
+        if test -n "$expat_include_dir" -a -n "$expat_lib_flags"; then
+            run_expat_test="yes"
+        fi
+    else
+        run_expat_test="no"
+    fi
+
+    dnl
+    dnl Check Expat XML Parser files
+    dnl
+    if test "$run_expat_test" = "yes"; then
+
+        saved_CPPFLAGS="$CPPFLAGS"
+        CPPFLAGS="$CPPFLAGS -I$expat_include_dir"
+
+        saved_LDFLAGS="$LDFLAGS"
+        LIBS="$LDFLAGS $expat_lib_flags"
+
+        dnl
+        dnl Check Expat headers
+        dnl
+        AC_MSG_CHECKING([for Expat XML Parser headers in $expat_include_dir])
+
+        AC_LANG_PUSH([C++])
+        AC_COMPILE_IFELSE([
+            AC_LANG_PROGRAM(
+                [[
+@%:@include <expat.h>
+                ]],
+                [[]]
+            )],
+            [
+            EXPAT_CFLAGS="-I$expat_include_dir"
+            expat_header_found="yes"
+            AC_MSG_RESULT([found])
+            ],
+            [
+            expat_header_found="no"
+            AC_MSG_RESULT([not found])
+            ]
+        )
+        AC_LANG_POP([C++])
+
+        dnl
+        dnl Check Expat libraries
+        dnl
+        if test "$expat_header_found" = "yes"; then
+
+            AC_MSG_CHECKING([for Expat XML Parser libraries])
+
+            AC_LANG_PUSH([C++])
+            AC_LINK_IFELSE([
+                AC_LANG_PROGRAM(
+                    [[
+@%:@include <expat.h>
+                    ]],
+                    [[
+XML_Parser p = XML_ParserCreate(NULL);
+XML_ParserFree(p);
+p = NULL;
+                    ]]
+                )],
+                [
+                EXPAT_LIBS="$expat_lib_flags"
+                expat_lib_found="yes"
+                AC_MSG_RESULT([found])
+                ],
+                [
+                expat_lib_found="no"
+                AC_MSG_RESULT([not found])
+                ]
+            )
+            AC_LANG_POP([C++])
+        fi
+
+        CPPFLAGS="$saved_CPPFLAGS"
+        LDFLAGS="$saved_LDFLAGS"
+    fi
+
+    AC_MSG_CHECKING([for Expat XML Parser])
+
+    if test "$run_expat_test" = "yes"; then
+        if test "$expat_header_found" = "yes" -a "$expat_lib_found" = "yes"; then
+
+            AC_SUBST([EXPAT_CFLAGS])
+            AC_SUBST([EXPAT_LIBS])
+
+            HAVE_EXPAT="yes"
+        else
+            HAVE_EXPAT="no"
+        fi
+
+        AC_MSG_RESULT([$HAVE_EXPAT])
+
+        dnl
+        dnl Check Expat version
+        dnl
+        if test "$HAVE_EXPAT" = "yes"; then
+
+            expat_version_req=ifelse([$1], [], [], [$1])
+
+            if test  -n "$expat_version_req"; then
+
+                AC_MSG_CHECKING([if Expat XML Parser version is >= $expat_version_req])
+
+                if test -f "$expat_include_dir/expat.h"; then
+
+                    expat_major=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MAJOR_VERSION.*[0-9]$' | \
+                                    sed -e 's/#define XML_MAJOR_VERSION.//'`
+
+                    expat_minor=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MINOR_VERSION.*[0-9]$' | \
+                                    sed -e 's/#define XML_MINOR_VERSION.//'`
+
+                    expat_revision=`cat $expat_include_dir/expat.h | \
+                                    grep '^#define.*XML_MICRO_VERSION.*[0-9]$' | \
+                                    sed -e 's/#define XML_MICRO_VERSION.//'`
+
+                    EXPAT_VERSION="$expat_major.$expat_minor.$expat_revision"
+                    AC_SUBST([EXPAT_VERSION])
+
+                    dnl Decompose required version string and calculate numerical representation
+                    expat_version_req_major=`expr $expat_version_req : '\([[0-9]]*\)'`
+                    expat_version_req_minor=`expr $expat_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+                    expat_version_req_revision=`expr $expat_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+                    if test "x$expat_version_req_revision" = "x"; then
+                        expat_version_req_revision="0"
+                    fi
+
+                    expat_version_req_number=`expr $expat_version_req_major \* 10000 \
+                                               \+ $expat_version_req_minor \* 100 \
+                                               \+ $expat_version_req_revision`
+
+                    dnl Calculate numerical representation of detected version
+                    expat_version_number=`expr $expat_major \* 10000 \
+                                          \+ $expat_minor \* 100 \
+                                           \+ $expat_revision`
+
+                    expat_version_check=`expr $expat_version_number \>\= $expat_version_req_number`
+                    if test "$expat_version_check" = "1"; then
+                        AC_MSG_RESULT([yes])
+                    else
+                        AC_MSG_RESULT([no])
+                        AC_MSG_WARN([Found Expat XML Parser $EXPAT_VERSION, which is older than required. Possible compilation failure.])
+                    fi
+                else
+                    AC_MSG_RESULT([no])
+                    AC_MSG_WARN([Missing expat.h header. Unable to determine Expat version.])
+                fi
+            fi
+        fi
+
+    else
+        HAVE_EXPAT="no"
+        AC_MSG_RESULT([$HAVE_EXPAT])
+
+        if test "$expat_requested" = "yes"; then
+            AC_MSG_WARN([Expat XML Parser support requested but headers or library not found. Specify valid prefix of Expat using --with-expat=@<:@DIR@:>@ or provide include directory and linker flags using --with-expat-inc and --with-expat-lib])
+        fi
+    fi
+])
diff --git a/daemon/m4/ax_path_lib_pcre.m4 b/daemon/m4/ax_path_lib_pcre.m4
new file mode 100644
index 0000000000000000000000000000000000000000..926e69d272d8288761c21163a96121f9e3691b0d
--- /dev/null
+++ b/daemon/m4/ax_path_lib_pcre.m4
@@ -0,0 +1,90 @@
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_path_lib_pcre.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PATH_LIB_PCRE [(A/NA)]
+#
+# DESCRIPTION
+#
+#   check for pcre lib and set PCRE_LIBS and PCRE_CFLAGS accordingly.
+#
+#   also provide --with-pcre option that may point to the $prefix of the
+#   pcre installation - the macro will check $pcre/include and $pcre/lib to
+#   contain the necessary files.
+#
+#   the usual two ACTION-IF-FOUND / ACTION-IF-NOT-FOUND are supported and
+#   they can take advantage of the LIBS/CFLAGS additions.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#
+#   This program is free software; you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation; either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 7
+
+AC_DEFUN([AX_PATH_LIB_PCRE],[dnl
+AC_MSG_CHECKING([lib pcre])
+AC_ARG_WITH(pcre,
+[  --with-pcre[[=prefix]]    compile xmlpcre part (via libpcre check)],,
+     with_pcre="yes")
+if test ".$with_pcre" = ".no" ; then
+  AC_MSG_RESULT([disabled])
+  m4_ifval($2,$2)
+else
+  AC_MSG_RESULT([(testing)])
+  AC_CHECK_LIB(pcre, pcre_study)
+  if test "$ac_cv_lib_pcre_pcre_study" = "yes" ; then
+     PCRE_LIBS="-lpcre"
+     AC_MSG_CHECKING([lib pcre])
+     AC_MSG_RESULT([$PCRE_LIBS])
+     m4_ifval($1,$1)
+  else
+     OLDLDFLAGS="$LDFLAGS" ; LDFLAGS="$LDFLAGS -L$with_pcre/lib"
+     OLDCPPFLAGS="$CPPFLAGS" ; CPPFLAGS="$CPPFLAGS -I$with_pcre/include"
+     AC_CHECK_LIB(pcre, pcre_compile)
+     CPPFLAGS="$OLDCPPFLAGS"
+     LDFLAGS="$OLDLDFLAGS"
+     if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then
+        AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre)
+        PCRE_LIBS="-L$with_pcre/lib -lpcre"
+        test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include"
+        AC_MSG_CHECKING([lib pcre])
+        AC_MSG_RESULT([$PCRE_LIBS])
+        m4_ifval($1,$1)
+     else
+        AC_MSG_CHECKING([lib pcre])
+        AC_MSG_RESULT([no, (WARNING)])
+        m4_ifval($2,$2)
+     fi
+  fi
+fi
+AC_SUBST([PCRE_LIBS])
+AC_SUBST([PCRE_CFLAGS])
+])
diff --git a/daemon/m4/ax_pthread.m4 b/daemon/m4/ax_pthread.m4
new file mode 100644
index 0000000000000000000000000000000000000000..e20a388ca869b2bf1be9946ef93c37146a9db387
--- /dev/null
+++ b/daemon/m4/ax_pthread.m4
@@ -0,0 +1,309 @@
+# ===========================================================================
+#        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+#   This macro figures out how to build C programs using POSIX threads. It
+#   sets the PTHREAD_LIBS output variable to the threads library and linker
+#   flags, and the PTHREAD_CFLAGS output variable to any special C compiler
+#   flags that are needed. (The user can also force certain compiler
+#   flags/libs to be tested by setting these environment variables.)
+#
+#   Also sets PTHREAD_CC to any special C compiler that is needed for
+#   multi-threaded programs (defaults to the value of CC otherwise). (This
+#   is necessary on AIX to use the special cc_r compiler alias.)
+#
+#   NOTE: You are assumed to not only compile your program with these flags,
+#   but also link it with them as well. e.g. you should link with
+#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
+#
+#   If you are only building threads programs, you may wish to use these
+#   variables in your default LIBS, CFLAGS, and CC:
+#
+#     LIBS="$PTHREAD_LIBS $LIBS"
+#     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+#     CC="$PTHREAD_CC"
+#
+#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
+#   has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
+#   (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+#
+#   Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
+#   PTHREAD_PRIO_INHERIT symbol is defined when compiling with
+#   PTHREAD_CFLAGS.
+#
+#   ACTION-IF-FOUND is a list of shell commands to run if a threads library
+#   is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
+#   is not found. If ACTION-IF-FOUND is not specified, the default action
+#   will define HAVE_PTHREAD.
+#
+#   Please let the authors know if this macro fails on any platform, or if
+#   you have any other suggestions or comments. This macro was based on work
+#   by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
+#   from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
+#   Alejandro Forero Cuervo to the autoconf macro repository. We are also
+#   grateful for the helpful feedback of numerous users.
+#
+#   Updated for Autoconf 2.68 by Daniel Richard G.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
+#   Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 17
+
+AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
+AC_DEFUN([AX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_PUSH([C])
+ax_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test x"$ax_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+#      ... -mt is also the pthreads flag for HP/aCC
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
+        ;;
+
+        *-darwin*)
+        ax_pthread_flags="-pthread $ax_pthread_flags"
+        ;;
+esac
+
+if test x"$ax_pthread_ok" = xno; then
+for flag in $ax_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+                pthread-config)
+                AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
+                if test x"$ax_pthread_config" = xno; then continue; fi
+                PTHREAD_CFLAGS="`pthread-config --cflags`"
+                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+                ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+                        static void routine(void *a) { a = 0; }
+                        static void *start_routine(void *a) { return a; }],
+                       [pthread_t th; pthread_attr_t attr;
+                        pthread_create(&th, 0, start_routine, 0);
+                        pthread_join(th, 0);
+                        pthread_attr_init(&attr);
+                        pthread_cleanup_push(routine, 0);
+                        pthread_cleanup_pop(0) /* ; */])],
+                [ax_pthread_ok=yes],
+                [])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($ax_pthread_ok)
+        if test "x$ax_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$ax_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+        AC_MSG_CHECKING([for joinable pthread attribute])
+        attr_name=unknown
+        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+            AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
+                           [int attr = $attr; return attr /* ; */])],
+                [attr_name=$attr; break],
+                [])
+        done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *-osf* | *-hpux*) flag="-D_REENTRANT";;
+            *solaris*)
+            if test "$GCC" = "yes"; then
+                flag="-D_REENTRANT"
+            else
+                flag="-mt -D_REENTRANT"
+            fi
+            ;;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
+            ax_cv_PTHREAD_PRIO_INHERIT, [
+                AC_LINK_IFELSE([
+                    AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
+                    [ax_cv_PTHREAD_PRIO_INHERIT=yes],
+                    [ax_cv_PTHREAD_PRIO_INHERIT=no])
+            ])
+        AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
+            AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with xlc_r or cc_r
+        if test x"$GCC" != xyes; then
+          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+        else
+          PTHREAD_CC=$CC
+        fi
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$ax_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        ax_pthread_ok=no
+        $2
+fi
+AC_LANG_POP
+])dnl AX_PTHREAD
diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am
index 271c3902d446362786f1df58e1c45fa4cba10767..e6e8986a0f177beae66fd30534f4f491dd527730 100644
--- a/daemon/src/Makefile.am
+++ b/daemon/src/Makefile.am
@@ -73,8 +73,6 @@ libsflphone_la_LDFLAGS = \
 		@SAMPLERATE_LIBS@ \
 		@libssl_LIBS@ \
 		@UUID_LIBS@ \
-		@yaml_LIBS@ \
-		@xml_LIBS@ \
 		@DBUSCPP_LIBS@
 
 libsflphone_la_CFLAGS = \
@@ -87,9 +85,7 @@ libsflphone_la_CFLAGS = \
 		@PULSEAUDIO_CFLAGS@ \
 		@SAMPLERATE_CFLAGS@ \
 		@libssl_CFLAGS@ \
-		@UUID_CFLAGS@ \
-		@yaml_CFLAGS@ \
-	 	@xml_CFLAGS@
+		@UUID_CFLAGS@
 
 libsflphone_la_SOURCES = conference.cpp \
 		voiplink.cpp \
diff --git a/daemon/src/config/Makefile.am b/daemon/src/config/Makefile.am
index f64c876291d13ed2c4f69c956136123553d6df9f..559faf36eb0b8ad9a4b462822f0bea7ab6dce65b 100644
--- a/daemon/src/config/Makefile.am
+++ b/daemon/src/config/Makefile.am
@@ -13,6 +13,4 @@ noinst_HEADERS = \
 	yamlparser.h \
 	yamlnode.h
 
-libconfig_la_LDFLAGS = @yaml_LIBS@
-
-libconfig_la_CXXFLAGS = @yaml_CFLAGS@ -I $(top_srcdir)/src
+libconfig_la_CXXFLAGS = -I $(top_srcdir)/src
diff --git a/gnome/.gitignore b/gnome/.gitignore
index 062344668bf4748809802cfae31ff6e42fbc1fc3..f6e3821328b639b709f4b2e0b6c03bd6d72a355b 100644
--- a/gnome/.gitignore
+++ b/gnome/.gitignore
@@ -1,3 +1,5 @@
+m4
+aclocal.m4
 config.*
 configure
 depcomp
diff --git a/plugins/.gitignore b/plugins/.gitignore
index 2e55b18e4baa7ea3d7a1e4ecc8480d49679eefc0..ad90355f8e8c80a17399279d88ae038db1ea8f0e 100644
--- a/plugins/.gitignore
+++ b/plugins/.gitignore
@@ -1,3 +1,5 @@
+m4
+aclocal.m4
 .cproject
 .project
 .settings/*