[pacman-dev] [PATCH] Configure: Check if libfetch version is >= 2.21

Xavier shiningxc at gmail.com
Mon Aug 24 16:42:14 EDT 2009


On Mon, Aug 24, 2009 at 10:10 PM, Henning
Garus<henning.garus at googlemail.com> wrote:
> Commit 6f97842 started using libfetch's conditional GET. This requires libfetch
> to be version 2.21 or greater.
>
> Change configure.ac to check for the existence of the last_modified field in
> the url struct, which was introduced with libfetch 2.21.
>
> Signed-off-by: Henning Garus <henning.garus at gmail.com>
> ---
>  configure.ac |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index b2164b9..40d8e13 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -142,7 +142,12 @@ if test "x$internaldownload" = "xyes" ; then
>        AC_MSG_RESULT(yes)
>        AC_DEFINE([INTERNAL_DOWNLOAD], , [Use internal download library])
>        # Check for a download library if it was actually requested
> -       AC_CHECK_LIB([fetch], [fetchParseURL], ,
> +       AC_CHECK_LIB([fetch], [fetchParseURL],
> +               # Check if libfetch supports conditional GET
> +               # (version >=2.21, struct url has member last_modified)
> +               AC_CHECK_MEMBER(struct url.last_modified, ,
> +                       AC_MSG_ERROR([libfetch must be version 2.21 or greater]),
> +                       [#include <fetch.h>] ),
>                AC_MSG_ERROR([libfetch is needed to compile with internal download support]) )
>  else
>        AC_MSG_RESULT(no)
> --
> 1.6.4.1
>
>
>

AC_CHECK_MEMBER is exactly what we need :)

however, for some reason, this patch did not work as expected. it
prevented AC_CHECK_LIB from working and adding -lfetch

I reworked the patch as follow :
diff --git a/configure.ac b/configure.ac
index b2164b9..e0d0687 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,6 +144,11 @@ if test "x$internaldownload" = "xyes" ; then
        # Check for a download library if it was actually requested
        AC_CHECK_LIB([fetch], [fetchParseURL], ,
                AC_MSG_ERROR([libfetch is needed to compile with
internal download support]) )
+       # Check if libfetch supports conditional GET
+       # (version >=2.21, struct url has member last_modified)
+       AC_CHECK_MEMBER(struct url.last_modified, ,
+               AC_MSG_ERROR([libfetch must be version 2.21 or greater]),
+               [#include <fetch.h>] ),
 else
        AC_MSG_RESULT(no)
 fi

Does it look fine to you? and do you know why yours did not work for me?


More information about the pacman-dev mailing list