curl-config.in 3.8 KB

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