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