Merge from vendor branch TNF:
[pkgsrcv2.git] / devel / glib2 / patches / patch-ak
1 $NetBSD$
2
3 --- configure.ac.orig   2011-10-14 04:12:40.000000000 +0000
4 +++ configure.ac
5 @@ -882,7 +882,7 @@ int main (int argc, char **argv)
6  AC_MSG_RESULT($g_have_gnuc_visibility)
7  AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes])
8  
9 -AC_MSG_CHECKING([whether using Sun Studio C compiler])
10 +AC_MSG_CHECKING([whether using Sun Studio C compiler visibilily])
11  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
12  #else
13  # include "error: this is not Sun Studio."
14 @@ -1114,8 +1114,20 @@ AC_SUBST(NETWORK_LIBS)
15  
16  case $host in
17    *-*-solaris* )
18 +    AC_MSG_CHECKING([whether using Sun Studio C compiler with C99])
19 +    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__STDC_VERSION__) || (__STDC_VERSION__ - 0 >= 199901L)
20 +#else
21 +# include "error: this is STD C99."
22 +#endif
23 +    ]], [[]])], [ g_have_sunstudio_c99=yes ], [ g_have_sunstudio_c99=no ])
24 +    AC_MSG_RESULT($g_have_sunstudio_c99)
25 +    if test $g_have_sunstudio_c99 = yes; then
26 +      AC_DEFINE(_XOPEN_SOURCE,          600, Needed to get declarations for msg_control and msg_controllen on Solaris)
27 +    else
28       AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris)
29       AC_DEFINE(_XOPEN_SOURCE,          2, Needed to get declarations for msg_control and msg_controllen on Solaris)
30 +    fi
31 +
32       AC_DEFINE(__EXTENSIONS__,         1, Needed to get declarations for msg_control and msg_controllen on Solaris)
33       ;;
34  esac
35 @@ -1509,11 +1521,12 @@ if test x"$glib_native_win32" = xyes; th
36    G_MODULE_LDFLAGS=
37  else
38    export SED
39 -  G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
40 +  G_MODULE_LDFLAGS=`(libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
41  fi
42  dnl G_MODULE_IMPL= don't reset, so cmd-line can override
43  G_MODULE_NEED_USCORE=0
44  G_MODULE_BROKEN_RTLD_GLOBAL=0
45 +G_MODULE_BROKEN_DLOPEN_NULL=0
46  G_MODULE_HAVE_DLERROR=0
47  dnl *** force native WIN32 shared lib loader 
48  if test -z "$G_MODULE_IMPL"; then
49 @@ -1574,7 +1587,7 @@ if test "$G_MODULE_IMPL" = "G_MODULE_IMP
50         LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
51  dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
52         echo "void glib_plugin_test(void) { }" > plugin.c
53 -       ${SHELL} ./libtool --mode=compile ${CC} -shared \
54 +       ${SHELL} libtool --mode=compile ${CC} -shared \
55                 -export-dynamic -o plugin.o plugin.c 2>&1 >/dev/null
56         AC_CACHE_CHECK([for RTLD_GLOBAL brokenness],
57                 glib_cv_rtldglobal_broken,[
58 @@ -1638,6 +1651,38 @@ dnl *** check for having dlerror()
59                 [G_MODULE_HAVE_DLERROR=0])
60         LIBS="$LIBS_orig"
61  fi
62 +dnl *** check for dlopen(NULL, 0) brokenness
63 +       AC_CACHE_CHECK([for dlopen(NULL, 0) brokenness],
64 +               glib_cv_dlopennull_broken,[
65 +               AC_TRY_RUN([
66 +#include <stdio.h>
67 +#include <dlfcn.h>
68 +#ifndef RTLD_GLOBAL
69 +#  define RTLD_GLOBAL 0
70 +#endif
71 +#ifndef RTLD_LAZY
72 +#  define RTLD_LAZY 0
73 +#endif
74 +int gettext;
75 +int main () {
76 +    void *handle;
77 +    handle = dlopen ("libm.so", RTLD_GLOBAL | RTLD_LAZY);
78 +    if (!handle) return 0;
79 +    handle = dlopen (NULL, 0);
80 +    if (!handle) return 0;
81 +    handle = dlsym (handle, "sin");
82 +    return handle == NULL;
83 +}
84 +               ],
85 +               [glib_cv_dlopennull_broken=no],
86 +               [glib_cv_dlopennull_broken=yes],
87 +               [glib_cv_dlopennull_broken=no])
88 +       ])
89 +       if test "x$glib_cv_dlopennull_broken" = "xyes"; then
90 +               G_MODULE_BROKEN_DLOPEN_NULL=1
91 +       else
92 +               G_MODULE_BROKEN_DLOPEN_NULL=0
93 +       fi
94  dnl *** done, have we got an implementation?
95  if test -z "$G_MODULE_IMPL"; then
96         G_MODULE_IMPL=0
97 @@ -1648,7 +1693,7 @@ fi
98  
99  AC_MSG_CHECKING(for the suffix of module shared libraries)
100  export SED
101 -shrext_cmds=`./libtool --config | grep '^shrext_cmds='`
102 +shrext_cmds=`libtool --config | grep '^shrext_cmds='`
103  eval $shrext_cmds
104  module=yes eval std_shrext=$shrext_cmds
105  # chop the initial dot
106 @@ -1667,6 +1712,8 @@ AC_SUBST(G_MODULE_PLUGIN_LIBS)
107  AC_SUBST(G_MODULE_LDFLAGS)
108  AC_SUBST(G_MODULE_HAVE_DLERROR)
109  AC_SUBST(G_MODULE_BROKEN_RTLD_GLOBAL)
110 +AC_SUBST(G_MODULE_BROKEN_DLOPEN_NULL)
111 +
112  AC_SUBST(G_MODULE_NEED_USCORE)
113  AC_SUBST(GLIB_DEBUG_FLAGS)
114  
115 @@ -2055,22 +2102,8 @@ if test x"$have_threads" != xno; then
116          G_THREAD_LIBS="-lpthread -lthread"
117          ;;
118        *)
119 -        for flag in pthread pthreads mt; do
120 -          glib_save_CFLAGS="$CFLAGS"
121 -          CFLAGS="$CFLAGS -$flag"
122 -          AC_TRY_RUN(glib_thread_test(0),
123 -                     glib_flag_works=yes,
124 -                     glib_flag_works=no,
125 -                     [AC_LINK_IFELSE([AC_LANG_SOURCE(glib_thread_test(0))],
126 -                                     glib_flag_works=yes,
127 -                                     glib_flag_works=no)])
128 -          CFLAGS="$glib_save_CFLAGS"
129 -          if test $glib_flag_works = yes ; then
130 -             G_THREAD_CFLAGS=-$flag
131 -            G_THREAD_LIBS=-$flag
132 -            break;
133 -          fi
134 -        done
135 +       G_THREAD_LIBS="${PTHREAD_LDFLAGS} ${PTHREAD_LIBS}"
136 +       G_THREAD_CFLAGS="${PTHREAD_CFLAGS}"
137           ;;
138      esac 
139    fi
140 @@ -3771,7 +3804,7 @@ AC_ARG_ENABLE(Bsymbolic,
141                             enable_Bsymbolic=no)
142                 LDFLAGS="${SAVED_LDFLAGS}"])
143  
144 -if test "x${enable_Bsymbolic}" == "xyes"; then
145 +if test "x${enable_Bsymbolic}" = "xyes"; then
146    GLIB_LINK_FLAGS=-Wl,-Bsymbolic-functions
147  fi
148