1 dnl Check for CURL Libraries
2 dnl CHECK_CURL(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
10 CURL_MIN_VERSION="7.15.1"
12 AC_DEFUN([CHECK_CURL],
17 [AC_HELP_STRING([--with-curl=PATH],[Path to curl prefix or config script])],
18 [test_paths="${with_curl}"],
19 [test_paths="/usr/local/libcurl /usr/local/curl /usr/local /opt/libcurl /opt/curl /opt /usr"])
21 AC_MSG_CHECKING([for libcurl config script])
23 for x in ${test_paths}; do
24 dnl # Determine if the script was specified and use it directly
25 if test ! -d "$x" -a -e "$x"; then
31 dnl # Try known config script names/locations
32 for CURL_CONFIG in curl-config; do
33 if test -e "${x}/bin/${CURL_CONFIG}"; then
36 elif test -e "${x}/${CURL_CONFIG}"; then
43 if test -n "$curl_path"; then
48 if test -n "${curl_path}"; then
49 if test "${curl_path}" != "no"; then
50 CURL_CONFIG="${curl_path}/${CURL_CONFIG}"
52 AC_MSG_RESULT([${CURL_CONFIG}])
53 CURL_CFLAGS="`${CURL_CONFIG} --cflags`"
54 if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl CFLAGS: $CURL_CFLAGS); fi
55 CURL_LIBS="`${CURL_CONFIG} --libs`"
56 if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl LIBS: $CURL_LIBS); fi
57 CURL_VERSION=`${CURL_CONFIG} --version | sed 's/^[[^0-9]][[^[:space:]]][[^[:space:]]]*[[[:space:]]]*//'`
58 if test "$verbose_output" -eq 1; then AC_MSG_NOTICE(curl VERSION: $CURL_VERSION); fi
62 dnl # Check version is ok
63 AC_MSG_CHECKING([if libcurl is at least v${CURL_MIN_VERSION}])
64 curl_min_ver=`echo ${CURL_MIN_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'`
65 curl_ver=`echo ${CURL_VERSION} | awk -F. '{print (\$ 1 * 1000000) + (\$ 2 * 1000) + \$ 3}'`
66 if test "$curl_min_ver" -le "$curl_ver"; then
70 AC_MSG_NOTICE([NOTE: curl library may be too old: $CURL_VERSION])
73 dnl # Check/warn if GnuTLS is used
74 AC_MSG_CHECKING([if libcurl is linked with gnutls])
75 curl_uses_gnutls=`echo ${CURL_LIBS} | grep gnutls | wc -l`
76 if test "$curl_uses_gnutls" -ne 0; then
78 AC_MSG_NOTICE([NOTE: curl linked with gnutls may be buggy, openssl recommended])
91 AC_SUBST(CURL_USES_GNUTLS)
93 if test -z "${CURL_LIBS}"; then
94 AC_MSG_NOTICE([*** curl library not found.])
95 ifelse([$2], , AC_MSG_NOTICE([NOTE: curl library is only required for building mlogc]), $2)
97 AC_MSG_NOTICE([using '${CURL_LIBS}' for curl Library])