cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: autoconf Macro & curl-config

From: Nick Humfrey <njh_at_aelius.com>
Date: Thu, 10 Oct 2002 17:40:55 +0100

Thanks Daniel - your email was very helpful.

This probably isn't the best autoconf macro but it works for me.

Cheers,

nick.

-----------------------------------

dnl ******
dnl libcurl
dnl ******

dnl MY_CURL
dnl -------
dnl set my_cv_curl_vers to the version of libcurl or NONE
dnl if libcurl is not found or is too old

AC_DEFUN(MY_CURL,[
        AC_CACHE_VAL(my_cv_curl_vers,[
        my_cv_curl_vers=NONE
        check="7.9.7"
        check_hex="070907"

        if eval curl-config --version 2>/dev/null >/dev/null; then
                ver=`curl-config --version`
                hex_ver=`curl-config --vernum | tr 'a-f' 'A-F'`
                ok=`echo "ibase=16; if($hex_ver>=$check_hex) $hex_ver
else 0" | bc`

                if test x$ok != x0; then
                        my_cv_curl_vers="$ver"
                        echo "curl version $ver is fine."
                else
                        echo "curl version $ver is too old. Need
version $check or higher."
                fi
        fi
        ])
        echo "libcurl version ..................................
$my_cv_curl_vers"
])

>On Thu, 10 Oct 2002, Nick Humfrey wrote:
>
>> Does anyone have an autoconf Macro to check for the presence/version of
>> libcurl ?
>>
>> I am adding curl support to OpenQuicktime. I am using the Multi features of
>> curl and would like to check to make sure they have version 7.9.7 or later
>> installed...
>>
>> Should just be a matter of comparing the hex version number - but I am not
>> sure of a good way of doing that... ?
>
>Without doing a very extensive test, I wrote up this little check that seems
>to work for me on Solaris and Linux at least. It is a bourne shell script,
>that uses tr and bc:
>
>#!/bin/sh
>ver=`curl-config --vernum | tr 'a-f' 'A-F'`
>
># check must use uppercase hex letters if any
># the lowest acceptable version
>check="070909"
>
>ok=`echo "ibase=16; if($ver>=$check) $ver else 0" | bc`
>
>if [ $ok -gt "0" ]; then
> echo "curl version $ver is fine"
>else
> echo "curl version $ver is too old"
>fi
>
>
>--
> Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
>
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-10