[PATCH] BeOS Patch #3



Guys,

Here's the third patch for BeOS.  I hope I've answered the problems that
were outlined by Tim before the New Year.  As always let me know if this
isn't OK and why it's not OK...

david
Index: configure.in
===================================================================
RCS file: /cvs/gnome/glib/configure.in,v
retrieving revision 1.164
diff -u -r1.164 configure.in
--- configure.in	2000/12/22 13:44:22	1.164
+++ configure.in	2001/01/02 02:25:40
@@ -78,16 +78,19 @@
 
 AC_CANONICAL_HOST
 
+G_BEOS_NEEDED_LDFLAGS=
 AC_MSG_CHECKING(for the BeOS)
 case $host in
   *-*-beos*)
     glib_native_beos="yes"
+    G_BEOS_NEEDED_LDFLAGS=../libglib-$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.la
     ;;
   *)
     glib_native_beos="no"
     ;;
 esac
 AC_MSG_RESULT([$glib_native_beos])
+AC_SUBST(G_BEOS_NEEDED_LDFLAGS)
 
 dnl
 
@@ -450,10 +453,18 @@
         AC_DEFINE(HAVE_SYS_SELECT_H,1,[found fd_set in sys/select.h])
         AC_MSG_RESULT([yes, found in sys/select.h])
     else
