]>
Commit | Line | Data |
---|---|---|
fb1ce5fd | 1 | #! /bin/sh |
6ca627ae DS |
2 | #*************************************************************************** |
3 | # _ _ ____ _ | |
4 | # Project ___| | | | _ \| | | |
5 | # / __| | | | |_) | | | |
6 | # | (__| |_| | _ <| |___ | |
7 | # \___|\___/|_| \_\_____| | |
fb1ce5fd | 8 | # |
2bc1d775 | 9 | # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. |
6ca627ae DS |
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 | |
4d2f8006 | 13 | # are also available at https://curl.se/docs/copyright.html. |
6ca627ae DS |
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. | |
fb1ce5fd | 21 | # |
ad9bc597 MM |
22 | # SPDX-License-Identifier: curl |
23 | # | |
6ca627ae | 24 | ########################################################################### |
1b6d18fc | 25 | |
3adc9f3f | 26 | prefix="@prefix@" |
fb1ce5fd DS |
27 | exec_prefix=@exec_prefix@ |
28 | includedir=@includedir@ | |
a379a4c1 | 29 | cppflag_curl_staticlib=@CPPFLAG_CURL_STATICLIB@ |
fb1ce5fd DS |
30 | |
31 | usage() | |
32 | { | |
33 | cat <<EOF | |
34 | Usage: curl-config [OPTION] | |
35 | ||
1ee7f92c | 36 | Available values for OPTION include: |
fb1ce5fd | 37 | |
a1312859 | 38 | --built-shared says 'yes' if libcurl was built shared |
98e1605b | 39 | --ca ca bundle install path |
6e9d1617 | 40 | --cc compiler |
1ee7f92c | 41 | --cflags pre-processor and compiler flags |
6ca627ae | 42 | --checkfor [version] check for (lib)curl of the specified version |
f7f76e17 | 43 | --configure the arguments given to configure when building curl |
2a6ea6d7 | 44 | --features newline separated list of enabled features |
1ee7f92c DS |
45 | --help display this help and exit |
46 | --libs library linking information | |
47 | --prefix curl install prefix | |
faaaf626 | 48 | --protocols newline separated list of enabled protocols |
0c65678e | 49 | --ssl-backends output the SSL backends libcurl was built to support |
faaaf626 | 50 | --static-libs static libcurl library linking information |
1ee7f92c | 51 | --version output version information |
26886731 | 52 | --vernum output the version information as a number (hexadecimal) |
fb1ce5fd DS |
53 | EOF |
54 | ||
55 | exit $1 | |
56 | } | |
57 | ||
58 | if test $# -eq 0; then | |
59 | usage 1 | |
60 | fi | |
61 | ||
fb1ce5fd DS |
62 | while test $# -gt 0; do |
63 | case "$1" in | |
28a91082 DS |
64 | # this deals with options in the style |
65 | # --option=value and extracts the value part | |
66 | # [not currently used] | |
67 | -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; | |
68 | *) value= ;; | |
fb1ce5fd DS |
69 | esac |
70 | ||
71 | case "$1" in | |
a1312859 DS |
72 | --built-shared) |
73 | echo @ENABLE_SHARED@ | |
74 | ;; | |
75 | ||
98e1605b | 76 | --ca) |
e47b8306 | 77 | echo @CURL_CA_BUNDLE@ |
d23d69e1 | 78 | ;; |
98e1605b | 79 | |
6e9d1617 | 80 | --cc) |
d23d69e1 KD |
81 | echo "@CC@" |
82 | ;; | |
6e9d1617 | 83 | |
fb1ce5fd | 84 | --prefix) |
d23d69e1 KD |
85 | echo "$prefix" |
86 | ;; | |
fb1ce5fd | 87 | |
2a6ea6d7 | 88 | --feature|--features) |
9813cea1 DF |
89 | for feature in @SUPPORT_FEATURES@ ""; do |
90 | test -n "$feature" && echo "$feature" | |
bbc002a5 | 91 | done |
d23d69e1 | 92 | ;; |
2a6ea6d7 DS |
93 | |
94 | --protocols) | |
bbc002a5 | 95 | for protocol in @SUPPORT_PROTOCOLS@; do |
cc0054a4 | 96 | echo "$protocol" |
bbc002a5 | 97 | done |
d23d69e1 | 98 | ;; |
a1312859 | 99 | |
fb1ce5fd | 100 | --version) |
d23d69e1 KD |
101 | echo libcurl @CURLVERSION@ |
102 | exit 0 | |
103 | ;; | |
fb1ce5fd | 104 | |
6ca627ae DS |
105 | --checkfor) |
106 | checkfor=$2 | |
107 | cmajor=`echo $checkfor | cut -d. -f1` | |
108 | cminor=`echo $checkfor | cut -d. -f2` | |
109 | # when extracting the patch part we strip off everything after a | |
d23d69e1 KD |
110 | # dash as that's used for things like version 1.2.3-CVS |
111 | cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1` | |
6ca627ae | 112 | |
abfdf6a0 DS |
113 | vmajor=`echo @CURLVERSION@ | cut -d. -f1` |
114 | vminor=`echo @CURLVERSION@ | cut -d. -f2` | |
115 | # when extracting the patch part we strip off everything after a | |
116 | # dash as that's used for things like version 1.2.3-CVS | |
117 | vpatch=`echo @CURLVERSION@ | cut -d. -f3 | cut -d- -f1` | |
118 | ||
119 | if test "$vmajor" -gt "$cmajor"; then | |
120 | exit 0; | |
121 | fi | |
122 | if test "$vmajor" -eq "$cmajor"; then | |
123 | if test "$vminor" -gt "$cminor"; then | |
124 | exit 0 | |
125 | fi | |
126 | if test "$vminor" -eq "$cminor"; then | |
127 | if test "$cpatch" -le "$vpatch"; then | |
128 | exit 0 | |
129 | fi | |
130 | fi | |
d23d69e1 | 131 | fi |
abfdf6a0 DS |
132 | |
133 | echo "requested version $checkfor is newer than existing @CURLVERSION@" | |
134 | exit 1 | |
d23d69e1 | 135 | ;; |
6ca627ae | 136 | |
1e5e0f9a | 137 | --vernum) |
d23d69e1 KD |
138 | echo @VERSIONNUM@ |
139 | exit 0 | |
140 | ;; | |
1e5e0f9a | 141 | |
fb1ce5fd | 142 | --help) |
d23d69e1 KD |
143 | usage 0 |
144 | ;; | |
fb1ce5fd DS |
145 | |
146 | --cflags) | |
a379a4c1 YT |
147 | if test "X$cppflag_curl_staticlib" = "X-DCURL_STATICLIB"; then |
148 | CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB " | |
149 | else | |
150 | CPPFLAG_CURL_STATICLIB="" | |
151 | fi | |
d23d69e1 | 152 | if test "X@includedir@" = "X/usr/include"; then |
382429e7 | 153 | echo "$CPPFLAG_CURL_STATICLIB" |
b0fbb98f | 154 | else |
382429e7 | 155 | echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@" |
b0fbb98f | 156 | fi |
d23d69e1 | 157 | ;; |
d9e54a3c | 158 | |
fb1ce5fd | 159 | --libs) |
d23d69e1 KD |
160 | if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then |
161 | CURLLIBDIR="-L@libdir@ " | |
162 | else | |
163 | CURLLIBDIR="" | |
164 | fi | |
97aca097 | 165 | if test "X@ENABLE_SHARED@" = "Xno"; then |
d23d69e1 KD |
166 | echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@ |
167 | else | |
168 | echo ${CURLLIBDIR}-lcurl | |
169 | fi | |
170 | ;; | |
0c65678e DS |
171 | --ssl-backends) |
172 | echo "@SSL_BACKENDS@" | |
173 | ;; | |
fb1ce5fd | 174 | |
faaaf626 | 175 | --static-libs) |
6f3e7aab | 176 | if test "X@ENABLE_STATIC@" != "Xno" ; then |
3adc9f3f | 177 | echo "@libdir@/libcurl.@libext@" @LDFLAGS@ @LIBCURL_LIBS@ |
6f3e7aab KD |
178 | else |
179 | echo "curl was built with static libraries disabled" >&2 | |
180 | exit 1 | |
181 | fi | |
d23d69e1 | 182 | ;; |
faaaf626 | 183 | |
f7f76e17 | 184 | --configure) |
d23d69e1 KD |
185 | echo @CONFIGURE_OPTIONS@ |
186 | ;; | |
f7f76e17 | 187 | |
fb1ce5fd | 188 | *) |
861ca06f | 189 | echo "unknown option: $1" |
d23d69e1 KD |
190 | usage 1 |
191 | ;; | |
fb1ce5fd DS |
192 | esac |
193 | shift | |
194 | done | |
195 | ||
196 | exit 0 |