curl-config.in 4.0 KB

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