removed useless comment
[platform/upstream/curl.git] / curl-config.in
1 #! /bin/sh
2 #***************************************************************************
3 #                                  _   _ ____  _
4 #  Project                     ___| | | |  _ \| |
5 #                             / __| | | | |_) | |
6 #                            | (__| |_| |  _ <| |___
7 #                             \___|\___/|_| \_\_____|
8 #
9 # Copyright (C) 2001 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
10 #
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://curl.haxx.se/docs/copyright.html.
14 #
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
18 #
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
21 #
22 # $Id$
23 ###########################################################################
24
25 prefix=@prefix@
26 exec_prefix=@exec_prefix@
27 includedir=@includedir@
28
29 usage()
30 {
31     cat <<EOF
32 Usage: curl-config [OPTION]
33
34 Available values for OPTION include:
35
36   --ca        ca bundle install path
37   --cc        compiler
38   --cflags    pre-processor and compiler flags
39   --checkfor [version] check for (lib)curl of the specified version
40   --features  newline separated list of enabled features
41   --help      display this help and exit
42   --libs      library linking information
43   --prefix    curl install prefix
44   --protocols newline separated list of enabled protocols
45   --static-libs static libcurl library linking information
46   --version   output version information
47   --vernum    output the version information as a number (hexadecimal)
48 EOF
49
50     exit $1
51 }
52
53 if test $# -eq 0; then
54     usage 1
55 fi
56
57 while test $# -gt 0; do
58     case "$1" in
59     # this deals with options in the style
60     # --option=value and extracts the value part
61     # [not currently used]
62     -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
63     *) value= ;;
64     esac
65
66     case "$1" in
67     --ca)
68         echo "@CURL_CA_BUNDLE@"
69         ;;
70
71     --cc)
72         echo "@CC@"
73         ;;
74
75     --prefix)
76         echo "$prefix"
77         ;;
78
79     --feature|--features)
80         for feature in @SUPPORT_FEATURES@ ""; do
81             test -n "$feature" && echo "$feature"
82         done
83         ;;
84
85     --protocols)
86         for protocol in @SUPPORT_PROTOCOLS@; do
87             echo "$protocol"
88         done
89         ;;
90     --version)
91         echo libcurl @VERSION@
92         exit 0
93         ;;
94
95     --checkfor)
96         checkfor=$2
97         cmajor=`echo $checkfor | cut -d. -f1`
98         cminor=`echo $checkfor | cut -d. -f2`
99         # when extracting the patch part we strip off everything after a
100         # dash as that's used for things like version 1.2.3-CVS
101         cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
102         checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
103         numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'`
104         nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
105
106         if test "$nownum" -ge "$checknum"; then
107           # silent success
108           exit 0
109         else
110           echo "requested version $checkfor is newer than existing @VERSION@"
111           exit 1
112         fi
113         ;;
114
115     --vernum)
116         echo @VERSIONNUM@
117         exit 0
118         ;;
119
120     --help)
121         usage 0
122         ;;
123
124     --cflags)
125         if test "X@includedir@" = "X/usr/include"; then
126           echo ""
127         else
128           echo "-I@includedir@"
129         fi
130         ;;
131
132     --libs)
133         if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then
134            CURLLIBDIR="-L@libdir@ "
135         else
136            CURLLIBDIR=""
137         fi
138         if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then
139           echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@
140         else
141           echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBS@
142         fi
143         ;;
144
145     --static-libs)
146         echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@
147         ;;
148
149     *)
150         echo "unknown option: $1"
151         usage 1
152         ;;
153     esac
154     shift
155 done
156
157 exit 0