1 dnl ###########################################################################
2 dnl # Configure paths for libpurple
3 dnl # Gary Kramlich 2005
5 dnl # Based off of glib-2.0.m4 by Owen Taylor
6 dnl ###########################################################################
8 dnl ###########################################################################
9 dnl # AM_PATH_PURPLE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
11 dnl # Test for purple and define PURPLE_CFLAGS, PURPLE_LIBS, PURPLE_DATADIR, and
13 dnl ###########################################################################
14 AC_DEFUN([AM_PATH_PURPLE],
16 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
20 if test x"$PKG_CONFIG" != x"no" ; then
21 if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
24 echo "*** pkg-config is too old; version 0.7 or newer is required."
32 min_version=ifelse([$1], ,2.0.0,$1)
35 AC_MSG_CHECKING(for purple - version >= $min_version)
37 if test x"$no_purple" = x"" ; then
38 PURPLE_DATADIR=`$PKG_CONFIG --variable=datadir purple`
39 PURPLE_LIBDIR=`$PKG_CONFIG --variable=libdir purple`
41 PURPLE_CFLAGS=`$PKG_CONFIG --cflags purple`
42 PURPLE_LIBS=`$PKG_CONFIG --libs purple`
44 purple_version=`$PKG_CONFIG --modversion purple`
45 purple_major_version=`echo $purple_version | cut -d. -f 1`
46 purple_minor_version=`echo $purple_version | cut -d. -f 2`
48 dnl # stash the micro version in a temp variable. Then stash
49 dnl # the numeric for it in purple_micro_version and anything
50 dnl # else in purple_extra_version.
51 purple_micro_version_temp=`echo $purple_version | cut -d. -f 3`
52 purple_micro_version=`echo $purple_micro_version_temp | sed 's/[[^0-9]]//g'`
53 purple_extra_version=`echo $purple_micro_version_temp | sed 's/[[0-9]]//g'`
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`
60 dnl # check the users version against the version from pkg-config
61 if test $purple_major_version -eq $min_major_version -a \
62 $purple_minor_version -ge $min_minor_version -a \
63 $purple_micro_version -ge $min_micro_version
68 found_version="$purple_major_version.$purple_minor_version.$purple_micro_version$purple_extra_version"
71 dnl # Do we want a compile test here?
74 if test x"$no_purple" = x"" ; then
75 AC_MSG_RESULT(yes (version $purple_major_version.$purple_minor_version.$purple_micro_version$purple_extra_version))
76 ifelse([$2], , :, [$2])
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/"
84 if test x"found_version" != x"" ; then
85 echo "*** A new enough version of purple was not found."
86 echo "*** You have version $found_version"
87 echo "*** See http://pidgin.im/"
95 ifelse([$3], , :, [$3])
98 AC_SUBST(PURPLE_CFLAGS)
100 AC_SUBST(PURPLE_DATADIR)
101 AC_SUBST(PURPLE_LIBDIR)