OSDN Git Service

* java/awt/Window.java (Window(Window,GraphicsConfiguration)):
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2003 17:54:14 +0000 (17:54 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2003 17:54:14 +0000 (17:54 +0000)
Don't try to find graphics configuration.
* java/awt/Toolkit.java (default_toolkit_name): Use new
Configuration entry.
* gnu/classpath/Configuration.java.in (default_awt_peer_toolkit):
New global.
* configure: Rebuilt.
* configure.in (TOOLKIT): New subst.
(--enable-java-awt) [xlib, gtk]: Set TOOLKIT if required.
Do AWT tests much earlier.  Run Gtk tests.  Make jniinclude
directory.  Make output directories for .c files.
* Makefile.in: Rebuilt.
* Makefile.am (lib_gnu_java_awt_peer_gtk_la_SOURCES): New macro.
(toolexeclib_LTLIBRARIES): Added cond_gtk_ltlibrary.
(all_java_source_files): Added new sources.
($(lib_gnu_java_awt_peer_gtk_la_OBJECTS)): New target.
(gtk_c_files): New macro.
(gtk_c_source_files): New macro.
(cond_gtk_ltlibrary): New macro.
($(gtk_c_files)): New target.
(lib_gnu_java_awt_peer_gtk_la_LIBADD): New macro.
(gtk_awt_peer_sources): New macro.
(gtk_c_headers): New macro.
($(gtk_c_headers)): New target.
(ACLOCAL_AMFLAGS): New macro.
* gtk.m4, glib.m4, libart.m4: New files.
* gnu/java/awt/peer/gtk/GdkFontMetrics.java,
gnu/java/awt/peer/gtk/GdkGraphics.java,
gnu/java/awt/peer/gtk/GtkArg.java,
gnu/java/awt/peer/gtk/GtkArgList.java,
gnu/java/awt/peer/gtk/GtkButtonPeer.java,
gnu/java/awt/peer/gtk/GtkCanvasPeer.java,
gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java,
gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java,
gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
gnu/java/awt/peer/gtk/GtkChoicePeer.java,
gnu/java/awt/peer/gtk/GtkClipboard.java,
gnu/java/awt/peer/gtk/GtkComponentPeer.java,
gnu/java/awt/peer/gtk/GtkContainerPeer.java,
gnu/java/awt/peer/gtk/GtkDialogPeer.java,
gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
gnu/java/awt/peer/gtk/GtkFontPeer.java,
gnu/java/awt/peer/gtk/GtkFramePeer.java,
gnu/java/awt/peer/gtk/GtkGenericPeer.java,
gnu/java/awt/peer/gtk/GtkImage.java,
gnu/java/awt/peer/gtk/GtkImagePainter.java,
gnu/java/awt/peer/gtk/GtkLabelPeer.java,
gnu/java/awt/peer/gtk/GtkListPeer.java,
gnu/java/awt/peer/gtk/GtkMainThread.java,
gnu/java/awt/peer/gtk/GtkMenuBarPeer.java,
gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
gnu/java/awt/peer/gtk/GtkMenuPeer.java,
gnu/java/awt/peer/gtk/GtkOffScreenImage.java,
gnu/java/awt/peer/gtk/GtkPanelPeer.java,
gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java,
gnu/java/awt/peer/gtk/GtkScrollbarPeer.java,
gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,
gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
gnu/java/awt/peer/gtk/GtkTextComponentPeer.java,
gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
gnu/java/awt/peer/gtk/GtkToolkit.java,
gnu/java/awt/peer/gtk/GtkWindowPeer.java,
gnu/java/awt/peer/gtk/TestAWT.java,
gnu/java/awt/peer/gtk/Test.java: New files from Classpath.
* jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,
jni/gtk-peer/gthread-jni.c, jni/gtk-peer/gthread-jni.h,
jni/gtk-peer/gtkpeer.h, jni/classpath/jcl.c, jni/classpath/jcl.h,
jni/classpath/jnilink.c, jni/classpath/jnilink.h,
jni/classpath/native_state.c, jni/classpath/native_state.h,
jni/classpath/primlib.c, jni/classpath/primlib.h: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@62187 138bc75d-0d04-0410-961f-82ee72b054a4

93 files changed:
libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in
libjava/aclocal.m4
libjava/configure
libjava/configure.in
libjava/gcj/Makefile.in
libjava/glib.m4 [new file with mode: 0644]
libjava/gnu/classpath/Configuration.java.in
libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GdkGraphics.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkArg.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkArgList.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkClipboard.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkImage.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkListPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkMainThread.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkToolkit.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/Test.java [new file with mode: 0644]
libjava/gnu/java/awt/peer/gtk/TestAWT.java [new file with mode: 0644]
libjava/gtk.m4 [new file with mode: 0644]
libjava/include/Makefile.in
libjava/include/config.h.in
libjava/java/awt/Toolkit.java
libjava/java/awt/Window.java
libjava/jni/classpath/jcl.c [new file with mode: 0644]
libjava/jni/classpath/jcl.h [new file with mode: 0644]
libjava/jni/classpath/jnilink.c [new file with mode: 0644]
libjava/jni/classpath/jnilink.h [new file with mode: 0644]
libjava/jni/classpath/native_state.c [new file with mode: 0644]
libjava/jni/classpath/native_state.h [new file with mode: 0644]
libjava/jni/classpath/primlib.c [new file with mode: 0644]
libjava/jni/classpath/primlib.h [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c [new file with mode: 0644]
libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c [new file with mode: 0644]
libjava/jni/gtk-peer/gthread-jni.c [new file with mode: 0644]
libjava/jni/gtk-peer/gthread-jni.h [new file with mode: 0644]
libjava/jni/gtk-peer/gtkpeer.h [new file with mode: 0644]
libjava/libart.m4 [new file with mode: 0644]
libjava/testsuite/Makefile.in

index d7989f6..4633436 100644 (file)
@@ -1,3 +1,103 @@
+2003-01-31  Tom Tromey  <tromey@redhat.com>
+
+       * java/awt/Window.java (Window(Window,GraphicsConfiguration)):
+       Don't try to find graphics configuration.
+       * java/awt/Toolkit.java (default_toolkit_name): Use new
+       Configuration entry.
+       * gnu/classpath/Configuration.java.in (default_awt_peer_toolkit):
+       New global.
+       * configure: Rebuilt.
+       * configure.in (TOOLKIT): New subst.
+       (--enable-java-awt) [xlib, gtk]: Set TOOLKIT if required.
+       Do AWT tests much earlier.  Run Gtk tests.  Make jniinclude
+       directory.  Make output directories for .c files.
+       * Makefile.in: Rebuilt.
+       * Makefile.am (lib_gnu_java_awt_peer_gtk_la_SOURCES): New macro.
+       (toolexeclib_LTLIBRARIES): Added cond_gtk_ltlibrary.
+       (all_java_source_files): Added new sources.
+       ($(lib_gnu_java_awt_peer_gtk_la_OBJECTS)): New target.
+       (gtk_c_files): New macro.
+       (gtk_c_source_files): New macro.
+       (cond_gtk_ltlibrary): New macro.
+       ($(gtk_c_files)): New target.
+       (lib_gnu_java_awt_peer_gtk_la_LIBADD): New macro.
+       (gtk_awt_peer_sources): New macro.
+       (gtk_c_headers): New macro.
+       ($(gtk_c_headers)): New target.
+       (ACLOCAL_AMFLAGS): New macro.
+       * gtk.m4, glib.m4, libart.m4: New files.
+       * gnu/java/awt/peer/gtk/GdkFontMetrics.java,
+       gnu/java/awt/peer/gtk/GdkGraphics.java,
+       gnu/java/awt/peer/gtk/GtkArg.java,
+       gnu/java/awt/peer/gtk/GtkArgList.java,
+       gnu/java/awt/peer/gtk/GtkButtonPeer.java,
+       gnu/java/awt/peer/gtk/GtkCanvasPeer.java,
+       gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java,
+       gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java,
+       gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
+       gnu/java/awt/peer/gtk/GtkChoicePeer.java,
+       gnu/java/awt/peer/gtk/GtkClipboard.java,
+       gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+       gnu/java/awt/peer/gtk/GtkContainerPeer.java,
+       gnu/java/awt/peer/gtk/GtkDialogPeer.java,
+       gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
+       gnu/java/awt/peer/gtk/GtkFontPeer.java,
+       gnu/java/awt/peer/gtk/GtkFramePeer.java,
+       gnu/java/awt/peer/gtk/GtkGenericPeer.java,
+       gnu/java/awt/peer/gtk/GtkImage.java,
+       gnu/java/awt/peer/gtk/GtkImagePainter.java,
+       gnu/java/awt/peer/gtk/GtkLabelPeer.java,
+       gnu/java/awt/peer/gtk/GtkListPeer.java,
+       gnu/java/awt/peer/gtk/GtkMainThread.java,
+       gnu/java/awt/peer/gtk/GtkMenuBarPeer.java,
+       gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
+       gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
+       gnu/java/awt/peer/gtk/GtkMenuPeer.java,
+       gnu/java/awt/peer/gtk/GtkOffScreenImage.java,
+       gnu/java/awt/peer/gtk/GtkPanelPeer.java,
+       gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java,
+       gnu/java/awt/peer/gtk/GtkScrollbarPeer.java,
+       gnu/java/awt/peer/gtk/GtkScrollPanePeer.java,
+       gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
+       gnu/java/awt/peer/gtk/GtkTextComponentPeer.java,
+       gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
+       gnu/java/awt/peer/gtk/GtkToolkit.java,
+       gnu/java/awt/peer/gtk/GtkWindowPeer.java,
+       gnu/java/awt/peer/gtk/TestAWT.java,
+       gnu/java/awt/peer/gtk/Test.java: New files from Classpath.
+       * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c,
+       jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,
+       jni/gtk-peer/gthread-jni.c, jni/gtk-peer/gthread-jni.h,
+       jni/gtk-peer/gtkpeer.h, jni/classpath/jcl.c, jni/classpath/jcl.h,
+       jni/classpath/jnilink.c, jni/classpath/jnilink.h,
+       jni/classpath/native_state.c, jni/classpath/native_state.h,
+       jni/classpath/primlib.c, jni/classpath/primlib.h: Likewise.
+
 2003-01-31  Julian Dolby  <dolby@us.ibm.com>
 
        * java/util/Properties.java (load): Ignore backslash before EOF.
index 4d680de..65c1064 100644 (file)
@@ -2,6 +2,8 @@
 
 AUTOMAKE_OPTIONS = foreign
 
+ACLOCAL_AMFLAGS = -I .
+
 if TESTSUBDIR
 SUBDIRS = $(DIRLTDL) testsuite gcj include
 else
@@ -23,7 +25,14 @@ cond_x_ltlibrary =
 xlib_includes =
 endif
 
-toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary)
+if GTK_AWT
+cond_gtk_ltlibrary = lib-gnu-java-awt-peer-gtk.la
+else
+cond_gtk_ltlibrary =
+endif
+
+toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la \
+    $(cond_gtk_ltlibrary) $(cond_x_ltlibrary)
 toolexecmainlib_DATA = libgcj.spec
 
 jardir = $(datadir)/java
@@ -115,6 +124,8 @@ nat_files = $(nat_source_files:.cc=.lo)
 x_nat_files = $(x_nat_source_files:.cc=.lo)
 ## Objects from C sources in subdirs.
 c_files = $(c_source_files:.c=.lo)
+## Objects from gtk-related C sources in subdirs.
+gtk_c_files = $(gtk_c_source_files:.c=.lo)
 ## Objects from Java sources in subdirs.
 javao_files = $(java_source_files:.java=.lo) \
        $(built_java_source_files:.java=.lo)
@@ -140,6 +151,102 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \
        -version-info `grep -v '^\#' $(srcdir)/libtool-version`
 libgcj_la_LINK = $(LIBLINK)
 
+## Gtk JNI sources.
+gtk_c_source_files = \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c        \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c \
+jni/gtk-peer/gthread-jni.c \
+jni/classpath/jcl.c \
+jni/classpath/jnilink.c        \
+jni/classpath/native_state.c \
+jni/classpath/primlib.c
+
+## Java sources for Gtk peers.
+gtk_awt_peer_sources = \
+gnu/java/awt/peer/gtk/GdkFontMetrics.java \
+gnu/java/awt/peer/gtk/GdkGraphics.java \
+gnu/java/awt/peer/gtk/GtkArg.java \
+gnu/java/awt/peer/gtk/GtkArgList.java \
+gnu/java/awt/peer/gtk/GtkButtonPeer.java \
+gnu/java/awt/peer/gtk/GtkCanvasPeer.java \
+gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java        \
+gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java \
+gnu/java/awt/peer/gtk/GtkCheckboxPeer.java \
+gnu/java/awt/peer/gtk/GtkChoicePeer.java \
+gnu/java/awt/peer/gtk/GtkClipboard.java        \
+gnu/java/awt/peer/gtk/GtkComponentPeer.java \
+gnu/java/awt/peer/gtk/GtkContainerPeer.java \
+gnu/java/awt/peer/gtk/GtkDialogPeer.java \
+gnu/java/awt/peer/gtk/GtkFileDialogPeer.java \
+gnu/java/awt/peer/gtk/GtkFontPeer.java \
+gnu/java/awt/peer/gtk/GtkFramePeer.java        \
+gnu/java/awt/peer/gtk/GtkGenericPeer.java \
+gnu/java/awt/peer/gtk/GtkImage.java \
+gnu/java/awt/peer/gtk/GtkImagePainter.java \
+gnu/java/awt/peer/gtk/GtkLabelPeer.java        \
+gnu/java/awt/peer/gtk/GtkListPeer.java \
+gnu/java/awt/peer/gtk/GtkMainThread.java \
+gnu/java/awt/peer/gtk/GtkMenuBarPeer.java \
+gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java        \
+gnu/java/awt/peer/gtk/GtkMenuItemPeer.java \
+gnu/java/awt/peer/gtk/GtkMenuPeer.java \
+gnu/java/awt/peer/gtk/GtkOffScreenImage.java \
+gnu/java/awt/peer/gtk/GtkPanelPeer.java        \
+gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java \
+gnu/java/awt/peer/gtk/GtkScrollPanePeer.java \
+gnu/java/awt/peer/gtk/GtkScrollbarPeer.java \
+gnu/java/awt/peer/gtk/GtkTextAreaPeer.java \
+gnu/java/awt/peer/gtk/GtkTextComponentPeer.java        \
+gnu/java/awt/peer/gtk/GtkTextFieldPeer.java \
+gnu/java/awt/peer/gtk/GtkToolkit.java \
+gnu/java/awt/peer/gtk/GtkWindowPeer.java
+
+## FIXME: GNU make.
+gtk_c_headers = $(patsubst %.java,jniinclude/%.h,$(subst /,_,$(gtk_awt_peer_sources)))
+
+$(gtk_c_headers): $(gtk_awt_peer_sources)
+## FIXME: GNU make.
+       @input=`echo $@ | sed -e 's,jniinclude,,' -e 's,_,.,g' -e 's,.h$$,,'`; \
+       echo "$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input"; \
+       $(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input
+
+lib_gnu_java_awt_peer_gtk_la_SOURCES = \
+$(gtk_awt_peer_sources) \
+$(gtk_c_source_files) \
+jni/gtk-peer/gthread-jni.h \
+jni/gtk-peer/gtkpeer.h \
+jni/classpath/jcl.h \
+jni/classpath/jnilink.h        \
+jni/classpath/native_state.h \
+jni/classpath/primlib.h
+
+lib_gnu_java_awt_peer_gtk_la_LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(LIBART_LIBS)
+
 lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
 org/w3c/dom/CDATASection.java \
 org/w3c/dom/CharacterData.java \
@@ -220,6 +327,7 @@ all_java_source_files = \
     $(built_java_source_files) \
     $(lib_org_xml_sax_la_SOURCES) \
     $(lib_org_w3c_dom_la_SOURCES) \
+    $(gtk_awt_peer_sources) \
     $(x_java_source_files)
 
 all_java_class_files = $(all_java_source_files:.java=.class)
@@ -270,9 +378,18 @@ $(c_files): %.lo: %.c
 $(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
 
 ## FIXME: GNU make.
+$(gtk_c_files): %.lo: %.c
+       $(LTCOMPILE) -c -Ijniinclude -I$(srcdir)/jni/classpath -I$(srcdir)/jni/gtk-peer $(GTK_CFLAGS) $(LIBART_CFLAGS) -o $@ $<
+
+$(gtk_c_files): $(gtk_c_headers)
+
+## FIXME: GNU make.
 $(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java
        $(GCJCOMPILE) -o $@ $<
 
+$(gtk_awt_peer_sources:.java=.lo): %.lo: %.java
+       $(GCJCOMPILE) -fjni -o $@ $<
+
 ## Pass the list of object files to libtool in a temporary file to 
 ## avoid tripping platform command line length limits.
 libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
index 0d7eee7..a646689 100644 (file)
@@ -84,10 +84,19 @@ GCLIBS = @GCLIBS@
 GCOBJS = @GCOBJS@
 GCSPEC = @GCSPEC@
 GCTESTSPEC = @GCTESTSPEC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
 HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
 INCLTDL = @INCLTDL@
 INTERPRETER = @INTERPRETER@
 JC1GCSPEC = @JC1GCSPEC@
+LIBART_CFLAGS = @LIBART_CFLAGS@
+LIBART_CONFIG = @LIBART_CONFIG@
+LIBART_LIBS = @LIBART_LIBS@
 LIBFFI = @LIBFFI@
 LIBGCJDEBUG = @LIBGCJDEBUG@
 LIBGCJTESTSPEC = @LIBGCJTESTSPEC@
@@ -116,6 +125,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
 THREADLIBS = @THREADLIBS@
 THREADOBJS = @THREADOBJS@
 THREADSPEC = @THREADSPEC@
+TOOLKIT = @TOOLKIT@
 VERSION = @VERSION@
 ZINCS = @ZINCS@
 ZLIBS = @ZLIBS@
@@ -132,14 +142,20 @@ toolexeclibdir = @toolexeclibdir@
 toolexecmainlibdir = @toolexecmainlibdir@
 
 AUTOMAKE_OPTIONS = foreign
+
+ACLOCAL_AMFLAGS = -I .
 @TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
 @TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
 @XLIB_AWT_TRUE@cond_x_ltlibrary = @XLIB_AWT_TRUE@libgcjx.la
 @XLIB_AWT_FALSE@cond_x_ltlibrary = 
 @XLIB_AWT_TRUE@xlib_includes = @XLIB_AWT_TRUE@-I../libstdc++-v3/include -I../libstdc++-v3/include/$(target_alias) -I$(srcdir)/../libstdc++-v3/libsupc++
 @XLIB_AWT_FALSE@xlib_includes = 
+@GTK_AWT_TRUE@cond_gtk_ltlibrary = @GTK_AWT_TRUE@lib-gnu-java-awt-peer-gtk.la
+@GTK_AWT_FALSE@cond_gtk_ltlibrary = 
+
+toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la \
+    $(cond_gtk_ltlibrary) $(cond_x_ltlibrary)
 
-toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary)
 toolexecmainlib_DATA = libgcj.spec
 
 jardir = $(datadir)/java
@@ -191,6 +207,7 @@ INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
 nat_files = $(nat_source_files:.cc=.lo)
 x_nat_files = $(x_nat_source_files:.cc=.lo)
 c_files = $(c_source_files:.c=.lo)
+gtk_c_files = $(gtk_c_source_files:.c=.lo)
 javao_files = $(java_source_files:.java=.lo) \
        $(built_java_source_files:.java=.lo)
 
@@ -220,6 +237,96 @@ libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(THREADLIBS) \
 
 libgcj_la_LINK = $(LIBLINK)
 
+gtk_c_source_files = \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c        \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c \
+jni/gtk-peer/gthread-jni.c \
+jni/classpath/jcl.c \
+jni/classpath/jnilink.c        \
+jni/classpath/native_state.c \
+jni/classpath/primlib.c
+
+
+gtk_awt_peer_sources = \
+gnu/java/awt/peer/gtk/GdkFontMetrics.java \
+gnu/java/awt/peer/gtk/GdkGraphics.java \
+gnu/java/awt/peer/gtk/GtkArg.java \
+gnu/java/awt/peer/gtk/GtkArgList.java \
+gnu/java/awt/peer/gtk/GtkButtonPeer.java \
+gnu/java/awt/peer/gtk/GtkCanvasPeer.java \
+gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java        \
+gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java \
+gnu/java/awt/peer/gtk/GtkCheckboxPeer.java \
+gnu/java/awt/peer/gtk/GtkChoicePeer.java \
+gnu/java/awt/peer/gtk/GtkClipboard.java        \
+gnu/java/awt/peer/gtk/GtkComponentPeer.java \
+gnu/java/awt/peer/gtk/GtkContainerPeer.java \
+gnu/java/awt/peer/gtk/GtkDialogPeer.java \
+gnu/java/awt/peer/gtk/GtkFileDialogPeer.java \
+gnu/java/awt/peer/gtk/GtkFontPeer.java \
+gnu/java/awt/peer/gtk/GtkFramePeer.java        \
+gnu/java/awt/peer/gtk/GtkGenericPeer.java \
+gnu/java/awt/peer/gtk/GtkImage.java \
+gnu/java/awt/peer/gtk/GtkImagePainter.java \
+gnu/java/awt/peer/gtk/GtkLabelPeer.java        \
+gnu/java/awt/peer/gtk/GtkListPeer.java \
+gnu/java/awt/peer/gtk/GtkMainThread.java \
+gnu/java/awt/peer/gtk/GtkMenuBarPeer.java \
+gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java        \
+gnu/java/awt/peer/gtk/GtkMenuItemPeer.java \
+gnu/java/awt/peer/gtk/GtkMenuPeer.java \
+gnu/java/awt/peer/gtk/GtkOffScreenImage.java \
+gnu/java/awt/peer/gtk/GtkPanelPeer.java        \
+gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java \
+gnu/java/awt/peer/gtk/GtkScrollPanePeer.java \
+gnu/java/awt/peer/gtk/GtkScrollbarPeer.java \
+gnu/java/awt/peer/gtk/GtkTextAreaPeer.java \
+gnu/java/awt/peer/gtk/GtkTextComponentPeer.java        \
+gnu/java/awt/peer/gtk/GtkTextFieldPeer.java \
+gnu/java/awt/peer/gtk/GtkToolkit.java \
+gnu/java/awt/peer/gtk/GtkWindowPeer.java
+
+
+gtk_c_headers = $(patsubst %.java,jniinclude/%.h,$(subst /,_,$(gtk_awt_peer_sources)))
+
+lib_gnu_java_awt_peer_gtk_la_SOURCES = \
+$(gtk_awt_peer_sources) \
+$(gtk_c_source_files) \
+jni/gtk-peer/gthread-jni.h \
+jni/gtk-peer/gtkpeer.h \
+jni/classpath/jcl.h \
+jni/classpath/jnilink.h        \
+jni/classpath/native_state.h \
+jni/classpath/primlib.h
+
+
+lib_gnu_java_awt_peer_gtk_la_LIBADD = $(GTK_LIBS) $(GLIB_LIBS) $(LIBART_LIBS)
+
 lib_org_w3c_dom_la_SOURCES = org/w3c/dom/Attr.java \
 org/w3c/dom/CDATASection.java \
 org/w3c/dom/CharacterData.java \
@@ -294,6 +401,7 @@ all_java_source_files = \
     $(built_java_source_files) \
     $(lib_org_xml_sax_la_SOURCES) \
     $(lib_org_w3c_dom_la_SOURCES) \
+    $(gtk_awt_peer_sources) \
     $(x_java_source_files)
 
 
@@ -2309,6 +2417,75 @@ org/w3c/dom/traversal/DocumentTraversal.lo \
 org/w3c/dom/traversal/NodeFilter.lo \
 org/w3c/dom/traversal/NodeIterator.lo \
 org/w3c/dom/traversal/TreeWalker.lo
+lib_gnu_java_awt_peer_gtk_la_LDFLAGS = 
+lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES = 
+lib_gnu_java_awt_peer_gtk_la_OBJECTS =  \
+gnu/java/awt/peer/gtk/GdkFontMetrics.lo \
+gnu/java/awt/peer/gtk/GdkGraphics.lo gnu/java/awt/peer/gtk/GtkArg.lo \
+gnu/java/awt/peer/gtk/GtkArgList.lo \
+gnu/java/awt/peer/gtk/GtkButtonPeer.lo \
+gnu/java/awt/peer/gtk/GtkCanvasPeer.lo \
+gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.lo \
+gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.lo \
+gnu/java/awt/peer/gtk/GtkCheckboxPeer.lo \
+gnu/java/awt/peer/gtk/GtkChoicePeer.lo \
+gnu/java/awt/peer/gtk/GtkClipboard.lo \
+gnu/java/awt/peer/gtk/GtkComponentPeer.lo \
+gnu/java/awt/peer/gtk/GtkContainerPeer.lo \
+gnu/java/awt/peer/gtk/GtkDialogPeer.lo \
+gnu/java/awt/peer/gtk/GtkFileDialogPeer.lo \
+gnu/java/awt/peer/gtk/GtkFontPeer.lo \
+gnu/java/awt/peer/gtk/GtkFramePeer.lo \
+gnu/java/awt/peer/gtk/GtkGenericPeer.lo \
+gnu/java/awt/peer/gtk/GtkImage.lo \
+gnu/java/awt/peer/gtk/GtkImagePainter.lo \
+gnu/java/awt/peer/gtk/GtkLabelPeer.lo \
+gnu/java/awt/peer/gtk/GtkListPeer.lo \
+gnu/java/awt/peer/gtk/GtkMainThread.lo \
+gnu/java/awt/peer/gtk/GtkMenuBarPeer.lo \
+gnu/java/awt/peer/gtk/GtkMenuComponentPeer.lo \
+gnu/java/awt/peer/gtk/GtkMenuItemPeer.lo \
+gnu/java/awt/peer/gtk/GtkMenuPeer.lo \
+gnu/java/awt/peer/gtk/GtkOffScreenImage.lo \
+gnu/java/awt/peer/gtk/GtkPanelPeer.lo \
+gnu/java/awt/peer/gtk/GtkPopupMenuPeer.lo \
+gnu/java/awt/peer/gtk/GtkScrollPanePeer.lo \
+gnu/java/awt/peer/gtk/GtkScrollbarPeer.lo \
+gnu/java/awt/peer/gtk/GtkTextAreaPeer.lo \
+gnu/java/awt/peer/gtk/GtkTextComponentPeer.lo \
+gnu/java/awt/peer/gtk/GtkTextFieldPeer.lo \
+gnu/java/awt/peer/gtk/GtkToolkit.lo \
+gnu/java/awt/peer/gtk/GtkWindowPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.lo \
+jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.lo \
+jni/gtk-peer/gthread-jni.lo jni/classpath/jcl.lo \
+jni/classpath/jnilink.lo jni/classpath/native_state.lo \
+jni/classpath/primlib.lo
 libgcjx_la_OBJECTS =  gnu/gcj/xlib/natClip.lo \
 gnu/gcj/xlib/natColormap.lo gnu/gcj/xlib/natDisplay.lo \
 gnu/gcj/xlib/natDrawable.lo gnu/gcj/xlib/natFont.lo \
@@ -2346,9 +2523,8 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 DATA =  $(jar_DATA) $(toolexecmainlib_DATA)
 
 DIST_COMMON =  README COPYING ChangeLog Makefile.am Makefile.in NEWS \
-THANKS acconfig.h acinclude.m4 aclocal.m4 configure configure.in \
-gcj/libgcj-config.h.in gcj/stamp-h2.in include/config.h.in \
-include/stamp-h1.in libgcj-test.spec.in libgcj.spec.in
+THANKS acinclude.m4 aclocal.m4 configure configure.in \
+libgcj-test.spec.in libgcj.spec.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -2448,6 +2624,43 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/gnu/java/awt/GLightweightPeer.P \
 .deps/gnu/java/awt/image/ImageDecoder.P \
 .deps/gnu/java/awt/image/XBMDecoder.P \
+.deps/gnu/java/awt/peer/gtk/GdkFontMetrics.P \
+.deps/gnu/java/awt/peer/gtk/GdkGraphics.P \
+.deps/gnu/java/awt/peer/gtk/GtkArg.P \
+.deps/gnu/java/awt/peer/gtk/GtkArgList.P \
+.deps/gnu/java/awt/peer/gtk/GtkButtonPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkCanvasPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkCheckboxPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkChoicePeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkClipboard.P \
+.deps/gnu/java/awt/peer/gtk/GtkComponentPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkContainerPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkDialogPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkFileDialogPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkFontPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkFramePeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkGenericPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkImage.P \
+.deps/gnu/java/awt/peer/gtk/GtkImagePainter.P \
+.deps/gnu/java/awt/peer/gtk/GtkLabelPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkListPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkMainThread.P \
+.deps/gnu/java/awt/peer/gtk/GtkMenuBarPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkMenuItemPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkMenuPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkOffScreenImage.P \
+.deps/gnu/java/awt/peer/gtk/GtkPanelPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkScrollPanePeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkScrollbarPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkTextAreaPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkTextComponentPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkTextFieldPeer.P \
+.deps/gnu/java/awt/peer/gtk/GtkToolkit.P \
+.deps/gnu/java/awt/peer/gtk/GtkWindowPeer.P \
 .deps/gnu/java/beans/BeanInfoEmbryo.P \
 .deps/gnu/java/beans/EmptyBeanInfo.P \
 .deps/gnu/java/beans/ExplicitBeanInfo.P \
@@ -3724,8 +3937,38 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/javax/transaction/UserTransaction.P \
 .deps/javax/transaction/xa/XAException.P \
 .deps/javax/transaction/xa/XAResource.P \
-.deps/javax/transaction/xa/Xid.P .deps/jni.P .deps/no-threads.P \
-.deps/nogc.P .deps/org/w3c/dom/Attr.P .deps/org/w3c/dom/CDATASection.P \
+.deps/javax/transaction/xa/Xid.P .deps/jni.P .deps/jni/classpath/jcl.P \
+.deps/jni/classpath/jnilink.P .deps/jni/classpath/native_state.P \
+.deps/jni/classpath/primlib.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.P \
+.deps/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.P \
+.deps/jni/gtk-peer/gthread-jni.P .deps/no-threads.P .deps/nogc.P \
+.deps/org/w3c/dom/Attr.P .deps/org/w3c/dom/CDATASection.P \
 .deps/org/w3c/dom/CharacterData.P .deps/org/w3c/dom/Comment.P \
 .deps/org/w3c/dom/DOMException.P .deps/org/w3c/dom/DOMImplementation.P \
 .deps/org/w3c/dom/Document.P .deps/org/w3c/dom/DocumentFragment.P \
@@ -3765,8 +4008,8 @@ DEP_FILES =  .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
 .deps/org/xml/sax/helpers/XMLReaderFactory.P .deps/posix-threads.P \
 .deps/posix.P .deps/prims.P .deps/resolve.P .deps/verify.P \
 .deps/win32-threads.P .deps/win32.P
-SOURCES = $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(lib_org_xml_sax_la_SOURCES) $(lib_org_w3c_dom_la_SOURCES) $(libgcjx_la_SOURCES) $(EXTRA_libgcjx_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(rmic_SOURCES) $(EXTRA_rmic_SOURCES) $(rmiregistry_SOURCES) $(EXTRA_rmiregistry_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
-OBJECTS = $(libgcj_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS) $(lib_org_w3c_dom_la_OBJECTS) $(libgcjx_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(rmic_OBJECTS) $(rmiregistry_OBJECTS) $(gen_from_JIS_OBJECTS)
+SOURCES = $(libgcj_la_SOURCES) $(EXTRA_libgcj_la_SOURCES) $(lib_org_xml_sax_la_SOURCES) $(lib_org_w3c_dom_la_SOURCES) $(lib_gnu_java_awt_peer_gtk_la_SOURCES) $(libgcjx_la_SOURCES) $(EXTRA_libgcjx_la_SOURCES) $(jv_convert_SOURCES) $(EXTRA_jv_convert_SOURCES) $(gij_SOURCES) $(rmic_SOURCES) $(EXTRA_rmic_SOURCES) $(rmiregistry_SOURCES) $(EXTRA_rmiregistry_SOURCES) $(gen_from_JIS_SOURCES) $(EXTRA_gen_from_JIS_SOURCES)
+OBJECTS = $(libgcj_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS) $(lib_org_w3c_dom_la_OBJECTS) $(lib_gnu_java_awt_peer_gtk_la_OBJECTS) $(libgcjx_la_OBJECTS) $(jv_convert_OBJECTS) $(gij_OBJECTS) $(rmic_OBJECTS) $(rmiregistry_OBJECTS) $(gen_from_JIS_OBJECTS)
 
 all: all-redirect
 .SUFFIXES:
@@ -3778,60 +4021,15 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
        cd $(top_builddir) \
          && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in  acinclude.m4
-       cd $(srcdir) && $(ACLOCAL)
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in  acinclude.m4 \
+               ./acinclude.m4 ./aclocal.m4 ./glib.m4 ./gtk.m4 \
+               ./libart.m4
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 
 config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
        $(SHELL) ./config.status --recheck
 $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
        cd $(srcdir) && $(AUTOCONF)
-
-include/config.h: include/stamp-h1
-       @if test ! -f $@; then \
-               rm -f include/stamp-h1; \
-               $(MAKE) include/stamp-h1; \
-       else :; fi
-include/stamp-h1: $(srcdir)/include/config.h.in $(top_builddir)/config.status
-       cd $(top_builddir) \
-         && CONFIG_FILES= CONFIG_HEADERS=include/config.h \
-            $(SHELL) ./config.status
-       @echo timestamp > include/stamp-h1 2> /dev/null
-$(srcdir)/include/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/include/stamp-h1.in
-       @if test ! -f $@; then \
-               rm -f $(srcdir)/include/stamp-h1.in; \
-               $(MAKE) $(srcdir)/include/stamp-h1.in; \
-       else :; fi
-$(srcdir)/include/stamp-h1.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
-       cd $(top_srcdir) && $(AUTOHEADER)
-       @echo timestamp > $(srcdir)/include/stamp-h1.in 2> /dev/null
-
-gcj/libgcj-config.h: gcj/stamp-h2
-       @if test ! -f $@; then \
-               rm -f gcj/stamp-h2; \
-               $(MAKE) gcj/stamp-h2; \
-       else :; fi
-gcj/stamp-h2: $(srcdir)/gcj/libgcj-config.h.in $(top_builddir)/config.status
-       cd $(top_builddir) \
-         && CONFIG_FILES= CONFIG_HEADERS=gcj/libgcj-config.h \
-            $(SHELL) ./config.status
-       @echo timestamp > gcj/stamp-h2 2> /dev/null
-$(srcdir)/gcj/libgcj-config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/gcj/stamp-h2.in
-       @if test ! -f $@; then \
-               rm -f $(srcdir)/gcj/stamp-h2.in; \
-               $(MAKE) $(srcdir)/gcj/stamp-h2.in; \
-       else :; fi
-$(srcdir)/gcj/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
-       cd $(top_srcdir) && $(AUTOHEADER)
-       @echo timestamp > $(srcdir)/gcj/stamp-h2.in 2> /dev/null
-
-mostlyclean-hdr:
-
-clean-hdr:
-
-distclean-hdr:
-       -rm -f include/config.h gcj/libgcj-config.h
-
-maintainer-clean-hdr:
 libgcj.spec: $(top_builddir)/config.status libgcj.spec.in
        cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 libgcj-test.spec: $(top_builddir)/config.status libgcj-test.spec.in
@@ -3906,6 +4104,9 @@ lib-org-xml-sax.la: $(lib_org_xml_sax_la_OBJECTS) $(lib_org_xml_sax_la_DEPENDENC
 lib-org-w3c-dom.la: $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_w3c_dom_la_DEPENDENCIES)
        $(LINK) -rpath $(toolexeclibdir) $(lib_org_w3c_dom_la_LDFLAGS) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_w3c_dom_la_LIBADD) $(LIBS)
 
+lib-gnu-java-awt-peer-gtk.la: $(lib_gnu_java_awt_peer_gtk_la_OBJECTS) $(lib_gnu_java_awt_peer_gtk_la_DEPENDENCIES)
+       $(LINK) -rpath $(toolexeclibdir) $(lib_gnu_java_awt_peer_gtk_la_LDFLAGS) $(lib_gnu_java_awt_peer_gtk_la_OBJECTS) $(lib_gnu_java_awt_peer_gtk_la_LIBADD) $(LIBS)
+
 mostlyclean-binPROGRAMS:
 
 clean-binPROGRAMS:
@@ -4272,32 +4473,29 @@ distclean-generic:
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
 
 maintainer-clean-generic:
-mostlyclean-am:  mostlyclean-hdr mostlyclean-toolexeclibLTLIBRARIES \
-               mostlyclean-compile mostlyclean-libtool \
-               mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
-               mostlyclean-tags mostlyclean-depend mostlyclean-generic
+mostlyclean-am:  mostlyclean-toolexeclibLTLIBRARIES mostlyclean-compile \
+               mostlyclean-libtool mostlyclean-binPROGRAMS \
+               mostlyclean-noinstPROGRAMS mostlyclean-tags \
+               mostlyclean-depend mostlyclean-generic
 
 mostlyclean: mostlyclean-recursive
 
-clean-am:  clean-hdr clean-toolexeclibLTLIBRARIES clean-compile \
-               clean-libtool clean-binPROGRAMS clean-noinstPROGRAMS \
-               clean-tags clean-depend clean-generic mostlyclean-am \
-               clean-local
+clean-am:  clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \
+               clean-binPROGRAMS clean-noinstPROGRAMS clean-tags \
+               clean-depend clean-generic mostlyclean-am clean-local
 
 clean: clean-recursive
 
-distclean-am:  distclean-hdr distclean-toolexeclibLTLIBRARIES \
-               distclean-compile distclean-libtool \
-               distclean-binPROGRAMS distclean-noinstPROGRAMS \
-               distclean-tags distclean-depend distclean-generic \
-               clean-am
+distclean-am:  distclean-toolexeclibLTLIBRARIES distclean-compile \
+               distclean-libtool distclean-binPROGRAMS \
+               distclean-noinstPROGRAMS distclean-tags \
+               distclean-depend distclean-generic clean-am
        -rm -f libtool
 
 distclean: distclean-recursive
        -rm -f config.status
 
-maintainer-clean-am:  maintainer-clean-hdr \
-               maintainer-clean-toolexeclibLTLIBRARIES \
+maintainer-clean-am:  maintainer-clean-toolexeclibLTLIBRARIES \
                maintainer-clean-compile maintainer-clean-libtool \
                maintainer-clean-binPROGRAMS \
                maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
@@ -4309,9 +4507,9 @@ maintainer-clean-am:  maintainer-clean-hdr \
 maintainer-clean: maintainer-clean-recursive
        -rm -f config.status
 
-.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
-mostlyclean-toolexeclibLTLIBRARIES distclean-toolexeclibLTLIBRARIES \
-clean-toolexeclibLTLIBRARIES maintainer-clean-toolexeclibLTLIBRARIES \
+.PHONY: mostlyclean-toolexeclibLTLIBRARIES \
+distclean-toolexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \
+maintainer-clean-toolexeclibLTLIBRARIES \
 uninstall-toolexeclibLTLIBRARIES install-toolexeclibLTLIBRARIES \
 mostlyclean-compile distclean-compile clean-compile \
 maintainer-clean-compile mostlyclean-libtool distclean-libtool \
@@ -4337,6 +4535,11 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
 maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
+$(gtk_c_headers): $(gtk_awt_peer_sources)
+       @input=`echo $@ | sed -e 's,jniinclude,,' -e 's,_,.,g' -e 's,.h$$,,'`; \
+       echo "$(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input"; \
+       $(GCJH) -jni -d jniinclude -classpath '' -bootclasspath $(top_builddir) $$input
+
 install-exec-hook:
        cd $(DESTDIR)$(libdir) && \
        if test -f libgcjx.la; then \
@@ -4377,9 +4580,17 @@ $(c_files): %.lo: %.c
 
 $(c_files): java/lang/fdlibm.h java/lang/ieeefp.h java/lang/mprec.h
 
+$(gtk_c_files): %.lo: %.c
+       $(LTCOMPILE) -c -Ijniinclude -I$(srcdir)/jni/classpath -I$(srcdir)/jni/gtk-peer $(GTK_CFLAGS) $(LIBART_CFLAGS) -o $@ $<
+
+$(gtk_c_files): $(gtk_c_headers)
+
 $(javao_files) $(x_javao_files) $(lib_org_w3c_dom_la_OBJECTS) $(lib_org_xml_sax_la_OBJECTS): %.lo: %.java
        $(GCJCOMPILE) -o $@ $<
 
+$(gtk_awt_peer_sources:.java=.lo): %.lo: %.java
+       $(GCJCOMPILE) -fjni -o $@ $<
+
 libgcj.la: $(libgcj_la_OBJECTS) $(libgcj_la_DEPENDENCIES)
        @: $(shell echo Creating list of files to link...) $(shell rm -f libgcj.objectlist || :) $(shell touch libgcj.objectlist) $(foreach object,$(libgcj_la_OBJECTS) $(libgcj_la_LIBADD),$(shell echo $(object) >> libgcj.objectlist))
        $(libgcj_la_LINK) -objectlist libgcj.objectlist \
index 2253b6b..c32821e 100644 (file)
@@ -1,6 +1,6 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4-p5
+dnl aclocal.m4 generated automatically by aclocal 1.4
 
-dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -271,7 +271,7 @@ AC_DEFUN([AM_LC_MESSAGES],
 dnl Usage:
 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
 
-AC_DEFUN([AM_INIT_AUTOMAKE],
+AC_DEFUN(AM_INIT_AUTOMAKE,
 [AC_REQUIRE([AC_PROG_INSTALL])
 PACKAGE=[$1]
 AC_SUBST(PACKAGE)
@@ -299,7 +299,7 @@ AC_REQUIRE([AC_PROG_MAKE_SET])])
 # Check to make sure that the build environment is sane.
 #
 
-AC_DEFUN([AM_SANITY_CHECK],
+AC_DEFUN(AM_SANITY_CHECK,
 [AC_MSG_CHECKING([whether build environment is sane])
 # Just in case
 sleep 1
@@ -340,7 +340,7 @@ AC_MSG_RESULT(yes)])
 
 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
 dnl The program must properly implement --version.
-AC_DEFUN([AM_MISSING_PROG],
+AC_DEFUN(AM_MISSING_PROG,
 [AC_MSG_CHECKING(for working $2)
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
@@ -359,7 +359,7 @@ AC_SUBST($1)])
 
 # serial 1
 
-AC_DEFUN([AM_MAINTAINER_MODE],
+AC_DEFUN(AM_MAINTAINER_MODE,
 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode is disabled by default
   AC_ARG_ENABLE(maintainer-mode,
@@ -376,7 +376,7 @@ AC_DEFUN([AM_MAINTAINER_MODE],
 
 # Define a conditional.
 
-AC_DEFUN([AM_CONDITIONAL],
+AC_DEFUN(AM_CONDITIONAL,
 [AC_SUBST($1_TRUE)
 AC_SUBST($1_FALSE)
 if $2; then
@@ -389,7 +389,7 @@ fi])
 
 # Like AC_CONFIG_HEADER, but automatically create stamp file.
 
-AC_DEFUN([AM_CONFIG_HEADER],
+AC_DEFUN(AM_CONFIG_HEADER,
 [AC_PREREQ([2.12])
 AC_CONFIG_HEADER([$1])
 dnl When config.status generates a header, we must update the stamp-h file.
@@ -410,3 +410,561 @@ for am_file in <<$1>>; do
 done<<>>dnl>>)
 changequote([,]))])
 
+# Configure paths for GTK+
+# Owen Taylor     97-11-3
+
+dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
+dnl
+AC_DEFUN(AM_PATH_GTK,
+[dnl 
+dnl Get the cflags and libraries from the gtk-config script
+dnl
+AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
+            gtk_config_prefix="$withval", gtk_config_prefix="")
+AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
+            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
+AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
+                   , enable_gtktest=yes)
+
+  for module in . $4
+  do
+      case "$module" in
+         gthread) 
+             gtk_config_args="$gtk_config_args gthread"
+         ;;
+      esac
+  done
+
+  if test x$gtk_config_exec_prefix != x ; then
+     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
+     fi
+  fi
+  if test x$gtk_config_prefix != x ; then
+     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
+     fi
+  fi
+
+  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
+  min_gtk_version=ifelse([$1], ,0.99.7,$1)
+  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
+  no_gtk=""
+  if test "$GTK_CONFIG" = "no" ; then
+    no_gtk=yes
+  else
+    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
+    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
+    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK is sufficiently new. (Also sanity
+dnl checks the results of gtk-config to some extent
+dnl
+      rm -f conf.gtktest
+      AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.gtktest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If gtk-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
+      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+          (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+            GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+#endif /* defined (GTK_MAJOR_VERSION) ... */
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+              major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
+        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$GTK_CONFIG" = "no" ; then
+       echo "*** The gtk-config script installed by GTK could not be found"
+       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GTK_CONFIG environment variable to the"
+       echo "*** full path to gtk-config."
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK test program, checking why..."
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK or finding the wrong"
+          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
+          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
+          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+  rm -f conf.gtktest
+])
+
+# Configure paths for GLIB
+# Owen Taylor     97-11-3
+
+dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or 
+dnl gthread is specified in MODULES, pass to glib-config
+dnl
+AC_DEFUN(AM_PATH_GLIB,
+[dnl 
+dnl Get the cflags and libraries from the glib-config script
+dnl
+AC_ARG_WITH(glib-prefix,[  --with-glib-prefix=PFX   Prefix where GLIB is installed (optional)],
+            glib_config_prefix="$withval", glib_config_prefix="")
+AC_ARG_WITH(glib-exec-prefix,[  --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
+            glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
+AC_ARG_ENABLE(glibtest, [  --disable-glibtest       Do not try to compile and run a test GLIB program],
+                   , enable_glibtest=yes)
+
+  if test x$glib_config_exec_prefix != x ; then
+     glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
+     if test x${GLIB_CONFIG+set} != xset ; then
+        GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
+     fi
+  fi
+  if test x$glib_config_prefix != x ; then
+     glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
+     if test x${GLIB_CONFIG+set} != xset ; then
+        GLIB_CONFIG=$glib_config_prefix/bin/glib-config
+     fi
+  fi
+
+  for module in . $4
+  do
+      case "$module" in
+         gmodule) 
+             glib_config_args="$glib_config_args gmodule"
+         ;;
+         gthread) 
+             glib_config_args="$glib_config_args gthread"
+         ;;
+      esac
+  done
+
+  AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
+  min_glib_version=ifelse([$1], ,0.99.7,$1)
+  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+  no_glib=""
+  if test "$GLIB_CONFIG" = "no" ; then
+    no_glib=yes
+  else
+    GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
+    GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
+    glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_glibtest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GLIB_CFLAGS"
+      LIBS="$GLIB_LIBS $LIBS"
+dnl
+dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+dnl checks the results of glib-config to some extent
+dnl
+      rm -f conf.glibtest
+      AC_TRY_RUN([
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.glibtest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_glib_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_glib_version");
+     exit(1);
+   }
+
+  if ((glib_major_version != $glib_config_major_version) ||
+      (glib_minor_version != $glib_config_minor_version) ||
+      (glib_micro_version != $glib_config_micro_version))
+    {
+      printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
+             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+             glib_major_version, glib_minor_version, glib_micro_version);
+      printf ("*** was found! If glib-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
+      printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+          (glib_minor_version != GLIB_MINOR_VERSION) ||
+           (glib_micro_version != GLIB_MICRO_VERSION))
+    {
+      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+            GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            glib_major_version, glib_minor_version, glib_micro_version);
+    }
+  else
+    {
+      if ((glib_major_version > major) ||
+        ((glib_major_version == major) && (glib_minor_version > minor)) ||
+        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+               glib_major_version, glib_minor_version, glib_micro_version);
+        printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+              major, minor, micro);
+        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the glib-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
+        printf("*** correct copy of glib-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_glib" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$GLIB_CONFIG" = "no" ; then
+       echo "*** The glib-config script installed by GLIB could not be found"
+       echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GLIB_CONFIG environment variable to the"
+       echo "*** full path to glib-config."
+     else
+       if test -f conf.glibtest ; then
+        :
+       else
+          echo "*** Could not run GLIB test program, checking why..."
+          CFLAGS="$CFLAGS $GLIB_CFLAGS"
+          LIBS="$LIBS $GLIB_LIBS"
+          AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
+          echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
+          echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GLIB_CFLAGS=""
+     GLIB_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GLIB_CFLAGS)
+  AC_SUBST(GLIB_LIBS)
+  rm -f conf.glibtest
+])
+
+# Configure paths for LIBART
+# Raph Levien 98-11-18
+# stolen from Manish Singh    98-9-30
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
+dnl
+AC_DEFUN(AM_PATH_LIBART,
+[dnl 
+dnl Get the cflags and libraries from the libart-config script
+dnl
+AC_ARG_WITH(libart-prefix,[  --with-libart-prefix=PFX   Prefix where LIBART is installed (optional)],
+            libart_prefix="$withval", libart_prefix="")
+AC_ARG_WITH(libart-exec-prefix,[  --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
+            libart_exec_prefix="$withval", libart_exec_prefix="")
+AC_ARG_ENABLE(libarttest, [  --disable-libarttest       Do not try to compile and run a test LIBART program],
+                   , enable_libarttest=yes)
+
+  if test x$libart_exec_prefix != x ; then
+     libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
+     if test x${LIBART_CONFIG+set} != xset ; then
+        LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
+     fi
+  fi
+  if test x$libart_prefix != x ; then
+     libart_args="$libart_args --prefix=$libart_prefix"
+     if test x${LIBART_CONFIG+set} != xset ; then
+        LIBART_CONFIG=$libart_prefix/bin/libart-config
+     fi
+  fi
+
+  AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
+  min_libart_version=ifelse([$1], ,0.2.5,$1)
+  AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
+  no_libart=""
+  if test "$LIBART_CONFIG" = "no" ; then
+    no_libart=yes
+  else
+    LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
+    LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
+
+    libart_major_version=`$LIBART_CONFIG $libart_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_libarttest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $LIBART_CFLAGS"
+      LIBS="$LIBS $LIBART_LIBS"
+dnl
+dnl Now check if the installed LIBART is sufficiently new. (Also sanity
+dnl checks the results of libart-config to some extent
+dnl
+      rm -f conf.libarttest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libart_lgpl/libart.h>
+
+char*
+my_strdup (char *str)
+{
+  char *new_str;
+  
+  if (str)
+    {
+      new_str = malloc ((strlen (str) + 1) * sizeof(char));
+      strcpy (new_str, str);
+    }
+  else
+    new_str = NULL;
+  
+  return new_str;
+}
+
+int main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.libarttest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = my_strdup("$min_libart_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_libart_version");
+     exit(1);
+   }
+
+   if (($libart_major_version > major) ||
+      (($libart_major_version == major) && ($libart_minor_version > minor)) ||
+      (($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
+      printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
+      printf("*** best to upgrade to the required version.\n");
+      printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
+      printf("*** to point to the correct copy of libart-config, and remove the file\n");
+      printf("*** config.cache before re-running configure\n");
+      return 1;
+    }
+}
+
+],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_libart" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$LIBART_CONFIG" = "no" ; then
+       echo "*** The libart-config script installed by LIBART could not be found"
+       echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the LIBART_CONFIG environment variable to the"
+       echo "*** full path to libart-config."
+     else
+       if test -f conf.libarttest ; then
+        :
+       else
+          echo "*** Could not run LIBART test program, checking why..."
+          CFLAGS="$CFLAGS $LIBART_CFLAGS"
+          LIBS="$LIBS $LIBART_LIBS"
+          AC_TRY_LINK([
+#include <stdio.h>
+#include <libart_lgpl/libart.h>
+],      [ return 0; ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding LIBART or finding the wrong"
+          echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
+          echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
+          echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     LIBART_CFLAGS=""
+     LIBART_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(LIBART_CFLAGS)
+  AC_SUBST(LIBART_LIBS)
+  rm -f conf.libarttest
+])
+
index 56b3741..e3afa18 100755 (executable)
@@ -58,13 +58,31 @@ ac_help="$ac_help
 ac_help="$ac_help
   --with-system-zlib      use installed libz"
 ac_help="$ac_help
+  --with-x                use the X Window System"
+ac_help="$ac_help
+  --enable-java-awt       list of AWT peer implementations to be built"
+ac_help="$ac_help
   --enable-java-gc=TYPE   choose garbage collector [boehm]"
 ac_help="$ac_help
   --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib"
 ac_help="$ac_help
-  --with-x                use the X Window System"
+  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)"
 ac_help="$ac_help
-  --enable-java-awt       list of AWT peer implementations to be built"
+  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)"
+ac_help="$ac_help
+  --disable-gtktest       Do not try to compile and run a test GTK program"
+ac_help="$ac_help
+  --with-glib-prefix=PFX   Prefix where GLIB is installed (optional)"
+ac_help="$ac_help
+  --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)"
+ac_help="$ac_help
+  --disable-glibtest       Do not try to compile and run a test GLIB program"
+ac_help="$ac_help
+  --with-libart-prefix=PFX   Prefix where LIBART is installed (optional)"
+ac_help="$ac_help
+  --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)"
+ac_help="$ac_help
+  --disable-libarttest       Do not try to compile and run a test LIBART program"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -594,7 +612,7 @@ fi
 ORIGINAL_LD_FOR_MULTILIBS=$LD
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:598: checking whether ln -s works" >&5
+echo "configure:616: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -647,7 +665,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:651: checking for a BSD compatible install" >&5
+echo "configure:669: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -700,7 +718,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:704: checking whether build environment is sane" >&5
+echo "configure:722: checking whether build environment is sane" >&5
 # Just in case
 sleep 1
 echo timestamp > conftestfile
@@ -757,7 +775,7 @@ test "$program_suffix" != NONE &&
 test "$program_transform_name" = "" && program_transform_name="s,x,x,"
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:761: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:779: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -790,12 +808,12 @@ else
 fi
 
 echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:794: checking for Cygwin environment" >&5
+echo "configure:812: checking for Cygwin environment" >&5
 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 799 "configure"
+#line 817 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -806,7 +824,7 @@ int main() {
 return __CYGWIN__;
 ; return 0; }
 EOF
-if { (eval echo configure:810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:828: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_cygwin=yes
 else
@@ -823,19 +841,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
 CYGWIN=
 test "$ac_cv_cygwin" = yes && CYGWIN=yes
 echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:827: checking for mingw32 environment" >&5
+echo "configure:845: checking for mingw32 environment" >&5
 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 832 "configure"
+#line 850 "configure"
 #include "confdefs.h"
 
 int main() {
 return __MINGW32__;
 ; return 0; }
 EOF
-if { (eval echo configure:839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mingw32=yes
 else
@@ -962,7 +980,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:966: checking host system type" >&5
+echo "configure:984: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -983,7 +1001,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:987: checking target system type" >&5
+echo "configure:1005: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -1001,7 +1019,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1005: checking build system type" >&5
+echo "configure:1023: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1030,7 +1048,7 @@ test "$host_alias" != "$target_alias" &&
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1034: checking for $ac_word" >&5
+echo "configure:1052: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1060,7 +1078,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1064: checking for $ac_word" >&5
+echo "configure:1082: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1111,7 +1129,7 @@ fi
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1115: checking for $ac_word" >&5
+echo "configure:1133: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1144,7 +1162,7 @@ fi
 
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1148: checking whether we are using GNU C" >&5
+echo "configure:1166: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1153,7 +1171,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1172,7 +1190,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1176: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1194: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1221,7 +1239,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1225: checking for $ac_word" >&5
+echo "configure:1243: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_glibjava_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1256,7 +1274,7 @@ CXX=$glibjava_CXX
 test -z "$glibjava_CXX" && { echo "configure: error: no acceptable c++ found in \$PATH" 1>&2; exit 1; }
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1260: checking whether we are using GNU C++" >&5
+echo "configure:1278: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1265,7 +1283,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1287: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -1280,7 +1298,7 @@ if test $ac_cv_prog_gxx = yes; then
   ac_save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS=
   echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1284: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1302: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1329,7 +1347,7 @@ EOF
 
 missing_dir=`cd $ac_aux_dir && pwd`
 echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1333: checking for working aclocal" >&5
+echo "configure:1351: checking for working aclocal" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1342,7 +1360,7 @@ else
 fi
 
 echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1346: checking for working autoconf" >&5
+echo "configure:1364: checking for working autoconf" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1355,7 +1373,7 @@ else
 fi
 
 echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1359: checking for working automake" >&5
+echo "configure:1377: checking for working automake" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1368,7 +1386,7 @@ else
 fi
 
 echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1372: checking for working autoheader" >&5
+echo "configure:1390: checking for working autoheader" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1381,7 +1399,7 @@ else
 fi
 
 echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1385: checking for working makeinfo" >&5
+echo "configure:1403: checking for working makeinfo" >&5
 # Run test in a subshell; some versions of sh will print an error if
 # an executable is not found, even if stderr is redirected.
 # Redirect stdin to placate older versions of autoconf.  Sigh.
@@ -1400,7 +1418,7 @@ fi
 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
 # be run before AC_CANONICAL_HOST.
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:1404: checking build system type" >&5
+echo "configure:1422: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -1421,7 +1439,7 @@ echo "$ac_t""$build" 1>&6
 # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
 set dummy ${ac_tool_prefix}as; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1425: checking for $ac_word" >&5
+echo "configure:1443: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1453,7 +1471,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1457: checking for $ac_word" >&5
+echo "configure:1475: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1485,7 +1503,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1489: checking for $ac_word" >&5
+echo "configure:1507: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1517,7 +1535,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1521: checking for $ac_word" >&5
+echo "configure:1539: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1562,7 +1580,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1566: checking for a BSD compatible install" >&5
+echo "configure:1584: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1616,7 +1634,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1620: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1638: checking whether to enable maintainer-specific portions of Makefiles" >&5
     # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then
   enableval="$enable_maintainer_mode"
@@ -1642,7 +1660,7 @@ fi
 
 
 echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1646: checking for executable suffix" >&5
+echo "configure:1664: checking for executable suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1652,7 +1670,7 @@ else
   rm -f conftest*
   echo 'int main () { return 0; }' > conftest.$ac_ext
   ac_cv_exeext=
-  if { (eval echo configure:1656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+  if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
       *.c | *.o | *.obj | *.ilk | *.pdb) ;;
@@ -1802,7 +1820,7 @@ ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
   echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:1806: checking for ld used by GCC" >&5
+echo "configure:1824: checking for ld used by GCC" >&5
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -1832,10 +1850,10 @@ echo "configure:1806: checking for ld used by GCC" >&5
   esac
 elif test "$with_gnu_ld" = yes; then
   echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1836: checking for GNU ld" >&5
+echo "configure:1854: checking for GNU ld" >&5
 else
   echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1839: checking for non-GNU ld" >&5
+echo "configure:1857: checking for non-GNU ld" >&5
 fi
 if eval "test \"`echo '$''{'lt_cv_path_LD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1870,7 +1888,7 @@ else
 fi
 test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
 echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6
-echo "configure:1874: checking if the linker ($LD) is GNU ld" >&5
+echo "configure:1892: checking if the linker ($LD) is GNU ld" >&5
 if eval "test \"`echo '$''{'lt_cv_prog_gnu_ld'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1887,7 +1905,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
 echo $ac_n "checking for $LD option to reload object files""... $ac_c" 1>&6
-echo "configure:1891: checking for $LD option to reload object files" >&5
+echo "configure:1909: checking for $LD option to reload object files" >&5
 if eval "test \"`echo '$''{'lt_cv_ld_reload_flag'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1899,7 +1917,7 @@ reload_flag=$lt_cv_ld_reload_flag
 test -n "$reload_flag" && reload_flag=" $reload_flag"
 
 echo $ac_n "checking for BSD-compatible nm""... $ac_c" 1>&6
-echo "configure:1903: checking for BSD-compatible nm" >&5
+echo "configure:1921: checking for BSD-compatible nm" >&5
 if eval "test \"`echo '$''{'lt_cv_path_NM'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1937,7 +1955,7 @@ NM="$lt_cv_path_NM"
 echo "$ac_t""$NM" 1>&6
 
 echo $ac_n "checking how to recognise dependant libraries""... $ac_c" 1>&6
-echo "configure:1941: checking how to recognise dependant libraries" >&5
+echo "configure:1959: checking how to recognise dependant libraries" >&5
 if eval "test \"`echo '$''{'lt_cv_deplibs_check_method'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2110,13 +2128,13 @@ file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 
 echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:2114: checking for object suffix" >&5
+echo "configure:2132: checking for object suffix" >&5
 if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   rm -f conftest*
 echo 'int i = 1;' > conftest.$ac_ext
-if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2138: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   for ac_file in conftest.*; do
     case $ac_file in
     *.c) ;;
@@ -2140,7 +2158,7 @@ case $deplibs_check_method in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
     echo $ac_n "checking for ${ac_tool_prefix}file""... $ac_c" 1>&6
-echo "configure:2144: checking for ${ac_tool_prefix}file" >&5
+echo "configure:2162: checking for ${ac_tool_prefix}file" >&5
 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2202,7 +2220,7 @@ fi
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
     echo $ac_n "checking for file""... $ac_c" 1>&6
-echo "configure:2206: checking for file" >&5
+echo "configure:2224: checking for file" >&5
 if eval "test \"`echo '$''{'lt_cv_path_MAGIC_CMD'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2273,7 +2291,7 @@ esac
 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2277: checking for $ac_word" >&5
+echo "configure:2295: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2305,7 +2323,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2309: checking for $ac_word" >&5
+echo "configure:2327: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2340,7 +2358,7 @@ fi
 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2344: checking for $ac_word" >&5
+echo "configure:2362: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2372,7 +2390,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2376: checking for $ac_word" >&5
+echo "configure:2394: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2439,8 +2457,8 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
 case $host in
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 2443 "configure"' > conftest.$ac_ext
-  if { (eval echo configure:2444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  echo '#line 2461 "configure"' > conftest.$ac_ext
+  if { (eval echo configure:2462: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case `/usr/bin/file conftest.$ac_objext` in
     *32-bit*)
       LD="${LD-ld} -32"
@@ -2459,7 +2477,7 @@ case $host in
 ia64-*-hpux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo configure:2463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  if { (eval echo configure:2481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *ELF-32*)
       HPUX_IA64_MODE="32"
@@ -2475,7 +2493,7 @@ ia64-*-hpux*)
 x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
   # Find out which ABI we are using.
   echo 'int i;' > conftest.$ac_ext
-  if { (eval echo configure:2479: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  if { (eval echo configure:2497: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     case "`/usr/bin/file conftest.o`" in
     *32-bit*)
       case $host in
@@ -2519,7 +2537,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
   echo $ac_n "checking whether the C compiler needs -belf""... $ac_c" 1>&6
-echo "configure:2523: checking whether the C compiler needs -belf" >&5
+echo "configure:2541: checking whether the C compiler needs -belf" >&5
 if eval "test \"`echo '$''{'lt_cv_cc_needs_belf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2532,14 +2550,14 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
 cross_compiling=$ac_cv_prog_cc_cross
 
      cat > conftest.$ac_ext <<EOF
-#line 2536 "configure"
+#line 2554 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   lt_cv_cc_needs_belf=yes
 else
@@ -2569,7 +2587,7 @@ echo "$ac_t""$lt_cv_cc_needs_belf" 1>&6
 esac
 
 echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:2573: checking how to run the C++ preprocessor" >&5
+echo "configure:2591: checking how to run the C++ preprocessor" >&5
 if test -z "$CXXCPP"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2582,12 +2600,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
 cross_compiling=$ac_cv_prog_cxx_cross
   CXXCPP="${CXX-g++} -E"
   cat > conftest.$ac_ext <<EOF
-#line 2586 "configure"
+#line 2604 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -2823,7 +2841,7 @@ INTERPRETER="$libgcj_interpreter"
 
 
 echo $ac_n "checking for exception model to use""... $ac_c" 1>&6
-echo "configure:2827: checking for exception model to use" >&5
+echo "configure:2845: checking for exception model to use" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -2838,7 +2856,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then
   :
 else
   cat > conftest.$ac_ext << EOF
-#line 2842 "configure"
+#line 2860 "configure"
 struct S { ~S(); };
 void bar();
 void foo()
@@ -2849,7 +2867,7 @@ void foo()
 EOF
 old_CXXFLAGS="$CXXFLAGS"  
 CXXFLAGS=-S
-if { (eval echo configure:2853: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2871: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
     enable_sjlj_exceptions=yes
   elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
@@ -2980,7 +2998,7 @@ esac
 
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:2984: checking how to run the C preprocessor" >&5
+echo "configure:3002: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2995,13 +3013,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2999 "configure"
+#line 3017 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -3012,13 +3030,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 3016 "configure"
+#line 3034 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -3029,13 +3047,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 3033 "configure"
+#line 3051 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3039: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -3060,7 +3078,7 @@ fi
 echo "$ac_t""$CPP" 1>&6
 
 cat > conftest.$ac_ext <<EOF
-#line 3064 "configure"
+#line 3082 "configure"
 #include "confdefs.h"
 #include <stdint.h>
 EOF
@@ -3075,7 +3093,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 3079 "configure"
+#line 3097 "configure"
 #include "confdefs.h"
 #include <inttypes.h>
 EOF
@@ -3090,7 +3108,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 3094 "configure"
+#line 3112 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3105,7 +3123,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 3109 "configure"
+#line 3127 "configure"
 #include "confdefs.h"
 #include <sys/config.h>
 EOF
@@ -3122,7 +3140,7 @@ rm -f conftest*
 
 
 cat > conftest.$ac_ext <<EOF
-#line 3126 "configure"
+#line 3144 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -3137,7 +3155,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 3141 "configure"
+#line 3159 "configure"
 #include "confdefs.h"
 #include <time.h>
 EOF
@@ -3186,1136 +3204,1456 @@ ZLIBSPEC=
 ZLIBTESTSPEC=
 
 
-libsubdir=.libs
+# If we find X, set shell vars x_includes and x_libraries to the
+# paths, otherwise set no_x=yes.
+# Uses ac_ vars as temps to allow command line to override cache and checks.
+# --without-x overrides everything else, but does not touch the cache.
+echo $ac_n "checking for X""... $ac_c" 1>&6
+echo "configure:3213: checking for X" >&5
 
-echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
-echo "configure:3193: checking for garbage collector to use" >&5
-# Check whether --enable-java-gc or --disable-java-gc was given.
-if test "${enable_java_gc+set}" = set; then
-  enableval="$enable_java_gc"
-  
-  GC=$enableval
-else
-  GC=boehm
+# Check whether --with-x or --without-x was given.
+if test "${with_x+set}" = set; then
+  withval="$with_x"
+  :
 fi
 
-GCLIBS=
-GCINCS=
-GCDEPS=
-GCOBJS=
-GCSPEC=
-JC1GCSPEC=
-GCTESTSPEC=
-case "$GC" in
- boehm)
-    echo "$ac_t""boehm" 1>&6
-    GCLIBS=../boehm-gc/libgcjgc_convenience.la
-    GCINCS='-I$(top_srcdir)/../boehm-gc/include'
-    JC1GCSPEC='-fuse-boehm-gc'
-    GCTESTSPEC="-L`${PWDCMD-pwd}`/../boehm-gc/.libs -rpath `${PWDCMD-pwd}`/../boehm-gc/.libs"
-
-            GCINCS="$GCINCS `cat ../boehm-gc/boehm-cflags`"
-    GCOBJS=boehm.lo
-    GCHDR=boehm-gc.h
-        cat >> confdefs.h <<\EOF
-#define HAVE_BOEHM_GC 1
+# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
+if test "x$with_x" = xno; then
+  # The user explicitly disabled X.
+  have_x=disabled
+else
+  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+    # Both variables are already set.
+    have_x=yes
+  else
+if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  # One or both of the vars are not set, and there is no cached value.
+ac_x_includes=NO ac_x_libraries=NO
+rm -fr conftestdir
+if mkdir conftestdir; then
+  cd conftestdir
+  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+  cat > Imakefile <<'EOF'
+acfindx:
+       @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
 EOF
+  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
+    for ac_extension in a so sl; do
+      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+        test -f $ac_im_libdir/libX11.$ac_extension; then
+        ac_im_usrlibdir=$ac_im_libdir; break
+      fi
+    done
+    # Screen out bogus values from the imake configuration.  They are
+    # bogus both because they are the default anyway, and because
+    # using them would break gcc on systems where it needs fixed includes.
+    case "$ac_im_incroot" in
+       /usr/include) ;;
+       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
+    esac
+    case "$ac_im_usrlibdir" in
+       /usr/lib | /lib) ;;
+       *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
+    esac
+  fi
+  cd ..
+  rm -fr conftestdir
+fi
 
-    ;;
- no)
-    echo "$ac_t""none" 1>&6
-    GCOBJS=nogc.lo
-    GCHDR=no-gc.h
-    ;;
- *)
-    { echo "configure: error: unrecognized collector \"$GC\"" 1>&2; exit 1; }
-    ;;
-esac
+if test "$ac_x_includes" = NO; then
+  # Guess where to find include files, by looking for this one X11 .h file.
+  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
 
+  # First, try using that file with no special directory specified.
+cat > conftest.$ac_ext <<EOF
+#line 3275 "configure"
+#include "confdefs.h"
+#include <$x_direct_test_include>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3280: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  # We can compile using X headers with no special include directory.
+ac_x_includes=
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  # Look for the header file in a standard set of common directories.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+  for ac_dir in               \
+    /usr/X11/include          \
+    /usr/X11R6/include        \
+    /usr/X11R5/include        \
+    /usr/X11R4/include        \
+                              \
+    /usr/include/X11          \
+    /usr/include/X11R6        \
+    /usr/include/X11R5        \
+    /usr/include/X11R4        \
+                              \
+    /usr/local/X11/include    \
+    /usr/local/X11R6/include  \
+    /usr/local/X11R5/include  \
+    /usr/local/X11R4/include  \
+                              \
+    /usr/local/include/X11    \
+    /usr/local/include/X11R6  \
+    /usr/local/include/X11R5  \
+    /usr/local/include/X11R4  \
+                              \
+    /usr/X386/include         \
+    /usr/x386/include         \
+    /usr/XFree86/include/X11  \
+                              \
+    /usr/include              \
+    /usr/local/include        \
+    /usr/unsupported/include  \
+    /usr/athena/include       \
+    /usr/local/x11r5/include  \
+    /usr/lpp/Xamples/include  \
+                              \
+    /usr/openwin/include      \
+    /usr/openwin/share/include \
+    ; \
+  do
+    if test -r "$ac_dir/$x_direct_test_include"; then
+      ac_x_includes=$ac_dir
+      break
+    fi
+  done
+fi
+rm -f conftest*
+fi # $ac_x_includes = NO
 
+if test "$ac_x_libraries" = NO; then
+  # Check for the libraries.
 
+  test -z "$x_direct_test_library" && x_direct_test_library=Xt
+  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
 
+  # See if we find them without any special options.
+  # Don't add to $LIBS permanently.
+  ac_save_LIBS="$LIBS"
+  LIBS="-l$x_direct_test_library $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3349 "configure"
+#include "confdefs.h"
 
+int main() {
+${x_direct_test_function}()
+; return 0; }
+EOF
+if { (eval echo configure:3356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  LIBS="$ac_save_LIBS"
+# We can link X programs with no special library path.
+ac_x_libraries=
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  LIBS="$ac_save_LIBS"
+# First see if replacing the include by lib works.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
+    /usr/X11/lib          \
+    /usr/X11R6/lib        \
+    /usr/X11R5/lib        \
+    /usr/X11R4/lib        \
+                          \
+    /usr/lib/X11          \
+    /usr/lib/X11R6        \
+    /usr/lib/X11R5        \
+    /usr/lib/X11R4        \
+                          \
+    /usr/local/X11/lib    \
+    /usr/local/X11R6/lib  \
+    /usr/local/X11R5/lib  \
+    /usr/local/X11R4/lib  \
+                          \
+    /usr/local/lib/X11    \
+    /usr/local/lib/X11R6  \
+    /usr/local/lib/X11R5  \
+    /usr/local/lib/X11R4  \
+                          \
+    /usr/X386/lib         \
+    /usr/x386/lib         \
+    /usr/XFree86/lib/X11  \
+                          \
+    /usr/lib              \
+    /usr/local/lib        \
+    /usr/unsupported/lib  \
+    /usr/athena/lib       \
+    /usr/local/x11r5/lib  \
+    /usr/lpp/Xamples/lib  \
+    /lib/usr/lib/X11     \
+                          \
+    /usr/openwin/lib      \
+    /usr/openwin/share/lib \
+    ; \
+do
+  for ac_extension in a so sl; do
+    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
+      ac_x_libraries=$ac_dir
+      break 2
+    fi
+  done
+done
+fi
+rm -f conftest*
+fi # $ac_x_libraries = NO
 
+if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+fi
+fi
+  fi
+  eval "$ac_cv_have_x"
+fi # $with_x != no
 
+if test "$have_x" != yes; then
+  echo "$ac_t""$have_x" 1>&6
+  no_x=yes
+else
+  # If each of the values was on the command line, it overrides each guess.
+  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
+  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
+  # Update the cache value to reflect the command line values.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
+fi
 
-
-
-echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
-echo "configure:3246: checking for thread model used by GCC" >&5
-THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
-echo "$ac_t""$THREADS" 1>&6
-
-case "$THREADS" in
- no | none | single)
-    THREADS=none
-    ;;
- posix | pthreads)
-    THREADS=posix
-    case "$host" in
-     *-*-linux*)
-       cat >> confdefs.h <<\EOF
-#define LINUX_THREADS 1
+if test "$no_x" = yes; then
+  # Not all programs may use this symbol, but it does not hurt to define it.
+  cat >> confdefs.h <<\EOF
+#define X_DISPLAY_MISSING 1
 EOF
 
-       ;;
-    esac
-    ;;
- win32)
-    ;;
- decosf1 | irix | mach | os2 | solaris | dce | vxworks)
-    { echo "configure: error: thread package $THREADS not yet supported" 1>&2; exit 1; }
-    ;;
- *)
-    { echo "configure: error: $THREADS is an unknown thread package" 1>&2; exit 1; }
-    ;;
-esac
-
-THREADLDFLAGS=
-THREADLIBS=
-THREADINCS=
-THREADDEPS=
-THREADOBJS=
-THREADH=
-THREADSPEC=
-case "$THREADS" in
- posix)
-    case "$host" in
-     *-*-cygwin*)
-       # Don't set THREADLIBS here.  Cygwin doesn't have -lpthread.
-       ;;
-   
-     *-*-freebsd[1234]*)
-   
-       # Before FreeBSD 5, it didn't have -lpthread (or any library which
-       # merely adds pthread_* functions) but it does have a -pthread switch
-       # which is required at link-time to select -lc_r *instead* of -lc.
-       THREADLDFLAGS=-pthread
-       # Don't set THREADSPEC here as might be expected since -pthread is
-       # not processed when found within a spec file, it must come from
-       # the command line.  For now, the user must provide the -pthread
-       # switch to link code compiled with gcj.  In future, consider adding
-       # support for weak references to pthread_* functions ala gthr.h API.
-       THREADSPEC='%{!pthread: %eUnder this configuration, the user must provide -pthread when linking.}'
-       ;;
-     *-*-freebsd*)
-       # FreeBSD 5 implements a model much closer to other modern UNIX
-       # which support threads.  However, it still does not support
-       # -lpthread.
-       THREADLDFLAGS=-pthread
-       THREADSPEC=-lc_r
-       ;;
-     *)
-       THREADLIBS=-lpthread
-       THREADSPEC=-lpthread
-       ;;
-    esac
-    THREADOBJS=posix-threads.lo
-    THREADH=posix-threads.h
-    # MIT pthreads doesn't seem to have the mutexattr functions.
-    # But for now we don't check for it.  We just assume you aren't
-    # using MIT pthreads.
-    cat >> confdefs.h <<\EOF
-#define HAVE_PTHREAD_MUTEXATTR_INIT 1
-EOF
+  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+  if test -n "$x_includes"; then
+    X_CFLAGS="$X_CFLAGS -I$x_includes"
+  fi
 
+  # It would also be nice to do this for all -L options, not just this one.
+  if test -n "$x_libraries"; then
+    X_LIBS="$X_LIBS -L$x_libraries"
+    # For Solaris; some versions of Sun CC require a space after -R and
+    # others require no space.  Words are not sufficient . . . .
+    case "`(uname -sr) 2>/dev/null`" in
+    "SunOS 5"*)
+      echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
+echo "configure:3462: checking whether -R must be followed by a space" >&5
+      ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
+      cat > conftest.$ac_ext <<EOF
+#line 3465 "configure"
+#include "confdefs.h"
 
-    # If we're using the Boehm GC, then we happen to know that it
-    # defines _REENTRANT, so we don't bother.  Eww.
-    if test "$GC" != boehm; then
-       cat >> confdefs.h <<\EOF
-#define _REENTRANT 1
-EOF
+int main() {
 
-    fi
-    cat >> confdefs.h <<\EOF
-#define _POSIX_PTHREAD_SEMANTICS 1
+; return 0; }
 EOF
+if { (eval echo configure:3472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_R_nospace=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_R_nospace=no
+fi
+rm -f conftest*
+      if test $ac_R_nospace = yes; then
+       echo "$ac_t""no" 1>&6
+       X_LIBS="$X_LIBS -R$x_libraries"
+      else
+       LIBS="$ac_xsave_LIBS -R $x_libraries"
+       cat > conftest.$ac_ext <<EOF
+#line 3488 "configure"
+#include "confdefs.h"
 
-    ;;
-
- win32)
-    THREADOBJS=win32-threads.lo
-    THREADH=win32-threads.h
-    ;;
-
- none)
-    THREADOBJS=no-threads.lo
-    THREADH=no-threads.h
-    ;;
-esac
-
-
-
+int main() {
 
+; return 0; }
+EOF
+if { (eval echo configure:3495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  ac_R_space=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_R_space=no
+fi
+rm -f conftest*
+       if test $ac_R_space = yes; then
+         echo "$ac_t""yes" 1>&6
+         X_LIBS="$X_LIBS -R $x_libraries"
+       else
+         echo "$ac_t""neither works" 1>&6
+       fi
+      fi
+      LIBS="$ac_xsave_LIBS"
+    esac
+  fi
 
+  # Check for system-dependent libraries X programs must link with.
+  # Do this before checking for the system-independent R6 libraries
+  # (-lICE), since we may need -lsocket or whatever for X linking.
 
+  if test "$ISC" = yes; then
+    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
+  else
+    # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
+    # libraries were built with DECnet support.  And karl@cs.umb.edu says
+    # the Alpha needs dnet_stub (dnet does not exist).
+    echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
+echo "configure:3527: checking for dnet_ntoa in -ldnet" >&5
+ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldnet  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3535 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dnet_ntoa();
 
+int main() {
+dnet_ntoa()
+; return 0; }
+EOF
+if { (eval echo configure:3546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
-if test -d sysdep; then true; else mkdir sysdep; fi
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
+else
+  echo "$ac_t""no" 1>&6
+fi
 
+    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
+      echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
+echo "configure:3568: checking for dnet_ntoa in -ldnet_stub" >&5
+ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldnet_stub  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3576 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dnet_ntoa();
 
-HASH_SYNC_SPEC=
-# Hash synchronization is only useful with posix threads right now.
-if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
-   HASH_SYNC_SPEC=-fhash-synchronization
-   cat >> confdefs.h <<\EOF
-#define JV_HASH_SYNCHRONIZATION 1
+int main() {
+dnet_ntoa()
+; return 0; }
 EOF
+if { (eval echo configure:3587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
 fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
+else
+  echo "$ac_t""no" 1>&6
+fi
 
+    fi
 
-
-
-
-if test "$GCC" = yes; then
-  USING_GCC_TRUE=
-  USING_GCC_FALSE='#'
-else
-  USING_GCC_TRUE='#'
-  USING_GCC_FALSE=
-fi
-
-CANADIAN=no
-NULL_TARGET=no
-NATIVE=yes
-
-# We're in the tree with gcc, and need to include some of its headers.
-GCC_UNWIND_INCLUDE='-I$(libgcj_basedir)/../gcc'
-
-# Figure out where generated headers like libgcj-config.h get installed.
-gcc_version_trigger=${libgcj_basedir}/../gcc/version.c
-gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
-gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
-tool_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include
-
-
-
-if test "x${with_newlib}" = "xyes"; then
-   # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
-   # may not work correctly, because the compiler may not be able to
-   # link executables.
-
-   # We assume newlib.  This lets us hard-code the functions we know
-   # we'll have.
-   cat >> confdefs.h <<\EOF
-#define HAVE_MEMMOVE 1
-EOF
-
-   cat >> confdefs.h <<\EOF
-#define HAVE_MEMCPY 1
-EOF
-
-   cat >> confdefs.h <<\EOF
-#define HAVE_STRERROR 1
-EOF
-
-   cat >> confdefs.h <<\EOF
-#define HAVE_TIME 1
-EOF
-
-   cat >> confdefs.h <<\EOF
-#define HAVE_GMTIME_R 1
-EOF
-
-   cat >> confdefs.h <<\EOF
-#define HAVE_LOCALTIME_R 1
-EOF
-
-      cat >> confdefs.h <<\EOF
-#define HAVE_PTHREAD_MUTEXATTR_INIT 1
-EOF
-
-      cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
-
-
-      cat >> confdefs.h <<\EOF
-#define NO_GETUID 1
-EOF
-
-
-   # If Canadian cross, then don't pick up tools from the build
-   # directory.
-   if test x"$build" != x"$with_cross_host" \
-        && test x"$build" != x"$target"; then
-      CANADIAN=yes
-      GCC_UNWIND_INCLUDE=
-      GCJ="${target_alias}-gcj"
-   fi
-   NATIVE=no
-else
-   for ac_func in strerror ioctl select fstat open fsync sleep opendir
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3454: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+    # to get the SysV transport functions.
+    # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
+    # needs -lnsl.
+    # The nsl library prevents programs from opening the X display
+    # on Irix 5.2, according to dickey@clark.net.
+    echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:3616: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3459 "configure"
+#line 3621 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char gethostbyname(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char gethostbyname();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
 choke me
 #else
-$ac_func();
+gethostbyname();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3482: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_func_gethostbyname=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_func_gethostbyname=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
+  :
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-   for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3509: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    if test $ac_cv_func_gethostbyname = no; then
+      echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:3665: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3514 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3673 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char gethostbyname();
 
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:3537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-   for ac_func in access stat mkdir rename rmdir unlink realpath utime chmod
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3564: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    fi
+
+    # lieder@skyler.mavd.honeywell.com says without -lsocket,
+    # socket/setsockopt and other routines are undefined under SCO ODT
+    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
+    # on later versions), says simon@lia.di.epfl.ch: it contains
+    # gethostby* variants that don't use the nameserver (or something).
+    # -lsocket must be given before -lnsl if both are needed.
+    # We assume that if connect needs -lnsl, so does gethostbyname.
+    echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:3714: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3569 "configure"
+#line 3719 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char connect(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char connect();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_connect) || defined (__stub___connect)
 choke me
 #else
-$ac_func();
+connect();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_func_connect=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_func_connect=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
+  :
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-   for ac_func in nl_langinfo setlocale
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3619: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    if test $ac_cv_func_connect = no; then
+      echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
+echo "configure:3763: checking for connect in -lsocket" >&5
+ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3624 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3771 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char connect();
 
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+connect()
 ; return 0; }
 EOF
-if { (eval echo configure:3647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
+  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-   for ac_func in inet_aton inet_addr
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3674: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    fi
+
+    # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
+    echo $ac_n "checking for remove""... $ac_c" 1>&6
+echo "configure:3806: checking for remove" >&5
+if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3679 "configure"
+#line 3811 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char remove(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char remove();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_remove) || defined (__stub___remove)
 choke me
 #else
-$ac_func();
+remove();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_func_remove=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_func_remove=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- break
+  :
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-   for ac_func in inet_pton uname inet_ntoa
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3729: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    if test $ac_cv_func_remove = no; then
+      echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
+echo "configure:3855: checking for remove in -lposix" >&5
+ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3734 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lposix  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3863 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char remove();
 
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+remove()
 ; return 0; }
 EOF
-if { (eval echo configure:3757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-   for ac_func in fork execvp pipe sigaction ftruncate
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3784: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    fi
+
+    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
+    echo $ac_n "checking for shmat""... $ac_c" 1>&6
+echo "configure:3898: checking for shmat" >&5
+if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3789 "configure"
+#line 3903 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char shmat(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char shmat();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_shmat) || defined (__stub___shmat)
 choke me
 #else
-$ac_func();
+shmat();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:3812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_func_shmat=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_func_shmat=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
+  :
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-   for ac_hdr in execinfo.h unistd.h dlfcn.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3840: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+    if test $ac_cv_func_shmat = no; then
+      echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
+echo "configure:3947: checking for shmat in -lipc" >&5
+ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3845 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lipc  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3955 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char shmat();
+
+int main() {
+shmat()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:3966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
+  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
 else
   echo "$ac_t""no" 1>&6
 fi
-done
-   echo $ac_n "checking for backtrace""... $ac_c" 1>&6
-echo "configure:3877: checking for backtrace" >&5
-if eval "test \"`echo '$''{'ac_cv_func_backtrace'+set}'`\" = set"; then
+
+    fi
+  fi
+
+  # Check for libraries that X11R6 Xt/Xaw programs need.
+  ac_save_LDFLAGS="$LDFLAGS"
+  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
+  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
+  # check for ICE first), but we must link in the order -lSM -lICE or
+  # we get undefined symbols.  So assume we have SM if we have ICE.
+  # These have to be linked with before -lX11, unlike the other
+  # libraries we check for below, so use a different variable.
+  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
+  echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
+echo "configure:3999: checking for IceConnectionNumber in -lICE" >&5
+ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3882 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4007 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char backtrace(); below.  */
-#include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char backtrace();
+char IceConnectionNumber();
+
+int main() {
+IceConnectionNumber()
+; return 0; }
+EOF
+if { (eval echo configure:4018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  LDFLAGS="$ac_save_LDFLAGS"
+
+fi
+
+
+# Check whether --enable-java-awt or --disable-java-awt was given.
+if test "${enable_java_awt+set}" = set; then
+  enableval="$enable_java_awt"
+  :
+fi
+
+
+peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
+use_xlib_awt=""
+use_gtk_awt=""
+# The default toolkit to use is the first one specified.
+TOOLKIT=
+
+
+for peer in $peerlibs ; do
+  case $peer in
+    xlib)
+      if test "$no_x" = yes; then
+        echo "*** xlib peers requested but no X library available" 1>&2
+        exit 1
+      else
+        use_xlib_awt="yes"
+       if test -z "$TOOLKIT"; then
+          TOOLKIT=gnu.gnu.awt.xlib.XToolkit
+       fi
+      fi
+      ;;
+    gtk)
+      if test "$no_x" = yes; then
+        echo "*** xlib peers requested but no X library available" 1>&2
+        exit 1
+      else
+        use_gtk_awt=yes
+        if test -z "$TOOLKIT"; then
+           TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
+        fi
+        test -d jniinclude || mkdir jniinclude
+      fi
+      ;;
+    no)
+      use_xlib_awt=
+      use_gtk_awt=
+      break
+      ;;
+    *)
+      echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
+      exit 1
+  esac
+done
+
+
+
+if test "$use_xlib_awt" = yes; then
+  XLIB_AWT_TRUE=
+  XLIB_AWT_FALSE='#'
+else
+  XLIB_AWT_TRUE='#'
+  XLIB_AWT_FALSE=
+fi
+
+
+if test "$use_gtk_awt" = yes; then
+  GTK_AWT_TRUE=
+  GTK_AWT_FALSE='#'
+else
+  GTK_AWT_TRUE='#'
+  GTK_AWT_FALSE=
+fi
+
+
+libsubdir=.libs
+
+echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
+echo "configure:4116: checking for garbage collector to use" >&5
+# Check whether --enable-java-gc or --disable-java-gc was given.
+if test "${enable_java_gc+set}" = set; then
+  enableval="$enable_java_gc"
+  
+  GC=$enableval
+else
+  GC=boehm
+fi
+
+GCLIBS=
+GCINCS=
+GCDEPS=
+GCOBJS=
+GCSPEC=
+JC1GCSPEC=
+GCTESTSPEC=
+case "$GC" in
+ boehm)
+    echo "$ac_t""boehm" 1>&6
+    GCLIBS=../boehm-gc/libgcjgc_convenience.la
+    GCINCS='-I$(top_srcdir)/../boehm-gc/include'
+    JC1GCSPEC='-fuse-boehm-gc'
+    GCTESTSPEC="-L`${PWDCMD-pwd}`/../boehm-gc/.libs -rpath `${PWDCMD-pwd}`/../boehm-gc/.libs"
+
+            GCINCS="$GCINCS `cat ../boehm-gc/boehm-cflags`"
+    GCOBJS=boehm.lo
+    GCHDR=boehm-gc.h
+        cat >> confdefs.h <<\EOF
+#define HAVE_BOEHM_GC 1
+EOF
+
+    ;;
+ no)
+    echo "$ac_t""none" 1>&6
+    GCOBJS=nogc.lo
+    GCHDR=no-gc.h
+    ;;
+ *)
+    { echo "configure: error: unrecognized collector \"$GC\"" 1>&2; exit 1; }
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+
+echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6
+echo "configure:4169: checking for thread model used by GCC" >&5
+THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
+echo "$ac_t""$THREADS" 1>&6
+
+case "$THREADS" in
+ no | none | single)
+    THREADS=none
+    ;;
+ posix | pthreads)
+    THREADS=posix
+    case "$host" in
+     *-*-linux*)
+       cat >> confdefs.h <<\EOF
+#define LINUX_THREADS 1
+EOF
+
+       ;;
+    esac
+    ;;
+ win32)
+    ;;
+ decosf1 | irix | mach | os2 | solaris | dce | vxworks)
+    { echo "configure: error: thread package $THREADS not yet supported" 1>&2; exit 1; }
+    ;;
+ *)
+    { echo "configure: error: $THREADS is an unknown thread package" 1>&2; exit 1; }
+    ;;
+esac
+
+THREADLDFLAGS=
+THREADLIBS=
+THREADINCS=
+THREADDEPS=
+THREADOBJS=
+THREADH=
+THREADSPEC=
+case "$THREADS" in
+ posix)
+    case "$host" in
+     *-*-cygwin*)
+       # Don't set THREADLIBS here.  Cygwin doesn't have -lpthread.
+       ;;
+   
+     *-*-freebsd[1234]*)
+   
+       # Before FreeBSD 5, it didn't have -lpthread (or any library which
+       # merely adds pthread_* functions) but it does have a -pthread switch
+       # which is required at link-time to select -lc_r *instead* of -lc.
+       THREADLDFLAGS=-pthread
+       # Don't set THREADSPEC here as might be expected since -pthread is
+       # not processed when found within a spec file, it must come from
+       # the command line.  For now, the user must provide the -pthread
+       # switch to link code compiled with gcj.  In future, consider adding
+       # support for weak references to pthread_* functions ala gthr.h API.
+       THREADSPEC='%{!pthread: %eUnder this configuration, the user must provide -pthread when linking.}'
+       ;;
+     *-*-freebsd*)
+       # FreeBSD 5 implements a model much closer to other modern UNIX
+       # which support threads.  However, it still does not support
+       # -lpthread.
+       THREADLDFLAGS=-pthread
+       THREADSPEC=-lc_r
+       ;;
+     *)
+       THREADLIBS=-lpthread
+       THREADSPEC=-lpthread
+       ;;
+    esac
+    THREADOBJS=posix-threads.lo
+    THREADH=posix-threads.h
+    # MIT pthreads doesn't seem to have the mutexattr functions.
+    # But for now we don't check for it.  We just assume you aren't
+    # using MIT pthreads.
+    cat >> confdefs.h <<\EOF
+#define HAVE_PTHREAD_MUTEXATTR_INIT 1
+EOF
+
+
+    # If we're using the Boehm GC, then we happen to know that it
+    # defines _REENTRANT, so we don't bother.  Eww.
+    if test "$GC" != boehm; then
+       cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+    fi
+    cat >> confdefs.h <<\EOF
+#define _POSIX_PTHREAD_SEMANTICS 1
+EOF
+
+    ;;
+
+ win32)
+    THREADOBJS=win32-threads.lo
+    THREADH=win32-threads.h
+    ;;
 
-int main() {
+ none)
+    THREADOBJS=no-threads.lo
+    THREADH=no-threads.h
+    ;;
+esac
 
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_backtrace) || defined (__stub___backtrace)
-choke me
-#else
-backtrace();
-#endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_backtrace=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_backtrace=no"
-fi
-rm -f conftest*
-fi
 
-if eval "test \"`echo '$ac_cv_func_'backtrace`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  
-     case "$host" in
-       ia64-*-linux*)
-        # Has broken backtrace()
-        ;;
-       s390*-*-linux*)
-        # Has broken backtrace()
-        ;;
-       *)
-         cat >> confdefs.h <<\EOF
-#define HAVE_BACKTRACE 1
-EOF
 
-        ;;
-     esac
-   
-else
-  echo "$ac_t""no" 1>&6
 
-     case "$host" in
-       *mingw*)
-         # Has backtrace() defined in libgcj itself
-         cat >> confdefs.h <<\EOF
-#define HAVE_BACKTRACE 1
-EOF
 
-         ;;
-     esac
-   
-fi
 
 
-   echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6
-echo "configure:3952: checking for dladdr in -ldl" >&5
-ac_lib_var=`echo dl'_'dladdr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3960 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dladdr();
+if test -d sysdep; then true; else mkdir sysdep; fi
 
-int main() {
-dladdr()
-; return 0; }
-EOF
-if { (eval echo configure:3971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  
-     cat >> confdefs.h <<\EOF
-#define HAVE_DLADDR 1
+HASH_SYNC_SPEC=
+# Hash synchronization is only useful with posix threads right now.
+if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
+   HASH_SYNC_SPEC=-fhash-synchronization
+   cat >> confdefs.h <<\EOF
+#define JV_HASH_SYNCHRONIZATION 1
 EOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-   if test x"$build" = x"$host"; then
-     for ac_file in /proc/self/exe
-do
 
-ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
-echo "configure:4001: checking for $ac_file" >&5
-if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test "$cross_compiling" = yes; then
-    { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
+
+
+
+if test "$GCC" = yes; then
+  USING_GCC_TRUE=
+  USING_GCC_FALSE='#'
 else
-  if test -r $ac_file; then
-    eval "ac_cv_file_$ac_safe=yes"
-  else
-    eval "ac_cv_file_$ac_safe=no"
-  fi
-fi
+  USING_GCC_TRUE='#'
+  USING_GCC_FALSE=
 fi
-if eval "test \"`echo '$ac_cv_file_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_file=HAVE_`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_file 1
-EOF
-       cat >> confdefs.h <<\EOF
-#define HAVE_PROC_SELF_EXE 1
-EOF
 
-else
-  echo "$ac_t""no" 1>&6
+CANADIAN=no
+NULL_TARGET=no
+NATIVE=yes
 
-fi
-done
+# We're in the tree with gcc, and need to include some of its headers.
+GCC_UNWIND_INCLUDE='-I$(libgcj_basedir)/../gcc'
 
-   else
-     case $host in
-     *-linux*)
-       cat >> confdefs.h <<\EOF
-#define HAVE_PROC_SELF_EXE 1
+# Figure out where generated headers like libgcj-config.h get installed.
+gcc_version_trigger=${libgcj_basedir}/../gcc/version.c
+gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
+gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
+tool_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include
+
+
+
+if test "x${with_newlib}" = "xyes"; then
+   # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
+   # may not work correctly, because the compiler may not be able to
+   # link executables.
+
+   # We assume newlib.  This lets us hard-code the functions we know
+   # we'll have.
+   cat >> confdefs.h <<\EOF
+#define HAVE_MEMMOVE 1
 EOF
 
-       ;;
-     esac
-   fi
+   cat >> confdefs.h <<\EOF
+#define HAVE_MEMCPY 1
+EOF
 
-   
-    
-  am_cv_lib_iconv_ldpath=
-  # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given.
-if test "${with_libiconv_prefix+set}" = set; then
-  withval="$with_libiconv_prefix"
-  
-    for dir in `echo "$withval" | tr : ' '`; do
-      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
-      if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
-    done
-   
-fi
+   cat >> confdefs.h <<\EOF
+#define HAVE_STRERROR 1
+EOF
 
+   cat >> confdefs.h <<\EOF
+#define HAVE_TIME 1
+EOF
 
-  echo $ac_n "checking for iconv""... $ac_c" 1>&6
-echo "configure:4059: checking for iconv" >&5
-if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
-    am_cv_func_iconv="no, consider installing GNU libiconv"
-    am_cv_lib_iconv=no
-    cat > conftest.$ac_ext <<EOF
-#line 4067 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <iconv.h>
-int main() {
-iconv_t cd = iconv_open("","");
-       iconv(cd,NULL,NULL,NULL,NULL);
-       iconv_close(cd);
-; return 0; }
+   cat >> confdefs.h <<\EOF
+#define HAVE_GMTIME_R 1
 EOF
-if { (eval echo configure:4077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  am_cv_func_iconv=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-    if test "$am_cv_func_iconv" != yes; then
-      am_save_LIBS="$LIBS"
-      LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
-      cat > conftest.$ac_ext <<EOF
-#line 4089 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <iconv.h>
-int main() {
-iconv_t cd = iconv_open("","");
-         iconv(cd,NULL,NULL,NULL,NULL);
-         iconv_close(cd);
-; return 0; }
+
+   cat >> confdefs.h <<\EOF
+#define HAVE_LOCALTIME_R 1
 EOF
-if { (eval echo configure:4099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  am_cv_lib_iconv=yes
-        am_cv_func_iconv=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-      LIBS="$am_save_LIBS"
-    fi
-  
-fi
 
-echo "$ac_t""$am_cv_func_iconv" 1>&6
-  if test "$am_cv_func_iconv" = yes; then
-    cat >> confdefs.h <<\EOF
-#define HAVE_ICONV 1
+      cat >> confdefs.h <<\EOF
+#define HAVE_PTHREAD_MUTEXATTR_INIT 1
 EOF
 
-    echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
-echo "configure:4120: checking for iconv declaration" >&5
-    if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
+      cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+
+      cat >> confdefs.h <<\EOF
+#define NO_GETUID 1
+EOF
+
+
+   # If Canadian cross, then don't pick up tools from the build
+   # directory.
+   if test x"$build" != x"$with_cross_host" \
+        && test x"$build" != x"$target"; then
+      CANADIAN=yes
+      GCC_UNWIND_INCLUDE=
+      GCJ="${target_alias}-gcj"
+   fi
+   NATIVE=no
+else
+   for ac_func in strerror ioctl select fstat open fsync sleep opendir
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4377: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  
-      cat > conftest.$ac_ext <<EOF
-#line 4126 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 4382 "configure"
 #include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
 
-#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
 #else
-size_t iconv();
+$ac_func();
 #endif
 
-int main() {
-
 ; return 0; }
 EOF
-if { (eval echo configure:4145: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  am_cv_proto_iconv_arg1=""
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  am_cv_proto_iconv_arg1="const"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
 fi
 
-    am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
-    echo "$ac_t""${ac_t:-
-         }$am_cv_proto_iconv" 1>&6
-    cat >> confdefs.h <<EOF
-#define ICONV_CONST $am_cv_proto_iconv_arg1
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
 
-  fi
-  LIBICONV=
-  if test "$am_cv_lib_iconv" = yes; then
-    LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
-  fi
-  
-
-   if test $ac_cv_header_locale_h = yes; then
-    echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
-echo "configure:4174: checking for LC_MESSAGES" >&5
-if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+   for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4432: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4179 "configure"
+#line 4437 "configure"
 #include "confdefs.h"
-#include <locale.h>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
 int main() {
-return LC_MESSAGES
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:4186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  am_cv_val_LC_MESSAGES=yes
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  am_cv_val_LC_MESSAGES=no
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
-    if test $am_cv_val_LC_MESSAGES = yes; then
-      cat >> confdefs.h <<\EOF
-#define HAVE_LC_MESSAGES 1
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
 
-    fi
-  fi
-   echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:4207: checking whether struct tm is in sys/time.h or time.h" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
+   for ac_func in access stat mkdir rename rmdir unlink realpath utime chmod
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4487: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4212 "configure"
+#line 4492 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <time.h>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
 int main() {
-struct tm *tp; tp->tm_sec;
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:4220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_struct_tm=time.h
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_struct_tm=sys/time.h
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-echo "$ac_t""$ac_cv_struct_tm" 1>&6
-if test $ac_cv_struct_tm = sys/time.h; then
-  cat >> confdefs.h <<\EOF
-#define TM_IN_SYS_TIME 1
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
-
+else
+  echo "$ac_t""no" 1>&6
 fi
+done
 
-echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:4241: checking for tm_zone in struct tm" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
+   for ac_func in nl_langinfo setlocale
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4542: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4246 "configure"
+#line 4547 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <$ac_cv_struct_tm>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
 int main() {
-struct tm tm; tm.tm_zone;
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:4254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_struct_tm_zone=yes
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_struct_tm_zone=no
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6
-if test "$ac_cv_struct_tm_zone" = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_TM_ZONE 1
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
-
 else
-  echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:4274: checking for tzname" >&5
-if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+   for ac_func in inet_aton inet_addr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4597: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4279 "configure"
+#line 4602 "configure"
 #include "confdefs.h"
-#include <time.h>
-#ifndef tzname /* For SGI.  */
-extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
-#endif
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
 int main() {
-atoi(*tzname);
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:4289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_var_tzname=yes
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_var_tzname=no
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-echo "$ac_t""$ac_cv_var_tzname" 1>&6
-  if test $ac_cv_var_tzname = yes; then
-    cat >> confdefs.h <<\EOF
-#define HAVE_TZNAME 1
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
-
-  fi
+ break
+else
+  echo "$ac_t""no" 1>&6
 fi
+done
 
-
-   for ac_func in gethostbyname_r
+   for ac_func in inet_pton uname inet_ntoa
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4314: checking for $ac_func" >&5
+echo "configure:4652: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4319 "configure"
+#line 4657 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4338,7 +4676,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4357,594 +4695,550 @@ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
 #define $ac_tr_func 1
 EOF
  
-     cat >> confdefs.h <<\EOF
-#define HAVE_GETHOSTBYNAME_R 1
-EOF
-
-     # There are two different kinds of gethostbyname_r.
-     # We look for the one that returns `int'.
-     # Hopefully this check is robust enough.
-     cat > conftest.$ac_ext <<EOF
-#line 4369 "configure"
-#include "confdefs.h"
-#include <netdb.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "int.*gethostbyname_r" >/dev/null 2>&1; then
-  rm -rf conftest*
-  
-       cat >> confdefs.h <<\EOF
-#define GETHOSTBYNAME_R_RETURNS_INT 1
-EOF
-
+else
+  echo "$ac_t""no" 1>&6
 fi
-rm -f conftest*
-
+done
 
-     case " $GCINCS " in
-     *" -D_REENTRANT "*) ;;
-     *)
-               echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
-echo "configure:4389: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
-if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
+   for ac_func in fork execvp pipe sigaction ftruncate
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4707: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-   
-         ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-
-         cat > conftest.$ac_ext <<EOF
-#line 4402 "configure"
-#include "confdefs.h"
-#include <netdb.h>
-int main() {
-gethostbyname_r("", 0, 0);
-; return 0; }
-EOF
-if { (eval echo configure:4409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  libjava_cv_gethostbyname_r_needs_reentrant=no
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-               CPPFLAGS_SAVE="$CPPFLAGS"
-               CPPFLAGS="$CPPFLAGS -D_REENTRANT"
-               cat > conftest.$ac_ext <<EOF
-#line 4419 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 4712 "configure"
 #include "confdefs.h"
-#include <netdb.h>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
 int main() {
-gethostbyname_r("", 0, 0);
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:4426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  libjava_cv_gethostbyname_r_needs_reentrant=yes
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  libjava_cv_gethostbyname_r_needs_reentrant=fail
-fi
-rm -f conftest*
-               CPPFLAGS="$CPPFLAGS_SAVE"
-         
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-         ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-       
 fi
 
-echo "$ac_t""$libjava_cv_gethostbyname_r_needs_reentrant" 1>&6
-       if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
-         cat >> confdefs.h <<\EOF
-#define _REENTRANT 1
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
 
-       fi
-     ;;
-     esac
-
-     echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
-echo "configure:4461: checking for struct hostent_data" >&5
-if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
+   for ac_hdr in execinfo.h unistd.h dlfcn.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:4763: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-       cat > conftest.$ac_ext <<EOF
-#line 4466 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 4768 "configure"
 #include "confdefs.h"
-
-#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
-# define _REENTRANT 1
-#endif
-#include <netdb.h>
-int main() {
-struct hostent_data data;
-; return 0; }
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:4477: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  libjava_cv_struct_hostent_data=yes
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  libjava_cv_struct_hostent_data=no
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
 fi
-
-echo "$ac_t""$libjava_cv_struct_hostent_data" 1>&6
-     if test "x$libjava_cv_struct_hostent_data" = xyes; then
-       cat >> confdefs.h <<\EOF
-#define HAVE_STRUCT_HOSTENT_DATA 1
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
 EOF
-
-     fi
-   
 else
   echo "$ac_t""no" 1>&6
 fi
 done
-
-
-   # FIXME: libjava source code expects to find a prototype for
-   # gethostbyaddr_r in netdb.h.  The outer check ensures that
-   # HAVE_GETHOSTBYADDR_R will not be defined if the prototype fails
-   # to exist where expected.  (The root issue: AC_CHECK_FUNCS assumes C
-   # linkage check is enough, yet C++ code requires proper prototypes.)
-   cat > conftest.$ac_ext <<EOF
-#line 4509 "configure"
-#include "confdefs.h"
-#include <netdb.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "gethostbyaddr_r" >/dev/null 2>&1; then
-  rm -rf conftest*
-  
-   for ac_func in gethostbyaddr_r
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4520: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "checking for backtrace""... $ac_c" 1>&6
+echo "configure:4800: checking for backtrace" >&5
+if eval "test \"`echo '$''{'ac_cv_func_backtrace'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4525 "configure"
+#line 4805 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char backtrace(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char backtrace();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_backtrace) || defined (__stub___backtrace)
 choke me
 #else
-$ac_func();
+backtrace();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:4548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_func_backtrace=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_func_backtrace=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'backtrace`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-     cat >> confdefs.h <<\EOF
-#define HAVE_GETHOSTBYADDR_R 1
-EOF
-
-     # There are two different kinds of gethostbyaddr_r.
-     # We look for the one that returns `int'.
-     # Hopefully this check is robust enough.
-     cat > conftest.$ac_ext <<EOF
-#line 4575 "configure"
-#include "confdefs.h"
-#include <netdb.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "int.*gethostbyaddr_r" >/dev/null 2>&1; then
-  rm -rf conftest*
   
-       cat >> confdefs.h <<\EOF
-#define GETHOSTBYADDR_R_RETURNS_INT 1
+     case "$host" in
+       ia64-*-linux*)
+        # Has broken backtrace()
+        ;;
+       s390*-*-linux*)
+        # Has broken backtrace()
+        ;;
+       *)
+         cat >> confdefs.h <<\EOF
+#define HAVE_BACKTRACE 1
 EOF
 
-fi
-rm -f conftest*
-
+        ;;
+     esac
+   
 else
   echo "$ac_t""no" 1>&6
-fi
-done
 
+     case "$host" in
+       *mingw*)
+         # Has backtrace() defined in libgcj itself
+         cat >> confdefs.h <<\EOF
+#define HAVE_BACKTRACE 1
+EOF
+
+         ;;
+     esac
+   
 fi
-rm -f conftest*
 
 
-   for ac_func in gethostname
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4602: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6
+echo "configure:4875: checking for dladdr in -ldl" >&5
+ac_lib_var=`echo dl'_'dladdr | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4607 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4883 "configure"
+#include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char $ac_func();
+char dladdr();
 
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+dladdr()
 ; return 0; }
 EOF
-if { (eval echo configure:4630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
+  
      cat >> confdefs.h <<\EOF
-#define HAVE_GETHOSTNAME 1
+#define HAVE_DLADDR 1
 EOF
 
-     cat > conftest.$ac_ext <<EOF
-#line 4654 "configure"
-#include "confdefs.h"
-#include <unistd.h>
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+   if test x"$build" = x"$host"; then
+     for ac_file in /proc/self/exe
+do
+
+ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_file""... $ac_c" 1>&6
+echo "configure:4924: checking for $ac_file" >&5
+if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; }
+else
+  if test -r $ac_file; then
+    eval "ac_cv_file_$ac_safe=yes"
+  else
+    eval "ac_cv_file_$ac_safe=no"
+  fi
+fi
+fi
+if eval "test \"`echo '$ac_cv_file_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_file=HAVE_`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_file 1
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "gethostname" >/dev/null 2>&1; then
-  rm -rf conftest*
-  
        cat >> confdefs.h <<\EOF
-#define HAVE_GETHOSTNAME_DECL 1
+#define HAVE_PROC_SELF_EXE 1
 EOF
 
-fi
-rm -f conftest*
-
 else
   echo "$ac_t""no" 1>&6
+
 fi
 done
 
+   else
+     case $host in
+     *-linux*)
+       cat >> confdefs.h <<\EOF
+#define HAVE_PROC_SELF_EXE 1
+EOF
+
+       ;;
+     esac
+   fi
 
-   # Look for these functions in the thread library, but only bother
-   # if using POSIX threads.
-   if test "$THREADS" = posix; then
-      save_LIBS="$LIBS"
-      LIBS="$LIBS $THREADLIBS"
-      # Some POSIX thread systems don't have pthread_mutexattr_settype.
-      # E.g., Solaris.
-      for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4685: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+   
+    
+  am_cv_lib_iconv_ldpath=
+  # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given.
+if test "${with_libiconv_prefix+set}" = set; then
+  withval="$with_libiconv_prefix"
+  
+    for dir in `echo "$withval" | tr : ' '`; do
+      if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
+      if test -d $dir/lib; then am_cv_lib_iconv_ldpath="-L$dir/lib"; fi
+    done
+   
+fi
+
+
+  echo $ac_n "checking for iconv""... $ac_c" 1>&6
+echo "configure:4982: checking for iconv" >&5
+if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4690 "configure"
+  
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    cat > conftest.$ac_ext <<EOF
+#line 4990 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
+#include <stdlib.h>
+#include <iconv.h>
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+iconv_t cd = iconv_open("","");
+       iconv(cd,NULL,NULL,NULL,NULL);
+       iconv_close(cd);
 ; return 0; }
 EOF
-if { (eval echo configure:4713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  am_cv_func_iconv=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $am_cv_libiconv_ldpath -liconv"
+      cat > conftest.$ac_ext <<EOF
+#line 5012 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <iconv.h>
+int main() {
+iconv_t cd = iconv_open("","");
+         iconv(cd,NULL,NULL,NULL,NULL);
+         iconv_close(cd);
+; return 0; }
 EOF
+if { (eval echo configure:5022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  am_cv_lib_iconv=yes
+        am_cv_func_iconv=yes
 else
-  echo "$ac_t""no" 1>&6
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+      LIBS="$am_save_LIBS"
+    fi
+  
 fi
-done
 
+echo "$ac_t""$am_cv_func_iconv" 1>&6
+  if test "$am_cv_func_iconv" = yes; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_ICONV 1
+EOF
 
-      # Look for sched_yield.  Up to Solaris 2.6, it is in libposix4, since
-      # Solaris 7 the name librt is preferred.
-      for ac_func in sched_yield
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4743: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+    echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6
+echo "configure:5043: checking for iconv declaration" >&5
+    if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4748 "configure"
+  
+      cat > conftest.$ac_ext <<EOF
+#line 5049 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
 
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
 #else
-$ac_func();
+size_t iconv();
 #endif
 
+int main() {
+
 ; return 0; }
 EOF
-if { (eval echo configure:4771: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5068: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  am_cv_proto_iconv_arg1=""
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  am_cv_proto_iconv_arg1="const"
 fi
 rm -f conftest*
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
+    am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    echo "$ac_t""${ac_t:-
+         }$am_cv_proto_iconv" 1>&6
+    cat >> confdefs.h <<EOF
+#define ICONV_CONST $am_cv_proto_iconv_arg1
 EOF
-else
-  echo "$ac_t""no" 1>&6
-echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:4793: checking for sched_yield in -lrt" >&5
-ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lrt  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 4801 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char sched_yield();
 
+  fi
+  LIBICONV=
+  if test "$am_cv_lib_iconv" = yes; then
+    LIBICONV="$am_cv_lib_iconv_ldpath -liconv"
+  fi
+  
+
+   if test $ac_cv_header_locale_h = yes; then
+    echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+echo "configure:5097: checking for LC_MESSAGES" >&5
+if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5102 "configure"
+#include "confdefs.h"
+#include <locale.h>
 int main() {
-sched_yield()
+return LC_MESSAGES
 ; return 0; }
 EOF
-if { (eval echo configure:4812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5109: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  am_cv_val_LC_MESSAGES=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  am_cv_val_LC_MESSAGES=no
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  
-         cat >> confdefs.h <<\EOF
-#define HAVE_SCHED_YIELD 1
-EOF
 
-         THREADLIBS="$THREADLIBS -lrt"
-         THREADSPEC="$THREADSPEC -lrt"
-else
-  echo "$ac_t""no" 1>&6
+echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
+    if test $am_cv_val_LC_MESSAGES = yes; then
+      cat >> confdefs.h <<\EOF
+#define HAVE_LC_MESSAGES 1
+EOF
 
-         echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:4838: checking for sched_yield in -lposix4" >&5
-ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+    fi
+  fi
+   echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
+echo "configure:5130: checking whether struct tm is in sys/time.h or time.h" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lposix4  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 4846 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 5135 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char sched_yield();
-
+#include <sys/types.h>
+#include <time.h>
 int main() {
-sched_yield()
+struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:4857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5143: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ac_cv_struct_tm=time.h
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_struct_tm=sys/time.h
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  
-           cat >> confdefs.h <<\EOF
-#define HAVE_SCHED_YIELD 1
-EOF
-
-           THREADLIBS="$THREADLIBS -lposix4"
-           THREADSPEC="$THREADSPEC -lposix4"
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-fi
+echo "$ac_t""$ac_cv_struct_tm" 1>&6
+if test $ac_cv_struct_tm = sys/time.h; then
+  cat >> confdefs.h <<\EOF
+#define TM_IN_SYS_TIME 1
+EOF
 
 fi
-done
 
-      LIBS="$save_LIBS"
-
-      # We can save a little space at runtime if the mutex has m_count
-      # or __m_count.  This is a nice hack for Linux.
-      cat > conftest.$ac_ext <<EOF
-#line 4893 "configure"
+echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
+echo "configure:5164: checking for tm_zone in struct tm" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5169 "configure"
 #include "confdefs.h"
-#include <pthread.h>
+#include <sys/types.h>
+#include <$ac_cv_struct_tm>
 int main() {
-
-          extern pthread_mutex_t *mutex; int q = mutex->m_count;
-        
+struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:4902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define PTHREAD_MUTEX_HAVE_M_COUNT 1
-EOF
-
+  ac_cv_struct_tm_zone=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  
-       cat > conftest.$ac_ext <<EOF
-#line 4914 "configure"
+  ac_cv_struct_tm_zone=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6
+if test "$ac_cv_struct_tm_zone" = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_TM_ZONE 1
+EOF
+
+else
+  echo $ac_n "checking for tzname""... $ac_c" 1>&6
+echo "configure:5197: checking for tzname" >&5
+if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5202 "configure"
 #include "confdefs.h"
-#include <pthread.h>
+#include <time.h>
+#ifndef tzname /* For SGI.  */
+extern char *tzname[]; /* RS6000 and others reject char **tzname.  */
+#endif
 int main() {
-
-           extern pthread_mutex_t *mutex; int q = mutex->__m_count;
-         
+atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:4923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define PTHREAD_MUTEX_HAVE___M_COUNT 1
-EOF
-
+  ac_cv_var_tzname=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_var_tzname=no
 fi
 rm -f conftest*
 fi
-rm -f conftest*
-   fi
 
-   # We require a way to get the time.
-   time_found=no
-   for ac_func in gettimeofday time ftime
+echo "$ac_t""$ac_cv_var_tzname" 1>&6
+  if test $ac_cv_var_tzname = yes; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_TZNAME 1
+EOF
+
+  fi
+fi
+
+
+   for ac_func in gethostbyname_r
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4943: checking for $ac_func" >&5
+echo "configure:5237: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4948 "configure"
+#line 5242 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4967,7 +5261,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4971: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4985,83 +5279,172 @@ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   cat >> confdefs.h <<EOF
 #define $ac_tr_func 1
 EOF
- time_found=yes
-else
-  echo "$ac_t""no" 1>&6
+     cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYNAME_R 1
+EOF
+
+     # There are two different kinds of gethostbyname_r.
+     # We look for the one that returns `int'.
+     # Hopefully this check is robust enough.
+     cat > conftest.$ac_ext <<EOF
+#line 5292 "configure"
+#include "confdefs.h"
+#include <netdb.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "int.*gethostbyname_r" >/dev/null 2>&1; then
+  rm -rf conftest*
+  
+       cat >> confdefs.h <<\EOF
+#define GETHOSTBYNAME_R_RETURNS_INT 1
+EOF
+
 fi
-done
+rm -f conftest*
 
-   if test "$time_found" = no; then
-      { echo "configure: error: no function found to get the time" 1>&2; exit 1; }
-   fi
 
-   for ac_func in memmove
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5002: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+     case " $GCINCS " in
+     *" -D_REENTRANT "*) ;;
+     *)
+               echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
+echo "configure:5312: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
+if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5007 "configure"
+   
+         ac_ext=C
+# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cxx_cross
+
+         cat > conftest.$ac_ext <<EOF
+#line 5325 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
+#include <netdb.h>
+int main() {
+gethostbyname_r("", 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:5332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libjava_cv_gethostbyname_r_needs_reentrant=no
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+               CPPFLAGS_SAVE="$CPPFLAGS"
+               CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+               cat > conftest.$ac_ext <<EOF
+#line 5342 "configure"
+#include "confdefs.h"
+#include <netdb.h>
+int main() {
+gethostbyname_r("", 0, 0);
+; return 0; }
+EOF
+if { (eval echo configure:5349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  libjava_cv_gethostbyname_r_needs_reentrant=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  libjava_cv_gethostbyname_r_needs_reentrant=fail
+fi
+rm -f conftest*
+               CPPFLAGS="$CPPFLAGS_SAVE"
+         
+fi
+rm -f conftest*
+         ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+       
+fi
+
+echo "$ac_t""$libjava_cv_gethostbyname_r_needs_reentrant" 1>&6
+       if test "x$libjava_cv_gethostbyname_r_needs_reentrant" = xyes; then
+         cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+       fi
+     ;;
+     esac
 
-int main() {
+     echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
+echo "configure:5384: checking for struct hostent_data" >&5
+if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+       cat > conftest.$ac_ext <<EOF
+#line 5389 "configure"
+#include "confdefs.h"
 
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
+#if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT)
+# define _REENTRANT 1
 #endif
-
+#include <netdb.h>
+int main() {
+struct hostent_data data;
 ; return 0; }
 EOF
-if { (eval echo configure:5030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  libjava_cv_struct_hostent_data=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  libjava_cv_struct_hostent_data=no
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
+echo "$ac_t""$libjava_cv_struct_hostent_data" 1>&6
+     if test "x$libjava_cv_struct_hostent_data" = xyes; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_HOSTENT_DATA 1
 EOF
+
+     fi
+   
 else
   echo "$ac_t""no" 1>&6
 fi
 done
 
 
-   # We require memcpy.
-   memcpy_found=no
-   for ac_func in memcpy
+   # FIXME: libjava source code expects to find a prototype for
+   # gethostbyaddr_r in netdb.h.  The outer check ensures that
+   # HAVE_GETHOSTBYADDR_R will not be defined if the prototype fails
+   # to exist where expected.  (The root issue: AC_CHECK_FUNCS assumes C
+   # linkage check is enough, yet C++ code requires proper prototypes.)
+   cat > conftest.$ac_ext <<EOF
+#line 5432 "configure"
+#include "confdefs.h"
+#include <netdb.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "gethostbyaddr_r" >/dev/null 2>&1; then
+  rm -rf conftest*
+  
+   for ac_func in gethostbyaddr_r
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5060: checking for $ac_func" >&5
+echo "configure:5443: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5065 "configure"
+#line 5448 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -5084,7 +5467,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -5102,350 +5485,253 @@ if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   cat >> confdefs.h <<EOF
 #define $ac_tr_func 1
 EOF
- memcpy_found=yes
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-   if test "$memcpy_found" = no; then
-      { echo "configure: error: memcpy is required" 1>&2; exit 1; }
-   fi
+     cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTBYADDR_R 1
+EOF
 
-   echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5117: checking for dlopen in -ldl" >&5
-ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5125 "configure"
+     # There are two different kinds of gethostbyaddr_r.
+     # We look for the one that returns `int'.
+     # Hopefully this check is robust enough.
+     cat > conftest.$ac_ext <<EOF
+#line 5498 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dlopen();
-
-int main() {
-dlopen()
-; return 0; }
+#include <netdb.h>
 EOF
-if { (eval echo configure:5136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "int.*gethostbyaddr_r" >/dev/null 2>&1; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
   
        cat >> confdefs.h <<\EOF
-#define HAVE_DLOPEN 1
+#define GETHOSTBYADDR_R_RETURNS_INT 1
 EOF
 
+fi
+rm -f conftest*
+
 else
   echo "$ac_t""no" 1>&6
 fi
+done
 
+fi
+rm -f conftest*
 
-   # Some library-finding code we stole from Tcl.
-   #--------------------------------------------------------------------
-   #   Check for the existence of the -lsocket and -lnsl libraries.
-   #   The order here is important, so that they end up in the right
-   #   order in the command line generated by make.  Here are some
-   #   special considerations:
-   #   1. Use "connect" and "accept" to check for -lsocket, and
-   #      "gethostbyname" to check for -lnsl.
-   #   2. Use each function name only once:  can't redo a check because
-   #      autoconf caches the results of the last check and won't redo it.
-   #   3. Use -lnsl and -lsocket only if they supply procedures that
-   #      aren't already present in the normal libraries.  This is because
-   #      IRIX 5.2 has libraries, but they aren't needed and they're
-   #      bogus:  they goof up name resolution if used.
-   #   4. On some SVR4 systems, can't use -lsocket without -lnsl too.
-   #      To get around this problem, check for both libraries together
-   #      if -lsocket doesn't work by itself.
-   #--------------------------------------------------------------------
 
-   echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
-echo "configure:5181: checking for socket libraries" >&5
-if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  gcj_cv_lib_sockets=
-     gcj_checkBoth=0
-     unset ac_cv_func_connect
-     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5189: checking for connect" >&5
-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+   for ac_func in gethostname
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5525: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5194 "configure"
+#line 5530 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char connect(); below.  */
+    which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char connect();
+char $ac_func();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_connect) || defined (__stub___connect)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-connect();
+$ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_connect=yes"
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_connect=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  gcj_checkSocket=0
-else
-  echo "$ac_t""no" 1>&6
-gcj_checkSocket=1
-fi
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+     cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTNAME 1
+EOF
 
-     if test "$gcj_checkSocket" = 1; then
-        unset ac_cv_func_connect
-        echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:5240: checking for main in -lsocket" >&5
-ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lsocket  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5248 "configure"
+     cat > conftest.$ac_ext <<EOF
+#line 5577 "configure"
 #include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
+#include <unistd.h>
 EOF
-if { (eval echo configure:5255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "gethostname" >/dev/null 2>&1; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  
+       cat >> confdefs.h <<\EOF
+#define HAVE_GETHOSTNAME_DECL 1
+EOF
+
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
 
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  gcj_cv_lib_sockets="-lsocket"
 else
   echo "$ac_t""no" 1>&6
-gcj_checkBoth=1
 fi
+done
 
-     fi
-     if test "$gcj_checkBoth" = 1; then
-        gcj_oldLibs=$LIBS
-        LIBS="$LIBS -lsocket -lnsl"
-        unset ac_cv_func_accept
-        echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:5282: checking for accept" >&5
-if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
+
+   # Look for these functions in the thread library, but only bother
+   # if using POSIX threads.
+   if test "$THREADS" = posix; then
+      save_LIBS="$LIBS"
+      LIBS="$LIBS $THREADLIBS"
+      # Some POSIX thread systems don't have pthread_mutexattr_settype.
+      # E.g., Solaris.
+      for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5608: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5287 "configure"
+#line 5613 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char accept(); below.  */
+    which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char accept();
+char $ac_func();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_accept) || defined (__stub___accept)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-accept();
+$ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_accept=yes"
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_accept=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'accept`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  gcj_checkNsl=0
-                       gcj_cv_lib_sockets="-lsocket -lnsl"
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
 else
-  echo "$ac_t""no" 1>&6
-fi
-
-        unset ac_cv_func_accept
-        LIBS=$gcj_oldLibs
-     fi
-     unset ac_cv_func_gethostbyname
-     gcj_oldLibs=$LIBS
-     LIBS="$LIBS $gcj_cv_lib_sockets"
-     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:5337: checking for gethostbyname" >&5
-if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+
+      # Look for sched_yield.  Up to Solaris 2.6, it is in libposix4, since
+      # Solaris 7 the name librt is preferred.
+      for ac_func in sched_yield
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5666: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5342 "configure"
+#line 5671 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char gethostbyname(); below.  */
+    which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char gethostbyname();
+char $ac_func();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-gethostbyname();
+$ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:5365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_gethostbyname=yes"
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_gethostbyname=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  :
-else
-  echo "$ac_t""no" 1>&6
-echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:5383: checking for main in -lnsl" >&5
-ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lnsl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5391 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
-if { (eval echo configure:5398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"
 else
   echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-     unset ac_cv_func_gethostbyname
-     LIBS=$gcj_oldLIBS
-   
-fi
-
-echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
-   SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets"
-
-   if test "$with_system_zlib" = yes; then
-      echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
-echo "configure:5430: checking for deflate in -lz" >&5
-ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
+echo "configure:5716: checking for sched_yield in -lrt" >&5
+ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lz  $LIBS"
+LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5438 "configure"
+#line 5724 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char deflate();
+char sched_yield();
 
 int main() {
-deflate()
+sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:5449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5460,34 +5746,37 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  ZLIBSPEC=-lz
+  
+         cat >> confdefs.h <<\EOF
+#define HAVE_SCHED_YIELD 1
+EOF
+
+         THREADLIBS="$THREADLIBS -lrt"
+         THREADSPEC="$THREADSPEC -lrt"
 else
   echo "$ac_t""no" 1>&6
-ZLIBSPEC=
-fi
-
-   fi
 
-   # On Solaris, and maybe other architectures, the Boehm collector
-   # requires -ldl.
-   if test "$GC" = boehm; then
-      echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:5476: checking for main in -ldl" >&5
-ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
+         echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
+echo "configure:5761: checking for sched_yield in -lposix4" >&5
+ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-ldl  $LIBS"
+LIBS="-lposix4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5484 "configure"
+#line 5769 "configure"
 #include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char sched_yield();
 
 int main() {
-main()
+sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:5491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5502,2033 +5791,2557 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  SYSTEMSPEC="$SYSTEMSPEC -ldl"
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-   fi
-
-   if test -z "${with_multisubdir}"; then
-      builddotdot=.
-   else
-
-      builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`
-
-   fi
-   if test -x "${builddotdot}/../../gcc/gcj"; then
-      dir="`cd ${builddotdot}/../../gcc && ${PWDCMD-pwd}`"
-      GCJ="$dir/gcj -B`${PWDCMD-pwd}`/ -B$dir/"
-   else
-      CANADIAN=yes
-      NULL_TARGET=yes
-      GCJ="gcj -B`${PWDCMD-pwd}`/"
-   fi
-fi
-
-# Create it, so that compile/link tests don't fail
-test -f libgcj.spec || touch libgcj.spec
-
-# We must search the source tree for java.lang, since we still don't
-# have libgcj.jar nor java/lang/*.class
-GCJ_SAVE_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
-
-# Since some classes depend on this one, we need its source available
-# before we can do any GCJ compilation test :-(
-if test ! -f gnu/classpath/Configuration.java; then
-  test -d gnu || mkdir gnu
-  test -d gnu/classpath || mkdir gnu/classpath
-  sed 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
-       < $srcdir/gnu/classpath/Configuration.java.in \
-       > gnu/classpath/Configuration.java
-  # We do not want to redirect the output of the grep below to /dev/null,
-  # but we add /dev/null to the input list so that grep will print the
-  # filename of Configuration.java in case it finds any matches.
-  if grep @ gnu/classpath/Configuration.java /dev/null; then
-    { echo "configure: error: configure.in is missing the substitutions above" 1>&2; exit 1; }
-  fi
-fi
+  
+           cat >> confdefs.h <<\EOF
+#define HAVE_SCHED_YIELD 1
+EOF
 
-# Extract the first word of "${ac_tool_prefix}gcj", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcj; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5557: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$GCJ"; then
-  ac_cv_prog_GCJ="$GCJ" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_GCJ="${ac_tool_prefix}gcj"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-GCJ="$ac_cv_prog_GCJ"
-if test -n "$GCJ"; then
-  echo "$ac_t""$GCJ" 1>&6
+           THREADLIBS="$THREADLIBS -lposix4"
+           THREADSPEC="$THREADSPEC -lposix4"
 else
   echo "$ac_t""no" 1>&6
 fi
 
-
-if test -z "$ac_cv_prog_GCJ"; then
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "gcj", so it can be a program name with args.
-set dummy gcj; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5589: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$GCJ"; then
-  ac_cv_prog_GCJ="$GCJ" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_GCJ="gcj"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_GCJ" && ac_cv_prog_GCJ="no"
-fi
-fi
-GCJ="$ac_cv_prog_GCJ"
-if test -n "$GCJ"; then
-  echo "$ac_t""$GCJ" 1>&6
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-else
-  GCJ="no"
-fi
 fi
+done
 
-  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
-  
-
-
-LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
-lt_save_CC="$CC"
-lt_save_CFLAGS="$CFLAGS"
-AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
-MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
-LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
-AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
-objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
-deplibs_check_method="$deplibs_check_method" \
-file_magic_cmd="$file_magic_cmd" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
---build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
-|| { echo "configure: error: libtool tag configuration failed" 1>&2; exit 1; }
-CC="$lt_save_CC"
-CFLAGS="$lt_save_CFLAGS"
+      LIBS="$save_LIBS"
 
-# Redirect the config.log output again, so that the ltconfig log is not
-# clobbered by the next message.
-exec 5>>./config.log
+      # We can save a little space at runtime if the mutex has m_count
+      # or __m_count.  This is a nice hack for Linux.
+      cat > conftest.$ac_ext <<EOF
+#line 5816 "configure"
+#include "confdefs.h"
+#include <pthread.h>
+int main() {
 
+          extern pthread_mutex_t *mutex; int q = mutex->m_count;
+        
+; return 0; }
+EOF
+if { (eval echo configure:5825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define PTHREAD_MUTEX_HAVE_M_COUNT 1
+EOF
 
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  
+       cat > conftest.$ac_ext <<EOF
+#line 5837 "configure"
+#include "confdefs.h"
+#include <pthread.h>
+int main() {
 
+           extern pthread_mutex_t *mutex; int q = mutex->__m_count;
+         
+; return 0; }
+EOF
+if { (eval echo configure:5846: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define PTHREAD_MUTEX_HAVE___M_COUNT 1
+EOF
 
-CPPFLAGS=$GCJ_SAVE_CPPFLAGS
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+   fi
 
-echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:5651: checking size of void *" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
+   # We require a way to get the time.
+   time_found=no
+   for ac_func in gettimeofday time ftime
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5866: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  for ac_size in 4 8 1 2 16 12  ; do # List sizes in rough order of prevalence.
   cat > conftest.$ac_ext <<EOF
-#line 5657 "configure"
-#include "confdefs.h"
+#line 5871 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
 
 int main() {
-switch (0) case 0: case (sizeof (void *) == $ac_size):;
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:5667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_sizeof_void_p=$ac_size
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
-  if test x$ac_cv_sizeof_void_p != x ; then break; fi
-done
-
 fi
 
-if test x$ac_cv_sizeof_void_p = x ; then
-  { echo "configure: error: cannot determine a size for void *" 1>&2; exit 1; }
-fi
-echo "$ac_t""$ac_cv_sizeof_void_p" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
 EOF
-
-
-
-ZLIBS=
-SYS_ZLIBS=
-ZINCS=
-
-if test -z "$ZLIBSPEC"; then
-   # Use zlib from the GCC tree.
-   ZINCS='-I$(top_srcdir)/../zlib'
-   ZLIBS=../zlib/libzgcj_convenience.la
+ time_found=yes
 else
-   # System's zlib.
-   SYS_ZLIBS="$ZLIBSPEC"
+  echo "$ac_t""no" 1>&6
 fi
+done
 
+   if test "$time_found" = no; then
+      { echo "configure: error: no function found to get the time" 1>&2; exit 1; }
+   fi
 
+   for ac_func in memmove
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5925: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5930 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
 
+int main() {
 
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
 
-
-
-
-
-if test "$CANADIAN" = yes; then
-  CANADIAN_TRUE=
-  CANADIAN_FALSE='#'
+; return 0; }
+EOF
+if { (eval echo configure:5953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
 else
-  CANADIAN_TRUE='#'
-  CANADIAN_FALSE=
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
 fi
 
-
-if test "$NULL_TARGET" = yes; then
-  NULL_TARGET_TRUE=
-  NULL_TARGET_FALSE='#'
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
 else
-  NULL_TARGET_TRUE='#'
-  NULL_TARGET_FALSE=
+  echo "$ac_t""no" 1>&6
 fi
+done
 
 
-if test "$NATIVE" = yes || test "$NULL_TARGET" = yes; then
-  NATIVE_TRUE=
-  NATIVE_FALSE='#'
+   # We require memcpy.
+   memcpy_found=no
+   for ac_func in memcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:5983: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  NATIVE_TRUE='#'
-  NATIVE_FALSE=
-fi
+  cat > conftest.$ac_ext <<EOF
+#line 5988 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
 
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
 
-if test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes; then
-  NEEDS_DATA_START_TRUE=
-  NEEDS_DATA_START_FALSE='#'
+; return 0; }
+EOF
+if { (eval echo configure:6011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
 else
-  NEEDS_DATA_START_TRUE='#'
-  NEEDS_DATA_START_FALSE=
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
 fi
 
-
-if test -n "$with_cross_host" &&
-   test x"$with_cross_host" != x"no"; then
-  toolexecdir='$(exec_prefix)/$(target_alias)'
-  toolexecmainlibdir='$(toolexecdir)/lib'
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+ memcpy_found=yes
 else
-  toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
-  toolexecmainlibdir='$(libdir)'
+  echo "$ac_t""no" 1>&6
 fi
-toolexeclibdir=$toolexecmainlibdir/`$CC -print-multi-os-directory`
-
+done
 
+   if test "$memcpy_found" = no; then
+      { echo "configure: error: memcpy is required" 1>&2; exit 1; }
+   fi
 
+   echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:6040: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6048 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char dlopen();
 
-# Determine gcj version number.
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:6059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
-gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+       cat >> confdefs.h <<\EOF
+#define HAVE_DLOPEN 1
+EOF
 
-GCJVERSION=$gcjversion
+else
+  echo "$ac_t""no" 1>&6
+fi
 
-cat >> confdefs.h <<EOF
-#define GCJVERSION "$GCJVERSION"
-EOF
 
+   # Some library-finding code we stole from Tcl.
+   #--------------------------------------------------------------------
+   #   Check for the existence of the -lsocket and -lnsl libraries.
+   #   The order here is important, so that they end up in the right
+   #   order in the command line generated by make.  Here are some
+   #   special considerations:
+   #   1. Use "connect" and "accept" to check for -lsocket, and
+   #      "gethostbyname" to check for -lnsl.
+   #   2. Use each function name only once:  can't redo a check because
+   #      autoconf caches the results of the last check and won't redo it.
+   #   3. Use -lnsl and -lsocket only if they supply procedures that
+   #      aren't already present in the normal libraries.  This is because
+   #      IRIX 5.2 has libraries, but they aren't needed and they're
+   #      bogus:  they goof up name resolution if used.
+   #   4. On some SVR4 systems, can't use -lsocket without -lnsl too.
+   #      To get around this problem, check for both libraries together
+   #      if -lsocket doesn't work by itself.
+   #--------------------------------------------------------------------
 
-echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6
-echo "configure:5772: checking for g++ -ffloat-store bug" >&5
-save_CFLAGS="$CFLAGS"
-CFLAGS="-x c++ -O2 -ffloat-store"
-cat > conftest.$ac_ext <<EOF
-#line 5776 "configure"
+   echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
+echo "configure:6104: checking for socket libraries" >&5
+if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  gcj_cv_lib_sockets=
+     gcj_checkBoth=0
+     unset ac_cv_func_connect
+     echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:6112: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6117 "configure"
 #include "confdefs.h"
-#include <math.h>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char connect(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char connect();
+
 int main() {
 
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+connect();
+#endif
+
 ; return 0; }
 EOF
-if { (eval echo configure:5783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  eval "ac_cv_func_connect=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define __NO_MATH_INLINES 1
-EOF
-
-   echo "$ac_t""yes" 1>&6
+  eval "ac_cv_func_connect=no"
 fi
 rm -f conftest*
-CFLAGS="$save_CFLAGS"
+fi
 
-for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h pwd.h sys/config.h stdint.h langinfo.h locale.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5803: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  gcj_checkSocket=0
+else
+  echo "$ac_t""no" 1>&6
+gcj_checkSocket=1
+fi
+
+     if test "$gcj_checkSocket" = 1; then
+        unset ac_cv_func_connect
+        echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
+echo "configure:6163: checking for main in -lsocket" >&5
+ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5808 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lsocket  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6171 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+
+int main() {
+main()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:6178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
+  gcj_cv_lib_sockets="-lsocket"
 else
   echo "$ac_t""no" 1>&6
+gcj_checkBoth=1
 fi
-done
 
-for ac_hdr in dirent.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5843: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+     fi
+     if test "$gcj_checkBoth" = 1; then
+        gcj_oldLibs=$LIBS
+        LIBS="$LIBS -lsocket -lnsl"
+        unset ac_cv_func_accept
+        echo $ac_n "checking for accept""... $ac_c" 1>&6
+echo "configure:6205: checking for accept" >&5
+if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5848 "configure"
+#line 6210 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char accept(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char accept();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_accept) || defined (__stub___accept)
+choke me
+#else
+accept();
+#endif
+
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:6233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_func_accept=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_func_accept=no"
 fi
 rm -f conftest*
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'accept`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
+  gcj_checkNsl=0
+                       gcj_cv_lib_sockets="-lsocket -lnsl"
 else
   echo "$ac_t""no" 1>&6
 fi
-done
 
-for ac_hdr in inttypes.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5883: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+        unset ac_cv_func_accept
+        LIBS=$gcj_oldLibs
+     fi
+     unset ac_cv_func_gethostbyname
+     gcj_oldLibs=$LIBS
+     LIBS="$LIBS $gcj_cv_lib_sockets"
+     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:6260: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5888 "configure"
+#line 6265 "configure"
 #include "confdefs.h"
-#include <$ac_hdr>
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gethostbyname();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:6288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_func_gethostbyname=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_func_gethostbyname=no"
 fi
 rm -f conftest*
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-    cat >> confdefs.h <<\EOF
-#define HAVE_INTTYPES_H 1
-EOF
-
-    cat >> confdefs.h <<\EOF
-#define JV_HAVE_INTTYPES_H 1
-EOF
-
 
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
 else
   echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:5929: checking for sys/wait.h that is POSIX.1 compatible" >&5
-if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
+echo "configure:6306: checking for main in -lnsl" >&5
+ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5934 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lnsl  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6314 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
+
 int main() {
-int s;
-wait (&s);
-s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:5950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_header_sys_wait_h=yes
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_header_sys_wait_h=no
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  gcj_cv_lib_sockets="$gcj_cv_lib_sockets -lnsl"
+else
+  echo "$ac_t""no" 1>&6
 fi
 
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
-if test $ac_cv_header_sys_wait_h = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_SYS_WAIT_H 1
-EOF
+fi
 
+     unset ac_cv_func_gethostbyname
+     LIBS=$gcj_oldLIBS
+   
 fi
 
+echo "$ac_t""$gcj_cv_lib_sockets" 1>&6
+   SYSTEMSPEC="$SYSTEMSPEC $gcj_cv_lib_sockets"
 
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:5972: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+   if test "$with_system_zlib" = yes; then
+      echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
+echo "configure:6353: checking for deflate in -lz" >&5
+ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5977 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lz  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6361 "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char deflate();
+
+int main() {
+deflate()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+if { (eval echo configure:6372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_header_stdc=yes
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_header_stdc=no
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 6002 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "memchr" >/dev/null 2>&1; then
-  :
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  ZLIBSPEC=-lz
 else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
+  echo "$ac_t""no" 1>&6
+ZLIBSPEC=
 fi
-rm -f conftest*
 
+   fi
+
+   # Test for Gtk stuff, if asked for.
+   if test "$use_gtk_awt" = yes; then
+      # Check whether --with-gtk-prefix or --without-gtk-prefix was given.
+if test "${with_gtk_prefix+set}" = set; then
+  withval="$with_gtk_prefix"
+  gtk_config_prefix="$withval"
+else
+  gtk_config_prefix=""
 fi
 
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 6020 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "free" >/dev/null 2>&1; then
+# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given.
+if test "${with_gtk_exec_prefix+set}" = set; then
+  withval="$with_gtk_exec_prefix"
+  gtk_config_exec_prefix="$withval"
+else
+  gtk_config_exec_prefix=""
+fi
+
+# Check whether --enable-gtktest or --disable-gtktest was given.
+if test "${enable_gtktest+set}" = set; then
+  enableval="$enable_gtktest"
   :
 else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
+  enable_gtktest=yes
 fi
-rm -f conftest*
 
+
+  for module in . 
+  do
+      case "$module" in
+         gthread) 
+             gtk_config_args="$gtk_config_args gthread"
+         ;;
+      esac
+  done
+
+  if test x$gtk_config_exec_prefix != x ; then
+     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
+     fi
+  fi
+  if test x$gtk_config_prefix != x ; then
+     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
+     fi
+  fi
+
+  # Extract the first word of "gtk-config", so it can be a program name with args.
+set dummy gtk-config; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6447: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$GTK_CONFIG" in
+  /*)
+  ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_GTK_CONFIG="$GTK_CONFIG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_GTK_CONFIG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_GTK_CONFIG" && ac_cv_path_GTK_CONFIG="no"
+  ;;
+esac
+fi
+GTK_CONFIG="$ac_cv_path_GTK_CONFIG"
+if test -n "$GTK_CONFIG"; then
+  echo "$ac_t""$GTK_CONFIG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
 fi
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
-  :
+  min_gtk_version=1.2.4
+  echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
+echo "configure:6482: checking for GTK - version >= $min_gtk_version" >&5
+  no_gtk=""
+  if test "$GTK_CONFIG" = "no" ; then
+    no_gtk=yes
+  else
+    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
+    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
+    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+      rm -f conf.gtktest
+      if test "$cross_compiling" = yes; then
+  echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 6041 "configure"
+#line 6505 "configure"
 #include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.gtktest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If gtk-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
+      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+          (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+            GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+#endif /* defined (GTK_MAJOR_VERSION) ... */
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+              major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
+        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
 
 EOF
-if { (eval echo configure:6052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -fr conftest*
-  ac_cv_header_stdc=no
+  no_gtk=yes
 fi
 rm -fr conftest*
 fi
 
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
-  cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     echo "$ac_t""yes" 1>&6
+     :     
+  else
+     echo "$ac_t""no" 1>&6
+     if test "$GTK_CONFIG" = "no" ; then
+       echo "*** The gtk-config script installed by GTK could not be found"
+       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GTK_CONFIG environment variable to the"
+       echo "*** full path to gtk-config."
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK test program, checking why..."
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          cat > conftest.$ac_ext <<EOF
+#line 6617 "configure"
+#include "confdefs.h"
 
-fi
+#include <gtk/gtk.h>
+#include <stdio.h>
 
-echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
-echo "configure:6076: checking for ssize_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 6081 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
+int main() {
+ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); 
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_ssize_t=yes
+if { (eval echo configure:6627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+   echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK or finding the wrong"
+          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" 
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_type_ssize_t=no
+   echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
+          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
+          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" 
 fi
 rm -f conftest*
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     exit 1
+  fi
+  
+  
+  rm -f conf.gtktest
 
+      # Check whether --with-glib-prefix or --without-glib-prefix was given.
+if test "${with_glib_prefix+set}" = set; then
+  withval="$with_glib_prefix"
+  glib_config_prefix="$withval"
+else
+  glib_config_prefix=""
+fi
+
+# Check whether --with-glib-exec-prefix or --without-glib-exec-prefix was given.
+if test "${with_glib_exec_prefix+set}" = set; then
+  withval="$with_glib_exec_prefix"
+  glib_config_exec_prefix="$withval"
+else
+  glib_config_exec_prefix=""
 fi
-echo "$ac_t""$ac_cv_type_ssize_t" 1>&6
-if test $ac_cv_type_ssize_t = no; then
-  cat >> confdefs.h <<\EOF
-#define ssize_t int
-EOF
 
+# Check whether --enable-glibtest or --disable-glibtest was given.
+if test "${enable_glibtest+set}" = set; then
+  enableval="$enable_glibtest"
+  :
+else
+  enable_glibtest=yes
 fi
 
 
-echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
-echo "configure:6110: checking for in_addr_t" >&5
-cat > conftest.$ac_ext <<EOF
-#line 6112 "configure"
+  if test x$glib_config_exec_prefix != x ; then
+     glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
+     if test x${GLIB_CONFIG+set} != xset ; then
+        GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
+     fi
+  fi
+  if test x$glib_config_prefix != x ; then
+     glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
+     if test x${GLIB_CONFIG+set} != xset ; then
+        GLIB_CONFIG=$glib_config_prefix/bin/glib-config
+     fi
+  fi
+
+  for module in . gthread
+  do
+      case "$module" in
+         gmodule) 
+             glib_config_args="$glib_config_args gmodule"
+         ;;
+         gthread) 
+             glib_config_args="$glib_config_args gthread"
+         ;;
+      esac
+  done
+
+  # Extract the first word of "glib-config", so it can be a program name with args.
+set dummy glib-config; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6718: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GLIB_CONFIG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$GLIB_CONFIG" in
+  /*)
+  ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_GLIB_CONFIG="$GLIB_CONFIG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_GLIB_CONFIG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_GLIB_CONFIG" && ac_cv_path_GLIB_CONFIG="no"
+  ;;
+esac
+fi
+GLIB_CONFIG="$ac_cv_path_GLIB_CONFIG"
+if test -n "$GLIB_CONFIG"; then
+  echo "$ac_t""$GLIB_CONFIG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  min_glib_version=1.2.4
+  echo $ac_n "checking for GLIB - version >= $min_glib_version""... $ac_c" 1>&6
+echo "configure:6753: checking for GLIB - version >= $min_glib_version" >&5
+  no_glib=""
+  if test "$GLIB_CONFIG" = "no" ; then
+    no_glib=yes
+  else
+    GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
+    GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
+    glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+    glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+    glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+    if test "x$enable_glibtest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GLIB_CFLAGS"
+      LIBS="$GLIB_LIBS $LIBS"
+      rm -f conf.glibtest
+      if test "$cross_compiling" = yes; then
+  echo $ac_n "cross compiling; assumed OK... $ac_c"
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6776 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
+
+#include <glib.h>
+#include <stdio.h>
 #include <stdlib.h>
-#include <stddef.h>
-#endif
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-int main() {
-in_addr_t foo;
-; return 0; }
-EOF
-if { (eval echo configure:6126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_IN_ADDR_T 1
-EOF
 
-   echo "$ac_t""yes" 1>&6
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.glibtest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_glib_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_glib_version");
+     exit(1);
+   }
+
+  if ((glib_major_version != $glib_config_major_version) ||
+      (glib_minor_version != $glib_config_minor_version) ||
+      (glib_micro_version != $glib_config_micro_version))
+    {
+      printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
+             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+             glib_major_version, glib_minor_version, glib_micro_version);
+      printf ("*** was found! If glib-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
+      printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+          (glib_minor_version != GLIB_MINOR_VERSION) ||
+           (glib_micro_version != GLIB_MICRO_VERSION))
+    {
+      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+            GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            glib_major_version, glib_minor_version, glib_micro_version);
+    }
+  else
+    {
+      if ((glib_major_version > major) ||
+        ((glib_major_version == major) && (glib_minor_version > minor)) ||
+        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+               glib_major_version, glib_minor_version, glib_micro_version);
+        printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+              major, minor, micro);
+        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the glib-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
+        printf("*** correct copy of glib-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+
+EOF
+if { (eval echo configure:6852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  rm -fr conftest*
+  no_glib=yes
+fi
+rm -fr conftest*
 fi
-rm -f conftest*
 
-echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6142: checking whether struct ip_mreq is in netinet/in.h" >&5
-cat > conftest.$ac_ext <<EOF
-#line 6144 "configure"
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_glib" = x ; then
+     echo "$ac_t""yes" 1>&6
+     :     
+  else
+     echo "$ac_t""no" 1>&6
+     if test "$GLIB_CONFIG" = "no" ; then
+       echo "*** The glib-config script installed by GLIB could not be found"
+       echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GLIB_CONFIG environment variable to the"
+       echo "*** full path to glib-config."
+     else
+       if test -f conf.glibtest ; then
+        :
+       else
+          echo "*** Could not run GLIB test program, checking why..."
+          CFLAGS="$CFLAGS $GLIB_CFLAGS"
+          LIBS="$LIBS $GLIB_LIBS"
+          cat > conftest.$ac_ext <<EOF
+#line 6886 "configure"
 #include "confdefs.h"
-#include <netinet/in.h>
+
+#include <glib.h>
+#include <stdio.h>
+
 int main() {
-struct ip_mreq mreq;
+ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); 
 ; return 0; }
 EOF
-if { (eval echo configure:6151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_STRUCT_IP_MREQ 1
-EOF
-
-   echo "$ac_t""yes" 1>&6
+if { (eval echo configure:6896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+   echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" 
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+   echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
+          echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
+          echo "*** may want to edit the glib-config script: $GLIB_CONFIG" 
 fi
 rm -f conftest*
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GLIB_CFLAGS=""
+     GLIB_LIBS=""
+     exit 1
+  fi
+  
+  
+  rm -f conf.glibtest
 
-echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6167: checking whether struct ipv6_mreq is in netinet/in.h" >&5
-cat > conftest.$ac_ext <<EOF
-#line 6169 "configure"
-#include "confdefs.h"
-#include <netinet/in.h>
-int main() {
-struct ipv6_mreq mreq6;
-; return 0; }
-EOF
-if { (eval echo configure:6176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_STRUCT_IPV6_MREQ 1
-EOF
+            enable_libarttest=no
+      # Check whether --with-libart-prefix or --without-libart-prefix was given.
+if test "${with_libart_prefix+set}" = set; then
+  withval="$with_libart_prefix"
+  libart_prefix="$withval"
+else
+  libart_prefix=""
+fi
 
-   echo "$ac_t""yes" 1>&6
+# Check whether --with-libart-exec-prefix or --without-libart-exec-prefix was given.
+if test "${with_libart_exec_prefix+set}" = set; then
+  withval="$with_libart_exec_prefix"
+  libart_exec_prefix="$withval"
+else
+  libart_exec_prefix=""
+fi
+
+# Check whether --enable-libarttest or --disable-libarttest was given.
+if test "${enable_libarttest+set}" = set; then
+  enableval="$enable_libarttest"
+  :
+else
+  enable_libarttest=yes
+fi
+
+
+  if test x$libart_exec_prefix != x ; then
+     libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
+     if test x${LIBART_CONFIG+set} != xset ; then
+        LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
+     fi
+  fi
+  if test x$libart_prefix != x ; then
+     libart_args="$libart_args --prefix=$libart_prefix"
+     if test x${LIBART_CONFIG+set} != xset ; then
+        LIBART_CONFIG=$libart_prefix/bin/libart-config
+     fi
+  fi
+
+  # Extract the first word of "libart-config", so it can be a program name with args.
+set dummy libart-config; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:6976: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_LIBART_CONFIG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$LIBART_CONFIG" in
+  /*)
+  ac_cv_path_LIBART_CONFIG="$LIBART_CONFIG" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_LIBART_CONFIG="$LIBART_CONFIG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_LIBART_CONFIG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_LIBART_CONFIG" && ac_cv_path_LIBART_CONFIG="no"
+  ;;
+esac
+fi
+LIBART_CONFIG="$ac_cv_path_LIBART_CONFIG"
+if test -n "$LIBART_CONFIG"; then
+  echo "$ac_t""$LIBART_CONFIG" 1>&6
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
   echo "$ac_t""no" 1>&6
 fi
-rm -f conftest*
 
-echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
-echo "configure:6192: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
-cat > conftest.$ac_ext <<EOF
-#line 6194 "configure"
+  min_libart_version=2.1.0
+  echo $ac_n "checking for LIBART - version >= $min_libart_version""... $ac_c" 1>&6
+echo "configure:7011: checking for LIBART - version >= $min_libart_version" >&5
+  no_libart=""
+  if test "$LIBART_CONFIG" = "no" ; then
+    no_libart=yes
+  else
+    LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
+    LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
+
+    libart_major_version=`$LIBART_CONFIG $libart_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+    libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+    libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+    if test "x$enable_libarttest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $LIBART_CFLAGS"
+      LIBS="$LIBS $LIBART_LIBS"
+      rm -f conf.libarttest
+      if test "$cross_compiling" = yes; then
+  echo $ac_n "cross compiling; assumed OK... $ac_c"
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7035 "configure"
 #include "confdefs.h"
-#include <netinet/in.h>
-int main() {
-struct sockaddr_in6 addr6;
-; return 0; }
-EOF
-if { (eval echo configure:6201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_INET6 1
-EOF
 
-   echo "$ac_t""yes" 1>&6
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libart_lgpl/libart.h>
+
+char*
+my_strdup (char *str)
+{
+  char *new_str;
+  
+  if (str)
+    {
+      new_str = malloc ((strlen (str) + 1) * sizeof(char));
+      strcpy (new_str, str);
+    }
+  else
+    new_str = NULL;
+  
+  return new_str;
+}
+
+int main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.libarttest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = my_strdup("$min_libart_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_libart_version");
+     exit(1);
+   }
+
+   if (($libart_major_version > major) ||
+      (($libart_major_version == major) && ($libart_minor_version > minor)) ||
+      (($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
+      printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
+      printf("*** best to upgrade to the required version.\n");
+      printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
+      printf("*** to point to the correct copy of libart-config, and remove the file\n");
+      printf("*** config.cache before re-running configure\n");
+      return 1;
+    }
+}
+
+
+EOF
+if { (eval echo configure:7093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  rm -fr conftest*
+  no_libart=yes
+fi
+rm -fr conftest*
 fi
-rm -f conftest*
 
-echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
-echo "configure:6217: checking for socklen_t in sys/socket.h" >&5
-cat > conftest.$ac_ext <<EOF
-#line 6219 "configure"
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_libart" = x ; then
+     echo "$ac_t""yes" 1>&6
+     :     
+  else
+     echo "$ac_t""no" 1>&6
+     if test "$LIBART_CONFIG" = "no" ; then
+       echo "*** The libart-config script installed by LIBART could not be found"
+       echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the LIBART_CONFIG environment variable to the"
+       echo "*** full path to libart-config."
+     else
+       if test -f conf.libarttest ; then
+        :
+       else
+          echo "*** Could not run LIBART test program, checking why..."
+          CFLAGS="$CFLAGS $LIBART_CFLAGS"
+          LIBS="$LIBS $LIBART_LIBS"
+          cat > conftest.$ac_ext <<EOF
+#line 7127 "configure"
 #include "confdefs.h"
-#define _POSIX_PII_SOCKET
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <stdio.h>
+#include <libart_lgpl/libart.h>
+
 int main() {
-socklen_t x = 5;
+ return 0; 
 ; return 0; }
 EOF
-if { (eval echo configure:6228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_SOCKLEN_T 1
-EOF
-
-   echo "$ac_t""yes" 1>&6
+   echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding LIBART or finding the wrong"
+          echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+   echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
+          echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
+          echo "*** may want to edit the libart-config script: $LIBART_CONFIG" 
 fi
 rm -f conftest*
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     LIBART_CFLAGS=""
+     LIBART_LIBS=""
+     exit 1
+  fi
+  
+  
+  rm -f conf.libarttest
 
-echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
-echo "configure:6244: checking for tm_gmtoff in struct tm" >&5
+   fi
+
+   # On Solaris, and maybe other architectures, the Boehm collector
+   # requires -ldl.
+   if test "$GC" = boehm; then
+      echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
+echo "configure:7176: checking for main in -ldl" >&5
+ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6246 "configure"
+#line 7184 "configure"
 #include "confdefs.h"
-#include <time.h>
+
 int main() {
-struct tm tim; tim.tm_gmtoff = 0;
+main()
 ; return 0; }
 EOF
-if { (eval echo configure:6253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define STRUCT_TM_HAS_GMTOFF 1
-EOF
-
-   echo "$ac_t""yes" 1>&6
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SYSTEMSPEC="$SYSTEMSPEC -ldl"
+else
   echo "$ac_t""no" 1>&6
-   echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
-echo "configure:6266: checking for global timezone variable" >&5
-               cat > conftest.$ac_ext <<EOF
-#line 6268 "configure"
-#include "confdefs.h"
-#include <time.h>
-int main() {
-void i(){long z2 = 2*timezone;}
-; return 0; }
-EOF
-if { (eval echo configure:6275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_TIMEZONE 1
-EOF
+fi
 
-      echo "$ac_t""yes" 1>&6
+   fi
+
+   if test -z "${with_multisubdir}"; then
+      builddotdot=.
+   else
+
+      builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`
+
+   fi
+   if test -x "${builddotdot}/../../gcc/gcj"; then
+      dir="`cd ${builddotdot}/../../gcc && ${PWDCMD-pwd}`"
+      GCJ="$dir/gcj -B`${PWDCMD-pwd}`/ -B$dir/"
+   else
+      CANADIAN=yes
+      NULL_TARGET=yes
+      GCJ="gcj -B`${PWDCMD-pwd}`/"
+   fi
+fi
+
+# Create it, so that compile/link tests don't fail
+test -f libgcj.spec || touch libgcj.spec
+
+# We must search the source tree for java.lang, since we still don't
+# have libgcj.jar nor java/lang/*.class
+GCJ_SAVE_CPPFLAGS=$CPPFLAGS
+CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
+
+# Since some classes depend on this one, we need its source available
+# before we can do any GCJ compilation test :-(
+if test ! -f gnu/classpath/Configuration.java; then
+  test -d gnu || mkdir gnu
+  test -d gnu/classpath || mkdir gnu/classpath
+  sed -e 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
+      -e 's,@TOOLKIT@,$TOOLKIT,' \
+       < $srcdir/gnu/classpath/Configuration.java.in \
+       > gnu/classpath/Configuration.java
+  # We do not want to redirect the output of the grep below to /dev/null,
+  # but we add /dev/null to the input list so that grep will print the
+  # filename of Configuration.java in case it finds any matches.
+  if grep @ gnu/classpath/Configuration.java /dev/null; then
+    { echo "configure: error: configure.in is missing the substitutions above" 1>&2; exit 1; }
+  fi
+fi
+
+# Extract the first word of "${ac_tool_prefix}gcj", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcj; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7258: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$GCJ"; then
+  ac_cv_prog_GCJ="$GCJ" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_GCJ="${ac_tool_prefix}gcj"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+GCJ="$ac_cv_prog_GCJ"
+if test -n "$GCJ"; then
+  echo "$ac_t""$GCJ" 1>&6
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
   echo "$ac_t""no" 1>&6
-       echo $ac_n "checking for global _timezone variable""... $ac_c" 1>&6
-echo "configure:6288: checking for global _timezone variable" >&5
-              cat > conftest.$ac_ext <<EOF
-#line 6290 "configure"
-#include "confdefs.h"
-#include <time.h>
-int main() {
-long z2 = _timezone;
-; return 0; }
-EOF
-if { (eval echo configure:6297: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_UNDERSCORE_TIMEZONE 1
-EOF
+fi
 
-          echo "$ac_t""yes" 1>&6
+
+if test -z "$ac_cv_prog_GCJ"; then
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "gcj", so it can be a program name with args.
+set dummy gcj; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:7290: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$GCJ"; then
+  ac_cv_prog_GCJ="$GCJ" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_GCJ="gcj"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_prog_GCJ" && ac_cv_prog_GCJ="no"
+fi
+fi
+GCJ="$ac_cv_prog_GCJ"
+if test -n "$GCJ"; then
+  echo "$ac_t""$GCJ" 1>&6
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
   echo "$ac_t""no" 1>&6
 fi
-rm -f conftest*
+
+else
+  GCJ="no"
 fi
-rm -f conftest*
 fi
-rm -f conftest*
 
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:6319: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+  
+
+
+LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh"
+lt_save_CC="$CC"
+lt_save_CFLAGS="$CFLAGS"
+AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
+AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
+objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
+deplibs_check_method="$deplibs_check_method" \
+file_magic_cmd="$file_magic_cmd" \
+${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \
+--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \
+|| { echo "configure: error: libtool tag configuration failed" 1>&2; exit 1; }
+CC="$lt_save_CC"
+CFLAGS="$lt_save_CFLAGS"
+
+# Redirect the config.log output again, so that the ltconfig log is not
+# clobbered by the next message.
+exec 5>>./config.log
+
+
+
+
+CPPFLAGS=$GCJ_SAVE_CPPFLAGS
+
+echo $ac_n "checking size of void *""... $ac_c" 1>&6
+echo "configure:7352: checking size of void *" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
+  for ac_size in 4 8 1 2 16 12  ; do # List sizes in rough order of prevalence.
   cat > conftest.$ac_ext <<EOF
-#line 6324 "configure"
+#line 7358 "configure"
 #include "confdefs.h"
-#include <alloca.h>
+#include "confdefs.h"
+#include <sys/types.h>
+
+
 int main() {
-char *p = alloca(2 * sizeof(int));
+switch (0) case 0: case (sizeof (void *) == $ac_size):;
 ; return 0; }
 EOF
-if { (eval echo configure:6331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7368: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_cv_header_alloca_h=yes
+  ac_cv_sizeof_void_p=$ac_size
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_header_alloca_h=no
 fi
 rm -f conftest*
+  if test x$ac_cv_sizeof_void_p != x ; then break; fi
+done
+
 fi
 
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
+if test x$ac_cv_sizeof_void_p = x ; then
+  { echo "configure: error: cannot determine a size for void *" 1>&2; exit 1; }
+fi
+echo "$ac_t""$ac_cv_sizeof_void_p" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
 EOF
 
+
+
+ZLIBS=
+SYS_ZLIBS=
+ZINCS=
+
+if test -z "$ZLIBSPEC"; then
+   # Use zlib from the GCC tree.
+   ZINCS='-I$(top_srcdir)/../zlib'
+   ZLIBS=../zlib/libzgcj_convenience.la
+else
+   # System's zlib.
+   SYS_ZLIBS="$ZLIBSPEC"
 fi
 
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:6352: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+
+
+
+
+
+
+
+if test "$CANADIAN" = yes; then
+  CANADIAN_TRUE=
+  CANADIAN_FALSE='#'
 else
-  cat > conftest.$ac_ext <<EOF
-#line 6357 "configure"
-#include "confdefs.h"
+  CANADIAN_TRUE='#'
+  CANADIAN_FALSE=
+fi
 
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  if HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#    endif
-#   endif
-#  endif
-# endif
-#endif
 
-int main() {
-char *p = (char *) alloca(1);
-; return 0; }
-EOF
-if { (eval echo configure:6385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  ac_cv_func_alloca_works=yes
+if test "$NULL_TARGET" = yes; then
+  NULL_TARGET_TRUE=
+  NULL_TARGET_FALSE='#'
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_func_alloca_works=no
+  NULL_TARGET_TRUE='#'
+  NULL_TARGET_FALSE=
 fi
-rm -f conftest*
+
+
+if test "$NATIVE" = yes || test "$NULL_TARGET" = yes; then
+  NATIVE_TRUE=
+  NATIVE_FALSE='#'
+else
+  NATIVE_TRUE='#'
+  NATIVE_FALSE=
 fi
 
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
-EOF
 
+if test "$NEEDS_DATA_START" = yes && test "$NATIVE" = yes; then
+  NEEDS_DATA_START_TRUE=
+  NEEDS_DATA_START_FALSE='#'
+else
+  NEEDS_DATA_START_TRUE='#'
+  NEEDS_DATA_START_FALSE=
 fi
 
-if test $ac_cv_func_alloca_works = no; then
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-  # that cause trouble.  Some versions do not even contain alloca or
-  # contain a buggy version.  If you still want to use their alloca,
-  # use ar to extract alloca.o from them instead of compiling alloca.c.
-  ALLOCA=alloca.${ac_objext}
-  cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
+
+if test -n "$with_cross_host" &&
+   test x"$with_cross_host" != x"no"; then
+  toolexecdir='$(exec_prefix)/$(target_alias)'
+  toolexecmainlibdir='$(toolexecdir)/lib'
+else
+  toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+  toolexecmainlibdir='$(libdir)'
+fi
+toolexeclibdir=$toolexecmainlibdir/`$CC -print-multi-os-directory`
+
+
+
+
+# Determine gcj version number.
+
+gcjversion=`$GCJ -v 2>&1 | sed -n 's/^.*version \([^ ]*\).*$/\1/p'`
+
+GCJVERSION=$gcjversion
+
+cat >> confdefs.h <<EOF
+#define GCJVERSION "$GCJVERSION"
 EOF
 
 
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:6417: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 6422 "configure"
-#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
+echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6
+echo "configure:7473: checking for g++ -ffloat-store bug" >&5
+save_CFLAGS="$CFLAGS"
+CFLAGS="-x c++ -O2 -ffloat-store"
+cat > conftest.$ac_ext <<EOF
+#line 7477 "configure"
+#include "confdefs.h"
+#include <math.h>
+int main() {
 
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "webecray" >/dev/null 2>&1; then
+if { (eval echo configure:7484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_cv_os_cray=yes
+  echo "$ac_t""no" 1>&6
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_os_cray=no
-fi
-rm -f conftest*
+  cat >> confdefs.h <<\EOF
+#define __NO_MATH_INLINES 1
+EOF
 
+   echo "$ac_t""yes" 1>&6
 fi
+rm -f conftest*
+CFLAGS="$save_CFLAGS"
 
-echo "$ac_t""$ac_cv_os_cray" 1>&6
-if test $ac_cv_os_cray = yes; then
-for ac_func in _getb67 GETB67 getb67; do
-  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6447: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h net/if.h pwd.h sys/config.h stdint.h langinfo.h locale.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:7504: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6452 "configure"
+#line 7509 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:6475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7514: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
 fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
   cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
+#define $ac_tr_hdr 1
 EOF
-
-  break
 else
   echo "$ac_t""no" 1>&6
 fi
-
 done
-fi
 
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:6502: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+for ac_hdr in dirent.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:7544: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_c_stack_direction=0
-else
   cat > conftest.$ac_ext <<EOF
-#line 6510 "configure"
+#line 7549 "configure"
 #include "confdefs.h"
-find_stack_direction ()
-{
-  static char *addr = 0;
-  auto char dummy;
-  if (addr == 0)
-    {
-      addr = &dummy;
-      return find_stack_direction ();
-    }
-  else
-    return (&dummy > addr) ? 1 : -1;
-}
-main ()
-{
-  exit (find_stack_direction() < 0);
-}
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:6529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_c_stack_direction=1
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_c_stack_direction=-1
-fi
-rm -fr conftest*
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-
+rm -f conftest*
 fi
-
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
 EOF
-
+else
+  echo "$ac_t""no" 1>&6
 fi
+done
 
-
-for ac_prog in perl
+for ac_hdr in inttypes.h
 do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6556: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:7584: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$PERL"; then
-  ac_cv_prog_PERL="$PERL" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_PERL="$ac_prog"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-PERL="$ac_cv_prog_PERL"
-if test -n "$PERL"; then
-  echo "$ac_t""$PERL" 1>&6
+  cat > conftest.$ac_ext <<EOF
+#line 7589 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7594: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
 else
-  echo "$ac_t""no" 1>&6
-fi
-
-test -n "$PERL" && break
-done
-test -n "$PERL" || PERL="false"
-
-
-SYSDEP_SOURCES=
-
-case "${host}" in
- i?86-*-linux*)
-    SIGNAL_HANDLER=include/i386-signal.h
-    ;;
- sparc*-sun-solaris*)
-    SIGNAL_HANDLER=include/sparc-signal.h
-    ;;
-# ia64-*)
-#    SYSDEP_SOURCES=sysdep/ia64.c
-#    test -d sysdep || mkdir sysdep
-#    ;;
- ia64-*-linux*)
-    SIGNAL_HANDLER=include/dwarf2-signal.h
-    ;;
- powerpc-*-linux*)
-    SIGNAL_HANDLER=include/dwarf2-signal.h
-    ;;
- alpha*-*-linux*)
-    SIGNAL_HANDLER=include/dwarf2-signal.h
-    ;;
- s390*-*-linux*)
-    SIGNAL_HANDLER=include/s390-signal.h
-    ;;
- x86_64*-*-linux*)
-    SIGNAL_HANDLER=include/x86_64-signal.h
-    ;;
- sparc*-*-linux*)
-    SIGNAL_HANDLER=include/dwarf2-signal.h
-    ;;
- sh-*-linux* | sh[34]*-*-linux*)
-    SIGNAL_HANDLER=include/dwarf2-signal.h
-    ;;
- *mingw*)
-    SIGNAL_HANDLER=include/win32-signal.h
-    ;;
- *)
-    SIGNAL_HANDLER=include/default-signal.h
-    ;;
-esac
-
-# If we're using sjlj exceptions, forget what we just learned.
-if test "$enable_sjlj_exceptions" = yes; then
-   SIGNAL_HANDLER=include/default-signal.h
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-
-
-
-
-
-if test "${multilib}" = "yes"; then
-  multilib_arg="--enable-multilib"
-else
-  multilib_arg=
+rm -f conftest*
 fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+    cat >> confdefs.h <<\EOF
+#define HAVE_INTTYPES_H 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define JV_HAVE_INTTYPES_H 1
+EOF
 
-# If we find X, set shell vars x_includes and x_libraries to the
-# paths, otherwise set no_x=yes.
-# Uses ac_ vars as temps to allow command line to override cache and checks.
-# --without-x overrides everything else, but does not touch the cache.
-echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:6649: checking for X" >&5
-
-# Check whether --with-x or --without-x was given.
-if test "${with_x+set}" = set; then
-  withval="$with_x"
-  :
-fi
 
-# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
-if test "x$with_x" = xno; then
-  # The user explicitly disabled X.
-  have_x=disabled
 else
-  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
-    # Both variables are already set.
-    have_x=yes
-  else
-if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:7630: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  # One or both of the vars are not set, and there is no cached value.
-ac_x_includes=NO ac_x_libraries=NO
-rm -fr conftestdir
-if mkdir conftestdir; then
-  cd conftestdir
-  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
-  cat > Imakefile <<'EOF'
-acfindx:
-       @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+  cat > conftest.$ac_ext <<EOF
+#line 7635 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
 EOF
-  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
-    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
-    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
-    for ac_extension in a so sl; do
-      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
-        test -f $ac_im_libdir/libX11.$ac_extension; then
-        ac_im_usrlibdir=$ac_im_libdir; break
-      fi
-    done
-    # Screen out bogus values from the imake configuration.  They are
-    # bogus both because they are the default anyway, and because
-    # using them would break gcc on systems where it needs fixed includes.
-    case "$ac_im_incroot" in
-       /usr/include) ;;
-       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
-    esac
-    case "$ac_im_usrlibdir" in
-       /usr/lib | /lib) ;;
-       *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
-    esac
-  fi
-  cd ..
-  rm -fr conftestdir
+if { (eval echo configure:7651: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
 fi
 
-if test "$ac_x_includes" = NO; then
-  # Guess where to find include files, by looking for this one X11 .h file.
-  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
 
-  # First, try using that file with no special directory specified.
-cat > conftest.$ac_ext <<EOF
-#line 6711 "configure"
+fi
+
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:7673: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7678 "configure"
 #include "confdefs.h"
-#include <$x_direct_test_include>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6716: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
-  # We can compile using X headers with no special include directory.
-ac_x_includes=
+  ac_cv_header_stdc=yes
 else
   echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  # Look for the header file in a standard set of common directories.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-  for ac_dir in               \
-    /usr/X11/include          \
-    /usr/X11R6/include        \
-    /usr/X11R5/include        \
-    /usr/X11R4/include        \
-                              \
-    /usr/include/X11          \
-    /usr/include/X11R6        \
-    /usr/include/X11R5        \
-    /usr/include/X11R4        \
-                              \
-    /usr/local/X11/include    \
-    /usr/local/X11R6/include  \
-    /usr/local/X11R5/include  \
-    /usr/local/X11R4/include  \
-                              \
-    /usr/local/include/X11    \
-    /usr/local/include/X11R6  \
-    /usr/local/include/X11R5  \
-    /usr/local/include/X11R4  \
-                              \
-    /usr/X386/include         \
-    /usr/x386/include         \
-    /usr/XFree86/include/X11  \
-                              \
-    /usr/include              \
-    /usr/local/include        \
-    /usr/unsupported/include  \
-    /usr/athena/include       \
-    /usr/local/x11r5/include  \
-    /usr/lpp/Xamples/include  \
-                              \
-    /usr/openwin/include      \
-    /usr/openwin/share/include \
-    ; \
-  do
-    if test -r "$ac_dir/$x_direct_test_include"; then
-      ac_x_includes=$ac_dir
-      break
-    fi
-  done
+  ac_cv_header_stdc=no
 fi
 rm -f conftest*
-fi # $ac_x_includes = NO
 
-if test "$ac_x_libraries" = NO; then
-  # Check for the libraries.
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 7703 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  rm -rf conftest*
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
-  test -z "$x_direct_test_library" && x_direct_test_library=Xt
-  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
+fi
 
-  # See if we find them without any special options.
-  # Don't add to $LIBS permanently.
-  ac_save_LIBS="$LIBS"
-  LIBS="-l$x_direct_test_library $LIBS"
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 6785 "configure"
+#line 7721 "configure"
 #include "confdefs.h"
-
-int main() {
-${x_direct_test_function}()
-; return 0; }
+#include <stdlib.h>
 EOF
-if { (eval echo configure:6792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  LIBS="$ac_save_LIBS"
-# We can link X programs with no special library path.
-ac_x_libraries=
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  LIBS="$ac_save_LIBS"
-# First see if replacing the include by lib works.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
-    /usr/X11/lib          \
-    /usr/X11R6/lib        \
-    /usr/X11R5/lib        \
-    /usr/X11R4/lib        \
-                          \
-    /usr/lib/X11          \
-    /usr/lib/X11R6        \
-    /usr/lib/X11R5        \
-    /usr/lib/X11R4        \
-                          \
-    /usr/local/X11/lib    \
-    /usr/local/X11R6/lib  \
-    /usr/local/X11R5/lib  \
-    /usr/local/X11R4/lib  \
-                          \
-    /usr/local/lib/X11    \
-    /usr/local/lib/X11R6  \
-    /usr/local/lib/X11R5  \
-    /usr/local/lib/X11R4  \
-                          \
-    /usr/X386/lib         \
-    /usr/x386/lib         \
-    /usr/XFree86/lib/X11  \
-                          \
-    /usr/lib              \
-    /usr/local/lib        \
-    /usr/unsupported/lib  \
-    /usr/athena/lib       \
-    /usr/local/x11r5/lib  \
-    /usr/lpp/Xamples/lib  \
-    /lib/usr/lib/X11     \
-                          \
-    /usr/openwin/lib      \
-    /usr/openwin/share/lib \
-    ; \
-do
-  for ac_extension in a so sl; do
-    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
-      ac_x_libraries=$ac_dir
-      break 2
-    fi
-  done
-done
+  ac_cv_header_stdc=no
 fi
 rm -f conftest*
-fi # $ac_x_libraries = NO
 
-if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
-  # Didn't find X anywhere.  Cache the known absence of X.
-  ac_cv_have_x="have_x=no"
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+  :
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7742 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:7753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
 else
-  # Record where we found X for the cache.
-  ac_cv_have_x="have_x=yes \
-               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_header_stdc=no
 fi
+rm -fr conftest*
 fi
-  fi
-  eval "$ac_cv_have_x"
-fi # $with_x != no
 
-if test "$have_x" != yes; then
-  echo "$ac_t""$have_x" 1>&6
-  no_x=yes
-else
-  # If each of the values was on the command line, it overrides each guess.
-  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
-  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
-  # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes \
-               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-  echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
+fi
 fi
 
-if test "$no_x" = yes; then
-  # Not all programs may use this symbol, but it does not hurt to define it.
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
   cat >> confdefs.h <<\EOF
-#define X_DISPLAY_MISSING 1
+#define STDC_HEADERS 1
 EOF
 
-  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
-else
-  if test -n "$x_includes"; then
-    X_CFLAGS="$X_CFLAGS -I$x_includes"
-  fi
+fi
 
-  # It would also be nice to do this for all -L options, not just this one.
-  if test -n "$x_libraries"; then
-    X_LIBS="$X_LIBS -L$x_libraries"
-    # For Solaris; some versions of Sun CC require a space after -R and
-    # others require no space.  Words are not sufficient . . . .
-    case "`(uname -sr) 2>/dev/null`" in
-    "SunOS 5"*)
-      echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:6898: checking whether -R must be followed by a space" >&5
-      ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
-      cat > conftest.$ac_ext <<EOF
-#line 6901 "configure"
+echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
+echo "configure:7777: checking for ssize_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7782 "configure"
 #include "confdefs.h"
-
-int main() {
-
-; return 0; }
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
 EOF
-if { (eval echo configure:6908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
-  ac_R_nospace=yes
+  ac_cv_type_ssize_t=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_R_nospace=no
+  ac_cv_type_ssize_t=no
 fi
 rm -f conftest*
-      if test $ac_R_nospace = yes; then
-       echo "$ac_t""no" 1>&6
-       X_LIBS="$X_LIBS -R$x_libraries"
-      else
-       LIBS="$ac_xsave_LIBS -R $x_libraries"
-       cat > conftest.$ac_ext <<EOF
-#line 6924 "configure"
-#include "confdefs.h"
 
-int main() {
+fi
+echo "$ac_t""$ac_cv_type_ssize_t" 1>&6
+if test $ac_cv_type_ssize_t = no; then
+  cat >> confdefs.h <<\EOF
+#define ssize_t int
+EOF
+
+fi
+
 
+echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
+echo "configure:7811: checking for in_addr_t" >&5
+cat > conftest.$ac_ext <<EOF
+#line 7813 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+int main() {
+in_addr_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:6931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_R_space=yes
+  cat >> confdefs.h <<\EOF
+#define HAVE_IN_ADDR_T 1
+EOF
+
+   echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_R_space=no
+  echo "$ac_t""no" 1>&6
 fi
 rm -f conftest*
-       if test $ac_R_space = yes; then
-         echo "$ac_t""yes" 1>&6
-         X_LIBS="$X_LIBS -R $x_libraries"
-       else
-         echo "$ac_t""neither works" 1>&6
-       fi
-      fi
-      LIBS="$ac_xsave_LIBS"
-    esac
-  fi
-
-  # Check for system-dependent libraries X programs must link with.
-  # Do this before checking for the system-independent R6 libraries
-  # (-lICE), since we may need -lsocket or whatever for X linking.
 
-  if test "$ISC" = yes; then
-    X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
-  else
-    # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
-    # libraries were built with DECnet support.  And karl@cs.umb.edu says
-    # the Alpha needs dnet_stub (dnet does not exist).
-    echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:6963: checking for dnet_ntoa in -ldnet" >&5
-ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldnet  $LIBS"
+echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
+echo "configure:7843: checking whether struct ip_mreq is in netinet/in.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 6971 "configure"
+#line 7845 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dnet_ntoa();
-
+#include <netinet/in.h>
 int main() {
-dnet_ntoa()
+struct ip_mreq mreq;
 ; return 0; }
 EOF
-if { (eval echo configure:6982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_IP_MREQ 1
+EOF
+
+   echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
-else
   echo "$ac_t""no" 1>&6
 fi
+rm -f conftest*
 
-    if test $ac_cv_lib_dnet_dnet_ntoa = no; then
-      echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:7004: checking for dnet_ntoa in -ldnet_stub" >&5
-ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldnet_stub  $LIBS"
+echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6
+echo "configure:7868: checking whether struct ipv6_mreq is in netinet/in.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7012 "configure"
+#line 7870 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dnet_ntoa();
-
+#include <netinet/in.h>
 int main() {
-dnet_ntoa()
+struct ipv6_mreq mreq6;
 ; return 0; }
 EOF
-if { (eval echo configure:7023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7877: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_IPV6_MREQ 1
+EOF
+
+   echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
-else
   echo "$ac_t""no" 1>&6
 fi
+rm -f conftest*
 
-    fi
-
-    # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
-    # to get the SysV transport functions.
-    # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
-    # needs -lnsl.
-    # The nsl library prevents programs from opening the X display
-    # on Irix 5.2, according to dickey@clark.net.
-    echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:7052: checking for gethostbyname" >&5
-if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 7057 "configure"
+echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
+echo "configure:7893: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
+cat > conftest.$ac_ext <<EOF
+#line 7895 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char gethostbyname(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char gethostbyname();
-
+#include <netinet/in.h>
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-gethostbyname();
-#endif
-
+struct sockaddr_in6 addr6;
 ; return 0; }
 EOF
-if { (eval echo configure:7080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_func_gethostbyname=yes"
+  cat >> confdefs.h <<\EOF
+#define HAVE_INET6 1
+EOF
+
+   echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_gethostbyname=no"
+  echo "$ac_t""no" 1>&6
 fi
 rm -f conftest*
-fi
 
-if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  :
+echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
+echo "configure:7918: checking for socklen_t in sys/socket.h" >&5
+cat > conftest.$ac_ext <<EOF
+#line 7920 "configure"
+#include "confdefs.h"
+#define _POSIX_PII_SOCKET
+#include <sys/types.h>
+#include <sys/socket.h>
+int main() {
+socklen_t x = 5;
+; return 0; }
+EOF
+if { (eval echo configure:7929: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
+   echo "$ac_t""yes" 1>&6
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
   echo "$ac_t""no" 1>&6
 fi
+rm -f conftest*
 
-    if test $ac_cv_func_gethostbyname = no; then
-      echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:7101: checking for gethostbyname in -lnsl" >&5
-ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lnsl  $LIBS"
+echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
+echo "configure:7945: checking for tm_gmtoff in struct tm" >&5
 cat > conftest.$ac_ext <<EOF
-#line 7109 "configure"
+#line 7947 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char gethostbyname();
-
+#include <time.h>
 int main() {
-gethostbyname()
+struct tm tim; tim.tm_gmtoff = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:7120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7954: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  cat >> confdefs.h <<\EOF
+#define STRUCT_TM_HAS_GMTOFF 1
+EOF
+
+   echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
-else
   echo "$ac_t""no" 1>&6
-fi
-
-    fi
+   echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
+echo "configure:7967: checking for global timezone variable" >&5
+               cat > conftest.$ac_ext <<EOF
+#line 7969 "configure"
+#include "confdefs.h"
+#include <time.h>
+int main() {
+void i(){long z2 = 2*timezone;}
+; return 0; }
+EOF
+if { (eval echo configure:7976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  cat >> confdefs.h <<\EOF
+#define HAVE_TIMEZONE 1
+EOF
 
-    # lieder@skyler.mavd.honeywell.com says without -lsocket,
-    # socket/setsockopt and other routines are undefined under SCO ODT
-    # 2.0.  But -lsocket is broken on IRIX 5.2 (and is not necessary
-    # on later versions), says simon@lia.di.epfl.ch: it contains
-    # gethostby* variants that don't use the nameserver (or something).
-    # -lsocket must be given before -lnsl if both are needed.
-    # We assume that if connect needs -lnsl, so does gethostbyname.
-    echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:7150: checking for connect" >&5
-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+      echo "$ac_t""yes" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 7155 "configure"
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+       echo $ac_n "checking for global _timezone variable""... $ac_c" 1>&6
+echo "configure:7989: checking for global _timezone variable" >&5
+              cat > conftest.$ac_ext <<EOF
+#line 7991 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char connect(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char connect();
-
+#include <time.h>
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-connect();
-#endif
-
+long z2 = _timezone;
 ; return 0; }
 EOF
-if { (eval echo configure:7178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_func_connect=yes"
+  cat >> confdefs.h <<\EOF
+#define HAVE_UNDERSCORE_TIMEZONE 1
+EOF
+
+          echo "$ac_t""yes" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_connect=no"
+  echo "$ac_t""no" 1>&6
 fi
 rm -f conftest*
 fi
-
-if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  :
-else
-  echo "$ac_t""no" 1>&6
+rm -f conftest*
 fi
+rm -f conftest*
 
-    if test $ac_cv_func_connect = no; then
-      echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:7199: checking for connect in -lsocket" >&5
-ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:8020: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 7207 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 8025 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char connect();
-
+#include <alloca.h>
 int main() {
-connect()
+char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:7218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ac_cv_header_alloca_h=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_header_alloca_h=no
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-    fi
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
 
-    # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
-    echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:7242: checking for remove" >&5
-if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:8053: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7247 "configure"
+#line 8058 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char remove(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char remove();
-
-int main() {
 
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_remove) || defined (__stub___remove)
-choke me
+#ifdef __GNUC__
+# define alloca __builtin_alloca
 #else
-remove();
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
 #endif
 
+int main() {
+char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:7270: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_remove=yes"
+  ac_cv_func_alloca_works=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_remove=no"
+  ac_cv_func_alloca_works=no
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  :
-else
-  echo "$ac_t""no" 1>&6
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
 fi
 
-    if test $ac_cv_func_remove = no; then
-      echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:7291: checking for remove in -lposix" >&5
-ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+if test $ac_cv_func_alloca_works = no; then
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+  # that cause trouble.  Some versions do not even contain alloca or
+  # contain a buggy version.  If you still want to use their alloca,
+  # use ar to extract alloca.o from them instead of compiling alloca.c.
+  ALLOCA=alloca.${ac_objext}
+  cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:8118: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lposix  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 7299 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 8123 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char remove();
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
 
-int main() {
-remove()
-; return 0; }
 EOF
-if { (eval echo configure:7310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "webecray" >/dev/null 2>&1; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  ac_cv_os_cray=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  ac_cv_os_cray=no
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
-else
-  echo "$ac_t""no" 1>&6
-fi
 
-    fi
-
-    # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-    echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:7334: checking for shmat" >&5
-if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:8148: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7339 "configure"
+#line 8153 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char shmat(); below.  */
+    which can conflict with char $ac_func(); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char shmat();
+char $ac_func();
 
 int main() {
 
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_shmat) || defined (__stub___shmat)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-shmat();
+$ac_func();
 #endif
 
 ; return 0; }
 EOF
-if { (eval echo configure:7362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_func_shmat=yes"
+  eval "ac_cv_func_$ac_func=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_shmat=no"
+  eval "ac_cv_func_$ac_func=no"
 fi
 rm -f conftest*
 fi
 
-if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  :
+  cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+  break
 else
   echo "$ac_t""no" 1>&6
 fi
 
-    if test $ac_cv_func_shmat = no; then
-      echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:7383: checking for shmat in -lipc" >&5
-ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:8203: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lipc  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 7391 "configure"
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat > conftest.$ac_ext <<EOF
+#line 8211 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char shmat();
-
-int main() {
-shmat()
-; return 0; }
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+  exit (find_stack_direction() < 0);
+}
 EOF
-if { (eval echo configure:7402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+if { (eval echo configure:8230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_c_stack_direction=1
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  rm -fr conftest*
+  ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
-else
-  echo "$ac_t""no" 1>&6
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
 fi
 
-    fi
-  fi
 
-  # Check for libraries that X11R6 Xt/Xaw programs need.
-  ac_save_LDFLAGS="$LDFLAGS"
-  test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
-  # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
-  # check for ICE first), but we must link in the order -lSM -lICE or
-  # we get undefined symbols.  So assume we have SM if we have ICE.
-  # These have to be linked with before -lX11, unlike the other
-  # libraries we check for below, so use a different variable.
-  #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
-  echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:7435: checking for IceConnectionNumber in -lICE" >&5
-ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+for ac_prog in perl
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:8257: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lICE $X_EXTRA_LIBS $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 7443 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char IceConnectionNumber();
-
-int main() {
-IceConnectionNumber()
-; return 0; }
-EOF
-if { (eval echo configure:7454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  if test -n "$PERL"; then
+  ac_cv_prog_PERL="$PERL" # Let the user override the test.
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_PERL="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
+PERL="$ac_cv_prog_PERL"
+if test -n "$PERL"; then
+  echo "$ac_t""$PERL" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
-  LDFLAGS="$ac_save_LDFLAGS"
+test -n "$PERL" && break
+done
+test -n "$PERL" || PERL="false"
 
-fi
 
+SYSDEP_SOURCES=
 
-# Check whether --enable-java-awt or --disable-java-awt was given.
-if test "${enable_java_awt+set}" = set; then
-  enableval="$enable_java_awt"
-  :
-fi
+case "${host}" in
+ i?86-*-linux*)
+    SIGNAL_HANDLER=include/i386-signal.h
+    ;;
+ sparc*-sun-solaris*)
+    SIGNAL_HANDLER=include/sparc-signal.h
+    ;;
+# ia64-*)
+#    SYSDEP_SOURCES=sysdep/ia64.c
+#    test -d sysdep || mkdir sysdep
+#    ;;
+ ia64-*-linux*)
+    SIGNAL_HANDLER=include/dwarf2-signal.h
+    ;;
+ powerpc-*-linux*)
+    SIGNAL_HANDLER=include/dwarf2-signal.h
+    ;;
+ alpha*-*-linux*)
+    SIGNAL_HANDLER=include/dwarf2-signal.h
+    ;;
+ s390*-*-linux*)
+    SIGNAL_HANDLER=include/s390-signal.h
+    ;;
+ x86_64*-*-linux*)
+    SIGNAL_HANDLER=include/x86_64-signal.h
+    ;;
+ sparc*-*-linux*)
+    SIGNAL_HANDLER=include/dwarf2-signal.h
+    ;;
+ sh-*-linux* | sh[34]*-*-linux*)
+    SIGNAL_HANDLER=include/dwarf2-signal.h
+    ;;
+ *mingw*)
+    SIGNAL_HANDLER=include/win32-signal.h
+    ;;
+ *)
+    SIGNAL_HANDLER=include/default-signal.h
+    ;;
+esac
 
+# If we're using sjlj exceptions, forget what we just learned.
+if test "$enable_sjlj_exceptions" = yes; then
+   SIGNAL_HANDLER=include/default-signal.h
+fi
 
-peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
-use_xlib_awt=""
-use_gtk_awt=""
 
-for peer in $peerlibs ; do
-  case $peer in
-    xlib)
-      if test "$no_x" = yes; then
-        echo "*** xlib peers requested but no X library available" 1>&2
-        exit 1
-      else
-        use_xlib_awt="yes"
-      fi
-      ;;
-    gtk)
-      # Nothing, yet...
-      ;;
-    no)
-      use_xlib_awt=
-      use_gtk_awt=
-      break
-      ;;
-    *)
-      echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
-      exit 1
-  esac
-done
 
 
 
-if test "$use_xlib_awt" = yes; then
-  XLIB_AWT_TRUE=
-  XLIB_AWT_FALSE='#'
+if test "${multilib}" = "yes"; then
+  multilib_arg="--enable-multilib"
 else
-  XLIB_AWT_TRUE='#'
-  XLIB_AWT_FALSE=
+  multilib_arg=
 fi
 
 
-if test "$use_gtk_awt" = yes; then
-  GTK_AWT_TRUE=
-  GTK_AWT_FALSE='#'
-else
-  GTK_AWT_TRUE='#'
-  GTK_AWT_FALSE=
-fi
-
 
 here=`${PWDCMD-pwd}`
 
@@ -7732,6 +8545,15 @@ s%@SYSTEMSPEC@%$SYSTEMSPEC%g
 s%@LIBGCJTESTSPEC@%$LIBGCJTESTSPEC%g
 s%@ZLIBSPEC@%$ZLIBSPEC%g
 s%@ZLIBTESTSPEC@%$ZLIBTESTSPEC%g
+s%@X_CFLAGS@%$X_CFLAGS%g
+s%@X_PRE_LIBS@%$X_PRE_LIBS%g
+s%@X_LIBS@%$X_LIBS%g
+s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
+s%@TOOLKIT@%$TOOLKIT%g
+s%@XLIB_AWT_TRUE@%$XLIB_AWT_TRUE%g
+s%@XLIB_AWT_FALSE@%$XLIB_AWT_FALSE%g
+s%@GTK_AWT_TRUE@%$GTK_AWT_TRUE%g
+s%@GTK_AWT_FALSE@%$GTK_AWT_FALSE%g
 s%@GCLIBS@%$GCLIBS%g
 s%@GCINCS@%$GCINCS%g
 s%@GCDEPS@%$GCDEPS%g
@@ -7751,6 +8573,15 @@ s%@USING_GCC_FALSE@%$USING_GCC_FALSE%g
 s%@tool_include_dir@%$tool_include_dir%g
 s%@gcc_version@%$gcc_version%g
 s%@LIBICONV@%$LIBICONV%g
+s%@GTK_CONFIG@%$GTK_CONFIG%g
+s%@GTK_CFLAGS@%$GTK_CFLAGS%g
+s%@GTK_LIBS@%$GTK_LIBS%g
+s%@GLIB_CONFIG@%$GLIB_CONFIG%g
+s%@GLIB_CFLAGS@%$GLIB_CFLAGS%g
+s%@GLIB_LIBS@%$GLIB_LIBS%g
+s%@LIBART_CONFIG@%$LIBART_CONFIG%g
+s%@LIBART_CFLAGS@%$LIBART_CFLAGS%g
+s%@LIBART_LIBS@%$LIBART_LIBS%g
 s%@GCJ@%$GCJ%g
 s%@GCJFLAGS@%$GCJFLAGS%g
 s%@ZLIBS@%$ZLIBS%g
@@ -7775,14 +8606,6 @@ s%@GCJVERSION@%$GCJVERSION%g
 s%@ALLOCA@%$ALLOCA%g
 s%@PERL@%$PERL%g
 s%@SYSDEP_SOURCES@%$SYSDEP_SOURCES%g
-s%@X_CFLAGS@%$X_CFLAGS%g
-s%@X_PRE_LIBS@%$X_PRE_LIBS%g
-s%@X_LIBS@%$X_LIBS%g
-s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
-s%@XLIB_AWT_TRUE@%$XLIB_AWT_TRUE%g
-s%@XLIB_AWT_FALSE@%$XLIB_AWT_FALSE%g
-s%@GTK_AWT_TRUE@%$GTK_AWT_TRUE%g
-s%@GTK_AWT_FALSE@%$GTK_AWT_FALSE%g
 s%@here@%$here%g
 
 CEOF
@@ -8072,10 +8895,10 @@ esac
 # builddir for the .java files.
 h=`${PWDCMD-pwd}`
 : > deps.mk
-( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' \) -print) ;
-  find . \( -name '*.java' -o -name '*.cc' \) -print) | \
+( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) ;
+  find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) | \
    fgrep -v testsuite | \
-   sed -e 's/\.java/.d/'\;'s/\.cc/.d/' | \
+   sed -e 's/\.java/.d/'\;'s/\.cc/.d/'\;'s/\.c/.d/' | \
    while read f; do
       echo "include $f" >> deps.mk
       test -f $f || {
index 3ad1f49..f20c474 100644 (file)
@@ -289,6 +289,59 @@ AC_SUBST(ZLIBSPEC)
 ZLIBTESTSPEC=
 AC_SUBST(ZLIBTESTSPEC)
 
+AC_PATH_XTRA
+
+dnl Determine which AWT peer libraries to build
+AC_ARG_ENABLE(java-awt,
+[  --enable-java-awt       list of AWT peer implementations to be built])
+
+peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
+use_xlib_awt=""
+use_gtk_awt=""
+# The default toolkit to use is the first one specified.
+TOOLKIT=
+AC_SUBST(TOOLKIT)
+
+for peer in $peerlibs ; do
+  case $peer in
+    xlib)
+      if test "$no_x" = yes; then
+        echo "*** xlib peers requested but no X library available" 1>&2
+        exit 1
+      else
+        use_xlib_awt="yes"
+       if test -z "$TOOLKIT"; then
+          TOOLKIT=gnu.gnu.awt.xlib.XToolkit
+       fi
+      fi
+      ;;
+    gtk)
+      if test "$no_x" = yes; then
+        echo "*** xlib peers requested but no X library available" 1>&2
+        exit 1
+      else
+        use_gtk_awt=yes
+        if test -z "$TOOLKIT"; then
+           TOOLKIT=gnu.java.awt.peer.gtk.GtkToolkit
+        fi
+        test -d jniinclude || mkdir jniinclude
+      fi
+      ;;
+    no)
+      use_xlib_awt=
+      use_gtk_awt=
+      break
+      ;;
+    *)
+      echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
+      exit 1
+  esac
+done
+
+AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
+AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
+
+
 dnl FIXME: this should be _libs on some hosts.
 libsubdir=.libs
 
@@ -721,6 +774,15 @@ else
       AC_CHECK_LIB(z, deflate, ZLIBSPEC=-lz, ZLIBSPEC=)
    fi
 
+   # Test for Gtk stuff, if asked for.
+   if test "$use_gtk_awt" = yes; then
+      AM_PATH_GTK(1.2.4,,exit 1)
+      AM_PATH_GLIB(1.2.4,,exit 1,gthread)
+      dnl XXX Fix me when libart.m4 has the compile test fixed!
+      enable_libarttest=no
+      AM_PATH_LIBART(2.1.0,,exit 1)
+   fi
+
    # On Solaris, and maybe other architectures, the Boehm collector
    # requires -ldl.
    if test "$GC" = boehm; then
@@ -757,7 +819,8 @@ CPPFLAGS="$CPPFLAGS -I`${PWDCMD-pwd}` -I`cd $srcdir && ${PWDCMD-pwd}`"
 if test ! -f gnu/classpath/Configuration.java; then
   test -d gnu || mkdir gnu
   test -d gnu/classpath || mkdir gnu/classpath
-  sed 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
+  sed -e 's,@LIBGCJDEBUG@,$LIBGCJDEBUG,' \
+      -e 's,@TOOLKIT@,$TOOLKIT,' \
        < $srcdir/gnu/classpath/Configuration.java.in \
        > gnu/classpath/Configuration.java
   # We do not want to redirect the output of the grep below to /dev/null,
@@ -966,42 +1029,6 @@ else
   multilib_arg=
 fi
 
-AC_PATH_XTRA
-
-dnl Determine which AWT peer libraries to build
-AC_ARG_ENABLE(java-awt,
-[  --enable-java-awt       list of AWT peer implementations to be built])
-
-peerlibs="`echo ${enable_java_awt} | tr ',' ' '`"
-use_xlib_awt=""
-use_gtk_awt=""
-
-for peer in $peerlibs ; do
-  case $peer in
-    xlib)
-      if [test "$no_x" = yes]; then
-        echo "*** xlib peers requested but no X library available" 1>&2
-        exit 1
-      else
-        use_xlib_awt="yes"
-      fi
-      ;;
-    gtk)
-      # Nothing, yet...
-      ;;
-    no)
-      use_xlib_awt=
-      use_gtk_awt=
-      break
-      ;;
-    *)
-      echo "*** unrecognised argument \"${peer}\" for --enable-java-awt" 1>&2
-      exit 1
-  esac
-done
-
-AM_CONDITIONAL(XLIB_AWT, test "$use_xlib_awt" = yes)
-AM_CONDITIONAL(GTK_AWT, test "$use_gtk_awt" = yes)
 
 
 here=`${PWDCMD-pwd}`
@@ -1023,10 +1050,10 @@ esac
 # builddir for the .java files.
 h=`${PWDCMD-pwd}`
 : > deps.mk
-( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' \) -print) ;
-  find . \( -name '*.java' -o -name '*.cc' \) -print) | \
+( (cd $srcdir && find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) ;
+  find . \( -name '*.java' -o -name '*.cc' -o -name '*.c' \) -print) | \
    fgrep -v testsuite | \
-   sed -e 's/\.java/.d/'\;'s/\.cc/.d/' | \
+   sed -e 's/\.java/.d/'\;'s/\.cc/.d/'\;'s/\.c/.d/' | \
    while read f; do
       echo "include $f" >> deps.mk
       test -f $f || {
index 201722f..80629ae 100644 (file)
@@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@
 GCOBJS = @GCOBJS@
 GCSPEC = @GCSPEC@
 GCTESTSPEC = @GCTESTSPEC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
 HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
 INCLTDL = @INCLTDL@
 INTERPRETER = @INTERPRETER@
 JC1GCSPEC = @JC1GCSPEC@
+LIBART_CFLAGS = @LIBART_CFLAGS@
+LIBART_CONFIG = @LIBART_CONFIG@
+LIBART_LIBS = @LIBART_LIBS@
 LIBFFI = @LIBFFI@
 LIBFFIINCS = @LIBFFIINCS@
 LIBGCJDEBUG = @LIBGCJDEBUG@
@@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
 THREADLIBS = @THREADLIBS@
 THREADOBJS = @THREADOBJS@
 THREADSPEC = @THREADSPEC@
+TOOLKIT = @TOOLKIT@
 VERSION = @VERSION@
 ZINCS = @ZINCS@
 ZLIBS = @ZLIBS@
@@ -129,6 +139,9 @@ here = @here@
 libgcj_basedir = @libgcj_basedir@
 mkinstalldirs = @mkinstalldirs@
 tool_include_dir = @tool_include_dir@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+toolexecmainlibdir = @toolexecmainlibdir@
 
 AUTOMAKE_OPTIONS = foreign
 
diff --git a/libjava/glib.m4 b/libjava/glib.m4
new file mode 100644 (file)
index 0000000..b8094bb
--- /dev/null
@@ -0,0 +1,196 @@
+# Configure paths for GLIB
+# Owen Taylor     97-11-3
+
+dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or 
+dnl gthread is specified in MODULES, pass to glib-config
+dnl
+AC_DEFUN(AM_PATH_GLIB,
+[dnl 
+dnl Get the cflags and libraries from the glib-config script
+dnl
+AC_ARG_WITH(glib-prefix,[  --with-glib-prefix=PFX   Prefix where GLIB is installed (optional)],
+            glib_config_prefix="$withval", glib_config_prefix="")
+AC_ARG_WITH(glib-exec-prefix,[  --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)],
+            glib_config_exec_prefix="$withval", glib_config_exec_prefix="")
+AC_ARG_ENABLE(glibtest, [  --disable-glibtest       Do not try to compile and run a test GLIB program],
+                   , enable_glibtest=yes)
+
+  if test x$glib_config_exec_prefix != x ; then
+     glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix"
+     if test x${GLIB_CONFIG+set} != xset ; then
+        GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config
+     fi
+  fi
+  if test x$glib_config_prefix != x ; then
+     glib_config_args="$glib_config_args --prefix=$glib_config_prefix"
+     if test x${GLIB_CONFIG+set} != xset ; then
+        GLIB_CONFIG=$glib_config_prefix/bin/glib-config
+     fi
+  fi
+
+  for module in . $4
+  do
+      case "$module" in
+         gmodule) 
+             glib_config_args="$glib_config_args gmodule"
+         ;;
+         gthread) 
+             glib_config_args="$glib_config_args gthread"
+         ;;
+      esac
+  done
+
+  AC_PATH_PROG(GLIB_CONFIG, glib-config, no)
+  min_glib_version=ifelse([$1], ,0.99.7,$1)
+  AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
+  no_glib=""
+  if test "$GLIB_CONFIG" = "no" ; then
+    no_glib=yes
+  else
+    GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags`
+    GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs`
+    glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_glibtest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GLIB_CFLAGS"
+      LIBS="$GLIB_LIBS $LIBS"
+dnl
+dnl Now check if the installed GLIB is sufficiently new. (Also sanity
+dnl checks the results of glib-config to some extent
+dnl
+      rm -f conf.glibtest
+      AC_TRY_RUN([
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.glibtest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_glib_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_glib_version");
+     exit(1);
+   }
+
+  if ((glib_major_version != $glib_config_major_version) ||
+      (glib_minor_version != $glib_config_minor_version) ||
+      (glib_micro_version != $glib_config_micro_version))
+    {
+      printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", 
+             $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
+             glib_major_version, glib_minor_version, glib_micro_version);
+      printf ("*** was found! If glib-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n");
+      printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+  else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
+          (glib_minor_version != GLIB_MINOR_VERSION) ||
+           (glib_micro_version != GLIB_MICRO_VERSION))
+    {
+      printf("*** GLIB header files (version %d.%d.%d) do not match\n",
+            GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            glib_major_version, glib_minor_version, glib_micro_version);
+    }
+  else
+    {
+      if ((glib_major_version > major) ||
+        ((glib_major_version == major) && (glib_minor_version > minor)) ||
+        ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
+               glib_major_version, glib_minor_version, glib_micro_version);
+        printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
+              major, minor, micro);
+        printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the glib-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n");
+        printf("*** correct copy of glib-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_glib" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$GLIB_CONFIG" = "no" ; then
+       echo "*** The glib-config script installed by GLIB could not be found"
+       echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GLIB_CONFIG environment variable to the"
+       echo "*** full path to glib-config."
+     else
+       if test -f conf.glibtest ; then
+        :
+       else
+          echo "*** Could not run GLIB test program, checking why..."
+          CFLAGS="$CFLAGS $GLIB_CFLAGS"
+          LIBS="$LIBS $GLIB_LIBS"
+          AC_TRY_LINK([
+#include <glib.h>
+#include <stdio.h>
+],      [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GLIB or finding the wrong"
+          echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GLIB was incorrectly installed"
+          echo "*** or that you have moved GLIB since it was installed. In the latter case, you"
+          echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GLIB_CFLAGS=""
+     GLIB_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GLIB_CFLAGS)
+  AC_SUBST(GLIB_LIBS)
+  rm -f conf.glibtest
+])
index 1002b62..5a4b97e 100644 (file)
@@ -1,5 +1,5 @@
 /* gnu.classpath.Configuration
-   Copyright (C) 1998, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -56,4 +56,7 @@ public interface Configuration
   boolean HAVE_NATIVE_GET_PROXY_DATA = false;
   boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
   boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
+
+  // Name of default AWT peer library.
+  String default_awt_peer_toolkit = "@TOOLKIT@";
 }
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java b/libjava/gnu/java/awt/peer/gtk/GdkFontMetrics.java
new file mode 100644 (file)
index 0000000..45690b0
--- /dev/null
@@ -0,0 +1,108 @@
+/* GdkFontMetrics.java
+   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+
+public class GdkFontMetrics extends FontMetrics
+{
+  private final int native_state = GtkGenericPeer.getUniqueInteger();
+
+  private static final int ASCENT = 0, MAX_ASCENT = 1, 
+                       DESCENT = 2, MAX_DESCENT = 3, 
+                       MAX_ADVANCE = 4;
+
+  private int[] metrics;
+  private native int[] initState (String xlfd, int pts);
+
+  public GdkFontMetrics (Font font)
+  {
+    super (font);
+    metrics = initState (((GtkFontPeer)font.getPeer ()).getXLFD (), 
+                        font.getSize ());
+  }
+
+  native public int stringWidth (String str);
+
+  public int charWidth (char ch)
+  {
+    return stringWidth (new String (new char[] { ch }));
+  }
+
+  public int charsWidth (char data[], int off, int len)
+  {
+    return stringWidth (new String (data, off, len));
+  }
+
+  /* 
+     Sun's Motif implementation always returns 0 or 1 here (???), but
+     going by the X11 man pages, it seems as though we should return
+     font.ascent + font.descent.
+  */
+  public int getLeading ()
+  {
+    return 1;
+//      return metrics[ASCENT] + metrics[DESCENT];
+  }
+
+  public int getAscent ()
+  {
+    return metrics[ASCENT];
+  }
+
+  public int getMaxAscent ()
+  {
+    return metrics[MAX_ASCENT];
+  }
+
+  public int getDescent ()
+  {
+    return metrics[DESCENT];
+  }
+
+  public int getMaxDescent ()
+  {
+    return metrics[MAX_DESCENT];
+  }
+
+  public int getMaxAdvance ()
+  {
+    return metrics[MAX_ADVANCE];
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java b/libjava/gnu/java/awt/peer/gtk/GdkGraphics.java
new file mode 100644 (file)
index 0000000..3e3d04b
--- /dev/null
@@ -0,0 +1,322 @@
+/* GdkGraphics.java
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class GdkGraphics extends Graphics
+{
+  private final int native_state = GtkGenericPeer.getUniqueInteger();
+
+  Color color, xorColor;
+  GtkComponentPeer component;
+  Font font;
+  Rectangle clip;
+
+  int xOffset = 0;
+  int yOffset = 0;
+
+  static final int GDK_COPY = 0, GDK_XOR = 2;
+
+  native int[] initState (GtkComponentPeer component);
+  native void initState (int width, int height);
+  native void copyState (GdkGraphics g);
+
+  GdkGraphics (GdkGraphics g)
+  {
+    color = g.color;
+    xorColor = g.xorColor;
+    font = g.font;
+    clip = new Rectangle (g.clip);
+    component = g.component;
+
+    copyState (g);
+  }
+
+  GdkGraphics (int width, int height)
+  {
+    initState (width, height);
+    color = Color.black;
+    clip = new Rectangle (0, 0, width, height);
+    font = new Font ("Dialog", Font.PLAIN, 10);
+  }
+
+  GdkGraphics (GtkComponentPeer component)
+  {
+    this.component = component;
+    int rgb[] = initState (component);
+    color = new Color (rgb[0], rgb[1], rgb[2]);
+    font = new Font ("Dialog", Font.PLAIN, 10);
+    Dimension d = component.awtComponent.getSize ();
+    clip = new Rectangle (0, 0, d.width, d.height);
+  }
+
+  public native void clearRect (int x, int y, int width, int height);
+
+  public void clipRect (int x, int y, int width, int height)
+  {
+    clip = clip.intersection (new Rectangle (x, y, width, height));
+    setClipRectangle (clip.x, clip.y, clip.width, clip.height);
+  }
+
+  native public void copyArea (int x, int y, int width, int height, 
+                              int dx, int dy);
+
+  public Graphics create ()
+  {
+    return new GdkGraphics (this);
+  }
+
+//    public Graphics create (int x, int y, int width, int height)
+//    {
+//      GdkGraphics g = new GdkGraphics (this);
+//      System.out.println ("translating by: " + x +" " + y);
+//      g.translate (x, y);
+//      g.clipRect (0, 0, width, height);
+
+//      return g;
+//    }
+  
+  native public void dispose ();
+
+  native void copyPixmap (Graphics g, int x, int y, int width, int height);
+  public boolean drawImage (Image img, int x, int y, 
+                           Color bgcolor, ImageObserver observer)
+  {
+    if (img instanceof GtkOffScreenImage)
+      {
+       copyPixmap (img.getGraphics (), 
+                   x, y, img.getWidth (null), img.getHeight (null));
+       return true;
+      }
+
+    GtkImage image = (GtkImage) img;
+    new GtkImagePainter (image, this, x, y, -1, -1, bgcolor);
+    return image.isLoaded ();
+  }
+
+  public boolean drawImage (Image img, int x, int y, ImageObserver observer)
+  {
+    if (img instanceof GtkOffScreenImage)
+      {
+       copyPixmap (img.getGraphics (), 
+                   x, y, img.getWidth (null), img.getHeight (null));
+       return true;
+      }
+
+    return drawImage (img, x, y, component.getBackground (), observer);
+  }
+
+  public boolean drawImage (Image img, int x, int y, int width, int height, 
+                           Color bgcolor, ImageObserver observer)
+  {
+    if (img instanceof GtkOffScreenImage)
+      {
+       throw new RuntimeException ();
+      }
+
+    GtkImage image = (GtkImage) img;
+    new GtkImagePainter (image, this, x, y, width, height, bgcolor);
+    return image.isLoaded ();
+  }
+
+  public boolean drawImage (Image img, int x, int y, int width, int height, 
+                           ImageObserver observer)
+  {
+    return drawImage (img, x, y, width, height, component.getBackground (),
+                     observer);
+  }
+
+  public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, 
+                           int sx1, int sy1, int sx2, int sy2, 
+                           Color bgcolor, ImageObserver observer)
+  {
+    if (img instanceof GtkOffScreenImage)
+      {
+       throw new RuntimeException ();
+      }
+
+    GtkImage image = (GtkImage) img;
+    new GtkImagePainter (image, this, dx1, dy1, dx2, dy2, 
+                        sx1, sy1, sx2, sy2, bgcolor);
+    return image.isLoaded ();
+  }
+
+  public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, 
+                           int sx1, int sy1, int sx2, int sy2, 
+                           ImageObserver observer) 
+  {
+    return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2,
+                     component.getBackground (), observer);
+  }
+
+  native public void drawLine (int x1, int y1, int x2, int y2);
+
+  native public void drawArc (int x, int y, int width, int height,
+                             int startAngle, int arcAngle);
+  native public void fillArc (int x, int y, int width, int height, 
+                             int startAngle, int arcAngle);
+  native public void drawOval(int x, int y, int width, int height);
+  native public void fillOval(int x, int y, int width, int height);
+
+  native public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
+  native public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
+
+  native public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints);
+
+  native public void drawRect(int x, int y, int width, int height);
+  native public void fillRect (int x, int y, int width, int height);
+
+  native void drawString (String str, int x, int y, String fname, int size);
+  public void drawString (String str, int x, int y)
+  {
+    drawString (str, x, y,
+               ((GtkFontPeer)font.getPeer ()).getXLFD (), font.getSize ());
+  }
+
+  public void drawRoundRect(int x, int y, int width, int height, 
+                           int arcWidth, int arcHeight)
+  {
+    // System.out.println ("drawRoundRect called [UNIMPLEMENTED]");
+  }
+
+  public void fillRoundRect (int x, int y, int width, int height, 
+                            int arcWidth, int arcHeight)
+  {
+    // System.out.println ("fillRoundRect called [UNIMPLEMENTED]");
+  }
+
+  public Shape getClip ()
+  {
+    return getClipBounds ();
+  }
+
+  public Rectangle getClipBounds ()
+  {
+//      System.out.println ("returning CLIP: " + clip);
+    return new Rectangle (clip.x, clip.y, clip.width, clip.height);
+  }
+
+  public Color getColor ()
+  {
+    return color;
+  }
+
+  public Font getFont ()
+  {
+    return font;
+  }
+
+  public FontMetrics getFontMetrics (Font font)
+  {
+    return new GdkFontMetrics (font);
+  }
+
+  native void setClipRectangle (int x, int y, int width, int height);
+
+  public void setClip (int x, int y, int width, int height)
+  {
+    clip.x = x;
+    clip.y = y;
+    clip.width = width;
+    clip.height = height;
+    
+    setClipRectangle (x, y, width, height);
+  }
+
+  public void setClip (Rectangle clip)
+  {
+    setClip (clip.x, clip.y, clip.width, clip.height);
+  }
+
+  public void setClip (Shape clip)
+  {
+    setClip (clip.getBounds ());
+  }
+
+  native private void setFGColor (int red, int green, int blue);
+
+  public void setColor (Color c)
+  {
+    color = c;
+
+    if (xorColor == null) /* paint mode */
+      setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
+    else                 /* xor mode */
+      setFGColor (color.getRed   () ^ xorColor.getRed (),
+                 color.getGreen () ^ xorColor.getGreen (),
+                 color.getBlue  () ^ xorColor.getBlue ());
+  }
+
+  public void setFont (Font font)
+  {
+    this.font = font;
+  }
+
+  native void setFunction (int gdk_func);
+
+  public void setPaintMode ()
+  {
+    xorColor = null;
+
+    setFunction (GDK_COPY);
+    setFGColor (color.getRed (), color.getGreen (), color.getBlue ());
+  }
+
+  public void setXORMode (Color c)
+  {
+    xorColor = c;
+
+    setFunction (GDK_XOR);
+    setFGColor (color.getRed   () ^ xorColor.getRed (),
+               color.getGreen () ^ xorColor.getGreen (),
+               color.getBlue  () ^ xorColor.getBlue ());
+  }
+
+  native public void translateNative (int x, int y);
+
+  public void translate (int x, int y)
+  {
+    clip.x -= x;
+    clip.y -= y;
+
+    translateNative (x, y);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkArg.java b/libjava/gnu/java/awt/peer/gtk/GtkArg.java
new file mode 100644 (file)
index 0000000..0491856
--- /dev/null
@@ -0,0 +1,61 @@
+/* GtkArg.java
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+
+public class GtkArg
+{
+  String name;
+  Object value;
+
+  public GtkArg (String name, Object value)
+  {
+    this.name = name;
+    this.value = value;
+  }
+
+  public String getName ()
+  {
+    return name;
+  }
+
+  public Object getValue ()
+  {
+    return value;
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkArgList.java b/libjava/gnu/java/awt/peer/gtk/GtkArgList.java
new file mode 100644 (file)
index 0000000..c777047
--- /dev/null
@@ -0,0 +1,75 @@
+/* GtkArgList.java
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.util.Vector;
+
+public class GtkArgList extends Vector
+{
+  void add (GtkArg arg)
+  {
+    addElement (arg);
+  }
+
+  void add (String name, boolean value)
+  {
+    addElement (new GtkArg (name, new Boolean (value)));
+  }
+    
+  void add (String name, int value)
+  {
+    addElement (new GtkArg (name, new Integer (value)));
+  }
+
+  void add (String name, float value)
+  {
+    addElement (new GtkArg (name, new Float (value)));
+  }
+
+  void add (String name, Object value)
+  {
+    addElement (new GtkArg (name, value));
+  }
+
+  synchronized void setArgs (GtkComponentPeer cp)
+  {
+    for (int i = 0; i < elementCount; i++)
+      cp.set ((GtkArg)elementData[i]);
+  }
+}
+  
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkButtonPeer.java
new file mode 100644 (file)
index 0000000..94603c0
--- /dev/null
@@ -0,0 +1,89 @@
+/* GtkButtonPeer.java -- Implements ButtonPeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.KeyEvent;
+import java.awt.peer.*;
+
+public class GtkButtonPeer extends GtkComponentPeer
+    implements ButtonPeer
+{
+  native void create ();
+
+  public GtkButtonPeer (Button b)
+  {
+    super (b);
+  }
+
+  public void setLabel (String label) 
+  {
+    set ("label", label);
+  }
+
+  public void handleEvent (AWTEvent e)
+  {
+    if (e.getID () == MouseEvent.MOUSE_CLICKED && isEnabled () 
+       && !modalHasGrab ())
+      {
+       MouseEvent me = (MouseEvent) e;
+       if (!me.isConsumed ()
+           && (me.getModifiers () & MouseEvent.BUTTON1_MASK) != 0)
+         postActionEvent (((Button)awtComponent).getActionCommand (), 
+                          me.getModifiers ());
+      }
+
+    if (e.getID () == KeyEvent.KEY_PRESSED)
+      {
+       KeyEvent ke = (KeyEvent) e;
+       if (!ke.isConsumed () && ke.getKeyCode () == KeyEvent.VK_SPACE)
+         postActionEvent (((Button)awtComponent).getActionCommand (),
+                          ke.getModifiers ());
+      }
+
+    super.handleEvent (e);
+  }
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    super.getArgs (component, args);
+
+    args.add ("label", ((Button)component).getLabel ());
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCanvasPeer.java
new file mode 100644 (file)
index 0000000..59c28f9
--- /dev/null
@@ -0,0 +1,92 @@
+/* GtkCanvasPeer.java
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.event.PaintEvent;
+import java.awt.peer.*;
+
+public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer
+{
+  native void create ();
+
+  public GtkCanvasPeer (Canvas c)
+  {
+    super (c);
+  }
+
+  public Graphics getGraphics ()
+  {
+    return new GdkGraphics (this);
+  }
+
+  public void handleEvent (AWTEvent event)
+  {
+    int id = event.getID();
+      
+    switch (id)
+      {
+      case PaintEvent.PAINT:
+      case PaintEvent.UPDATE:
+       {
+         try 
+           {
+             Graphics g = getGraphics ();
+             g.setClip (((PaintEvent)event).getUpdateRect());
+               
+             if (id == PaintEvent.PAINT)
+               awtComponent.paint (g);
+             else
+               awtComponent.update (g);
+             
+             g.dispose ();
+           } 
+         catch (InternalError e)
+           { 
+             System.err.println (e);
+           }
+       }
+       break;
+      }
+  }
+
+  /* Preferred size for a drawing widget is always what the user requested */
+  public Dimension getPreferredSize ()
+  {
+    return awtComponent.getSize ();
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxGroupPeer.java
new file mode 100644 (file)
index 0000000..9903c31
--- /dev/null
@@ -0,0 +1,86 @@
+/* GtkCheckboxGroupPeer.java - Wrap a CheckboxGroup
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.*;
+
+// Note that there is no peer interface for a CheckboxGroup.  We
+// introduce our own in order to make it easier to keep a piece of
+// native state for each one.
+public class GtkCheckboxGroupPeer extends GtkGenericPeer
+{
+  // This maps from a CheckboxGroup to the native peer.
+  private static WeakHashMap map = new WeakHashMap ();
+
+  // Find the native peer corresponding to a CheckboxGroup.
+  public static synchronized GtkCheckboxGroupPeer
+      getCheckboxGroupPeer (CheckboxGroup group)
+  {
+    if (group == null)
+      return null;
+    GtkCheckboxGroupPeer nat = (GtkCheckboxGroupPeer) map.get (group);
+    if (nat == null)
+      {
+       nat = new GtkCheckboxGroupPeer ();
+       map.put (group, nat);
+      }
+    return nat;
+  }
+
+  private GtkCheckboxGroupPeer ()
+  {
+    // We don't need any special state here.  Note that we can't store
+    // a reference to the java-side CheckboxGroup.  That would mean
+    // they could never be collected.
+    super (null);
+  }
+
+  // Dispose of our native resources.
+  public native void dispose ();
+
+  // Remove a given checkbox from this group.
+  public native void remove (GtkCheckboxPeer box);
+
+  // When collected, clean up the native state.
+  protected void finalize ()
+  {
+    dispose ();
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxMenuItemPeer.java
new file mode 100644 (file)
index 0000000..1bff706
--- /dev/null
@@ -0,0 +1,56 @@
+/* GtkCheckboxMenuItemPeer.java -- Implements CheckboxMenuItemPeer with GTK+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.CheckboxMenuItemPeer;
+import java.awt.peer.MenuItemPeer;
+
+public class GtkCheckboxMenuItemPeer extends GtkMenuItemPeer
+  implements CheckboxMenuItemPeer
+{
+  native void create (String label);
+
+  public GtkCheckboxMenuItemPeer (CheckboxMenuItem menu)
+  {
+    super (menu);
+    setState (menu.getState ());
+  }
+
+  native public void setState (boolean t);
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
new file mode 100644 (file)
index 0000000..48f8804
--- /dev/null
@@ -0,0 +1,114 @@
+/* GtkCheckboxPeer.java -- Implements CheckboxPeer with GTK
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkCheckboxPeer extends GtkComponentPeer
+  implements CheckboxPeer
+{
+  // Group from last time it was set.
+  public GtkCheckboxGroupPeer old_group;
+
+  public native void nativeCreate (GtkCheckboxGroupPeer group);
+  public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
+  public native void connectHooks ();
+
+  public GtkCheckboxPeer (Checkbox c)
+  {
+    super (c);
+  }
+
+  // We can't fully use the ordinary getArgs code here, due to
+  // oddities of this particular widget.  In particular we must be
+  // able to switch between a checkbutton and a radiobutton
+  // dynamically.
+  public void create ()
+  {
+    CheckboxGroup g = ((Checkbox) awtComponent).getCheckboxGroup ();
+    old_group = GtkCheckboxGroupPeer.getCheckboxGroupPeer (g);
+    nativeCreate (old_group);
+  }
+
+  public void setState (boolean state)
+  {
+    set ("active", state);
+  }
+
+  public void setLabel (String label)
+  {
+    set ("label", label);
+  }
+
+  public void setCheckboxGroup (CheckboxGroup group)
+  {
+    GtkCheckboxGroupPeer gp
+      = GtkCheckboxGroupPeer.getCheckboxGroupPeer (group);
+    if (gp != old_group)
+      {
+       if (old_group != null)
+         old_group.remove (this);
+       nativeSetCheckboxGroup (gp);
+       old_group = gp;
+      }
+  }
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    super.getArgs (component, args);
+    args.add ("active", ((Checkbox) component).getState ());
+    args.add ("label", ((Checkbox) component).getLabel ());
+  }
+
+  // Override the superclass postItemEvent so that the peer doesn't
+  // need information that we have.
+  public void postItemEvent (Object item, int stateChange)
+  {
+    super.postItemEvent (awtComponent, stateChange);
+  }
+
+  public void dispose ()
+  {
+    // Notify the group so that the native state can be cleaned up
+    // appropriately.
+    if (old_group != null)
+      old_group.remove (this);
+    super.dispose ();
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkChoicePeer.java
new file mode 100644 (file)
index 0000000..19e1a56
--- /dev/null
@@ -0,0 +1,90 @@
+/* GtkChoicePeer.java -- Implements ChoicePeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+import java.awt.event.*;
+
+public class GtkChoicePeer extends GtkComponentPeer
+  implements ChoicePeer
+{
+  native void create ();
+
+  public GtkChoicePeer (Choice c)
+  {
+    super (c);
+
+    int count = c.getItemCount ();
+    if (count > 0)
+      {
+       String items[] = new String[count];
+       for (int i = 0; i < count; i++)
+         items[i] = c.getItem (i);
+         
+       append (items);
+      }
+  }
+
+  native void append (String items[]);
+
+  native public void add (String item, int index);
+  native public void remove (int index);
+  native public void select (int position);
+  
+  public void addItem (String item, int position)
+  {
+    add (item, position);
+  }
+  
+  /*
+  public void handleEvent (AWTEvent event)
+  {
+    if (event instanceof ItemEvent)
+      ((Choice) awtComponent).select ((String) ((ItemEvent)event).getItem ());
+    super.handleEvent (event);
+  }
+  */
+
+  protected void postItemEvent (Object item, int stateChange)
+  {
+    if (stateChange == ItemEvent.SELECTED)
+      ((Choice) awtComponent).select ((String) item);
+    super.postItemEvent (item, stateChange);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java b/libjava/gnu/java/awt/peer/gtk/GtkClipboard.java
new file mode 100644 (file)
index 0000000..d2587d9
--- /dev/null
@@ -0,0 +1,167 @@
+/* GtkClipboard.java
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+import java.io.*;
+import java.net.*;
+import java.util.*;
+import java.awt.datatransfer.*;
+import java.awt.image.*;
+import java.awt.peer.*;
+
+public class GtkClipboard extends Clipboard
+{
+  /* the number of milliseconds that we'll wait around for the
+     owner of the GDK_SELECTION_PRIMARY selection to convert 
+     the requested data */
+  final static int SELECTION_RECEIVED_TIMEOUT = 5000;
+
+  /* We currently only support transferring of text between applications */
+  static String selection;
+  static Object selectionLock = new Object ();
+
+  static boolean hasSelection = false;
+
+  protected 
+  GtkClipboard ()
+  {
+    super ("System Clipboard");
+    initNativeState ();
+  }
+
+  public Transferable 
+  getContents (Object requestor)
+  {
+    synchronized (this)
+      {
+       if (hasSelection)
+         return contents;
+      }
+
+    /* Java doesn't own the selection, so we need to ask X11 */
+    synchronized (selectionLock)
+      {
+       requestStringConversion ();
+       try 
+         {
+           selectionLock.wait (SELECTION_RECEIVED_TIMEOUT);
+         } 
+       catch (InterruptedException e)
+         {
+           return null;
+         }
+       
+       return (selection == null) ? null : new StringSelection (selection);
+      }
+  }
+
+  void 
+  stringSelectionReceived (String newSelection)
+  {
+    synchronized (selectionLock)
+      {
+       selection = newSelection;
+       selectionLock.notify ();
+      }
+  }
+
+  /* convert Java clipboard data into a String suitable for sending
+     to another application */
+  synchronized String
+  stringSelectionHandler () throws IOException
+  {
+    String selection = null;
+
+    try {
+      if (contents.isDataFlavorSupported (DataFlavor.stringFlavor))
+       selection = (String)contents.getTransferData (DataFlavor.stringFlavor);
+      else if (contents.isDataFlavorSupported (DataFlavor.plainTextFlavor))
+       {
+         StringBuffer sbuf = new StringBuffer ();
+         InputStreamReader reader;
+         char readBuf[] = new char[512];
+         int numChars;
+         
+         reader = new InputStreamReader 
+           ((InputStream) 
+            contents.getTransferData (DataFlavor.plainTextFlavor), "UNICODE");
+         
+         while (true)
+           {
+             numChars = reader.read (readBuf);
+             if (numChars == -1)
+               break;
+             sbuf.append (readBuf, 0, numChars);
+           }
+         
+         selection = new String (sbuf);
+       }
+    } catch (Exception e) { }
+    
+    return selection;
+  }
+
+  public synchronized void
+  setContents (Transferable contents, ClipboardOwner owner)
+  {
+    selectionGet ();
+
+    this.contents = contents;
+    this.owner = owner;
+
+    hasSelection = true;
+  }
+
+  synchronized
+  void selectionClear ()
+  {
+    hasSelection = false;
+
+    if (owner != null)
+      {
+       owner.lostOwnership (this, contents);
+       owner = null;
+       contents = null;
+      }
+  }
+
+  native void initNativeState ();
+  native static void requestStringConversion ();
+  native static void selectionGet ();
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkComponentPeer.java
new file mode 100644 (file)
index 0000000..6e3b252
--- /dev/null
@@ -0,0 +1,391 @@
+/* GtkComponentPeer.java -- Implements ComponentPeer with GTK
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.awt.peer.ComponentPeer;
+
+public class GtkComponentPeer extends GtkGenericPeer
+  implements ComponentPeer
+{
+  Component awtComponent;
+
+  /* this isEnabled differs from Component.isEnabled, in that it
+     knows if a parent is disabled.  In that case Component.isEnabled 
+     may return true, but our isEnabled will always return false */
+  native boolean isEnabled ();
+  native static boolean modalHasGrab ();
+
+  native int[] gtkWidgetGetForeground ();
+  native int[] gtkWidgetGetBackground ();
+  native void gtkWidgetSetVisible (boolean b);
+  native void gtkWidgetGetDimensions(int[] dim);
+  native void gtkWidgetGetLocationOnScreen(int[] point);
+  native void gtkWidgetSetCursor (int type);
+
+  void create ()
+  {
+    throw new RuntimeException ();
+  }
+
+  native void connectHooks ();
+
+  protected GtkComponentPeer (Component awtComponent)
+  {
+    super (awtComponent);
+    this.awtComponent = awtComponent;
+
+    /* temporary try/catch block until all peers use this creation method */
+    try {
+      create ();
+      
+      GtkArgList args = new GtkArgList ();
+      getArgs (awtComponent, args);
+      args.setArgs (this);
+
+      connectHooks ();
+
+      if (awtComponent.getForeground () == null)
+       awtComponent.setForeground (getForeground ());
+      if (awtComponent.getBackground () == null)
+       awtComponent.setBackground (getBackground ());
+      //        if (c.getFont () == null)
+      //       c.setFont (cp.getFont ());
+      
+      if (! (awtComponent instanceof Window))
+       {
+         setCursor (awtComponent.getCursor ());
+         Rectangle bounds = awtComponent.getBounds ();
+         setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
+       }
+    } catch (RuntimeException ex) { ; }
+  }
+
+  public int checkImage (Image image, int width, int height, 
+                        ImageObserver observer) 
+  {
+    GtkImage i = (GtkImage) image;
+    return i.checkImage ();
+  }
+
+  public Image createImage (ImageProducer producer) 
+  {
+    return new GtkImage (producer, null);
+  }
+
+  public Image createImage (int width, int height)
+  {
+    GdkGraphics g = new GdkGraphics (width, height);
+    return new GtkOffScreenImage (null, g, width, height);
+  }
+
+  public void disable () 
+  {
+    setEnabled (false);
+  }
+
+  public void enable () 
+  {
+    setEnabled (true);
+  }
+
+  public ColorModel getColorModel () 
+  {
+    return ColorModel.getRGBdefault ();
+  }
+
+  public FontMetrics getFontMetrics (Font font)
+  {
+    return new GdkFontMetrics (font);
+  }
+
+  public Graphics getGraphics ()
+  {
+    return null;
+  }
+
+  public Point getLocationOnScreen () 
+  { 
+    int point[] = new int[2];
+    gtkWidgetGetLocationOnScreen (point);
+    return new Point (point[0], point[1]);
+  }
+
+  public Dimension getMinimumSize () 
+  {
+    int dim[]=new int[2];
+    gtkWidgetGetDimensions (dim);
+    Dimension d = new Dimension (dim[0],dim[1]);
+    return (d);
+  }
+
+  public Dimension getPreferredSize ()
+  {
+    int dim[]=new int[2];
+    gtkWidgetGetDimensions (dim);
+    Dimension d = new Dimension (dim[0],dim[1]);
+    return (d);
+  }
+
+  public Toolkit getToolkit ()
+  {
+    return Toolkit.getDefaultToolkit();
+  }
+  
+  public void handleEvent (AWTEvent event)
+  {
+  }
+  
+  public boolean isFocusTraversable () 
+  {
+    return true;
+  }
+
+  public Dimension minimumSize () 
+  {
+    return getMinimumSize();
+  }
+
+  public void paint (Graphics g)
+  {
+    awtComponent.paint (g);
+  }
+
+  public Dimension preferredSize()
+  {
+    return getPreferredSize();
+  }
+
+  public boolean prepareImage (Image image, int width, int height,
+                              ImageObserver observer) 
+  {
+    GtkImage i = (GtkImage) image;
+
+    if (i.isLoaded ()) return true;
+
+    class PrepareImage extends Thread
+    {
+      GtkImage image;
+      ImageObserver observer;
+
+      PrepareImage (GtkImage image, ImageObserver observer)
+      {
+       this.image = image;
+       this.observer = observer;
+      }
+      
+      public void run ()
+      {
+       // XXX: need to return data to image observer
+       image.source.startProduction (null);
+      }
+    }
+
+    new PrepareImage (i, observer).start ();
+    return false;
+  }
+
+  public void print (Graphics g) 
+  {
+    throw new RuntimeException ();
+  }
+
+  public void repaint (long tm, int x, int y, int width, int height)
+  {
+    q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
+                                new Rectangle (x, y, width, height)));
+  }
+
+  native public void requestFocus ();
+
+  public void reshape (int x, int y, int width, int height) 
+  {
+    setBounds (x, y, width, height);
+  }
+
+  public void setBackground (Color c) 
+  {
+    // System.out.println ("setBackground [UNIMPLEMENTED");
+  }
+
+  native public void setNativeBounds (int x, int y, int width, int height);
+
+  public void setBounds (int x, int y, int width, int height)
+  {
+    Component parent = awtComponent.getParent ();
+    
+    if (parent instanceof Frame)
+      {
+       Insets insets = ((Frame)parent).getInsets ();
+       /* convert Java's coordinate space into GTK+'s coordinate space */
+       setNativeBounds (x-insets.left, y-insets.top, width, height);
+      }
+    else
+      setNativeBounds (x, y, width, height);
+  }
+
+  public void setCursor (Cursor cursor) 
+  {
+    gtkWidgetSetCursor (cursor.getType ());
+  }
+
+  public void setEnabled (boolean b)
+  {
+    set ("sensitive", b);
+  }
+
+  public void setFont (Font f)
+  {
+  }
+
+  public void setForeground (Color c) 
+  {
+    // System.out.println ("setForeground [UNIMPLEMENTED");
+  }
+
+  public Color getForeground ()
+  {
+    int rgb[] = gtkWidgetGetForeground ();
+    return new Color (rgb[0], rgb[1], rgb[2]);
+  }
+
+  public Color getBackground ()
+  {
+    int rgb[] = gtkWidgetGetBackground ();
+    return new Color (rgb[0], rgb[1], rgb[2]);
+  }
+
+  public void setVisible (boolean b)
+  {
+    set ("visible", b);
+  }
+  
+  public void hide () 
+  {
+    setVisible (false);
+  }
+
+  public void show () 
+  {
+    setVisible (true);
+  }
+
+  protected void postMouseEvent(int id, long when, int mods, int x, int y, 
+                               int clickCount, boolean popupTrigger) 
+  {
+    q.postEvent(new MouseEvent(awtComponent, id, when, mods, x, y, 
+                              clickCount, popupTrigger));
+  }
+
+  protected void postExposeEvent (int x, int y, int width, int height)
+  {
+    q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+                                new Rectangle (x, y, width, height)));
+  }
+
+  protected void postKeyEvent (int id, long when, int mods, 
+                              int keyCode, char keyChar)
+  {
+    q.postEvent (new KeyEvent (awtComponent, id, when, mods, 
+                              keyCode, keyChar));
+  }
+  
+  protected void postFocusEvent (int id, boolean temporary)
+  {
+    q.postEvent (new FocusEvent (awtComponent, id, temporary));
+  }
+
+  protected void postItemEvent (Object item, int stateChange)
+  {
+    q.postEvent (new ItemEvent ((ItemSelectable)awtComponent, 
+                               ItemEvent.ITEM_STATE_CHANGED,
+                               item, stateChange));
+  }
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    args.add ("visible", component.isVisible ());
+    args.add ("sensitive", component.isEnabled ());
+
+    ComponentPeer p;
+
+    do
+      {
+       component = component.getParent ();
+       p = component.getPeer ();
+      } while (p instanceof java.awt.peer.LightweightPeer);
+    
+    args.add ("parent", p);
+  }
+
+  native void set (String name, String value);
+  native void set (String name, boolean value);
+  native void set (String name, int value);
+  native void set (String name, float value);
+  native void set (String name, Object value);
+
+  void set (GtkArg arg)
+  {
+    String name = arg.getName ();
+    Object value = arg.getValue ();
+
+    if (value instanceof Boolean)
+      set (name, ((Boolean)value).booleanValue ());
+    else if (value instanceof Integer)
+      set (name, ((Integer)value).intValue ());
+    else if (value instanceof Float)
+      set (name, ((Float)value).floatValue ());
+    else if (value instanceof String)
+      set (name, ((String) value));
+    else
+      set (name, value);
+  }
+
+  public GraphicsConfiguration getGraphicsConfiguration ()
+  {
+    // FIXME: just a stub for now.
+    return null;
+  }
+
+  public void setEventMask (long mask)
+  {
+    // FIXME: just a stub for now.
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkContainerPeer.java
new file mode 100644 (file)
index 0000000..fef88cd
--- /dev/null
@@ -0,0 +1,125 @@
+/* GtkContainerPeer.java -- Implements ContainerPeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.peer.ContainerPeer;
+
+public class GtkContainerPeer extends GtkComponentPeer
+  implements ContainerPeer
+{
+  Insets insets;
+  Container c;
+
+  public GtkContainerPeer(Container c)
+  {
+    super (c);
+    this.c = c;
+    insets = new Insets (0, 0, 0, 0);
+  }
+
+  public void beginValidate() 
+  {
+  }
+
+  public void endValidate() 
+  {
+//      q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+//                              new Rectangle (x, y, width, height)));
+//      Graphics gc = getGraphics ();
+//      if (gc != null)
+//        {
+//     awtComponent.update (gc);
+//     gc.dispose ();
+//        }
+//      System.out.println ("got here");
+//      awtComponent.repaint ();
+  }
+
+  public Insets getInsets() 
+  {
+    return insets;
+  }
+
+  public Insets insets() 
+  {
+    return getInsets ();
+  }
+
+  public void setBounds (int x, int y, int width, int height)
+  {
+    super.setBounds (x, y, width, height);
+    awtComponent.validate ();
+  }
+
+  public Graphics getGraphics ()
+  {
+    return new GdkGraphics (this);
+  }
+
+  public void handleEvent (AWTEvent event)
+  {
+    int id = event.getID();
+      
+    switch (id)
+      {
+      case PaintEvent.PAINT:
+      case PaintEvent.UPDATE:
+       {
+         try 
+           {
+             Graphics g = getGraphics ();
+             g.setClip (((PaintEvent)event).getUpdateRect());
+
+             if (id == PaintEvent.PAINT)
+               awtComponent.paint (g);
+             else
+               awtComponent.update (g);
+             
+             g.dispose ();
+           } 
+         catch (InternalError e)
+           { 
+             System.err.println (e);
+           }
+       }
+       break;
+      }
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkDialogPeer.java
new file mode 100644 (file)
index 0000000..b47956d
--- /dev/null
@@ -0,0 +1,76 @@
+/* GtkDialogPeer.java -- Implements DialogPeer with GTK
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.event.*;
+
+public class GtkDialogPeer extends GtkWindowPeer
+  implements DialogPeer
+{
+  public GtkDialogPeer (Dialog dialog)
+  {
+    super (dialog);
+  }
+
+  void create ()
+  {
+    create (GTK_WINDOW_DIALOG);
+  }
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    super.getArgs (component, args);
+
+    Dialog dialog = (Dialog) component;
+
+    args.add ("modal", dialog.isModal ());
+    args.add ("allow_shrink", dialog.isResizable ());
+    args.add ("allow_grow", dialog.isResizable ());
+  }
+
+  public void handleEvent (AWTEvent event)
+  {
+//     int id = event.getID();
+    
+//     if (id == WindowEvent.WINDOW_CLOSING)
+//       System.out.println ("got a closing event");
+  }
+
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
new file mode 100644 (file)
index 0000000..3376787
--- /dev/null
@@ -0,0 +1,70 @@
+/* GtkFileDialogPeer.java -- Implements FileDialogPeer with GTK
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.io.FilenameFilter;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
+{
+  native void create ();
+
+  public GtkFileDialogPeer (FileDialog fd)
+  {
+    super (fd);
+  }
+
+  public void setDirectory (String directory)
+  {
+    setFile (directory);
+  }
+
+  public native void setFile (String file);
+  public native void connectHooks ();
+
+  public void setFilenameFilter (FilenameFilter filter)
+  {
+    /* GTK has no filters. */
+  }
+
+  public Graphics getGraphics ()
+  {
+    return null;
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFontPeer.java
new file mode 100644 (file)
index 0000000..47a46e8
--- /dev/null
@@ -0,0 +1,74 @@
+/* GtkFontPeer.java -- Implements FontPeer with GTK+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.FontPeer;
+import java.awt.Font;
+import java.util.ResourceBundle;
+
+public class GtkFontPeer implements FontPeer
+{
+  private static ResourceBundle bundle;
+  
+  static
+  {
+    try
+      {
+       bundle = ResourceBundle.getBundle ("gnu.java.awt.peer.gtk.font");
+      }
+    catch (Throwable ignored)
+      {
+       bundle = null;
+      }
+  }
+
+  final private String Xname;
+
+  public GtkFontPeer (String name, int style)
+  {
+    if (bundle != null)
+      Xname = bundle.getString (name.toLowerCase () + "." + style);
+    else
+      Xname = "-*-*-medium-r-normal-*-12-*-*-*-c-*-*-*";
+  }
+
+  public String getXLFD ()
+  {
+    return Xname;
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkFramePeer.java
new file mode 100644 (file)
index 0000000..e16a570
--- /dev/null
@@ -0,0 +1,132 @@
+/* GtkFramePeer.java -- Implements FramePeer with GTK
+   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.event.*;
+
+public class GtkFramePeer extends GtkWindowPeer
+    implements FramePeer
+{
+  int menuBarHeight = 0;
+  native int getMenuBarHeight ();
+
+  native public void setMenuBarPeer (MenuBarPeer bar);
+
+  public void setMenuBar (MenuBar bar)
+  {
+    if (bar == null)
+      setMenuBarPeer (null);
+    else
+      setMenuBarPeer ((MenuBarPeer) bar.getPeer ());
+  }
+
+  public GtkFramePeer (Frame frame)
+  {
+    super (frame);
+  }
+
+  void create ()
+  {
+    create (GTK_WINDOW_TOPLEVEL);
+  }
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    super.getArgs (component, args);
+
+    Frame frame = (Frame) component;
+
+    args.add ("title", frame.getTitle ());
+    args.add ("allow_shrink", frame.isResizable ());
+    args.add ("allow_grow", frame.isResizable ());
+  }
+  public void setIconImage (Image image) 
+  {
+      /* TODO: Waiting on Toolkit Image routines */
+  }
+
+  public Graphics getGraphics ()
+  {
+    GdkGraphics g = new GdkGraphics (this);
+    g.translateNative (-insets.left, -insets.top);
+    return g;
+  }
+
+  public void setBounds (int x, int y, int width, int height)
+  {
+    super.setBounds (0, 0, width - insets.left - insets.right,
+                    height - insets.top - insets.bottom + menuBarHeight);
+  }
+
+  protected void postConfigureEvent (int x, int y, int width, int height,
+                                    int top, int left, int bottom, int right)
+  {
+    if (((Frame)awtComponent).getMenuBar () != null)
+      {
+       menuBarHeight = getMenuBarHeight ();
+       top += menuBarHeight;
+      }
+
+    super.postConfigureEvent (0, 0,
+                             width + left + right,
+                             height + top + bottom - menuBarHeight,
+                             top, left, bottom, right);
+  }
+
+  protected void postMouseEvent(int id, long when, int mods, int x, int y, 
+                               int clickCount, boolean popupTrigger)
+  {
+    super.postMouseEvent (id, when, mods, 
+                         x + insets.left, y + insets.top, 
+                         clickCount, popupTrigger);
+  }
+
+  protected void postExposeEvent (int x, int y, int width, int height)
+  {
+//      System.out.println ("x + insets.left:" + (x + insets.left));
+//      System.out.println ("y + insets.top :" + (y + insets.top));
+    q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+                                new Rectangle (x + insets.left, 
+                                               y + insets.top, 
+                                               width, height)));
+  }
+}
+
+
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkGenericPeer.java
new file mode 100644 (file)
index 0000000..914b7a6
--- /dev/null
@@ -0,0 +1,84 @@
+/* GtkGenericPeer.java - Has a hashcode.  Yuck.
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.event.*;
+
+public class GtkGenericPeer
+{
+  final int native_state = getUniqueInteger ();
+
+  // Next native state value we will assign.
+  private static int next_native_state = 0;
+
+  // The widget or other java-side object we wrap.
+  protected Object awtWidget;
+
+  // Global event queue.
+  protected static EventQueue q = null;
+
+  // Dispose of our native state.
+  public native void dispose ();
+
+  protected GtkGenericPeer (Object awtWidget)
+  {
+    this.awtWidget = awtWidget;
+  }
+
+  public static void enableQueue (EventQueue sq) 
+  {
+    if (q == null)
+      q = sq;
+  }
+
+  protected void postActionEvent (String command, int mods) 
+  {
+    q.postEvent (new ActionEvent (awtWidget, ActionEvent.ACTION_PERFORMED, 
+                                 command, mods));
+  }
+
+  // Return a unique integer for use in the native state mapping
+  // code.  We can't use a hash code since that is not guaranteed to
+  // be unique.
+  static synchronized int getUniqueInteger ()
+  {
+    // Let's assume this will never wrap.
+    return next_native_state++;
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImage.java b/libjava/gnu/java/awt/peer/gtk/GtkImage.java
new file mode 100644 (file)
index 0000000..f0c8bf4
--- /dev/null
@@ -0,0 +1,286 @@
+/* GtkImage.java
+   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+import java.util.*;
+import java.awt.image.*;
+
+public class GtkImage extends Image implements ImageConsumer
+{
+  int width = -1, height = -1;
+  Hashtable props = null;
+  boolean isLoaded = false;
+  boolean isCacheable = true;
+  boolean loading = false;
+
+  Vector widthObservers = new Vector ();
+  Vector heightObservers = new Vector ();
+  Vector propertyObservers = new Vector ();
+
+  ImageProducer source;
+  Graphics g;
+
+  /* Variables in which we stored cached data, if possible.
+
+     An image is cached if the following properties are true:
+     1. The ColorModel passed into setColorModel is the same ColorModel
+        passed to all invocations of setPixels.
+     2. The image contains a single frame.
+
+  */
+  int[] pixelCache;
+  ColorModel model;
+
+  public 
+  GtkImage (ImageProducer producer, Graphics g)
+  {
+    source = producer;
+    this.g = g;
+
+    source.addConsumer (this);
+  }
+  
+  public synchronized int 
+  getWidth (ImageObserver observer)
+  {
+    if (width == -1)
+      widthObservers.addElement (observer);
+    
+    return width;
+  }
+  
+  public synchronized int 
+  getHeight (ImageObserver observer)
+  {
+    if (height == -1)
+      heightObservers.addElement (observer);
+    
+    return height;
+  }
+  
+  public ImageProducer 
+  getSource ()
+  {
+    return source;
+  }
+
+  public Graphics 
+  getGraphics ()
+  {
+    return g;
+  }
+  
+  public synchronized Object 
+  getProperty (String name, ImageObserver observer)
+  {
+    if (props == null)
+      {
+       propertyObservers.addElement (observer);
+       return null;
+      }
+    
+    Object value = props.get (name);
+    return (value == null) ? UndefinedProperty : value;
+  }
+
+  public synchronized void 
+  flush ()
+  {
+    isLoaded = false;
+    isCacheable = true;
+    width = height = -1;
+    props = null;
+    pixelCache = null;
+    model = null;
+
+    source.removeConsumer (this);
+    source.addConsumer (this);
+  }
+
+  public boolean
+  isLoaded ()
+  {
+    return isLoaded;
+  }
+
+  /* ImageConsumer methods */
+
+  public synchronized void 
+  setDimensions (int width, int height)
+  {
+    pixelCache = new int[width*height];
+
+    this.width = width;
+    this.height = height;
+    
+    for (int i = 0; i < widthObservers.size (); i++)
+      {
+       ImageObserver io = (ImageObserver) widthObservers.elementAt (i);
+       io.imageUpdate (this, ImageObserver.WIDTH, -1, -1, width, height);
+      }
+
+    for (int i = 0; i < heightObservers.size (); i++)
+      {
+       ImageObserver io = (ImageObserver) heightObservers.elementAt (i);
+       io.imageUpdate (this, ImageObserver.HEIGHT, -1, -1, width, height);
+      }
+  }
+
+  public synchronized void 
+  setProperties (Hashtable props)
+  {
+    this.props = props;
+    
+    for (int i = 0; i < propertyObservers.size (); i++)
+      {
+       ImageObserver io = (ImageObserver) propertyObservers.elementAt (i);
+       io.imageUpdate (this, ImageObserver.PROPERTIES, -1, -1, width, height);
+      }
+  }
+
+  public synchronized void 
+  setColorModel (ColorModel model)
+  {
+    if (this.model == null || this.model == model)
+      this.model = model;
+    else
+      isCacheable = false;
+  }
+
+  public synchronized void 
+  setHints (int flags)
+  {
+  }
+
+  public synchronized void 
+  setPixels (int x, int y, int width, int height, ColorModel cm, byte[] pixels,
+            int offset, int scansize)
+  {
+    setPixels (x, y, width, height, cm, convertPixels (pixels), offset,
+              scansize);
+  }
+
+  public synchronized void 
+  setPixels (int x, int y, int width, int height, ColorModel cm, int[] pixels,
+            int offset, int scansize)
+  {
+    loading = true;
+
+    if (!isCacheable)
+      return;
+
+    if (cm != model || pixelCache == null)
+      {
+       isCacheable = false;
+       return;
+      }
+
+    if (scansize == width)
+      {
+       System.arraycopy (pixels, offset, 
+                         pixelCache, y * this.width + x,
+                         pixels.length - offset);
+      }
+    else                       // skip over scansize-width for each row
+      {
+       for (int i = 0; i < height; i++)
+         System.arraycopy (pixels, offset + (i * scansize),
+                           pixelCache, (y + i) * this.width + x,
+                           width);
+      }
+  }
+
+  public synchronized void 
+  imageComplete (int status)
+  {
+    if (status == ImageConsumer.STATICIMAGEDONE && isCacheable)
+      isLoaded = true;
+
+    if (status == ImageConsumer.SINGLEFRAMEDONE)
+      isCacheable = false;
+
+    source.removeConsumer (this);
+  }
+
+  public synchronized void
+  startProduction (GtkImagePainter painter)
+  {
+    if (isLoaded)
+      {
+       painter.setDimensions (width, height);
+       painter.setPixels (0, 0, width, height, model, pixelCache, 0, width);
+      }
+    else
+      {
+       source.startProduction (painter);
+       source.removeConsumer (painter);
+      }
+  }
+
+  private int[]
+  convertPixels (byte[] pixels)
+  {
+    int ret[] = new int[pixels.length];
+
+    for (int i = 0; i < pixels.length; i++)
+      ret[i] = pixels[i];
+    
+    return ret;
+  }
+
+  synchronized int 
+  checkImage ()
+  {
+    int bits = 0;
+
+    if (width != -1)
+      bits |= ImageObserver.WIDTH;
+    if (height != -1)
+      bits |= ImageObserver.HEIGHT;
+    if (props != null)
+      bits |= ImageObserver.PROPERTIES;
+    if (loading)
+      bits |= ImageObserver.SOMEBITS;
+    if (isLoaded)
+      bits |= ImageObserver.ALLBITS;
+
+    return bits;
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java b/libjava/gnu/java/awt/peer/gtk/GtkImagePainter.java
new file mode 100644 (file)
index 0000000..3ea22cd
--- /dev/null
@@ -0,0 +1,239 @@
+/* GtkImagePainter.java
+   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+import java.awt.image.*;
+import java.util.*;
+
+public class GtkImagePainter implements Runnable, ImageConsumer
+{
+  GtkImage image;
+  GdkGraphics gc;
+  int startX, startY;
+  int redBG;
+  int greenBG;
+  int blueBG;
+  double affine[];
+  int width, height;
+  boolean flipX, flipY;
+  Rectangle clip;
+  int s_width, s_height;
+
+  public
+  GtkImagePainter (GtkImage image, GdkGraphics gc, int x, int y, 
+                  int width, int height, Color bgcolor)
+  {
+    this.image = image;
+    this.gc = (GdkGraphics) gc.create ();
+    startX = x;
+    startY = y;
+    redBG = bgcolor.getRed ();
+    greenBG = bgcolor.getGreen ();
+    blueBG = bgcolor.getBlue ();
+    this.width = width;
+    this.height = height;
+    flipX = flipY = false;
+    s_width = s_height = 0;
+    clip = null;
+
+    new Thread (this).start ();
+  }
+
+  public
+  GtkImagePainter (GtkImage image, GdkGraphics gc, 
+                  int dx1, int dy1, int dx2, int dy2,
+                  int sx1, int sy1, int sx2, int sy2,
+                  Color bgcolor)
+  {
+    this.image = image;
+    this.gc = (GdkGraphics) gc.create ();
+    startX = (dx1 < dx2) ? dx1 : dx2;
+    startY = dy1;
+    redBG = bgcolor.getRed ();
+    greenBG = bgcolor.getGreen ();
+    blueBG = bgcolor.getBlue ();
+
+    this.width = Math.abs (dx2 - dx1);
+    this.height = Math.abs (dy2 - dy1);
+
+    flipX = ((dx1 > dx2 && sx2 > sx1)
+            || (dx1 < dx2 && sx2 < sx1));
+
+    flipY = ((dy1 > dy2 && sy2 > sy1)
+            || (dy1 < dy2 && sy2 < sy1));
+
+    s_width = Math.abs (sx2 - sx1);
+    s_height = Math.abs (sy2 - sy1);
+    clip = new Rectangle (sx1, sy1, s_width, s_height);
+    
+    new Thread (this).start ();
+  }
+
+  public void
+  run ()
+  {
+    image.startProduction (this);
+    gc.dispose ();
+  }
+
+  /* Convert pixel data into a format that gdkrgb can understand */
+  static int[] 
+  convertPixels (int[] pixels, ColorModel model)
+  {
+    if (model.equals (ColorModel.getRGBdefault ()))
+      return pixels;
+    
+    int ret[] = new int[pixels.length];
+
+    for (int i = 0; i < pixels.length; i++)
+      ret[i] = model.getRGB (pixels[i]);
+
+    return ret;
+  }
+
+  static int[]
+  convertPixels (byte[] pixels, ColorModel model)
+  {
+    int ret[] = new int[pixels.length];
+
+    for (int i = 0; i < pixels.length; i++)
+      ret[i] = model.getRGB (pixels[i]);
+
+    return ret;
+  }
+
+  native void
+  drawPixels (GdkGraphics gc, int bg_red, int bg_green, int bg_blue, 
+             int x, int y, int width, int height, int[] pixels, int offset, 
+             int scansize, double affine[]);
+
+  public void 
+  setPixels (int x, int y, int width, int height, ColorModel model,
+            int[] pixels, int offset, int scansize)
+  {
+    if (clip != null)
+      {
+       Rectangle r;
+       r = clip.intersection (new Rectangle (x, y, width, height));
+       if (r.width == 0 && r.height == 0)
+         return;
+
+       offset += r.y * scansize + r.x;
+
+       r.translate (-Math.abs (clip.x - startX), -Math.abs (clip.y - startY));
+
+       width = r.width;
+       height = r.height;
+       x = r.x;
+       y = r.y;
+      }
+
+    drawPixels (gc, redBG, greenBG, blueBG,
+               startX + x, startY + y,
+               width, height, convertPixels (pixels, model), offset,
+               scansize, affine);
+  }
+
+  public void 
+  setPixels (int x, int y, int width, int height, ColorModel model, 
+            byte[] pixels, int offset, int scansize)
+  {
+    setPixels (x, y, width, height, model, convertPixels (pixels, model),
+              offset, scansize);
+  }
+
+  public void 
+  setDimensions (int width, int height)
+  {
+    if (!flipX && !flipY && 
+       ((this.width == -1 && this.height == -1)
+        || (this.width == width && this.height == height)))
+      return;
+
+    affine = new double[6];
+    affine[1] = affine[2] = affine[4] = affine[5] = 0;
+    
+    if (clip != null)
+      {
+       affine[0] = this.width / (double) s_width;
+       affine[3] = this.height / (double) s_height;
+      }
+    else
+      {
+       affine[0] = this.width / (double) width;
+       affine[3] = this.height / (double) height;
+      }
+
+    if (flipX)
+      {
+       affine[0] = -affine[0];
+       affine[4] = this.width;
+      }
+
+    if (flipY)
+      {
+       affine[3] = -affine[3];
+       affine[5] = this.height;
+      }
+
+    if (affine[0] == 1 && affine[3] == 1)
+      affine = null;
+  }
+
+  public void 
+  setProperties (Hashtable props)
+  {
+  }
+
+  public void 
+  setColorModel (ColorModel model)
+  {
+  }
+
+  public void 
+  setHints (int flags)
+  {
+  }
+
+  public void 
+  imageComplete (int status)
+  {
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkLabelPeer.java
new file mode 100644 (file)
index 0000000..5cd3fb7
--- /dev/null
@@ -0,0 +1,88 @@
+/* GtkLabelPeer.java -- Implements LabelPeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.*;
+
+public class GtkLabelPeer extends GtkComponentPeer
+    implements LabelPeer
+{
+  native void create ();
+
+  public GtkLabelPeer (Label l)
+  {
+    super (l);
+  }
+    
+  public void setText (String text)
+  {
+    set ("label", text);
+  }
+
+  public void setAlignment (int alignment)
+  {
+    set ("xalign", getGtkAlignment (alignment));
+  }
+
+  float getGtkAlignment (int alignment)
+  {
+    switch (alignment)
+      {
+      case Label.LEFT:
+       return 0.0f;
+      case Label.CENTER:
+       return 0.5f;
+      case Label.RIGHT:
+       return 1.0f;
+      }
+
+    return 0.0f;
+  }
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    super.getArgs (component, args);
+
+    Label label = (Label) component;
+
+    args.add ("label", label.getText ());
+    args.add ("xalign", getGtkAlignment (label.getAlignment ()));
+    args.add ("yalign", 0.5f);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkListPeer.java
new file mode 100644 (file)
index 0000000..6686457
--- /dev/null
@@ -0,0 +1,126 @@
+/* GtkListPeer.java -- Implements ListPeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.*;
+
+public class GtkListPeer extends GtkComponentPeer
+  implements ListPeer
+{
+//    native void create (ComponentPeer parent, String [] items, boolean mode);
+
+  native void create ();
+  native void connectHooks ();
+
+  native void getSize (int rows, int dims[]);
+
+  public GtkListPeer (List list)
+  {
+    super (list);
+    
+    setMultipleMode (list.isMultipleMode ());
+
+    if (list.getItemCount () > 0)
+      append (list.getItems ());
+  }
+
+  native void append (String items[]);
+
+  public native void add (String item, int index);
+  
+  public void addItem (String item, int index)
+  {
+    add (item, index);
+  }
+  
+  public void clear ()
+  {
+    removeAll ();
+  }
+  
+  public native void delItems (int start, int end);
+  public native void deselect (int index);
+  
+  public Dimension getMinimumSize (int rows)
+  {
+    int dims[] = new int[2];
+
+    getSize (rows, dims);
+    return (new Dimension (dims[0], dims[1]));
+  }
+
+  public Dimension getPreferredSize (int rows)
+  {
+    int dims[] = new int[2];
+
+    getSize (rows, dims);
+    return (new Dimension (dims[0], dims[1]));
+  }
+  
+  public native int[] getSelectedIndexes ();
+  public native void makeVisible (int index);
+
+  public Dimension minimumSize (int rows)
+  {
+    return (getMinimumSize (rows));
+  }
+
+  public Dimension preferredSize (int rows)
+  {
+    return (getPreferredSize (rows));
+  }
+
+  public void removeAll ()
+  {
+    delItems (0, -1);
+  }
+
+  public native void select (int index);
+  public native void setMultipleMode (boolean b);
+
+  public void setMultipleSelections (boolean b)
+  {
+    setMultipleMode (b);
+  }
+
+  protected void postItemEvent (int item, int stateChange)
+  {
+    postItemEvent (new Integer (item), stateChange);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMainThread.java b/libjava/gnu/java/awt/peer/gtk/GtkMainThread.java
new file mode 100644 (file)
index 0000000..6efa841
--- /dev/null
@@ -0,0 +1,80 @@
+/* GtkMainThread.java -- Runs gtk_main()
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+
+public class GtkMainThread extends GtkGenericPeer implements Runnable
+{
+  private static Thread mainThread = null;
+  private static Object mainThreadLock = new Object();
+
+  static native void gtkInit();
+  native void gtkMain();
+  
+  public GtkMainThread() 
+  {
+    super (null);
+    synchronized (mainThreadLock) 
+      {
+       if (mainThread != null)
+         throw new IllegalStateException();
+       mainThread = new Thread(this, "GtkMain");
+      }
+    
+    synchronized (this) 
+      {
+       mainThread.start();
+       try {
+         wait();
+       } catch (InterruptedException e) { }
+      }
+  }
+  
+  public void run() 
+  {
+    synchronized (this) 
+      {
+       gtkInit();
+       notify();
+      }
+    gtkMain();
+  }
+}
+
+
+
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
new file mode 100644 (file)
index 0000000..6ceb864
--- /dev/null
@@ -0,0 +1,69 @@
+/* GtkMenuBarPeer.java -- Implements MenuBarPeer with GTK+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.MenuBarPeer;
+import java.awt.peer.MenuPeer;
+
+public class GtkMenuBarPeer extends GtkMenuComponentPeer
+  implements MenuBarPeer
+{
+
+  native void create ();
+  native void addMenu (MenuPeer menu);
+
+  public GtkMenuBarPeer (MenuBar target)
+  {
+    super (target);
+    create ();
+  }
+
+  /* In Gnome, help menus are no longer right flushed. */
+  public void addHelpMenu (Menu menu)
+  {
+    addMenu (menu);
+  }
+
+  public void addMenu (Menu menu)
+  {
+    addMenu ((MenuPeer) menu.getPeer ());
+  }
+
+  native public void delMenu (int index);
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
new file mode 100644 (file)
index 0000000..e04ce99
--- /dev/null
@@ -0,0 +1,54 @@
+/* GtkMenuComponentPeer.java -- Implements MenuComponentPeer with GTK+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.MenuComponentPeer;
+
+public class GtkMenuComponentPeer extends GtkGenericPeer
+  implements MenuComponentPeer
+{
+  public GtkMenuComponentPeer (Object awtWidget)
+  {
+    super (awtWidget);
+  }
+
+  public void dispose ()
+  {
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
new file mode 100644 (file)
index 0000000..1428011
--- /dev/null
@@ -0,0 +1,92 @@
+/* GtkMenuItemPeer.java -- Implements MenuItemPeer with GTK+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuComponentPeer;
+import java.awt.peer.MenuBarPeer;
+import java.awt.peer.MenuPeer;
+
+public class GtkMenuItemPeer extends GtkMenuComponentPeer
+  implements MenuItemPeer
+{
+  native void create (String label);
+
+  public GtkMenuItemPeer (MenuItem item)
+  {
+    super (item);
+    create (item.getLabel ());
+    setEnabled (item.isEnabled ());
+    setParent (item);
+  }
+
+  void setParent (MenuItem item)
+  {
+    // add ourself differently, based on what type of parent we have
+    // yes, the typecasting here is nasty.
+    Object parent = item.getParent ();
+    if (parent instanceof MenuBar)
+      {
+       ((GtkMenuBarPeer)((MenuBar)parent).getPeer ()).addMenu ((MenuPeer) this);
+      }
+    else // parent instanceof Menu
+      {
+       ((GtkMenuPeer)((Menu)parent).getPeer ()).addItem (this, 
+                                                         item.getShortcut ());
+      }
+  }
+
+  public void disable ()
+  {
+    setEnabled (false);
+  }
+
+  public void enable ()
+  {
+    setEnabled (true);
+  }
+
+  native public void setEnabled (boolean b);
+  native public void setLabel (String label);
+
+  protected void postMenuActionEvent ()
+  {
+    postActionEvent (((MenuItem)awtWidget).getActionCommand (), 0);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkMenuPeer.java
new file mode 100644 (file)
index 0000000..51733a6
--- /dev/null
@@ -0,0 +1,99 @@
+/* GtkMenuPeer.java -- Implements MenuPeer with GTK+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.MenuPeer;
+import java.awt.peer.MenuItemPeer;
+
+public class GtkMenuPeer extends GtkMenuItemPeer
+  implements MenuPeer
+{
+  native void create (String label);
+  native void addItem (MenuItemPeer item, int key, boolean shiftModifier);
+  native void setupAccelGroup (GtkGenericPeer container);
+
+  public GtkMenuPeer (Menu menu)
+  {
+    super (menu);
+    
+    MenuContainer parent = menu.getParent ();
+    if (parent instanceof Menu)
+      setupAccelGroup ((GtkGenericPeer)((Menu)parent).getPeer ());
+    else if (parent instanceof Component)
+      setupAccelGroup ((GtkGenericPeer)((Component)parent).getPeer ());
+    else
+      setupAccelGroup (null);
+  }
+
+  public void addItem (MenuItem item)
+  {
+    int key = 0;
+    boolean shiftModifier = false;
+
+    MenuShortcut ms = item.getShortcut ();
+    if (ms != null)
+      {
+       key = ms.getKey ();
+       shiftModifier = ms.usesShiftModifier ();
+      }
+
+    addItem ((MenuItemPeer) item.getPeer (), key, shiftModifier);
+  }
+
+  public void addItem (MenuItemPeer item, MenuShortcut ms)
+  {
+    int key = 0;
+    boolean shiftModifier = false;
+
+    if (ms != null)
+      {
+       key = ms.getKey ();
+       shiftModifier = ms.usesShiftModifier ();
+      }
+
+    addItem (item, key, shiftModifier);
+  }
+
+  public void addSeparator ()
+  {
+    addItem (new MenuItem ("-"));
+  }
+
+  native public void delItem (int index);
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java b/libjava/gnu/java/awt/peer/gtk/GtkOffScreenImage.java
new file mode 100644 (file)
index 0000000..135fbf6
--- /dev/null
@@ -0,0 +1,87 @@
+/* GtkOffScreenImage.java
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class GtkOffScreenImage extends Image
+{
+  int width, height;
+  ImageProducer source;
+  Graphics g;
+  
+  public GtkOffScreenImage (ImageProducer source, Graphics g,
+                           int width, int height)
+  {
+    this.width = width;
+    this.height = height;
+
+    this.source = source;
+    this.g = g;
+  }
+
+  public int getWidth (ImageObserver observer)
+  {
+    return width;
+  }
+
+  public int getHeight (ImageObserver observer)
+  {
+    return height;
+  }
+
+  public ImageProducer getSource ()
+  {
+    return source;
+  }
+
+  public Graphics getGraphics ()
+  {
+    return g;
+  }
+
+  public Object getProperty (String name, ImageObserver observer)
+  {
+    return Image.UndefinedProperty;
+  }
+
+  public void flush ()
+  {
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkPanelPeer.java
new file mode 100644 (file)
index 0000000..168e075
--- /dev/null
@@ -0,0 +1,53 @@
+/* GtkPanelPeer.java -- Implements PanelPeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkPanelPeer extends GtkContainerPeer
+  implements PanelPeer
+{
+  native void create ();
+  native void connectHooks ();
+
+  public GtkPanelPeer (Panel p)
+  {
+    super (p);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java
new file mode 100644 (file)
index 0000000..c7a645a
--- /dev/null
@@ -0,0 +1,65 @@
+/* GtkPopupMenuPeer.java -- Implements PopupMenuPeer with GTK+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.ComponentPeer;
+import java.awt.peer.PopupMenuPeer;
+
+public class GtkPopupMenuPeer extends GtkMenuPeer
+  implements PopupMenuPeer
+{
+  public GtkPopupMenuPeer (PopupMenu menu)
+  {
+    super (menu);
+  }
+
+  native void setupAccelGroup (GtkGenericPeer container);
+
+  void setParent (MenuItem item)
+  {
+    // we don't need to "add" ourselves to our parent
+  }
+
+  native void show (int x, int y, long time);
+  public void show (Component origin, int x, int y)
+  {
+    Point abs = origin.getLocationOnScreen ();
+    show (abs.x + x, abs.y + y, 0);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollPanePeer.java
new file mode 100644 (file)
index 0000000..9abde2a
--- /dev/null
@@ -0,0 +1,91 @@
+/* GtkScrollPanePeer.java -- Implements ScrollPanePeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkScrollPanePeer extends GtkContainerPeer
+  implements ScrollPanePeer
+{
+  native void create ();
+
+  native void gtkScrolledWindowNew(ComponentPeer parent,
+                                  int policy, int w, int h, int[] dims);
+  native void gtkScrolledWindowSetScrollPosition(int x, int y);
+  native void gtkScrolledWindowSetHScrollIncrement (int u);
+  native void gtkScrolledWindowSetVScrollIncrement (int u);
+  native void gtkScrolledWindowSetSize(int w, int h);
+  
+  public GtkScrollPanePeer (ScrollPane sp)
+  {
+    super (sp);
+
+    setPolicy (sp.getScrollbarDisplayPolicy ());
+  }
+
+  native void setPolicy (int policy);
+  native public void childResized (int width, int height);
+  native public int getHScrollbarHeight ();
+  native public int getVScrollbarWidth ();
+  native public void setScrollPosition (int x, int y);
+
+//    public Dimension getPreferredSize ()
+//    {
+//      return new Dimension (60, 60);
+//    }
+
+  public void setUnitIncrement (Adjustable adj, int u)
+  {
+    if (adj.getOrientation()==Adjustable.HORIZONTAL)
+      gtkScrolledWindowSetHScrollIncrement (u);
+    else
+      gtkScrolledWindowSetVScrollIncrement (u);
+  }
+
+  public void setValue (Adjustable adj, int v)
+  {
+//      System.out.println("SPP: setVal: "+adj+":"+v);
+//      Point p=myScrollPane.getScrollPosition ();
+//      if (adj.getOrientation()==Adjustable.HORIZONTAL)
+//        gtkScrolledWindowSetScrollPosition (v,p.y);
+//      else
+//        gtkScrolledWindowSetScrollPosition (p.x,v);
+//      adj.setValue(v);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkScrollbarPeer.java
new file mode 100644 (file)
index 0000000..07aee67
--- /dev/null
@@ -0,0 +1,78 @@
+/* GtkScrollbarPeer.java -- Implements ScrollbarPeer with GTK+
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.*;
+import java.awt.peer.*;
+import java.awt.event.AdjustmentEvent;
+
+public class GtkScrollbarPeer extends GtkComponentPeer
+    implements ScrollbarPeer
+{
+  void create ()
+  {
+    Scrollbar sb = (Scrollbar) awtComponent;
+
+    create (sb.getOrientation (), sb.getValue (),
+           sb.getMinimum (), sb.getMaximum (), 
+           sb.getUnitIncrement (), sb.getBlockIncrement (),
+           sb.getVisibleAmount ());
+  }
+
+  native void create (int orientation, int value,
+                     int min, int max, int stepIncr, int pageIncr,
+                     int visibleAmount);
+
+  native void connectHooks ();
+
+  public GtkScrollbarPeer (Scrollbar s)
+  {
+    super (s);
+  }
+
+  native public void setLineIncrement (int amount);
+  native public void setPageIncrement (int amount);
+  native public void setValues (int value, int visible, int min, int max);
+
+  protected void postAdjustmentEvent (int type, int value)
+  {
+    q.postEvent (new AdjustmentEvent ((Adjustable)awtComponent, 
+                                     AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
+                                     type, value));
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
new file mode 100644 (file)
index 0000000..7a648b9
--- /dev/null
@@ -0,0 +1,102 @@
+/* GtkTextAreaPeer.java -- Implements TextAreaPeer with GTK
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkTextAreaPeer extends GtkTextComponentPeer
+  implements TextAreaPeer
+{
+  native void create (int scrollbarVisibility);
+
+  void create ()
+  {
+    create (((TextArea)awtComponent).getScrollbarVisibility ());
+  }
+
+  // native void create (Object parent, String text, int scroll);
+  native void gtkTextGetSize (int rows, int cols, int dims[]);
+
+  public GtkTextAreaPeer (TextArea ta)
+  {
+    super (ta);
+  }
+
+  public native void insert (String str, int pos);
+  public native void replaceRange (String str, int start, int end);
+
+  public Dimension getMinimumSize (int rows, int cols)
+  {
+    int dims[] = new int[2];
+
+    gtkTextGetSize (rows, cols, dims);
+
+    return (new Dimension (dims[0], dims[1]));
+  }
+
+  public Dimension getPreferredSize (int rows, int cols)
+  {
+    int dims[] = new int[2];
+
+    gtkTextGetSize (rows, cols, dims);
+
+    return (new Dimension (dims[0], dims[1]));
+  }
+
+  /* Deprecated */
+  public Dimension minimumSize (int rows, int cols)
+  {
+    return getMinimumSize (rows, cols);
+  }
+
+  public Dimension preferredSize (int rows, int cols)
+  {
+    return getPreferredSize (rows, cols);
+  }
+
+  public void replaceText (String str, int start, int end)
+  {
+    replaceRange (str, start, end);
+  }
+
+  public void insertText (String str, int pos)
+  {
+    insert (str, pos);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
new file mode 100644 (file)
index 0000000..b9205cc
--- /dev/null
@@ -0,0 +1,79 @@
+/* GtkTextComponentPeer.java -- Implements TextComponentPeer with GTK
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkTextComponentPeer extends GtkComponentPeer
+  implements TextComponentPeer
+{
+  GtkTextComponentPeer (TextComponent tc)
+  {
+    super (tc);
+
+    setText (tc.getText ());
+  }
+  
+  public native int getCaretPosition ();
+  public void setCaretPosition (int pos)
+  {
+    set ("text_position", pos);
+  }
+  public native int getSelectionStart ();
+  public native int getSelectionEnd ();
+  public native String getText ();
+  public native void select (int start, int end);
+
+  public void setEditable (boolean state)
+  {
+    set ("editable", state);
+  }
+
+  public native void setText (String text);
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    super.getArgs (component, args);
+
+    TextComponent tc = (TextComponent) component;
+
+    args.add ("text_position", tc.getCaretPosition ());
+    args.add ("editable", tc.isEditable ());
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
new file mode 100644 (file)
index 0000000..4dc23f8
--- /dev/null
@@ -0,0 +1,98 @@
+/* GtkTextFieldPeer.java -- Implements TextFieldPeer with GTK
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkTextFieldPeer extends GtkTextComponentPeer
+  implements TextFieldPeer
+{
+
+//    native void create (ComponentPeer parent, String text);
+
+  native void create ();
+  native void createHooks ();
+
+  native void gtkEntryGetSize (int cols, int dims[]);
+
+  public GtkTextFieldPeer (TextField tf)
+  {
+    super (tf);
+
+    if (tf.echoCharIsSet ())
+      setEchoChar (tf.getEchoChar ());
+  }
+
+  public Dimension getMinimumSize (int cols)
+  {
+    int dims[] = new int[2];
+
+    gtkEntryGetSize (cols, dims);
+
+    return (new Dimension (dims[0], dims[1]));
+  }
+
+  public Dimension getPreferredSize (int cols)
+  {
+    int dims[] = new int[2];
+
+    gtkEntryGetSize (cols, dims);
+
+    return (new Dimension (dims[0], dims[1]));
+  }
+  
+  public native void setEchoChar (char c);
+
+  /* Deprecated */
+
+  public Dimension minimumSize (int cols)
+  {
+    return getMinimumSize (cols);
+  }
+
+  public Dimension preferredSize (int cols)
+  {
+    return getPreferredSize (cols);
+  }
+
+  public void setEchoCharacter (char c)
+  {
+    setEchoChar (c);
+  }
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/gnu/java/awt/peer/gtk/GtkToolkit.java
new file mode 100644 (file)
index 0000000..ffdc910
--- /dev/null
@@ -0,0 +1,329 @@
+/* GtkToolkit.java -- Implements an AWT Toolkit using GTK for peers
+   Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.peer.DragSourceContextPeer;
+import java.awt.im.InputMethodHighlight;
+import java.awt.image.*;
+import java.awt.peer.*;
+import java.net.*;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Properties;
+import gnu.java.awt.image.*;
+import gnu.classpath.Configuration;
+
+/* This class uses a deprecated method java.awt.peer.ComponentPeer.getPeer().
+   This merits comment.  We are basically calling Sun's bluff on this one.
+   We think Sun has deprecated it simply to discourage its use as it is 
+   bad programming style.  However, we need to get at a component's peer in
+   this class.  If getPeer() ever goes away, we can implement a hash table
+   that will keep up with every window's peer, but for now this is faster. */
+
+public class GtkToolkit extends java.awt.Toolkit
+{
+  GtkMainThread main;
+  Hashtable containers = new Hashtable();
+  static EventQueue q = new EventQueue();
+  static Clipboard systemClipboard;
+
+  static 
+  {
+    if (Configuration.INIT_LOAD_LIBRARY)
+      System.loadLibrary("gtkpeer");
+  }
+
+  public GtkToolkit ()
+  {
+    main = new GtkMainThread ();
+    systemClipboard = new GtkClipboard ();
+    GtkGenericPeer.enableQueue (q);
+  }
+  
+  native public void beep ();
+  native private void getScreenSizeDimensions (int[] xy);
+  
+  public int checkImage (Image image, int width, int height, 
+                        ImageObserver observer) 
+  {
+    return ImageObserver.ALLBITS;
+
+//      GtkImage i = (GtkImage) image;
+//      return i.checkImage ();
+  }
+
+  public Image createImage (String filename)
+  {
+    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
+    // return new GtkImage (new GdkPixbufDecoder (filename), null);
+    return null;
+  }
+
+  public Image createImage (URL url)
+  {
+    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
+    // return new GtkImage (new GdkPixbufDecoder (url), null);
+    return null;
+  }
+
+  public Image createImage (ImageProducer producer) 
+  {
+    return new GtkImage (producer, null);
+  }
+
+  public Image createImage (byte[] imagedata, int imageoffset,
+                           int imagelength) 
+  {
+    // System.out.println ("createImage byte[] NOT SUPPORTED");
+    return null;
+  }
+
+  public ColorModel getColorModel () 
+  {
+    return ColorModel.getRGBdefault ();
+  }
+
+  public String[] getFontList () 
+  {
+    return (new String[] { "Dialog", 
+                          "DialogInput", 
+                          "Monospaced", 
+                          "Serif", 
+                          "SansSerif" });
+  }
+
+  public FontMetrics getFontMetrics (Font font) 
+  {
+    return new GdkFontMetrics (font);
+  }
+
+  public Image getImage (String filename) 
+  {
+    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
+    // return new GtkImage (new GdkPixbufDecoder (filename), null);
+    return null;
+  }
+
+  public Image getImage (URL url) 
+  {
+    // FIXME - gcj local: GdkPixbufDecoder doesn't work.
+    // return new GtkImage (new GdkPixbufDecoder (url), null);
+    return null;
+  }
+
+  public PrintJob getPrintJob (Frame frame, String jobtitle, Properties props) 
+  {
+    return null;
+  }
+
+  native public int getScreenResolution();
+
+  public Dimension getScreenSize () {
+    int dim[] = new int[2];
+    getScreenSizeDimensions(dim);
+    return new Dimension(dim[0], dim[1]);
+  }
+
+  public Clipboard getSystemClipboard() 
+  {
+    return systemClipboard;
+  }
+
+  public boolean prepareImage (Image image, int width, int height, 
+                              ImageObserver observer) 
+  {
+    return false;
+  }
+
+  native public void sync ();
+
+  protected void setComponentState (Component c, GtkComponentPeer cp)
+  {
+    /* Make the Component reflect Peer defaults */
+    if (c.getForeground () == null)
+      c.setForeground (cp.getForeground ());
+    if (c.getBackground () == null)
+      c.setBackground (cp.getBackground ());
+    //        if (c.getFont () == null)
+    //         c.setFont (cp.getFont ());
+      
+    /* Make the Peer reflect the state of the Component */
+    if (! (c instanceof Window))
+      {
+       cp.setCursor (c.getCursor ());
+       
+       Rectangle bounds = c.getBounds ();
+       cp.setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
+       cp.setVisible (c.isVisible ());
+      }
+  }
+
+  protected ButtonPeer createButton (Button b)
+  {
+    return new GtkButtonPeer (b);
+  }
+
+  protected CanvasPeer createCanvas (Canvas c) 
+  {
+    return new GtkCanvasPeer (c);
+  }
+
+  protected CheckboxPeer createCheckbox (Checkbox cb) 
+  {
+    return new GtkCheckboxPeer (cb);
+  }
+
+  protected CheckboxMenuItemPeer createCheckboxMenuItem (CheckboxMenuItem cmi)
+  {
+    return new GtkCheckboxMenuItemPeer (cmi);
+  }
+
+  protected ChoicePeer createChoice (Choice c) 
+  {
+    return new GtkChoicePeer (c);
+  }
+
+  protected DialogPeer createDialog (Dialog d)
+  {
+    return new GtkDialogPeer (d);
+  }
+
+  protected FileDialogPeer createFileDialog (FileDialog fd)
+  {
+    return new GtkFileDialogPeer (fd);
+  }
+
+  protected FramePeer createFrame (Frame f)
+  {
+    return new GtkFramePeer (f);
+  }
+
+  protected LabelPeer createLabel (Label label) 
+  {
+    return new GtkLabelPeer (label);
+  }
+
+  protected ListPeer createList (List list)
+  {
+    return new GtkListPeer (list);
+  }
+
+  protected MenuPeer createMenu (Menu m) 
+  {
+    return new GtkMenuPeer (m);
+  }
+
+  protected MenuBarPeer createMenuBar (MenuBar mb) 
+  {
+    return new GtkMenuBarPeer (mb);
+  }
+
+  protected MenuItemPeer createMenuItem (MenuItem mi) 
+  {
+    return new GtkMenuItemPeer (mi);
+  }
+
+  protected PanelPeer createPanel (Panel p) 
+  {
+    return new GtkPanelPeer (p);
+  }
+
+  protected PopupMenuPeer createPopupMenu (PopupMenu target) 
+  {
+    return new GtkPopupMenuPeer (target);
+  }
+
+  protected ScrollPanePeer createScrollPane (ScrollPane sp) 
+  {
+    return new GtkScrollPanePeer (sp);
+  }
+
+  protected ScrollbarPeer createScrollbar (Scrollbar sb) 
+  {
+    return new GtkScrollbarPeer (sb);
+  }
+
+  protected TextAreaPeer createTextArea (TextArea ta) 
+  {
+    return new GtkTextAreaPeer (ta);
+  }
+
+  protected TextFieldPeer createTextField (TextField tf) 
+  {
+    return new GtkTextFieldPeer (tf);
+  }
+
+  protected WindowPeer createWindow (Window w)
+  {
+    return new GtkWindowPeer (w);
+  }
+
+  protected FontPeer getFontPeer (String name, int style) 
+  {
+    try {
+      GtkFontPeer fp = new GtkFontPeer (name, style);
+      return fp;
+    } catch (MissingResourceException ex) {
+      return null;
+    }
+  }
+
+  protected EventQueue getSystemEventQueueImpl() 
+  {
+    return q;
+  }
+
+  protected void loadSystemColors (int[] systemColors) 
+  {
+  }
+
+  public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent e)
+  {
+    throw new Error("not implemented");
+  }
+
+  public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+  {
+    throw new Error("not implemented");
+  }
+} // class GtkToolkit
diff --git a/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/gnu/java/awt/peer/gtk/GtkWindowPeer.java
new file mode 100644 (file)
index 0000000..7ef667e
--- /dev/null
@@ -0,0 +1,111 @@
+/* GtkWindowPeer.java -- Implements WindowPeer with GTK
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.awt.peer.gtk;
+import java.awt.peer.*;
+import java.awt.*;
+
+public class GtkWindowPeer extends GtkContainerPeer
+  implements WindowPeer
+{
+  static protected final int GTK_WINDOW_TOPLEVEL = 0;
+  static protected final int GTK_WINDOW_DIALOG = 1;
+  static protected final int GTK_WINDOW_POPUP = 2;
+
+  native void create (int type);
+
+  void create ()
+  {
+    create (GTK_WINDOW_POPUP);
+  }
+
+  native void connectHooks ();
+
+  public GtkWindowPeer (Window window)
+  {
+    super (window);
+
+    Dimension d = window.getSize ();
+    setBounds (0, 0, d.width, d.height);
+  }
+
+  public void getArgs (Component component, GtkArgList args)
+  {
+    args.add ("visible", component.isVisible ());
+    args.add ("sensitive", component.isEnabled ());
+  }
+  
+  native public void toBack ();
+  native public void toFront ();
+
+  native public void setBounds (int x, int y, int width, int height);
+
+  public void setTitle (String title)
+  {
+    set ("title", title);
+  }
+
+  native public void setResizable (boolean r);
+
+  protected void postConfigureEvent (int x, int y, int width, int height,
+                                    int top, int left, int bottom, int right)
+  {
+    /* 
+       If our borders change (which often happens when we opaque resize),
+       we need to make sure that a new layout will happen, since Sun
+       forgets to handle this case.
+    */
+    if (insets.top != top
+       || insets.left != left
+       || insets.bottom != bottom
+       || insets.right != right)
+      {
+       awtComponent.invalidate ();
+      }
+    
+    insets.top = top;
+    insets.left = left;
+    insets.bottom = bottom;
+    insets.right = right;
+
+    awtComponent.setBounds (x, y, width, height);
+    awtComponent.validate ();
+  }
+  
+  native public void setVisible (boolean b);
+}
diff --git a/libjava/gnu/java/awt/peer/gtk/Test.java b/libjava/gnu/java/awt/peer/gtk/Test.java
new file mode 100644 (file)
index 0000000..7ecb593
--- /dev/null
@@ -0,0 +1,299 @@
+/* Test.java -- Tests the GTK Toolkit
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.peer.*;
+import java.awt.datatransfer.*;
+import gnu.java.awt.image.*;
+import java.io.*;
+
+class Test
+{
+  static int xs = 5, ys = 5;
+
+  public static void main(String args[])
+    {
+      if (args.length == 0)
+       { 
+         Properties prop=System.getProperties ();
+         prop.put ("awt.toolkit","gnu.java.awt.peer.gtk.GtkToolkit");
+       }
+
+      final Frame f=new Frame();
+      f.setTitle ("Red Hat Classpath");
+      
+//        f.addComponentListener (new ComponentAdapter() {
+//     public void componentMoved (ComponentEvent e) {
+//       System.out.println("component moved");
+//     }
+//     public void componentResized (ComponentEvent e) {
+//       System.out.println("component resized");
+//     }
+//        });
+      f.setSize(200,200);
+
+      Panel pan=new Panel();
+
+      final Label l = new Label ("Pithy Message:");
+      l.setCursor (Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR));
+      pan.add (l);
+
+      TextField tf = new TextField("Hello world!");
+      pan.add(tf);
+
+      final Image img;
+      img = Toolkit.getDefaultToolkit ().createImage (new XBMDecoder ("fvwm.xbm"));
+
+
+      final Canvas ch = new Canvas () { 
+
+         public void update (Graphics g)
+         {
+           System.out.println ("update called");
+           super.update (g);
+         }
+       public void paint (Graphics g) {
+         g.drawString("Hello world!", xs+5, ys+10);
+         g.setColor (Color.blue);
+         g.drawLine (xs,ys,xs+20,ys+20);
+
+//       System.out.println (TextArea.SCROLLBARS_BOTH);
+//       System.out.println (TextArea.SCROLLBARS_HORIZONTAL_ONLY);
+//       System.out.println (TextArea.SCROLLBARS_VERTICAL_ONLY);
+
+//       Font f1 = new Font ("TimesRoman", Font.PLAIN, 10);
+//       System.out.println (f1.getName ());
+//       System.out.println (f1.getFamily ());
+
+//       Font font = new Font ("Serif", Font.PLAIN, 18); 
+//       g.setFont (font);
+//       g.setXORMode (Color.red);
+
+
+//       System.out.println (g.getFontMetrics (font).stringWidth ("foobar"));
+
+//        System.out.println (g.drawImage (img, 0, 0, this));
+       }
+      };
+
+      ch.setSize(60, 60);
+//        List ch=new List();
+//        ch.add("Ding");
+//        ch.add("September");
+//        ch.add("Red");
+//        ch.add("Quassia");
+//        ch.add("Pterodactyl");
+
+//        ch.addMouseListener(new MouseAdapter() {
+//     public void mousePressed(MouseEvent e) {
+//       System.out.println("mouse pressed ch");
+//       System.out.println("shift = " + e.isShiftDown());
+//       System.out.println("meta = " + e.isMetaDown());
+//       System.out.println("alt = " + e.isAltDown());
+//       System.out.println("ctrl = " + e.isControlDown());
+//       System.out.println("x = " + e.getX());
+//       System.out.println("y = " + e.getY());
+//       System.out.println("clickcount = " + e.getClickCount());
+//       System.out.println("when = " + e.getWhen());
+//       System.out.println();
+//     }
+//     public void mouseReleased(MouseEvent e) {
+//       System.out.println("mouse released ch");
+//     }
+//     public void mouseClicked(MouseEvent e) {
+//       System.out.println("mouse clicked ch");
+//     }
+//        });
+
+      pan.add(ch);
+      f.add(pan,"North");
+
+      final ScrollPane sp=new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
+      System.out.println ("ALWAYS HERE: " + ScrollPane.SCROLLBARS_ALWAYS);
+      System.out.println ("ALWAYS" + ScrollPane.SCROLLBARS_ALWAYS);
+      System.out.println ("NEEDED" + ScrollPane.SCROLLBARS_AS_NEEDED);
+      System.out.println ("NEVER " + ScrollPane.SCROLLBARS_NEVER);
+
+
+      final Panel p=new Panel();
+      System.out.println ("PREFERED: " + p.getPreferredSize ());
+      p.add(new Button("Stop"));
+      System.out.println ("PREFERED: " + p.getPreferredSize ());
+      p.add(new Button("evil"));
+      System.out.println ("PREFERED: " + p.getPreferredSize ());
+      p.add(new Button("hoarders"));
+      p.add(new Button("use"));
+      p.add(new Button("GNU"));
+      p.add(new Scrollbar(Scrollbar.HORIZONTAL));
+      System.out.println ("PREFERED: " + p.getPreferredSize ());
+
+      sp.add(p);
+      f.add(sp,"South");
+
+      Panel east_panel = new Panel();
+      east_panel.setLayout(new GridLayout (0,1));
+
+//        CheckboxGroup group = new CheckboxGroup();
+
+//        Checkbox cb=new Checkbox("one", group, true);
+//        east_panel.add(cb);
+//        cb=new Checkbox("two", group, false);
+//        east_panel.add(cb);
+
+//        cb.addMouseListener(new MouseAdapter() {
+//       public void mousePressed(MouseEvent e) {
+//       System.out.println("mouse pressed cb");
+//       System.out.println("shift = " + e.isShiftDown());
+//       System.out.println("meta = " + e.isMetaDown());
+//       System.out.println("alt = " + e.isAltDown());
+//       System.out.println("ctrl = " + e.isControlDown());
+//       System.out.println("x = " + e.getX());
+//       System.out.println("y = " + e.getY());
+//       System.out.println("clickcount = " + e.getClickCount());
+//       System.out.println("when = " + e.getWhen());
+//       System.out.println();
+//     }
+//     public void mouseReleased(MouseEvent e) {
+//       System.out.println("mouse released cb");
+//     }
+//     public void mouseClicked(MouseEvent e) {
+//       System.out.println("mouse clicked cb");
+//     }
+//     public void mouseEntered(MouseEvent e) {
+//       System.out.println("mouse entered cb");
+//     }
+//     public void mouseExited(MouseEvent e) {
+//       System.out.println("mouse exited cb");
+//     }
+//        });
+
+      f.add(east_panel,"East");
+
+      final Button wb=new Button();
+      wb.setLabel("Destroy Frame on Click");
+      wb.addActionListener (new ActionListener () {
+       public void actionPerformed (ActionEvent e) {
+         ScrollPanePeer peer = (ScrollPanePeer)sp.getPeer ();
+         if (peer != null)
+           {
+             System.out.println (peer.getHScrollbarHeight ());
+             System.out.println (peer.getVScrollbarWidth ());
+           }
+
+         l.setText ("Hello World!");
+         System.out.println ("PREFERED: " + p.getPreferredSize ());
+
+         final Dialog d = new Dialog (f);
+         d.setModal (true);
+         Button b = new Button ("foobar");
+         b.addMouseListener (new MouseAdapter () {
+             public void mousePressed (MouseEvent me) {
+               System.out.println ("I got called");
+               d.hide ();
+
+//             System.out.println (ScrollPane.SCROLLBARS_ALWAYS);
+//             System.out.println (ScrollPane.SCROLLBARS_AS_NEEDED);
+//             System.out.println (ScrollPane.SCROLLBARS_NEVER);
+             }
+           });
+         d.add (b);
+         d.pack ();
+         d.show ();
+         System.out.println ("hello world");
+//       System.out.println ("action listener on wb called");
+//       Clipboard clip = Toolkit.getDefaultToolkit ().getSystemClipboard ();
+//       StringSelection ss = new StringSelection("123456789");
+//       clip.setContents (ss, ss);
+//       Transferable t = clip.getContents (this);
+//       try {
+//         System.out.println (t.getTransferData (DataFlavor.stringFlavor));
+//       } catch (Exception ex) {
+//         ex.printStackTrace ();
+//       }
+//       System.exit (0);
+       }
+      });
+
+      wb.addMouseListener(new MouseAdapter() {
+       public void mousePressed(MouseEvent e) {
+         System.out.println("mouse pressed wb");
+         xs++;
+         ys++;
+         ch.repaint ();
+       }
+       public void mouseReleased(MouseEvent e) {
+         System.out.println("mouse released wb");
+       }
+       public void mouseClicked(MouseEvent e) {
+         System.out.println("mouse clicked wb");
+       }
+       public void mouseEntered(MouseEvent e) {
+         System.out.println("mouse entered wb");
+       }
+       public void mouseExited(MouseEvent e) {
+         System.out.println("mouse exited wb");
+       }
+      });
+
+      f.add(wb,"West");
+      
+      f.pack();
+      f.show();
+
+      sp.setScrollPosition (10,0);
+
+      Toolkit t = Toolkit.getDefaultToolkit();
+      /* t.beep(); */
+      System.out.println("screen size: " + t.getScreenSize());
+      System.out.println("resolution : " + t.getScreenResolution());
+//        try {
+//     Thread.sleep (5000);
+//        } catch (InterruptedException e) {}
+//        f.setSize(500,500);
+
+      System.out.println ("background of canvas: " + ch.getBackground ());
+      System.out.println ("foreground of canvas: " + ch.getForeground ());
+
+      System.out.println("done");
+    }
+}
+
+
+
diff --git a/libjava/gnu/java/awt/peer/gtk/TestAWT.java b/libjava/gnu/java/awt/peer/gtk/TestAWT.java
new file mode 100644 (file)
index 0000000..48cdce1
--- /dev/null
@@ -0,0 +1,571 @@
+/* TestAWT.java -- Tests the AWT like testgtk
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+import java.awt.List;
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.peer.*;
+
+class TestAWT
+{
+  public static void main(String args[])
+  {
+    if (args.length==0)
+      {
+       Properties prop = System.getProperties ();
+       prop.put ("awt.toolkit", "gnu.java.awt.peer.gtk.GtkToolkit");
+      }
+    MainWindow f = new MainWindow();
+    System.out.println(f.isDisplayable());
+    f.show();
+    System.out.println(f.isDisplayable());
+  }
+}
+
+interface SubWindow
+{
+  public void init ();
+}
+
+class PrettyPanel extends Panel
+{
+  Insets myInsets;
+
+  public PrettyPanel ()
+  {
+    myInsets = new Insets (10, 10, 10, 10);
+  }
+  public Insets getInsets ()
+  {
+    return myInsets;
+  }
+}
+
+abstract class PrettyFrame extends Frame
+{
+  public PrettyFrame ()
+  {
+    ((BorderLayout) getLayout ()).setHgap (5);
+    ((BorderLayout) getLayout ()).setVgap (5);
+  }
+
+//    public Insets getInsets()
+//    {
+//      Insets oldInsets = super.getInsets ();
+//      return new Insets (oldInsets.top+10,
+//                    oldInsets.left+10,
+//                    oldInsets.bottom+10,
+//                    oldInsets.right+10);
+//    }
+}
+
+abstract class SubFrame extends PrettyFrame implements SubWindow
+{
+  boolean initted = false;
+
+  public void setVisible (boolean visible)
+  {
+    if (!initted && visible)
+      init();
+    super.setVisible (visible);
+  } 
+}
+
+class MainWindow extends PrettyFrame implements ActionListener 
+{
+  Button closeButton;
+
+  Hashtable windows;
+  Vector buttons;
+
+  void addSubWindow (String name, SubWindow w)
+  {
+    Button b = new Button (name);
+    b.addActionListener (this);
+
+    buttons.addElement (b);
+    windows.put (b, w);    
+  }
+
+  MainWindow () 
+  {
+    MenuBar mb = new MenuBar ();
+    Menu menu = new Menu ("File");
+    Menu submenu = new Menu ("Testing");
+    submenu.add (new CheckboxMenuItem ("Foobar"));
+    menu.add (submenu);
+    mb.add (menu);
+
+    setMenuBar (mb);
+
+    add (new Label ("Classpath v0.0.0"), "North");
+      
+    closeButton = new Button ("Close");
+    closeButton.addActionListener (this);
+    closeButton.setFont (new Font ("Serif", Font.BOLD | Font.ITALIC, 18));
+    add (closeButton, "South");
+
+    windows = new Hashtable ();
+    buttons = new Vector ();
+
+    addSubWindow ("Buttons", new ButtonsWindow ());
+    addSubWindow ("Cursors", new CursorsWindow ());
+    addSubWindow ("Dialog", new DialogWindow (this));
+    addSubWindow ("File", new FileWindow (this));
+    addSubWindow ("Labels", new LabelWindow ());
+    addSubWindow ("List", new ListWindow ());
+    addSubWindow ("Radio Buttons", new RadioWindow ());
+    addSubWindow ("TextField", new TextFieldWindow ());
+
+    Panel sp = new Panel();
+    PrettyPanel p = new PrettyPanel();
+    p.setLayout (new GridLayout (windows.size(), 1));
+
+    for (Enumeration e = buttons.elements (); e.hasMoreElements (); )
+      {
+       p.add ((Button) e.nextElement ());
+      }
+
+    sp.add (p);
+    add (sp, "Center");
+
+    setSize (200, 86 + (windows.size ()*22));
+    setTitle ("TestAWT");
+  }
+
+  public void actionPerformed (ActionEvent evt)
+  {
+    Button source = (Button) evt.getSource ();
+      
+    if (source==closeButton)
+      {
+       System.getProperties ().list (System.out);
+       dispose();
+       System.exit (0);
+      }
+
+    Window w = (Window) windows.get (source);
+    if (w.isVisible ())
+      w.dispose ();
+    else 
+      {
+       w.setVisible (true);
+       w.show();
+      }
+  }
+}
+
+class ButtonsWindow extends SubFrame implements ActionListener
+{
+  Button b[] = new Button [9];
+
+  public void init ()
+  {
+    initted = true;
+    Panel p = new Panel ();
+    p.setLayout (new GridLayout (0, 3, 5, 5));
+      
+    for (int i=0; i<9; i++) 
+      {
+       b[i]=new Button ("button" + (i+1));
+       b[i].addActionListener (this);
+      }
+
+    p.add (b[0]);
+    p.add (b[6]);
+    p.add (b[4]);
+    p.add (b[8]);
+    p.add (b[1]);
+    p.add (b[7]);
+    p.add (b[3]);
+    p.add (b[5]);
+    p.add (b[2]);
+
+    add (p, "North");
+
+    Button cb = new Button ("close");
+    cb.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) {
+       dispose();
+      }
+    });
+    add (cb, "South");
+    setTitle ("Buttons");
+  }
+
+  public void actionPerformed (ActionEvent evt)
+  {
+    Button source = (Button) evt.getSource ();
+      
+    for (int i=0; i<9; i++)
+      {
+       if (source == b[i])
+         {
+           int i2=((i+1)==9)?0:(i+1);
+           if (b[i2].isVisible())
+             b[i2].setVisible(false);
+           else 
+             b[i2].setVisible(true);
+         }
+      }
+  }
+}
+
+
+class DialogWindow extends Dialog implements SubWindow
+{
+  Label text;
+  boolean initted = false;
+
+  public DialogWindow (Frame f)
+  {
+    super (f, true);
+  }
+
+  public void setVisible (boolean visible)
+  {
+    if (!initted && visible)
+      init();
+    super.setVisible (visible);
+  }
+
+  public void init ()
+  {
+    text = new Label ("Dialog Test");
+    text.setAlignment (Label.CENTER);
+
+    add (text, "North");
+    text.setVisible (false);
+
+    Panel p = new PrettyPanel();
+
+    Button cb = new Button ("OK");
+    cb.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) 
+       {
+         dispose();
+       }
+    });
+    
+    p.setLayout (new GridLayout (1, 2));
+    ((GridLayout) p.getLayout ()).setHgap (5);
+    ((GridLayout) p.getLayout ()).setVgap (5);
+    p.add (cb);
+
+    Button toggle = new Button ("Toggle");
+    p.add (toggle);
+
+    toggle.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) 
+       {
+         if (text.isVisible ())
+           text.setVisible (false);
+         else 
+           text.setVisible (true);
+         doLayout();
+       }
+    });
+    
+    add (p, "South");
+    setTitle ("Dialog");
+    setSize (130, 70);
+  }
+}
+
+class CursorsWindow extends SubFrame implements ItemListener
+{
+  Choice cursorChoice;
+  Canvas cursorCanvas;
+
+  public void init ()
+  {
+    cursorChoice = new Choice();
+    cursorChoice.add ("Default");
+    cursorChoice.add ("Crosshair");
+    cursorChoice.add ("Text");
+    cursorChoice.add ("Wait");
+    cursorChoice.add ("Southwest Resize");
+    cursorChoice.add ("Southeast Resize");
+    cursorChoice.add ("Northwest Resize");
+    cursorChoice.add ("Northeast Resize");
+    cursorChoice.add ("North Resize");
+    cursorChoice.add ("South Resize");
+    cursorChoice.add ("West Resize");
+    cursorChoice.add ("East Resize");
+    cursorChoice.add ("Hand");
+    cursorChoice.add ("Move");
+
+    cursorChoice.addItemListener(this);
+
+    add (cursorChoice, "North");
+
+    cursorCanvas = new Canvas () 
+    { 
+      public void paint (Graphics g) 
+      {
+       Dimension d = this.getSize();
+       g.setColor (Color.white);
+       g.fillRect (0, 0, d.width, d.height/2);
+       g.setColor (Color.black);
+       g.fillRect (0, d.height/2, d.width, d.height/2);
+       g.setColor (this.getBackground());
+       g.fillRect (d.width/3, d.height/3, d.width/3,
+                   d.height/3);
+      }
+    };
+
+    cursorCanvas.setSize (80,80);
+
+    add (cursorCanvas, "Center");
+
+    Button cb = new Button ("Close");
+    cb.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) {
+       dispose();
+      }
+    });
+
+    add (cb, "South");
+    setTitle ("Cursors");
+    setSize (160, 180);
+  }
+
+  public void itemStateChanged (ItemEvent e)
+  {
+    cursorCanvas.setCursor (Cursor.getPredefinedCursor (cursorChoice.getSelectedIndex()));
+  }
+}
+
+class TextFieldWindow extends SubFrame implements ItemListener
+{
+  Checkbox editable, visible, sensitive;
+  TextField text;
+
+  public void init ()
+  {
+    initted = true;
+    text = new TextField ("hello world");
+    add (text, "North");
+
+    Panel p = new Panel();
+    p.setLayout (new GridLayout (3, 1));
+    ((GridLayout) p.getLayout ()).setHgap (5);
+    ((GridLayout) p.getLayout ()).setVgap (5);
+
+    editable = new Checkbox("Editable", true);
+    p.add (editable);
+    editable.addItemListener (this);
+
+    visible = new Checkbox("Visible", true);
+    p.add (visible);
+    visible.addItemListener (this);
+
+    sensitive = new Checkbox("Sensitive", true);
+    p.add (sensitive);
+    sensitive.addItemListener (this);
+
+    add (p, "Center");
+
+    Button cb = new Button ("Close");
+    cb.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) {
+       dispose();
+      }
+    });
+
+    add (cb, "South");
+    setTitle ("TextField");
+    setSize (160, 180);
+  }
+
+  public void itemStateChanged (ItemEvent e)
+  {
+    boolean on=true;
+
+    if (e.getStateChange () == ItemEvent.DESELECTED)
+      on=false;
+    if (e.getSource() == editable)
+      text.setEditable (on);
+    if (e.getSource() == visible)
+      if (on)
+       text.setEchoChar ((char) 0);
+      else
+       text.setEchoChar ('*');
+    if (e.getSource() == sensitive)
+      text.setEnabled (on);
+         
+  }
+}
+
+class FileWindow extends FileDialog implements SubWindow
+{
+  boolean initted = false;
+
+  public FileWindow (MainWindow mw)
+  {
+    super (mw);
+  }
+  
+  public void setVisible (boolean visible)
+  {
+    if (!initted && visible)
+      init();
+    super.setVisible (visible);
+  }
+
+  public void init() 
+  {
+    initted = true;
+  }
+}
+
+class LabelWindow extends SubFrame
+{
+  public void init ()
+  {
+    initted = true;
+    
+    Panel p = new Panel();
+    p.setLayout (new GridLayout (3, 1));
+    ((GridLayout) p.getLayout ()).setHgap (5);
+    ((GridLayout) p.getLayout ()).setVgap (5);
+
+    p.add (new Label ("left justified label", Label.LEFT));
+    p.add (new Label ("center justified label", Label.CENTER));
+    p.add (new Label ("right justified label", Label.RIGHT));
+
+    add (p, "Center");
+
+    Button cb = new Button ("Close");
+    cb.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) {
+       dispose();
+      }
+    });
+
+    add (cb, "South");
+    setTitle ("Labels");
+    setSize (160, 180);
+  }
+}
+
+class ListWindow extends SubFrame
+{
+  public void init ()
+  {
+    initted = true;
+
+    Panel p = new Panel ();
+    p.setLayout (new GridLayout (3, 1));
+    
+    List l = new List (5, true);
+    for (int i = 0; i < 10; i++)
+      l.add ("added item " + i);
+
+    p.add (l);
+
+    add (p, "Center");
+
+    Button cb = new Button ("Close");
+    cb.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) {
+       dispose();
+      }
+    });
+
+    add (cb, "South");
+    setTitle ("List");
+    setSize (85, 167);
+  }
+}    
+
+
+class RadioWindow extends SubFrame
+{
+  public void init ()
+  {
+    initted = true;
+
+    Panel p = new Panel();
+    p.setLayout (new GridLayout (3, 1));
+    ((GridLayout) p.getLayout ()).setHgap (5);
+    ((GridLayout) p.getLayout ()).setVgap (5);
+
+    final CheckboxGroup cg = new CheckboxGroup();
+    final Checkbox[] boxes = new Checkbox[3];
+    for (int i = 0; i < 3; ++i)
+      {
+       boxes[i] = new Checkbox("button" + i, cg, i == 0);
+       p.add(boxes[i]);
+      }
+
+    add (p, "North");
+
+    p = new Panel();
+    p.setLayout (new GridLayout (1, 3));
+    ((GridLayout) p.getLayout ()).setHgap (5);
+    ((GridLayout) p.getLayout ()).setVgap (5);
+
+    for (int i = 0; i < 3; ++i)
+      {
+       final int val = i;
+       Button tweak = new Button ("Set " + i);
+       tweak.addActionListener(new ActionListener ()
+         {
+           public void actionPerformed (ActionEvent e)
+           {
+             cg.setSelectedCheckbox(boxes[val]);
+           }
+         });
+       p.add(tweak);
+      }
+
+    add (p, "Center");
+
+    Button cb = new Button ("Close");
+    cb.addActionListener(new ActionListener () {
+      public void actionPerformed (ActionEvent e) {
+       dispose();
+      }
+    });
+
+    add (cb, "South");
+    setTitle ("Radio Buttons");
+    setSize (85, 167);
+  }
+}
diff --git a/libjava/gtk.m4 b/libjava/gtk.m4
new file mode 100644 (file)
index 0000000..b8cf402
--- /dev/null
@@ -0,0 +1,194 @@
+# Configure paths for GTK+
+# Owen Taylor     97-11-3
+
+dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
+dnl
+AC_DEFUN(AM_PATH_GTK,
+[dnl 
+dnl Get the cflags and libraries from the gtk-config script
+dnl
+AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
+            gtk_config_prefix="$withval", gtk_config_prefix="")
+AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
+            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
+AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
+                   , enable_gtktest=yes)
+
+  for module in . $4
+  do
+      case "$module" in
+         gthread) 
+             gtk_config_args="$gtk_config_args gthread"
+         ;;
+      esac
+  done
+
+  if test x$gtk_config_exec_prefix != x ; then
+     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
+     fi
+  fi
+  if test x$gtk_config_prefix != x ; then
+     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
+     fi
+  fi
+
+  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
+  min_gtk_version=ifelse([$1], ,0.99.7,$1)
+  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
+  no_gtk=""
+  if test "$GTK_CONFIG" = "no" ; then
+    no_gtk=yes
+  else
+    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
+    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
+    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK is sufficiently new. (Also sanity
+dnl checks the results of gtk-config to some extent
+dnl
+      rm -f conf.gtktest
+      AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.gtktest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If gtk-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
+      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+          (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+            GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+            gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+#endif /* defined (GTK_MAJOR_VERSION) ... */
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+              major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
+        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$GTK_CONFIG" = "no" ; then
+       echo "*** The gtk-config script installed by GTK could not be found"
+       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GTK_CONFIG environment variable to the"
+       echo "*** full path to gtk-config."
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK test program, checking why..."
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK or finding the wrong"
+          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
+          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
+          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+  rm -f conf.gtktest
+])
index 1deb2b4..6eadc25 100644 (file)
@@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@
 GCOBJS = @GCOBJS@
 GCSPEC = @GCSPEC@
 GCTESTSPEC = @GCTESTSPEC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
 HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
 INCLTDL = @INCLTDL@
 INTERPRETER = @INTERPRETER@
 JC1GCSPEC = @JC1GCSPEC@
+LIBART_CFLAGS = @LIBART_CFLAGS@
+LIBART_CONFIG = @LIBART_CONFIG@
+LIBART_LIBS = @LIBART_LIBS@
 LIBFFI = @LIBFFI@
 LIBFFIINCS = @LIBFFIINCS@
 LIBGCJDEBUG = @LIBGCJDEBUG@
@@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
 THREADLIBS = @THREADLIBS@
 THREADOBJS = @THREADOBJS@
 THREADSPEC = @THREADSPEC@
+TOOLKIT = @TOOLKIT@
 VERSION = @VERSION@
 ZINCS = @ZINCS@
 ZLIBS = @ZLIBS@
@@ -129,6 +139,9 @@ here = @here@
 libgcj_basedir = @libgcj_basedir@
 mkinstalldirs = @mkinstalldirs@
 tool_include_dir = @tool_include_dir@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+toolexecmainlibdir = @toolexecmainlibdir@
 
 AUTOMAKE_OPTIONS = foreign
 
index cd770f9..9f958e7 100644 (file)
@@ -1,4 +1,4 @@
-/* include/config.h.in.  Generated automatically from configure.in by autoheader 2.13.  */
+/* include/config.h.in.  Generated automatically from configure.in by autoheader.  */
 
 /* Define if using alloca.c.  */
 #undef C_ALLOCA
 /* Define if the compiler is configured for setjmp/longjmp exceptions. */
 #undef SJLJ_EXCEPTIONS
 
-/* Indicate that linker is not able to 8-byte align static data */
-#undef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
-
 /* Required define if using POSIX threads */
 #undef _REENTRANT
 
index da9bc0e..225ef5b 100644 (file)
@@ -1,5 +1,5 @@
 /* Toolkit.java -- AWT Toolkit superclass
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -96,7 +96,7 @@ public abstract class Toolkit
 {
   /** The default toolkit name. */
   private static String default_toolkit_name
-    = "gnu.awt.gtk.GtkToolkit";
+    = gnu.classpath.Configuration.default_awt_peer_toolkit;
 
   /**
    * The toolkit in use.  Once we load it, we don't ever change it
index 31e6b57..dbfe92c 100644 (file)
@@ -1,5 +1,5 @@
 /* Window.java --
-   Copyright (C) 1999, 2000, 2002 Free Software Foundation
+   Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -141,11 +141,12 @@ public class Window extends Container
         && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN)
       throw new IllegalArgumentException ("gc must be from a screen device");
 
-    if (gc == null)
-      graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
-        .getDefaultScreenDevice()
-        .getDefaultConfiguration();
-    else
+    // FIXME: until we implement this, it just causes AWT to crash.
+//     if (gc == null)
+//       graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment()
+//         .getDefaultScreenDevice()
+//         .getDefaultConfiguration();
+//     else
       graphicsConfiguration = gc;
   }
 
diff --git a/libjava/jni/classpath/jcl.c b/libjava/jni/classpath/jcl.c
new file mode 100644 (file)
index 0000000..66c756e
--- /dev/null
@@ -0,0 +1,134 @@
+/* jcl.c
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <stdio.h>
+#include <jcl.h>
+#include <malloc.h>
+
+static char errstr[4098]; // this way the memory is pre-allocated, so that we do not have to worry if we are out of memory.
+
+JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg) {
+       jclass excClass;
+       if((*env)->ExceptionOccurred(env)) {
+               (*env)->ExceptionClear(env);
+       }
+       excClass = (*env)->FindClass(env, className);
+       if(excClass == NULL) {
+               jclass errExcClass;
+               errExcClass = (*env)->FindClass(env, "java/lang/ClassNotFoundException");
+               if(errExcClass == NULL) {
+                       errExcClass = (*env)->FindClass(env, "java/lang/InternalError");
+                       if(errExcClass == NULL) {
+                               sprintf(errstr,"JCL: Utterly failed to throw exeption %s with message %s.",className,errMsg);
+                               fprintf(stderr, errstr);
+                               return;
+                       }
+               }
+               sprintf(errstr,"JCL: Failed to throw exception %s with message %s: could not find exception class.", className, errMsg);
+               (*env)->ThrowNew(env, errExcClass, errstr);
+       }
+       (*env)->ThrowNew(env, excClass, errMsg);
+}
+
+JNIEXPORT void * JNICALL JCL_malloc(JNIEnv * env, size_t size) {
+       void * mem = malloc(size);
+       if(mem == NULL) {
+               JCL_ThrowException(env, "java/lang/OutOfMemoryError", "malloc() failed.");
+               return NULL;
+       }
+       return mem;
+}
+
+JNIEXPORT void * JNICALL JCL_realloc(JNIEnv *env, void *ptr, size_t size)
+{
+  ptr = realloc(ptr, size);
+  if (ptr == 0)
+    {
+      JCL_ThrowException(env, "java/lang/OutOfMemoryError",
+                             "malloc() failed.");
+      return NULL;
+    }
+  return(ptr);
+}
+
+JNIEXPORT void JNICALL JCL_free(JNIEnv * env, void * p) {
+       if(p != NULL) {
+               free(p);
+       }
+}
+
+JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv * env, jstring s) {
+       char* cstr;
+       if(s == NULL) {
+               JCL_ThrowException(env, "java/lang/NullPointerException","Null string");
+               return NULL;
+       }
+       cstr = (char*)(*env)->GetStringUTFChars(env, s, NULL);
+       if(cstr == NULL) {
+               JCL_ThrowException(env, "java/lang/InternalError", "GetStringUTFChars() failed.");
+               return NULL;
+       }
+       return cstr;
+}
+
+JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv * env, jstring s, char * cstr) {
+       (*env)->ReleaseStringUTFChars(env, s, cstr);
+}
+
+JNIEXPORT jint JNICALL JCL_MonitorEnter(JNIEnv * env, jobject o) {
+       jint retval = (*env)->MonitorEnter(env,o);
+       if(retval != 0) {
+               JCL_ThrowException(env, "java/lang/InternalError", "MonitorEnter() failed.");
+       }
+       return retval;
+}
+
+JNIEXPORT jint JNICALL JCL_MonitorExit(JNIEnv * env, jobject o) {
+       jint retval = (*env)->MonitorExit(env,o);
+       if(retval != 0) {
+               JCL_ThrowException(env, "java/lang/InternalError", "MonitorExit() failed.");
+       }
+       return retval;
+}
+
+JNIEXPORT jclass JNICALL JCL_FindClass(JNIEnv * env, char * className) {
+       jclass retval = (*env)->FindClass(env,className);
+       if(retval == NULL) {
+               JCL_ThrowException(env, "java/lang/ClassNotFoundException", className);
+       }
+       return retval;
+}
diff --git a/libjava/jni/classpath/jcl.h b/libjava/jni/classpath/jcl.h
new file mode 100644 (file)
index 0000000..a7d00b4
--- /dev/null
@@ -0,0 +1,64 @@
+/* jcl.h
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef __JCL_H__
+#define __JCL_H__
+
+#include <stddef.h>
+#include <jni.h>
+#include <config.h>
+
+JNIEXPORT jclass JNICALL JCL_FindClass(JNIEnv * env, char * className);
+JNIEXPORT void JNICALL JCL_ThrowException(JNIEnv * env, char * className, char * errMsg);
+JNIEXPORT void * JNICALL JCL_malloc(JNIEnv *env, size_t size);
+JNIEXPORT void * JNICALL JCL_realloc(JNIEnv *env, void *ptr, size_t size);
+JNIEXPORT void JNICALL JCL_free(JNIEnv *env, void * p);
+JNIEXPORT char * JNICALL JCL_jstring_to_cstring(JNIEnv *env, jstring s);
+JNIEXPORT void JNICALL JCL_free_cstring(JNIEnv *env, jstring s, char * cstr);
+JNIEXPORT jint JNICALL JCL_MonitorEnter(JNIEnv *env, jobject o);
+JNIEXPORT jint JNICALL JCL_MonitorExit(JNIEnv *env, jobject o);
+
+#define JCL_RETHROW_EXCEPTION(env) if((*(env))->ExceptionOccurred((env)) != NULL) return NULL;
+
+/* Simple debug macro */
+#ifdef DEBUG
+#define DBG(x) fprintf(stderr, (x));
+#else
+#define DBG(x)
+#endif
+
+#endif
diff --git a/libjava/jni/classpath/jnilink.c b/libjava/jni/classpath/jnilink.c
new file mode 100644 (file)
index 0000000..0c244f2
--- /dev/null
@@ -0,0 +1,117 @@
+/* JNILINK 1.1: JNI version.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "jnilink.h"
+#include <string.h>
+#include <jcl.h>
+
+#include <malloc.h>
+
+#define GETCLASS(c) *(jclass*)(c)
+
+JNIEXPORT jclass JNICALL
+LINK_RelinkClass     (JNIEnv * env, linkedClass * c, char * name) {
+       jclass found;
+       LINK_UnlinkClass(env,*c);
+
+       found = (*env)->FindClass(env,name);
+       if(found == NULL)
+               return NULL;
+
+       *c = JCL_malloc(env,sizeof(jclass));
+       if(*c == NULL)
+               return NULL;
+
+       GETCLASS(*c) = (*env)->NewGlobalRef(env,found);
+       return GETCLASS(*c);
+}
+
+JNIEXPORT jclass JNICALL
+LINK_RelinkKnownClass(JNIEnv * env, linkedClass * c, jclass newClass) {
+       LINK_UnlinkClass(env,*c);
+
+       *c = JCL_malloc(env,sizeof(jclass));
+       if(*c == NULL)
+               return NULL;
+
+       GETCLASS(*c) = (*env)->NewGlobalRef(env,newClass);
+       return newClass;
+}
+
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkMethod      (JNIEnv * env, jmethodID * m, linkedClass c,
+                        char * name, char * sig) {
+       *m = (*env)->GetMethodID(env,GETCLASS(c),name,sig);
+       return *m;
+}
+
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkStaticMethod(JNIEnv * env, jmethodID * m, linkedClass c,
+                        char * name, char * sig) {
+       *m = (*env)->GetStaticMethodID(env,GETCLASS(c),name,sig);
+       return *m;
+}
+
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkField       (JNIEnv * env, jfieldID * f, linkedClass c,
+                        char * name, char * sig) {
+       *f = (*env)->GetFieldID(env,GETCLASS(c),name,sig);
+       return *f;
+}
+
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c,
+                        char * name, char * sig) {
+       *f = (*env)->GetStaticFieldID(env,GETCLASS(c),name,sig);
+       return *f;
+}
+
+
+/* These are for when the class referencing the symbols is unloaded; it
+destroys any object references
+ * the linker might have kept around.
+ */
+JNIEXPORT void JNICALL LINK_UnlinkClass       (JNIEnv * env, linkedClass * c) {
+       if(*c != NULL) {
+               if(GETCLASS(*c) != NULL)
+                       (*env)->DeleteGlobalRef(env,GETCLASS(*c));
+               JCL_free(env,*c);
+               *c = NULL;
+       }
+}
+
diff --git a/libjava/jni/classpath/jnilink.h b/libjava/jni/classpath/jnilink.h
new file mode 100644 (file)
index 0000000..448e2b5
--- /dev/null
@@ -0,0 +1,86 @@
+/* JNILINK 1.1: JNI version.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#ifndef __JNILINK_H__
+#define __JNILINK_H__
+
+#include <jni.h>
+
+typedef void* linkedClass;
+
+#define LINK_LinkClass(env,c,name)              ((c)==NULL ? LINK_ReallyLinkClass((env),&(c),(name)) : (c))
+#define LINK_LinkKnownClass(env,c,newClass)     ((c)==NULL ? LINK_ReallyLinkKnownClass((env),&(c),(newClass)) : (c))
+#define LINK_LinkMethod(env,m,c,name,sig)       ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),(name),(sig)) : (m))
+#define LINK_LinkStaticMethod(env,m,c,name,sig) ((m)==NULL ? LINK_RelinkStaticMethod((env),&(m),(c),(name),(sig)) : (m))
+#define LINK_LinkField(env,f,c,name,sig)        ((m)==NULL ? LINK_RelinkField((env),&(f),(c),(name),(sig)) : (f))
+#define LINK_LinkStaticField(env,f,c,name,sig)  ((m)==NULL ? LINK_RelinkStaticField((env),&(f),(c),(name),(sig)) : (f))
+
+#define LINK_LinkConstructor(env,m,c,sig)       ((m)==NULL ? LINK_RelinkMethod((env),&(m),(c),"<init>",(sig)) : (m))
+
+JNIEXPORT jclass JNICALL
+LINK_ReallyLinkClass     (JNIEnv * env, linkedClass * c,
+                          char * name);
+JNIEXPORT jclass JNICALL
+LINK_ReallyLinkKnownClass(JNIEnv * env, linkedClass * c,
+                          jclass newClass);
+JNIEXPORT jclass JNICALL
+LINK_RelinkClass       (JNIEnv * env, linkedClass * c,
+                        char * name);
+JNIEXPORT jclass JNICALL
+LINK_RelinkKnownClass  (JNIEnv * env, linkedClass * c,
+                        jclass newClass);
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkMethod      (JNIEnv * env, jmethodID * m, linkedClass c,
+                        char * name, char * sig);
+JNIEXPORT jmethodID JNICALL
+LINK_RelinkStaticMethod(JNIEnv * env, jmethodID * m, linkedClass c,
+                        char * name, char * sig);
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkField       (JNIEnv * env, jfieldID * f, linkedClass c,
+                        char * name, char * sig);
+JNIEXPORT jfieldID JNICALL
+LINK_RelinkStaticField (JNIEnv * env, jfieldID * f, linkedClass c,
+                        char * name, char * sig);
+
+/* These are for when the class referencing the symbols is unloaded; it
+destroys any object references
+ * the linker might have kept around.
+ */
+JNIEXPORT void JNICALL LINK_UnlinkClass       (JNIEnv * env, linkedClass * c);
+
+#endif
diff --git a/libjava/jni/classpath/native_state.c b/libjava/jni/classpath/native_state.c
new file mode 100644 (file)
index 0000000..746686e
--- /dev/null
@@ -0,0 +1,247 @@
+/* Magical NSA API -- Associate a C ptr with an instance of an object
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <stdlib.h>
+#include <jni.h>
+#include "native_state.h"
+
+#define DEFAULT_TABLE_SIZE 97
+
+struct state_table *
+init_state_table_with_size (JNIEnv *env, jclass clazz, jint size)
+{
+  struct state_table *table;
+  jfieldID hash;
+  jclass clazz_g;
+
+  hash = (*env)->GetFieldID (env, clazz, "native_state", "I");
+  if (hash == NULL)
+    return NULL;
+
+  clazz_g = (*env)->NewGlobalRef (env, clazz);
+  if (clazz_g == NULL)
+    return NULL;
+
+  table = (struct state_table *) malloc (sizeof (struct state_table));
+  table->size = size;
+  table->head = (struct state_node **) calloc (sizeof (struct state_node *),
+                                              table->size);
+  table->hash = hash;
+  table->clazz = clazz_g; 
+
+  return table;
+}
+
+struct state_table *
+init_state_table (JNIEnv *env, jclass clazz)
+{
+  return init_state_table_with_size (env, clazz, DEFAULT_TABLE_SIZE);
+}
+
+static void *
+remove_node (struct state_node **head, jint obj_id)
+{
+  struct state_node *back_ptr = NULL;
+  struct state_node *node = *head;
+
+  while (node != NULL)
+    {
+      if (node->key == obj_id)
+       {
+         void *return_value;
+         if (back_ptr == NULL)
+           *head = node->next;
+         else
+           back_ptr->next = node->next;
+         return_value = node->c_state;
+         free (node);
+         return return_value;
+       }
+      back_ptr = node;
+      node = node->next;
+    }
+
+  return NULL;
+}
+           
+static void *
+get_node (struct state_node **head, jint obj_id)
+{
+  struct state_node *back_ptr = NULL;
+  struct state_node *node = *head;
+
+  while (node != NULL)
+    {
+      if (node->key == obj_id)
+       {
+         /* Move the node we found to the front of the list.  */
+         if (back_ptr != NULL)
+           {
+             back_ptr->next = node->next;
+             node->next = *head;
+             *head = node;
+           }
+
+         /* Return the match.  */
+         return node->c_state;
+       }
+  
+      back_ptr = node;
+      node = node->next;
+    }
+
+  return NULL;
+}
+
+static void 
+add_node (struct state_node **head, jint obj_id, void *state)
+{
+  struct state_node *node = *head;
+  struct state_node *back_ptr = NULL;
+
+  struct state_node *new_node;
+
+  if (node != NULL)
+    {
+      while (node->next != NULL && obj_id != node->key) 
+       {
+         back_ptr = node;
+         node = node->next;
+       }
+
+      if (node->key == obj_id)
+       {
+         /* If we're updating a node, move it to the front of the
+            list.  */
+         if (back_ptr != NULL)
+           {
+             back_ptr->next = node->next;
+             node->next = *head;
+           }
+         node->c_state = state;
+         return;
+       }
+    }
+
+  new_node = (struct state_node *) malloc (sizeof (struct state_node));
+  new_node->key = obj_id;
+  new_node->c_state = state;
+  new_node->next = *head;
+  *head = new_node;
+}
+
+void 
+set_state_oid (JNIEnv *env, jobject lock, struct state_table *table, 
+              jint obj_id, void *state)
+{
+  jint hash;
+  
+  hash = obj_id % table->size;
+
+  (*env)->MonitorEnter (env, lock);
+  add_node (&table->head[hash], obj_id, state);
+  (*env)->MonitorExit (env, lock);
+}
+
+void *
+get_state_oid (JNIEnv *env, jobject lock, struct state_table *table,
+              jint obj_id)
+{
+  jint hash;
+  void *return_value;
+  
+  hash = obj_id % table->size;
+
+  (*env)->MonitorEnter (env, lock);
+  return_value = get_node (&table->head[hash], obj_id);
+  (*env)->MonitorExit (env, lock);
+
+  return return_value;
+}
+
+void *
+remove_state_oid (JNIEnv *env, jobject lock, struct state_table *table,
+                 jint obj_id)
+{
+  jint hash;
+  void *return_value;
+  
+  hash = obj_id % table->size;
+
+  (*env)->MonitorEnter (env, lock);
+  return_value = remove_node (&table->head[hash], obj_id);
+  (*env)->MonitorExit (env, lock);
+
+  return return_value;
+}
+
+int
+set_state (JNIEnv *env, jobject obj, struct state_table *table, void *state)
+{
+  jint obj_id;
+  obj_id = (*env)->GetIntField (env, obj, table->hash);
+
+  if ((*env)->ExceptionOccurred (env) != NULL)
+    return -1;
+
+  set_state_oid (env, table->clazz, table, obj_id, state);
+  return 0;
+}
+
+void *
+get_state (JNIEnv *env, jobject obj, struct state_table *table)
+{
+  jint obj_id;
+  obj_id = (*env)->GetIntField (env, obj, table->hash);
+
+  if ((*env)->ExceptionOccurred (env) != NULL)
+    return NULL;
+
+  return get_state_oid (env, table->clazz, table, obj_id);
+}
+
+void *
+remove_state_slot (JNIEnv *env, jobject obj, struct state_table *table)
+{
+  jint obj_id;
+  obj_id = (*env)->GetIntField (env, obj, table->hash);
+
+  if ((*env)->ExceptionOccurred (env) != NULL)
+    return NULL;
+
+  return remove_state_oid (env, table->clazz, table, obj_id);
+}
diff --git a/libjava/jni/classpath/native_state.h b/libjava/jni/classpath/native_state.h
new file mode 100644 (file)
index 0000000..25ef6b5
--- /dev/null
@@ -0,0 +1,71 @@
+/* Magical NSA API -- Associate a C ptr with an instance of an object
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef JCL_NATIVE_STATE
+#define JCL_NATIVE_STATE
+
+#include <jni.h>
+
+struct state_table
+{
+  jint size;                   /* number of slots, should be prime */
+  jfieldID hash;               /* field containing System.identityHashCode(this) */
+  jclass clazz;                        /* lock aquired for reading/writing nodes */
+  struct state_node **head;
+};
+
+struct state_node
+{
+  jint key;
+  void *c_state;
+  struct state_node *next;
+};
+
+struct state_table * init_state_table_with_size (JNIEnv *, jclass, jint);
+struct state_table * init_state_table (JNIEnv *, jclass);
+
+/* lowlevel api */
+void set_state_oid (JNIEnv *, jobject, struct state_table *, jint, void *);
+void * get_state_oid (JNIEnv *, jobject, struct state_table *, jint);
+void * remove_state_oid (JNIEnv *, jobject, struct state_table *, jint);
+
+/* highlevel api */
+int set_state (JNIEnv *, jobject, struct state_table *, void *);
+void * get_state (JNIEnv *, jobject, struct state_table *);
+void * remove_state_slot (JNIEnv *, jobject, struct state_table *);
+
+#endif
diff --git a/libjava/jni/classpath/primlib.c b/libjava/jni/classpath/primlib.c
new file mode 100644 (file)
index 0000000..c7396e2
--- /dev/null
@@ -0,0 +1,463 @@
+/* primlib.c
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include <jnilink.h>
+#include <primlib.h>
+#include <jcl.h>
+
+static jclass nativeWrapClass[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
+                                               NULL,NULL,NULL, NULL,NULL,NULL};
+
+static jclass nativeTypeClass[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
+                                               NULL,NULL,NULL, NULL,NULL,NULL};
+
+static jmethodID nativeWrapClassConstructor[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
+                                               NULL,NULL,NULL, NULL,NULL,NULL};
+
+static jmethodID nativeWrapClassAccessor[PRIMLIB_NUMTYPES] = {NULL,NULL,NULL, NULL,NULL,NULL,
+                                               NULL,NULL,NULL, NULL,NULL,NULL};
+
+static char * nativeWrapClassName[PRIMLIB_NUMTYPES] = {
+                                                       NULL,
+                                                       NULL,
+                                                       "java/lang/Boolean",
+                                                       "java/lang/Byte",
+                                                       "java/lang/Character",
+                                                       "java/lang/Short",
+                                                       "java/lang/Integer",
+                                                       "java/lang/Long",
+                                                       "java/lang/Float",
+                                                       "java/lang/Double",
+                                                       "java/lang/Void",
+                                                       NULL
+                                                       };
+
+static char * nativeWrapClassConstructorSig[PRIMLIB_NUMTYPES] = {
+                                                       NULL,
+                                                       NULL,
+                                                       "(Z)V",
+                                                       "(B)V",
+                                                       "(C)V",
+                                                       "(S)V",
+                                                       "(I)V",
+                                                       "(J)V",
+                                                       "(F)V",
+                                                       "(D)V",
+                                                       "()V",
+                                                       NULL
+                                                       };
+
+static char * nativeWrapClassAccessorName[PRIMLIB_NUMTYPES] = {
+                                                       NULL,
+                                                       NULL,
+                                                       "booleanValue",
+                                                       "byteValue",
+                                                       "charValue",
+                                                       "shortValue",
+                                                       "intValue",
+                                                       "longValue",
+                                                       "floatValue",
+                                                       "doubleValue",
+                                                       NULL,
+                                                       NULL
+};
+
+static char * nativeWrapClassAccessorSig[PRIMLIB_NUMTYPES] = {
+                                                       NULL,
+                                                       NULL,
+                                                       "()Z",
+                                                       "()B",
+                                                       "()C",
+                                                       "()S",
+                                                       "()I",
+                                                       "()J",
+                                                       "()F",
+                                                       "()D",
+                                                       NULL,
+                                                       NULL
+};
+
+
+JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass(JNIEnv * env, int reflectType) {
+       return LINK_LinkClass(env,nativeWrapClass[reflectType],nativeWrapClassName[reflectType]);
+}
+
+static jclass ActuallyGetNativeTypeClass(JNIEnv * env, int reflectType) {
+       jclass wrapClass;
+       jfieldID typeField;
+
+       wrapClass = PRIMLIB_GetNativeWrapClass(env, reflectType);
+       if(wrapClass == NULL)
+               return NULL;
+       typeField = (*env)->GetStaticFieldID(env, wrapClass, "TYPE", "Ljava/lang/Class");
+       if(typeField == NULL)
+               return NULL;
+       return (*env)->GetStaticObjectField(env, wrapClass, typeField);
+}
+
+JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass(JNIEnv * env, int reflectType) {
+       return LINK_LinkKnownClass(env, nativeTypeClass[reflectType], ActuallyGetNativeTypeClass(env,reflectType));
+}
+
+JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor(JNIEnv * env, int reflectType) {
+       PRIMLIB_GetNativeWrapClass(env,reflectType);
+       return LINK_LinkConstructor(env, nativeWrapClassConstructor[reflectType], nativeWrapClass[reflectType], nativeWrapClassConstructorSig[reflectType]);
+}
+
+JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor(JNIEnv * env, int reflectType) {
+       PRIMLIB_GetNativeWrapClass(env,reflectType);
+       return LINK_LinkMethod(env, nativeWrapClassAccessor[reflectType], nativeWrapClass[reflectType], nativeWrapClassAccessorName[reflectType], nativeWrapClassAccessorSig[reflectType]);
+}
+
+
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean(JNIEnv * env, jboolean b) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_BOOLEAN);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN), construct, b);
+}
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapByte   (JNIEnv * env, jbyte b) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_BYTE);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE), construct, b); 
+}
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapChar   (JNIEnv * env, jchar c) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_CHAR);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR), construct, c);
+}
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapShort  (JNIEnv * env, jshort s) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_SHORT);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT), construct, s);
+}
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapInt    (JNIEnv * env, jint i) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_INT);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT), construct, i);
+}
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapLong   (JNIEnv * env, jlong l) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_LONG);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG), construct, l);
+}
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat  (JNIEnv * env, jfloat f) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_FLOAT);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT), construct, f);
+}
+
+JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d) {
+       jmethodID construct = PRIMLIB_GetNativeWrapClassConstructor(env, PRIMLIB_DOUBLE);
+       JCL_RETHROW_EXCEPTION(env);
+       return (*env)->NewObject(env, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE), construct, d);
+}
+
+
+JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN))) {
+               return PRIMLIB_GetBooleanObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return JNI_FALSE;
+       }
+}
+
+JNIEXPORT jbyte JNICALL PRIMLIB_UnwrapByte(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
+               return PRIMLIB_GetByteObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return 0;
+       }
+}
+
+JNIEXPORT jshort JNICALL PRIMLIB_UnwrapShort(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
+               return PRIMLIB_GetShortObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
+               return (jshort)PRIMLIB_GetByteObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return 0;
+       }
+}
+
+JNIEXPORT jchar JNICALL PRIMLIB_UnwrapChar(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
+               return PRIMLIB_GetCharObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return 0;
+       }
+}
+
+JNIEXPORT jint JNICALL PRIMLIB_UnwrapInt(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
+               return PRIMLIB_GetIntObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
+               return (jint)PRIMLIB_GetShortObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
+               return (jint)PRIMLIB_GetCharObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
+               return (jint)PRIMLIB_GetByteObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return 0;
+       }
+}
+
+JNIEXPORT jlong JNICALL PRIMLIB_UnwrapLong(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) {
+               return PRIMLIB_GetLongObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
+               return (jlong)PRIMLIB_GetIntObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
+               return (jlong)PRIMLIB_GetShortObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
+               return (jlong)PRIMLIB_GetCharObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
+               return (jlong)PRIMLIB_GetByteObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return 0;
+       }
+}
+
+JNIEXPORT jfloat JNICALL PRIMLIB_UnwrapFloat(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT))) {
+               return PRIMLIB_GetFloatObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) {
+               return (jfloat)PRIMLIB_GetLongObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
+               return (jfloat)PRIMLIB_GetIntObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
+               return (jfloat)PRIMLIB_GetShortObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
+               return (jfloat)PRIMLIB_GetCharObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
+               return (jfloat)PRIMLIB_GetByteObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return 0;
+       }
+}
+
+JNIEXPORT jdouble JNICALL PRIMLIB_UnwrapDouble(JNIEnv * env, jobject obj) {
+       if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE))) {
+               return PRIMLIB_GetDoubleObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT))) {
+               return (jdouble)PRIMLIB_GetFloatObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG))) {
+               return (jdouble)PRIMLIB_GetLongObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT))) {
+               return (jdouble)PRIMLIB_GetIntObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT))) {
+               return (jdouble)PRIMLIB_GetShortObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR))) {
+               return (jdouble)PRIMLIB_GetCharObjectValue(env, obj);
+       } else if((*env)->IsInstanceOf(env, obj, PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE))) {
+               return (jdouble)PRIMLIB_GetByteObjectValue(env, obj);
+       } else {
+               JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct type.");
+               return 0;
+       }
+}
+
+JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType(JNIEnv * env, jobject obj) {
+       jclass typeClass;
+       if(obj == NULL) {
+               return PRIMLIB_NULL;
+       }
+
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_DOUBLE);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_DOUBLE;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_FLOAT);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_FLOAT;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_LONG);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_LONG;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_INT);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_INT;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_CHAR);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_CHAR;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_SHORT);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_SHORT;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BYTE);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_BYTE;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_BOOLEAN);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_BOOLEAN;
+       }
+       typeClass = PRIMLIB_GetNativeWrapClass(env, PRIMLIB_VOID);
+       if((*env)->IsInstanceOf(env, obj, typeClass)) {
+               return PRIMLIB_VOID;
+       }
+       return PRIMLIB_OBJECT;
+}
+
+JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType(JNIEnv * env, jclass returnType) {
+       jclass typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_DOUBLE);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_DOUBLE;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_FLOAT);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_FLOAT;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_LONG);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_LONG;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_INT);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_INT;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_CHAR);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_CHAR;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_SHORT);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_SHORT;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_BYTE);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_BYTE;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_BOOLEAN);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_BOOLEAN;
+       }
+       typeClass = PRIMLIB_GetNativeTypeClass(env, PRIMLIB_VOID);
+       if((*env)->IsAssignableFrom(env, returnType, typeClass)) {
+               return PRIMLIB_VOID;
+       }
+       return PRIMLIB_OBJECT;
+}
+
+
+JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_BOOLEAN);
+       return (*env)->CallBooleanMethod(env, obj, acc);
+}
+
+JNIEXPORT jbyte JNICALL PRIMLIB_GetByteObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_BYTE);
+       return (*env)->CallByteMethod(env, obj, acc);
+}
+
+JNIEXPORT jshort JNICALL PRIMLIB_GetShortObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_SHORT);
+       return (*env)->CallShortMethod(env, obj, acc);
+}
+
+JNIEXPORT jchar JNICALL PRIMLIB_GetCharObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_CHAR);
+       return (*env)->CallCharMethod(env, obj, acc);
+}
+
+JNIEXPORT jint JNICALL PRIMLIB_GetIntObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_INT);
+       return (*env)->CallIntMethod(env, obj, acc);
+}
+
+JNIEXPORT jlong JNICALL PRIMLIB_GetLongObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_LONG);
+       return (*env)->CallLongMethod(env, obj, acc);
+}
+
+JNIEXPORT jfloat JNICALL PRIMLIB_GetFloatObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_FLOAT);
+       return (*env)->CallFloatMethod(env, obj, acc);
+}
+
+JNIEXPORT jdouble JNICALL PRIMLIB_GetDoubleObjectValue(JNIEnv * env, jobject obj) {
+       jmethodID acc = PRIMLIB_GetNativeWrapClassAccessor(env, PRIMLIB_DOUBLE);
+       return (*env)->CallDoubleMethod(env, obj, acc);
+}
+
+
+
+JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue(JNIEnv* env, jobject obj, jclass classType) {
+       jvalue retval;
+       jint objType = PRIMLIB_GetReflectiveType(env, classType);
+       if(objType == PRIMLIB_BOOLEAN) {
+               retval.z = PRIMLIB_UnwrapBoolean(env,obj);
+       } else if(objType == PRIMLIB_BYTE) {
+               retval.b = PRIMLIB_UnwrapByte(env,obj);
+       } else if(objType == PRIMLIB_CHAR) {
+               retval.c = PRIMLIB_UnwrapChar(env,obj);
+       } else if(objType == PRIMLIB_SHORT) {
+               retval.s = PRIMLIB_UnwrapShort(env,obj);
+       } else if(objType == PRIMLIB_INT) {
+               retval.i = PRIMLIB_UnwrapInt(env,obj);
+       } else if(objType == PRIMLIB_LONG) {
+               retval.j = PRIMLIB_UnwrapLong(env,obj);
+       } else if(objType == PRIMLIB_FLOAT) {
+               retval.f = PRIMLIB_UnwrapFloat(env,obj);
+       } else if(objType == PRIMLIB_DOUBLE) {
+               retval.d = PRIMLIB_UnwrapDouble(env,obj);
+       } else {
+               if(obj != NULL && !(*env)->IsInstanceOf(env, obj, classType)) {
+                       JCL_ThrowException(env, "java/lang/IllegalArgumentException", "Argument not of correct object type.");
+                       return retval;
+               }
+               retval.l = obj;
+       }
+       return retval;
+}
+
diff --git a/libjava/jni/classpath/primlib.h b/libjava/jni/classpath/primlib.h
new file mode 100644 (file)
index 0000000..12f3bae
--- /dev/null
@@ -0,0 +1,102 @@
+/* primlib.h
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef __PRIMLIB_H__
+#define __PRIMLIB_H__
+
+#include <jni.h>
+
+#define PRIMLIB_UNKNOWN  0
+#define PRIMLIB_OBJECT   1
+#define PRIMLIB_BOOLEAN  2
+#define PRIMLIB_BYTE     3
+#define PRIMLIB_CHAR     4
+#define PRIMLIB_SHORT    5
+#define PRIMLIB_INT      6
+#define PRIMLIB_LONG     7
+#define PRIMLIB_FLOAT    8
+#define PRIMLIB_DOUBLE   9
+#define PRIMLIB_VOID     10
+#define PRIMLIB_NULL     11
+#define PRIMLIB_NUMTYPES 12
+
+/* Low-level primitive class accessor functions. */
+JNIEXPORT jclass JNICALL PRIMLIB_GetNativeWrapClass(JNIEnv * env, int reflectType);
+JNIEXPORT jclass JNICALL PRIMLIB_GetNativeTypeClass(JNIEnv * env, int reflectType);
+JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassConstructor(JNIEnv * env, int reflectType);
+JNIEXPORT jmethodID JNICALL PRIMLIB_GetNativeWrapClassAccessor(JNIEnv * env, int reflectType);
+
+/* Type discovery functions: WrapperType finds out j.l.Boolean/Byte/etc., and
+   Type finds out j.l.Boolean.TYPE, etc.
+*/
+JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveWrapperType(JNIEnv * env, jobject obj);
+JNIEXPORT jint JNICALL PRIMLIB_GetReflectiveType(JNIEnv * env, jclass returnType);
+
+/* Constructor functions. */
+JNIEXPORT jobject JNICALL PRIMLIB_WrapBoolean(JNIEnv * env, jboolean b);
+JNIEXPORT jobject JNICALL PRIMLIB_WrapByte   (JNIEnv * env, jbyte b);
+JNIEXPORT jobject JNICALL PRIMLIB_WrapChar   (JNIEnv * env, jchar c);
+JNIEXPORT jobject JNICALL PRIMLIB_WrapShort  (JNIEnv * env, jshort s);
+JNIEXPORT jobject JNICALL PRIMLIB_WrapInt    (JNIEnv * env, jint i);
+JNIEXPORT jobject JNICALL PRIMLIB_WrapLong   (JNIEnv * env, jlong l);
+JNIEXPORT jobject JNICALL PRIMLIB_WrapFloat  (JNIEnv * env, jfloat f);
+JNIEXPORT jobject JNICALL PRIMLIB_WrapDouble (JNIEnv * env, jdouble d);
+
+/* Widening conversion unwrapping functions. */
+JNIEXPORT jboolean JNICALL PRIMLIB_UnwrapBoolean(JNIEnv * env, jobject obj);
+JNIEXPORT jbyte    JNICALL PRIMLIB_UnwrapByte   (JNIEnv * env, jobject obj);
+JNIEXPORT jshort   JNICALL PRIMLIB_UnwrapShort  (JNIEnv * env, jobject obj);
+JNIEXPORT jchar    JNICALL PRIMLIB_UnwrapChar   (JNIEnv * env, jobject obj);
+JNIEXPORT jint     JNICALL PRIMLIB_UnwrapInt    (JNIEnv * env, jobject obj);
+JNIEXPORT jlong    JNICALL PRIMLIB_UnwrapLong   (JNIEnv * env, jobject obj);
+JNIEXPORT jfloat   JNICALL PRIMLIB_UnwrapFloat  (JNIEnv * env, jobject obj);
+JNIEXPORT jdouble  JNICALL PRIMLIB_UnwrapDouble (JNIEnv * env, jobject obj);
+
+/* Simple unwrapping functions. Objects *must* be of correct type. */
+JNIEXPORT jboolean JNICALL PRIMLIB_GetBooleanObjectValue(JNIEnv * env, jobject obj);
+JNIEXPORT jbyte    JNICALL PRIMLIB_GetByteObjectValue   (JNIEnv * env, jobject obj);
+JNIEXPORT jshort   JNICALL PRIMLIB_GetShortObjectValue  (JNIEnv * env, jobject obj);
+JNIEXPORT jchar    JNICALL PRIMLIB_GetCharObjectValue   (JNIEnv * env, jobject obj);
+JNIEXPORT jint     JNICALL PRIMLIB_GetIntObjectValue    (JNIEnv * env, jobject obj);
+JNIEXPORT jlong    JNICALL PRIMLIB_GetLongObjectValue   (JNIEnv * env, jobject obj);
+JNIEXPORT jfloat   JNICALL PRIMLIB_GetFloatObjectValue  (JNIEnv * env, jobject obj);
+JNIEXPORT jdouble  JNICALL PRIMLIB_GetDoubleObjectValue (JNIEnv * env, jobject obj);
+
+/* jvalue conversion: Unwrap obj to the type of classType, with widening conversion. */
+JNIEXPORT jvalue JNICALL PRIMLIB_UnwrapJValue(JNIEnv* env, jobject obj, jclass classType);
+
+#endif
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
new file mode 100644 (file)
index 0000000..03c1e49
--- /dev/null
@@ -0,0 +1,102 @@
+/* gdkfontmetrics.c
+   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GdkFontMetrics.h"
+#include <gdk/gdkx.h>
+
+#define ASCENT      0
+#define MAX_ASCENT  1
+#define DESCENT     2
+#define MAX_DESCENT 3
+#define MAX_ADVANCE 4
+#define NUM_METRICS 5
+
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_initState
+  (JNIEnv *env, jobject obj, jstring fname, jint size)
+{
+  jintArray array;
+  jint *metrics;
+  const char *cfname;
+  char *xlfd;
+  GdkFont *font;
+  XFontStruct *xfont;
+
+  cfname = (*env)->GetStringUTFChars (env, fname, NULL);
+  xlfd = g_strdup_printf (cfname, (size * 10));
+  (*env)->ReleaseStringUTFChars (env, fname, cfname);
+
+  array = (*env)->NewIntArray (env, NUM_METRICS);
+  metrics = (*env)->GetIntArrayElements (env, array, NULL);
+
+  gdk_threads_enter ();
+  font = gdk_font_load (xlfd);
+  xfont = GDK_FONT_XFONT (font);
+
+  metrics[ASCENT]      = font->ascent;
+  metrics[MAX_ASCENT]  = xfont->max_bounds.ascent;
+  metrics[DESCENT]     = font->descent;
+  metrics[MAX_DESCENT] = xfont->max_bounds.descent;
+  metrics[MAX_ADVANCE] = xfont->max_bounds.width;
+  gdk_threads_leave ();
+
+  g_free (xlfd);
+  (*env)->ReleaseIntArrayElements (env, array, metrics, 0);
+
+  NSA_SET_PTR (env, obj, font);
+
+  return array;
+}
+
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkFontMetrics_stringWidth
+  (JNIEnv *env, jobject obj, jstring str)
+{
+  GdkFont *font;
+  const char *cstr;
+  jint width;
+
+  font = (GdkFont *) NSA_GET_PTR (env, obj);
+  cstr = (*env)->GetStringUTFChars (env, str, NULL);
+
+  gdk_threads_enter ();
+  width = gdk_string_width (font, cstr);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, str, cstr);
+
+  return width;
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
new file mode 100644 (file)
index 0000000..41e9db6
--- /dev/null
@@ -0,0 +1,498 @@
+/* gdkgraphics.c
+   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GdkGraphics.h"
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
+
+#define GDK_STABLE_IS_PIXMAP(d) (((GdkWindowPrivate *)d)->window_type == GDK_WINDOW_PIXMAP)
+
+GdkPoint *
+translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints, 
+                 jint npoints, jint x_offset, jint y_offset);
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyState
+  (JNIEnv *env, jobject obj, jobject old)
+{
+  struct graphics *g, *g_old;
+
+  g = (struct graphics *) malloc (sizeof (struct graphics));
+  g_old = (struct graphics *) NSA_GET_PTR (env, old);
+
+  *g = *g_old;
+
+  gdk_threads_enter ();
+
+  g->gc = gdk_gc_new (g->drawable);
+  gdk_gc_copy (g->gc, g_old->gc);
+
+  if (GDK_STABLE_IS_PIXMAP (g->drawable))
+    gdk_pixmap_ref (g->drawable);
+  else /* GDK_IS_WINDOW (g->drawable) */
+    gdk_window_ref (g->drawable);
+
+  gdk_colormap_ref (g->cm);
+
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, g);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II
+  (JNIEnv *env, jobject obj, jint width, jint height)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) malloc (sizeof (struct graphics));
+  g->x_offset = g->y_offset = 0;
+
+  gdk_threads_enter ();
+  g->drawable = (GdkDrawable *) gdk_pixmap_new (NULL, width, height, 
+                                               gdk_rgb_get_visual ()->depth);
+  g->cm = gdk_rgb_get_cmap ();
+  gdk_colormap_ref (g->cm);
+  g->gc = gdk_gc_new (g->drawable);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, g);
+}
+
+/* copy the native state of the peer (GtkWidget *) to the native state
+   of the graphics object */
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2
+  (JNIEnv *env, jobject obj, jobject peer)
+{
+  struct graphics *g = (struct graphics *) malloc (sizeof (struct graphics));
+  void *ptr;
+  GtkWidget *widget;
+  GdkColor color;
+  jintArray array;
+  jint *rgb;
+
+  ptr = NSA_GET_PTR (env, peer);
+  g->x_offset = g->y_offset = 0;
+
+  gdk_threads_enter ();
+
+  widget = GTK_WIDGET (ptr);
+
+  if (GTK_IS_WINDOW (widget))
+    {
+      g->drawable = find_gtk_layout (widget)->bin_window;
+    }
+  else if (GTK_IS_LAYOUT (widget))
+    {
+      g->drawable = (GdkDrawable *) GTK_LAYOUT (widget)->bin_window;
+    }
+  else
+    {
+      g->drawable = (GdkDrawable *) widget->window;
+    }
+
+  gdk_window_ref (g->drawable);
+  g->cm = gtk_widget_get_colormap (widget);
+  gdk_colormap_ref (g->cm);
+  g->gc = gdk_gc_new (g->drawable);
+  gdk_gc_copy (g->gc, widget->style->fg_gc[GTK_STATE_NORMAL]);
+  color = widget->style->fg[GTK_STATE_NORMAL];
+
+  gdk_threads_leave ();
+
+  array = (*env)->NewIntArray (env, 3);
+  rgb = (*env)->GetIntArrayElements (env, array, NULL);
+  rgb[0] = color.red >> 8;
+  rgb[1] = color.green >> 8;
+  rgb[2] = color.blue >> 8;
+  (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
+
+  NSA_SET_PTR (env, obj, g);
+
+  return array;
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
+  (JNIEnv *env, jobject obj)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_DEL_PTR (env, obj);
+
+  if (!g) return;              /* dispose has been called more than once */
+  
+  gdk_threads_enter ();
+  XFlush (GDK_DISPLAY ());
+
+  gdk_gc_destroy (g->gc);
+
+  if (GDK_STABLE_IS_PIXMAP (g->drawable))
+    gdk_pixmap_unref (g->drawable);
+  else /* GDK_IS_WINDOW (g->drawable) */
+    gdk_window_unref (g->drawable);
+
+  gdk_colormap_unref (g->cm);
+
+  gdk_threads_leave ();
+
+  free (g);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_translateNative
+  (JNIEnv *env, jobject obj, jint x, jint y)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  g->x_offset += x;
+  g->y_offset += y;
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawString
+  (JNIEnv *env, jobject obj, jstring str, jint x, jint y, 
+   jstring fname, jint size)
+{
+  struct graphics *g;
+  const char *cfname, *cstr;
+  gchar *xlfd;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+  
+  cfname = (*env)->GetStringUTFChars (env, fname, NULL);
+  xlfd = g_strdup_printf (cfname, (size * 10));
+  (*env)->ReleaseStringUTFChars (env, fname, cfname);
+
+  cstr = (*env)->GetStringUTFChars (env, str, NULL);
+
+  gdk_threads_enter ();
+  gdk_draw_string (g->drawable, gdk_font_load (xlfd), g->gc, 
+                  x + g->x_offset, y + g->y_offset, cstr);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, str, cstr);
+  g_free (xlfd);
+}
+
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawLine
+  (JNIEnv *env, jobject obj, jint x, jint y, jint x2, jint y2)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_draw_line (g->drawable, g->gc, 
+                x + g->x_offset, y + g->y_offset, 
+                x2 + g->x_offset, y2 + g->y_offset);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillRect
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_draw_rectangle (g->drawable, g->gc, TRUE, 
+                     x + g->x_offset, y + g->y_offset, width, height);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawRect
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_draw_rectangle (g->drawable, g->gc, FALSE, 
+                     x + g->x_offset, y + g->y_offset, width, height);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea
+  (JNIEnv *env, jobject obj, jint x, jint y, 
+   jint width, jint height, jint dx, jint dy)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_window_copy_area ((GdkWindow *)g->drawable,
+                       g->gc,
+                       x + g->x_offset + dx, y + g->y_offset + dy,
+                       (GdkWindow *)g->drawable,
+                       x + g->x_offset, y + g->y_offset,
+                       width, height);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap
+  (JNIEnv *env, jobject obj, jobject offscreen, 
+   jint x, jint y, jint width, jint height)
+{
+  struct graphics *g1, *g2;
+
+  g1 = (struct graphics *) NSA_GET_PTR (env, obj);
+  g2 = (struct graphics *) NSA_GET_PTR (env, offscreen);
+
+  gdk_threads_enter ();
+  gdk_window_copy_area ((GdkWindow *)g1->drawable,
+                       g1->gc,
+                       x + g1->x_offset, y + g1->y_offset,
+                       (GdkWindow *)g2->drawable,
+                       0 + g2->x_offset, 0 + g2->y_offset, 
+                       width, height);
+  gdk_threads_leave ();
+}
+  
+
+
+
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_window_clear_area ((GdkWindow *)g->drawable, 
+                        x + g->x_offset, y + g->y_offset, width, height);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFunction
+  (JNIEnv *env, jobject obj, jint func)
+{
+  struct graphics *g;
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  gdk_gc_set_function (g->gc, func);
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setFGColor
+  (JNIEnv *env, jobject obj, jint red, jint green, jint blue)
+{
+  GdkColor color;
+  struct graphics *g;
+
+  color.red = red << 8;
+  color.green = green << 8;
+  color.blue = blue << 8;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  gdk_color_alloc (g->cm, &color);
+  gdk_gc_set_foreground (g->gc, &color);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawArc
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height, 
+   jint angle1, jint angle2)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_draw_arc (g->drawable, g->gc, FALSE, 
+               x + g->x_offset, y + g->y_offset, 
+               width, height, angle1 << 6, angle2 << 6);
+  gdk_threads_leave ();
+}  
+
+GdkPoint *
+translate_points (JNIEnv *env, jintArray xpoints, jintArray ypoints, 
+                 jint npoints, jint x_offset, jint y_offset)
+{
+  GdkPoint *points;
+  jint *x, *y;
+  int i;
+
+  /* allocate one more point than necessary, in case we need to tack
+     on an extra due to the semantics of Java polygons. */
+  points = g_malloc (sizeof (GdkPoint) * (npoints + 1));
+  
+  x = (*env)->GetIntArrayElements (env, xpoints, NULL);
+  y = (*env)->GetIntArrayElements (env, ypoints, NULL);
+
+  for (i = 0; i < npoints; i++)
+    {
+      points[i].x = x[i] + x_offset;
+      points[i].y = y[i] + y_offset;
+    }
+
+  (*env)->ReleaseIntArrayElements (env, xpoints, x, JNI_ABORT);
+  (*env)->ReleaseIntArrayElements (env, ypoints, y, JNI_ABORT);
+
+  return points;
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolyline
+  (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints, 
+   jint npoints)
+{
+  struct graphics *g;
+  GdkPoint *points;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+  points = translate_points (env, xpoints, ypoints, npoints,
+                            g->x_offset, g->y_offset);
+
+  gdk_threads_enter ();
+  gdk_draw_lines (g->drawable, g->gc, points, npoints);
+  gdk_threads_leave ();
+
+  g_free (points);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawPolygon
+  (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints, 
+   jint npoints)
+{
+  struct graphics *g;
+  GdkPoint *points;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+  points = translate_points (env, xpoints, ypoints, npoints,
+                            g->x_offset, g->y_offset);
+
+  /* make sure the polygon is closed, per Java semantics.
+     if it's not, we close it. */
+  if (points[0].x != points[npoints-1].x || points[0].y != points[npoints-1].y)
+    points[npoints++] = points[0];
+
+  gdk_threads_enter ();
+  gdk_draw_lines (g->drawable, g->gc, points, npoints);
+  gdk_threads_leave ();
+
+  g_free (points);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillPolygon
+  (JNIEnv *env, jobject obj, jintArray xpoints, jintArray ypoints, 
+   jint npoints)
+{
+  struct graphics *g;
+  GdkPoint *points;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+  points = translate_points (env, xpoints, ypoints, npoints,
+                            g->x_offset, g->y_offset);
+  gdk_threads_enter ();
+  gdk_draw_polygon (g->drawable, g->gc, TRUE, points, npoints);
+  gdk_threads_leave ();
+
+  g_free (points);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillArc
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height, 
+   jint angle1, jint angle2)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_draw_arc (g->drawable, g->gc, TRUE, 
+               x + g->x_offset, y + g->y_offset, 
+               width, height, angle1 << 6, angle2 << 6);
+  gdk_threads_leave ();
+}  
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_drawOval
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_draw_arc (g->drawable, g->gc, FALSE, 
+               x + g->x_offset, y + g->y_offset, 
+               width, height, 0, 23040);
+  gdk_threads_leave ();
+}  
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_fillOval
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  struct graphics *g;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gdk_draw_arc (g->drawable, g->gc, TRUE, 
+               x + g->x_offset, y + g->y_offset, 
+               width, height, 0, 23040);
+  gdk_threads_leave ();
+}  
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_setClipRectangle
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  struct graphics *g;
+  GdkRectangle rectangle;
+
+  g = (struct graphics *) NSA_GET_PTR (env, obj);
+
+  rectangle.x = x + g->x_offset;
+  rectangle.y = y + g->y_offset;
+  rectangle.width = width;
+  rectangle.height = height;
+
+  gdk_threads_enter ();
+  gdk_gc_set_clip_rectangle (g->gc, &rectangle);
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
new file mode 100644 (file)
index 0000000..ebebc43
--- /dev/null
@@ -0,0 +1,52 @@
+/* gtkbuttonpeer.c -- Native implementation of GtkButtonPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h"
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  gpointer widget;
+
+  gdk_threads_enter ();
+  widget = gtk_type_new (gtk_button_get_type ());
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, widget);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCanvasPeer.c
new file mode 100644 (file)
index 0000000..cc7cfb8
--- /dev/null
@@ -0,0 +1,54 @@
+/* gtkcanvaspeer.c -- Native implementation of GtkCanvasPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkCanvasPeer.h"
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCanvasPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  gpointer widget;
+    
+  gdk_threads_enter ();
+  widget = gtk_type_new (gtk_drawing_area_get_type ());
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, widget);
+}
+
+
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
new file mode 100644 (file)
index 0000000..94b1366
--- /dev/null
@@ -0,0 +1,73 @@
+/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  GtkWidget *widget;
+  const char *str;
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  gdk_threads_enter ();
+  widget = gtk_check_menu_item_new_with_label (str);
+  gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), 1);
+  gtk_widget_show (widget);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+
+  NSA_SET_PTR (env, obj, widget);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_setState
+  (JNIEnv *env, jobject obj, jboolean state)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (ptr), state);
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
new file mode 100644 (file)
index 0000000..09fa7ef
--- /dev/null
@@ -0,0 +1,175 @@
+/* gtkcheckboxpeer.c -- Native implementation of GtkCheckboxPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkCheckboxPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+
+static void item_toggled (GtkToggleButton *item, jobject peer);
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_dispose
+  (JNIEnv *env, jobject obj)
+{
+  /* The actual underlying widget is owned by a different class.  So
+     we just clean up the hash table here.  */
+  NSA_DEL_PTR (env, obj);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxGroupPeer_remove
+  (JNIEnv *env, jobject obj, jobject checkbox)
+{
+  GtkRadioButton *button;
+  void *ptr;
+  GSList *list;
+
+  ptr = NSA_GET_PTR (env, checkbox);
+  gdk_threads_enter ();
+  button = GTK_RADIO_BUTTON (ptr);
+
+  /* Update the group to point to some other widget in the group.  We
+     have to do this because Gtk doesn't have a separate object to
+     represent a radio button's group.  */
+  for (list = gtk_radio_button_group (button); list != NULL;
+       list = list->next)
+    {
+      if (list->data != button)
+       break;
+    }
+
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, list ? list->data : NULL);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeCreate
+  (JNIEnv *env, jobject obj, jobject group)
+{
+  GtkWidget *button;
+
+  gdk_threads_enter ();
+
+  if (group == NULL)
+    button = gtk_check_button_new_with_label ("");
+  else
+    {
+      void *native_group = NSA_GET_PTR (env, group);
+      button = gtk_radio_button_new_with_label_from_widget (native_group, "");
+      if (native_group == NULL)
+       {
+         /* Set the native group so we can use the correct value the
+            next time around.  FIXME: this doesn't work!  */
+         NSA_SET_PTR (env, group, button);
+       }
+    }
+
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, button);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr = NSA_GET_PTR (env, obj);
+  jobject peer;
+
+  gdk_threads_enter ();
+
+  peer = (*env)->NewGlobalRef (env, obj);
+
+  /* FIXME: when the widget goes away, we should get rid of the global
+     reference.  */
+  gtk_signal_connect (GTK_OBJECT (ptr), "toggled",
+                     GTK_SIGNAL_FUNC (item_toggled), peer);
+
+  gdk_threads_leave ();
+
+  /* Connect the superclass hooks.  */
+  Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks (env, obj);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup
+  (JNIEnv *env, jobject obj, jobject group)
+{
+  GtkRadioButton *button;
+  void *native_group, *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  /* FIXME: we can't yet switch between a checkbutton and a
+     radiobutton.  However, AWT requires this.  For now we just
+     crash.  */
+
+  button = GTK_RADIO_BUTTON (ptr);
+
+  native_group = NSA_GET_PTR (env, group);
+  if (native_group == NULL)
+    gtk_radio_button_set_group (button, NULL);
+  else
+    gtk_radio_button_set_group (button,
+                               gtk_radio_button_group 
+                               (GTK_RADIO_BUTTON (native_group)));
+
+  gdk_threads_leave ();
+
+  /* If the native group wasn't set on the new CheckboxGroup, then set
+     it now so that the right thing will happen with the next
+     radiobutton.  The native state for a CheckboxGroup is a pointer
+     to one of the widgets in the group.  We are careful to keep this
+     always pointing at a live widget; whenever a widget is destroyed
+     (or otherwise removed from the group), the CheckboxGroup peer is
+     notified.  */
+  if (native_group == NULL)
+    NSA_SET_PTR (env, group, native_group);
+}
+
+static void
+item_toggled (GtkToggleButton *item, jobject peer)
+{
+  (*gdk_env)->CallVoidMethod (gdk_env, peer,
+                             postItemEventID,
+                             peer,
+                             item->active ?
+                             (jint) AWT_ITEM_SELECTED :
+                             (jint) AWT_ITEM_DESELECTED);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkChoicePeer.c
new file mode 100644 (file)
index 0000000..b3eee27
--- /dev/null
@@ -0,0 +1,204 @@
+/* gtkchoicepeer.c -- Native implementation of GtkChoicePeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkChoicePeer.h"
+
+static void connect_choice_item_selectable_hook (JNIEnv *env, 
+                                                jobject peer_obj, 
+                                                GtkItem *item, 
+                                                jobject item_obj);
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_create 
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *menu;
+  GtkOptionMenu *option_menu;
+  GtkRequisition child_requisition;
+
+  gdk_threads_enter ();
+  option_menu = GTK_OPTION_MENU (gtk_option_menu_new ());
+  menu = gtk_menu_new ();
+  gtk_widget_show (menu);
+
+  gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
+
+  gtk_widget_size_request (gtk_menu_item_new_with_label (""), 
+                          &child_requisition);
+  option_menu->width = child_requisition.width;
+  option_menu->height = child_requisition.height;
+
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, option_menu);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_append 
+  (JNIEnv *env, jobject obj, jobjectArray items)
+{
+  gpointer ptr;
+  GtkMenu *menu;
+  jsize count, i;
+  int need_set_history = 0;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr)));
+
+  if (!gtk_container_children (GTK_CONTAINER (menu)))
+      need_set_history = 1;
+
+  count = (*env)->GetArrayLength (env, items);
+
+  for (i = 0; i < count; i++) 
+    {
+      jobject item;
+      const char *label;
+      GtkWidget *menuitem;
+
+      item = (*env)->GetObjectArrayElement (env, items, i);
+      label = (*env)->GetStringUTFChars (env, item, NULL);
+
+      menuitem = gtk_menu_item_new_with_label (label);
+
+      (*env)->ReleaseStringUTFChars (env, item, label);
+
+      gtk_menu_append (menu, menuitem);
+      gtk_widget_show (menuitem);
+
+      connect_choice_item_selectable_hook (env, obj, 
+                                          GTK_ITEM (menuitem), item);
+    }
+  
+  if (need_set_history)
+    gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_add 
+  (JNIEnv *env, jobject obj, jstring item, jint index)
+{
+  void *ptr;
+  const char *label;
+  GtkWidget *menu, *menuitem;
+  int need_set_history = 0;
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  label = (*env)->GetStringUTFChars (env, item, 0);      
+
+  gdk_threads_enter ();
+  menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr));
+
+  if (!gtk_container_children (GTK_CONTAINER (menu)))
+      need_set_history = 1;
+
+  menuitem = gtk_menu_item_new_with_label (label);
+  gtk_menu_insert (GTK_MENU (menu), menuitem, index);
+  gtk_widget_show (menuitem);
+  connect_choice_item_selectable_hook (env, obj, GTK_ITEM (menuitem), item);
+
+  if (need_set_history)
+    gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), 0);
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, item, label);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_remove 
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GtkContainer *menu;
+  GList *children;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  menu = GTK_CONTAINER (gtk_option_menu_get_menu (GTK_OPTION_MENU (ptr)));
+  children = gtk_container_children (menu);
+  gtk_container_remove (menu, GTK_WIDGET (g_list_nth (children, index)->data));
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkChoicePeer_select 
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_option_menu_set_history (GTK_OPTION_MENU (ptr), index);
+  gdk_threads_leave ();
+}
+
+
+static void
+item_activate (GtkItem *item, struct item_event_hook_info *ie)
+{
+  gdk_threads_leave ();
+  (*gdk_env)->CallVoidMethod (gdk_env, ie->peer_obj,
+                             postItemEventID,
+                             ie->item_obj,
+                             (jint) AWT_ITEM_SELECTED);
+  gdk_threads_enter ();
+}
+
+static void
+connect_choice_item_selectable_hook (JNIEnv *env, jobject peer_obj, 
+                                    GtkItem *item, jobject item_obj)
+{
+  struct item_event_hook_info *ie;
+
+  ie = (struct item_event_hook_info *) 
+    malloc (sizeof (struct item_event_hook_info));
+
+  ie->peer_obj = (*env)->NewGlobalRef (env, peer_obj);
+  ie->item_obj = (*env)->NewGlobalRef (env, item_obj);
+
+  gtk_signal_connect (GTK_OBJECT (item), "activate", 
+                     GTK_SIGNAL_FUNC (item_activate), ie);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkClipboard.c
new file mode 100644 (file)
index 0000000..7c6beec
--- /dev/null
@@ -0,0 +1,180 @@
+/* gtkclipboard.c
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkClipboard.h"
+
+jmethodID stringSelectionReceivedID;
+jmethodID stringSelectionHandlerID;
+jmethodID selectionClearID;
+
+void selection_received (GtkWidget *, GtkSelectionData *, guint, gpointer);
+void selection_get (GtkWidget *, GtkSelectionData *, guint, guint, gpointer);
+gint selection_clear (GtkWidget *, GdkEventSelection *);
+
+GtkWidget *clipboard;
+jobject cb_obj;
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkClipboard_initNativeState (JNIEnv *env, 
+                                                        jobject obj)
+{
+  if (!stringSelectionReceivedID)
+    {
+      jclass gtkclipboard;
+
+      gtkclipboard = (*env)->FindClass (env, 
+                                       "gnu/java/awt/peer/gtk/GtkClipboard");
+      stringSelectionReceivedID = (*env)->GetMethodID (env, gtkclipboard,
+                                                   "stringSelectionReceived",
+                                                   "(Ljava/lang/String;)V");
+      stringSelectionHandlerID = (*env)->GetMethodID (env, gtkclipboard,
+                                                     "stringSelectionHandler",
+                                                     "()Ljava/lang/String;");
+      selectionClearID = (*env)->GetMethodID (env, gtkclipboard,
+                                             "selectionClear", "()V");
+    }
+
+  cb_obj = (*env)->NewGlobalRef (env, obj);
+
+  gdk_threads_enter ();
+  clipboard = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+  gtk_signal_connect (GTK_OBJECT(clipboard), "selection_received",
+                     GTK_SIGNAL_FUNC (selection_received), NULL);
+
+  gtk_signal_connect (GTK_OBJECT(clipboard), "selection_clear_event",
+                     GTK_SIGNAL_FUNC (selection_clear), NULL);
+
+  gtk_selection_add_target (clipboard, GDK_SELECTION_PRIMARY, 
+                           GDK_TARGET_STRING, GDK_TARGET_STRING);
+
+  gtk_signal_connect (GTK_OBJECT(clipboard), "selection_get",
+                      GTK_SIGNAL_FUNC (selection_get), NULL);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkClipboard_requestStringConversion (JNIEnv *env, 
+                                                                jclass clazz)
+{
+  gdk_threads_enter ();
+  gtk_selection_convert (clipboard, GDK_SELECTION_PRIMARY, 
+                        GDK_TARGET_STRING, GDK_CURRENT_TIME);
+  gdk_threads_leave ();
+}
+
+void
+selection_received (GtkWidget *widget, GtkSelectionData *selection_data, 
+                   guint time, gpointer data)
+{
+  /* Check to see if retrieval succeeded  */
+  if (selection_data->length < 0
+      || selection_data->type != GDK_SELECTION_TYPE_STRING)
+    {
+      (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
+                                 NULL);
+    }
+  else
+    {
+      char *str = (char *) selection_data->data;
+      
+      (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, stringSelectionReceivedID,
+                                 (*gdk_env)->NewStringUTF (gdk_env, str));
+    }
+
+  return;
+}
+
+void
+selection_get (GtkWidget *widget, 
+               GtkSelectionData *selection_data,
+               guint      info,
+               guint      time,
+               gpointer   data)
+{
+  jstring jstr;
+  const char *utf;
+  jsize utflen;
+
+  jstr = (*gdk_env)->CallObjectMethod (gdk_env, cb_obj, 
+                                      stringSelectionHandlerID);
+
+  if (!jstr)
+    {
+      gtk_selection_data_set (selection_data, 
+                             GDK_TARGET_STRING, 8, NULL, 0);
+      return;
+    }
+
+  utflen = (*gdk_env)->GetStringUTFLength (gdk_env, jstr);
+  utf = (*gdk_env)->GetStringUTFChars (gdk_env, jstr, NULL);
+
+  gtk_selection_data_set (selection_data, GDK_TARGET_STRING, 8, 
+                         (char *)utf, utflen);
+
+  (*gdk_env)->ReleaseStringUTFChars (gdk_env, jstr, utf);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkClipboard_selectionGet (JNIEnv *env, 
+                                                     jclass clazz)
+{
+  GdkWindow *owner;
+
+  gdk_threads_enter ();
+
+  /* if we already own the clipboard, we need to tell the old data object
+     that we're no longer going to be using him */
+  owner = gdk_selection_owner_get (GDK_SELECTION_PRIMARY);
+  if (owner && owner == clipboard->window)
+    (*env)->CallVoidMethod (env, cb_obj, selectionClearID);
+    
+  gtk_selection_owner_set (clipboard, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME);
+
+  gdk_threads_leave ();
+}
+
+gint
+selection_clear (GtkWidget *widget, GdkEventSelection *event)
+{
+  (*gdk_env)->CallVoidMethod (gdk_env, cb_obj, selectionClearID);
+
+  return TRUE;
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
new file mode 100644 (file)
index 0000000..5522354
--- /dev/null
@@ -0,0 +1,649 @@
+/* gtkcomponentpeer.c -- Native implementation of GtkComponentPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+#include <gtk/gtkprivate.h>
+
+#define GTK_OBJECT_SETV(ptr, arg)                \
+  gdk_threads_enter ();                          \
+  {                                              \
+    GtkArgInfo *info = NULL;                     \
+    char *error;                                 \
+                                                 \
+    error = gtk_object_arg_get_info (GTK_OBJECT_TYPE (ptr), arg.name, &info); \
+    if (error)                                   \
+      {                                          \
+       /* assume the argument is destined for the container's only child */ \
+       ptr = gtk_container_children (GTK_CONTAINER (ptr))->data;            \
+      }                                          \
+    gtk_object_setv (GTK_OBJECT (ptr), 1, &arg); \
+  }                                              \
+  gdk_threads_leave ();                          \
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  ptr = NSA_DEL_PTR (env, obj);
+
+  /* For now the native state for any object must be a widget.
+     However, a subclass could override dispose() if required.  */
+  gdk_threads_enter ();
+  gtk_widget_destroy (GTK_WIDGET (ptr));
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetCursor 
+  (JNIEnv *env, jobject obj, jint type) 
+{
+  void *ptr;
+  GtkWidget *widget;
+  GdkCursorType gdk_cursor_type;
+  GdkCursor *gdk_cursor;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  switch (type)
+    {
+    case AWT_CROSSHAIR_CURSOR:
+      gdk_cursor_type = GDK_CROSSHAIR;
+      break;
+    case AWT_TEXT_CURSOR:
+      gdk_cursor_type = GDK_XTERM;
+      break;
+    case AWT_WAIT_CURSOR:
+      gdk_cursor_type = GDK_WATCH;
+      break;
+    case AWT_SW_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_LEFT_CORNER;
+      break;
+    case AWT_SE_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_RIGHT_CORNER;
+      break;
+    case AWT_NW_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_LEFT_CORNER;
+      break;
+    case AWT_NE_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_RIGHT_CORNER;
+      break;
+    case AWT_N_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_TOP_SIDE;
+      break;
+    case AWT_S_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_BOTTOM_SIDE;
+      break;
+    case AWT_W_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_LEFT_SIDE;
+      break;
+    case AWT_E_RESIZE_CURSOR:
+      gdk_cursor_type = GDK_RIGHT_SIDE;
+      break;
+    case AWT_HAND_CURSOR:
+      gdk_cursor_type = GDK_HAND2;
+      break;
+    case AWT_MOVE_CURSOR:
+      gdk_cursor_type = GDK_FLEUR;
+      break;
+    default:
+      gdk_cursor_type = GDK_LEFT_PTR;
+    }
+      
+  gdk_threads_enter ();
+
+  widget = GTK_WIDGET(ptr);
+
+  gdk_cursor = gdk_cursor_new (gdk_cursor_type);
+  gdk_window_set_cursor (widget->window, gdk_cursor);
+  gdk_cursor_destroy (gdk_cursor);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_requestFocus
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  gtk_widget_grab_focus (GTK_WIDGET (ptr));
+  gdk_threads_leave ();
+}
+
+
+/*
+ * Show a widget (NO LONGER USED)
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setVisible
+  (JNIEnv *env, jobject obj, jboolean visible)
+{
+  GtkWidget *widget;
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  widget = GTK_WIDGET (ptr);
+
+  if (visible)
+    gtk_widget_show (widget);
+  else
+    gtk_widget_hide (widget);
+
+  gdk_flush ();
+  gdk_threads_leave ();
+}
+
+/*
+ * Find the origin of a widget's window.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetLocationOnScreen
+  (JNIEnv * env, jobject obj, jintArray jpoint)
+{
+  void *ptr;
+  jint *point;
+
+  ptr = NSA_GET_PTR (env, obj);
+  point = (*env)->GetIntArrayElements (env, jpoint, 0);
+
+  gdk_threads_enter ();
+  gdk_window_get_origin (GTK_WIDGET (ptr)->window, point, point+1);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements(env, jpoint, point, 0);
+}
+
+/*
+ * Find the preferred size of a widget.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetDimensions
+    (JNIEnv *env, jobject obj, jintArray jdims)
+{
+    void *ptr;
+    jint *dims;
+    GtkRequisition req;
+
+    ptr = NSA_GET_PTR (env, obj);
+    dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+
+    gdk_threads_enter ();
+
+    gtk_signal_emit_by_name (GTK_OBJECT (ptr), "size_request", &req);
+
+    dims[0] = req.width;
+    dims[1] = req.height;
+
+    gdk_threads_leave ();
+
+    (*env)->ReleaseIntArrayElements(env, jdims, dims, 0);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetUsize (JNIEnv *env, 
+    jobject obj, jint w, jint h)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  gtk_widget_set_usize (GTK_WIDGET (ptr), w, h);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedNew (JNIEnv *env, 
+    jobject obj, jint width, jint height, jboolean visible)
+{
+  GtkWidget *layout;
+
+  gdk_threads_enter ();
+  layout = gtk_layout_new (NULL, NULL);
+  gtk_widget_realize (layout);
+  connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
+  set_visible (layout, visible);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, layout);
+}
+
+/*
+ * Place a widget on the layout widget. 
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedPut 
+    (JNIEnv *env, jobject obj, jobject container, jint x, jint y)
+{
+  GList *child;
+  GtkWidget *fix;
+  void *containerptr=NULL;
+  void *objptr=NULL;
+
+  /* We hawe a container which, if it is a window, will have
+     this component added to its fixed.  If it is a fixed, we add the
+     component to it. */
+  
+  containerptr=NSA_GET_PTR (env, container);
+  objptr=NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  if (GTK_IS_WINDOW(GTK_OBJECT(containerptr)))
+    {
+      child=gtk_container_children (GTK_CONTAINER(containerptr));
+      
+      while (child && !GTK_IS_FIXED(child->data))
+       {
+         child=g_list_next(child);
+       }
+      
+      fix=GTK_WIDGET(child->data);
+      g_list_free(child);
+    }
+  else
+    if (GTK_IS_SCROLLED_WINDOW(GTK_OBJECT(containerptr)))
+    {
+      child=gtk_container_children (GTK_CONTAINER (GTK_BIN(containerptr)->child));
+      
+      while (child && !GTK_IS_FIXED(child->data))
+       {
+         child=g_list_next(child);
+       }
+      
+      fix=GTK_WIDGET(child->data);
+
+      g_list_free(child);
+    }
+  else
+    {
+      fix=GTK_WIDGET(containerptr);
+    }
+  
+  gtk_fixed_put(GTK_FIXED(fix),GTK_WIDGET(objptr),x,y);
+  gtk_widget_realize (GTK_WIDGET (objptr));
+  gtk_widget_show (GTK_WIDGET (objptr));
+  
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkFixedMove (JNIEnv *env, 
+    jobject obj, jint x, jint y)
+{
+  GtkWidget *widget;
+  void *ptr=NULL;
+
+  /* For some reason, ScrolledWindow tries to scroll its contents
+     by moving them using this function.  Since we want to use GTK's
+     nice fast scrolling, we try to second guess it here.  This
+     might cause problems later.  */
+  
+  if (x >= 0 && y >= 0) 
+    {
+      ptr = NSA_GET_PTR (env, obj);
+      
+      gdk_threads_enter ();
+      widget=GTK_WIDGET (ptr);
+      if (!GTK_IS_WINDOW (widget))
+         gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
+      gdk_threads_leave ();
+    }
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  GtkWidget *widget;
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  widget = GTK_WIDGET (ptr);
+  if (GTK_IS_VIEWPORT (widget->parent))
+    {
+      gtk_widget_set_usize (widget, width, height);
+    }
+  else
+    {
+      gtk_widget_set_usize (widget, width, height);
+      gtk_layout_move (GTK_LAYOUT (widget->parent), widget, x, y);
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetBackground
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jintArray array;
+  int *rgb;
+  GdkColor bg;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  bg = GTK_WIDGET (ptr)->style->bg[GTK_STATE_NORMAL];
+  gdk_threads_leave ();
+
+  array = (*env)->NewIntArray (env, 3);
+  rgb = (*env)->GetIntArrayElements (env, array, NULL);
+  /* convert color data from 16 bit values down to 8 bit values */
+  rgb[0] = bg.red   >> 8;
+  rgb[1] = bg.green >> 8;
+  rgb[2] = bg.blue  >> 8;
+  (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
+
+  return array;
+}
+
+JNIEXPORT jintArray JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetGetForeground
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jintArray array;
+  jint *rgb;
+  GdkColor fg;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  fg = GTK_WIDGET (ptr)->style->fg[GTK_STATE_NORMAL];
+  gdk_threads_leave ();
+
+  array = (*env)->NewIntArray (env, 3);
+  rgb = (*env)->GetIntArrayElements (env, array, NULL);
+  /* convert color data from 16 bit values down to 8 bit values */
+  rgb[0] = fg.red   >> 8;
+  rgb[1] = fg.green >> 8;
+  rgb[2] = fg.blue  >> 8;
+  (*env)->ReleaseIntArrayElements (env, array, rgb, 0);
+
+  return array;
+}
+
+void
+set_visible (GtkWidget *widget, jboolean visible)
+{
+  if (visible)
+    gtk_widget_show (widget);
+  else
+    gtk_widget_hide (widget);
+}
+
+GtkLayout *
+find_gtk_layout (GtkWidget *parent)
+{
+  if (GTK_IS_WINDOW (parent))
+    {
+      GList *children = gtk_container_children 
+                         (GTK_CONTAINER (GTK_BIN (parent)->child));
+
+      if (GTK_IS_MENU_BAR (children->data))
+       return GTK_LAYOUT (children->next->data);
+      else /* GTK_IS_LAYOUT (children->data) */
+       return GTK_LAYOUT (children->data);
+    }
+
+  return NULL;
+}
+
+#define WIDGET_CLASS(w)  GTK_WIDGET_CLASS (GTK_OBJECT (w)->klass)
+
+void
+set_parent (GtkWidget *widget, GtkContainer *parent)
+{
+  if (GTK_IS_WINDOW (parent))
+    {
+      GList *children = gtk_container_children 
+                         (GTK_CONTAINER (GTK_BIN (parent)->child));
+
+      if (GTK_IS_MENU_BAR (children->data))
+       gtk_layout_put (GTK_LAYOUT (children->next->data), widget, 0, 0);
+      else /* GTK_IS_LAYOUT (children->data) */
+       gtk_layout_put (GTK_LAYOUT (children->data), widget, 0, 0);
+    }
+  else
+    if (GTK_IS_SCROLLED_WINDOW (parent))
+      {
+/*     if (WIDGET_CLASS (widget)->set_scroll_adjustments_signal) */
+/*       gtk_container_add (GTK_CONTAINER (parent), widget); */
+/*     else */
+/*       { */
+           gtk_scrolled_window_add_with_viewport 
+             (GTK_SCROLLED_WINDOW (parent), widget);
+           gtk_viewport_set_shadow_type (GTK_VIEWPORT (widget->parent), 
+                                         GTK_SHADOW_NONE);
+/*       } */
+
+      }
+/*        gtk_layout_put  */
+/*     (GTK_LAYOUT (GTK_BIN (parent)->child), widget, 0, 0); */
+
+/*      if (GTK_IS_SCROLLED_WINDOW (parent)) */
+/*        gtk_layout_put  */
+/*     (GTK_LAYOUT (GTK_BIN (GTK_BIN (parent)->child)->child), widget, 0, 0); */
+    else
+      gtk_layout_put (GTK_LAYOUT (parent), widget, 0, 0);
+}
+
+JNIEXPORT jboolean JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled 
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  jboolean ret_val;
+  
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  ret_val = GTK_WIDGET_IS_SENSITIVE (GTK_WIDGET (ptr));
+  gdk_threads_leave ();
+
+  return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_modalHasGrab
+  (JNIEnv *env, jclass clazz)
+{
+  GtkWidget *widget;
+  jboolean retval;
+
+  gdk_threads_enter ();
+  widget = gtk_grab_get_current ();
+  retval = (widget && GTK_IS_WINDOW (widget) && GTK_WINDOW (widget)->modal);
+  gdk_threads_leave ();
+
+  return retval;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_String_2
+  (JNIEnv *env, jobject obj, jstring jname, jstring jvalue)
+{
+  const char *name;
+  const char *value;
+  void *ptr;
+  GtkArg arg;
+
+  ptr = NSA_GET_PTR (env, obj);
+  name = (*env)->GetStringUTFChars (env, jname, NULL);
+  value = (*env)->GetStringUTFChars (env, jvalue, NULL);
+
+  arg.type = GTK_TYPE_STRING;
+  arg.name = (char *) name;
+  GTK_VALUE_STRING (arg) = (char *) value;
+
+  GTK_OBJECT_SETV (ptr, arg);  
+
+  (*env)->ReleaseStringUTFChars (env, jname, name);
+  (*env)->ReleaseStringUTFChars (env, jvalue, value);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Z
+  (JNIEnv *env, jobject obj, jstring jname, jboolean value)
+{
+  const char *name;
+  void *ptr;
+  GtkArg arg;
+
+  ptr = NSA_GET_PTR (env, obj);
+  name = (*env)->GetStringUTFChars (env, jname, NULL);
+
+  arg.type = GTK_TYPE_BOOL;
+  arg.name = (char *) name;
+  GTK_VALUE_BOOL (arg) = value;
+
+  GTK_OBJECT_SETV (ptr, arg);  
+
+  (*env)->ReleaseStringUTFChars (env, jname, name);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2I
+  (JNIEnv *env, jobject obj, jstring jname, jint value)
+{
+  const char *name;
+  void *ptr;
+  GtkArg arg;
+
+  ptr = NSA_GET_PTR (env, obj);
+  name = (*env)->GetStringUTFChars (env, jname, NULL);
+
+  arg.type = GTK_TYPE_INT;
+  arg.name = (char *) name;
+  GTK_VALUE_INT (arg) = value;
+  
+  GTK_OBJECT_SETV (ptr, arg);  
+
+  (*env)->ReleaseStringUTFChars (env, jname, name);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2F
+  (JNIEnv *env, jobject obj, jstring jname, jfloat value)
+{
+  const char *name;
+  void *ptr;
+  GtkArg arg;
+
+  ptr = NSA_GET_PTR (env, obj);
+  name = (*env)->GetStringUTFChars (env, jname, NULL);
+
+  arg.type = GTK_TYPE_FLOAT;
+  arg.name = (char *) name;
+  GTK_VALUE_FLOAT (arg) = value;
+  
+  GTK_OBJECT_SETV (ptr, arg);  
+
+  (*env)->ReleaseStringUTFChars (env, jname, name);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkComponentPeer_set__Ljava_lang_String_2Ljava_lang_Object_2
+  (JNIEnv *env, jobject obj1, jstring jname, jobject obj2)
+{
+  const char *name;
+  void *ptr1, *ptr2;
+  GtkArg arg;
+
+  ptr1 = NSA_GET_PTR (env, obj1);
+  ptr2 = NSA_GET_PTR (env, obj2);
+  
+  name = (*env)->GetStringUTFChars (env, jname, NULL);
+
+  /* special case to catch where we need to set the parent */
+  if (!strcmp (name, "parent"))
+    {
+      gdk_threads_enter ();
+      set_parent (GTK_WIDGET (ptr1), GTK_CONTAINER (ptr2));
+      gdk_threads_leave ();
+
+      (*env)->ReleaseStringUTFChars (env, jname, name);
+      return;
+    }
+
+  arg.type = GTK_TYPE_OBJECT;
+  arg.name = (char *) name;
+  GTK_VALUE_OBJECT (arg) = GTK_OBJECT (ptr2);
+  
+  GTK_OBJECT_SETV (ptr1, arg);  
+
+  (*env)->ReleaseStringUTFChars (env, jname, name);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_create
+  (JNIEnv *env, jobject obj, jstring jtypename)
+{
+  const char *typename;
+  gpointer widget;
+
+  typename = (*env)->GetStringUTFChars (env, jtypename, NULL);
+
+  gdk_threads_enter ();
+  gtk_button_get_type ();
+  widget = gtk_object_newv (gtk_type_from_name (typename),
+                           0, NULL);
+/*    widget = gtk_type_new (gtk_type_from_name (typename)); */
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, jtypename, typename);
+  NSA_SET_PTR (env, obj, widget);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_widget_realize (GTK_WIDGET (ptr));
+  connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
new file mode 100644 (file)
index 0000000..99ca093
--- /dev/null
@@ -0,0 +1,552 @@
+/* gtkevents.c -- GDK/GTK event handlers
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include <X11/Xlib.h>
+#include <gdk/gdkkeysyms.h>
+#include <stdarg.h>
+#include <assert.h>
+
+/* A widget can be composed of multipled windows, so we need to hook
+   events on all of them. */
+struct event_hook_info
+{
+  jobject *peer_obj;
+  int nwindows;
+  GdkWindow ***windows;                /* array of pointers to (GdkWindow *) */
+};
+
+static jint
+button_to_awt_mods (int button)
+{
+  switch (button)
+    {
+    case 1:
+      return AWT_BUTTON1_MASK;
+    case 2:
+      return AWT_BUTTON2_MASK;
+    case 3:
+      return AWT_BUTTON3_MASK;
+    }
+
+  return 0;
+}
+
+static jint
+state_to_awt_mods (int mods)
+{
+  jint result = 0;
+
+  if (mods & (GDK_SHIFT_MASK | GDK_LOCK_MASK))
+    result |= AWT_SHIFT_MASK;
+  if (mods & GDK_CONTROL_MASK)
+    result |= AWT_CTRL_MASK;
+  
+  return result;
+}
+
+#ifdef __GNUC__
+__inline
+#endif
+static jint
+keysym_to_awt_keycode (guint keyval)
+{
+  guint vk;
+
+  vk = gdk_keyval_to_upper (keyval);
+
+  if (vk <= 0x41 && vk <= 0x5A)        /* VK_A through VK_Z */
+    return vk;
+
+  if (vk <= 0x30 && vk <= 39)  /* VK_0 through VK_9 */
+    return vk;
+
+  switch (vk)
+    {
+    case GDK_Alt_L:
+    case GDK_Alt_R:
+      return VK_ALT;
+    case GDK_BackSpace:
+      return VK_BACK_SPACE;
+    case GDK_Cancel:
+      return VK_CANCEL;
+    case GDK_Caps_Lock:
+      return VK_CAPS_LOCK;
+    case GDK_Clear:
+      return VK_CLEAR;
+    case GDK_bracketright:
+      return VK_CLOSE_BRACKET;
+    case GDK_comma:
+      return VK_COMMA;
+    case GDK_Control_L:
+    case GDK_Control_R:
+      return VK_CONTROL;
+    case GDK_KP_Decimal:
+      return VK_DECIMAL;
+    case GDK_Delete:
+      return VK_DELETE;
+    case GDK_KP_Divide:
+      return VK_DIVIDE;
+    case GDK_Down:
+      return VK_DOWN;
+    case GDK_End:
+      return VK_END;
+    case GDK_Return:
+      return VK_ENTER;
+    case GDK_Escape:
+      return VK_ESCAPE;
+    case GDK_F1:
+      return VK_F1;
+    case GDK_F2:
+      return VK_F2;
+    case GDK_F3:
+      return VK_F3;
+    case GDK_F4:
+      return VK_F4;
+    case GDK_F5:
+      return VK_F5;
+    case GDK_F6:
+      return VK_F6;
+    case GDK_F7:
+      return VK_F7;
+    case GDK_F8:
+      return VK_F8;
+    case GDK_F9:
+      return VK_F9;
+    case GDK_F10:
+      return VK_F10;
+    case GDK_F11:
+      return VK_F11;
+    case GDK_F12:
+      return VK_F12;
+    case GDK_Help:
+      return VK_HELP;
+    case GDK_Home:
+      return VK_HOME;
+    case GDK_Insert:
+      return VK_INSERT;
+    case GDK_Kanji:
+      return VK_KANJI;
+    case GDK_Left:
+      return VK_LEFT;
+    case GDK_Meta_L:
+    case GDK_Meta_R:
+      return VK_META;
+    case GDK_KP_Multiply:
+      return VK_MULTIPLY;
+    case GDK_Num_Lock:
+      return VK_NUM_LOCK;
+    case GDK_KP_0:
+      return VK_NUMPAD0;
+    case GDK_KP_1:
+      return VK_NUMPAD1;
+    case GDK_KP_2:
+      return VK_NUMPAD2;
+    case GDK_KP_3:
+      return VK_NUMPAD3;
+    case GDK_KP_4:
+      return VK_NUMPAD4;
+    case GDK_KP_5:
+      return VK_NUMPAD5;
+    case GDK_KP_6:
+      return VK_NUMPAD6;
+    case GDK_KP_7:
+      return VK_NUMPAD7;
+    case GDK_KP_8:
+      return VK_NUMPAD8;
+    case GDK_KP_9:
+      return VK_NUMPAD9;
+    case GDK_bracketleft:
+      return VK_OPEN_BRACKET;
+    case GDK_Page_Down:
+      return VK_PAGE_DOWN;
+    case GDK_Page_Up:
+      return VK_PAGE_UP;
+    case GDK_Pause:
+      return VK_PAUSE;
+    case GDK_period:
+      return VK_PERIOD;
+    case GDK_Print:
+      return VK_PRINTSCREEN;
+    case GDK_quoteright:
+      return VK_QUOTE;
+    case GDK_Right:
+      return VK_RIGHT;
+    case GDK_Scroll_Lock:
+      return VK_SCROLL_LOCK;
+    case GDK_semicolon:
+      return VK_SEMICOLON;
+    case GDK_KP_Separator:
+      return VK_SEPARATOR;
+    case GDK_Shift_L:
+    case GDK_Shift_R:
+      return VK_SHIFT;
+    case GDK_slash:
+      return VK_SLASH;
+    case GDK_space:
+      return VK_SPACE;
+    case GDK_KP_Subtract:
+      return VK_SUBTRACT;
+    case GDK_Tab:
+      return VK_TAB;
+    case GDK_Up:
+      return VK_UP;
+
+    default:
+      return VK_UNDEFINED;
+    }
+}
+
+void
+awt_event_handler (GdkEvent *event)
+{
+  jobject *obj_ptr;
+  static guint32 button_click_time = 0;
+  static GdkWindow *button_window = NULL;
+  static guint button_number = -1;
+  static jint click_count = 1;
+
+  /* keep synthetic AWT events from being processed recursively */
+  if (event->type & SYNTHETIC_EVENT_MASK && event->type != GDK_NOTHING)
+    {
+      event->type ^= SYNTHETIC_EVENT_MASK;
+      gtk_main_do_event (event);
+      return;
+    }
+
+  /* keep track of clickCount ourselves, since the AWT allows more
+     than a triple click to occur */
+  if (event->type == GDK_BUTTON_PRESS)
+    {
+      if ((event->button.time < (button_click_time + MULTI_CLICK_TIME))
+         && (event->button.window == button_window)
+         && (event->button.button == button_number))
+       click_count++;
+      else
+       click_count = 1;
+      
+      button_click_time = event->button.time;
+      button_window = event->button.window;
+      button_number = event->button.button;
+    }
+
+  /* for all input events, which have a window with a jobject attached,
+     send the input event off to Java before GTK has a chance to process
+     the event */
+  if ((event->type == GDK_BUTTON_PRESS
+       || event->type == GDK_BUTTON_RELEASE
+       || event->type == GDK_ENTER_NOTIFY
+       || event->type == GDK_LEAVE_NOTIFY
+       || event->type == GDK_CONFIGURE
+       || event->type == GDK_EXPOSE
+       || event->type == GDK_KEY_PRESS
+       || event->type == GDK_FOCUS_CHANGE
+       || event->type == GDK_MOTION_NOTIFY)
+      && gdk_property_get (event->any.window,
+                          gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE),
+                          gdk_atom_intern ("CARDINAL", FALSE),
+                          0,
+                          sizeof (jobject),
+                          FALSE,
+                          NULL,
+                          NULL,
+                          NULL,
+                          (guchar **)&obj_ptr))
+    {
+      switch (event->type)
+       {
+       case GDK_BUTTON_PRESS:
+         (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
+                                     AWT_MOUSE_PRESSED, 
+                                     (jlong)event->button.time,
+                                   state_to_awt_mods (event->button.state) |
+                                   button_to_awt_mods (event->button.button), 
+                                     (jint)event->button.x,
+                                     (jint)event->button.y, 
+                                     click_count, 
+                                     (event->button.button == 3) ? JNI_TRUE :
+                                                                   JNI_FALSE);
+
+         /*      grab_counter++;
+         gdk_pointer_grab (event->any.window,
+                           FALSE,
+                           GDK_POINTER_MOTION_MASK |
+                           GDK_BUTTON_MOTION_MASK |
+                           GDK_BUTTON_PRESS_MASK |
+                           GDK_BUTTON_RELEASE_MASK |
+                           GDK_ENTER_NOTIFY_MASK |
+                           GDK_LEAVE_NOTIFY_MASK,
+                           NULL,
+                           NULL,
+                           event->button.time);*/
+         break;
+       case GDK_BUTTON_RELEASE:
+         {
+           int width, height;
+
+           /* only ungrab if no other buttons are pressed down */
+           /*      if (--grab_counter == 0)
+             gdk_pointer_ungrab (event->button.time);
+           */
+           (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
+                                       AWT_MOUSE_RELEASED, 
+                                       (jlong)event->button.time,
+                                   state_to_awt_mods (event->button.state) |
+                                   button_to_awt_mods (event->button.button), 
+                                       (jint)event->button.x,
+                                       (jint)event->button.y, 
+                                       click_count, JNI_FALSE);
+
+           /* check to see if the release occured in the window it was pressed
+              in, and if so, generate an AWT click event */
+           gdk_window_get_size (event->any.window, &width, &height);
+           if (event->button.x >= 0
+               && event->button.y >= 0
+               && event->button.x <= width 
+               && event->button.y <= height)
+             (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
+                                         AWT_MOUSE_CLICKED, 
+                                         (jlong)event->button.time,
+                                  state_to_awt_mods (event->button.state) |
+                                 button_to_awt_mods (event->button.button), 
+                                         (jint)event->button.x,
+                                         (jint)event->button.y, 
+                                         click_count, JNI_FALSE);
+           
+         }
+         break;
+       case GDK_MOTION_NOTIFY:
+         (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
+                                     AWT_MOUSE_MOVED,
+                                     (jlong)event->motion.time,
+                                     state_to_awt_mods (event->motion.state),
+                                     (jint)event->motion.x,
+                                     (jint)event->motion.y,
+                                     0, JNI_FALSE);
+
+         if (event->motion.state & (GDK_BUTTON1_MASK
+                                    | GDK_BUTTON2_MASK
+                                    | GDK_BUTTON3_MASK
+                                    | GDK_BUTTON4_MASK
+                                    | GDK_BUTTON5_MASK))
+           {
+             (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
+                                         AWT_MOUSE_DRAGGED,
+                                         (jlong)event->motion.time,
+                                     state_to_awt_mods (event->motion.state),
+                                         (jint)event->motion.x,
+                                         (jint)event->motion.y,
+                                         0, JNI_FALSE);
+           }
+         break;
+       case GDK_ENTER_NOTIFY:
+         (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
+                                     AWT_MOUSE_ENTERED, 
+                                     (jlong)event->crossing.time,
+                                   state_to_awt_mods (event->crossing.state), 
+                                     (jint)event->crossing.x,
+                                     (jint)event->crossing.y, 
+                                     0, JNI_FALSE);
+         break;
+       case GDK_LEAVE_NOTIFY:
+         if (event->crossing.mode == GDK_CROSSING_NORMAL)
+           (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, postMouseEventID,
+                                       AWT_MOUSE_EXITED, 
+                                       (jlong)event->crossing.time,
+                                   state_to_awt_mods (event->crossing.state),
+                                       (jint)event->crossing.x,
+                                       (jint)event->crossing.y, 
+                                       0, JNI_FALSE);
+         break;
+       case GDK_CONFIGURE:
+         {
+           GtkWidget *widget;
+
+           gdk_window_get_user_data (event->any.window, (void **) &widget);
+           
+           if (widget && GTK_WIDGET_TOPLEVEL (widget))
+             {
+               gint top, left, right, bottom;
+               gint x, y, w, h, wb, d;
+
+               /* calculate our insets */
+               gdk_window_get_root_geometry (event->any.window, 
+                                             &x, &y, &w, &h, &wb, &d);
+
+               /* We used to compute these based on the configure
+                  event's fields.  However, that gives strange and
+                  apparently incorrect results.  */
+               top = left = bottom = right = 0;
+
+               /* configure events are not posted to the AWT event queue,
+                  and as such, gdk/gtk will be called back before
+                  postConfigureEvent returns */
+               gdk_threads_leave ();
+               (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr, 
+                                           postConfigureEventID,
+                                           (jint)event->configure.x,
+                                           (jint)event->configure.y,
+                                           (jint)event->configure.width,
+                                           (jint)event->configure.height,
+                                           (jint)top,
+                                           (jint)left,
+                                           (jint)bottom,
+                                           (jint)right);
+               gdk_threads_enter ();
+             }
+         }
+         break;
+       case GDK_EXPOSE:
+         {
+           (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
+                                       postExposeEventID,
+                                       (jint)event->expose.area.x,
+                                       (jint)event->expose.area.y,
+                                       (jint)event->expose.area.width,
+                                       (jint)event->expose.area.height);
+         }
+         break;
+
+       case GDK_KEY_PRESS:
+         {
+           GtkWidget *widget;
+           GtkWindow *window;
+
+           gdk_window_get_user_data (event->any.window, (void **) &widget);
+
+           window = GTK_WINDOW (gtk_widget_get_ancestor (widget, 
+                                                         GTK_TYPE_WINDOW));
+           if (window
+               && GTK_WIDGET_IS_SENSITIVE (window) 
+               && window->focus_widget
+               && GTK_WIDGET_IS_SENSITIVE (window->focus_widget)
+               && window->focus_widget->window)
+             {
+               gtk_widget_activate (window->focus_widget);
+               gdk_property_get (window->focus_widget->window,
+                                 gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE),
+                                 gdk_atom_intern ("CARDINAL", FALSE),
+                                 0,
+                                 sizeof (jobject),
+                                 FALSE,
+                                 NULL,
+                                 NULL,
+                                 NULL,
+                                 (guchar **)&obj_ptr);
+               
+               /*          if (grab  && GTK_WIDGET_HAS_DEFAULT (widget) ) */
+               /*            { */
+               (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
+                                           postKeyEventID,
+                                           (jint) AWT_KEY_PRESSED,
+                                           (jlong) event->key.time,
+                                         state_to_awt_mods (event->key.state),
+                                    keysym_to_awt_keycode (event->key.keyval),
+                                           (jchar) (event->key.length) ? 
+                                           event->key.string[0] : 
+                                           AWT_KEY_CHAR_UNDEFINED);
+               if (event->key.length)
+                 (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
+                                             postKeyEventID,
+                                             (jint) AWT_KEY_TYPED,
+                                             (jlong) event->key.time,
+                                         state_to_awt_mods (event->key.state),
+                                             VK_UNDEFINED,
+                                             (jchar) event->key.string[0]);
+             }
+         }
+         break;
+       case GDK_FOCUS_CHANGE:
+         (*gdk_env)->CallVoidMethod (gdk_env, *obj_ptr,
+                                     postFocusEventID,
+                                     (jint) (event->focus_change.in) ? 
+                                     AWT_FOCUS_GAINED : AWT_FOCUS_LOST,
+                                     JNI_FALSE);
+         break;
+       default:
+       }
+      g_free (obj_ptr);
+    } 
+  
+  gtk_main_do_event (event);
+}
+
+static void
+attach_jobject (GdkWindow *window, jobject *obj)
+{
+  GdkAtom addr_atom = gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE);
+  GdkAtom type_atom = gdk_atom_intern ("CARDINAL", FALSE);
+
+  gdk_window_set_events (window, 
+                        gdk_window_get_events (window)
+                        | GDK_POINTER_MOTION_MASK
+                        | GDK_BUTTON_MOTION_MASK
+                        | GDK_BUTTON_PRESS_MASK
+                        | GDK_BUTTON_RELEASE_MASK
+                        | GDK_KEY_PRESS_MASK
+                        | GDK_KEY_RELEASE_MASK
+                        | GDK_ENTER_NOTIFY_MASK
+                        | GDK_LEAVE_NOTIFY_MASK
+                        | GDK_STRUCTURE_MASK
+                        | GDK_KEY_PRESS_MASK
+                        | GDK_FOCUS_CHANGE_MASK);
+
+  gdk_property_change (window,
+                      addr_atom,
+                      type_atom,
+                      8,
+                      GDK_PROP_MODE_REPLACE,
+                      (guchar *)obj,
+                      sizeof (jobject));
+}
+
+void
+connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...)
+{
+  int i;
+  va_list ap;
+  jobject *obj;
+
+  obj = (jobject *) malloc (sizeof (jobject));
+  *obj = (*env)->NewGlobalRef (env, peer_obj);
+
+  va_start (ap, nwindows);
+  for (i = 0; i < nwindows; i++)
+    attach_jobject (va_arg (ap, GdkWindow *), obj);
+  va_end (ap);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
new file mode 100644 (file)
index 0000000..2308d11
--- /dev/null
@@ -0,0 +1,92 @@
+/* gtkfiledialogpeer.c -- Native implementation of GtkFileDialogPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h"
+
+/*
+ * Make a new file selection dialog
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create 
+  (JNIEnv *env, jobject obj)
+{
+  gpointer widget;
+
+  gdk_threads_enter ();
+  widget = gtk_type_new (gtk_file_selection_get_type ());
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, widget);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  /* NOTE: we don't call the superclass connect method here.  */
+  gtk_widget_realize (GTK_WIDGET (ptr));
+  connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
+
+  gdk_threads_leave ();
+}
+
+/*
+ * Set the filename in the file selection dialog.
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_gtkFileSelectionSetFilename 
+    (JNIEnv *env, jobject obj, jstring filename)
+{
+  void *ptr;
+  const char *str;
+
+  ptr = NSA_GET_PTR (env, obj);
+    
+  str = (*env)->GetStringUTFChars (env, filename, 0);      
+  gdk_threads_enter ();
+  gtk_file_selection_set_filename (GTK_FILE_SELECTION (ptr), str);
+  gdk_threads_leave ();
+  (*env)->ReleaseStringUTFChars (env, filename, str);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c
new file mode 100644 (file)
index 0000000..dd446c8
--- /dev/null
@@ -0,0 +1,160 @@
+/* gtkimagepainter.c
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkImagePainter.h"
+#include <libart_lgpl/art_misc.h>
+#include <libart_lgpl/art_rgb_affine.h>
+
+#define SWAPU32(w) \
+  (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels
+(JNIEnv *env, jobject obj, jobject gc_obj, jint bg_red, jint bg_green, 
+ jint bg_blue, jint x, jint y, jint width, jint height, jintArray jpixels, 
+ jint offset, jint scansize, jdoubleArray jaffine)
+{
+  struct graphics *g;
+  jint *pixels, *elems;
+  guchar *packed;
+  int i;
+  jsize num_pixels;
+  guchar *j_rgba, *c_rgb;
+
+  g = (struct graphics *) NSA_GET_PTR (env, gc_obj);
+
+  elems = (*env)->GetIntArrayElements (env, jpixels, NULL);
+  num_pixels = (*env)->GetArrayLength (env, jpixels);
+  /* get a copy of the pixel data so we can modify it */
+  pixels = malloc (sizeof (jint) * num_pixels);
+  memcpy (pixels, elems, sizeof (jint) * num_pixels);
+  (*env)->ReleaseIntArrayElements (env, jpixels, elems, 0);
+
+#ifndef WORDS_BIGENDIAN
+  /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */
+  for (i = 0; i < num_pixels; i++)
+    pixels[i] = SWAPU32 ((unsigned)pixels[i]);
+#endif
+
+  packed = (guchar *) malloc (sizeof (guchar) * 3 * num_pixels);
+  j_rgba = (guchar *) pixels;
+  c_rgb = packed;
+
+  /* copy over pixels in DirectColorModel format to 24 bit RGB image data,
+     and process the alpha channel */
+  for (i = 0; i < num_pixels; i++)
+    {
+      jint ialpha = *j_rgba++;
+
+      switch (ialpha)
+       {
+       case 0:                 /* full transparency */
+         *c_rgb++ = bg_red;
+         *c_rgb++ = bg_green;
+         *c_rgb++ = bg_blue;
+         j_rgba += 3;
+         break;
+       case 255:               /* opaque */
+         *c_rgb++ = *j_rgba++;
+         *c_rgb++ = *j_rgba++;
+         *c_rgb++ = *j_rgba++;
+         break;
+       default:                /* compositing required */
+         {
+           jfloat alpha = ialpha / 255.0;
+           jfloat comp_alpha = 1.0 - alpha;
+           
+           *c_rgb++ = *j_rgba++ * alpha + bg_red * comp_alpha;
+           *c_rgb++ = *j_rgba++ * alpha + bg_green * comp_alpha;
+           *c_rgb++ = *j_rgba++ * alpha + bg_blue * comp_alpha;
+         }
+         break;
+       }
+    }
+
+  if (jaffine)
+    {
+      jdouble *affine;
+      ArtAlphaGamma *alphagamma = NULL;
+      art_u8 *dst;
+      int new_width, new_height;
+      int i;
+      
+      affine = (*env)->GetDoubleArrayElements (env, jaffine, NULL);
+
+      new_width = abs (width * affine[0]);
+      new_height = abs (height * affine[3]);
+
+      dst = (art_u8 *) malloc (sizeof (art_u8) * 3 * (new_width * new_height));
+      
+      art_rgb_affine (dst, 
+                     0, 0,
+                     new_width, new_height,
+                     new_width * 3,
+                     (art_u8 *) packed + offset * 3,
+                     width, height,
+                     scansize * 3,
+                     affine,
+                     ART_FILTER_NEAREST,
+                     alphagamma);
+
+      (*env)->ReleaseDoubleArrayElements (env, jaffine, affine, JNI_ABORT);
+      
+      free (packed);
+      packed = (guchar *) dst;
+
+      width = scansize = new_width;
+      height = new_height;
+      offset = 0;
+    }
+
+  gdk_threads_enter ();
+
+  gdk_draw_rgb_image (g->drawable,
+                     g->gc,
+                     x + g->x_offset, 
+                     y + g->y_offset, 
+                     width, height, GDK_RGB_DITHER_NORMAL,
+                     packed + offset * 3, scansize * 3);
+
+  gdk_threads_leave ();
+
+  free (pixels); 
+  free (packed);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
new file mode 100644 (file)
index 0000000..9313a8a
--- /dev/null
@@ -0,0 +1,57 @@
+/* gtklabelpeer.c -- Native implementation of GtkLabelPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkLabelPeer.h"
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *label;
+  GtkContainer *ebox;
+
+  gdk_threads_enter ();
+  ebox = GTK_CONTAINER (gtk_type_new (gtk_event_box_get_type ()));
+  label = GTK_WIDGET (gtk_type_new (gtk_label_get_type ()));
+  gtk_container_add (ebox, label);
+  gtk_widget_show (label);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, ebox);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
new file mode 100644 (file)
index 0000000..5787ce5
--- /dev/null
@@ -0,0 +1,381 @@
+/* gtklistpeer.c -- Native implementation of GtkListPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkListPeer.h"
+
+static void
+connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list);
+
+#define CLIST_FROM_SW(obj) (GTK_CLIST(GTK_SCROLLED_WINDOW (obj)->container.child))
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkListPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *list, *sw;
+
+  gdk_threads_enter ();
+  list = gtk_clist_new (1);
+  gtk_widget_show (list);
+  sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), 
+                                 GTK_POLICY_AUTOMATIC,
+                                 GTK_POLICY_AUTOMATIC);
+  gtk_container_add (GTK_CONTAINER (sw), list);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, sw);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkListPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_widget_realize (GTK_WIDGET (ptr));
+  connect_selectable_hook (env, obj, CLIST_FROM_SW (ptr));
+  connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkListPeer_append 
+  (JNIEnv *env, jobject obj, jobjectArray items)
+{
+  void *ptr;
+  GtkCList *list;
+  jint count, i;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  count = (*env)->GetArrayLength (env, items);
+
+  gdk_threads_enter ();
+  list = CLIST_FROM_SW (ptr);
+  for (i = 0; i < count; i++) 
+    {
+      const char *text;
+      jobject item;
+
+      item = (*env)->GetObjectArrayElement (env, items, i);
+
+      text = (*env)->GetStringUTFChars (env, item, NULL);
+      gtk_clist_append (list, (char **)&text);
+      (*env)->ReleaseStringUTFChars (env, item, text);
+    }
+
+  gtk_clist_columns_autosize (list);
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkListPeer_old_create
+  (JNIEnv *env, jobject obj, jobject parent_obj,
+   jobjectArray items, jboolean mode)
+{
+  GtkWidget *list, *sw, *parent;
+  jsize count, i;
+
+  parent = NSA_GET_PTR (env, parent_obj);
+
+  count = (*env)->GetArrayLength (env, items);
+
+  gdk_threads_enter ();
+
+  list = gtk_clist_new (1);
+  gtk_widget_show (list);
+
+  sw = gtk_scrolled_window_new (NULL, NULL);
+  set_parent (sw, GTK_CONTAINER (parent));
+  gtk_widget_realize (sw);
+
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), 
+                                 GTK_POLICY_AUTOMATIC,
+                                 GTK_POLICY_AUTOMATIC);
+  gtk_container_add (GTK_CONTAINER (sw), list);
+
+  connect_selectable_hook (env, obj, GTK_CLIST (list));
+  connect_awt_hook (env, obj, 1, list->window);
+
+  gtk_clist_set_selection_mode (GTK_CLIST (list),
+                               mode ? GTK_SELECTION_MULTIPLE : 
+                                      GTK_SELECTION_SINGLE);
+  
+  for (i = 0; i < count; i++) 
+    {
+      const char *text;
+      jobject item;
+
+      item = (*env)->GetObjectArrayElement (env, items, i);
+
+      text = (*env)->GetStringUTFChars (env, item, NULL);
+      gtk_clist_append (GTK_CLIST (list), (char **)&text);
+      (*env)->ReleaseStringUTFChars (env, item, text);
+    }
+
+  gtk_clist_columns_autosize (GTK_CLIST (list));
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, sw);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_add
+  (JNIEnv *env, jobject obj, jstring text, jint index)
+{
+  void *ptr;
+  const char *str;
+    
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, text, NULL);
+
+  gdk_threads_enter ();
+  gtk_clist_insert (CLIST_FROM_SW (ptr), index, (char **)&str);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, text, str);
+}
+
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_delItems
+  (JNIEnv *env, jobject obj, jint start, jint end)
+{
+  void *ptr;
+  GtkCList *list;
+  jint i;
+    
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  list = CLIST_FROM_SW (ptr);
+
+  if (end == -1)               /* special case for removing all rows */
+    end = list->rows;
+
+  gtk_clist_freeze (list);
+  for (i = start; i < end; i++)
+    gtk_clist_remove (list, i);
+  gtk_clist_thaw (list);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_select
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+    
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_clist_select_row (CLIST_FROM_SW (ptr), index, 0);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_deselect
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_clist_unselect_row (CLIST_FROM_SW (ptr), index, 0);
+  gdk_threads_leave ();
+}
+
+/* FIXME: magic mojo (that doesn't seem to do anything) */
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize
+  (JNIEnv *env, jobject obj, jint rows, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkWidget *list;
+  GtkScrolledWindow *sw;
+  GtkRequisition myreq;
+
+  dims = (*env)->GetIntArrayElements (env, jdims, NULL);
+  dims[0] = dims[1] = 0;
+
+  if (rows < 3)
+    rows = 3;
+
+  ptr = NSA_GET_PTR (env, obj);
+  gdk_threads_enter ();
+
+  list = GTK_WIDGET (CLIST_FROM_SW (ptr));
+  sw = GTK_SCROLLED_WINDOW (ptr);
+
+  /*
+  gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar), 
+                                      &myreq);
+  dims[1]=myreq.height+GTK_SCROLLED_WINDOW_CLASS 
+    (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
+  */
+
+  gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar), 
+                          "size_request", &myreq);
+  /*
+
+    gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar), 
+                                      &myreq);
+  */
+
+  dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS
+    (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
+
+  gtk_signal_emit_by_name (GTK_OBJECT (list), "size_request", &myreq);
+  
+  //  gtk_widget_size_request(GTK_WIDGET (list), &myreq);
+                                      
+  dims[0] += myreq.width + gdk_char_width (list->style->font, 'W');
+             
+  dims[1] += ((rows * (gdk_char_height (list->style->font, 'W')+7))
+             + (2 * (list->style->klass->ythickness)));
+                
+  
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+}
+
+
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_getSelectedIndexes
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkCList *list;
+  jintArray selection;
+  jint *sel;
+  GList *child;
+  jint count, i;
+
+  ptr = NSA_GET_PTR (env, obj);
+  gdk_threads_enter ();
+
+  list = CLIST_FROM_SW (ptr);
+  count = g_list_length (list->selection);
+
+  selection = (*env)->NewIntArray (env, count);
+  sel = (*env)->GetIntArrayElements (env, selection, NULL);  
+
+  for (i = 0, child = list->selection; i < count; i++)
+    {
+      sel[i] = GPOINTER_TO_INT (child->data);
+      child = g_list_next (child);
+    }
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements (env, selection, sel, 0);
+
+  return selection;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_makeVisible
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_clist_moveto (CLIST_FROM_SW (ptr), index, 0, 0.5, 0.5);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkListPeer_setMultipleMode
+  (JNIEnv *env, jobject obj, jboolean mode)
+{
+  void *ptr;
+    
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_clist_set_selection_mode (CLIST_FROM_SW (ptr),
+                               mode ? GTK_SELECTION_MULTIPLE : 
+                                      GTK_SELECTION_SINGLE);
+  gdk_threads_leave ();
+}
+
+static void
+item_select (GtkCList *list, int row, int col, GdkEventButton *event, 
+            jobject *peer_obj)
+{
+  (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
+                             postListItemEventID,
+                             row,
+                             (jint) AWT_ITEM_SELECTED);
+}
+
+static void
+item_unselect (GtkCList *list, int row, int col, GdkEventButton *event, 
+            jobject *peer_obj)
+{
+  (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
+                             postListItemEventID,
+                             row,
+                             (jint) AWT_ITEM_DESELECTED);
+}
+
+static void
+connect_selectable_hook (JNIEnv *env, jobject peer_obj, GtkCList *list)
+{
+  jobject *obj;
+
+  obj = (jobject *) malloc (sizeof (jobject));
+  *obj = (*env)->NewGlobalRef (env, peer_obj);
+
+  gtk_signal_connect (GTK_OBJECT (list), "select_row", 
+                     GTK_SIGNAL_FUNC (item_select), obj);
+
+  gtk_signal_connect (GTK_OBJECT (list), "unselect_row", 
+                     GTK_SIGNAL_FUNC (item_unselect), obj);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMainThread.c
new file mode 100644 (file)
index 0000000..af14f0b
--- /dev/null
@@ -0,0 +1,163 @@
+/* gtkmainthread.c -- Native implementation of GtkMainThread
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMainThread.h"
+#include "gthread-jni.h"
+
+#ifdef JVM_SUN
+  struct state_table *native_state_table;
+#endif
+
+jmethodID postActionEventID;
+jmethodID postMenuActionEventID;
+jmethodID postMouseEventID;
+jmethodID postConfigureEventID;
+jmethodID postExposeEventID;
+jmethodID postKeyEventID;
+jmethodID postFocusEventID;
+jmethodID postAdjustmentEventID;
+jmethodID postItemEventID;
+jmethodID postListItemEventID;
+JNIEnv *gdk_env;
+
+/*
+ * Call gtk_init.  It is very important that this happen before any other
+ * gtk calls.
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkInit (JNIEnv *env, jclass clazz)
+{
+  int argc = 1;
+  char **argv;
+  char *homedir, *rcpath = NULL;
+/*    jclass gtkgenericpeer; */
+  jclass gtkcomponentpeer, gtkwindowpeer, gtkscrollbarpeer, gtklistpeer, gtkmenuitempeer;
+
+  NSA_INIT (env, clazz);
+
+  /* GTK requires a program's argc and argv variables, and requires that they
+     be valid.  */
+
+  argv = (char **) malloc (sizeof (char *) * 2);
+  argv[0] = "";
+  argv[1] = NULL;
+
+  /* until we have JDK 1.2 JNI, assume we have a VM with threads that 
+     match what GLIB was compiled for */
+  g_thread_init (NULL);
+
+  gtk_init (&argc, &argv);
+
+  gdk_rgb_init ();
+  gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
+  gtk_widget_set_default_visual (gdk_rgb_get_visual ());
+
+  /* Make sure queued calls don't get sent to GTK/GDK while 
+     we're shutting down. */
+  atexit (gdk_threads_enter);
+
+  gdk_env = env;
+  gdk_event_handler_set ((GdkEventFunc)awt_event_handler, NULL, NULL);
+
+  if ((homedir = getenv ("HOME")))
+    {
+      rcpath = (char *) malloc (strlen (homedir) + strlen (RC_FILE) + 2);
+      sprintf (rcpath, "%s/%s", homedir, RC_FILE);
+    }
+  
+  gtk_rc_parse ((rcpath) ? rcpath : RC_FILE);
+
+  if (rcpath)
+    free (rcpath);
+
+  free (argv);
+
+  /* setup cached IDs for posting GTK events to Java */
+/*    gtkgenericpeer = (*env)->FindClass (env,  */
+/*                                   "gnu/java/awt/peer/gtk/GtkGenericPeer"); */
+  gtkcomponentpeer = (*env)->FindClass (env,
+                                    "gnu/java/awt/peer/gtk/GtkComponentPeer");
+  gtkwindowpeer = (*env)->FindClass (env,
+                                    "gnu/java/awt/peer/gtk/GtkWindowPeer");
+  gtkscrollbarpeer = (*env)->FindClass (env, 
+                                    "gnu/java/awt/peer/gtk/GtkScrollbarPeer");
+  gtklistpeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkListPeer");
+  gtkmenuitempeer = (*env)->FindClass (env, "gnu/java/awt/peer/gtk/GtkMenuItemPeer");
+/*    gdkColor = (*env)->FindClass (env, */
+/*                             "gnu/java/awt/peer/gtk/GdkColor"); */
+/*    gdkColorID = (*env)->GetMethodID (env, gdkColor, "<init>", "(III)V"); */
+/*    postActionEventID = (*env)->GetMethodID (env, gtkgenericpeer,  */
+/*                                        "postActionEvent",  */
+/*                                        "(Ljava/lang/String;I)V"); */
+
+  postMenuActionEventID = (*env)->GetMethodID (env, gtkmenuitempeer,
+                                              "postMenuActionEvent",
+                                              "()V");
+  postMouseEventID = (*env)->GetMethodID (env, gtkcomponentpeer, 
+                                         "postMouseEvent", "(IJIIIIZ)V");
+  postConfigureEventID = (*env)->GetMethodID (env, gtkwindowpeer, 
+                                         "postConfigureEvent", "(IIIIIIII)V");
+  postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer, 
+                                         "postExposeEvent", "(IIII)V");
+  postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
+                                       "postKeyEvent", "(IJIIC)V");
+  postFocusEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
+                                         "postFocusEvent", "(IZ)V");
+  postAdjustmentEventID = (*env)->GetMethodID (env, gtkscrollbarpeer,
+                                              "postAdjustmentEvent", 
+                                              "(II)V");
+  postItemEventID = (*env)->GetMethodID (env, gtkcomponentpeer,
+                                        "postItemEvent", 
+                                        "(Ljava/lang/Object;I)V");
+  postListItemEventID = (*env)->GetMethodID (env, gtklistpeer,
+                                            "postItemEvent",
+                                            "(II)V");
+}
+
+/*
+ * Run gtk_main and block.
+ */ 
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkMainThread_gtkMain (JNIEnv *env, jobject obj)
+{
+  gdk_threads_enter ();
+  gtk_main ();
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
new file mode 100644 (file)
index 0000000..89818e0
--- /dev/null
@@ -0,0 +1,81 @@
+/* gtkmenubarpeer.c -- Native implementation of GtkMenuBarPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuBarPeer.h"
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  GtkWidget *widget;
+
+  gdk_threads_enter ();
+  widget = gtk_menu_bar_new ();
+  gtk_widget_show (widget);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, widget);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
+  (JNIEnv *env, jobject obj, jobject menupeer)
+{
+  void *mbar, *menu;
+
+  mbar = NSA_GET_PTR (env, obj);
+  menu = NSA_GET_PTR (env, menupeer);
+
+  gdk_threads_enter ();
+  gtk_menu_bar_append (GTK_MENU_BAR (mbar), GTK_WIDGET (menu));
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GList *list;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  list = gtk_container_children (GTK_CONTAINER (ptr));
+  list = g_list_nth (list, index);
+  gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
new file mode 100644 (file)
index 0000000..ee39208
--- /dev/null
@@ -0,0 +1,120 @@
+/* gtkmenuitempeer.c -- Native implementation of GtkMenuItemPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuItemPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
+
+static void
+connect_activate_hook (JNIEnv *, jobject, GtkMenuItem *);
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  GtkWidget *widget;
+  const char *str;
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  gdk_threads_enter ();
+
+  if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
+    widget = gtk_menu_item_new ();
+  else
+    widget = gtk_menu_item_new_with_label (str);
+
+  connect_activate_hook (env, obj, GTK_MENU_ITEM (widget));
+  gtk_widget_show (widget);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+
+  NSA_SET_PTR (env, obj, widget);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  void *ptr;
+  const char *str;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  gdk_threads_enter ();
+
+  if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
+    gtk_container_remove (GTK_CONTAINER (ptr), GTK_BIN (ptr)->child);
+  else
+    {
+      GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
+
+      gtk_label_set_text (GTK_LABEL (accel_label), str);
+      gtk_accel_label_refetch (accel_label);
+    }
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
+  (JNIEnv *env, jobject obj, jboolean enabled)
+{
+/*    Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setEnabled (env, obj, enabled); */
+}
+
+static void
+item_activate (GtkMenuItem *item, jobject *peer_obj)
+{
+  (*gdk_env)->CallVoidMethod (gdk_env, *peer_obj,
+                             postMenuActionEventID);
+}
+
+static void
+connect_activate_hook (JNIEnv *env, jobject peer_obj, GtkMenuItem *item)
+{
+  jobject *obj;
+
+  obj = (jobject *) malloc (sizeof (jobject));
+  *obj = (*env)->NewGlobalRef (env, peer_obj);
+
+  gtk_signal_connect (GTK_OBJECT (item), "activate", 
+                     GTK_SIGNAL_FUNC (item_activate), obj);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
new file mode 100644 (file)
index 0000000..ec81542
--- /dev/null
@@ -0,0 +1,152 @@
+/* gtkmenupeer.c -- Native implementation of GtkMenuPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkMenuPeer.h"
+
+static void
+accel_attach (GtkMenuItem *menu_item, gpointer *user_data)
+{
+  GtkAccelGroup *accel;
+
+  accel = gtk_menu_get_accel_group (GTK_MENU (menu_item->submenu));
+  gtk_accel_group_attach (accel, 
+    GTK_OBJECT (gtk_widget_get_toplevel (GTK_WIDGET(menu_item))));
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_setupAccelGroup
+  (JNIEnv *env, jobject obj, jobject parent)
+{
+  void *ptr1, *ptr2;
+
+  ptr1 = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  if (!parent)
+    {
+      gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu), 
+                               gtk_accel_group_new ());
+
+      if (GTK_WIDGET_REALIZED (GTK_WIDGET (ptr1)))
+       accel_attach (GTK_MENU_ITEM (ptr1), NULL);
+      else
+       gtk_signal_connect (GTK_OBJECT (ptr1),
+                           "realize",
+                           GTK_SIGNAL_FUNC (accel_attach), 
+                           NULL);
+    }
+  else
+    {
+      GtkAccelGroup *parent_accel;
+
+      ptr2 = NSA_GET_PTR (env, parent);
+      parent_accel = gtk_menu_get_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr2)->submenu));
+      
+      gtk_menu_set_accel_group (GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu),
+                               parent_accel);
+    }
+      
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
+  (JNIEnv *env, jobject obj, jstring label)
+{
+  GtkWidget *menu_title, *menu;
+  const char *str;
+
+  str = (*env)->GetStringUTFChars (env, label, NULL);
+
+  gdk_threads_enter ();
+  menu = gtk_menu_new ();
+  
+  menu_title = gtk_menu_item_new_with_label (str);
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_title), menu);
+
+  gtk_widget_show (menu);
+  gtk_widget_show (menu_title);
+
+  NSA_SET_PTR (env, obj, menu_title);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, label, str);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_addItem
+  (JNIEnv *env, jobject obj, jobject menuitempeer, jint key, jboolean shift)
+{
+  void *ptr1, *ptr2;
+  GtkMenu *menu;
+
+  ptr1 = NSA_GET_PTR (env, obj);
+  ptr2 = NSA_GET_PTR (env, menuitempeer);
+
+  gdk_threads_enter ();
+
+  menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
+  gtk_menu_append (menu, GTK_WIDGET (ptr2));
+
+  if (key)
+    {
+      gtk_widget_add_accelerator (GTK_WIDGET (ptr2), "activate",
+                                 gtk_menu_get_accel_group (menu), key, 
+                                 (GDK_CONTROL_MASK
+                                  | ((shift) ? GDK_SHIFT_MASK : 0)), 
+                                 GTK_ACCEL_VISIBLE);
+    }
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_delItem
+  (JNIEnv *env, jobject obj, jint index)
+{
+  void *ptr;
+  GList *list;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  list = gtk_container_children (GTK_CONTAINER (ptr));
+  list = g_list_nth (list, index);
+  gtk_container_remove (GTK_CONTAINER (ptr), GTK_WIDGET (list->data));
+  gdk_threads_leave ();
+}
+
+
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
new file mode 100644 (file)
index 0000000..b52c75d
--- /dev/null
@@ -0,0 +1,137 @@
+/* gtkpanelpeer.c -- Native implementation of GtkPanelPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkPanelPeer.h"
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  gpointer widget;
+
+  gdk_threads_enter ();
+  widget = gtk_layout_new (NULL, NULL);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, widget);
+}
+
+typedef struct _GtkLayoutChild   GtkLayoutChild;
+
+struct _GtkLayoutChild {
+  GtkWidget *widget;
+  gint x;
+  gint y;
+};
+
+static
+void sr (GtkWidget *widget, GtkRequisition *requisition, gpointer user_data)
+{
+  GtkLayout *layout;
+  GtkLayoutChild *child;
+  GList *children;
+
+  layout = GTK_LAYOUT (widget);
+  requisition->width = GTK_WIDGET (widget)->allocation.width;
+  requisition->height = GTK_WIDGET (widget)->allocation.height;
+
+  children = layout->children;
+  while (children)
+    {
+      child = children->data;
+      children = children->next;
+
+      if (GTK_WIDGET_VISIBLE (child->widget))
+       {
+          requisition->height = MAX (requisition->height,
+                                     child->y +
+                                     child->widget->allocation.height);
+          requisition->width = MAX (requisition->width,
+                                    child->x +
+                                    child->widget->allocation.width);
+       }
+    }
+
+  requisition->height += GTK_CONTAINER (layout)->border_width * 2;
+  requisition->width += GTK_CONTAINER (layout)->border_width * 2;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_widget_realize (GTK_WIDGET (ptr));
+  connect_awt_hook (env, obj, 1, GTK_LAYOUT (ptr)->bin_window);
+
+/*    gtk_signal_connect (GTK_OBJECT (ptr), "size_request", GTK_SIGNAL_FUNC (sr), */
+/*                   NULL); */
+  gdk_threads_leave ();
+}
+
+/*
+ * Make a new panel.
+ */
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkPanelPeer_gtkPanelNew
+    (JNIEnv *env, jobject obj, jobject parent_obj)
+{
+  GtkWidget *layout;
+  void *parent;
+
+  parent = NSA_GET_PTR (env, parent_obj);
+
+  gdk_threads_enter ();
+  layout = gtk_layout_new (NULL, NULL);
+  
+  set_parent (layout, GTK_CONTAINER (parent));
+
+  gtk_widget_realize (layout);
+  connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
+  set_visible (layout, 1);
+
+  NSA_SET_PTR (env, obj, layout);
+  gdk_threads_leave ();
+}
+
+
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPopupMenuPeer.c
new file mode 100644 (file)
index 0000000..66affcf
--- /dev/null
@@ -0,0 +1,93 @@
+/* gtkpopupmenupeer.c -- Native implementation of GtkPopupMenuPeer
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkPopupMenuPeer.h"
+
+struct pos
+{
+  gint x;
+  gint y;
+};
+
+void 
+menu_pos (GtkMenu *menu, gint *x, gint *y, gpointer user_data)
+{
+  struct pos *p = (struct pos *) user_data;
+
+  *x = p->x;
+  *y = p->y;
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_show
+  (JNIEnv *env, jobject obj, jint x, jint y, jlong time)
+{
+  void *ptr;
+  struct pos *p;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  p = g_malloc (sizeof (struct pos));
+  p->x = x;
+  p->y = y;
+  
+  gdk_threads_enter ();
+  gtk_menu_popup (GTK_MENU (GTK_MENU_ITEM (ptr)->submenu), 
+                 NULL, NULL, menu_pos, p, 3, time);
+  gdk_threads_leave ();
+
+  g_free (p);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkPopupMenuPeer_setupAccelGroup
+  (JNIEnv *env, jobject obj, jobject parent)
+{
+  void *ptr1, *ptr2;
+  GtkMenu *menu;
+
+  ptr1 = NSA_GET_PTR (env, obj);
+  ptr2 = NSA_GET_PTR (env, parent);
+
+  gdk_threads_enter ();
+  menu = GTK_MENU (GTK_MENU_ITEM (ptr1)->submenu);
+  gtk_menu_set_accel_group (menu, gtk_accel_group_new ());
+  gtk_accel_group_attach (gtk_menu_get_accel_group (menu),
+                         GTK_OBJECT (gtk_widget_get_toplevel (ptr2)));
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollBarPeer.c
new file mode 100644 (file)
index 0000000..4b8787e
--- /dev/null
@@ -0,0 +1,183 @@
+/* gtkscrollbarpeer.c -- Native implementation of GtkScrollbarPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkScrollbarPeer.h"
+
+struct range_scrollbar
+{
+  GtkRange *range;
+  jobject *scrollbar;
+};
+
+static void 
+post_adjustment_event (GtkAdjustment *adj, struct range_scrollbar *rs)
+{
+  jint type;
+
+  switch (rs->range->scroll_type)
+    {
+    case GTK_SCROLL_STEP_FORWARD:
+      type = AWT_ADJUSTMENT_UNIT_INCREMENT;
+      break;
+    case GTK_SCROLL_STEP_BACKWARD:
+      type = AWT_ADJUSTMENT_UNIT_DECREMENT;
+      break;
+    case GTK_SCROLL_PAGE_FORWARD:
+      type = AWT_ADJUSTMENT_BLOCK_INCREMENT;
+      break;
+    case GTK_SCROLL_PAGE_BACKWARD:
+      type = AWT_ADJUSTMENT_BLOCK_DECREMENT;
+      break;
+    case GTK_SCROLL_JUMP:
+      type = AWT_ADJUSTMENT_TRACK;
+      break;
+    default: /* GTK_SCROLL_NONE */
+      return;
+    }
+  
+  (*gdk_env)->CallVoidMethod (gdk_env, *(rs->scrollbar), postAdjustmentEventID,
+                             type, (jint) adj->value);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_create
+(JNIEnv *env, jobject obj, jint orientation, jint value, 
+ jint min, jint max, jint step_incr, jint page_incr, jint visible_amount)
+{
+  GtkWidget *sb;
+  GtkObject *adj;
+
+  gdk_threads_enter ();
+  adj = gtk_adjustment_new (value, min, max, 
+                           step_incr, page_incr, 
+                           visible_amount);
+
+  sb = (orientation) ? gtk_vscrollbar_new (GTK_ADJUSTMENT (adj)) :
+                       gtk_hscrollbar_new (GTK_ADJUSTMENT (adj));
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, sb);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  struct range_scrollbar *rs;
+
+  rs = (struct range_scrollbar *) malloc (sizeof (struct range_scrollbar));
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_widget_realize (GTK_WIDGET (ptr));
+
+  rs->range = GTK_RANGE (ptr);
+  rs->scrollbar = (jobject *) malloc (sizeof (jobject));
+  *(rs->scrollbar) = (*env)->NewGlobalRef (env, obj);
+  gtk_signal_connect (GTK_OBJECT (GTK_RANGE (ptr)->adjustment), 
+                     "value_changed", 
+                     GTK_SIGNAL_FUNC (post_adjustment_event), rs);
+
+  connect_awt_hook (env, obj, 4, 
+                   GTK_RANGE (ptr)->trough,
+                   GTK_RANGE (ptr)->slider,
+                   GTK_RANGE (ptr)->step_forw,
+                   GTK_RANGE (ptr)->step_back);
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setLineIncrement
+    (JNIEnv *env, jobject obj, jint amount)
+{
+  void *ptr;
+  GtkAdjustment *adj;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  adj = GTK_RANGE (ptr)->adjustment;
+  adj->step_increment = amount;
+  gtk_adjustment_changed (adj);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setPageIncrement
+    (JNIEnv *env, jobject obj, jint amount)
+{
+  void *ptr;
+  GtkAdjustment *adj;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  adj = GTK_RANGE (ptr)->adjustment;
+  adj->page_increment = amount;
+  gtk_adjustment_changed (adj);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollbarPeer_setValues
+    (JNIEnv *env, jobject obj, jint value, jint visible, jint min, jint max)
+{
+  void *ptr;
+  GtkAdjustment *adj;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  adj = GTK_RANGE (ptr)->adjustment;
+  adj->value = value;
+  adj->page_size = visible;
+  adj->lower = min;
+  adj->upper = max;
+  gtk_adjustment_changed (adj);
+
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkScrollPanePeer.c
new file mode 100644 (file)
index 0000000..499b312
--- /dev/null
@@ -0,0 +1,190 @@
+/* gtkscrollpanepeer.c -- Native implementation of GtkScrollPanePeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkScrollPanePeer.h"
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_create 
+  (JNIEnv *env, jobject obj)
+{
+  gpointer window;
+  GtkWidget *layout;
+
+  gdk_threads_enter ();
+  window = gtk_scrolled_window_new (NULL, NULL);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, window);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setScrollPosition
+  (JNIEnv *env, jobject obj, jint x, jint y)
+{
+  GtkAdjustment *hadj, *vadj;
+  GtkScrolledWindow *sw;
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  sw = GTK_SCROLLED_WINDOW (ptr);
+
+  hadj = gtk_scrolled_window_get_hadjustment (sw);
+  vadj = gtk_scrolled_window_get_vadjustment (sw);
+
+  gtk_adjustment_set_value (hadj, x);
+  gtk_adjustment_set_value (vadj, y);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetHScrollIncrement
+  (JNIEnv *env, jobject obj, jint u)
+{
+  GtkAdjustment *hadj;
+  GtkScrolledWindow *sw;
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  sw = GTK_SCROLLED_WINDOW(ptr);
+
+  hadj = gtk_scrolled_window_get_hadjustment (sw);
+  hadj->step_increment = u;
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_gtkScrolledWindowSetVScrollIncrement
+  (JNIEnv *env, jobject obj, jint u)
+{
+  GtkAdjustment *vadj;
+  GtkScrolledWindow *sw;
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  sw = GTK_SCROLLED_WINDOW(ptr);
+
+  vadj = gtk_scrolled_window_get_hadjustment (sw);
+  vadj->step_increment = u;
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_childResized
+  (JNIEnv *env, jobject obj, jint width, jint height)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  return;
+
+  gdk_threads_enter ();
+  gtk_widget_set_usize (GTK_BIN (ptr)->child, width, height);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getHScrollbarHeight
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkScrolledWindow *sw;
+  jint height;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  sw = GTK_SCROLLED_WINDOW (ptr);
+  height = (sw->hscrollbar_visible) ? sw->hscrollbar->allocation.height : 0;
+  gdk_threads_leave ();
+
+  return height;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_getVScrollbarWidth
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkScrolledWindow *sw;
+  jint width;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  sw = GTK_SCROLLED_WINDOW (ptr);
+  width = (sw->vscrollbar_visible) ? sw->vscrollbar->allocation.width : 0;
+  gdk_threads_leave ();
+
+  return width;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkScrollPanePeer_setPolicy
+  (JNIEnv *env, jobject obj, jint policy)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  switch (policy)
+    {
+    case AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED:
+      policy = GTK_POLICY_AUTOMATIC;
+      break;
+    case AWT_SCROLLPANE_SCROLLBARS_ALWAYS:
+      policy = GTK_POLICY_ALWAYS;
+      break;
+    case AWT_SCROLLPANE_SCROLLBARS_NEVER:
+      policy = GTK_POLICY_NEVER;
+      break;
+    }
+
+  gdk_threads_enter ();
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ptr), policy, policy);
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
new file mode 100644 (file)
index 0000000..8f58623
--- /dev/null
@@ -0,0 +1,209 @@
+/* gtktextareapeer.c -- Native implementation of GtkTextAreaPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkTextAreaPeer.h"
+
+#define TEXT_FROM_SW(obj) (GTK_TEXT(GTK_SCROLLED_WINDOW (obj)->container.child))
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create
+  (JNIEnv *env, jobject obj, jint scroll)
+{
+  GtkWidget *text, *sw;
+
+  gdk_threads_enter ();
+  text = gtk_text_new (NULL, NULL);
+  gtk_widget_show (text);
+
+  sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_container_add (GTK_CONTAINER (sw), text);
+
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), 
+
+     /* horizontal scrollbar */
+     (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
+      || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ? 
+       GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
+
+     /* vertical scrollbar */
+     (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
+      || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ? 
+       GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, sw);
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_old_create
+  (JNIEnv *env, jobject obj, jobject parent_obj, 
+   jstring contents, jint scroll)
+{
+  GtkWidget *text, *sw;
+  const char *str;
+  int pos=0;
+  void *parent;
+
+  parent = NSA_GET_PTR (env, parent_obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+
+  gdk_threads_enter ();
+
+  text = gtk_text_new (NULL, NULL);
+  gtk_text_set_editable (GTK_TEXT (text), TRUE);
+
+  gtk_editable_insert_text (GTK_EDITABLE (text), str,
+                           strlen (str), &pos);
+
+  sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_container_add (GTK_CONTAINER (sw), text);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), 
+
+     /* horizontal scrollbar */
+     (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
+      || scroll == AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY) ? 
+       GTK_POLICY_ALWAYS : GTK_POLICY_NEVER,
+
+     /* vertical scrollbar */
+     (scroll == AWT_TEXTAREA_SCROLLBARS_BOTH
+      || scroll == AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY) ? 
+       GTK_POLICY_ALWAYS : GTK_POLICY_NEVER);
+
+  set_visible (text, TRUE);
+  set_parent (sw, GTK_CONTAINER (parent));
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+
+  NSA_SET_PTR (env, obj, sw);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkTextGetSize
+  (JNIEnv *env, jobject obj, jint rows, jint cols, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkWidget *text;
+  GtkScrolledWindow *sw;
+  GtkRequisition myreq;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+  dims[0] = dims[1] = 0;
+
+  gdk_threads_enter ();
+
+  text = GTK_WIDGET (TEXT_FROM_SW (ptr));
+  sw = GTK_SCROLLED_WINDOW (ptr);
+
+  gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->hscrollbar), 
+                          "size_request", &myreq);
+  //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->hscrollbar), 
+  //                                 &myreq);
+  dims[0]=myreq.width+GTK_SCROLLED_WINDOW_CLASS 
+    (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
+
+  gtk_signal_emit_by_name (GTK_OBJECT (GTK_SCROLLED_WINDOW(sw)->vscrollbar), 
+                          "size_request", &myreq);
+  //gtk_widget_size_request(GTK_WIDGET (GTK_SCROLLED_WINDOW(sw)->vscrollbar), 
+  //                                 &myreq);
+  dims[1]=myreq.width+GTK_SCROLLED_WINDOW_CLASS 
+    (GTK_OBJECT (sw)->klass)->scrollbar_spacing;
+  
+  /* The '1' in the following assignments is from 
+     #define TEXT_BORDER_ROOM         1
+     in gtktext.c */
+
+  dims[0] += ((cols * gdk_char_width (text->style->font, 'W'))
+            + (2 * (text->style->klass->xthickness + 1)));
+  dims[1] += ((rows * gdk_char_height (text->style->font, 'W'))
+            + (2 * (text->style->klass->ythickness + 1)));
+
+  gdk_threads_leave ();
+  
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert
+  (JNIEnv *env, jobject obj, jstring contents, jint position)
+{
+  void *ptr;
+  const char *str;
+  int pos=position;
+
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+  
+  gdk_threads_enter ();
+  gtk_editable_insert_text (GTK_EDITABLE (TEXT_FROM_SW (ptr)), 
+                           str, strlen (str), &pos);
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
+  (JNIEnv *env, jobject obj, jstring contents, jint start, jint end)
+{
+  void *ptr;
+  GtkEditable *text;
+  const char *str;
+  int pos = start;
+
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+  
+  gdk_threads_enter ();
+  
+  text = GTK_EDITABLE (TEXT_FROM_SW (ptr));
+  gtk_text_freeze (GTK_TEXT (text));
+  gtk_editable_delete_text (text, start, end);
+  gtk_editable_insert_text (text, str, strlen (str), &pos);
+  gtk_text_thaw (GTK_TEXT (text));
+
+  gdk_threads_leave ();
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+}
+
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
new file mode 100644 (file)
index 0000000..0b6db8f
--- /dev/null
@@ -0,0 +1,180 @@
+/* gtktextcomponentpeer.c -- Native implementation of GtkTextComponentPeer
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkTextComponentPeer.h"
+
+#define GET_EDITABLE(obj) (GTK_IS_EDITABLE (obj) ? GTK_EDITABLE (obj) : \
+  GTK_EDITABLE (GTK_SCROLLED_WINDOW (obj)->container.child))
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getCaretPosition
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  pos = gtk_editable_get_position (GET_EDITABLE (ptr));
+  gdk_threads_leave ();
+  
+  return pos;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setCaretPosition
+  (JNIEnv *env, jobject obj, jint pos)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_editable_set_position (GET_EDITABLE (ptr), pos);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionStart
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  pos = GET_EDITABLE (ptr)->selection_start_pos;
+  gdk_threads_leave ();
+
+  return pos;
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getSelectionEnd
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  int pos;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  pos = GET_EDITABLE (ptr)->selection_end_pos;
+  gdk_threads_leave ();
+
+  return pos;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_select
+  (JNIEnv *env, jobject obj, jint start, jint end)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_editable_select_region (GET_EDITABLE (ptr), start, end);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setEditable
+  (JNIEnv *env, jobject obj, jboolean state)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_editable_set_editable (GET_EDITABLE (ptr), state);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jstring JNICALL
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_getText
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  char *contents;
+  jstring jcontents;
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  contents = gtk_editable_get_chars (GET_EDITABLE (ptr), 0, -1);
+  gdk_threads_leave ();
+
+  jcontents = (*env)->NewStringUTF (env, contents);
+  g_free (contents);
+
+  return jcontents;
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextComponentPeer_setText
+  (JNIEnv *env, jobject obj, jstring contents)
+{
+  void *ptr;
+  GtkEditable *text;
+  const char *str;
+  int pos = 0;
+
+  ptr = NSA_GET_PTR (env, obj);
+  str = (*env)->GetStringUTFChars (env, contents, NULL);
+  
+  gdk_threads_enter ();
+
+  text = GET_EDITABLE (ptr);
+
+  if (GTK_IS_TEXT (text))
+    gtk_text_freeze (GTK_TEXT (text));
+
+  gtk_editable_delete_text (text, 0, -1);
+  gtk_editable_insert_text (text, str, strlen (str), &pos);
+
+  if (GTK_IS_TEXT (text))
+    gtk_text_thaw (GTK_TEXT (text));
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseStringUTFChars (env, contents, str);
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
new file mode 100644 (file)
index 0000000..9085a57
--- /dev/null
@@ -0,0 +1,150 @@
+/* gtktextfieldpeer.c -- Native implementation of GtkTextFieldPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkTextFieldPeer.h"
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create
+  (JNIEnv *env, jobject obj)
+{
+  gpointer widget;
+
+  gdk_threads_enter ();
+  widget = gtk_type_new (gtk_entry_get_type ());
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, widget);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  gtk_widget_realize (GTK_WIDGET (ptr));
+  connect_awt_hook (env, obj, 2, 
+                   GTK_WIDGET (ptr)->window, 
+                   GTK_ENTRY (ptr)->text_area);
+  gdk_threads_leave ();
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_old_create
+  (JNIEnv *env, jobject obj, jobject parent_obj, jstring text)
+{
+  GtkWidget *entry;
+  const char *str;
+  void *parent;
+
+  parent = NSA_GET_PTR (env, parent_obj);
+
+  str = (*env)->GetStringUTFChars (env, text, NULL);
+  gdk_threads_enter ();
+
+  entry = gtk_entry_new ();
+  gtk_entry_set_text (GTK_ENTRY (entry), str);
+
+  set_parent (entry, GTK_CONTAINER (parent));
+
+  gtk_widget_realize (entry);
+  connect_awt_hook (env, obj, 2, 
+                   entry->window, GTK_ENTRY (entry)->text_area);
+
+  NSA_SET_PTR (env, obj, entry);
+
+  gdk_threads_leave ();
+  (*env)->ReleaseStringUTFChars (env, text, str);
+}
+
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetSize
+  (JNIEnv *env, jobject obj, jint cols, jintArray jdims)
+{
+  void *ptr;
+  jint *dims;
+  GtkRequisition myreq;
+  GtkEntry *entry;
+  
+  ptr = NSA_GET_PTR (env, obj);
+  dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+  
+  gdk_threads_enter ();
+  entry = GTK_ENTRY (ptr);
+
+  gtk_signal_emit_by_name (GTK_OBJECT (entry), "size_request", &myreq);  
+  
+  dims[0]=myreq.width-150 + (cols * 
+                            gdk_char_width (GTK_WIDGET (entry)->style->font,
+                                           'W'));
+  dims[1]=myreq.height;
+  
+  gdk_threads_leave ();
+  
+  (*env)->ReleaseIntArrayElements (env, jdims, dims, 0);
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
+  (JNIEnv *env, jobject obj, jchar c)
+{
+  void *ptr;
+  GtkEntry *entry;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  entry = GTK_ENTRY (ptr);
+    
+  if (c!=0)
+    {
+/*        gtk_entry_set_echo_char (entry, c); */
+      gtk_entry_set_visibility (entry, FALSE);
+    }
+  else
+    gtk_entry_set_visibility (entry, TRUE);
+
+  gdk_threads_leave ();
+}
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c
new file mode 100644 (file)
index 0000000..1436bad
--- /dev/null
@@ -0,0 +1,87 @@
+/* gtktoolkit.c -- Native portion of GtkToolkit
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkToolkit.h"
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_beep (JNIEnv *env, jobject obj)
+{
+  gdk_threads_enter ();
+  gdk_beep ();
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_sync (JNIEnv *env, jobject obj)
+{
+  gdk_threads_enter ();
+  gdk_flush ();
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenSizeDimensions
+(JNIEnv *env, jobject obj, jintArray jdims)
+{
+  jint *dims = (*env)->GetIntArrayElements (env, jdims, 0);  
+
+  gdk_threads_enter ();
+
+  dims[0] = gdk_screen_width ();
+  dims[1] = gdk_screen_height ();
+
+  gdk_threads_leave ();
+
+  (*env)->ReleaseIntArrayElements(env, jdims, dims, 0);
+}
+
+JNIEXPORT jint JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkToolkit_getScreenResolution (JNIEnv *env, 
+                                                          jobject obj)
+{
+  jint res;
+
+  gdk_threads_enter ();
+
+  res = gdk_screen_width () / (gdk_screen_width_mm () / 25.4);
+
+  gdk_threads_leave ();
+  return res;
+}
+
diff --git a/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
new file mode 100644 (file)
index 0000000..3b7c06b
--- /dev/null
@@ -0,0 +1,365 @@
+/* gtkwindowpeer.c -- Native implementation of GtkWindowPeer
+   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkWindowPeer.h"
+#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
+#include <gdk/gdkprivate.h>
+#include <gdk/gdkx.h>
+
+static void setBounds (GtkWidget *, jint, jint, jint, jint);
+
+/*
+ * Make a new window (any type)
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create 
+  (JNIEnv *env, jobject obj, jint type)
+{
+  gpointer window;
+  GtkWidget *vbox, *layout;
+
+  gdk_threads_enter ();
+  window = gtk_window_new (type);
+
+  vbox = gtk_vbox_new (0, 0);
+  layout = gtk_layout_new (NULL, NULL);
+  gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
+  gtk_container_add (GTK_CONTAINER (window), vbox);
+
+  gtk_widget_show (layout);
+  gtk_widget_show (vbox);
+
+  gdk_threads_leave ();
+
+  NSA_SET_PTR (env, obj, window);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setVisible
+  (JNIEnv *env, jobject obj, jboolean visible)
+{
+  void *ptr;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  if (visible)
+    gtk_widget_show (GTK_WIDGET (ptr));
+  else
+    gtk_widget_hide (GTK_WIDGET (ptr));
+
+  XFlush (GDK_DISPLAY ());
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectHooks
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GtkWidget *layout;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  layout = GTK_WIDGET (gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child))->data);
+  gtk_widget_realize (layout);
+  connect_awt_hook (env, obj, 1, GTK_LAYOUT (layout)->bin_window);
+  
+  gtk_widget_realize (GTK_WIDGET (ptr));
+  connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
+  gdk_threads_leave ();
+}
+
+void
+setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width, 
+             jint height, jboolean visible)
+{
+  GtkWidget *layout, *vbox;
+  gint x, y;
+
+  gtk_window_set_policy (GTK_WINDOW (window), 1, 1, 0);
+  gtk_widget_set_usize (window, width, height);
+
+  vbox = gtk_vbox_new (0, 0);
+  layout = gtk_layout_new (NULL, NULL);
+  gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
+  gtk_container_add (GTK_CONTAINER (window), vbox);
+  gtk_widget_realize (layout);
+  connect_awt_hook (env, obj, 1, GTK_LAYOUT(layout)->bin_window);
+  gtk_widget_show (layout);
+  gtk_widget_show (vbox);
+
+  gtk_widget_realize (window);
+/*    setBounds (window, x, y, width, height); */
+
+  connect_awt_hook (env, obj, 1, window->window);
+  set_visible (window, visible);
+}
+
+/*
+ * Set a frame's title
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setTitle
+  (JNIEnv *env, jobject obj, jstring title)
+{
+  void *ptr;
+  const char *str;
+
+  ptr = NSA_GET_PTR (env, obj);
+  
+  str = (*env)->GetStringUTFChars (env, title, NULL);
+  
+  gdk_threads_enter ();
+  gtk_window_set_title (GTK_WINDOW (ptr), str);
+  gdk_threads_leave ();
+  
+  (*env)->ReleaseStringUTFChars (env, title, str);
+}
+
+/*
+ * Set a window's resizing policy
+ */
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setResizable
+  (JNIEnv *env, jobject obj, jboolean resize)
+{
+  void *ptr;
+  
+  ptr = NSA_GET_PTR (env, obj);
+  
+  gdk_threads_enter ();
+  gtk_window_set_policy (GTK_WINDOW (ptr), resize, resize, 0);
+  gdk_threads_leave ();
+}
+
+
+/*
+ * Lower the z-level of a window. 
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env, 
+    jobject obj)
+{
+  void *ptr;
+  ptr = NSA_GET_PTR (env, obj);
+    
+  gdk_threads_enter ();
+  gdk_window_lower (GTK_WIDGET (ptr)->window);
+
+  XFlush (GDK_DISPLAY ());
+  gdk_threads_leave ();
+}
+
+/*
+ * Raise the z-level of a window.
+ */
+
+JNIEXPORT void JNICALL 
+Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env, 
+    jobject obj)
+{
+  void *ptr;
+  ptr = NSA_GET_PTR (env, obj);
+    
+  gdk_threads_enter ();
+  gdk_window_raise (GTK_WIDGET (ptr)->window);
+
+  XFlush (GDK_DISPLAY ());
+  gdk_threads_leave ();
+}
+
+static void
+setBounds (GtkWidget *widget, jint x, jint y, jint width, jint height)
+{
+  gint current_x, current_y;
+  gint origin_x, origin_y;
+
+/*    gdk_window_get_root_origin (widget->window, &current_x, &current_y); */
+
+/*    if (current_x != x || current_y != y) */
+/*      { */
+/*        gdk_window_set_hints (widget->window, x, y, 0, 0, 0, 0, GDK_HINT_POS); */
+/*        gdk_window_move (widget->window, x, y); */
+/*      } */
+
+  gtk_widget_set_usize (widget, width, height);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setBounds
+  (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
+{
+  void *ptr;
+  GtkWidget *widget;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+
+  widget = GTK_WIDGET (ptr);
+  setBounds (widget, x, y, width, height);
+
+  gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
+  (JNIEnv *env, jobject obj, jobject menubar)
+{
+  void *wptr, *mptr;
+  GtkBox *box;
+
+  if (!menubar) return;
+
+  wptr = NSA_GET_PTR (env, obj);
+  mptr = NSA_GET_PTR (env, menubar);
+
+  if (!mptr) return; /* this case should remove a menu */
+
+  gdk_threads_enter ();
+  box = GTK_BOX (GTK_BIN (wptr)->child);
+  gtk_box_pack_start (box, GTK_WIDGET (mptr), 0, 0, 0);
+  gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
+  (JNIEnv *env, jobject obj)
+{
+  void *ptr;
+  GList *children;
+  jint height = 0;
+
+  ptr = NSA_GET_PTR (env, obj);
+
+  gdk_threads_enter ();
+  children = gtk_container_children (GTK_CONTAINER (GTK_BIN (ptr)->child));
+  if (g_list_length (children) == 2)
+    {
+      GtkWidget *menubar = GTK_WIDGET (children->data);
+      height = menubar->allocation.height;
+
+    }
+  gdk_threads_leave ();
+
+  return height;
+}
+
+
+void
+gdk_window_get_root_geometry (GdkWindow *window,
+                             gint      *x,
+                             gint      *y,
+                             gint      *width,
+                             gint      *height,
+                             gint      *border,
+                             gint      *depth)
+{
+  GdkWindowPrivate *private;
+  Window xwindow;
+  Window xparent;
+  Window root;
+  Window *children;
+  unsigned int nchildren;
+  
+  g_return_if_fail (window != NULL);
+  
+  private = (GdkWindowPrivate*) window;
+  if (x)
+    *x = 0;
+  if (y)
+    *y = 0;
+  if (width)
+    *width = 0;
+  if (height)
+    *height = 0;
+  if (border)
+    *border = 0;
+  if (depth)
+    *depth = 0;
+
+  if (private->destroyed)
+    return;
+  
+  while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
+    private = (GdkWindowPrivate*) private->parent;
+  if (private->destroyed)
+    return;
+  
+  xparent = private->xwindow;
+  do
+    {
+      xwindow = xparent;
+      if (!XQueryTree (private->xdisplay, xwindow,
+                      &root, &xparent,
+                      &children, &nchildren))
+       return;
+      
+      if (children)
+       XFree (children);
+    }
+  while (xparent != root);
+  
+  if (xparent == root)
+    {
+      unsigned int ww, wh, wb, wd;
+      int wx, wy;
+      
+      if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
+       {
+         if (x)
+           *x = wx;
+         if (y)
+           *y = wy;
+         if (width)
+           *width = ww;
+         if (height)
+           *height = wh;
+         if (border)
+           *border = wb;
+         if (depth)
+           *depth = wd;
+       }
+    }
+}
+
diff --git a/libjava/jni/gtk-peer/gthread-jni.c b/libjava/jni/gtk-peer/gthread-jni.c
new file mode 100644 (file)
index 0000000..9409720
--- /dev/null
@@ -0,0 +1,169 @@
+/* gthread-jni.c -- JNI threading routines for GLIB
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include "gthread-jni.h"
+
+/*
+ * This code has been written specifically to be used with GTK+ 1.2.
+ * `Real' GLIB threading is not supported.  We fake things where necessary.
+ * Once we know we're running on a 1.2 VM, we can write a real implementation.
+ */
+
+static GMutex *
+g_mutex_new_jni_impl (void)
+{
+  jclass obj_class;
+  jobject *mutex;
+
+  obj_class = (*gdk_env)->FindClass (gdk_env, "java/lang/Object");
+  if (obj_class == NULL)
+    return NULL;
+
+  mutex = (jobject *) g_malloc (sizeof (jobject));
+  *mutex = (*gdk_env)->AllocObject (gdk_env, obj_class);
+  if (*mutex == NULL)
+    {
+      g_free (mutex);
+      return NULL;
+    }
+  *mutex = (*gdk_env)->NewGlobalRef (gdk_env, *mutex);
+
+  return (GMutex *) mutex;
+}
+
+static void
+g_mutex_lock_jni_impl (GMutex *mutex)
+{
+  if (mutex && mutex == gdk_threads_mutex)
+    (*gdk_env)->MonitorEnter (gdk_env, *((jobject *)mutex));
+}
+
+static gboolean
+g_mutex_trylock_jni_impl (GMutex *mutex)
+{
+  return FALSE;
+}
+
+static void
+g_mutex_unlock_jni_impl (GMutex *mutex)
+{
+  if (mutex && mutex == gdk_threads_mutex)
+    (*gdk_env)->MonitorExit (gdk_env, *((jobject *)mutex));
+}
+
+static void
+g_mutex_free_jni_impl (GMutex *mutex)
+{
+  if (mutex && mutex == gdk_threads_mutex)
+    {
+      (*gdk_env)->DeleteGlobalRef (gdk_env, *((jobject *)mutex));
+      g_free (mutex);
+    }
+}
+
+static GPrivate *
+g_private_new_jni_impl (GDestroyNotify notify)
+{
+  return NULL;
+}
+
+static gpointer
+g_private_get_jni_impl (GPrivate *private)
+{
+  return NULL;
+}
+
+static void
+g_private_set_jni_impl (GPrivate *private, gpointer data)
+{
+}
+
+static GCond *
+g_cond_new_jni_impl ()
+{
+  return NULL;
+}
+
+static void
+g_cond_signal_jni_impl (GCond *cond)
+{
+}
+
+static void
+g_cond_broadcast_jni_impl (GCond *cond)
+{
+}
+
+static void
+g_cond_wait_jni_impl (GCond *cond, GMutex *mutex)
+{
+}
+
+static gboolean
+g_cond_timed_wait_jni_impl (GCond *cond, GMutex *mutex)
+{
+  return FALSE;
+}
+
+static void
+g_cond_free_jni_impl (GCond *cond)
+{
+}
+
+GThreadFunctions g_thread_jni_functions =
+{
+  g_mutex_new_jni_impl,              /* mutex_new */
+  g_mutex_lock_jni_impl,      /* mutex_lock */
+  g_mutex_trylock_jni_impl,   /* mutex_try_lock */
+  g_mutex_unlock_jni_impl,    /* mutex_unlock */
+  g_mutex_free_jni_impl,      /* mutex_free */
+  g_cond_new_jni_impl,        /* cond_new */
+  g_cond_signal_jni_impl,     /* cond_signal */
+  g_cond_broadcast_jni_impl,  /* cond_broadcast */
+  g_cond_wait_jni_impl,       /* cond_wait */
+  g_cond_timed_wait_jni_impl, /* cond_timed_wait */
+  g_cond_free_jni_impl,       /* cond_free */
+  g_private_new_jni_impl,     /* private_new */
+  g_private_get_jni_impl,     /* private_get */
+  g_private_set_jni_impl      /* private_set */
+};
+
+void
+gdk_threads_wake ()
+{
+}
diff --git a/libjava/jni/gtk-peer/gthread-jni.h b/libjava/jni/gtk-peer/gthread-jni.h
new file mode 100644 (file)
index 0000000..0bb5a56
--- /dev/null
@@ -0,0 +1,47 @@
+/* gthread-jni.h
+   Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+#ifndef __GTHREADJNI_H__
+#define __GTHREADJNI_H__
+
+#include <jni.h>
+#include <glib.h>
+#include "gtkpeer.h"
+
+extern GThreadFunctions g_thread_jni_functions;
+
+#endif /* __GTHREADJNI_H__ */
diff --git a/libjava/jni/gtk-peer/gtkpeer.h b/libjava/jni/gtk-peer/gtkpeer.h
new file mode 100644 (file)
index 0000000..fa1f19b
--- /dev/null
@@ -0,0 +1,299 @@
+/* gtkpeer.h -- Some global variables and #defines
+   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <config.h>
+#include "native_state.h"
+
+#include <jni.h>
+
+#define RC_FILE      ".classpath-gtkrc"
+#define JVM_SUN
+/*
+  #define JVM_JAPHAR
+*/
+
+#ifndef __GTKPEER_H__
+#define __GTKPEER_H__
+
+#ifdef JVM_SUN
+
+extern struct state_table *native_state_table;
+
+#define NSA_INIT(env, clazz) \
+  native_state_table = init_state_table (env, clazz)
+
+#define NSA_GET_PTR(env, obj) \
+  get_state (env, obj, native_state_table)
+
+#define NSA_SET_PTR(env, obj, ptr) \
+  set_state (env, obj, native_state_table, (void *)ptr)
+
+#define NSA_DEL_PTR(env, obj) \
+  remove_state_slot (env, obj, native_state_table)
+
+#endif /* JVM_SUN */
+
+struct graphics
+{
+  GdkDrawable *drawable;
+  GdkGC *gc;
+  GdkColormap *cm;
+  jint x_offset, y_offset;
+};
+
+#define AWT_DEFAULT_CURSOR 0
+#define AWT_CROSSHAIR_CURSOR 1
+#define AWT_TEXT_CURSOR 2
+#define AWT_WAIT_CURSOR 3
+#define AWT_SW_RESIZE_CURSOR 4
+#define AWT_SE_RESIZE_CURSOR 5
+#define AWT_NW_RESIZE_CURSOR 6
+#define AWT_NE_RESIZE_CURSOR 7
+#define AWT_N_RESIZE_CURSOR 8
+#define AWT_S_RESIZE_CURSOR 9
+#define AWT_W_RESIZE_CURSOR 10
+#define AWT_E_RESIZE_CURSOR 11
+#define AWT_HAND_CURSOR 12
+#define AWT_MOVE_CURSOR 13
+
+#define SYNTHETIC_EVENT_MASK (1 << 10)
+
+#define AWT_SHIFT_MASK   (1 << 0)
+#define AWT_CTRL_MASK    (1 << 1)
+#define AWT_META_MASK    (1 << 2)
+#define AWT_ALT_MASK     (1 << 3)
+
+#define AWT_BUTTON1_MASK (1 << 4)
+#define AWT_BUTTON2_MASK AWT_ALT_MASK
+#define AWT_BUTTON3_MASK AWT_META_MASK
+
+#define MULTI_CLICK_TIME   250
+/* as opposed to a MULTI_PASS_TIME :) */
+
+#define AWT_MOUSE_CLICKED  500
+#define AWT_MOUSE_PRESSED  501
+#define AWT_MOUSE_RELEASED 502
+#define AWT_MOUSE_MOVED    503
+#define AWT_MOUSE_ENTERED  504
+#define AWT_MOUSE_EXITED   505
+#define AWT_MOUSE_DRAGGED  506
+
+#define AWT_ADJUSTMENT_UNIT_INCREMENT 1
+#define AWT_ADJUSTMENT_UNIT_DECREMENT 2
+#define AWT_ADJUSTMENT_BLOCK_DECREMENT 3
+#define AWT_ADJUSTMENT_BLOCK_INCREMENT 4
+#define AWT_ADJUSTMENT_TRACK 5
+
+#define AWT_SCROLLPANE_SCROLLBARS_AS_NEEDED 0
+#define AWT_SCROLLPANE_SCROLLBARS_ALWAYS 1
+#define AWT_SCROLLPANE_SCROLLBARS_NEVER 2
+
+#define AWT_LABEL_LEFT 0
+#define AWT_LABEL_CENTER 1
+#define AWT_LABEL_RIGHT 2
+
+#define AWT_TEXTAREA_SCROLLBARS_BOTH 0
+#define AWT_TEXTAREA_SCROLLBARS_VERTICAL_ONLY 1
+#define AWT_TEXTAREA_SCROLLBARS_HORIZONTAL_ONLY 2
+
+#define AWT_ITEM_SELECTED 1
+#define AWT_ITEM_DESELECTED 2
+     
+#define AWT_KEY_TYPED    400
+#define AWT_KEY_PRESSED  401
+#define AWT_KEY_RELEASED 402
+
+#define VK_UNDEFINED   0
+#define AWT_KEY_CHAR_UNDEFINED 0
+
+#define VK_0 48
+#define VK_1 49
+#define VK_2 50
+#define VK_3 51
+#define VK_4 52
+#define VK_5 53
+#define VK_6 54
+#define VK_7 55
+#define VK_8 56
+#define VK_9 57
+#define VK_A 65
+#define VK_ACCEPT 30
+#define VK_ADD 107
+#define VK_ALT 18
+#define VK_B 66
+#define VK_BACK_QUOTE 192
+#define VK_BACK_SLASH 92
+#define VK_BACK_SPACE 8
+#define VK_C 67
+#define VK_CANCEL 3
+#define VK_CAPS_LOCK 20
+#define VK_CLEAR 12 
+#define VK_CLOSE_BRACKET 93
+#define VK_COMMA 44
+#define VK_CONTROL 17
+#define VK_CONVERT 28
+#define VK_D 68
+#define VK_DECIMAL 110
+#define VK_DELETE 127
+#define VK_DIVIDE 111
+#define VK_DOWN 40
+#define VK_E 69
+#define VK_END 35
+#define VK_ENTER 10
+#define VK_ESCAPE 27
+#define VK_F 70
+#define VK_F1 112
+#define VK_F10 121
+#define VK_F11 122
+#define VK_F12 123
+#define VK_F2 113
+#define VK_F3 114
+#define VK_F4 115
+#define VK_F5 116
+#define VK_F6 117
+#define VK_F7 118
+#define VK_F8 119
+#define VK_F9 120
+#define VK_FINAL 24
+#define VK_G 71
+#define VK_H 72
+#define VK_HELP 156
+#define VK_HOME 36
+#define VK_I 73
+#define VK_INSERT 155
+#define VK_J 74
+#define VK_K 75
+#define VK_KANA 21
+#define VK_KANJI 25
+#define VK_L 76
+#define VK_LEFT 37
+#define VK_M 77
+#define VK_META 157
+#define VK_MODECHANGE 31
+#define VK_MULTIPLY 106
+#define VK_N 78
+#define VK_NONCONVERT 29
+#define VK_NUM_LOCK 144
+#define VK_NUMPAD0 96
+#define VK_NUMPAD1 97
+#define VK_NUMPAD2 98
+#define VK_NUMPAD3 99
+#define VK_NUMPAD4 100
+#define VK_NUMPAD5 101
+#define VK_NUMPAD6 102
+#define VK_NUMPAD7 103
+#define VK_NUMPAD8 104
+#define VK_NUMPAD9 105
+#define VK_O 79
+#define VK_OPEN_BRACKET 91
+#define VK_P 80
+#define VK_PAGE_DOWN 34
+#define VK_PAGE_UP 33
+#define VK_PAUSE 19
+#define VK_PERIOD 46
+#define VK_PRINTSCREEN 154
+#define VK_Q 81
+#define VK_QUOTE 222
+#define VK_R 82
+#define VK_RIGHT 39
+#define VK_S 83
+#define VK_SCROLL_LOCK 145
+#define VK_SEMICOLON 59
+#define VK_SEPARATOR 108
+#define VK_SHIFT 16
+#define VK_SLASH 47
+#define VK_SPACE 32
+#define VK_SUBTRACT 109
+#define VK_T 84
+#define VK_TAB 9
+#define VK_U 85
+#define VK_UP 38
+#define VK_V 86
+#define VK_W 87
+#define VK_X 88
+#define VK_Y 89
+#define VK_Z 90
+
+#define AWT_FOCUS_LOST 1004
+#define AWT_FOCUS_GAINED 1005
+
+extern jmethodID postActionEventID;
+extern jmethodID postMenuActionEventID;
+extern jmethodID postMouseEventID;
+extern jmethodID postConfigureEventID;
+extern jmethodID postExposeEventID;
+extern jmethodID postKeyEventID;
+extern jmethodID postFocusEventID;
+extern jmethodID postAdjustmentEventID;
+extern jmethodID postItemEventID;
+extern jmethodID postListItemEventID;
+extern jmethodID syncAttrsID;
+extern jclass gdkColor;
+extern jmethodID gdkColorID;
+extern JNIEnv *gdk_env;
+
+void
+gdk_window_get_root_geometry (GdkWindow *window,
+                             gint      *x,
+                             gint      *y,
+                             gint      *width,
+                             gint      *height,
+                             gint      *border,
+                             gint      *depth);
+
+void awt_event_handler (GdkEvent *event);
+
+void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...);
+
+void set_visible (GtkWidget *widget, jboolean visible);
+void set_parent (GtkWidget *widget, GtkContainer *parent);
+GtkLayout *find_gtk_layout (GtkWidget *parent);
+void setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width, 
+                  jint height, jboolean visible);
+
+struct item_event_hook_info
+{
+  jobject peer_obj;
+  jobject item_obj;
+};
+
+#endif /* __GTKPEER_H */
diff --git a/libjava/libart.m4 b/libjava/libart.m4
new file mode 100644 (file)
index 0000000..9380a22
--- /dev/null
@@ -0,0 +1,165 @@
+# Configure paths for LIBART
+# Raph Levien 98-11-18
+# stolen from Manish Singh    98-9-30
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_LIBART([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for LIBART, and define LIBART_CFLAGS and LIBART_LIBS
+dnl
+AC_DEFUN(AM_PATH_LIBART,
+[dnl 
+dnl Get the cflags and libraries from the libart-config script
+dnl
+AC_ARG_WITH(libart-prefix,[  --with-libart-prefix=PFX   Prefix where LIBART is installed (optional)],
+            libart_prefix="$withval", libart_prefix="")
+AC_ARG_WITH(libart-exec-prefix,[  --with-libart-exec-prefix=PFX Exec prefix where LIBART is installed (optional)],
+            libart_exec_prefix="$withval", libart_exec_prefix="")
+AC_ARG_ENABLE(libarttest, [  --disable-libarttest       Do not try to compile and run a test LIBART program],
+                   , enable_libarttest=yes)
+
+  if test x$libart_exec_prefix != x ; then
+     libart_args="$libart_args --exec-prefix=$libart_exec_prefix"
+     if test x${LIBART_CONFIG+set} != xset ; then
+        LIBART_CONFIG=$libart_exec_prefix/bin/libart-config
+     fi
+  fi
+  if test x$libart_prefix != x ; then
+     libart_args="$libart_args --prefix=$libart_prefix"
+     if test x${LIBART_CONFIG+set} != xset ; then
+        LIBART_CONFIG=$libart_prefix/bin/libart-config
+     fi
+  fi
+
+  AC_PATH_PROG(LIBART_CONFIG, libart-config, no)
+  min_libart_version=ifelse([$1], ,0.2.5,$1)
+  AC_MSG_CHECKING(for LIBART - version >= $min_libart_version)
+  no_libart=""
+  if test "$LIBART_CONFIG" = "no" ; then
+    no_libart=yes
+  else
+    LIBART_CFLAGS=`$LIBART_CONFIG $libartconf_args --cflags`
+    LIBART_LIBS=`$LIBART_CONFIG $libartconf_args --libs`
+
+    libart_major_version=`$LIBART_CONFIG $libart_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    libart_minor_version=`$LIBART_CONFIG $libart_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    libart_micro_version=`$LIBART_CONFIG $libart_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_libarttest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $LIBART_CFLAGS"
+      LIBS="$LIBS $LIBART_LIBS"
+dnl
+dnl Now check if the installed LIBART is sufficiently new. (Also sanity
+dnl checks the results of libart-config to some extent
+dnl
+      rm -f conf.libarttest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libart_lgpl/libart.h>
+
+char*
+my_strdup (char *str)
+{
+  char *new_str;
+  
+  if (str)
+    {
+      new_str = malloc ((strlen (str) + 1) * sizeof(char));
+      strcpy (new_str, str);
+    }
+  else
+    new_str = NULL;
+  
+  return new_str;
+}
+
+int main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.libarttest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = my_strdup("$min_libart_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_libart_version");
+     exit(1);
+   }
+
+   if (($libart_major_version > major) ||
+      (($libart_major_version == major) && ($libart_minor_version > minor)) ||
+      (($libart_major_version == major) && ($libart_minor_version == minor) && ($libart_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** 'libart-config --version' returned %d.%d.%d, but the minimum version\n", $libart_major_version, $libart_minor_version, $libart_micro_version);
+      printf("*** of LIBART required is %d.%d.%d. If libart-config is correct, then it is\n", major, minor, micro);
+      printf("*** best to upgrade to the required version.\n");
+      printf("*** If libart-config was wrong, set the environment variable LIBART_CONFIG\n");
+      printf("*** to point to the correct copy of libart-config, and remove the file\n");
+      printf("*** config.cache before re-running configure\n");
+      return 1;
+    }
+}
+
+],, no_libart=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_libart" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$LIBART_CONFIG" = "no" ; then
+       echo "*** The libart-config script installed by LIBART could not be found"
+       echo "*** If LIBART was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the LIBART_CONFIG environment variable to the"
+       echo "*** full path to libart-config."
+     else
+       if test -f conf.libarttest ; then
+        :
+       else
+          echo "*** Could not run LIBART test program, checking why..."
+          CFLAGS="$CFLAGS $LIBART_CFLAGS"
+          LIBS="$LIBS $LIBART_LIBS"
+          AC_TRY_LINK([
+#include <stdio.h>
+#include <libart_lgpl/libart.h>
+],      [ return 0; ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding LIBART or finding the wrong"
+          echo "*** version of LIBART. If it is not finding LIBART, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+         echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means LIBART was incorrectly installed"
+          echo "*** or that you have moved LIBART since it was installed. In the latter case, you"
+          echo "*** may want to edit the libart-config script: $LIBART_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     LIBART_CFLAGS=""
+     LIBART_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(LIBART_CFLAGS)
+  AC_SUBST(LIBART_LIBS)
+  rm -f conf.libarttest
+])
index e5ed976..c6046e9 100644 (file)
@@ -85,10 +85,19 @@ GCLIBS = @GCLIBS@
 GCOBJS = @GCOBJS@
 GCSPEC = @GCSPEC@
 GCTESTSPEC = @GCTESTSPEC@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_CONFIG = @GLIB_CONFIG@
+GLIB_LIBS = @GLIB_LIBS@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_CONFIG = @GTK_CONFIG@
+GTK_LIBS = @GTK_LIBS@
 HASH_SYNC_SPEC = @HASH_SYNC_SPEC@
 INCLTDL = @INCLTDL@
 INTERPRETER = @INTERPRETER@
 JC1GCSPEC = @JC1GCSPEC@
+LIBART_CFLAGS = @LIBART_CFLAGS@
+LIBART_CONFIG = @LIBART_CONFIG@
+LIBART_LIBS = @LIBART_LIBS@
 LIBFFI = @LIBFFI@
 LIBFFIINCS = @LIBFFIINCS@
 LIBGCJDEBUG = @LIBGCJDEBUG@
@@ -118,6 +127,7 @@ THREADLDFLAGS = @THREADLDFLAGS@
 THREADLIBS = @THREADLIBS@
 THREADOBJS = @THREADOBJS@
 THREADSPEC = @THREADSPEC@
+TOOLKIT = @TOOLKIT@
 VERSION = @VERSION@
 ZINCS = @ZINCS@
 ZLIBS = @ZLIBS@
@@ -129,6 +139,9 @@ here = @here@
 libgcj_basedir = @libgcj_basedir@
 mkinstalldirs = @mkinstalldirs@
 tool_include_dir = @tool_include_dir@
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
+toolexecmainlibdir = @toolexecmainlibdir@
 
 AUTOMAKE_OPTIONS = foreign dejagnu