Don't bother adding a library path of /usr/lib in curl-config --libs
[platform/upstream/curl.git] / curl-config.in
1 #! /bin/sh
2 #***************************************************************************
3 #                                  _   _ ____  _
4 #  Project                     ___| | | |  _ \| |
5 #                             / __| | | | |_) | |
6 #                            | (__| |_| |  _ <| |___
7 #                             \___|\___/|_| \_\_____|
8 #
9 # Copyright (C) 2001 - 2007, 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 # The idea to this kind of setup info script was stolen from numerous
26 # other packages, such as neon, libxml and gnome.
27 #
28 prefix=@prefix@
29 exec_prefix=@exec_prefix@
30 includedir=@includedir@
31
32 usage()
33 {
34     cat <<EOF
35 Usage: curl-config [OPTION]
36
37 Available values for OPTION include:
38
39   --ca        ca bundle install path
40   --cc        compiler
41   --cflags    pre-processor and compiler flags
42   --checkfor [version] check for (lib)curl of the specified version
43   --features  newline separated list of enabled features
44   --protocols newline separated list of enabled protocols
45   --help      display this help and exit
46   --libs      library linking information
47   --prefix    curl install prefix
48   --version   output version information
49   --vernum    output the version information as a number (hexadecimal)
50 EOF
51
52     exit $1
53 }
54
55 if test $# -eq 0; then
56     usage 1
57 fi
58
59 while test $# -gt 0; do
60     case "$1" in
61     # this deals with options in the style
62     # --option=value and extracts the value part
63     # [not currently used]
64     -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
65     *) value= ;;
66     esac
67
68     case "$1" in
69     --ca)
70         echo "@CURL_CA_BUNDLE@"
71         ;;
72
73     --cc)
74         echo "@CC@"
75         ;;
76
77     --prefix)
78         echo "$prefix"
79         ;;
80
81     --feature|--features)
82         if test "@USE_SSLEAY@" = "1"; then
83           echo "SSL"
84           NTLM=1 # OpenSSL implies NTLM
85         elif test -n "@USE_GNUTLS@"; then
86           echo "SSL"
87         fi
88         if test "@KRB4_ENABLED@" = "1"; then
89           echo "KRB4"
90         fi
91         if test "@IPV6_ENABLED@" = "1"; then
92           echo "IPv6"
93         fi
94         if test "@HAVE_LIBZ@" = "1"; then
95           echo "libz"
96         fi
97         if test "@HAVE_ARES@" = "1"; then
98           echo "AsynchDNS"
99         fi
100         if test "@IDN_ENABLED@" = "1"; then
101           echo "IDN"
102         fi
103         if test "@USE_WINDOWS_SSPI@" = "1"; then
104           echo "SSPI"
105           NTLM=1
106         fi
107         if test "$NTLM" = "1"; then
108           echo "NTLM"
109         fi
110         ;;
111
112     --protocols)
113         if test "@CURL_DISABLE_HTTP@" != "1"; then
114           echo "HTTP"
115           if test "@USE_SSLEAY@" = "1"; then
116             echo "HTTPS"
117           fi
118         fi
119         if test "@CURL_DISABLE_FTP@" != "1"; then
120           echo "FTP"
121           if test "@USE_SSLEAY@" = "1"; then
122             echo "FTPS"
123           fi
124         fi
125         if test "@CURL_DISABLE_FILE@" != "1"; then
126           echo "FILE"
127         fi
128         if test "@CURL_DISABLE_TELNET@" != "1"; then
129           echo "TELNET"
130         fi
131         if test "@CURL_DISABLE_LDAP@" != "1"; then
132           echo "LDAP"
133         fi
134         if test "@CURL_DISABLE_DICT@" != "1"; then
135           echo "DICT"
136         fi
137         if test "@CURL_DISABLE_TFTP@" != "1"; then
138           echo "TFTP"
139         fi
140         ;;
141     --version)
142         echo libcurl @VERSION@
143         exit 0
144         ;;
145
146     --checkfor)
147         checkfor=$2
148         cmajor=`echo $checkfor | cut -d. -f1`
149         cminor=`echo $checkfor | cut -d. -f2`
150         # when extracting the patch part we strip off everything after a
151         # dash as that's used for things like version 1.2.3-CVS
152         cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
153         checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
154         numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'`
155         nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
156
157         if test "$nownum" -ge "$checknum"; then
158           # silent success
159           exit 0
160         else
161           echo "requested version $checkfor is newer than existing @VERSION@"
162           exit 1
163         fi
164         ;;
165
166     --vernum)
167         echo @VERSIONNUM@
168         exit 0
169         ;;
170
171     --help)
172         usage 0
173         ;;
174
175     --cflags)
176         if test "X@includedir@" = "X/usr/include"; then
177           echo ""
178         else
179           echo "-I@includedir@"
180         fi
181         ;;
182
183     --libs)
184         if test "X@libdir@" != "X/usr/lib"; then
185            CURLLIBDIR="-L@libdir@ "
186         else
187            CURLLIBDIR=""
188         fi
189         if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then
190           echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBS@
191         else
192           echo ${CURLLIBDIR}-lcurl @LDFLAGS@
193         fi
194         ;;
195
196     *)
197         echo "unknown option: $1"
198         usage 1
199         ;;
200     esac
201     shift
202 done
203
204 exit 0