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 26prefix="@prefix@" 27# Used in @libdir@ 28# shellcheck disable=SC2034 29exec_prefix=@exec_prefix@ 30# shellcheck disable=SC2034 31includedir=@includedir@ 32cppflag_curl_staticlib=@CPPFLAG_CURL_STATICLIB@ 33 34usage() 35{ 36 cat <<EOF 37Usage: curl-config [OPTION] 38 39Available values for OPTION include: 40 41 --built-shared says 'yes' if libcurl was built shared 42 --ca CA bundle install path 43 --cc compiler 44 --cflags preprocessor and compiler flags 45 --checkfor [version] check for (lib)curl of the specified version 46 --configure the arguments given to configure when building curl 47 --features newline separated list of enabled features 48 --help display this help and exit 49 --libs library linking information 50 --prefix curl install prefix 51 --protocols newline separated list of enabled protocols 52 --ssl-backends output the SSL backends libcurl was built to support 53 --static-libs static libcurl library linking information 54 --version output version information 55 --vernum output version as a hexadecimal number 56EOF 57 58 exit "$1" 59} 60 61if test "$#" -eq 0; then 62 usage 1 63fi 64 65while test "$#" -gt 0; do 66 case "$1" in 67 --built-shared) 68 echo '@ENABLE_SHARED@' 69 ;; 70 71 --ca) 72 echo '@CURL_CA_BUNDLE@' 73 ;; 74 75 --cc) 76 echo '@CC@' 77 ;; 78 79 --prefix) 80 echo "$prefix" 81 ;; 82 83 --feature|--features) 84 for feature in @SUPPORT_FEATURES@ ""; do 85 test -n "$feature" && echo "$feature" 86 done 87 ;; 88 89 --protocols) 90 # shellcheck disable=SC2043 91 for protocol in @SUPPORT_PROTOCOLS@; do 92 echo "$protocol" 93 done 94 ;; 95 96 --version) 97 echo 'libcurl @CURLVERSION@' 98 exit 0 99 ;; 100 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-pre1 107 cpatch=$(echo "$checkfor" | cut -d. -f3 | cut -d- -f1) 108 109 vmajor=$(echo '@CURLVERSION@' | cut -d. -f1) 110 vminor=$(echo '@CURLVERSION@' | cut -d. -f2) 111 # when extracting the patch part we strip off everything after a 112 # dash as that's used for things like version 1.2.3-pre1 113 vpatch=$(echo '@CURLVERSION@' | cut -d. -f3 | cut -d- -f1) 114 115 if test "$vmajor" -gt "$cmajor"; then 116 exit 0 117 fi 118 if test "$vmajor" -eq "$cmajor"; then 119 if test "$vminor" -gt "$cminor"; then 120 exit 0 121 fi 122 if test "$vminor" -eq "$cminor"; then 123 if test "$cpatch" -le "$vpatch"; then 124 exit 0 125 fi 126 fi 127 fi 128 129 echo "requested version $checkfor is newer than existing @CURLVERSION@" 130 exit 1 131 ;; 132 133 --vernum) 134 echo '@VERSIONNUM@' 135 exit 0 136 ;; 137 138 --help) 139 usage 0 140 ;; 141 142 --cflags) 143 if test "X$cppflag_curl_staticlib" = "X-DCURL_STATICLIB"; then 144 CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB " 145 else 146 CPPFLAG_CURL_STATICLIB="" 147 fi 148 if test "X@includedir@" = "X/usr/include"; then 149 echo "${CPPFLAG_CURL_STATICLIB}" 150 else 151 echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@" 152 fi 153 ;; 154 155 --libs) 156 if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then 157 CURLLIBDIR="-L@libdir@ " 158 else 159 CURLLIBDIR="" 160 fi 161 if test "X@ENABLE_SHARED@" = "Xno"; then 162 echo "${CURLLIBDIR}-lcurl @LIBCURL_LIBS@" 163 else 164 echo "${CURLLIBDIR}-lcurl" 165 fi 166 ;; 167 168 --ssl-backends) 169 echo '@SSL_BACKENDS@' 170 ;; 171 172 --static-libs) 173 if test "X@ENABLE_STATIC@" != "Xno" ; then 174 echo "@libdir@/libcurl.@libext@" @LDFLAGS@ @LIBCURL_LIBS@ 175 else 176 echo 'curl was built with static libraries disabled' >&2 177 exit 1 178 fi 179 ;; 180 181 --configure) 182 echo @CONFIGURE_OPTIONS@ 183 ;; 184 185 *) 186 echo "unknown option: $1" 187 usage 1 188 ;; 189 esac 190 shift 191done 192 193exit 0 194