Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 168 lines (143 sloc) 4.098 kb
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
1 #! /bin/sh
6ca627a @bagder curl-config got a --checkfor option
authored
2 #***************************************************************************
3 # _ _ ____ _
4 # Project ___| | | | _ \| |
5 # / __| | | | |_) | |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
8 #
82ecc85 @bagder curl-config: fix --version
authored
9 # Copyright (C) 2001 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
6ca627a @bagder curl-config got a --checkfor option
authored
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.
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
21 #
6ca627a @bagder curl-config got a --checkfor option
authored
22 ###########################################################################
1b6d18f @bagder removed useless comment
authored
23
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
24 prefix=@prefix@
25 exec_prefix=@exec_prefix@
26 includedir=@includedir@
27
28 usage()
29 {
30 cat <<EOF
31 Usage: curl-config [OPTION]
32
1ee7f92 @bagder configure sets variables that curl-config uses to display what features
authored
33 Available values for OPTION include:
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
34
a131285 @bagder curl-config: --built-shared returns shared info
authored
35 --built-shared says 'yes' if libcurl was built shared
98e1605 @bagder --ca shows ca bundle path
authored
36 --ca ca bundle install path
6e9d161 @bagder added support for --cc to output the compiler name. This makes it pos…
authored
37 --cc compiler
1ee7f92 @bagder configure sets variables that curl-config uses to display what features
authored
38 --cflags pre-processor and compiler flags
6ca627a @bagder curl-config got a --checkfor option
authored
39 --checkfor [version] check for (lib)curl of the specified version
f7f76e1 @claesjac Added '--configure' option to curl-config to display original configu…
claesjac authored
40 --configure the arguments given to configure when building curl
2a6ea6d @bagder David Shaw added --protocols, and thus the --feature no longer mentio…
authored
41 --features newline separated list of enabled features
1ee7f92 @bagder configure sets variables that curl-config uses to display what features
authored
42 --help display this help and exit
43 --libs library linking information
44 --prefix curl install prefix
faaaf62 @dfandrich Added the --static-libs option to curl-config
dfandrich authored
45 --protocols newline separated list of enabled protocols
46 --static-libs static libcurl library linking information
1ee7f92 @bagder configure sets variables that curl-config uses to display what features
authored
47 --version output version information
2688673 Add documentation for the --vernum attribute
Sterling Hughes authored
48 --vernum output the version information as a number (hexadecimal)
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
49 EOF
50
51 exit $1
52 }
53
54 if test $# -eq 0; then
55 usage 1
56 fi
57
58 while test $# -gt 0; do
59 case "$1" in
28a9108 @bagder more intial fixes
authored
60 # this deals with options in the style
61 # --option=value and extracts the value part
62 # [not currently used]
63 -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
64 *) value= ;;
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
65 esac
66
67 case "$1" in
a131285 @bagder curl-config: --built-shared returns shared info
authored
68 --built-shared)
69 echo @ENABLE_SHARED@
70 ;;
71
98e1605 @bagder --ca shows ca bundle path
authored
72 --ca)
df3ca59 @bagder Dan Fandrich:
authored
73 echo "@CURL_CA_BUNDLE@"
98e1605 @bagder --ca shows ca bundle path
authored
74 ;;
75
6e9d161 @bagder added support for --cc to output the compiler name. This makes it pos…
authored
76 --cc)
df3ca59 @bagder Dan Fandrich:
authored
77 echo "@CC@"
6e9d161 @bagder added support for --cc to output the compiler name. This makes it pos…
authored
78 ;;
79
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
80 --prefix)
df3ca59 @bagder Dan Fandrich:
authored
81 echo "$prefix"
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
82 ;;
83
2a6ea6d @bagder David Shaw added --protocols, and thus the --feature no longer mentio…
authored
84 --feature|--features)
9813cea @dfandrich Fixed curl-config when no features are enabled.
dfandrich authored
85 for feature in @SUPPORT_FEATURES@ ""; do
86 test -n "$feature" && echo "$feature"
bbc002a @bagder - Keith Mok added supported_protocols and supported_features to the p…
authored
87 done
2a6ea6d @bagder David Shaw added --protocols, and thus the --feature no longer mentio…
authored
88 ;;
89
90 --protocols)
bbc002a @bagder - Keith Mok added supported_protocols and supported_features to the p…
authored
91 for protocol in @SUPPORT_PROTOCOLS@; do
cc0054a @yangtse remove extra semicolon from curl-config.in
yangtse authored
92 echo "$protocol"
bbc002a @bagder - Keith Mok added supported_protocols and supported_features to the p…
authored
93 done
1ee7f92 @bagder configure sets variables that curl-config uses to display what features
authored
94 ;;
a131285 @bagder curl-config: --built-shared returns shared info
authored
95
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
96 --version)
82ecc85 @bagder curl-config: fix --version
authored
97 echo libcurl @CURLVERSION@
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
98 exit 0
99 ;;
100
6ca627a @bagder curl-config got a --checkfor option
authored
101 --checkfor)
102 checkfor=$2
103 cmajor=`echo $checkfor | cut -d. -f1`
104 cminor=`echo $checkfor | cut -d. -f2`
105 # when extracting the patch part we strip off everything after a
106 # dash as that's used for things like version 1.2.3-CVS
107 cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
108 checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
109 numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'`
110 nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
111
112 if test "$nownum" -ge "$checknum"; then
113 # silent success
114 exit 0
115 else
2d1b624 @bagder curl-config: fix version output
authored
116 echo "requested version $checkfor is newer than existing @CURLVERSION@"
6ca627a @bagder curl-config got a --checkfor option
authored
117 exit 1
118 fi
119 ;;
120
1e5e0f9 @bagder added 'curl-config --vernum' for hardcore hex version output
authored
121 --vernum)
122 echo @VERSIONNUM@
123 exit 0
124 ;;
125
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
126 --help)
127 usage 0
128 ;;
129
130 --cflags)
b0fbb98 @bagder Markus Oberhumer fixed the -cflags option
authored
131 if test "X@includedir@" = "X/usr/include"; then
132 echo ""
133 else
134 echo "-I@includedir@"
135 fi
d9e54a3 @bagder Added --include to set the compiler include flag for libcurl
authored
136 ;;
137
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
138 --libs)
8df7e0b @bagder Michal Marek made curl-config --libs not include /usr/lib64 in the ou…
authored
139 if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then
c5e7d83 @dfandrich Don't bother adding a library path of /usr/lib in curl-config --libs
dfandrich authored
140 CURLLIBDIR="-L@libdir@ "
141 else
142 CURLLIBDIR=""
143 fi
9de4e5e @dfandrich Fixed the problem of curl-config --libs specifying unneeded libraries
dfandrich authored
144 if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then
4ee2df4 @falconindy curl-config: only provide libraries with --libs
falconindy authored
145 echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@ @LIBS@
9de4e5e @dfandrich Fixed the problem of curl-config --libs specifying unneeded libraries
dfandrich authored
146 else
4ee2df4 @falconindy curl-config: only provide libraries with --libs
falconindy authored
147 echo ${CURLLIBDIR}-lcurl @LIBS@
9de4e5e @dfandrich Fixed the problem of curl-config --libs specifying unneeded libraries
dfandrich authored
148 fi
149 ;;
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
150
faaaf62 @dfandrich Added the --static-libs option to curl-config
dfandrich authored
151 --static-libs)
152 echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@
153 ;;
154
f7f76e1 @claesjac Added '--configure' option to curl-config to display original configu…
claesjac authored
155 --configure)
156 echo @CONFIGURE_OPTIONS@
157 ;;
158
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
159 *)
861ca06 @bagder removed --include again and stuffed the libcurl's include path in --c…
authored
160 echo "unknown option: $1"
2a6ea6d @bagder David Shaw added --protocols, and thus the --feature no longer mentio…
authored
161 usage 1
fb1ce5f @bagder tiny tool for outputting curl config variables
authored
162 ;;
163 esac
164 shift
165 done
166
167 exit 0
Something went wrong with that request. Please try again.