$NetBSD: patch-ak,v 1.3 2008/09/06 11:07:20 obache Exp $ --- configure.in.orig 2008-09-02 17:47:31.000000000 +0000 +++ configure.in @@ -1304,6 +1304,7 @@ fi dnl G_MODULE_IMPL= don't reset, so cmd-line can override G_MODULE_NEED_USCORE=0 G_MODULE_BROKEN_RTLD_GLOBAL=0 +G_MODULE_BROKEN_DLOPEN_NULL=0 G_MODULE_HAVE_DLERROR=0 dnl *** force native WIN32 shared lib loader if test -z "$G_MODULE_IMPL"; then @@ -1428,6 +1429,38 @@ dnl *** check for having dlerror() [G_MODULE_HAVE_DLERROR=0]) LIBS="$LIBS_orig" fi +dnl *** check for dlopen(NULL, 0) brokenness + AC_CACHE_CHECK([for dlopen(NULL, 0) brokenness], + glib_cv_dlopennull_broken,[ + AC_TRY_RUN([ +#include +#include +#ifndef RTLD_GLOBAL +# define RTLD_GLOBAL 0 +#endif +#ifndef RTLD_LAZY +# define RTLD_LAZY 0 +#endif +int gettext; +int main () { + void *handle; + handle = dlopen ("libm.so", RTLD_GLOBAL | RTLD_LAZY); + if (!handle) return 0; + handle = dlopen (NULL, 0); + if (!handle) return 0; + handle = dlsym (handle, "sin"); + return handle == NULL; +} + ], + [glib_cv_dlopennull_broken=no], + [glib_cv_dlopennull_broken=yes], + [glib_cv_dlopennull_broken=no]) + ]) + if test "x$glib_cv_dlopennull_broken" = "xyes"; then + G_MODULE_BROKEN_DLOPEN_NULL=1 + else + G_MODULE_BROKEN_DLOPEN_NULL=0 + fi dnl *** done, have we got an implementation? if test -z "$G_MODULE_IMPL"; then G_MODULE_IMPL=0 @@ -1457,6 +1490,8 @@ AC_SUBST(G_MODULE_PLUGIN_LIBS) AC_SUBST(G_MODULE_LDFLAGS) AC_SUBST(G_MODULE_HAVE_DLERROR) AC_SUBST(G_MODULE_BROKEN_RTLD_GLOBAL) +AC_SUBST(G_MODULE_BROKEN_DLOPEN_NULL) + AC_SUBST(G_MODULE_NEED_USCORE) AC_SUBST(GLIB_DEBUG_FLAGS) @@ -1844,22 +1879,8 @@ if test x"$have_threads" != xno; then G_THREAD_LIBS="-lpthread -lthread" ;; *) - for flag in pthread pthreads mt; do - glib_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -$flag" - AC_TRY_RUN(glib_thread_test(0), - glib_flag_works=yes, - glib_flag_works=no, - [AC_LINK_IFELSE(glib_thread_test(0), - glib_flag_works=yes, - glib_flag_works=no)]) - CFLAGS="$glib_save_CFLAGS" - if test $glib_flag_works = yes ; then - G_THREAD_CFLAGS=-$flag - G_THREAD_LIBS=-$flag - break; - fi - done + G_THREAD_LIBS="${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}" + G_THREAD_CFLAGS="${PTHREAD_CFLAGS}" ;; esac fi @@ -2255,6 +2276,10 @@ case $host in *) G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS" ;; + *-*-netbsd*) + # On NetBSD, pkgsrc's libtool does the right thing. + G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS" + ;; esac AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c",