tGet new pkg-config support - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 490a82064c3a95b4f0e9854059ea9b8ae884e915
 (DIR) parent 71966fc9176086dcf378ab622ff25e13b904eb89
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Sat,  7 Nov 2020 00:31:28 -0800
       
       Get new pkg-config support
       
       The newer check for pkg-config, employed in the glib
       check, is now aware of cross-compiling.
       
       Diffstat:
         M m4/glib-2.0.m4                      |      71 ++++++++++++++++---------------
         M m4/glib-gettext.m4                  |     154 ++++++++++++++++++++++++++-----
         A m4/pkg.m4                           |     343 +++++++++++++++++++++++++++++++
       
       3 files changed, 510 insertions(+), 58 deletions(-)
       ---
 (DIR) diff --git a/m4/glib-2.0.m4 b/m4/glib-2.0.m4
       t@@ -1,50 +1,66 @@
        # Configure paths for GLIB
        # Owen Taylor     1997-2001
        
       +# Increment this whenever this file is changed.
       +#serial 3
       +
        dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
       -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or 
       -dnl gthread is specified in MODULES, pass to pkg-config
       +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
       +dnl gthread, or gio is specified in MODULES, pass to pkg-config
        dnl
        AC_DEFUN([AM_PATH_GLIB_2_0],
        [dnl 
        dnl Get the cflags and libraries from pkg-config
        dnl
       +
       +dnl We can't use PKG_PREREQ because that needs 0.29.
       +m4_ifndef([PKG_PROG_PKG_CONFIG],
       +          [pkg.m4 version 0.28 or later is required])
       +
        AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run a test GLIB program],
                            , enable_glibtest=yes)
        
       -  pkg_config_args=glib-2.0
       +  min_glib_version=ifelse([$1], [], [2.0.0], [$1])
       +  pkg_config_args="glib-2.0 >= $min_glib_version"
          for module in . $4
          do
              case "$module" in
                 gmodule) 
                     pkg_config_args="$pkg_config_args gmodule-2.0"
                 ;;
       +         gmodule-no-export) 
       +             pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
       +         ;;
                 gobject) 
                     pkg_config_args="$pkg_config_args gobject-2.0"
                 ;;
                 gthread) 
                     pkg_config_args="$pkg_config_args gthread-2.0"
                 ;;
       +         gio*) 
       +             pkg_config_args="$pkg_config_args $module-2.0"
       +         ;;
              esac
          done
        
       -  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
       +  PKG_PROG_PKG_CONFIG([0.16])
        
          no_glib=""
        
       -  if test x$PKG_CONFIG != xno ; then
       -    if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
       -      :
       -    else
       -      echo *** pkg-config too old; version 0.7 or better required.
       -      no_glib=yes
       -      PKG_CONFIG=no
       -    fi
       -  else
       +  if test "x$PKG_CONFIG" = x ; then
            no_glib=yes
       +    PKG_CONFIG=no
          fi
        
       -  min_glib_version=ifelse([$1], ,2.0.0,$1)
       +  dnl For GLIB_CFLAGS and GLIB_LIBS
       +  PKG_CHECK_MODULES([GLIB], [$pkg_config_args], [:], [:])
       +
       +  dnl For the tools
       +  PKG_CHECK_VAR([GLIB_GENMARSHAL], [glib-2.0], [glib_genmarshal])
       +  PKG_CHECK_VAR([GOBJECT_QUERY], [glib-2.0], [gobject_query])
       +  PKG_CHECK_VAR([GLIB_MKENUMS], [glib-2.0], [glib_mkenums])
       +  PKG_CHECK_VAR([GLIB_COMPILE_RESOURCES], [gio-2.0], [glib_compile_resources])
       +
          AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
        
          if test x$PKG_CONFIG != xno ; then
       t@@ -62,12 +78,6 @@ AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run
          fi
        
          if test x"$no_glib" = x ; then
       -    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
       -    GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
       -    GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
       -
       -    GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
       -    GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
            glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
                   sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
            glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
       t@@ -90,16 +100,13 @@ dnl
        #include <stdlib.h>
        
        int 
       -main ()
       +main (void)
        {
       -  int major, minor, micro;
       -  char *tmp_version;
       +  unsigned int major, minor, micro;
        
       -  system ("touch conf.glibtest");
       +  fclose (fopen ("conf.glibtest", "w"));
        
       -  /* HP/UX 9 (%@#!) writes to sscanf strings */
       -  tmp_version = g_strdup("$min_glib_version");
       -  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
       +  if (sscanf("$min_glib_version", "%u.%u.%u", &major, &minor, &micro) != 3) {
             printf("%s, bad version string\n", "$min_glib_version");
             exit(1);
           }
       t@@ -138,9 +145,9 @@ main ()
               }
             else
              {
       -        printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
       +        printf("\n*** An old version of GLIB (%u.%u.%u) was found.\n",
                       glib_major_version, glib_minor_version, glib_micro_version);
       -        printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
       +        printf("*** You need a version of GLIB newer than %u.%u.%u. The latest version of\n",
                       major, minor, micro);
                printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
                printf("***\n");
       t@@ -201,12 +208,8 @@ main ()
             GLIB_GENMARSHAL=""
             GOBJECT_QUERY=""
             GLIB_MKENUMS=""
       +     GLIB_COMPILE_RESOURCES=""
             ifelse([$3], , :, [$3])
          fi
       -  AC_SUBST(GLIB_CFLAGS)
       -  AC_SUBST(GLIB_LIBS)
       -  AC_SUBST(GLIB_GENMARSHAL)
       -  AC_SUBST(GOBJECT_QUERY)
       -  AC_SUBST(GLIB_MKENUMS)
          rm -f conf.glibtest
        ])
 (DIR) diff --git a/m4/glib-gettext.m4 b/m4/glib-gettext.m4
       t@@ -1,5 +1,5 @@
        # Copyright (C) 1995-2002 Free Software Foundation, Inc.
       -# Copyright (C) 2001-2003 Red Hat, Inc.
       +# Copyright (C) 2001-2003,2004 Red Hat, Inc.
        #
        # This file is free software, distributed under the terms of the GNU
        # General Public License.  As a special exception to the GNU General
       t@@ -22,8 +22,13 @@
        #
        # Added better handling of ALL_LINGUAS from GNU gettext version 
        # written by Bruno Haible, Owen Taylor <otaylor.redhat.com> 5/30/3002
       -
        #
       +# Modified to require ngettext
       +# Matthias Clasen <mclasen@redhat.com> 08/06/2004
       +
       +# Increment this whenever this file is changed.
       +#serial 1
       +
        # We need this here as well, since someone might use autoconf-2.5x
        # to configure GLib then an older version to configure a package
        # using AM_GLIB_GNU_GETTEXT
       t@@ -95,6 +100,51 @@ fi
        AC_SUBST($1)dnl
        ])
        
       +dnl Checks for special options needed on Mac OS X.
       +dnl Defines INTL_MACOSX_LIBS.
       +dnl
       +dnl Copied from intlmacosx.m4 in gettext, GPL.
       +dnl Copyright (C) 2004-2013 Free Software Foundation, Inc.
       +glib_DEFUN([glib_gt_INTL_MACOSX],
       +[
       +  dnl Check for API introduced in Mac OS X 10.2.
       +  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
       +    [gt_cv_func_CFPreferencesCopyAppValue],
       +    [gt_save_LIBS="$LIBS"
       +     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
       +     AC_LINK_IFELSE(
       +       [AC_LANG_PROGRAM(
       +          [[#include <CoreFoundation/CFPreferences.h>]],
       +          [[CFPreferencesCopyAppValue(NULL, NULL)]])],
       +       [gt_cv_func_CFPreferencesCopyAppValue=yes],
       +       [gt_cv_func_CFPreferencesCopyAppValue=no])
       +     LIBS="$gt_save_LIBS"])
       +  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
       +    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
       +      [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
       +  fi
       +  dnl Check for API introduced in Mac OS X 10.3.
       +  AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
       +    [gt_save_LIBS="$LIBS"
       +     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
       +     AC_LINK_IFELSE(
       +       [AC_LANG_PROGRAM(
       +          [[#include <CoreFoundation/CFLocale.h>]],
       +          [[CFLocaleCopyCurrent();]])],
       +       [gt_cv_func_CFLocaleCopyCurrent=yes],
       +       [gt_cv_func_CFLocaleCopyCurrent=no])
       +     LIBS="$gt_save_LIBS"])
       +  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
       +    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
       +      [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
       +  fi
       +  INTL_MACOSX_LIBS=
       +  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
       +    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
       +  fi
       +  AC_SUBST([INTL_MACOSX_LIBS])
       +])
       +
        # GLIB_WITH_NLS
        #-----------------
        glib_DEFUN([GLIB_WITH_NLS],
       t@@ -108,6 +158,8 @@ glib_DEFUN([GLIB_WITH_NLS],
            XGETTEXT=:
            INTLLIBS=
        
       +    glib_gt_INTL_MACOSX
       +
            AC_CHECK_HEADER(libintl.h,
             [gt_cv_func_dgettext_libintl="no"
              libintl_extra_libs=""
       t@@ -115,54 +167,70 @@ glib_DEFUN([GLIB_WITH_NLS],
              #
              # First check in libc
              #
       -      AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
       +      AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc,
                [AC_TRY_LINK([
        #include <libintl.h>
        ],
       -          [return (int) dgettext ("","")],
       -          gt_cv_func_dgettext_libc=yes,
       -          gt_cv_func_dgettext_libc=no)
       +         [return !ngettext ("","", 1)],
       +          gt_cv_func_ngettext_libc=yes,
       +          gt_cv_func_ngettext_libc=no)
                ])
          
       -      if test "$gt_cv_func_dgettext_libc" = "yes" ; then
       -        [AC_CHECK_FUNCS([bind_textdomain_codeset])]
       +      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
       +              AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
       +                [AC_TRY_LINK([
       +#include <libintl.h>
       +],
       +                  [return !dgettext ("","")],
       +                  gt_cv_func_dgettext_libc=yes,
       +                  gt_cv_func_dgettext_libc=no)
       +                ])
       +      fi
       +  
       +      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
       +        AC_CHECK_FUNCS(bind_textdomain_codeset)
              fi
        
              #
              # If we don't have everything we want, check in libintl
              #
              if test "$gt_cv_func_dgettext_libc" != "yes" \
       +         || test "$gt_cv_func_ngettext_libc" != "yes" \
                 || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
                
                AC_CHECK_LIB(intl, bindtextdomain,
       -            [AC_CHECK_LIB(intl, dgettext,
       -                          gt_cv_func_dgettext_libintl=yes)])
       +            [AC_CHECK_LIB(intl, ngettext,
       +                    [AC_CHECK_LIB(intl, dgettext,
       +                                  gt_cv_func_dgettext_libintl=yes)])])
        
                if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
                  AC_MSG_CHECKING([if -liconv is needed to use gettext])
                  AC_MSG_RESULT([])
       -          AC_CHECK_LIB(intl, dcgettext,
       +            AC_CHECK_LIB(intl, ngettext,
       +                  [AC_CHECK_LIB(intl, dcgettext,
                               [gt_cv_func_dgettext_libintl=yes
                                libintl_extra_libs=-liconv],
       -                        :,-liconv)
       +                        :,-liconv)],
       +                :,-liconv)
                fi
        
                #
                # If we found libintl, then check in it for bind_textdomain_codeset();
                # we'll prefer libc if neither have bind_textdomain_codeset(),
       -        # and both have dgettext
       +        # and both have dgettext and ngettext
                #
                if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
                  glib_save_LIBS="$LIBS"
                  LIBS="$LIBS -lintl $libintl_extra_libs"
                  unset ac_cv_func_bind_textdomain_codeset
       -          [AC_CHECK_FUNCS([bind_textdomain_codeset])]
       +          AC_CHECK_FUNCS(bind_textdomain_codeset)
                  LIBS="$glib_save_LIBS"
        
                  if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
                    gt_cv_func_dgettext_libc=no
                  else
       -            if test "$gt_cv_func_dgettext_libc" = "yes"; then
       +            if test "$gt_cv_func_dgettext_libc" = "yes" \
       +                && test "$gt_cv_func_ngettext_libc" = "yes"; then
                      gt_cv_func_dgettext_libintl=no
                    fi
                  fi
       t@@ -175,7 +243,7 @@ glib_DEFUN([GLIB_WITH_NLS],
              fi
          
              if test "$gt_cv_func_dgettext_libintl" = "yes"; then
       -        INTLLIBS="-lintl $libintl_extra_libs"
       +        INTLLIBS="-lintl $libintl_extra_libs $INTL_MACOSX_LIBS"
              fi
          
              if test "$gt_cv_have_gettext" = "yes"; then
       t@@ -186,7 +254,21 @@ glib_DEFUN([GLIB_WITH_NLS],
                if test "$MSGFMT" != "no"; then
                  glib_save_LIBS="$LIBS"
                  LIBS="$LIBS $INTLLIBS"
       -          [AC_CHECK_FUNCS([dcgettext])]
       +          AC_CHECK_FUNCS(dcgettext)
       +          MSGFMT_OPTS=
       +          AC_MSG_CHECKING([if msgfmt accepts -c])
       +          GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[
       +msgid ""
       +msgstr ""
       +"Content-Type: text/plain; charset=UTF-8\n"
       +"Project-Id-Version: test 1.0\n"
       +"PO-Revision-Date: 2007-02-15 12:01+0100\n"
       +"Last-Translator: test <foo@bar.xx>\n"
       +"Language-Team: C <LL@li.org>\n"
       +"MIME-Version: 1.0\n"
       +"Content-Transfer-Encoding: 8bit\n"
       +], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
       +          AC_SUBST(MSGFMT_OPTS)
                  AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
                  GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
       t@@ -201,11 +283,15 @@ glib_DEFUN([GLIB_WITH_NLS],
                    dnl since both are added to the libc all together.
                    dnl Hence, we'd like to go with DATADIRNAME=share and
                    dnl and CATOBJEXT=.gmo in this case.
       -            [AC_CHECK_FUNC([bind_textdomain_codeset],
       +            AC_CHECK_FUNC(bind_textdomain_codeset,
                      [CATOBJEXT=.gmo 
                       DATADIRNAME=share],
                      [CATOBJEXT=.mo
       -               DATADIRNAME=lib])]
       +               DATADIRNAME=lib])
       +            ;;
       +            *-*-openbsd*)
       +            CATOBJEXT=.mo
       +            DATADIRNAME=share
                    ;;
                    *)
                    CATOBJEXT=.mo
       t@@ -248,7 +334,7 @@ glib_DEFUN([GLIB_WITH_NLS],
        
            dnl These rules are solely for the distribution goal.  While doing this
            dnl we only have to keep exactly one list of the available catalogs
       -    dnl in configure.in.
       +    dnl in configure.ac.
            for lang in $ALL_LINGUAS; do
              GMOFILES="$GMOFILES $lang.gmo"
              POFILES="$POFILES $lang.po"
       t@@ -277,9 +363,8 @@ glib_DEFUN([GLIB_WITH_NLS],
        # on various variables needed by the Makefile.in.in installed by 
        # glib-gettextize.
        dnl
       -glib_DEFUN([GLIB_GNU_GETTEXT],
       +AU_DEFUN([GLIB_GNU_GETTEXT],
          [AC_REQUIRE([AC_PROG_CC])dnl
       -   AC_REQUIRE([AC_HEADER_STDC])dnl
           
           GLIB_LC_MESSAGES
           GLIB_WITH_NLS
       t@@ -348,7 +433,8 @@ glib_DEFUN([GLIB_GNU_GETTEXT],
           rm -f po/POTFILES
           sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
                < $srcdir/po/POTFILES.in > po/POTFILES
       -  ])
       +  ],
       +  [[$0: This macro is deprecated. You should use upstream gettext instead.]])
        
        # AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
        # -------------------------------
       t@@ -358,8 +444,10 @@ glib_DEFUN([GLIB_DEFINE_LOCALEDIR],
        [glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
        glib_save_prefix="$prefix"
        glib_save_exec_prefix="$exec_prefix"
       +glib_save_datarootdir="$datarootdir"
        test "x$prefix" = xNONE && prefix=$ac_default_prefix
        test "x$exec_prefix" = xNONE && exec_prefix=$prefix
       +datarootdir=`eval echo "${datarootdir}"`
        if test "x$CATOBJEXT" = "x.mo" ; then
          localedir=`eval echo "${libdir}/locale"`
        else
       t@@ -367,6 +455,7 @@ else
        fi
        prefix="$glib_save_prefix"
        exec_prefix="$glib_save_exec_prefix"
       +datarootdir="$glib_save_datarootdir"
        AC_DEFINE_UNQUOTED($1, "$localedir",
          [Define the location where the catalogs will be installed])
        ])
       t@@ -374,7 +463,24 @@ AC_DEFINE_UNQUOTED($1, "$localedir",
        dnl
        dnl Now the definitions that aclocal will find
        dnl
       -ifdef(glib_configure_in,[],[
       +ifdef(glib_configure_ac,[],[
        AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)])
        AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)])
        ])dnl
       +
       +# GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL])
       +# 
       +# Create a temporary file with TEST-FILE as its contents and pass the
       +# file name to PROGRAM.  Perform ACTION-IF-PASS if PROGRAM exits with
       +# 0 and perform ACTION-IF-FAIL for any other exit status.
       +AC_DEFUN([GLIB_RUN_PROG],
       +[cat >conftest.foo <<_ACEOF
       +$2
       +_ACEOF
       +if AC_RUN_LOG([$1 conftest.foo]); then
       +  m4_ifval([$3], [$3], [:])
       +m4_ifvaln([$4], [else $4])dnl
       +echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD
       +sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD
       +fi])
       +
 (DIR) diff --git a/m4/pkg.m4 b/m4/pkg.m4
       t@@ -0,0 +1,343 @@
       +# pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
       +# serial 11 (pkg-config-0.29.1)
       +
       +dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
       +dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
       +dnl
       +dnl This program is free software; you can redistribute it and/or modify
       +dnl it under the terms of the GNU General Public License as published by
       +dnl the Free Software Foundation; either version 2 of the License, or
       +dnl (at your option) any later version.
       +dnl
       +dnl This program is distributed in the hope that it will be useful, but
       +dnl WITHOUT ANY WARRANTY; without even the implied warranty of
       +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       +dnl General Public License for more details.
       +dnl
       +dnl You should have received a copy of the GNU General Public License
       +dnl along with this program; if not, write to the Free Software
       +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
       +dnl 02111-1307, USA.
       +dnl
       +dnl As a special exception to the GNU General Public License, if you
       +dnl distribute this file as part of a program that contains a
       +dnl configuration script generated by Autoconf, you may include it under
       +dnl the same distribution terms that you use for the rest of that
       +dnl program.
       +
       +dnl PKG_PREREQ(MIN-VERSION)
       +dnl -----------------------
       +dnl Since: 0.29
       +dnl
       +dnl Verify that the version of the pkg-config macros are at least
       +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
       +dnl installed version of pkg-config, this checks the developer's version
       +dnl of pkg.m4 when generating configure.
       +dnl
       +dnl To ensure that this macro is defined, also add:
       +dnl m4_ifndef([PKG_PREREQ],
       +dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
       +dnl
       +dnl See the "Since" comment for each macro you use to see what version
       +dnl of the macros you require.
       +m4_defun([PKG_PREREQ],
       +[m4_define([PKG_MACROS_VERSION], [0.29.1])
       +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
       +    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
       +])dnl PKG_PREREQ
       +
       +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
       +dnl ----------------------------------
       +dnl Since: 0.16
       +dnl
       +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
       +dnl first found in the path. Checks that the version of pkg-config found
       +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
       +dnl used since that's the first version where most current features of
       +dnl pkg-config existed.
       +AC_DEFUN([PKG_PROG_PKG_CONFIG],
       +[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
       +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
       +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
       +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
       +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
       +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
       +
       +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
       +        AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
       +fi
       +if test -n "$PKG_CONFIG"; then
       +        _pkg_min_version=m4_default([$1], [0.9.0])
       +        AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
       +        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
       +                AC_MSG_RESULT([yes])
       +        else
       +                AC_MSG_RESULT([no])
       +                PKG_CONFIG=""
       +        fi
       +fi[]dnl
       +])dnl PKG_PROG_PKG_CONFIG
       +
       +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
       +dnl -------------------------------------------------------------------
       +dnl Since: 0.18
       +dnl
       +dnl Check to see whether a particular set of modules exists. Similar to
       +dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
       +dnl
       +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
       +dnl only at the first occurence in configure.ac, so if the first place
       +dnl it's called might be skipped (such as if it is within an "if", you
       +dnl have to call PKG_CHECK_EXISTS manually
       +AC_DEFUN([PKG_CHECK_EXISTS],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
       +if test -n "$PKG_CONFIG" && \
       +    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
       +  m4_default([$2], [:])
       +m4_ifvaln([$3], [else
       +  $3])dnl
       +fi])
       +
       +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
       +dnl ---------------------------------------------
       +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
       +dnl pkg_failed based on the result.
       +m4_define([_PKG_CONFIG],
       +[if test -n "$$1"; then
       +    pkg_cv_[]$1="$$1"
       + elif test -n "$PKG_CONFIG"; then
       +    PKG_CHECK_EXISTS([$3],
       +                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
       +                      test "x$?" != "x0" && pkg_failed=yes ],
       +                     [pkg_failed=yes])
       + else
       +    pkg_failed=untried
       +fi[]dnl
       +])dnl _PKG_CONFIG
       +
       +dnl _PKG_SHORT_ERRORS_SUPPORTED
       +dnl ---------------------------
       +dnl Internal check to see if pkg-config supports short errors.
       +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
       +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
       +        _pkg_short_errors_supported=yes
       +else
       +        _pkg_short_errors_supported=no
       +fi[]dnl
       +])dnl _PKG_SHORT_ERRORS_SUPPORTED
       +
       +
       +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
       +dnl   [ACTION-IF-NOT-FOUND])
       +dnl --------------------------------------------------------------
       +dnl Since: 0.4.0
       +dnl
       +dnl Note that if there is a possibility the first call to
       +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
       +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
       +AC_DEFUN([PKG_CHECK_MODULES],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
       +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
       +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
       +
       +pkg_failed=no
       +AC_MSG_CHECKING([for $1])
       +
       +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
       +_PKG_CONFIG([$1][_LIBS], [libs], [$2])
       +
       +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
       +and $1[]_LIBS to avoid the need to call pkg-config.
       +See the pkg-config man page for more details.])
       +
       +if test $pkg_failed = yes; then
       +           AC_MSG_RESULT([no])
       +        _PKG_SHORT_ERRORS_SUPPORTED
       +        if test $_pkg_short_errors_supported = yes; then
       +                $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
       +        else 
       +                $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
       +        fi
       +        # Put the nasty error message in config.log where it belongs
       +        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
       +
       +        m4_default([$4], [AC_MSG_ERROR(
       +[Package requirements ($2) were not met:
       +
       +$$1_PKG_ERRORS
       +
       +Consider adjusting the PKG_CONFIG_PATH environment variable if you
       +installed software in a non-standard prefix.
       +
       +_PKG_TEXT])[]dnl
       +        ])
       +elif test $pkg_failed = untried; then
       +             AC_MSG_RESULT([no])
       +        m4_default([$4], [AC_MSG_FAILURE(
       +[The pkg-config script could not be found or is too old.  Make sure it
       +is in your PATH or set the PKG_CONFIG environment variable to the full
       +path to pkg-config.
       +
       +_PKG_TEXT
       +
       +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
       +        ])
       +else
       +        $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
       +        $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
       +        AC_MSG_RESULT([yes])
       +        $3
       +fi[]dnl
       +])dnl PKG_CHECK_MODULES
       +
       +
       +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
       +dnl   [ACTION-IF-NOT-FOUND])
       +dnl ---------------------------------------------------------------------
       +dnl Since: 0.29
       +dnl
       +dnl Checks for existence of MODULES and gathers its build flags with
       +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
       +dnl and VARIABLE-PREFIX_LIBS from --libs.
       +dnl
       +dnl Note that if there is a possibility the first call to
       +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
       +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
       +dnl configure.ac.
       +AC_DEFUN([PKG_CHECK_MODULES_STATIC],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
       +_save_PKG_CONFIG=$PKG_CONFIG
       +PKG_CONFIG="$PKG_CONFIG --static"
       +PKG_CHECK_MODULES($@)
       +PKG_CONFIG=$_save_PKG_CONFIG[]dnl
       +])dnl PKG_CHECK_MODULES_STATIC
       +
       +
       +dnl PKG_INSTALLDIR([DIRECTORY])
       +dnl -------------------------
       +dnl Since: 0.27
       +dnl
       +dnl Substitutes the variable pkgconfigdir as the location where a module
       +dnl should install pkg-config .pc files. By default the directory is
       +dnl $libdir/pkgconfig, but the default can be changed by passing
       +dnl DIRECTORY. The user can override through the --with-pkgconfigdir
       +dnl parameter.
       +AC_DEFUN([PKG_INSTALLDIR],
       +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
       +m4_pushdef([pkg_description],
       +    [pkg-config installation directory @<:@]pkg_default[@:>@])
       +AC_ARG_WITH([pkgconfigdir],
       +    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
       +    [with_pkgconfigdir=]pkg_default)
       +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
       +m4_popdef([pkg_default])
       +m4_popdef([pkg_description])
       +])dnl PKG_INSTALLDIR
       +
       +
       +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
       +dnl --------------------------------
       +dnl Since: 0.27
       +dnl
       +dnl Substitutes the variable noarch_pkgconfigdir as the location where a
       +dnl module should install arch-independent pkg-config .pc files. By
       +dnl default the directory is $datadir/pkgconfig, but the default can be
       +dnl changed by passing DIRECTORY. The user can override through the
       +dnl --with-noarch-pkgconfigdir parameter.
       +AC_DEFUN([PKG_NOARCH_INSTALLDIR],
       +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
       +m4_pushdef([pkg_description],
       +    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
       +AC_ARG_WITH([noarch-pkgconfigdir],
       +    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
       +    [with_noarch_pkgconfigdir=]pkg_default)
       +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
       +m4_popdef([pkg_default])
       +m4_popdef([pkg_description])
       +])dnl PKG_NOARCH_INSTALLDIR
       +
       +
       +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
       +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
       +dnl -------------------------------------------
       +dnl Since: 0.28
       +dnl
       +dnl Retrieves the value of the pkg-config variable for the given module.
       +AC_DEFUN([PKG_CHECK_VAR],
       +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
       +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
       +
       +_PKG_CONFIG([$1], [variable="][$3]["], [$2])
       +AS_VAR_COPY([$1], [pkg_cv_][$1])
       +
       +AS_VAR_IF([$1], [""], [$5], [$4])dnl
       +])dnl PKG_CHECK_VAR
       +
       +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
       +dnl   [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
       +dnl   [DESCRIPTION], [DEFAULT])
       +dnl ------------------------------------------
       +dnl
       +dnl Prepare a "--with-" configure option using the lowercase
       +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
       +dnl PKG_CHECK_MODULES in a single macro.
       +AC_DEFUN([PKG_WITH_MODULES],
       +[
       +m4_pushdef([with_arg], m4_tolower([$1]))
       +
       +m4_pushdef([description],
       +           [m4_default([$5], [build with ]with_arg[ support])])
       +
       +m4_pushdef([def_arg], [m4_default([$6], [auto])])
       +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
       +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
       +
       +m4_case(def_arg,
       +            [yes],[m4_pushdef([with_without], [--without-]with_arg)],
       +            [m4_pushdef([with_without],[--with-]with_arg)])
       +
       +AC_ARG_WITH(with_arg,
       +     AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
       +    [AS_TR_SH([with_]with_arg)=def_arg])
       +
       +AS_CASE([$AS_TR_SH([with_]with_arg)],
       +            [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
       +            [auto],[PKG_CHECK_MODULES([$1],[$2],
       +                                        [m4_n([def_action_if_found]) $3],
       +                                        [m4_n([def_action_if_not_found]) $4])])
       +
       +m4_popdef([with_arg])
       +m4_popdef([description])
       +m4_popdef([def_arg])
       +
       +])dnl PKG_WITH_MODULES
       +
       +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
       +dnl   [DESCRIPTION], [DEFAULT])
       +dnl -----------------------------------------------
       +dnl
       +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
       +dnl check._[VARIABLE-PREFIX] is exported as make variable.
       +AC_DEFUN([PKG_HAVE_WITH_MODULES],
       +[
       +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
       +
       +AM_CONDITIONAL([HAVE_][$1],
       +               [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
       +])dnl PKG_HAVE_WITH_MODULES
       +
       +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
       +dnl   [DESCRIPTION], [DEFAULT])
       +dnl ------------------------------------------------------
       +dnl
       +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
       +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
       +dnl and preprocessor variable.
       +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
       +[
       +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
       +
       +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
       +        [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
       +])dnl PKG_HAVE_DEFINE_WITH_MODULES