curl-config.in 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #! /bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2001 - 2017, 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.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. prefix=@prefix@
  24. exec_prefix=@exec_prefix@
  25. includedir=@includedir@
  26. cppflag_curl_staticlib=@CPPFLAG_CURL_STATICLIB@
  27. usage()
  28. {
  29. cat <<EOF
  30. Usage: curl-config [OPTION]
  31. Available values for OPTION include:
  32. --built-shared says 'yes' if libcurl was built shared
  33. --ca ca bundle install path
  34. --cc compiler
  35. --cflags pre-processor and compiler flags
  36. --checkfor [version] check for (lib)curl of the specified version
  37. --configure the arguments given to configure when building curl
  38. --features newline separated list of enabled features
  39. --help display this help and exit
  40. --libs library linking information
  41. --prefix curl install prefix
  42. --protocols newline separated list of enabled protocols
  43. --ssl-backends output the SSL backends libcurl was built to support
  44. --static-libs static libcurl library linking information
  45. --version output version information
  46. --vernum output the version information as a number (hexadecimal)
  47. EOF
  48. exit $1
  49. }
  50. if test $# -eq 0; then
  51. usage 1
  52. fi
  53. while test $# -gt 0; do
  54. case "$1" in
  55. # this deals with options in the style
  56. # --option=value and extracts the value part
  57. # [not currently used]
  58. -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  59. *) value= ;;
  60. esac
  61. case "$1" in
  62. --built-shared)
  63. echo @ENABLE_SHARED@
  64. ;;
  65. --ca)
  66. echo @CURL_CA_BUNDLE@
  67. ;;
  68. --cc)
  69. echo "@CC@"
  70. ;;
  71. --prefix)
  72. echo "$prefix"
  73. ;;
  74. --feature|--features)
  75. for feature in @SUPPORT_FEATURES@ ""; do
  76. test -n "$feature" && echo "$feature"
  77. done
  78. ;;
  79. --protocols)
  80. for protocol in @SUPPORT_PROTOCOLS@; do
  81. echo "$protocol"
  82. done
  83. ;;
  84. --version)
  85. echo libcurl @CURLVERSION@
  86. exit 0
  87. ;;
  88. --checkfor)
  89. checkfor=$2
  90. cmajor=`echo $checkfor | cut -d. -f1`
  91. cminor=`echo $checkfor | cut -d. -f2`
  92. # when extracting the patch part we strip off everything after a
  93. # dash as that's used for things like version 1.2.3-CVS
  94. cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
  95. checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
  96. numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'`
  97. nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
  98. if test "$nownum" -ge "$checknum"; then
  99. # silent success
  100. exit 0
  101. else
  102. echo "requested version $checkfor is newer than existing @CURLVERSION@"
  103. exit 1
  104. fi
  105. ;;
  106. --vernum)
  107. echo @VERSIONNUM@
  108. exit 0
  109. ;;
  110. --help)
  111. usage 0
  112. ;;
  113. --cflags)
  114. if test "X$cppflag_curl_staticlib" = "X-DCURL_STATICLIB"; then
  115. CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB "
  116. else
  117. CPPFLAG_CURL_STATICLIB=""
  118. fi
  119. if test "X@includedir@" = "X/usr/include"; then
  120. echo "$CPPFLAG_CURL_STATICLIB"
  121. else
  122. echo "${CPPFLAG_CURL_STATICLIB}-I@includedir@"
  123. fi
  124. ;;
  125. --libs)
  126. if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then
  127. CURLLIBDIR="-L@libdir@ "
  128. else
  129. CURLLIBDIR=""
  130. fi
  131. if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then
  132. echo ${CURLLIBDIR}-lcurl @LIBCURL_LIBS@
  133. else
  134. echo ${CURLLIBDIR}-lcurl
  135. fi
  136. ;;
  137. --ssl-backends)
  138. echo "@SSL_BACKENDS@"
  139. ;;
  140. --static-libs)
  141. if test "X@ENABLE_STATIC@" != "Xno" ; then
  142. echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@
  143. else
  144. echo "curl was built with static libraries disabled" >&2
  145. exit 1
  146. fi
  147. ;;
  148. --configure)
  149. echo @CONFIGURE_OPTIONS@
  150. ;;
  151. *)
  152. echo "unknown option: $1"
  153. usage 1
  154. ;;
  155. esac
  156. shift
  157. done
  158. exit 0