curl-config.in 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. #! /bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2001 - 2008, Daniel Stenberg, <[email protected]>, 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. # $Id$
  23. ###########################################################################
  24. #
  25. # The idea to this kind of setup info script was stolen from numerous
  26. # other packages, such as neon, libxml and gnome.
  27. #
  28. prefix=@prefix@
  29. exec_prefix=@exec_prefix@
  30. includedir=@includedir@
  31. usage()
  32. {
  33. cat <<EOF
  34. Usage: curl-config [OPTION]
  35. Available values for OPTION include:
  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. --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)
  48. EOF
  49. exit $1
  50. }
  51. if test $# -eq 0; then
  52. usage 1
  53. fi
  54. while test $# -gt 0; do
  55. case "$1" in
  56. # this deals with options in the style
  57. # --option=value and extracts the value part
  58. # [not currently used]
  59. -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  60. *) value= ;;
  61. esac
  62. case "$1" in
  63. --ca)
  64. echo "@CURL_CA_BUNDLE@"
  65. ;;
  66. --cc)
  67. echo "@CC@"
  68. ;;
  69. --prefix)
  70. echo "$prefix"
  71. ;;
  72. --feature|--features)
  73. if test "@USE_SSLEAY@" = "1"; then
  74. echo "SSL"
  75. NTLM=1 # OpenSSL implies NTLM
  76. elif test -n "@SSL_ENABLED@"; then
  77. echo "SSL"
  78. fi
  79. if test "@KRB4_ENABLED@" = "1"; then
  80. echo "KRB4"
  81. fi
  82. if test "@IPV6_ENABLED@" = "1"; then
  83. echo "IPv6"
  84. fi
  85. if test "@HAVE_LIBZ@" = "1"; then
  86. echo "libz"
  87. fi
  88. if test "@HAVE_ARES@" = "1"; then
  89. echo "AsynchDNS"
  90. fi
  91. if test "@IDN_ENABLED@" = "1"; then
  92. echo "IDN"
  93. fi
  94. if test "@USE_WINDOWS_SSPI@" = "1"; then
  95. echo "SSPI"
  96. NTLM=1
  97. fi
  98. if test "$NTLM" = "1"; then
  99. echo "NTLM"
  100. fi
  101. ;;
  102. --protocols)
  103. if test "@CURL_DISABLE_HTTP@" != "1"; then
  104. echo "HTTP"
  105. if test "@SSL_ENABLED@" = "1"; then
  106. echo "HTTPS"
  107. fi
  108. fi
  109. if test "@CURL_DISABLE_FTP@" != "1"; then
  110. echo "FTP"
  111. if test "@SSL_ENABLED@" = "1"; then
  112. echo "FTPS"
  113. fi
  114. fi
  115. if test "@CURL_DISABLE_FILE@" != "1"; then
  116. echo "FILE"
  117. fi
  118. if test "@CURL_DISABLE_TELNET@" != "1"; then
  119. echo "TELNET"
  120. fi
  121. if test "@CURL_DISABLE_LDAP@" != "1"; then
  122. echo "LDAP"
  123. fi
  124. if test "@CURL_DISABLE_LDAPS@" != "1"; then
  125. echo "LDAPS"
  126. fi
  127. if test "@CURL_DISABLE_DICT@" != "1"; then
  128. echo "DICT"
  129. fi
  130. if test "@CURL_DISABLE_TFTP@" != "1"; then
  131. echo "TFTP"
  132. fi
  133. if test "@USE_LIBSSH2@" = "1"; then
  134. echo "SCP"
  135. echo "SFTP"
  136. fi
  137. ;;
  138. --version)
  139. echo libcurl @VERSION@
  140. exit 0
  141. ;;
  142. --checkfor)
  143. checkfor=$2
  144. cmajor=`echo $checkfor | cut -d. -f1`
  145. cminor=`echo $checkfor | cut -d. -f2`
  146. # when extracting the patch part we strip off everything after a
  147. # dash as that's used for things like version 1.2.3-CVS
  148. cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
  149. checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
  150. numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'`
  151. nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
  152. if test "$nownum" -ge "$checknum"; then
  153. # silent success
  154. exit 0
  155. else
  156. echo "requested version $checkfor is newer than existing @VERSION@"
  157. exit 1
  158. fi
  159. ;;
  160. --vernum)
  161. echo @VERSIONNUM@
  162. exit 0
  163. ;;
  164. --help)
  165. usage 0
  166. ;;
  167. --cflags)
  168. if test "X@includedir@" = "X/usr/include"; then
  169. echo ""
  170. else
  171. echo "-I@includedir@"
  172. fi
  173. ;;
  174. --libs)
  175. if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then
  176. CURLLIBDIR="-L@libdir@ "
  177. else
  178. CURLLIBDIR=""
  179. fi
  180. if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then
  181. echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@
  182. else
  183. echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBS@
  184. fi
  185. ;;
  186. --static-libs)
  187. echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@
  188. ;;
  189. *)
  190. echo "unknown option: $1"
  191. usage 1
  192. ;;
  193. esac
  194. shift
  195. done
  196. exit 0