diff options
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | Makefile.am | 11 | ||||
| -rw-r--r-- | configure.in | 85 | ||||
| -rw-r--r-- | gcj/.cvsignore | 13 | ||||
| -rw-r--r-- | gcj/Hello.java | 6 | ||||
| -rw-r--r-- | gcj/Makefile.am | 5 | ||||
| -rw-r--r-- | mono/.cvsignore | 14 | ||||
| -rw-r--r-- | mono/Makefile.am | 25 | ||||
| -rw-r--r-- | mono/Message.cs | 50 | ||||
| -rw-r--r-- | mono/Test.cs | 12 | 
10 files changed, 225 insertions, 3 deletions
| @@ -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. diff --git a/Makefile.am b/Makefile.am index 4b733db9..7384af0d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) diff --git a/configure.in b/configure.in index a51f8157..f2ca23e7 100644 --- a/configure.in +++ b/configure.in @@ -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 index 00000000..e250e085 --- /dev/null +++ b/gcj/.cvsignore @@ -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 index 00000000..b7a10180 --- /dev/null +++ b/gcj/Hello.java @@ -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 index 00000000..8381afe6 --- /dev/null +++ b/gcj/Makefile.am @@ -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 index 00000000..7657837d --- /dev/null +++ b/mono/.cvsignore @@ -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 index 00000000..d81bcc28 --- /dev/null +++ b/mono/Makefile.am @@ -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 index 00000000..84bd12ec --- /dev/null +++ b/mono/Message.cs @@ -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 index 00000000..ffe7d0a6 --- /dev/null +++ b/mono/Test.cs @@ -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); +  } +} | 
