2004-07-24 Havoc Pennington <hp@redhat.com>
[platform/upstream/dbus.git] / configure.in
index 2e32315..67f971c 100644 (file)
@@ -3,7 +3,7 @@ AC_PREREQ(2.52)
 
 AC_INIT(dbus/dbus.h)
 
-AM_INIT_AUTOMAKE(dbus, 0.20)
+AM_INIT_AUTOMAKE(dbus, 0.21)
 
 AM_CONFIG_HEADER(config.h)
 
@@ -35,9 +35,10 @@ AC_ARG_ENABLE(doxygen-docs,     [  --enable-doxygen-docs     build DOXYGEN docum
 AC_ARG_ENABLE(gcov,             [  --enable-gcov         compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
 AC_ARG_ENABLE(abstract-sockets, [  --enable-abstract-sockets  use abstract socket namespace (linux only)],enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
 AC_ARG_ENABLE(gcj,              [  --enable-gcj          build gcj bindings],enable_gcj=$enableval,enable_gcj=no)
-AC_ARG_ENABLE(mono,             [  --enable-mono         build mono bindings],enable_mono=$enableval,enable_mono=no)
+AC_ARG_ENABLE(mono,             [  --enable-mono         build mono bindings],enable_mono=$enableval,enable_mono=auto)
+AC_ARG_ENABLE(mono_docs,        [  --enable-mono-docs    build mono docs],enable_mono_docs=$enableval,enable_mono_docs=auto)
 AC_ARG_ENABLE(python,           [  --enable-python       build python bindings],enable_python=$enableval,enable_python=auto)
-
+AC_ARG_ENABLE(selinux,          [  --enable-selinux      build with SELinux support],enable_selinux=$enableval,enable_selinux=auto)
 
 AC_ARG_WITH(xml,                [  --with-xml=[libxml/expat]           XML library to use])
 AC_ARG_WITH(init-scripts,       [  --with-init-scripts=[redhat]        Style of init scripts to install])
@@ -184,32 +185,99 @@ AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
 AM_PROG_LIBTOOL
 
 #### Look for mono
-AC_CHECK_TOOL(MCS, mcs, mcs)
-if test -z "$MCS" ; then
-     have_mcs=no
+MONO_REQUIRED_VERSION=0.95
+AC_SUBST(MONO_REQUIRED_VERSION)
+PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, have_mono=true, have_mono=false)
+
+if test "x$have_mono" = "xtrue"; then
+if test `uname -s` = "Darwin"; then
+       AC_PATH_PROG(RUNTIME, mint, no)
+       AC_PATH_PROG(CSC, mcs, no)
+       LIB_PREFIX=
+    LIB_SUFFIX=.dylib
 else
-     have_mcs=yes
-     if test "x${MCSFLAGS-unset}" = xunset; then
-        MCSFLAGS="" ### put default MCSFLAGS here
-     fi
-     AC_SUBST(MCSFLAGS)
+       AC_PATH_PROG(RUNTIME, mono, no)
+       AC_PATH_PROG(CSC, mcs, no)
+       LIB_PREFIX=.so
+    LIB_SUFFIX=
+fi
+else
+AC_PATH_PROG(CSC, csc.exe, no)
+RUNTIME=
+LIB_PREFIX=
+LIB_SUFFIX=.dylib
 fi
 
-if test x$enable_mono = xauto ; then
+if test x$enable_mono = xyes; then
     if test x$have_mcs = xno ; then
+       AC_MSG_ERROR([Building Mono bindings explicitly required, but mcs compiler not found])
+    fi
+
+    ### Test for GACUTIL
+    AC_PATH_PROG(GACUTIL, gacutil, no)
+    if test "x$GACUTIL" = "xno" ; then
+        AC_MSG_ERROR([No gacutil tool found])
+    fi
+
+    AC_SUBST(GACUTIL)
+fi
+
+if test x$enable_mono = xauto ; then
+    if test x$CSC = xno ; then
         enable_mono=no
     else
-        enable_mono=yes
+       ### Test for GACUTIL
+       AC_PATH_PROG(GACUTIL, gacutil, no)
+       if test "x$GACUTIL" = "xno" ; then
+          enable_mono=no
+       else
+          enable_mono=yes
+       fi
     fi
 fi
 
-if test x$enable_mono = xyes; then
-    if test x$have_mcs = xno ; then
-       AC_MSG_ERROR([Building Mono bindings explicitly required, but mcs compiler not found])
+AC_SUBST(RUNTIME)
+AC_SUBST(CSC)
+AC_SUBST(GACUTIL)
+AC_SUBST(LIB_PREFIX)
+AC_SUBST(LIB_SUFFIX)
+
+AM_CONDITIONAL(DBUS_USE_CSC, test x$enable_mono = xyes)
+
+#### Look for monodoc
+MONODOC_REQUIRED_VERSION=0.16
+AC_SUBST(MONODOC_REQUIRED_VERSION)
+PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, have_monodoc=yes, have_monodoc=no)
+
+if test x$enable_mono_docs = xyes; then
+    if test x$have_monodoc = xno ; then
+       AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
+    else
+        AC_PATH_PROG(MONODOC, monodoc, no)
+        if test x$MONODOC = xno; then
+           AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])       
+       fi
+    fi
+fi
+
+if test x$enable_mono_docs = xauto ; then
+    if test x$have_monodoc = xno ; then
+        enable_mono_docs=no
+       MONODOC=
+    else
+        AC_PATH_PROG(MONODOC, monodoc, no)
+        if test x$MONODOC = xno; then
+           enable_mono_docs=no
+           MONODOC=
+       else
+          enable_mono_docs=yes
+        fi
     fi
 fi
 
-AM_CONDITIONAL(DBUS_USE_MCS, test x$enable_mono = xyes)
+AC_SUBST(MONODOC)
+
+AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_mono_docs" = "xyes")
 
 changequote(,)dnl
 # let ourselves use our own unstable API
@@ -557,15 +625,12 @@ if test x$enable_abstract_sockets = xno; then
 fi
 
 if test x$have_abstract_sockets = xyes ; then
-   abstract_sockets=1
    DBUS_PATH_OR_ABSTRACT=abstract
+   AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
 else
-   abstract_sockets=0
    DBUS_PATH_OR_ABSTRACT=path
 fi
 
-AC_DEFINE_UNQUOTED(HAVE_ABSTRACT_SOCKETS, $abstract_sockets, [Have abstract socket namespace])
-
 # this is used in addresses to prefer abstract, e.g. 
 # unix:path=/foo or unix:abstract=/foo 
 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
@@ -607,6 +672,12 @@ else
         fi
 fi
 
+if $dbus_use_libxml ; then
+       dnl libxml OOM handling is a bit broken
+       AC_MSG_WARN([libxml loader is not as robust as the expat one wrt. OOM handling])
+fi
+
+
 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
 
@@ -619,6 +690,40 @@ if $dbus_use_libxml; then
    XML_CFLAGS=$LIBXML_CFLAGS
 fi
 
+# SELinux detection
+if test x$enable_selinux = xno ; then
+    have_selinux=no;
+else
+    # See if we have SELinux library
+    AC_CHECK_LIB(selinux, is_selinux_enabled, 
+                 have_selinux=yes, have_selinux=no)
+
+    # see if we have the SELinux header with the new D-BUS stuff in it
+    if test x$have_selinux = xyes ; then
+        AC_EGREP_HEADER(DBUS__ACQUIRE_SVC, av_permissions.h,
+                        have_selinux=yes, have_selinux=no)
+    fi
+
+    if test x$enable_selinux = xauto ; then
+        if test x$have_selinux = xno ; then
+                AC_MSG_WARN([Sufficiently new SELinux library not found])
+        fi
+    else 
+        if test x$have_selinux = xno ; then
+                AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
+        fi
+    fi
+fi
+
+AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
+
+if test x$have_selinux = xyes ; then
+    SELINUX_LIBS=-lselinux
+    AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
+else
+    SELINUX_LIBS=
+fi
+
 #### Set up final flags
 DBUS_CLIENT_CFLAGS=
 DBUS_CLIENT_LIBS=
@@ -626,7 +731,7 @@ AC_SUBST(DBUS_CLIENT_CFLAGS)
 AC_SUBST(DBUS_CLIENT_LIBS)
 
 DBUS_BUS_CFLAGS=$XML_CFLAGS
-DBUS_BUS_LIBS=$XML_LIBS
+DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS"
 AC_SUBST(DBUS_BUS_CFLAGS)
 AC_SUBST(DBUS_BUS_LIBS)
 
@@ -695,6 +800,8 @@ AC_SUBST(DBUS_GTK_CFLAGS)
 AC_SUBST(DBUS_GTK_LIBS)
 
 # Qt detection
+AC_PATH_PROG(QT_MOC, moc, no)
+
 have_qt=no
 AC_MSG_CHECKING([for qglobal.h])
 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
@@ -937,6 +1044,7 @@ TEST_PATH(GLIB_SERVICE_BINARY, test-service-glib)
 TEST_PATH(EXIT_BINARY, test-exit)
 TEST_PATH(SEGFAULT_BINARY, test-segfault)
 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
+AC_SUBST(ABSOLUTE_TOP_BUILDDIR)
 
 #### Find socket directories
 if ! test -z "$TMPDIR" ; then
@@ -1002,7 +1110,6 @@ fi
 
 AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
 
-
 AC_OUTPUT([
 Doxyfile
 dbus/dbus-arch-deps.h
@@ -1014,12 +1121,17 @@ Makefile
 dbus/Makefile
 glib/Makefile
 python/Makefile
+python/examples/Makefile
 qt/Makefile
 gcj/Makefile
 gcj/org/Makefile
 gcj/org/freedesktop/Makefile
 gcj/org/freedesktop/dbus/Makefile
 mono/Makefile
+mono/AssemblyInfo.cs
+mono/dbus-sharp.dll.config
+mono/example/Makefile
+mono/doc/Makefile
 bus/Makefile
 tools/Makefile
 test/Makefile
@@ -1027,6 +1139,7 @@ test/glib/Makefile
 doc/Makefile
 dbus-1.pc
 dbus-glib-1.pc
+dbus-sharp.pc
 test/data/valid-config-files/debug-allow-all.conf
 test/data/valid-config-files/debug-allow-all-sha1.conf
 test/data/valid-service-files/debug-echo.service
@@ -1069,12 +1182,11 @@ fi
 
 if test x$enable_mono = xyes ; then
 echo \
-"        mcs:                    ${MCS}
-       mcsflags:                 ${MCSFLAGS}
+"        csc:                    ${CSC}
 "
 else
 echo \
-"        mcs:                      (not enabled)
+"        csc:                      (not enabled)
 "
 fi
 
@@ -1088,6 +1200,9 @@ echo "
         Building Qt bindings:     ${have_qt}
         Building GLib bindings:   ${have_glib}
         Building Python bindings: ${have_python}
+        Building SELinux support: ${have_selinux}
+       Building Mono bindings:   ${enable_mono}
+       Building Mono docs:       ${enable_mono_docs}
         Building GTK+ tools:      ${have_gtk}
         Building X11 code:        ${enable_x11}
         Building Doxygen docs:    ${enable_doxygen_docs}