curl-config.in 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #! /bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2001 - 2009, 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. # $Id$
  23. ###########################################################################
  24. prefix=@prefix@
  25. exec_prefix=@exec_prefix@
  26. includedir=@includedir@
  27. usage()
  28. {
  29. cat <<EOF
  30. Usage: curl-config [OPTION]
  31. Available values for OPTION include:
  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. --ca)
  61. echo "@CURL_CA_BUNDLE@"
  62. ;;
  63. --cc)
  64. echo "@CC@"
  65. ;;
  66. --prefix)
  67. echo "$prefix"
  68. ;;
  69. --feature|--features)
  70. for feature in @SUPPORT_FEATURES@ ""; do
  71. test -n "$feature" && echo "$feature"
  72. done
  73. ;;
  74. --protocols)
  75. for protocol in @SUPPORT_PROTOCOLS@; do
  76. echo "$protocol"
  77. done
  78. ;;
  79. --version)
  80. echo libcurl @VERSION@
  81. exit 0
  82. ;;
  83. --checkfor)
  84. checkfor=$2
  85. cmajor=`echo $checkfor | cut -d. -f1`
  86. cminor=`echo $checkfor | cut -d. -f2`
  87. # when extracting the patch part we strip off everything after a
  88. # dash as that's used for things like version 1.2.3-CVS
  89. cpatch=`echo $checkfor | cut -d. -f3 | cut -d- -f1`
  90. checknum=`echo "$cmajor*256*256 + $cminor*256 + ${cpatch:-0}" | bc`
  91. numuppercase=`echo @VERSIONNUM@ | tr 'a-f' 'A-F'`
  92. nownum=`echo "obase=10; ibase=16; $numuppercase" | bc`
  93. if test "$nownum" -ge "$checknum"; then
  94. # silent success
  95. exit 0
  96. else
  97. echo "requested version $checkfor is newer than existing @VERSION@"
  98. exit 1
  99. fi
  100. ;;
  101. --vernum)
  102. echo @VERSIONNUM@
  103. exit 0
  104. ;;
  105. --help)
  106. usage 0
  107. ;;
  108. --cflags)
  109. if test "X@includedir@" = "X/usr/include"; then
  110. echo ""
  111. else
  112. echo "-I@includedir@"
  113. fi
  114. ;;
  115. --libs)
  116. if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then
  117. CURLLIBDIR="-L@libdir@ "
  118. else
  119. CURLLIBDIR=""
  120. fi
  121. if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then
  122. echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@
  123. else
  124. echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBS@
  125. fi
  126. ;;
  127. --static-libs)
  128. echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@
  129. ;;
  130. --configure)
  131. echo @CONFIGURE_OPTIONS@
  132. ;;
  133. *)
  134. echo "unknown option: $1"
  135. usage 1
  136. ;;
  137. esac
  138. shift
  139. done
  140. exit 0