Mercurial > pidgin
comparison acinclude.m4 @ 3661:de4c62f656ee
[gaim-migrate @ 3790]
Added macros for gtk2 and glib2.
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sun, 13 Oct 2002 08:04:47 +0000 |
| parents | 3fd9f8e2c463 |
| children | 9df99116840a |
comparison
equal
deleted
inserted
replaced
| 3660:a9445dd25786 | 3661:de4c62f656ee |
|---|---|
| 388 AC_SUBST(GTK_LIBS) | 388 AC_SUBST(GTK_LIBS) |
| 389 rm -f conf.gtktest | 389 rm -f conf.gtktest |
| 390 ]) | 390 ]) |
| 391 | 391 |
| 392 AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) | 392 AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) |
| 393 # Configure paths for GLIB | |
| 394 # Owen Taylor 1997-2001 | |
| 395 | |
| 396 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | |
| 397 dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or | |
| 398 dnl gthread is specified in MODULES, pass to pkg-config | |
| 399 dnl | |
| 400 AC_DEFUN(AM_PATH_GLIB_2_0, | |
| 401 [dnl | |
| 402 dnl Get the cflags and libraries from pkg-config | |
| 403 dnl | |
| 404 AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], | |
| 405 , enable_glibtest=yes) | |
| 406 | |
| 407 pkg_config_args=glib-2.0 | |
| 408 for module in . $4 | |
| 409 do | |
| 410 case "$module" in | |
| 411 gmodule) | |
| 412 pkg_config_args="$pkg_config_args gmodule-2.0" | |
| 413 ;; | |
| 414 gobject) | |
| 415 pkg_config_args="$pkg_config_args gobject-2.0" | |
| 416 ;; | |
| 417 gthread) | |
| 418 pkg_config_args="$pkg_config_args gthread-2.0" | |
| 419 ;; | |
| 420 esac | |
| 421 done | |
| 422 | |
| 423 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
| 424 | |
| 425 no_glib="" | |
| 426 | |
| 427 if test x$PKG_CONFIG != xno ; then | |
| 428 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then | |
| 429 : | |
| 430 else | |
| 431 echo *** pkg-config too old; version 0.7 or better required. | |
| 432 no_glib=yes | |
| 433 PKG_CONFIG=no | |
| 434 fi | |
| 435 else | |
| 436 no_glib=yes | |
| 437 fi | |
| 438 | |
| 439 min_glib_version=ifelse([$1], ,2.0.0,$1) | |
| 440 AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) | |
| 441 | |
| 442 if test x$PKG_CONFIG != xno ; then | |
| 443 ## don't try to run the test against uninstalled libtool libs | |
| 444 if $PKG_CONFIG --uninstalled $pkg_config_args; then | |
| 445 echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH" | |
| 446 enable_glibtest=no | |
| 447 fi | |
| 448 | |
| 449 if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then | |
| 450 : | |
| 451 else | |
| 452 no_glib=yes | |
| 453 fi | |
| 454 fi | |
| 455 | |
| 456 if test x"$no_glib" = x ; then | |
| 457 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` | |
| 458 GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0` | |
| 459 GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0` | |
| 460 | |
| 461 GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args` | |
| 462 GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args` | |
| 463 glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \ | |
| 464 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
| 465 glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \ | |
| 466 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
| 467 glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \ | |
| 468 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
| 469 if test "x$enable_glibtest" = "xyes" ; then | |
| 470 ac_save_CFLAGS="$CFLAGS" | |
| 471 ac_save_LIBS="$LIBS" | |
| 472 CFLAGS="$CFLAGS $GLIB_CFLAGS" | |
| 473 LIBS="$GLIB_LIBS $LIBS" | |
| 474 dnl | |
| 475 dnl Now check if the installed GLIB is sufficiently new. (Also sanity | |
| 476 dnl checks the results of pkg-config to some extent) | |
| 477 dnl | |
| 478 rm -f conf.glibtest | |
| 479 AC_TRY_RUN([ | |
| 480 #include <glib.h> | |
| 481 #include <stdio.h> | |
| 482 #include <stdlib.h> | |
| 483 | |
| 484 int | |
| 485 main () | |
| 486 { | |
| 487 int major, minor, micro; | |
| 488 char *tmp_version; | |
| 489 | |
| 490 system ("touch conf.glibtest"); | |
| 491 | |
| 492 /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
| 493 tmp_version = g_strdup("$min_glib_version"); | |
| 494 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
| 495 printf("%s, bad version string\n", "$min_glib_version"); | |
| 496 exit(1); | |
| 497 } | |
| 498 | |
| 499 if ((glib_major_version != $glib_config_major_version) || | |
| 500 (glib_minor_version != $glib_config_minor_version) || | |
| 501 (glib_micro_version != $glib_config_micro_version)) | |
| 502 { | |
| 503 printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", | |
| 504 $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, | |
| 505 glib_major_version, glib_minor_version, glib_micro_version); | |
| 506 printf ("*** was found! If pkg-config was correct, then it is best\n"); | |
| 507 printf ("*** to remove the old version of GLib. You may also be able to fix the error\n"); | |
| 508 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
| 509 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
| 510 printf("*** required on your system.\n"); | |
| 511 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); | |
| 512 printf("*** to point to the correct configuration files\n"); | |
| 513 } | |
| 514 else if ((glib_major_version != GLIB_MAJOR_VERSION) || | |
| 515 (glib_minor_version != GLIB_MINOR_VERSION) || | |
| 516 (glib_micro_version != GLIB_MICRO_VERSION)) | |
| 517 { | |
| 518 printf("*** GLIB header files (version %d.%d.%d) do not match\n", | |
| 519 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); | |
| 520 printf("*** library (version %d.%d.%d)\n", | |
| 521 glib_major_version, glib_minor_version, glib_micro_version); | |
| 522 } | |
| 523 else | |
| 524 { | |
| 525 if ((glib_major_version > major) || | |
| 526 ((glib_major_version == major) && (glib_minor_version > minor)) || | |
| 527 ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) | |
| 528 { | |
| 529 return 0; | |
| 530 } | |
| 531 else | |
| 532 { | |
| 533 printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", | |
| 534 glib_major_version, glib_minor_version, glib_micro_version); | |
| 535 printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", | |
| 536 major, minor, micro); | |
| 537 printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); | |
| 538 printf("***\n"); | |
| 539 printf("*** If you have already installed a sufficiently new version, this error\n"); | |
| 540 printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); | |
| 541 printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
| 542 printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n"); | |
| 543 printf("*** correct copy of pkg-config. (In this case, you will have to\n"); | |
| 544 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
| 545 printf("*** so that the correct libraries are found at run-time))\n"); | |
| 546 } | |
| 547 } | |
| 548 return 1; | |
| 549 } | |
| 550 ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
| 551 CFLAGS="$ac_save_CFLAGS" | |
| 552 LIBS="$ac_save_LIBS" | |
| 553 fi | |
| 554 fi | |
| 555 if test "x$no_glib" = x ; then | |
| 556 AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) | |
| 557 ifelse([$2], , :, [$2]) | |
| 558 else | |
| 559 AC_MSG_RESULT(no) | |
| 560 if test "$PKG_CONFIG" = "no" ; then | |
| 561 echo "*** A new enough version of pkg-config was not found." | |
| 562 echo "*** See http://www.freedesktop.org/software/pkgconfig/" | |
| 563 else | |
| 564 if test -f conf.glibtest ; then | |
| 565 : | |
| 566 else | |
| 567 echo "*** Could not run GLIB test program, checking why..." | |
| 568 ac_save_CFLAGS="$CFLAGS" | |
| 569 ac_save_LIBS="$LIBS" | |
| 570 CFLAGS="$CFLAGS $GLIB_CFLAGS" | |
| 571 LIBS="$LIBS $GLIB_LIBS" | |
| 572 AC_TRY_LINK([ | |
| 573 #include <glib.h> | |
| 574 #include <stdio.h> | |
| 575 ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], | |
| 576 [ echo "*** The test program compiled, but did not run. This usually means" | |
| 577 echo "*** that the run-time linker is not finding GLIB or finding the wrong" | |
| 578 echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" | |
| 579 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
| 580 echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
| 581 echo "*** is required on your system" | |
| 582 echo "***" | |
| 583 echo "*** If you have an old version installed, it is best to remove it, although" | |
| 584 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | |
| 585 [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
| 586 echo "*** exact error that occured. This usually means GLIB is incorrectly installed."]) | |
| 587 CFLAGS="$ac_save_CFLAGS" | |
| 588 LIBS="$ac_save_LIBS" | |
| 589 fi | |
| 590 fi | |
| 591 GLIB_CFLAGS="" | |
| 592 GLIB_LIBS="" | |
| 593 GLIB_GENMARSHAL="" | |
| 594 GOBJECT_QUERY="" | |
| 595 GLIB_MKENUMS="" | |
| 596 ifelse([$3], , :, [$3]) | |
| 597 fi | |
| 598 AC_SUBST(GLIB_CFLAGS) | |
| 599 AC_SUBST(GLIB_LIBS) | |
| 600 AC_SUBST(GLIB_GENMARSHAL) | |
| 601 AC_SUBST(GOBJECT_QUERY) | |
| 602 AC_SUBST(GLIB_MKENUMS) | |
| 603 rm -f conf.glibtest | |
| 604 ]) | |
| 605 # Configure paths for GTK+ | |
| 606 # Owen Taylor 1997-2001 | |
| 607 | |
| 608 dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | |
| 609 dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, | |
| 610 dnl pass to pkg-config | |
| 611 dnl | |
| 612 AC_DEFUN(AM_PATH_GTK_2_0, | |
| 613 [dnl | |
| 614 dnl Get the cflags and libraries from pkg-config | |
| 615 dnl | |
| 616 AC_ARG_ENABLE(gtktest, [ --disable-gtktest do not try to compile and run a test GTK+ program], | |
| 617 , enable_gtktest=yes) | |
| 618 | |
| 619 pkg_config_args=gtk+-2.0 | |
| 620 for module in . $4 | |
| 621 do | |
| 622 case "$module" in | |
| 623 gthread) | |
| 624 pkg_config_args="$pkg_config_args gthread-2.0" | |
| 625 ;; | |
| 626 esac | |
| 627 done | |
| 628 | |
| 629 no_gtk="" | |
| 630 | |
| 631 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
| 632 | |
| 633 if test x$PKG_CONFIG != xno ; then | |
| 634 if pkg-config --atleast-pkgconfig-version 0.7 ; then | |
| 635 : | |
| 636 else | |
| 637 echo *** pkg-config too old; version 0.7 or better required. | |
| 638 no_gtk=yes | |
| 639 PKG_CONFIG=no | |
| 640 fi | |
| 641 else | |
| 642 no_gtk=yes | |
| 643 fi | |
| 644 | |
| 645 min_gtk_version=ifelse([$1], ,2.0.0,$1) | |
| 646 AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version) | |
| 647 | |
| 648 if test x$PKG_CONFIG != xno ; then | |
| 649 ## don't try to run the test against uninstalled libtool libs | |
| 650 if $PKG_CONFIG --uninstalled $pkg_config_args; then | |
| 651 echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH" | |
| 652 enable_gtktest=no | |
| 653 fi | |
| 654 | |
| 655 if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then | |
| 656 : | |
| 657 else | |
| 658 no_gtk=yes | |
| 659 fi | |
| 660 fi | |
| 661 | |
| 662 if test x"$no_gtk" = x ; then | |
| 663 GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags` | |
| 664 GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs` | |
| 665 gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
| 666 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
| 667 gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
| 668 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
| 669 gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \ | |
| 670 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
| 671 if test "x$enable_gtktest" = "xyes" ; then | |
| 672 ac_save_CFLAGS="$CFLAGS" | |
| 673 ac_save_LIBS="$LIBS" | |
| 674 CFLAGS="$CFLAGS $GTK_CFLAGS" | |
| 675 LIBS="$GTK_LIBS $LIBS" | |
| 676 dnl | |
| 677 dnl Now check if the installed GTK+ is sufficiently new. (Also sanity | |
| 678 dnl checks the results of pkg-config to some extent) | |
| 679 dnl | |
| 680 rm -f conf.gtktest | |
| 681 AC_TRY_RUN([ | |
| 682 #include <gtk/gtk.h> | |
| 683 #include <stdio.h> | |
| 684 #include <stdlib.h> | |
| 685 | |
| 686 int | |
| 687 main () | |
| 688 { | |
| 689 int major, minor, micro; | |
| 690 char *tmp_version; | |
| 691 | |
| 692 system ("touch conf.gtktest"); | |
| 693 | |
| 694 /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
| 695 tmp_version = g_strdup("$min_gtk_version"); | |
| 696 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
| 697 printf("%s, bad version string\n", "$min_gtk_version"); | |
| 698 exit(1); | |
| 699 } | |
| 700 | |
| 701 if ((gtk_major_version != $gtk_config_major_version) || | |
| 702 (gtk_minor_version != $gtk_config_minor_version) || | |
| 703 (gtk_micro_version != $gtk_config_micro_version)) | |
| 704 { | |
| 705 printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | |
| 706 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | |
| 707 gtk_major_version, gtk_minor_version, gtk_micro_version); | |
| 708 printf ("*** was found! If pkg-config was correct, then it is best\n"); | |
| 709 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | |
| 710 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | |
| 711 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | |
| 712 printf("*** required on your system.\n"); | |
| 713 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); | |
| 714 printf("*** to point to the correct configuration files\n"); | |
| 715 } | |
| 716 else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
| 717 (gtk_minor_version != GTK_MINOR_VERSION) || | |
| 718 (gtk_micro_version != GTK_MICRO_VERSION)) | |
| 719 { | |
| 720 printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
| 721 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
| 722 printf("*** library (version %d.%d.%d)\n", | |
| 723 gtk_major_version, gtk_minor_version, gtk_micro_version); | |
| 724 } | |
| 725 else | |
| 726 { | |
| 727 if ((gtk_major_version > major) || | |
| 728 ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
| 729 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | |
| 730 { | |
| 731 return 0; | |
| 732 } | |
| 733 else | |
| 734 { | |
| 735 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
| 736 gtk_major_version, gtk_minor_version, gtk_micro_version); | |
| 737 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | |
| 738 major, minor, micro); | |
| 739 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
| 740 printf("***\n"); | |
| 741 printf("*** If you have already installed a sufficiently new version, this error\n"); | |
| 742 printf("*** probably means that the wrong copy of the pkg-config shell script is\n"); | |
| 743 printf("*** being found. The easiest way to fix this is to remove the old version\n"); | |
| 744 printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n"); | |
| 745 printf("*** correct copy of pkg-config. (In this case, you will have to\n"); | |
| 746 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | |
| 747 printf("*** so that the correct libraries are found at run-time))\n"); | |
| 748 } | |
| 749 } | |
| 750 return 1; | |
| 751 } | |
| 752 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
| 753 CFLAGS="$ac_save_CFLAGS" | |
| 754 LIBS="$ac_save_LIBS" | |
| 755 fi | |
| 756 fi | |
| 757 if test "x$no_gtk" = x ; then | |
| 758 AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)) | |
| 759 ifelse([$2], , :, [$2]) | |
| 760 else | |
| 761 AC_MSG_RESULT(no) | |
| 762 if test "$PKG_CONFIG" = "no" ; then | |
| 763 echo "*** A new enough version of pkg-config was not found." | |
| 764 echo "*** See http://pkgconfig.sourceforge.net" | |
| 765 else | |
| 766 if test -f conf.gtktest ; then | |
| 767 : | |
| 768 else | |
| 769 echo "*** Could not run GTK+ test program, checking why..." | |
| 770 ac_save_CFLAGS="$CFLAGS" | |
| 771 ac_save_LIBS="$LIBS" | |
| 772 CFLAGS="$CFLAGS $GTK_CFLAGS" | |
| 773 LIBS="$LIBS $GTK_LIBS" | |
| 774 AC_TRY_LINK([ | |
| 775 #include <gtk/gtk.h> | |
| 776 #include <stdio.h> | |
| 777 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | |
| 778 [ echo "*** The test program compiled, but did not run. This usually means" | |
| 779 echo "*** that the run-time linker is not finding GTK+ or finding the wrong" | |
| 780 echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your" | |
| 781 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
| 782 echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
| 783 echo "*** is required on your system" | |
| 784 echo "***" | |
| 785 echo "*** If you have an old version installed, it is best to remove it, although" | |
| 786 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | |
| 787 [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
| 788 echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."]) | |
| 789 CFLAGS="$ac_save_CFLAGS" | |
| 790 LIBS="$ac_save_LIBS" | |
| 791 fi | |
| 792 fi | |
| 793 GTK_CFLAGS="" | |
| 794 GTK_LIBS="" | |
| 795 ifelse([$3], , :, [$3]) | |
| 796 fi | |
| 797 AC_SUBST(GTK_CFLAGS) | |
| 798 AC_SUBST(GTK_LIBS) | |
| 799 rm -f conf.gtktest | |
| 800 ]) |
