Merge lp:~linuxjedi/libdrizzle/5.1-remove-glib into lp:libdrizzle
- 5.1-remove-glib
- Merge into libdrizzle-redux
Proposed by
Andrew Hutchings
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Andrew Hutchings | ||||
Approved revision: | 66 | ||||
Merged at revision: | 66 | ||||
Proposed branch: | lp:~linuxjedi/libdrizzle/5.1-remove-glib | ||||
Merge into: | lp:libdrizzle | ||||
Diff against target: |
595 lines (+126/-297) 4 files modified
cli/drizzle_binlogs.c (+126/-74) cli/include.am (+0/-6) configure.ac (+0/-3) m4/glib-2.0.m4 (+0/-214) |
||||
To merge this branch: | bzr merge lp:~linuxjedi/libdrizzle/5.1-remove-glib | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Trunk | Pending | ||
Review via email: mp+141439@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'cli/drizzle_binlogs.c' |
2 | --- cli/drizzle_binlogs.c 2012-12-26 08:26:59 +0000 |
3 | +++ cli/drizzle_binlogs.c 2012-12-28 21:28:24 +0000 |
4 | @@ -38,47 +38,110 @@ |
5 | #include <libdrizzle-5.1/libdrizzle.h> |
6 | #include <stdlib.h> |
7 | #include <sys/types.h> |
8 | -#include <glib.h> |
9 | -#include <glib/gstdio.h> |
10 | #include <pwd.h> |
11 | #include <unistd.h> |
12 | #include <errno.h> |
13 | +#include <argp.h> |
14 | +#include <time.h> |
15 | |
16 | #define STR_HELPER(x) #x |
17 | #define STR(x) STR_HELPER(x) |
18 | |
19 | -gchar *host= NULL; |
20 | -gint port= DRIZZLE_DEFAULT_TCP_PORT; |
21 | -gchar *user= NULL; |
22 | -gboolean user_alloced= FALSE; |
23 | -gchar *pass= NULL; |
24 | -gchar *outdir= NULL; |
25 | -gchar *start_file= NULL; |
26 | -gint start_pos= 0; |
27 | -gboolean continuous= FALSE; |
28 | - |
29 | -static GOptionEntry main_options[]= { |
30 | - { "host", 0, 0, G_OPTION_ARG_STRING, &host, "Hostname of server, default "DRIZZLE_DEFAULT_TCP_HOST, NULL }, |
31 | - { "port", 0, 0, G_OPTION_ARG_INT, &port, "Port number of server, default "STR(DRIZZLE_DEFAULT_TCP_PORT), NULL }, |
32 | - { "user", 0, 0, G_OPTION_ARG_STRING, &user, "Username for the server, default is current system user", NULL }, |
33 | - { "pass", 0, 0, G_OPTION_ARG_STRING, &pass, "Password for the server", NULL }, |
34 | - { "outdir", 0, 0, G_OPTION_ARG_FILENAME, &outdir, "Output directory", NULL }, |
35 | - { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } |
36 | -}; |
37 | - |
38 | -static GOptionEntry binlog_options[]= { |
39 | - { "start-file", 0, 0, G_OPTION_ARG_FILENAME, &start_file, "Binlog file to start with", NULL }, |
40 | - { "start-pos", 0, 0, G_OPTION_ARG_INT, &start_pos, "Position to start with", NULL }, |
41 | - { "continuous", 0, 0, G_OPTION_ARG_NONE, &continuous, "Continous download mode", NULL } |
42 | -}; |
43 | - |
44 | -gboolean get_system_user(char *dest, uint8_t len); |
45 | +char *host= NULL; |
46 | +uint16_t port= DRIZZLE_DEFAULT_TCP_PORT; |
47 | +char *user= NULL; |
48 | +bool user_alloced= false; |
49 | +char *pass= NULL; |
50 | +char *outdir= NULL; |
51 | +char *start_file= NULL; |
52 | +uint32_t start_pos= 0; |
53 | +bool continuous= false; |
54 | +uint8_t opt_count= 0; |
55 | + |
56 | +typedef enum |
57 | +{ |
58 | + OPT_NONE, |
59 | + OPT_HOST, |
60 | + OPT_PORT, |
61 | + OPT_USER, |
62 | + OPT_PASS, |
63 | + OPT_OUTDIR, |
64 | + OPT_FILE, |
65 | + OPT_START_POS, |
66 | + OPT_CONTINUOUS |
67 | +} option_consts_t; |
68 | + |
69 | +static struct argp_option options[]= { |
70 | + { "host", OPT_HOST, "HOST", 0, "Hostname of server, default "DRIZZLE_DEFAULT_TCP_HOST, 0 }, |
71 | + { "port", OPT_PORT, "PORT", 0, "Port number of server, default "STR(DRIZZLE_DEFAULT_TCP_PORT), 0 }, |
72 | + { "user", OPT_USER, "USER", 0, "Username for the server, default is current system user", 0 }, |
73 | + { "pass", OPT_PASS, "PASS", 0, "Password for the server", 0 }, |
74 | + { "outdir", OPT_OUTDIR, "OUTDIR", 0, "Output directory", 0 }, |
75 | + { 0, 0, 0, 0, "Binlog Options", 1 }, |
76 | + { "start-file", OPT_FILE, "FILENAME", 0, "Binlog file to start with", 1 }, |
77 | + { "start-pos", OPT_START_POS, "POS", 0, "Position to start with", 1 }, |
78 | + { "continuous", OPT_CONTINUOUS, 0, 0, "Continous download mode", 1 }, |
79 | + { 0 } |
80 | +}; |
81 | + |
82 | +static char doc[]= "Drizzle binlog retriever"; |
83 | +static char args_doc[]= ""; |
84 | +const char *argp_program_version= LIBDRIZZLE_VERSION_STRING; |
85 | +static error_t parse_opt(int key, char *arg, struct argp_state *state) |
86 | +{ |
87 | + (void)(state); |
88 | + switch(key) |
89 | + { |
90 | + case OPT_HOST: |
91 | + host= arg; |
92 | + opt_count++; |
93 | + break; |
94 | + case OPT_PORT: |
95 | + port= atoi(arg); |
96 | + opt_count++; |
97 | + break; |
98 | + case OPT_USER: |
99 | + user= arg; |
100 | + opt_count++; |
101 | + break; |
102 | + case OPT_PASS: |
103 | + pass= arg; |
104 | + opt_count++; |
105 | + break; |
106 | + case OPT_OUTDIR: |
107 | + outdir= arg; |
108 | + opt_count++; |
109 | + break; |
110 | + case OPT_FILE: |
111 | + start_file= arg; |
112 | + opt_count++; |
113 | + break; |
114 | + case OPT_START_POS: |
115 | + start_pos= atoi(arg); |
116 | + opt_count++; |
117 | + break; |
118 | + case OPT_CONTINUOUS: |
119 | + continuous= true; |
120 | + opt_count++; |
121 | + break; |
122 | + case ARGP_KEY_NO_ARGS: |
123 | + break; |
124 | + default: |
125 | + return ARGP_ERR_UNKNOWN; |
126 | + break; |
127 | + } |
128 | + return 0; |
129 | +} |
130 | + |
131 | +static struct argp argp = { options, parse_opt, args_doc, doc, NULL, NULL, NULL }; |
132 | + |
133 | +bool get_system_user(char *dest, uint8_t len); |
134 | drizzle_st *_connect(void); |
135 | FILE *create_binlog_file(char *binlog_file); |
136 | void get_binlogs(drizzle_st *con); |
137 | void write_binlog(FILE* file, const uint8_t* data, uint32_t len); |
138 | |
139 | -gboolean get_system_user(char *dest, uint8_t len) |
140 | +bool get_system_user(char *dest, uint8_t len) |
141 | { |
142 | long pw_len= sysconf(_SC_GETPW_R_SIZE_MAX); |
143 | struct passwd pw_struct; |
144 | @@ -87,16 +150,16 @@ |
145 | { |
146 | pw_len= 1024; |
147 | } |
148 | - char *pw_buffer= g_malloc(pw_len); |
149 | + char *pw_buffer= malloc(pw_len); |
150 | |
151 | if (getpwuid_r(geteuid(), &pw_struct, pw_buffer, pw_len, &pw_tmp_struct) == 0) |
152 | { |
153 | - g_strlcpy(dest, pw_struct.pw_name, len); |
154 | - g_free(pw_buffer); |
155 | - return TRUE; |
156 | + strncpy(dest, pw_struct.pw_name, len); |
157 | + free(pw_buffer); |
158 | + return true; |
159 | } |
160 | - g_free(pw_buffer); |
161 | - return FALSE; |
162 | + free(pw_buffer); |
163 | + return false; |
164 | } |
165 | |
166 | drizzle_st *_connect(void) |
167 | @@ -107,13 +170,13 @@ |
168 | con= drizzle_create_tcp(host, port, user, pass, "", 0); |
169 | if (!con) |
170 | { |
171 | - g_print("Drizzle connection object creation error\n"); |
172 | + printf("Drizzle connection object creation error\n"); |
173 | return NULL; |
174 | } |
175 | ret= drizzle_connect(con); |
176 | if (ret != DRIZZLE_RETURN_OK) |
177 | { |
178 | - g_print("Error connecting to server: %s\n", drizzle_error(con)); |
179 | + printf("Error connecting to server: %s\n", drizzle_error(con)); |
180 | return NULL; |
181 | } |
182 | return con; |
183 | @@ -122,20 +185,17 @@ |
184 | FILE *create_binlog_file(char *binlog_file) |
185 | { |
186 | FILE *outfile; |
187 | - char *filename; |
188 | + char filename[PATH_MAX]; |
189 | if (outdir) |
190 | { |
191 | - filename= g_strdup_printf("%s/%s", outdir, binlog_file); |
192 | + snprintf(filename, PATH_MAX, "%s/%s", outdir, binlog_file); |
193 | + outfile= fopen(filename, "w"); |
194 | } |
195 | else |
196 | { |
197 | - filename= binlog_file; |
198 | - } |
199 | - outfile= g_fopen(filename, "w"); |
200 | - if (outdir) |
201 | - { |
202 | - g_free(filename); |
203 | - } |
204 | + outfile= fopen(binlog_file, "w"); |
205 | + } |
206 | + |
207 | return outfile; |
208 | } |
209 | |
210 | @@ -143,15 +203,17 @@ |
211 | { |
212 | drizzle_result_st *result; |
213 | drizzle_return_t ret; |
214 | - int server_id; |
215 | + uint16_t server_id; |
216 | FILE *outfile; |
217 | - gchar *binlog_file; |
218 | + char binlog_file[PATH_MAX]; |
219 | uint32_t event_len; |
220 | - gboolean read_end= FALSE; |
221 | + bool read_end= false; |
222 | |
223 | if (continuous) |
224 | { |
225 | - server_id= g_random_int_range(32768, 65535); |
226 | + srand(time(NULL)); |
227 | + // Random server ID from range 32767 - 65535 |
228 | + server_id= rand() % 32768 + 32767; |
229 | } |
230 | else |
231 | { |
232 | @@ -161,15 +223,15 @@ |
233 | result= drizzle_start_binlog(con, server_id, start_file, start_pos, &ret); |
234 | if (ret != DRIZZLE_RETURN_OK) |
235 | { |
236 | - g_print("Drizzle binlog start failure: %s\n", drizzle_error(con)); |
237 | + printf("Drizzle binlog start failure: %s\n", drizzle_error(con)); |
238 | exit(EXIT_FAILURE); |
239 | } |
240 | |
241 | - binlog_file= g_strdup(start_file); |
242 | + snprintf(binlog_file, PATH_MAX, "%s", start_file); |
243 | outfile= create_binlog_file(binlog_file); |
244 | if (!outfile) |
245 | { |
246 | - g_print("Could not create binlog file '%s', errno %d\n", binlog_file, errno); |
247 | + printf("Could not create binlog file '%s', errno %d\n", binlog_file, errno); |
248 | exit(EXIT_FAILURE); |
249 | } |
250 | |
251 | @@ -185,20 +247,19 @@ |
252 | // EOF |
253 | if (ret != DRIZZLE_RETURN_EOF) |
254 | { |
255 | - g_print("Read error: %d - %s\n", ret, drizzle_error(con)); |
256 | + printf("Read error: %d - %s\n", ret, drizzle_error(con)); |
257 | } |
258 | - read_end= TRUE; |
259 | + read_end= true; |
260 | break; |
261 | } |
262 | if (drizzle_binlog_event_type(result) == DRIZZLE_EVENT_TYPE_ROTATE) |
263 | { |
264 | fclose(outfile); |
265 | - g_free(binlog_file); |
266 | - binlog_file= g_strndup((const gchar *)drizzle_binlog_event_data(result), drizzle_binlog_event_length(result)); |
267 | + snprintf(binlog_file, PATH_MAX, "%.*s", drizzle_binlog_event_length(result), drizzle_binlog_event_data(result)); |
268 | outfile= create_binlog_file(binlog_file); |
269 | if (!outfile) |
270 | { |
271 | - g_print("Could not create binlog file '%s', errno %d\n", binlog_file, errno); |
272 | + printf("Could not create binlog file '%s', errno %d\n", binlog_file, errno); |
273 | exit(EXIT_FAILURE); |
274 | } |
275 | break; |
276 | @@ -220,7 +281,7 @@ |
277 | { |
278 | if (write(fileno(file), data, len) <= 0) |
279 | { |
280 | - g_print("Error: binlog: Error writing binary log: %s", strerror(errno)); |
281 | + printf("Error: binlog: Error writing binary log: %s", strerror(errno)); |
282 | exit(EXIT_FAILURE); |
283 | } |
284 | } |
285 | @@ -229,21 +290,13 @@ |
286 | |
287 | int main(int argc, char *argv[]) |
288 | { |
289 | - GError *error= NULL; |
290 | - GOptionContext *context; |
291 | drizzle_st *con; |
292 | char sysuser[DRIZZLE_MAX_USER_SIZE]; |
293 | |
294 | - context= g_option_context_new(" - Drizzle binlog retriever"); |
295 | - GOptionGroup *main_group= g_option_group_new("main", "Main Options", "Main Options", NULL, NULL); |
296 | - GOptionGroup *binlog_group= g_option_group_new("binlog", "Binlog Options", "Binlog Options", NULL, NULL); |
297 | - g_option_group_add_entries(main_group, main_options); |
298 | - g_option_group_add_entries(binlog_group, binlog_options); |
299 | - g_option_context_set_main_group(context, main_group); |
300 | - g_option_context_add_group(context, binlog_group); |
301 | - if (!g_option_context_parse(context, &argc, &argv, &error)) |
302 | + argp_parse(&argp, argc, argv, 0, 0, NULL); |
303 | + if (opt_count == 0) |
304 | { |
305 | - g_print("Error parsing options: %s, try --help\n", error->message); |
306 | + argp_help(&argp, stdout, ARGP_HELP_STD_USAGE, program_invocation_short_name); |
307 | return EXIT_FAILURE; |
308 | } |
309 | if (!user) |
310 | @@ -251,13 +304,13 @@ |
311 | user= sysuser; |
312 | if (!get_system_user(user, DRIZZLE_MAX_USER_SIZE)) |
313 | { |
314 | - g_print("No user specified and could not determine current user\n"); |
315 | + printf("No user specified and could not determine current user\n"); |
316 | return EXIT_FAILURE; |
317 | } |
318 | } |
319 | if (!host) |
320 | { |
321 | - host= g_strdup(DRIZZLE_DEFAULT_TCP_HOST); |
322 | + host= (char*)DRIZZLE_DEFAULT_TCP_HOST; |
323 | } |
324 | if (!port) |
325 | { |
326 | @@ -265,7 +318,7 @@ |
327 | } |
328 | if (!start_file) |
329 | { |
330 | - g_print("Binlog start file required\n"); |
331 | + printf("Binlog start file required\n"); |
332 | return EXIT_FAILURE; |
333 | } |
334 | con = _connect(); |
335 | @@ -275,6 +328,5 @@ |
336 | } |
337 | get_binlogs(con); |
338 | drizzle_quit(con); |
339 | - g_option_context_free(context); |
340 | return EXIT_SUCCESS; |
341 | } |
342 | |
343 | === modified file 'cli/include.am' |
344 | --- cli/include.am 2012-12-27 19:47:01 +0000 |
345 | +++ cli/include.am 2012-12-28 21:28:24 +0000 |
346 | @@ -2,16 +2,10 @@ |
347 | # included from Top Level Makefile.am |
348 | # All paths should be given relative to the root |
349 | |
350 | -if HAVE_GLIB |
351 | - |
352 | bin_PROGRAMS+= cli/drizzle_binlogs |
353 | cli_drizzle_binlogs_SOURCES= cli/drizzle_binlogs.c |
354 | cli_drizzle_binlogs_LDADD= libdrizzle/libdrizzle.la |
355 | -cli_drizzle_binlogs_LDADD+= @GLIB_LIBS@ |
356 | -cli_drizzle_binlogs_CFLAGS= @GLIB_CFLAGS@ |
357 | -cli_drizzle_binlogs_CXXFLAGS= @GLIB_CFLAGS@ |
358 | |
359 | check_SCRIPTS+= cli/drizzle_binlogs_check.sh |
360 | EXTRA_DIST+= ${check_SCRIPTS} |
361 | |
362 | -endif |
363 | |
364 | === modified file 'configure.ac' |
365 | --- configure.ac 2012-12-27 11:36:56 +0000 |
366 | +++ configure.ac 2012-12-28 21:28:24 +0000 |
367 | @@ -59,9 +59,6 @@ |
368 | # Checks for libraries. |
369 | AX_CXX_GCC_ABI_DEMANGLE |
370 | AX_CHECK_OPENSSL |
371 | -AM_PATH_GLIB_2_0(,[HAVE_GLIB=false],[HAVE_GLIB=true]) |
372 | - |
373 | -AM_CONDITIONAL([HAVE_GLIB],[test "x$HAVE_GLIB"="xtrue"]) |
374 | |
375 | # Checks for header files. |
376 | AC_DEFUN([CHECK_FOR_CXXABI], |
377 | |
378 | === removed file 'm4/glib-2.0.m4' |
379 | --- m4/glib-2.0.m4 2012-12-17 21:04:59 +0000 |
380 | +++ m4/glib-2.0.m4 1970-01-01 00:00:00 +0000 |
381 | @@ -1,214 +0,0 @@ |
382 | -# Configure paths for GLIB |
383 | -# Owen Taylor 1997-2001 |
384 | - |
385 | -dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) |
386 | -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject, |
387 | -dnl gthread, or gio is specified in MODULES, pass to pkg-config |
388 | -dnl |
389 | -AC_DEFUN([AM_PATH_GLIB_2_0], |
390 | -[dnl |
391 | -dnl Get the cflags and libraries from pkg-config |
392 | -dnl |
393 | -AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], |
394 | - , enable_glibtest=yes) |
395 | - |
396 | - pkg_config_args=glib-2.0 |
397 | - for module in . $4 |
398 | - do |
399 | - case "$module" in |
400 | - gmodule) |
401 | - pkg_config_args="$pkg_config_args gmodule-2.0" |
402 | - ;; |
403 | - gmodule-no-export) |
404 | - pkg_config_args="$pkg_config_args gmodule-no-export-2.0" |
405 | - ;; |
406 | - gobject) |
407 | - pkg_config_args="$pkg_config_args gobject-2.0" |
408 | - ;; |
409 | - gthread) |
410 | - pkg_config_args="$pkg_config_args gthread-2.0" |
411 | - ;; |
412 | - gio*) |
413 | - pkg_config_args="$pkg_config_args $module-2.0" |
414 | - ;; |
415 | - esac |
416 | - done |
417 | - |
418 | - PKG_PROG_PKG_CONFIG([0.16]) |
419 | - |
420 | - no_glib="" |
421 | - |
422 | - if test "x$PKG_CONFIG" = x ; then |
423 | - no_glib=yes |
424 | - PKG_CONFIG=no |
425 | - fi |
426 | - |
427 | - min_glib_version=ifelse([$1], ,2.0.0,$1) |
428 | - AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) |
429 | - |
430 | - if test x$PKG_CONFIG != xno ; then |
431 | - ## don't try to run the test against uninstalled libtool libs |
432 | - if $PKG_CONFIG --uninstalled $pkg_config_args; then |
433 | - echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" |
434 | - enable_glibtest=no |
435 | - fi |
436 | - |
437 | - if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then |
438 | - : |
439 | - else |
440 | - no_glib=yes |
441 | - fi |
442 | - fi |
443 | - |
444 | - if test x"$no_glib" = x ; then |
445 | - GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` |
446 | - GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` |
447 | - GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` |
448 | - GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable=glib_compile_resources gio-2.0` |
449 | - |
450 | - GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` |
451 | - GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` |
452 | - glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
453 | - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` |
454 | - glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
455 | - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` |
456 | - glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ |
457 | - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` |
458 | - if test "x$enable_glibtest" = "xyes" ; then |
459 | - ac_save_CFLAGS="$CFLAGS" |
460 | - ac_save_LIBS="$LIBS" |
461 | - CFLAGS="$CFLAGS $GLIB_CFLAGS" |
462 | - LIBS="$GLIB_LIBS $LIBS" |
463 | -dnl |
464 | -dnl Now check if the installed GLIB is sufficiently new. (Also sanity |
465 | -dnl checks the results of pkg-config to some extent) |
466 | -dnl |
467 | - rm -f conf.glibtest |
468 | - AC_TRY_RUN([ |
469 | -#include <glib.h> |
470 | -#include <stdio.h> |
471 | -#include <stdlib.h> |
472 | - |
473 | -int |
474 | -main () |
475 | -{ |
476 | - unsigned int major, minor, micro; |
477 | - char *tmp_version; |
478 | - |
479 | - fclose (fopen ("conf.glibtest", "w")); |
480 | - |
481 | - /* HP/UX 9 (%@#!) writes to sscanf strings */ |
482 | - tmp_version = g_strdup("$min_glib_version"); |
483 | - if (sscanf(tmp_version, "%u.%u.%u", &major, &minor, µ) != 3) { |
484 | - printf("%s, bad version string\n", "$min_glib_version"); |
485 | - exit(1); |
486 | - } |
487 | - |
488 | - if ((glib_major_version != $glib_config_major_version) || |
489 | - (glib_minor_version != $glib_config_minor_version) || |
490 | - (glib_micro_version != $glib_config_micro_version)) |
491 | - { |
492 | - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", |
493 | - $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, |
494 | - glib_major_version, glib_minor_version, glib_micro_version); |
495 | - printf ("*** was found! If pkg-config was correct, then it is best\n"); |
496 | - printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); |
497 | - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
498 | - printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
499 | - printf("*** required on your system.\n"); |
500 | - printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); |
501 | - printf("*** to point to the correct configuration files\n"); |
502 | - } |
503 | - else if ((glib_major_version != GLIB_MAJOR_VERSION) || |
504 | - (glib_minor_version != GLIB_MINOR_VERSION) || |
505 | - (glib_micro_version != GLIB_MICRO_VERSION)) |
506 | - { |
507 | - printf("*** GLIB header files (version %d.%d.%d) do not match\n", |
508 | - GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); |
509 | - printf("*** library (version %d.%d.%d)\n", |
510 | - glib_major_version, glib_minor_version, glib_micro_version); |
511 | - } |
512 | - else |
513 | - { |
514 | - if ((glib_major_version > major) || |
515 | - ((glib_major_version == major) && (glib_minor_version > minor)) || |
516 | - ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) |
517 | - { |
518 | - return 0; |
519 | - } |
520 | - else |
521 | - { |
522 | - printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n", |
523 | - glib_major_version, glib_minor_version, glib_micro_version); |
524 | - printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n", |
525 | - major, minor, micro); |
526 | - printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); |
527 | - printf("***\n"); |
528 | - printf("*** If you have already installed a sufficiently new version, this error\n"); |
529 | - printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); |
530 | - printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
531 | - printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); |
532 | - printf("*** correct copy of pkg-config. (In this case, you will have to\n"); |
533 | - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
534 | - printf("*** so that the correct libraries are found at run-time))\n"); |
535 | - } |
536 | - } |
537 | - return 1; |
538 | -} |
539 | -],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
540 | - CFLAGS="$ac_save_CFLAGS" |
541 | - LIBS="$ac_save_LIBS" |
542 | - fi |
543 | - fi |
544 | - if test "x$no_glib" = x ; then |
545 | - AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) |
546 | - ifelse([$2], , :, [$2]) |
547 | - else |
548 | - AC_MSG_RESULT(no) |
549 | - if test "$PKG_CONFIG" = "no" ; then |
550 | - echo "*** A new enough version of pkg-config was not found." |
551 | - echo "*** See http://www.freedesktop.org/software/pkgconfig/" |
552 | - else |
553 | - if test -f conf.glibtest ; then |
554 | - : |
555 | - else |
556 | - echo "*** Could not run GLIB test program, checking why..." |
557 | - ac_save_CFLAGS="$CFLAGS" |
558 | - ac_save_LIBS="$LIBS" |
559 | - CFLAGS="$CFLAGS $GLIB_CFLAGS" |
560 | - LIBS="$LIBS $GLIB_LIBS" |
561 | - AC_TRY_LINK([ |
562 | -#include <glib.h> |
563 | -#include <stdio.h> |
564 | -], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], |
565 | - [ echo "*** The test program compiled, but did not run. This usually means" |
566 | - echo "*** that the run-time linker is not finding GLIB or finding the wrong" |
567 | - echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" |
568 | - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
569 | - echo "*** to the installed location Also, make sure you have run ldconfig if that" |
570 | - echo "*** is required on your system" |
571 | - echo "***" |
572 | - echo "*** If you have an old version installed, it is best to remove it, although" |
573 | - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], |
574 | - [ echo "*** The test program failed to compile or link. See the file config.log for the" |
575 | - echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) |
576 | - CFLAGS="$ac_save_CFLAGS" |
577 | - LIBS="$ac_save_LIBS" |
578 | - fi |
579 | - fi |
580 | - GLIB_CFLAGS="" |
581 | - GLIB_LIBS="" |
582 | - GLIB_GENMARSHAL="" |
583 | - GOBJECT_QUERY="" |
584 | - GLIB_MKENUMS="" |
585 | - GLIB_COMPILE_RESOURCES="" |
586 | - ifelse([$3], , :, [$3]) |
587 | - fi |
588 | - AC_SUBST(GLIB_CFLAGS) |
589 | - AC_SUBST(GLIB_LIBS) |
590 | - AC_SUBST(GLIB_GENMARSHAL) |
591 | - AC_SUBST(GOBJECT_QUERY) |
592 | - AC_SUBST(GLIB_MKENUMS) |
593 | - AC_SUBST(GLIB_COMPILE_RESOURCES) |
594 | - rm -f conf.glibtest |
595 | -]) |