Fri, 06 Jan 2006 06:33:46 +0000
[gaim-migrate @ 15093]
abstract to a function and robustify the rest of the attribute parsing
| 11147 | 1 | dnl ########################################################################### |
| 2 | dnl # Configure paths for Gaim | |
| 3 | dnl # Gary Kramlich 2005 | |
| 4 | dnl # | |
| 5 | dnl # Based off of glib-2.0.m4 by Owen Taylor | |
| 6 | dnl ########################################################################### | |
| 7 | ||
| 8 | dnl ########################################################################### | |
| 9 | dnl # AM_PATH_GAIM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
| 10 | dnl # | |
| 11 | dnl # Test for gaim and define GAIM_CFLAGS, GAIM_LIBS, GAIM_DATADIR, and | |
| 12 | dnl # GAIM_LIBDIR | |
| 13 | dnl ########################################################################### | |
| 14 | AC_DEFUN([AM_PATH_GAIM], | |
| 15 | [dnl | |
| 16 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | |
| 17 | ||
| 18 | no_gaim="" | |
| 19 | ||
| 20 | if test x"$PKG_CONFIG" != x"no" ; then | |
| 21 | if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then | |
| 22 | : | |
| 23 | else | |
| 24 | echo "*** pkg-config is too old; version 0.7 or newer is required." | |
| 25 | no_gaim="yes" | |
| 26 | PKG_CONFIG="no" | |
| 27 | fi | |
| 28 | else | |
| 29 | no_gaim="yes" | |
| 30 | fi | |
| 31 | ||
| 32 | min_version=ifelse([$1], ,2.0.0,$1) | |
| 33 | found_version="" | |
| 34 | ||
| 35 | AC_MSG_CHECKING(for gaim - version >= $min_version) | |
| 36 | ||
| 37 | if test x"$no_gaim" = x"" ; then | |
| 38 | GAIM_DATADIR=`$PKG_CONFIG --variable=datadir gaim` | |
| 39 | GAIM_LIBDIR=`$PKG_CONFIG --variable=libdir gaim` | |
| 40 | ||
| 41 | GAIM_CFLAGS=`$PKG_CONFIG --cflags gaim` | |
| 42 | GAIM_LIBS=`$PKG_CONFIG --libs gaim` | |
| 43 | ||
| 44 | gaim_version=`$PKG_CONFIG --modversion gaim` | |
| 45 | gaim_major_version=`echo $gaim_version | cut -d. -f 1` | |
| 46 | gaim_minor_version=`echo $gaim_version | cut -d. -f 2` | |
| 47 | ||
| 48 | dnl # stash the micro version in a temp variable. Then stash | |
| 49 | dnl # the numeric for it in gaim_micro_version and anything | |
| 50 | dnl # else in gaim_extra_version. | |
| 51 | gaim_micro_version_temp=`echo $gaim_version | cut -d. -f 3` | |
| 52 | gaim_micro_version=`echo $gaim_micro_version_temp | sed 's/[[^0-9]]//g'` | |
| 53 | gaim_extra_version=`echo $gaim_micro_version_temp | sed 's/[[0-9]]//g'` | |
| 54 | ||
| 55 | dnl # get the major, minor, and macro that the user gave us | |
| 56 | min_major_version=`echo $min_version | cut -d. -f 1` | |
| 57 | min_minor_version=`echo $min_version | cut -d. -f 2` | |
| 58 | min_micro_version=`echo $min_version | cut -d. -f 3` | |
| 59 | ||
| 60 | dnl # check the users version against the version from pkg-config | |
| 61 | if test $gaim_major_version -eq $min_major_version -a \ | |
| 62 | $gaim_minor_version -ge $min_minor_version -a \ | |
| 63 | $gaim_micro_version -ge $min_micro_version | |
| 64 | then | |
| 65 | : | |
| 66 | else | |
| 67 | no_gaim="yes" | |
| 68 | found_version="$gaim_major_version.$gaim_minor_version.$gaim_micro_version$gaim_extra_version" | |
| 69 | fi | |
| 70 | ||
| 71 | dnl # Do we want a compile test here? | |
| 72 | fi | |
| 73 | ||
| 74 | if test x"$no_gaim" = x"" ; then | |
| 75 | AC_MSG_RESULT(yes (version $gaim_major_version.$gaim_minor_version.$gaim_micro_version$gaim_extra_version)) | |
| 76 | ifelse([$2], , :, [$2]) | |
| 77 | else | |
| 78 | AC_MSG_RESULT(no) | |
| 79 | if test x"$PKG_CONFIG" = x"no" ; then | |
| 80 | echo "*** A new enough version of pkg-config was not found." | |
| 81 | echo "*** See http://www.freedesktop.org/software/pkgconfig/" | |
| 82 | fi | |
| 83 | ||
| 84 | if test x"found_version" != x"" ; then | |
| 85 | echo "*** A new enough version of gaim was not found." | |
| 86 | echo "*** You have version $found_version" | |
| 87 | echo "*** See http://gaim.sf.net/" | |
| 88 | fi | |
| 89 | ||
| 90 | GAIM_CFLAGS="" | |
| 91 | GAIM_LIBS="" | |
| 92 | GAIM_DATADIR="" | |
| 93 | GAIM_LIBDIR="" | |
| 94 | ||
| 95 | ifelse([$3], , :, [$3]) | |
| 96 | fi | |
| 97 | ||
| 98 | AC_SUBST(GAIM_CFLAGS) | |
| 99 | AC_SUBST(GAIM_LIBS) | |
| 100 | AC_SUBST(GAIM_DATADIR) | |
| 101 | AC_SUBST(GAIM_LIBDIR) | |
| 102 | ]) |