blob: 2f958ca9424dacabda8950e4e79bd6884e26e606 [file] [log] [blame]
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001#! /bin/sh
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
Elliott Hughes0128fe42018-02-27 14:57:55 -08009# Copyright (C) 2001 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070010#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
Alex Deymo8f1a2142016-06-28 14:49:26 -070013# are also available at https://curl.haxx.se/docs/copyright.html.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070014#
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###########################################################################
23
24prefix=@prefix@
25exec_prefix=@exec_prefix@
26includedir=@includedir@
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070027cppflag_curl_staticlib=@CPPFLAG_CURL_STATICLIB@
Lucas Eckels9bd90e62012-08-06 15:07:02 -070028
29usage()
30{
31 cat <<EOF
32Usage: curl-config [OPTION]
33
34Available values for OPTION include:
35
36 --built-shared says 'yes' if libcurl was built shared
37 --ca ca bundle install path
38 --cc compiler
39 --cflags pre-processor and compiler flags
40 --checkfor [version] check for (lib)curl of the specified version
41 --configure the arguments given to configure when building curl
42 --features newline separated list of enabled features
43 --help display this help and exit
44 --libs library linking information
45 --prefix curl install prefix
46 --protocols newline separated list of enabled protocols
Elliott Hughes0128fe42018-02-27 14:57:55 -080047 --ssl-backends output the SSL backends libcurl was built to support
Lucas Eckels9bd90e62012-08-06 15:07:02 -070048 --static-libs static libcurl library linking information
49 --version output version information
50 --vernum output the version information as a number (hexadecimal)
51EOF
52
53 exit $1
54}
55
56if test $# -eq 0; then
57 usage 1
58fi
59
60while test $# -gt 0; do
61 case "$1" in
62 # this deals with options in the style
63 # --option=value and extracts the value part
64 # [not currently used]
65 -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
66 *) value= ;;
67 esac
68
69 case "$1" in
70 --built-shared)
71 echo @ENABLE_SHARED@
72 ;;
73
74 --ca)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070075 echo @CURL_CA_BUNDLE@
76 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -070077
78 --cc)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070079 echo "@CC@"
80 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -070081
82 --prefix)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070083 echo "$prefix"
84 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -070085
86 --feature|--features)
87 for feature in @SUPPORT_FEATURES@ ""; do
88 test -n "$feature" && echo "$feature"
89 done
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070090 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -070091
92 --protocols)
93 for protocol in @SUPPORT_PROTOCOLS@; do
94 echo "$protocol"
95 done
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070096 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -070097
98 --version)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070099 echo libcurl @CURLVERSION@
100 exit 0
101 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700102
103 --checkfor)
104 checkfor=$2
105 cmajor=`echo $checkfor | cut -d. -f1`
106 cminor=`echo $checkfor | cut -d. -f2`
107 # when extracting the patch part we strip off everything after a
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700108 # dash as that's used for things like version 1.2.3-CVS
109 cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700110 checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
111 numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'`
112 nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
113
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700114 if test "$nownum" -ge "$checknum"; then
115 # silent success
116 exit 0
117 else
118 echo "requested version $checkfor is newer than existing @CURLVERSION@"
119 exit 1
120 fi
121 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700122
123 --vernum)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700124 echo @VERSIONNUM@
125 exit 0
126 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700127
128 --help)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700129 usage 0
130 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700131
132 --cflags)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700133 if test "X$cppflag_curl_staticlib" = "X-DCURL_STATICLIB"; then
134 CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB "
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700135 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700136 CPPFLAG_CURL_STATICLIB=""
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700137 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700138 if test "X@includedir@" = "X/usr/include"; then
139 echo "$CPPFLAG_CURL_STATICLIB"
140 else
141 echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@"
142 fi
143 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700144
145 --libs)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700146 if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then
147 CURLLIBDIR="-L@libdir@ "
148 else
149 CURLLIBDIR=""
150 fi
151 if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then
152 echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@
153 else
154 echo ${CURLLIBDIR}-lcurl
155 fi
156 ;;
Elliott Hughes0128fe42018-02-27 14:57:55 -0800157 --ssl-backends)
158 echo "@SSL_BACKENDS@"
159 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700160
161 --static-libs)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700162 if test "X@ENABLE_STATIC@" != "Xno" ; then
163 echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@
164 else
165 echo "curl was built with static libraries disabled" >&2
166 exit 1
167 fi
168 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700169
170 --configure)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700171 echo @CONFIGURE_OPTIONS@
172 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700173
174 *)
175 echo "unknown option: $1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700176 usage 1
177 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700178 esac
179 shift
180done
181
182exit 0