You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

curl-config.in 4.8KB

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