Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | #*************************************************************************** |
| 3 | # _ _ ____ _ |
| 4 | # Project ___| | | | _ \| | |
| 5 | # / __| | | | |_) | | |
| 6 | # | (__| |_| | _ <| |___ |
| 7 | # \___|\___/|_| \_\_____| |
| 8 | # |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 9 | # Copyright (C) 2001 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 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 |
Alex Deymo | 8f1a214 | 2016-06-28 14:49:26 -0700 | [diff] [blame] | 13 | # are also available at https://curl.haxx.se/docs/copyright.html. |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 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 | ########################################################################### |
| 23 | |
| 24 | prefix=@prefix@ |
| 25 | exec_prefix=@exec_prefix@ |
| 26 | includedir=@includedir@ |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 27 | cppflag_curl_staticlib=@CPPFLAG_CURL_STATICLIB@ |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 28 | |
| 29 | usage() |
| 30 | { |
| 31 | cat <<EOF |
| 32 | Usage: curl-config [OPTION] |
| 33 | |
| 34 | Available 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 |
| 47 | --static-libs static libcurl library linking information |
| 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 | --built-shared) |
| 70 | echo @ENABLE_SHARED@ |
| 71 | ;; |
| 72 | |
| 73 | --ca) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 74 | echo @CURL_CA_BUNDLE@ |
| 75 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 76 | |
| 77 | --cc) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 78 | echo "@CC@" |
| 79 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 80 | |
| 81 | --prefix) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 82 | echo "$prefix" |
| 83 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 84 | |
| 85 | --feature|--features) |
| 86 | for feature in @SUPPORT_FEATURES@ ""; do |
| 87 | test -n "$feature" && echo "$feature" |
| 88 | done |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 89 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 90 | |
| 91 | --protocols) |
| 92 | for protocol in @SUPPORT_PROTOCOLS@; do |
| 93 | echo "$protocol" |
| 94 | done |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 95 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 96 | |
| 97 | --version) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 98 | echo libcurl @CURLVERSION@ |
| 99 | exit 0 |
| 100 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 101 | |
| 102 | --checkfor) |
| 103 | checkfor=$2 |
| 104 | cmajor=`echo $checkfor | cut -d. -f1` |
| 105 | cminor=`echo $checkfor | cut -d. -f2` |
| 106 | # when extracting the patch part we strip off everything after a |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 107 | # dash as that's used for things like version 1.2.3-CVS |
| 108 | cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1` |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 109 | checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc` |
| 110 | numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'` |
| 111 | nownum=`echo "obase=10; ibase=16; $numuppercase" | bc` |
| 112 | |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 113 | if test "$nownum" -ge "$checknum"; then |
| 114 | # silent success |
| 115 | exit 0 |
| 116 | else |
| 117 | echo "requested version $checkfor is newer than existing @CURLVERSION@" |
| 118 | exit 1 |
| 119 | fi |
| 120 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 121 | |
| 122 | --vernum) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 123 | echo @VERSIONNUM@ |
| 124 | exit 0 |
| 125 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 126 | |
| 127 | --help) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 128 | usage 0 |
| 129 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 130 | |
| 131 | --cflags) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 132 | if test "X$cppflag_curl_staticlib" = "X-DCURL_STATICLIB"; then |
| 133 | CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB " |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 134 | else |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 135 | CPPFLAG_CURL_STATICLIB="" |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 136 | fi |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 137 | if test "X@includedir@" = "X/usr/include"; then |
| 138 | echo "$CPPFLAG_CURL_STATICLIB" |
| 139 | else |
| 140 | echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@" |
| 141 | fi |
| 142 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 143 | |
| 144 | --libs) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 145 | if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then |
| 146 | CURLLIBDIR="-L@libdir@ " |
| 147 | else |
| 148 | CURLLIBDIR="" |
| 149 | fi |
| 150 | if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then |
| 151 | echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@ |
| 152 | else |
| 153 | echo ${CURLLIBDIR}-lcurl |
| 154 | fi |
| 155 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 156 | |
| 157 | --static-libs) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 158 | if test "X@ENABLE_STATIC@" != "Xno" ; then |
| 159 | echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@ |
| 160 | else |
| 161 | echo "curl was built with static libraries disabled" >&2 |
| 162 | exit 1 |
| 163 | fi |
| 164 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 165 | |
| 166 | --configure) |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 167 | echo @CONFIGURE_OPTIONS@ |
| 168 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 169 | |
| 170 | *) |
| 171 | echo "unknown option: $1" |
Bertrand SIMONNET | e6cd738 | 2015-07-01 15:39:44 -0700 | [diff] [blame] | 172 | usage 1 |
| 173 | ;; |
Lucas Eckels | 9bd90e6 | 2012-08-06 15:07:02 -0700 | [diff] [blame] | 174 | esac |
| 175 | shift |
| 176 | done |
| 177 | |
| 178 | exit 0 |