~drizzle-trunk/drizzle/development

1643.1.7 by Monty Taylor
Migrated code from auth_http into pandora check for libcurl, since PBMS was
1
dnl Copyright (C) 2010 Monty Taylor
2
dnl This file is free software;  Monty Taylor
3
dnl gives unlimited permission to copy and/or distribute it,
4
dnl with or without modifications, as long as this notice is preserved.
5
6
AC_DEFUN([_PANDORA_SEARCH_LIBCURL],[
7
  AC_REQUIRE([AC_LIB_PREFIX])
8
9
  dnl --------------------------------------------------------------------
10
  dnl  Check for libcurl
11
  dnl --------------------------------------------------------------------
12
13
  AC_ARG_ENABLE([libcurl],
14
    [AS_HELP_STRING([--disable-libcurl],
15
      [Build with libcurl support @<:@default=on@:>@])],
16
    [ac_enable_libcurl="$enableval"],
17
    [ac_enable_libcurl="yes"])
18
19
  AS_IF([test "x$ac_enable_libcurl" = "xyes"],[
20
    AC_LIB_HAVE_LINKFLAGS(curl,,
21
      [#include <curl/curl.h>],
22
      [
23
        CURL *handle;
24
        handle=curl_easy_init();
25
      ])
26
    ],[
27
      ac_cv_libcurl="no"
28
    ])
29
30
  AC_CACHE_CHECK([if libcurl has CURLOPT_USERNAME],
31
                 [pandora_cv_curl_have_username],[
32
     AC_COMPILE_IFELSE([
33
       AC_LANG_PROGRAM(
34
         [[
2363.1.1 by Brian Aker
Fix memory leak in temporal and json server.
35
           #include <curl/curl.h>
36
         ]],
37
         [[
38
           CURL *curl_handle=curl_easy_init();
39
           CURLcode rv= curl_easy_setopt(curl_handle, CURLOPT_USERNAME, "foo");
40
           (void)rv;
41
         ]])
42
       ],
1643.1.7 by Monty Taylor
Migrated code from auth_http into pandora check for libcurl, since PBMS was
43
       [pandora_cv_curl_have_username=yes],
44
       [pandora_cv_curl_have_username=no])
45
     ])
46
47
  AM_CONDITIONAL(HAVE_LIBCURL,[test "x${ac_cv_libcurl}" = "xyes"])
48
  AS_IF([test "x$pandora_cv_curl_have_username" = "xyes"],
49
        AC_DEFINE([HAVE_CURLOPT_USERNAME],[1],
50
                  [Does libcurl provide the CURLOPT_USERNAME constant]))
51
52
])
53
54
AC_DEFUN([PANDORA_HAVE_LIBCURL],[
55
  AC_REQUIRE([_PANDORA_SEARCH_LIBCURL])
56
  AS_IF([test "x${ac_cv_libcurl}" = "xno"],[
57
    AC_MSG_WARN([libcurl development lib not found. On Debian this is found in libcurl4-gnutls-dev. On RHEL5/Fedora11 it's in curl-devel. On RHEL6/Fedora12 it's in libcurl-devel.])
58
  ])
59
])
60
61
AC_DEFUN([PANDORA_REQUIRE_LIBCURL],[
62
  PANDORA_HAVE_LIBCURL($1)
63
  AS_IF([test "x${ac_cv_libcurl}" = "xno"],[
2221.1.8 by Monty Taylor
Adds ability to just build libdrizzle without needing all of the rest of the
64
    PANDORA_MSG_ERROR([libcurl is required for ${PACKAGE}])
1643.1.7 by Monty Taylor
Migrated code from auth_http into pandora check for libcurl, since PBMS was
65
  ])
66
])