diff --git a/CHANGES b/CHANGES index a3a653c70..4d87132d4 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,14 @@ Changelog +Daniel (2 May 2006) +- Added a --checkfor option to curl-config to allow users to easier + write for example shell scripts that test for the presence of a + new-enough libcurl version. If --checkfor is given a version string + newer than what is currently installed, curl-config will return a + non-zero exit code and output a string about the unfulfilled + requirement. + Daniel (26 April 2006) - David McCreedy brought initial line end conversions when doing FTP ASCII transfers. They are done on non-windows systems and translate CRLF to LF. diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 25b53b44f..810ffda92 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -11,6 +11,7 @@ Curl and libcurl 7.15.4 This release includes the following changes: + o curl-config got a --checkfor option to compare version numbers o line end conversions for FTP ASCII transfers o curl_multi_socket() API added (still mostly untested) o conversion callback options for EBCDIC <=> ASCII conversions @@ -45,6 +46,6 @@ advice from friends like these: Dan Fandrich, Ilja van Sprundel, David McCreedy, Tor Arntsen, Xavier Bouchoux, David Byron, Michele Bini, Ates Goral, Katie Wang, Robson Braga Araujo, - Ale Vesely, Paul Querna + Ale Vesely, Paul Querna, Gisle Vanem Thanks! (and sorry if I forgot to mention someone) diff --git a/curl-config.in b/curl-config.in index 8f89049ca..aaffda820 100644 --- a/curl-config.in +++ b/curl-config.in @@ -1,10 +1,30 @@ #! /bin/sh +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2001 - 2006, Daniel Stenberg, , et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +# $Id$ +########################################################################### # # The idea to this kind of setup info script was stolen from numerous # other packages, such as neon, libxml and gnome. # -# $Id$ -# prefix=@prefix@ exec_prefix=@exec_prefix@ includedir=@includedir@ @@ -19,6 +39,7 @@ Available values for OPTION include: --ca ca bundle install path --cc compiler --cflags pre-processor and compiler flags + --checkfor [version] check for (lib)curl of the specified version --features newline separated list of enabled features --protocols newline separated list of enabled protocols --help display this help and exit @@ -122,6 +143,26 @@ while test $# -gt 0; do exit 0 ;; + --checkfor) + checkfor=$2 + cmajor=`echo $checkfor | cut -d. -f1` + cminor=`echo $checkfor | cut -d. -f2` + # when extracting the patch part we strip off everything after a + # dash as that's used for things like version 1.2.3-CVS + cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1` + checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc` + numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'` + nownum=`echo "obase=10; ibase=16; $numuppercase" | bc` + + if test "$nownum" -ge "$checknum"; then + # silent success + exit 0 + else + echo "requested version $checkfor is newer than existing @VERSION@" + exit 1 + fi + ;; + --vernum) echo @VERSIONNUM@ exit 0 diff --git a/docs/curl-config.1 b/docs/curl-config.1 index 8ac77dbe4..066169874 100644 --- a/docs/curl-config.1 +++ b/docs/curl-config.1 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -21,7 +21,7 @@ .\" * $Id$ .\" ************************************************************************** .\" -.TH curl-config 1 "25 Jan 2004" "Curl 7.13.0" "curl-config manual" +.TH curl-config 1 "25 Jan 2004" "Curl 7.15.4" "curl-config manual" .SH NAME curl-config \- Get information about a libcurl installation .SH SYNOPSIS @@ -37,6 +37,11 @@ Displays the compiler used to build libcurl. .IP "--cflags" Set of compiler options (CFLAGS) to use when compiling files that use libcurl. Currently that is only thw include path to the curl include files. +.IP "--checkfor [version]" +Specify the oldest possible libcurl version string you want, and this +script will return 0 if the current installation is new enough or it +returns 1 and outputs a text saying that the current version is not new +enough. (Added in 7.15.4) .IP "--feature" Lists what particular main features the installed libcurl was built with. At the time of writing, this list may include SSL, KRB4 or IPv6. Do not assume