Ticket #26045: curl-config

File curl-config, 4.4 KB (added by mcl_guard-netmail@…, 14 years ago)

destroot-i386 curl-config

Line 
1#! /bin/sh
2#***************************************************************************
3#                                  _   _ ____  _
4#  Project                     ___| | | |  _ \| |
5#                             / __| | | | |_) | |
6#                            | (__| |_| |  _ <| |___
7#                             \___|\___/|_| \_\_____|
8#
9# Copyright (C) 2001 - 2009, 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 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.
21#
22###########################################################################
23
24prefix=/opt/local
25exec_prefix=${prefix}
26includedir=${prefix}/include
27
28usage()
29{
30    cat <<EOF
31Usage: curl-config [OPTION]
32
33Available values for OPTION include:
34
35  --ca        ca bundle install path
36  --cc        compiler
37  --cflags    pre-processor and compiler flags
38  --checkfor [version] check for (lib)curl of the specified version
39  --configure the arguments given to configure when building curl
40  --features  newline separated list of enabled features
41  --help      display this help and exit
42  --libs      library linking information
43  --prefix    curl install prefix
44  --protocols newline separated list of enabled protocols
45  --static-libs static libcurl library linking information
46  --version   output version information
47  --vernum    output the version information as a number (hexadecimal)
48EOF
49
50    exit $1
51}
52
53if test $# -eq 0; then
54    usage 1
55fi
56
57while test $# -gt 0; do
58    case "$1" in
59    # this deals with options in the style
60    # --option=value and extracts the value part
61    # [not currently used]
62    -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
63    *) value= ;;
64    esac
65
66    case "$1" in
67    --ca)
68        echo ""/opt/local/share/curl/curl-ca-bundle.crt""
69        ;;
70
71    --cc)
72        echo "/usr/bin/gcc-4.2"
73        ;;
74
75    --prefix)
76        echo "$prefix"
77        ;;
78
79    --feature|--features)
80        for feature in SSL IPv6 libz IDN NTLM ""; do
81            test -n "$feature" && echo "$feature"
82        done
83        ;;
84
85    --protocols)
86        for protocol in DICT FILE FTP FTPS HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP; do
87            echo "$protocol"
88        done
89        ;;
90    --version)
91        echo libcurl 7.21.0
92        exit 0
93        ;;
94
95    --checkfor)
96        checkfor=$2
97        cmajor=`echo $checkfor | cut -d. -f1`
98        cminor=`echo $checkfor | cut -d. -f2`
99        # when extracting the patch part we strip off everything after a
100        # dash as that's used for things like version 1.2.3-CVS
101        cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
102        checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
103        numuppercase=`echo 071500 | tr 'a-f' 'A-F'`
104        nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
105
106        if test "$nownum" -ge "$checknum"; then
107          # silent success
108          exit 0
109        else
110          echo "requested version $checkfor is newer than existing 7.21.0"
111          exit 1
112        fi
113        ;;
114
115    --vernum)
116        echo 071500
117        exit 0
118        ;;
119
120    --help)
121        usage 0
122        ;;
123
124    --cflags)
125        if test "X${prefix}/include" = "X/usr/include"; then
126          echo ""
127        else
128          echo "-I${prefix}/include"
129        fi
130        ;;
131
132    --libs)
133        if test "X${exec_prefix}/lib" != "X/usr/lib" -a "X${exec_prefix}/lib" != "X/usr/lib64"; then
134           CURLLIBDIR="-L${exec_prefix}/lib "
135        else
136           CURLLIBDIR=""
137        fi
138        if test "Xyes" = "Xyes"; then
139          echo ${CURLLIBDIR}-lcurl -L/opt/local/lib -lidn -lssl -lcrypto -lz
140        else
141          echo ${CURLLIBDIR}-lcurl -L/opt/local/lib
142        fi
143        ;;
144
145    --static-libs)
146        echo ${exec_prefix}/lib/libcurl.a -L/opt/local/lib -lidn -lssl -lcrypto -lz
147        ;;
148
149    --configure)
150      echo " '--prefix=/opt/local' '--enable-ipv6' '--without-gnutls' '--without-gssapi' '--without-libssh2' '--without-spnego' '--with-ssl' '--disable-ares' '--disable-ldap' '--disable-ldaps' '--with-libidn' '--with-zlib=/opt/local' '--with-random=/dev/urandom' '--disable-dependency-tracking' '--with-ca-bundle=/opt/local/share/curl/curl-ca-bundle.crt' 'CC=/usr/bin/gcc-4.2' 'CFLAGS=-O2 ' 'LDFLAGS=-L/opt/local/lib ' 'CPPFLAGS=-I/opt/local/include'"
151    ;;
152
153    *)
154        echo "unknown option: $1"
155        usage 1
156        ;;
157    esac
158    shift
159done
160
161exit 0