-	AC_DEFINE(NO_FD_SET,1,[didn't find fd_set])
-	AC_MSG_RESULT(no)
+        AC_HEADER_EGREP(fd_set, sys/socket.h, gtk_ok=yes)
+        if test $gtk_ok = yes; then
+            # This is for BeOS
+            AC_DEFINE(FD_SET_IN_SYS_SOCKET_H,1,[found fd_set in sys/socket.h])
+            AC_MSG_RESULT([yes, found in sys/socket.h])
+        else
+            AC_DEFINE(NO_FD_SET,1,[didn't find fd_set])
+            AC_MSG_RESULT(no)
+        fi
     fi
 fi
+AC_SEARCH_LIBS(select, socket bind)
 
 dnl *** check for sane realloc() ***
 AC_CACHE_CHECK([whether realloc (NULL,) will work],glib_cv_sane_realloc,[
@@ -581,8 +592,6 @@
 dnl *** g_module checks ***
 dnl ***********************
 G_MODULE_LIBS=
-G_MODULE_LIBS_EXTRA=
-G_MODULE_PLUGIN_LIBS=
 G_MODULE_LDFLAGS=
 dnl G_MODULE_IMPL= don't reset, so cmd-line can override
 G_MODULE_NEED_USCORE=0
@@ -597,9 +606,7 @@
 dnl *** load_image (BeOS)
 if test -z "$G_MODULE_IMPL" -a "x$glib_native_beos" = "xyes"; then
   AC_CHECK_LIB(root, load_image,
-      [G_MODULE_LIBS="-lbe -lroot -lglib"
-      G_MODULE_LIBS_EXTRA="-L\$(top_builddir_full)/.libs"
-      G_MODULE_PLUGIN_LIBS="-L\$(top_builddir_full)/gmodule/.libs -lgmodule"
+      [G_MODULE_LIBS="-lbe -lroot"
       G_MODULE_IMPL=G_MODULE_IMPL_BEOS],
       [])
 fi   
@@ -697,14 +704,11 @@
  
 AC_SUBST(G_MODULE_IMPL)
 AC_SUBST(G_MODULE_LIBS)
-AC_SUBST(G_MODULE_LIBS_EXTRA)
-AC_SUBST(G_MODULE_PLUGIN_LIBS)
 AC_SUBST(G_MODULE_LDFLAGS)
 AC_SUBST(G_MODULE_HAVE_DLERROR)
 AC_SUBST(G_MODULE_NEED_USCORE)
 AC_SUBST(GLIB_DEBUG_FLAGS)
 
-
 dnl ***********************
 dnl *** g_thread checks ***
 dnl ***********************
@@ -805,7 +809,6 @@
 dnl ********************************
 
 G_THREAD_LIBS=
-G_THREAD_LIBS_EXTRA=
 G_THREAD_CFLAGS=
 
 if test x"$have_threads" != xnone; then
@@ -959,6 +962,12 @@
            mutex_header_file='thread.h'
 	   g_threads_impl="SOLARIS"
            ;;
+        beos)
+           G_THREAD_LIBS="-lbe -lroot"
+           mutex_has_default=no
+           mutex_header_file='kernel/OS.h'
+           g_threads_impl="BEOS"
+           ;;
         none)
 	   g_threads_impl="NONE"
            ;;
@@ -972,15 +981,6 @@
         AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
 fi
 
-case $host in
-  *-*-beos*)
-    G_THREAD_LIBS="-lbe -lroot -lglib "
-    G_THREAD_LIBS_EXTRA="-L\$(top_builddir_full)/.libs"
-    ;;
-  *)
-    ;;
-esac
-
 AC_MSG_CHECKING(thread related libraries)
 AC_MSG_RESULT($G_THREAD_LIBS)
 
@@ -1108,11 +1108,15 @@
 			 glib_cv_sizeof_system_thread=`expr $glib_cv_sizeof_system_thread + $ac_cv_sizeof_long`],
 			[AC_MSG_RESULT(no)])
 	   
-	else # solaris threads
+	elif test x"$have_threads" = xsolaris; then
 		GLIB_SIZEOF([#include <thread.h>],
 			thread_t,
 			system_thread)
-	fi
+	elif text x"$have_threads" = xbeos; then
+                GLIB_SIZEOF([#include <kernel/OS.h>],
+                         thread_id,
+                         system_thread)
+        fi
 
 	LIBS="$glib_save_LIBS"
 
@@ -1134,7 +1138,6 @@
 		   [Source file containing theread implementation])
 AC_SUBST(G_THREAD_CFLAGS)
 AC_SUBST(G_THREAD_LIBS)
-AC_SUBST(G_THREAD_LIBS_EXTRA)
 
 dnl **********************************************
 dnl *** GDefaultMutex setup and initialization ***
Index: gfileutils.c
===================================================================
RCS file: /cvs/gnome/glib/gfileutils.c,v
retrieving revision 1.13
diff -u -r1.13 gfileutils.c
--- gfileutils.c	2000/12/05 20:45:32	1.13
+++ gfileutils.c	2001/01/02 02:25:43
@@ -54,6 +54,11 @@
 
 #endif /* G_OS_WIN32 */
 
+#ifdef G_OS_BEOS
+/* we need stdlib.h for the definition of mkstemp */
+#include <stdlib.h>
+#endif /* G_OS_BEOS */
+
 #ifndef S_ISLNK
 #define S_ISLNK(x) 0
 #endif
Index: gmain.c
===================================================================
RCS file: /cvs/gnome/glib/gmain.c,v
retrieving revision 1.50
diff -u -r1.50 gmain.c
--- gmain.c	2000/12/14 21:02:19	1.50
+++ gmain.c	2001/01/02 02:25:47
@@ -35,6 +35,9 @@
 
 /* uncomment the next line to get poll() debugging info */
 /* #define G_MAIN_POLL_DEBUG */
+#ifdef FD_SET_IN_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
 
 #include "glib.h"
 #include <sys/types.h>
@@ -57,10 +60,6 @@
 #include <windows.h>
 #endif /* G_OS_WIN32 */
 
-#ifdef G_OS_BEOS
-#include <net/socket.h>
-#endif /* G_OS_BEOS */
-
 /* Types */
 
 typedef struct _GTimeoutSource GTimeoutSource;
@@ -412,10 +411,6 @@
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
-
-#ifdef G_OS_BEOS
-#undef NO_FD_SET
-#endif /* G_OS_BEOS */
 
 #ifndef NO_FD_SET
 #  define SELECT_MASK fd_set
Index: gspawn.c
===================================================================
RCS file: /cvs/gnome/glib/gspawn.c,v
retrieving revision 1.3
diff -u -r1.3 gspawn.c
--- gspawn.c	2000/11/02 12:31:10	1.3
+++ gspawn.c	2001/01/02 02:25:51
@@ -20,6 +20,14 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef FD_SET_IN_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
 #include "glib.h"
 #include <sys/time.h>
 #include <sys/types.h>
Index: gtimer.c
===================================================================
RCS file: /cvs/gnome/glib/gtimer.c,v
retrieving revision 1.13
diff -u -r1.13 gtimer.c
--- gtimer.c	2000/09/06 13:56:15	1.13
+++ gtimer.c	2001/01/02 02:25:51
@@ -32,6 +32,10 @@
 #include <config.h>
 #endif
 
+#ifdef FD_SET_IN_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif /* HAVE_SYS_SOCKET_H */
+
 #include "glib.h"
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
Index: gmodule/Makefile.am
===================================================================
RCS file: /cvs/gnome/glib/gmodule/Makefile.am,v
retrieving revision 1.24
diff -u -r1.24 Makefile.am
--- gmodule/Makefile.am	2000/10/16 01:02:17	1.24
+++ gmodule/Makefile.am	2001/01/02 02:26:08
@@ -40,17 +40,17 @@
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
 	-export-dynamic
 
-libgmodule_1_3_la_LIBADD = @G_MODULE_LIBS_EXTRA@ @G_MODULE_LIBS@ # $(libglib)
+libgmodule_1_3_la_LIBADD = @G_BEOS_NEEDED_LDFLAGS@ # $(libglib)
 # we should really depend on $(libglib) for libgmodule.la, but libtool has a
 # problem with this ;(
 
 libgplugin_a_la_SOURCES = libgplugin_a.c
 libgplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module
-libgplugin_a_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ # $(libglib)
+libgplugin_a_la_LIBADD = @G_MODULE_LIBS@ @G_BEOS_NEEDED_LDFLAGS@ # $(libglib)
 
 libgplugin_b_la_SOURCES = libgplugin_b.c
 libgplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module
-libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ # $(libglib)
+libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ @G_BEOS_NEEDED_LDFLAGS@ # $(libglib)
 
 noinst_PROGRAMS = testgmodule
 testgmodule_LDFLAGS += @G_MODULE_LDFLAGS@
Index: gmodule/gmodule-beos.c
===================================================================
RCS file: /cvs/gnome/glib/gmodule/gmodule-beos.c,v
retrieving revision 1.3
diff -u -r1.3 gmodule-beos.c
--- gmodule/gmodule-beos.c	2000/07/26 11:02:01	1.3
+++ gmodule/gmodule-beos.c	2001/01/02 02:26:08
@@ -24,10 +24,12 @@
  * MT safe
  */
 
-#include <be/kernel/image.h> /* image (aka DSO) handling functions... */
+#undef MIN
+#undef MAX
+#include <kernel/image.h> /* image (aka DSO) handling functions... */
 
 /*
- * The BeOS doesn't use the same symantics as Unix's dlopen....
+ * BeOS doesn't use the same symantics as Unix's dlopen....
  * 
  */
 #ifndef	RTLD_GLOBAL
@@ -69,7 +71,6 @@
       
       g_module_set_error (msg);
       g_free (msg);
-      
       return NULL;
     }
   
@@ -82,21 +83,20 @@
   image_info info;
   int32 cookie = 0;
   status_t status;
+  gchar *msg;
   
-  /* Is it always the first one?  I'm guessing yes. */
-  status = get_next_image_info (0, &cookie, &info);
-  if (status == B_OK)
-    return (gpointer) info.id;
-  else
-    {
-      gchar *msg = g_strdup_printf ("failed to get_next_image_info(self): %s",
-				    strerror (status));
+  while (get_next_image_info(0, &cookie, &info) >= 0) {
+    if (info.type == B_APP_IMAGE) {
+      return (gpointer) info.id;
+    }
+  }
+  msg = g_strdup_printf ("failed to get_next_image_info(self): %s",
+                   strerror (status));     
       
-      g_module_set_error (msg);
-      g_free (msg);
+  g_module_set_error (msg);
+  g_free (msg);
       
-      return NULL;
-    }
+  return NULL;
 }
 
 static void
