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.

102 lines
2.3 KiB

  1. dnl @synopsis XERCES_CURL_PREFIX
  2. dnl
  3. dnl Determines the prefix for libcurl
  4. dnl
  5. dnl @category C
  6. dnl @author James Berry
  7. dnl @version 2005-05-23
  8. dnl @license AllPermissive
  9. dnl
  10. dnl $Id: xerces_curl_prefix.m4 1662862 2015-02-28 00:28:12Z scantor $
  11. AC_DEFUN([XERCES_CURL_PREFIX],
  12. [
  13. AC_ARG_WITH([curl],
  14. [AS_HELP_STRING([--with-curl[[[[=DIR]]]]],[Specify location of libcurl])],
  15. [
  16. if test x"$with_curl" = x"yes"; then
  17. with_curl=
  18. fi
  19. ],
  20. [with_curl=])
  21. # Determine if curl is available
  22. AC_CACHE_VAL([xerces_cv_curl_present],
  23. [
  24. xerces_cv_curl_present=no
  25. if test x"$with_curl" != x"no"; then
  26. # See if we were given a prefix.
  27. #
  28. if test -n "$with_curl"; then
  29. AC_PATH_PROG([curl_config], [curl-config],[],[$with_curl/bin])
  30. else
  31. AC_PATH_PROG([curl_config], [curl-config],[])
  32. fi
  33. if test -n "$curl_config"; then
  34. curl_flags=`$curl_config --cflags`
  35. curl_libs=`$curl_config --libs`
  36. else
  37. if test -n "$with_curl"; then
  38. curl_flags="-I$with_curl/include"
  39. curl_libs="-L$with_curl/lib -lcurl"
  40. else
  41. # Default compiler paths.
  42. #
  43. curl_flags=
  44. curl_libs=-lcurl
  45. fi
  46. fi
  47. # Check that the headers exist and can be compiled.
  48. #
  49. orig_cppflags=$CPPFLAGS
  50. if test -n "$curl_flags"; then
  51. CPPFLAGS="$curl_flags $CPPFLAGS"
  52. fi
  53. AC_CHECK_HEADER([curl/curl.h], [xerces_cv_curl_present=yes])
  54. CPPFLAGS=$orig_cppflags
  55. if test x"$xerces_cv_curl_present" != x"no"; then
  56. # Check that the library can be linked.
  57. #
  58. AC_MSG_CHECKING([for curl_multi_init in -lcurl])
  59. orig_libs=$LIBS
  60. LIBS="$curl_libs $LIBS"
  61. AC_LINK_IFELSE(
  62. AC_LANG_SOURCE[[
  63. #include <curl/curl.h>
  64. #include <curl/multi.h>
  65. #include <curl/easy.h>
  66. int main ()
  67. {
  68. curl_multi_init();
  69. return 0;
  70. }
  71. ]],
  72. [], [xerces_cv_curl_present=no])
  73. LIBS=$orig_libs
  74. if test x"$xerces_cv_curl_present" != x"no"; then
  75. AC_MSG_RESULT([yes])
  76. else
  77. AC_MSG_RESULT([no])
  78. fi
  79. fi
  80. fi
  81. ])
  82. AC_CACHE_VAL([xerces_cv_curl_flags], [xerces_cv_curl_flags=$curl_flags])
  83. AC_CACHE_VAL([xerces_cv_curl_libs], [xerces_cv_curl_libs=$curl_libs])
  84. AC_SUBST([CURL_PRESENT], [$xerces_cv_curl_present])
  85. AC_SUBST([CURL_FLAGS], [$xerces_cv_curl_flags])
  86. AC_SUBST([CURL_LIBS], [$xerces_cv_curl_libs])
  87. ]
  88. )