Files
pkgsrc-ng/devel/glib2/patches/patch-ak
2016-01-21 23:40:00 +01:00

158 lines
5.7 KiB
Plaintext

$NetBSD: patch-ak,v 1.18 2014/10/07 23:18:36 prlw1 Exp $
- solaris sun studio check and fix
- use pkgsrc libtool
- broken dlopen(NULL,0) detection and workaround
http://bugzilla.gnome.org/show_bug.cgi?id=140329
- remove unnecessary executions of libtool from configure
https://bugzilla.gnome.org/show_bug.cgi?id=736710
--- configure.ac.orig 2013-06-09 22:53:13.000000000 +0000
+++ configure.ac
@@ -858,7 +858,7 @@ int main (void)
AC_MSG_RESULT($g_have_gnuc_visibility)
AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes])
-AC_MSG_CHECKING([whether using Sun Studio C compiler])
+AC_MSG_CHECKING([whether using Sun Studio C compiler visibility])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
#else
# include "error: this is not Sun Studio."
@@ -1129,10 +1129,22 @@ AC_CHECK_TYPE([struct ip_mreqn], [
case $host in
*-*-solaris* )
- AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
- AC_DEFINE(_XOPEN_SOURCE, 2, Needed to get declarations for msg_control and msg_controllen on Solaris)
- AC_DEFINE(__EXTENSIONS__, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
- ;;
+ AC_MSG_CHECKING([whether using Sun Studio C compiler with C99])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__STDC_VERSION__) || (__STDC_VERSION__ - 0 >= 199901L)
+#else
+# include "error: this is STD C99."
+#endif
+ ]], [[]])], [ g_have_sunstudio_c99=yes ], [ g_have_sunstudio_c99=no ])
+ AC_MSG_RESULT($g_have_sunstudio_c99)
+ if test $g_have_sunstudio_c99 = yes; then
+ AC_DEFINE(_XOPEN_SOURCE, 600, Needed to get declarations for msg_control and msg_controllen on Solaris)
+ else
+ AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
+ AC_DEFINE(_XOPEN_SOURCE, 2, Needed to get declarations for msg_control and msg_controllen on Solaris)
+ fi
+
+ AC_DEFINE(__EXTENSIONS__, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
+ ;;
esac
dnl
@@ -1491,11 +1503,12 @@ if test x"$glib_native_win32" = xyes; th
G_MODULE_LDFLAGS=
else
export SED
- G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
+ eval G_MODULE_LDFLAGS=$export_dynamic_flag_spec
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
@@ -1556,13 +1569,12 @@ AS_IF([ test "$G_MODULE_IMPL" = "G_MODUL
LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
echo "void glib_plugin_test(void) { }" > plugin.c
- ${SHELL} ./libtool --mode=compile --tag=CC ${CC} ${CFLAGS} \
+ ${SHELL} libtool --mode=compile --tag=CC ${CC} ${CFLAGS} \
${CPPFLAGS} -c -o plugin.lo plugin.c >/dev/null 2>&1
- ${SHELL} ./libtool --mode=link --tag=CC ${CC} ${CFLAGS} \
+ ${SHELL} libtool --mode=link --tag=CC ${CC} ${CFLAGS} \
${LDFLAGS} -module -o plugin.la -export-dynamic \
-shrext ".o" -avoid-version plugin.lo \
-rpath /dont/care >/dev/null 2>&1
- eval `./libtool --config | grep ^objdir`
AC_CACHE_CHECK([for RTLD_GLOBAL brokenness],
glib_cv_rtldglobal_broken,[
AC_TRY_RUN([
@@ -1625,6 +1638,38 @@ dnl *** check for having dlerror()
[G_MODULE_HAVE_DLERROR=0])
LIBS="$LIBS_orig"
])
+dnl *** check for dlopen(NULL, 0) brokenness
+ AC_CACHE_CHECK([for dlopen(NULL, 0) brokenness],
+ glib_cv_dlopennull_broken,[
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <dlfcn.h>
+#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
@@ -1635,7 +1680,5 @@ fi
AC_MSG_CHECKING(for the suffix of module shared libraries)
export SED
-shrext_cmds=`./libtool --config | grep '^shrext_cmds='`
-eval $shrext_cmds
module=yes eval std_shrext=$shrext_cmds
# chop the initial dot
@@ -1654,6 +1699,7 @@ 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)
@@ -2035,22 +2081,8 @@ AS_IF([ test x"$have_threads" = xposix],
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([AC_LANG_SOURCE(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
])