diff options
author | Gary Kramlich <grim@reaperworld.com> | 2005-07-23 20:28:17 +0000 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2005-07-23 20:28:17 +0000 |
commit | d4e792bb73551075c60b16a8c124766ee8c5d87d (patch) | |
tree | 208d4d8d8e0bd7cf6c6640c80976aa0a0ef00f30 /m4macros | |
parent | d0eb6b469d1be1de43ac7874644d71053b37e2e5 (diff) | |
download | pidgin-d4e792bb73551075c60b16a8c124766ee8c5d87d.tar.gz |
[gaim-migrate @ 13226]
I started this a long time ago, and decided to finish it. This adds a AM_PATH_GAIM macro to aclocal. Very useful for plugin developers. It works alright so far, but isn't tolerant of an non major.minor.micro version being passed to it. I'm still considering moving the meat of this to a compile test, but this will do it for now.
Diffstat (limited to 'm4macros')
-rw-r--r-- | m4macros/.cvsignore | 2 | ||||
-rw-r--r-- | m4macros/Makefile.am | 6 | ||||
-rw-r--r-- | m4macros/gaim.m4 | 102 |
3 files changed, 110 insertions, 0 deletions
diff --git a/m4macros/.cvsignore b/m4macros/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/m4macros/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/m4macros/Makefile.am b/m4macros/Makefile.am new file mode 100644 index 0000000000..352f47bbce --- /dev/null +++ b/m4macros/Makefile.am @@ -0,0 +1,6 @@ +installed_m4=gaim.m4 + +EXTRA_DIT=$(installed_m4) + +m4datadir=$(datadir)/aclocal +m4data_DATA=$(installed_m4) diff --git a/m4macros/gaim.m4 b/m4macros/gaim.m4 new file mode 100644 index 0000000000..9cafd06680 --- /dev/null +++ b/m4macros/gaim.m4 @@ -0,0 +1,102 @@ +dnl ########################################################################### +dnl # Configure paths for Gaim +dnl # Gary Kramlich 2005 +dnl # +dnl # Based off of glib-2.0.m4 by Owen Taylor +dnl ########################################################################### + +dnl ########################################################################### +dnl # AM_PATH_GAIM([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl # +dnl # Test for gaim and define GAIM_CFLAGS, GAIM_LIBS, GAIM_DATADIR, and +dnl # GAIM_LIBDIR +dnl ########################################################################### +AC_DEFUN([AM_PATH_GAIM], +[dnl + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + + no_gaim="" + + if test x"$PKG_CONFIG" != x"no" ; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then + : + else + echo "*** pkg-config is too old; version 0.7 or newer is required." + no_gaim="yes" + PKG_CONFIG="no" + fi + else + no_gaim="yes" + fi + + min_version=ifelse([$1], ,2.0.0,$1) + found_version="" + + AC_MSG_CHECKING(for gaim - version >= $min_version) + + if test x"$no_gaim" = x"" ; then + GAIM_DATADIR=`$PKG_CONFIG --variable=datadir gaim` + GAIM_LIBDIR=`$PKG_CONFIG --variable=libdir gaim` + + GAIM_CFLAGS=`$PKG_CONFIG --cflags gaim` + GAIM_LIBS=`$PKG_CONFIG --libs gaim` + + gaim_version=`$PKG_CONFIG --modversion gaim` + gaim_major_version=`echo $gaim_version | cut -d. -f 1` + gaim_minor_version=`echo $gaim_version | cut -d. -f 2` + + dnl # stash the micro version in a temp variable. Then stash + dnl # the numeric for it in gaim_micro_version and anything + dnl # else in gaim_extra_version. + gaim_micro_version_temp=`echo $gaim_version | cut -d. -f 3` + gaim_micro_version=`echo $gaim_micro_version_temp | sed 's/[[^0-9]]//g'` + gaim_extra_version=`echo $gaim_micro_version_temp | sed 's/[[0-9]]//g'` + + dnl # get the major, minor, and macro that the user gave us + min_major_version=`echo $min_version | cut -d. -f 1` + min_minor_version=`echo $min_version | cut -d. -f 2` + min_micro_version=`echo $min_version | cut -d. -f 3` + + dnl # check the users version against the version from pkg-config + if test $gaim_major_version -eq $min_major_version -a \ + $gaim_minor_version -ge $min_minor_version -a \ + $gaim_micro_version -ge $min_micro_version + then + : + else + no_gaim="yes" + found_version="$gaim_major_version.$gaim_minor_version.$gaim_micro_version$gaim_extra_version" + fi + + dnl # Do we want a compile test here? + fi + + if test x"$no_gaim" = x"" ; then + AC_MSG_RESULT(yes (version $gaim_major_version.$gaim_minor_version.$gaim_micro_version$gaim_extra_version)) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test x"$PKG_CONFIG" = x"no" ; then + echo "*** A new enough version of pkg-config was not found." + echo "*** See http://www.freedesktop.org/software/pkgconfig/" + fi + + if test x"found_version" != x"" ; then + echo "*** A new enough version of gaim was not found." + echo "*** You have version $found_version" + echo "*** See http://gaim.sf.net/" + fi + + GAIM_CFLAGS="" + GAIM_LIBS="" + GAIM_DATADIR="" + GAIM_LIBDIR="" + + ifelse([$3], , :, [$3]) + fi + + AC_SUBST(GAIM_CFLAGS) + AC_SUBST(GAIM_LIBS) + AC_SUBST(GAIM_DATADIR) + AC_SUBST(GAIM_LIBDIR) +]) |