| 1 | #! /bin/sh |
|---|
| 2 | #*************************************************************************** |
|---|
| 3 | # _ _ ____ _ |
|---|
| 4 | # Project ___| | | | _ \| | |
|---|
| 5 | # / __| | | | |_) | | |
|---|
| 6 | # | (__| |_| | _ <| |___ |
|---|
| 7 | # \___|\___/|_| \_\_____| |
|---|
| 8 | # |
|---|
| 9 | # Copyright (C) 2001 - 2010, 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 | |
|---|
| 24 | prefix=/opt/local |
|---|
| 25 | exec_prefix=${prefix} |
|---|
| 26 | includedir=${prefix}/include |
|---|
| 27 | |
|---|
| 28 | usage() |
|---|
| 29 | { |
|---|
| 30 | cat <<EOF |
|---|
| 31 | Usage: curl-config [OPTION] |
|---|
| 32 | |
|---|
| 33 | Available values for OPTION include: |
|---|
| 34 | |
|---|
| 35 | --built-shared says 'yes' if libcurl was built shared |
|---|
| 36 | --ca ca bundle install path |
|---|
| 37 | --cc compiler |
|---|
| 38 | --cflags pre-processor and compiler flags |
|---|
| 39 | --checkfor [version] check for (lib)curl of the specified version |
|---|
| 40 | --configure the arguments given to configure when building curl |
|---|
| 41 | --features newline separated list of enabled features |
|---|
| 42 | --help display this help and exit |
|---|
| 43 | --libs library linking information |
|---|
| 44 | --prefix curl install prefix |
|---|
| 45 | --protocols newline separated list of enabled protocols |
|---|
| 46 | --static-libs static libcurl library linking information |
|---|
| 47 | --version output version information |
|---|
| 48 | --vernum output the version information as a number (hexadecimal) |
|---|
| 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 |
|---|
| 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= ;; |
|---|
| 65 | esac |
|---|
| 66 | |
|---|
| 67 | case "$1" in |
|---|
| 68 | --built-shared) |
|---|
| 69 | echo yes |
|---|
| 70 | ;; |
|---|
| 71 | |
|---|
| 72 | --ca) |
|---|
| 73 | echo ""/opt/local/share/curl/curl-ca-bundle.crt"" |
|---|
| 74 | ;; |
|---|
| 75 | |
|---|
| 76 | --cc) |
|---|
| 77 | echo "/usr/bin/gcc-4.0" |
|---|
| 78 | ;; |
|---|
| 79 | |
|---|
| 80 | --prefix) |
|---|
| 81 | echo "$prefix" |
|---|
| 82 | ;; |
|---|
| 83 | |
|---|
| 84 | --feature|--features) |
|---|
| 85 | for feature in SSL IPv6 libz IDN NTLM ""; do |
|---|
| 86 | test -n "$feature" && echo "$feature" |
|---|
| 87 | done |
|---|
| 88 | ;; |
|---|
| 89 | |
|---|
| 90 | --protocols) |
|---|
| 91 | for protocol in DICT FILE FTP FTPS HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP; do |
|---|
| 92 | echo "$protocol" |
|---|
| 93 | done |
|---|
| 94 | ;; |
|---|
| 95 | |
|---|
| 96 | --version) |
|---|
| 97 | echo libcurl 7.21.1 |
|---|
| 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-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 071501 | 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 |
|---|
| 116 | echo "requested version $checkfor is newer than existing 7.21.1" |
|---|
| 117 | exit 1 |
|---|
| 118 | fi |
|---|
| 119 | ;; |
|---|
| 120 | |
|---|
| 121 | --vernum) |
|---|
| 122 | echo 071501 |
|---|
| 123 | exit 0 |
|---|
| 124 | ;; |
|---|
| 125 | |
|---|
| 126 | --help) |
|---|
| 127 | usage 0 |
|---|
| 128 | ;; |
|---|
| 129 | |
|---|
| 130 | --cflags) |
|---|
| 131 | if test "X${prefix}/include" = "X/usr/include"; then |
|---|
| 132 | echo "" |
|---|
| 133 | else |
|---|
| 134 | echo "-I${prefix}/include" |
|---|
| 135 | fi |
|---|
| 136 | ;; |
|---|
| 137 | |
|---|
| 138 | --libs) |
|---|
| 139 | if test "X${exec_prefix}/lib" != "X/usr/lib" -a "X${exec_prefix}/lib" != "X/usr/lib64"; then |
|---|
| 140 | CURLLIBDIR="-L${exec_prefix}/lib " |
|---|
| 141 | else |
|---|
| 142 | CURLLIBDIR="" |
|---|
| 143 | fi |
|---|
| 144 | if test "Xyes" = "Xyes"; then |
|---|
| 145 | echo ${CURLLIBDIR}-lcurl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lidn -lssl -lcrypto -lssl -lcrypto -lz -lz |
|---|
| 146 | else |
|---|
| 147 | echo ${CURLLIBDIR}-lcurl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib |
|---|
| 148 | fi |
|---|
| 149 | ;; |
|---|
| 150 | |
|---|
| 151 | --static-libs) |
|---|
| 152 | echo ${exec_prefix}/lib/libcurl.a -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lidn -lssl -lcrypto -lssl -lcrypto -lz -lz |
|---|
| 153 | ;; |
|---|
| 154 | |
|---|
| 155 | --configure) |
|---|
| 156 | 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' '--disable-dependency-tracking' '--with-ca-bundle=/opt/local/share/curl/curl-ca-bundle.crt' '--host=powerpc-apple-darwin9.8.0' 'host_alias=powerpc-apple-darwin9.8.0' 'CC=/usr/bin/gcc-4.0' 'CFLAGS=-O2 ' 'LDFLAGS=-L/opt/local/lib ' 'CPPFLAGS=-I/opt/local/include'" |
|---|
| 157 | ;; |
|---|
| 158 | |
|---|
| 159 | *) |
|---|
| 160 | echo "unknown option: $1" |
|---|
| 161 | usage 1 |
|---|
| 162 | ;; |
|---|
| 163 | esac |
|---|
| 164 | shift |
|---|
| 165 | done |
|---|
| 166 | |
|---|
| 167 | exit 0 |
|---|