branch Attitude Adjustment packages
[12.09/packages.git] / libs / glib / patches / 001-automake-compat.patch
1 --- a/configure.in
2 +++ b/configure.in
3 @@ -1,10 +1,9 @@
4  dnl ***********************************
5  dnl *** include special GLib macros ***
6  dnl ***********************************
7 -builtin(include, acglib.m4)dnl
8  
9 -# require autoconf 2.13
10 -AC_PREREQ(2.13)
11 +# require autoconf 2.53
12 +AC_PREREQ(2.53)
13  
14  # init autoconf (and check for presence of glist.c)
15  AC_INIT(glist.c)
16 @@ -13,11 +12,10 @@ AC_INIT(glist.c)
17  cflags_set=${CFLAGS+set}
18  
19  # we rewrite this file
20 -rm -f glibconfig-sysdefs.h
21 +if test "x$cross_compiling" != "xyes"; then
22 +       rm -f glibconfig-sysdefs.h
23 +fi
24  
25 -dnl we need to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
26 -dnl are available for $ac_help expansion (don't we all *love* autoconf?)
27 -AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
28  #
29  # The following version number definitions apply to GLib, GModule and GThread
30  # as a whole, so if changes occoured in any of them, they are all
31 @@ -38,7 +36,6 @@ GLIB_INTERFACE_AGE=10
32  GLIB_BINARY_AGE=10
33  GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
34  dnl
35 -AC_DIVERT_POP()dnl
36  
37  AC_SUBST(GLIB_MAJOR_VERSION)
38  AC_SUBST(GLIB_MINOR_VERSION)
39 @@ -77,17 +74,13 @@ AM_PROG_LIBTOOL
40  dnl Initialize maintainer mode
41  AM_MAINTAINER_MODE
42  
43 -AC_CANONICAL_HOST
44 -
45  dnl figure debugging default, prior to $ac_help setup
46  dnl
47 -AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
48  if test `expr $GLIB_MINOR_VERSION \% 2` = 1 ; then
49         debug_default=yes
50  else
51         debug_default=minimum
52  fi
53 -AC_DIVERT_POP()dnl
54  
55  dnl declare --enable-* args and collect ac_help strings
56  AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
57 @@ -178,38 +171,6 @@ if test "x$GCC" = "xyes"; then
58  fi
59  changequote([,])dnl
60  
61 -dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
62 -AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
63 -glib_save_LIBS=$LIBS
64 -LIBS="$LIBS -lm"
65 -AC_TRY_RUN([#include <math.h>
66 -             int main (void) { return (log(1) != log(1.)); }],
67 -     AC_MSG_RESULT(none needed),
68 -     glib_save_CFLAGS=$CFLAGS
69 -     CFLAGS="$CFLAGS -std1"
70 -     AC_TRY_RUN([#include <math.h>
71 -                 int main (void) { return (log(1) != log(1.)); }],
72 -         AC_MSG_RESULT(-std1),
73 -         AC_MSG_RESULT()
74 -         CFLAGS=$glib_save_CFLAGS
75 -         AC_MSG_WARN(
76 -                [No ANSI prototypes found in library. (-std1 didn't work.)])
77 -     )
78 -)
79 -LIBS=$glib_save_LIBS
80 -
81 -dnl NeXTStep cc seems to need this
82 -AC_MSG_CHECKING([for extra flags for POSIX compliance])
83 -AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
84 -  AC_MSG_RESULT(none needed),
85 -  glib_save_CFLAGS=$CFLAGS
86 -  CFLAGS="$CFLAGS -posix"
87 -  AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
88 -    AC_MSG_RESULT(-posix),
89 -    AC_MSG_RESULT()
90 -    CFLAGS=$glib_save_CFLAGS
91 -    AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
92 -
93  # Checks for header files.
94  AC_HEADER_STDC
95  
96 @@ -405,11 +366,13 @@ AC_CACHE_VAL(glib_cv_sane_realloc,[
97           return realloc (0, sizeof (int)) == 0;
98         }],
99         glib_cv_sane_realloc=yes
100 -       AC_DEFINE(REALLOC_0_WORKS)
101         ,
102         glib_cv_sane_realloc=no
103         ,)
104  ])
105 +if test "x$glib_cv_sane_realloc" = "xyes"; then
106 +       AC_DEFINE(REALLOC_0_WORKS)
107 +fi
108  AC_MSG_RESULT($glib_cv_sane_realloc)
109  
110  
111 @@ -485,7 +448,8 @@ AC_CACHE_VAL(glib_cv_va_val_copy,[
112  ])
113  if test "x$glib_cv_va_copy" = "xyes"; then
114    AC_DEFINE(G_VA_COPY, va_copy)
115 -else if test "x$glib_cv___va_copy" = "xyes"; then
116 +else
117 +if test "x$glib_cv___va_copy" = "xyes"; then
118    AC_DEFINE(G_VA_COPY, __va_copy)
119  fi
120  fi
121 @@ -505,21 +469,13 @@ G_MODULE_NEED_USCORE=0
122  G_MODULE_BROKEN_RTLD_GLOBAL=0
123  G_MODULE_HAVE_DLERROR=0
124  dnl *** dlopen() and dlsym() in system libraries
125 -if test -z "$G_MODULE_IMPL"; then
126 -       AC_CHECK_FUNC(dlopen,
127 -               AC_CHECK_FUNC(dlsym,
128 -                       G_MODULE_IMPL=G_MODULE_IMPL_DL
129 -               ,)
130 -       ,)
131 -fi
132 +AC_CHECK_FUNC([dlopen], [AC_CHECK_FUNC([dlsym], [G_MODULE_IMPL=G_MODULE_IMPL_DL], [])], [])
133  dnl *** dlopen() and dlsym() in libdl
134  if test -z "$G_MODULE_IMPL"; then
135 -       AC_CHECK_LIB(dl, dlopen,
136 -               AC_CHECK_LIB(dl, dlsym,
137 -                       G_MODULE_LIBS=-ldl
138 -                       G_MODULE_IMPL=G_MODULE_IMPL_DL
139 -               ,)
140 -       ,)
141 +       AC_CHECK_LIB([dl], [dlopen], [AC_CHECK_LIB([dl], [dlsym], [
142 +               G_MODULE_LIBS=-ldl
143 +               G_MODULE_IMPL=G_MODULE_IMPL_DL
144 +       ], [])], [])
145  fi
146  dnl *** shl_load() in libdld (HP-UX)
147  if test -z "$G_MODULE_IMPL"; then
148 @@ -854,49 +810,68 @@ if test x"$have_threads" != xnone; then
149                         AC_MSG_CHECKING(whether getpwuid_r is posix like)
150                         # The signature for the POSIX version is:
151                         # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **)
152 -                       AC_TRY_COMPILE([#include <pwd.h>
153 -                                        #include <sys/types.h>
154 -                                        #include <stdlib.h>],
155 -                               [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
156 -                               [AC_DEFINE(HAVE_GETPWUID_R_POSIX)
157 -                               AC_MSG_RESULT(yes)],
158 -                               [AC_MSG_RESULT(no)])
159 +                       AC_CACHE_CHECK([whether pthread_getspecific is posix like],
160 +                               [ac_cv_func_getpwuid_r_posix],
161 +                               [AC_TRY_COMPILE([#include <pwd.h>
162 +                                 #include <sys/types.h>
163 +                                 #include <stdlib.h>],
164 +                                       [getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
165 +                                       [ac_cv_func_getpwuid_r_posix=yes],
166 +                                       [ac_cv_func_getpwuid_r_posix=no])]
167 +                       )
168 +                       if test "x$ac_cv_func_getpwuid_r_posix" = "xyes"; then
169 +                               AC_DEFINE(HAVE_GETPWUID_R_POSIX)
170 +                       fi
171                 fi
172         fi
173         if test x"$have_threads" = xposix; then
174                 LIBS="$LIBS $G_THREAD_LIBS"
175                 AC_MSG_CHECKING(whether pthread_getspecific is posix like)
176                 # PCThreads has pthread_getspecific(pthread_key_t, void **);
177 -               AC_TRY_COMPILE([#include <pthread.h>],
178 -                       [pthread_getspecific(0,NULL);],
179 -                       [AC_MSG_RESULT(no)],
180 -                       [AC_MSG_RESULT(yes)
181 -                       AC_DEFINE(HAVE_PTHREAD_GETSPECIFIC_POSIX)])
182 +               AC_CACHE_CHECK([whether pthread_getspecific is posix like],
183 +                       [glib_cv_sys_pthread_getspecific_posix],
184 +                       [AC_TRY_COMPILE([#include <pthread.h>],
185 +                               [pthread_getspecific(0,NULL);],
186 +                               [glib_cv_sys_pthread_getspecific_posix=no],
187 +                               [glib_cv_sys_pthread_getspecific_posix=yes])]
188 +               )
189 +               if test "x$glib_cv_sys_pthread_getspecific_posix" = "xyes"; then
190 +                       AC_DEFINE(HAVE_PTHREAD_GETSPECIFIC_POSIX)
191 +               fi
192                 AC_MSG_CHECKING(whether pthread_mutex_trylock is posix like)
193                 # DCE Threads return 1 as success, posix 0. what a mess.
194 -               AC_TRY_RUN([#include <pthread.h>
195 -                       pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
196 -                       int main () { 
197 -                       return !pthread_mutex_trylock (&mutex); }],
198 -                       [AC_MSG_RESULT(no)],
199 -                       [AC_MSG_RESULT(yes)
200 -                       AC_DEFINE(HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX)])
201 +               AC_CACHE_CHECK([whether pthread_mutex_trylock is posix like],
202 +                       [glib_cv_sys_pthread_mutex_trylock_posix],
203 +                       [AC_TRY_RUN([#include <pthread.h>
204 +                               pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
205 +                               int main () { 
206 +                               return !pthread_mutex_trylock (&mutex); }],
207 +                       [glib_cv_sys_pthread_mutex_trylock_posix=no],
208 +                       [glib_cv_sys_pthread_mutex_trylock_posix=yes])]
209 +               )
210 +               if test "x$glib_cv_sys_pthread_mutex_trylock_posix=no" = "xyes"; then
211 +                       AC_DEFINE(HAVE_PTHREAD_MUTEX_TRYLOCK_POSIX)
212 +               fi
213                 AC_MSG_CHECKING(whether pthread_cond_timedwait is posix like)
214                 # DCE Threads return -1 as failure, posix ETIMEDOUT.
215 -               AC_TRY_RUN([#include <pthread.h>
216 -                       int main () { 
217 -                       pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
218 -                       pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
219 -                       struct timeval tval;
220 -                       struct timespec tspec;
221 -                       gettimeofday (&tval, NULL);
222 -                       tspec.tv_sec = tval.tv_sec;
223 -                       tspec.tv_nsec = 0;
224 -                       return pthread_cond_timedwait (&cond,&mutex,&tspec) 
225 -                               != -1;}],
226 -                       [AC_MSG_RESULT(no)],
227 -                       [AC_MSG_RESULT(yes)
228 -                       AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_POSIX)])
229 +               AC_CACHE_CHECK([whether pthread_cond_timedwait is posix like],
230 +                       [glib_cv_sys_pthread_cond_timedwait_posix],
231 +                       [AC_TRY_RUN([#include <pthread.h>
232 +                               int main () { 
233 +                               pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
234 +                               pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
235 +                               struct timeval tval;
236 +                               struct timespec tspec;
237 +                               gettimeofday (&tval, NULL);
238 +                               tspec.tv_sec = tval.tv_sec;
239 +                               tspec.tv_nsec = 0;
240 +                               return pthread_cond_timedwait (&cond,&mutex,&tspec) != -1;}],
241 +                       [glib_cv_sys_pthread_cond_timedwait_posix=no],
242 +                       [glib_cv_sys_pthread_cond_timedwait_posix=yes])]
243 +               )
244 +               if test "x$glib_cv_sys_pthread_cond_timedwait_posix" = "xyes"; then
245 +                       AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_POSIX)
246 +               fi
247         fi
248         LIBS="$glib_save_LIBS"
249         CFLAGS="$glib_save_CFLAGS"
250 @@ -940,12 +915,14 @@ GLIB_IF_VAR_EQ(mutex_has_default, yes,
251  dnl ****************************************
252  dnl *** GLib POLL* compatibility defines ***
253  dnl ****************************************
254 +if test "x$cross_compiling" != "xyes"; then
255  GLIB_SYSDEFS(
256  [#include <sys/types.h>
257  #include <sys/poll.h>],
258         POLLIN:1 POLLOUT:4 POLLPRI:2 POLLERR:8 POLLHUP:16 POLLNVAL:32,
259         glibconfig-sysdefs.h,
260         =)
261 +fi
262  
263  
264  dnl ******************************
265 --- a/Makefile.am
266 +++ b/Makefile.am
267 @@ -70,7 +70,7 @@ configinclude_DATA = \
268  
269  CONFIGURE_DEPENDENCIES = acglib.m4             
270  
271 -BUILT_SOURCES = stamp-gc-h #note: not glibconfig.h
272 +BUILT_SOURCES += stamp-gc-h #note: not glibconfig.h
273  glibconfig.h: stamp-gc-h
274         @:
275  stamp-gc-h: config.status
276 --- a/gmodule/Makefile.am
277 +++ b/gmodule/Makefile.am
278 @@ -42,7 +42,7 @@ libgplugin_b_la_LDFLAGS = @G_MODULE_LDFL
279  libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ # $(libglib)
280  
281  noinst_PROGRAMS = testgmodule
282 -testgmodule_LDFLAGS += @G_MODULE_LDFLAGS@
283 +testgmodule_LDFLAGS = @G_MODULE_LDFLAGS@
284  testgmodule_LDADD = libgmodule.la $(libglib) @G_MODULE_LIBS@
285  
286  .PHONY: files release