2003-06-22 Havoc Pennington <hp@pobox.com>
authorHavoc Pennington <hp@redhat.com>
Sun, 22 Jun 2003 05:53:06 +0000 (05:53 +0000)
committerHavoc Pennington <hp@redhat.com>
Sun, 22 Jun 2003 05:53:06 +0000 (05:53 +0000)
* mono/*, gcj/*, configure.in, Makefile.am:
Check in makefiles and subdirs for mono and gcj bindings.
Neither binding actually exists, just trying to get through
all the build and other boring bits.

ChangeLog
Makefile.am
configure.in
gcj/.cvsignore [new file with mode: 0644]
gcj/Hello.java [new file with mode: 0644]
gcj/Makefile.am [new file with mode: 0644]
mono/.cvsignore [new file with mode: 0644]
mono/Makefile.am [new file with mode: 0644]
mono/Message.cs [new file with mode: 0644]
mono/Test.cs [new file with mode: 0644]

index 7bebaaa..81f20c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-06-22  Havoc Pennington  <hp@pobox.com>
+
+       * mono/*, gcj/*, configure.in, Makefile.am: 
+       Check in makefiles and subdirs for mono and gcj bindings. 
+       Neither binding actually exists, just trying to get through 
+       all the build and other boring bits.
+
 2003-06-21  Philip Blundell  <philb@gnu.org>
 
        * tools/dbus-monitor.1: Updated.
index 4b733db..7384af0 100644 (file)
@@ -8,7 +8,16 @@ if HAVE_QT
    QT_SUBDIR=qt
 endif
 
-SUBDIRS=dbus bus test doc $(GLIB_SUBDIR) $(QT_SUBDIR) tools
+if DBUS_USE_GCJ
+   GCJ_SUBDIR=gcj
+endif
+
+if DBUS_USE_MCS
+   MONO_SUBDIR=mono
+endif
+
+
+SUBDIRS=dbus bus test doc $(GLIB_SUBDIR) $(GCJ_SUBDIR) $(MONO_SUBDIR) $(QT_SUBDIR) tools
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = dbus-1.pc $(GLIB_PC)
index a51f815..f2ca23e 100644 (file)
@@ -33,7 +33,8 @@ AC_ARG_ENABLE(checks,           [  --enable-checks       include sanity checks o
 AC_ARG_ENABLE(docs,             [  --enable-docs         build documentation (requires Doxygen and jade)],enable_docs=$enableval,enable_docs=auto)
 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_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])
@@ -134,6 +135,63 @@ else
   fi
 fi
 
+#### can't use AM_PROG_GCJ since it fails fatally if no gcj found
+AC_CHECK_PROGS(GCJ, gcj, gcj)
+if test -z "$GCJ" ; then
+     have_gcj=no
+else
+     have_gcj=yes
+     if test "x${GCJFLAGS-unset}" = xunset; then
+        GCJFLAGS="-g -O2 -Wall"
+     fi
+     AC_SUBST(GCJFLAGS)
+     _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(GCJ)])
+fi
+
+if test x$enable_gcj = xauto ; then
+    if test x$have_gcj = xno ; then
+        enable_gcj=no
+    else
+        enable_gcj=yes
+    fi
+fi
+
+if test x$enable_gcj = xyes; then
+    if test x$have_gcj = xno ; then
+       AC_MSG_ERROR([Building gcj explicitly required, but gcj not found])
+    fi
+fi
+
+AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
+
+#### Look for mono
+AC_CHECK_TOOL(MCS, mcs, mcs)
+if test -z "$MCS" ; then
+     have_mcs=no
+else
+     have_mcs=yes
+     if test "x${MCSFLAGS-unset}" = xunset; then
+        MCSFLAGS="" ### put default MCSFLAGS here
+     fi
+     AC_SUBST(MCSFLAGS)
+fi
+
+if test x$enable_mono = xauto ; then
+    if test x$have_mcs = xno ; then
+        enable_mono=no
+    else
+        enable_mono=yes
+    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])
+    fi
+fi
+
+AM_CONDITIONAL(DBUS_USE_MCS, test x$enable_mono = xyes)
+
 changequote(,)dnl
 # let ourselves use our own unstable API
 CPPFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE=1 $CPPFLAGS"
@@ -736,6 +794,8 @@ Makefile
 dbus/Makefile
 glib/Makefile
 qt/Makefile
+gcj/Makefile
+mono/Makefile
 bus/Makefile
 tools/Makefile
 test/Makefile
@@ -765,8 +825,29 @@ echo "
        cppflags:                 ${CPPFLAGS}
        cxxflags:                 ${CXXFLAGS}
         Doxygen:                  ${DOXYGEN}
-        db2html:                  ${DB2HTML}
+        db2html:                  ${DB2HTML}"
+
+if test x$enable_gcj = xyes ; then
+echo \
+"        gcj:                    ${GCJ}
+       gcjflags:                 ${GCJFLAGS}"
+else
+echo \
+"        gcj:                      (not enabled)"
+fi
+
+if test x$enable_mono = xyes ; then
+echo \
+"        mcs:                    ${MCS}
+       mcsflags:                 ${MCSFLAGS}
+"
+else
+echo \
+"        mcs:                      (not enabled)
+"
+fi
 
+echo "
         Maintainer mode:          ${USE_MAINTAINER_MODE}
         gcc coverage profiling:   ${enable_gcov}
         Building unit tests:      ${enable_tests}
diff --git a/gcj/.cvsignore b/gcj/.cvsignore
new file mode 100644 (file)
index 0000000..e250e08
--- /dev/null
@@ -0,0 +1,13 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
+dbus-test
+*.bb
+*.bbg
+*.gcov
+*.da
+dbus-arch-deps.h
+.dbus-keyrings
diff --git a/gcj/Hello.java b/gcj/Hello.java
new file mode 100644 (file)
index 0000000..b7a1018
--- /dev/null
@@ -0,0 +1,6 @@
+
+class Hello {
+    public static void main(String[] args) {
+        System.out.println("Hello World!"); //Display the string.
+    }
+}
\ No newline at end of file
diff --git a/gcj/Makefile.am b/gcj/Makefile.am
new file mode 100644 (file)
index 0000000..8381afe
--- /dev/null
@@ -0,0 +1,5 @@
+noinst_PROGRAMS=hello
+
+hello_SOURCES=Hello.java
+
+hello_LDFLAGS=--main=Hello
diff --git a/mono/.cvsignore b/mono/.cvsignore
new file mode 100644 (file)
index 0000000..7657837
--- /dev/null
@@ -0,0 +1,14 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
+*.bb
+*.bbg
+*.gcov
+*.da
+.dbus-keyrings
+*.dll
+*.exe
+test-dbus-sharp
diff --git a/mono/Makefile.am b/mono/Makefile.am
new file mode 100644 (file)
index 0000000..d81bcc2
--- /dev/null
@@ -0,0 +1,25 @@
+DESTDIR=
+
+DLLS=dbus-sharp.dll
+NOINST_EXES=test-dbus-sharp
+
+DBUS_SHARP_FILES=Message.cs
+TEST_DBUS_SHARP_FILES=Test.cs
+
+all: $(DLLS) $(NOINST_EXES)
+
+dbus-sharp.dll: $(DBUS_SHARP_FILES)
+       $(MCS) $(MCSFLAGS) --unsafe --target library -o dbus-sharp.dll --recurse '$(DBUS_SHARP_FILES)'
+
+test-dbus-sharp: $(TEST_DBUS_SHARP_FILES)
+       $(MCS) $(MCSFLAGS) --unsafe --target exe -L . -r dbus-sharp.dll -o test-dbus-sharp --recurse '$(TEST_DBUS_SHARP_FILES)'
+
+clean:
+       rm -f $(DLLS) $(NOINST_EXES)
+
+install: all
+       ../mkinstalldirs $(DESTDIR)$(prefix)/lib && \
+       cp $(DLLS) $(DESTDIR)$(prefix)/lib || exit 1
+
+EXTRA_DIST=$(DBUS_SHARP_FILES)
+
diff --git a/mono/Message.cs b/mono/Message.cs
new file mode 100644 (file)
index 0000000..84bd12e
--- /dev/null
@@ -0,0 +1,50 @@
+namespace DBus {
+  
+  using System;
+  using System.Runtime.InteropServices;
+  
+  public class Message {
+
+    public Message (string name,
+                    string dest_service) {
+      raw = dbus_message_new (name, dest_service);
+    }
+
+    public string Name {
+      get {
+        return dbus_message_get_name (raw);
+      }
+    }
+    
+    IntPtr raw;
+
+    ~Message () {
+      dbus_message_unref (raw);
+    }
+    
+    Message (IntPtr r) {
+      raw = r;
+      dbus_message_ref (r);
+    }
+    
+    // static constructor runs before any methods 
+    static Message () {
+      
+    }
+      
+    const string libname = "libdbus-1.so.0";
+    
+    [DllImport (libname, EntryPoint="dbus_message_new")]
+      private extern static IntPtr dbus_message_new (string name,
+                                                     string dest_service);
+
+    [DllImport (libname, EntryPoint="dbus_message_unref")]
+      private extern static void dbus_message_unref (IntPtr ptr);
+
+    [DllImport (libname, EntryPoint="dbus_message_ref")]
+      private extern static void dbus_message_ref (IntPtr ptr);
+
+    [DllImport (libname, EntryPoint="dbus_message_get_name")]
+      private extern static string dbus_message_get_name (IntPtr ptr);
+  }
+}
diff --git a/mono/Test.cs b/mono/Test.cs
new file mode 100644 (file)
index 0000000..ffe7d0a
--- /dev/null
@@ -0,0 +1,12 @@
+
+using System;
+
+class Test {  
+  static void Main() {
+    DBus.Message m;
+
+    m = new DBus.Message ("org.freedesktop.Foo", null);
+
+    Console.WriteLine ("Message name is {0}\n", m.Name);
+  }
+}