2003-03-27 Havoc Pennington <hp@redhat.com>
[platform/upstream/dbus.git] / configure.in
index 78db7ba..7212f3b 100644 (file)
@@ -3,7 +3,7 @@ AC_PREREQ(2.52)
 
 AC_INIT(dbus/dbus.h)
 
-AM_INIT_AUTOMAKE(dbus, 0.5)
+AM_INIT_AUTOMAKE(dbus, 0.6)
 
 AM_CONFIG_HEADER(config.h)
 
@@ -31,6 +31,8 @@ AC_ARG_ENABLE(verbose-mode, [  --enable-verbose-mode support verbose debug mode]
 AC_ARG_ENABLE(asserts, [  --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=yes)
 AC_ARG_ENABLE(gcov, [  --enable-gcov compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
 
+AC_ARG_WITH(xml, [  --with-xml=[libxml/expat] XML library to use])
+
 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files 
 dnl and also some stuff in the test/ subdir
 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
@@ -118,8 +120,6 @@ else
   fi
 fi
 
-
-
 AC_CHECK_SIZEOF(char)
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(long)
@@ -134,7 +134,7 @@ AC_C_BIGENDIAN
 AC_CHECK_LIB(socket,socket)
 AC_CHECK_LIB(nsl,gethostbyname)
 
-AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv socketpair)
+AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv socketpair getgrouplist)
 
 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
 
@@ -219,13 +219,64 @@ if test x$dbus_have_struct_cmsgcred = xyes; then
     AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
 fi
 
+
+#### Sort out XML library
+
+# see what we have
+AC_CHECK_LIB(expat, XML_ParserCreate_MM, 
+             [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
+             have_expat=false)
+
+PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
+
+# see what we want to use
+dbus_use_libxml=false
+dbus_use_expat=false
+if test x$with_xml = xexpat; then
+        dbus_use_expat=true
+        if ! $have_expat ; then
+           AC_MSG_ERROR([Explicitly requested expat but expat not found])
+        fi
+elif test x$with_xml = xlibxml; then
+        dbus_use_libxml=true
+        if ! $have_libxml ; then
+           AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
+        fi
+else
+        ### expat is the default because libxml can't currently survive 
+        ### our brutal OOM-handling unit test setup. Need to find the 
+        ### bugs and submit to DV
+        if $have_expat ; then
+                with_xml=expat
+                dbus_use_expat=true
+        elif $have_libxml ; then
+                with_xml=libxml
+                dbus_use_libxml=true
+        else
+                AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
+        fi
+fi
+
+AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
+AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
+
+if $dbus_use_expat; then
+   XML_LIBS=-lexpat
+   XML_CFLAGS=
+fi
+if $dbus_use_libxml; then
+   XML_LIBS=$LIBXML_LIBS
+   XML_CFLAGS=$LIBXML_CFLAGS
+fi
+
+#### Set up final flags
 DBUS_CLIENT_CFLAGS=
 DBUS_CLIENT_LIBS=
 AC_SUBST(DBUS_CLIENT_CFLAGS)
 AC_SUBST(DBUS_CLIENT_LIBS)
 
-DBUS_BUS_CFLAGS=
-DBUS_BUS_LIBS=
+DBUS_BUS_CFLAGS=$XML_CFLAGS
+DBUS_BUS_LIBS=$XML_LIBS
 AC_SUBST(DBUS_BUS_CFLAGS)
 AC_SUBST(DBUS_BUS_LIBS)
 
@@ -329,6 +380,7 @@ echo "
         Building assertions:    ${enable_asserts}
         Building Qt bindings:   ${have_qt}
         Building GLib bindings: ${have_glib}
+        Using XML parser:       ${with_xml}
 "
 
 if test x$enable_tests = xyes; then