Re: GModule build fixes
- From: Dan Winship <danw ximian com>
- To: Owen Taylor <otaylor redhat com>
- Cc: timj gtk org, gtk-devel-list gnome org
- Subject: Re: GModule build fixes
- Date: 25 Nov 2001 15:15:45 -0500
On Fri, 2001-11-23 at 21:17, Owen Taylor wrote:
> Well, GLib-1.2 has the same thing, and there haven't been a lot
> of complaints for portability.
It's sort of an edge case (the only common example I know of that needs
it is libglade signal autoconnection), and people didn't seem to know it
was supposed to Just Work. (Lots of GNOME apps currently have
"-export-dynamic" in their LDFLAGS to make the libglade thing work on
non-Linux platforms.)
> (*) My start at guessing the magic is:
>
> G_MODULE_LDFLAGS="`( ./libtool --config ; echo eval echo \\$export_dynamic_flag_spec ) | sh`"
Seems to work (although the ""s aren't necessary).
The attached patch makes all the tests in tests/ pass on NetBSD. It
includes:
* the G_MODULE_LDFLAGS fix
* thread-test fix to use g_thread_yield() to yield, rather than
g_usleep
* addition of a charset alias for NetBSD
* addition of an environment variable for the libcharset
charset.alias file so date-test can pass on platforms that
need a charset.alias file when you haven't "make install"ed
yet.
OK to commit?
-- Dan
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glib/ChangeLog,v
retrieving revision 1.941
diff -u -r1.941 ChangeLog
--- ChangeLog 2001/11/23 15:59:29 1.941
+++ ChangeLog 2001/11/25 20:11:25
@@ -1,3 +1,19 @@
+2001-11-25 Dan Winship <danw ximian com>
+
+ * configure.in (G_MODULE_LDFLAGS): Set this from libtool rather
+ than hardcoding values for certain platforms.
+
+ * glib/libcharset/config.charset: Add a rule for NetBSD.
+
+ * glib/libcharset/localcharset.c (_g_locale_get_charset_aliases):
+ If LIBCHARSET_ALIAS_DIR is set, look for charset.aliases there.
+
+ * tests/Makefile.am (TESTS_ENVIRONMENT): set LIBCHARSET_ALIAS_DIR
+ so we don't depend on charset.aliases having been installed
+
+ * tests/thread-test.c: Change all instances of g_usleep to
+ g_thread_yield.
+
2001-11-23 Hans Breuer <hans breuer org>
* glib/makefile.msc.in : added -Zm400 to DEPCFLAGS to avoid :
Index: configure.in
===================================================================
RCS file: /cvs/gnome/glib/configure.in,v
retrieving revision 1.250
diff -u -r1.250 configure.in
--- configure.in 2001/11/24 22:55:58 1.250
+++ configure.in 2001/11/25 20:11:25
@@ -765,7 +765,7 @@
G_MODULE_LIBS=
G_MODULE_LIBS_EXTRA=
G_MODULE_PLUGIN_LIBS=
-G_MODULE_LDFLAGS=
+G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
dnl G_MODULE_IMPL= don't reset, so cmd-line can override
G_MODULE_NEED_USCORE=0
G_MODULE_BROKEN_RTLD_GLOBAL=0
@@ -809,21 +809,6 @@
fi
dnl *** shl_load() in libdld (HP-UX)
if test -z "$G_MODULE_IMPL"; then
- AC_MSG_CHECKING(how to export all symbols)
- SAVED_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -Wl,-E"
- AC_TRY_LINK(,[ return 0; ],
- [ G_MODULE_LDFLAGS="-Wl,-E" ],[
- LDFLAGS="$SAVED_LDFLAGS -bexpall"
- AC_TRY_LINK(,[ return 0; ],
- [G_MODULE_LDFLAGS="-bexpall"],
- [G_MODULE_LDFLAGS="none"])
- ])
- LDFLAGS=$SAVED_LDFLAGS
- AC_MSG_RESULT($G_MODULE_LDFLAGS)
- if test "x$G_MODULE_LDFLAGS" = "xnone"; then
- G_MODULE_LDFLAGS=
- fi
AC_CHECK_LIB(dld, shl_load,
[G_MODULE_LIBS=-ldld
G_MODULE_IMPL=G_MODULE_IMPL_DLD],
@@ -831,11 +816,6 @@
fi
dnl *** additional checks for G_MODULE_IMPL_DL
if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
- case "$host_os" in
- linux*)
- G_MODULE_LDFLAGS='-rdynamic'
- ;;
- esac
LIBS_orig="$LIBS"
LDFLAGS_orig="$LDFLAGS"
LIBS="$LIBS $G_MODULE_LIBS"
Index: glib/libcharset/config.charset
===================================================================
RCS file: /cvs/gnome/glib/glib/libcharset/config.charset,v
retrieving revision 1.3
diff -u -r1.3 config.charset
--- glib/libcharset/config.charset 2001/11/05 20:40:14 1.3
+++ glib/libcharset/config.charset 2001/11/25 20:11:25
@@ -435,4 +435,7 @@
echo "eo CP850"
echo "eo_EO CP850"
;;
+ netbsd*)
+ echo "646 ASCII"
+ ;;
esac
Index: glib/libcharset/localcharset.c
===================================================================
RCS file: /cvs/gnome/glib/glib/libcharset/localcharset.c,v
retrieving revision 1.1
diff -u -r1.1 localcharset.c
--- glib/libcharset/localcharset.c 2001/09/27 02:49:05 1.1
+++ glib/libcharset/localcharset.c 2001/11/25 20:11:25
@@ -93,9 +93,12 @@
{
#ifndef WIN32
FILE *fp;
- const char *dir = LIBDIR;
+ const char *dir = getenv ("LIBCHARSET_ALIAS_DIR");
const char *base = "charset.alias";
char *file_name;
+
+ if (dir == NULL)
+ dir = LIBDIR;
/* Concatenate dir and base into freshly allocated file_name. */
{
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/gnome/glib/tests/Makefile.am,v
retrieving revision 1.50
diff -u -r1.50 Makefile.am
--- tests/Makefile.am 2001/11/22 18:56:12 1.50
+++ tests/Makefile.am 2001/11/25 20:11:25
@@ -93,7 +93,8 @@
check_PROGRAMS = $(test_programs) $(test_script_support_programs)
TESTS = $(test_programs) $(test_scripts)
-TESTS_ENVIRONMENT = srcdir=$(srcdir)
+TESTS_ENVIRONMENT = srcdir=$(srcdir) \
+ LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset
progs_LDADD = $(EFENCE) $(libglib) $(EFENCE)
thread_LDADD = $(libgthread) @G_THREAD_LIBS@ $(progs_LDADD)
Index: tests/thread-test.c
===================================================================
RCS file: /cvs/gnome/glib/tests/thread-test.c,v
retrieving revision 1.8
diff -u -r1.8 thread-test.c
--- tests/thread-test.c 2001/05/18 08:44:57 1.8
+++ tests/thread-test.c 2001/11/25 20:11:26
@@ -29,7 +29,7 @@
g_assert (G_TRYLOCK (test_g_mutex));
thread = g_thread_create (test_g_mutex_thread, GINT_TO_POINTER (42),
TRUE, NULL);
- g_usleep (G_USEC_PER_SEC);
+ g_thread_yield ();
test_g_mutex_int = 42;
G_UNLOCK (test_g_mutex);
g_mutex_unlock (test_g_mutex_mutex);
@@ -68,14 +68,14 @@
g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
thread = g_thread_create (test_g_static_rec_mutex_thread,
GINT_TO_POINTER (42), TRUE, NULL);
- g_usleep (G_USEC_PER_SEC);
+ g_thread_yield ();
g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex));
- g_usleep (G_USEC_PER_SEC);
+ g_thread_yield ();
test_g_static_rec_mutex_int = 41;
g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex);
test_g_static_rec_mutex_int = 42;
g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex);
- g_usleep (G_USEC_PER_SEC);
+ g_thread_yield ();
g_static_rec_mutex_lock (&test_g_static_rec_mutex_mutex);
test_g_static_rec_mutex_int = 0;
g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex);
@@ -137,7 +137,7 @@
test_g_static_private_destructor);
}
*private2 = number * 2;
- g_usleep (G_USEC_PER_SEC / 5);
+ g_thread_yield ();
g_assert (number == *private1);
g_assert (number * 2 == *private2);
}
@@ -147,7 +147,7 @@
/* Busy wait is not nice but that's just a test */
while (test_g_static_private_ready != 0)
- g_usleep (G_USEC_PER_SEC / 5);
+ g_thread_yield ();
for (i = 0; i < 10; i++)
{
@@ -160,7 +160,7 @@
test_g_static_private_destructor);
}
*private2 = number * 2;
- g_usleep (G_USEC_PER_SEC / 5);
+ g_thread_yield ();
g_assert (number * 2 == *private2);
}
@@ -183,7 +183,7 @@
/* Busy wait is not nice but that's just a test */
while (test_g_static_private_ready != THREADS)
- g_usleep (G_USEC_PER_SEC / 5);
+ g_thread_yield ();
/* Reuse the static private */
g_static_private_free (&test_g_static_private_private2);
@@ -224,7 +224,7 @@
test_g_static_rw_lock_state++;
G_UNLOCK (test_g_static_rw_lock_state);
- g_usleep (10);
+ g_thread_yield ();
G_LOCK (test_g_static_rw_lock_state);
test_g_static_rw_lock_state--;
@@ -245,7 +245,7 @@
test_g_static_rw_lock_state = -1;
G_UNLOCK (test_g_static_rw_lock_state);
- g_usleep (10);
+ g_thread_yield ();
G_LOCK (test_g_static_rw_lock_state);
test_g_static_rw_lock_state = 0;
@@ -267,7 +267,7 @@
threads[i] = g_thread_create (test_g_static_rw_lock_thread,
NULL, TRUE, NULL);
}
- g_usleep (G_USEC_PER_SEC);
+ g_thread_yield ();
test_g_static_rw_lock_run = FALSE;
for (i = 0; i < THREADS; i++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]