@@ -105,13 +105,15 @@
 {
   image_info info;
   gchar *name;
-  
+  status_t status;
+ 
   if (unload_add_on ((image_id) handle) != B_OK)
     {
       gchar *msg;
       
       /* Try and get the name of the image. */
-      if (get_image_info ((image_id) handle, &info) != B_OK)
+      status = get_image_info ((image_id) handle, &info);
+      if (status != B_OK)
 	name = g_strdup ("unknown");
       else
 	name = g_strdup (info.name);
Index: gmodule/gmodule.c
===================================================================
RCS file: /cvs/gnome/glib/gmodule/gmodule.c,v
retrieving revision 1.29
diff -u -r1.29 gmodule.c
--- gmodule/gmodule.c	2000/12/22 13:44:25	1.29
+++ gmodule/gmodule.c	2001/01/02 02:26:09
@@ -137,6 +137,8 @@
 #include "gmodule-dld.c"
 #elif	(G_MODULE_IMPL == G_MODULE_IMPL_WIN32)
 #include "gmodule-win32.c"
+#elif   (G_MODULE_IMPL == G_MODULE_IMPL_BEOS)
+#include "gmodule-beos.c"
 #else
 #undef	SUPPORT_OR_RETURN
 #define	SUPPORT_OR_RETURN(rv)	{ g_module_set_error ("dynamic modules are " \
Index: gobject/Makefile.am
===================================================================
RCS file: /cvs/gnome/glib/gobject/Makefile.am,v
retrieving revision 1.21
diff -u -r1.21 Makefile.am
--- gobject/Makefile.am	2000/12/13 08:36:17	1.21
+++ gobject/Makefile.am	2001/01/02 02:26:10
@@ -19,7 +19,7 @@
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
 	-export-dynamic						\
 @STRIP_END@
-libgobject_1_3_la_LIBADD = # $(libglib)
+libgobject_1_3_la_LIBADD = @G_BEOS_NEEDED_LDFLAGS@ # $(libglib)
 
 #
 # setup source file variables
Index: gthread/Makefile.am
===================================================================
RCS file: /cvs/gnome/glib/gthread/Makefile.am,v
retrieving revision 1.19
diff -u -r1.19 Makefile.am
--- gthread/Makefile.am	2000/10/25 10:58:46	1.19
+++ gthread/Makefile.am	2001/01/02 02:26:10
@@ -29,7 +29,7 @@
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
 	-export-dynamic
 
-libgthread_1_3_la_LIBADD = @G_THREAD_LIBS_EXTRA@ @G_THREAD_LIBS@
+libgthread_1_3_la_LIBADD = @G_BEOS_NEEDED_LDFLAGS@ @G_THREAD_LIBS@ 
 
 gthread.rc: $(top_builddir)/config.status $(top_srcdir)/gthread/gthread.rc.in
 	cd $(top_builddir) && CONFIG_FILES=gthread/$@ CONFIG_HEADERS= $(SHELL) ./config.status


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]