|
Lines 353-365
Link Here
|
| 353 |
[ |
353 |
[ |
| 354 |
AC_LANG_SOURCE( |
354 |
AC_LANG_SOURCE( |
| 355 |
[#include <stdio.h> |
355 |
[#include <stdio.h> |
|
|
356 |
#include <stdlib.h> |
| 356 |
#include <string.h> |
357 |
#include <string.h> |
| 357 |
#include "$5" |
358 |
#include "$5" |
| 358 |
int main (void) |
359 |
int main (void) |
| 359 |
{ |
360 |
{ |
| 360 |
const char *version = $6; |
361 |
const char *version = $6; |
|
|
362 |
char wanted[[]] = "$2"; |
| 363 |
char *version_tok, *wanted_tok = wanted; |
| 364 |
char *version_tmp, *wanted_tmp; |
| 361 |
fprintf (stderr, "%s\n", version); |
365 |
fprintf (stderr, "%s\n", version); |
| 362 |
return ! (strcmp (version ? version : "", "$2") >= 0); |
366 |
if (!version) return EXIT_FAILURE; |
|
|
367 |
version_tok = strdup(version); |
| 368 |
for (version_tok = strtok_r(version_tok, ".", &version_tmp), |
| 369 |
wanted_tok = strtok_r(wanted_tok, ".", &wanted_tmp); |
| 370 |
version_tok != NULL && wanted_tok != NULL; |
| 371 |
version_tok = strtok_r(NULL, ".", &version_tmp), |
| 372 |
wanted_tok = strtok_r(NULL, ".", &wanted_tmp)) { |
| 373 |
char *version_endptr, *wanted_endptr; |
| 374 |
unsigned long version_bit = strtoul(version_tok, &version_endptr, 10); |
| 375 |
unsigned long wanted_bit = strtoul(wanted_tok, &wanted_endptr, 10); |
| 376 |
if (version_bit < wanted_bit) |
| 377 |
return EXIT_FAILURE; |
| 378 |
if (version_bit > wanted_bit) |
| 379 |
return EXIT_SUCCESS; |
| 380 |
if (strcmp(version_endptr, wanted_endptr) > 0) |
| 381 |
return EXIT_SUCCESS; |
| 382 |
if (strcmp(version_endptr, wanted_endptr) < 0) |
| 383 |
return EXIT_FAILURE; |
| 384 |
} |
| 385 |
return wanted_tok == NULL ? EXIT_SUCCESS : EXIT_FAILURE; |
| 363 |
}] |
386 |
}] |
| 364 |
) |
387 |
) |
| 365 |
], |
388 |
], |