113498266Sopenharmony_ci#! /bin/sh
213498266Sopenharmony_ci#***************************************************************************
313498266Sopenharmony_ci#                                  _   _ ____  _
413498266Sopenharmony_ci#  Project                     ___| | | |  _ \| |
513498266Sopenharmony_ci#                             / __| | | | |_) | |
613498266Sopenharmony_ci#                            | (__| |_| |  _ <| |___
713498266Sopenharmony_ci#                             \___|\___/|_| \_\_____|
813498266Sopenharmony_ci#
913498266Sopenharmony_ci# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
1013498266Sopenharmony_ci#
1113498266Sopenharmony_ci# This software is licensed as described in the file COPYING, which
1213498266Sopenharmony_ci# you should have received as part of this distribution. The terms
1313498266Sopenharmony_ci# are also available at https://curl.se/docs/copyright.html.
1413498266Sopenharmony_ci#
1513498266Sopenharmony_ci# You may opt to use, copy, modify, merge, publish, distribute and/or sell
1613498266Sopenharmony_ci# copies of the Software, and permit persons to whom the Software is
1713498266Sopenharmony_ci# furnished to do so, under the terms of the COPYING file.
1813498266Sopenharmony_ci#
1913498266Sopenharmony_ci# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
2013498266Sopenharmony_ci# KIND, either express or implied.
2113498266Sopenharmony_ci#
2213498266Sopenharmony_ci# SPDX-License-Identifier: curl
2313498266Sopenharmony_ci#
2413498266Sopenharmony_ci###########################################################################
2513498266Sopenharmony_ci
2613498266Sopenharmony_ciprefix="@prefix@"
2713498266Sopenharmony_ciexec_prefix=@exec_prefix@
2813498266Sopenharmony_ciincludedir=@includedir@
2913498266Sopenharmony_cicppflag_curl_staticlib=@CPPFLAG_CURL_STATICLIB@
3013498266Sopenharmony_ci
3113498266Sopenharmony_ciusage()
3213498266Sopenharmony_ci{
3313498266Sopenharmony_ci    cat <<EOF
3413498266Sopenharmony_ciUsage: curl-config [OPTION]
3513498266Sopenharmony_ci
3613498266Sopenharmony_ciAvailable values for OPTION include:
3713498266Sopenharmony_ci
3813498266Sopenharmony_ci  --built-shared says 'yes' if libcurl was built shared
3913498266Sopenharmony_ci  --ca        ca bundle install path
4013498266Sopenharmony_ci  --cc        compiler
4113498266Sopenharmony_ci  --cflags    pre-processor and compiler flags
4213498266Sopenharmony_ci  --checkfor [version] check for (lib)curl of the specified version
4313498266Sopenharmony_ci  --configure the arguments given to configure when building curl
4413498266Sopenharmony_ci  --features  newline separated list of enabled features
4513498266Sopenharmony_ci  --help      display this help and exit
4613498266Sopenharmony_ci  --libs      library linking information
4713498266Sopenharmony_ci  --prefix    curl install prefix
4813498266Sopenharmony_ci  --protocols newline separated list of enabled protocols
4913498266Sopenharmony_ci  --ssl-backends output the SSL backends libcurl was built to support
5013498266Sopenharmony_ci  --static-libs static libcurl library linking information
5113498266Sopenharmony_ci  --version   output version information
5213498266Sopenharmony_ci  --vernum    output the version information as a number (hexadecimal)
5313498266Sopenharmony_ciEOF
5413498266Sopenharmony_ci
5513498266Sopenharmony_ci    exit $1
5613498266Sopenharmony_ci}
5713498266Sopenharmony_ci
5813498266Sopenharmony_ciif test $# -eq 0; then
5913498266Sopenharmony_ci    usage 1
6013498266Sopenharmony_cifi
6113498266Sopenharmony_ci
6213498266Sopenharmony_ciwhile test $# -gt 0; do
6313498266Sopenharmony_ci    case "$1" in
6413498266Sopenharmony_ci    # this deals with options in the style
6513498266Sopenharmony_ci    # --option=value and extracts the value part
6613498266Sopenharmony_ci    # [not currently used]
6713498266Sopenharmony_ci    -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
6813498266Sopenharmony_ci    *) value= ;;
6913498266Sopenharmony_ci    esac
7013498266Sopenharmony_ci
7113498266Sopenharmony_ci    case "$1" in
7213498266Sopenharmony_ci    --built-shared)
7313498266Sopenharmony_ci        echo @ENABLE_SHARED@
7413498266Sopenharmony_ci        ;;
7513498266Sopenharmony_ci
7613498266Sopenharmony_ci    --ca)
7713498266Sopenharmony_ci        echo @CURL_CA_BUNDLE@
7813498266Sopenharmony_ci        ;;
7913498266Sopenharmony_ci
8013498266Sopenharmony_ci    --cc)
8113498266Sopenharmony_ci        echo "@CC@"
8213498266Sopenharmony_ci        ;;
8313498266Sopenharmony_ci
8413498266Sopenharmony_ci    --prefix)
8513498266Sopenharmony_ci        echo "$prefix"
8613498266Sopenharmony_ci        ;;
8713498266Sopenharmony_ci
8813498266Sopenharmony_ci    --feature|--features)
8913498266Sopenharmony_ci        for feature in @SUPPORT_FEATURES@ ""; do
9013498266Sopenharmony_ci            test -n "$feature" && echo "$feature"
9113498266Sopenharmony_ci        done
9213498266Sopenharmony_ci        ;;
9313498266Sopenharmony_ci
9413498266Sopenharmony_ci    --protocols)
9513498266Sopenharmony_ci        for protocol in @SUPPORT_PROTOCOLS@; do
9613498266Sopenharmony_ci            echo "$protocol"
9713498266Sopenharmony_ci        done
9813498266Sopenharmony_ci        ;;
9913498266Sopenharmony_ci
10013498266Sopenharmony_ci    --version)
10113498266Sopenharmony_ci        echo libcurl @CURLVERSION@
10213498266Sopenharmony_ci        exit 0
10313498266Sopenharmony_ci        ;;
10413498266Sopenharmony_ci
10513498266Sopenharmony_ci    --checkfor)
10613498266Sopenharmony_ci        checkfor=$2
10713498266Sopenharmony_ci        cmajor=`echo $checkfor | cut -d. -f1`
10813498266Sopenharmony_ci        cminor=`echo $checkfor | cut -d. -f2`
10913498266Sopenharmony_ci        # when extracting the patch part we strip off everything after a
11013498266Sopenharmony_ci        # dash as that's used for things like version 1.2.3-CVS
11113498266Sopenharmony_ci        cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
11213498266Sopenharmony_ci
11313498266Sopenharmony_ci        vmajor=`echo @CURLVERSION@ | cut -d. -f1`
11413498266Sopenharmony_ci        vminor=`echo @CURLVERSION@ | cut -d. -f2`
11513498266Sopenharmony_ci        # when extracting the patch part we strip off everything after a
11613498266Sopenharmony_ci        # dash as that's used for things like version 1.2.3-CVS
11713498266Sopenharmony_ci        vpatch=`echo @CURLVERSION@ | cut -d. -f3 | cut -d- -f1`
11813498266Sopenharmony_ci
11913498266Sopenharmony_ci        if test "$vmajor" -gt "$cmajor"; then
12013498266Sopenharmony_ci            exit 0;
12113498266Sopenharmony_ci        fi
12213498266Sopenharmony_ci        if test "$vmajor" -eq "$cmajor"; then
12313498266Sopenharmony_ci            if test "$vminor" -gt "$cminor"; then
12413498266Sopenharmony_ci                exit 0
12513498266Sopenharmony_ci            fi
12613498266Sopenharmony_ci            if test "$vminor" -eq "$cminor"; then
12713498266Sopenharmony_ci                if test "$cpatch" -le "$vpatch"; then
12813498266Sopenharmony_ci                    exit 0
12913498266Sopenharmony_ci                fi
13013498266Sopenharmony_ci            fi
13113498266Sopenharmony_ci        fi
13213498266Sopenharmony_ci
13313498266Sopenharmony_ci        echo "requested version $checkfor is newer than existing @CURLVERSION@"
13413498266Sopenharmony_ci        exit 1
13513498266Sopenharmony_ci        ;;
13613498266Sopenharmony_ci
13713498266Sopenharmony_ci    --vernum)
13813498266Sopenharmony_ci        echo @VERSIONNUM@
13913498266Sopenharmony_ci        exit 0
14013498266Sopenharmony_ci        ;;
14113498266Sopenharmony_ci
14213498266Sopenharmony_ci    --help)
14313498266Sopenharmony_ci        usage 0
14413498266Sopenharmony_ci        ;;
14513498266Sopenharmony_ci
14613498266Sopenharmony_ci    --cflags)
14713498266Sopenharmony_ci        if test "X$cppflag_curl_staticlib" = "X-DCURL_STATICLIB"; then
14813498266Sopenharmony_ci          CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB "
14913498266Sopenharmony_ci        else
15013498266Sopenharmony_ci          CPPFLAG_CURL_STATICLIB=""
15113498266Sopenharmony_ci        fi
15213498266Sopenharmony_ci        if test "X@includedir@" = "X/usr/include"; then
15313498266Sopenharmony_ci          echo "$CPPFLAG_CURL_STATICLIB"
15413498266Sopenharmony_ci        else
15513498266Sopenharmony_ci          echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@"
15613498266Sopenharmony_ci        fi
15713498266Sopenharmony_ci        ;;
15813498266Sopenharmony_ci
15913498266Sopenharmony_ci    --libs)
16013498266Sopenharmony_ci        if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then
16113498266Sopenharmony_ci           CURLLIBDIR="-L@libdir@ "
16213498266Sopenharmony_ci        else
16313498266Sopenharmony_ci           CURLLIBDIR=""
16413498266Sopenharmony_ci        fi
16513498266Sopenharmony_ci        if test "X@ENABLE_SHARED@" = "Xno"; then
16613498266Sopenharmony_ci          echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@
16713498266Sopenharmony_ci        else
16813498266Sopenharmony_ci          echo ${CURLLIBDIR}-lcurl
16913498266Sopenharmony_ci        fi
17013498266Sopenharmony_ci        ;;
17113498266Sopenharmony_ci    --ssl-backends)
17213498266Sopenharmony_ci        echo "@SSL_BACKENDS@"
17313498266Sopenharmony_ci        ;;
17413498266Sopenharmony_ci
17513498266Sopenharmony_ci    --static-libs)
17613498266Sopenharmony_ci        if test "X@ENABLE_STATIC@" != "Xno" ; then
17713498266Sopenharmony_ci          echo "@libdir@/libcurl.@libext@" @LDFLAGS@ @LIBCURL_LIBS@
17813498266Sopenharmony_ci        else
17913498266Sopenharmony_ci          echo "curl was built with static libraries disabled" >&2
18013498266Sopenharmony_ci          exit 1
18113498266Sopenharmony_ci        fi
18213498266Sopenharmony_ci        ;;
18313498266Sopenharmony_ci
18413498266Sopenharmony_ci    --configure)
18513498266Sopenharmony_ci        echo @CONFIGURE_OPTIONS@
18613498266Sopenharmony_ci        ;;
18713498266Sopenharmony_ci
18813498266Sopenharmony_ci    *)
18913498266Sopenharmony_ci        echo "unknown option: $1"
19013498266Sopenharmony_ci        usage 1
19113498266Sopenharmony_ci        ;;
19213498266Sopenharmony_ci    esac
19313498266Sopenharmony_ci    shift
19413498266Sopenharmony_cidone
19513498266Sopenharmony_ci
19613498266Sopenharmony_ciexit 0
197