]> git.ipfire.org Git - thirdparty/curl.git/blob - curl-config.in
asyn-ares: fix data race warning
[thirdparty/curl.git] / curl-config.in
1 #! /bin/sh
2 #***************************************************************************
3 # _ _ ____ _
4 # Project ___| | | | _ \| |
5 # / __| | | | |_) | |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
8 #
9 # Copyright (C) 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 https://curl.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 # SPDX-License-Identifier: curl
23 #
24 ###########################################################################
25
26 prefix="@prefix@"
27 exec_prefix=@exec_prefix@
28 includedir=@includedir@
29 cppflag_curl_staticlib=@CPPFLAG_CURL_STATICLIB@
30
31 usage()
32 {
33 cat <<EOF
34 Usage: curl-config [OPTION]
35
36 Available values for OPTION include:
37
38 --built-shared says 'yes' if libcurl was built shared
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 --configure the arguments given to configure when building curl
44 --features newline separated list of enabled features
45 --help display this help and exit
46 --libs library linking information
47 --prefix curl install prefix
48 --protocols newline separated list of enabled protocols
49 --ssl-backends output the SSL backends libcurl was built to support
50 --static-libs static libcurl library linking information
51 --version output version information
52 --vernum output the version information as a number (hexadecimal)
53 EOF
54
55 exit $1
56 }
57
58 if test $# -eq 0; then
59 usage 1
60 fi
61
62 while test $# -gt 0; do
63 case "$1" in
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= ;;
69 esac
70
71 case "$1" in
72 --built-shared)
73 echo @ENABLE_SHARED@
74 ;;
75
76 --ca)
77 echo @CURL_CA_BUNDLE@
78 ;;
79
80 --cc)
81 echo "@CC@"
82 ;;
83
84 --prefix)
85 echo "$prefix"
86 ;;
87
88 --feature|--features)
89 for feature in @SUPPORT_FEATURES@ ""; do
90 test -n "$feature" && echo "$feature"
91 done
92 ;;
93
94 --protocols)
95 for protocol in @SUPPORT_PROTOCOLS@; do
96 echo "$protocol"
97 done
98 ;;
99
100 --version)
101 echo libcurl @CURLVERSION@
102 exit 0
103 ;;
104
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
110 # dash as that's used for things like version 1.2.3-CVS
111 cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
112
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
131 fi
132
133 echo "requested version $checkfor is newer than existing @CURLVERSION@"
134 exit 1
135 ;;
136
137 --vernum)
138 echo @VERSIONNUM@
139 exit 0
140 ;;
141
142 --help)
143 usage 0
144 ;;
145
146 --cflags)
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
152 if test "X@includedir@" = "X/usr/include"; then
153 echo "$CPPFLAG_CURL_STATICLIB"
154 else
155 echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@"
156 fi
157 ;;
158
159 --libs)
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
165 if test "X@ENABLE_SHARED@" = "Xno"; then
166 echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@
167 else
168 echo ${CURLLIBDIR}-lcurl
169 fi
170 ;;
171 --ssl-backends)
172 echo "@SSL_BACKENDS@"
173 ;;
174
175 --static-libs)
176 if test "X@ENABLE_STATIC@" != "Xno" ; then
177 echo "@libdir@/libcurl.@libext@" @LDFLAGS@ @LIBCURL_LIBS@
178 else
179 echo "curl was built with static libraries disabled" >&2
180 exit 1
181 fi
182 ;;
183
184 --configure)
185 echo @CONFIGURE_OPTIONS@
186 ;;
187
188 *)
189 echo "unknown option: $1"
190 usage 1
191 ;;
192 esac
193 shift
194 done
195
196 exit 0