2003-07-17 21:09:23 -04:00
|
|
|
dnl XIPH_PATH_CURL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
|
|
|
dnl Test for libcurl, and define CURL_CFLAGS and CURL_LIBS
|
|
|
|
dnl
|
2004-07-06 15:21:46 -04:00
|
|
|
dnl $Id$
|
|
|
|
dnl
|
|
|
|
AC_DEFUN([XIPH_PATH_CURL],
|
2003-07-17 21:09:23 -04:00
|
|
|
[dnl
|
|
|
|
dnl Get the cflags and libraries
|
|
|
|
dnl
|
|
|
|
AC_ARG_WITH(curl,
|
|
|
|
AC_HELP_STRING([--with-curl=PFX],[Prefix where libcurl is installed (optional)]),
|
2008-04-18 21:54:11 -04:00
|
|
|
curl_prefix="$withval", curl_prefix="$CURL_PREFIX")
|
|
|
|
|
|
|
|
if test "x$curl_prefix" = "xno"
|
|
|
|
then
|
|
|
|
AC_MSG_RESULT([libcurl support disabled by request])
|
|
|
|
else
|
|
|
|
|
2003-07-17 21:09:23 -04:00
|
|
|
AC_ARG_WITH(curl-config,
|
|
|
|
AC_HELP_STRING([--with-curl-config=curl-config],[Use curl-config to find libcurl]),
|
|
|
|
CURL_CONFIG="$withval", [AC_PATH_PROGS(CURL_CONFIG, [curl-config], "")])
|
|
|
|
|
2005-07-10 10:24:08 -04:00
|
|
|
if test "x$curl_prefix" != "x" -a "x$curl_prefix" != "xyes"; then
|
2003-07-17 21:09:23 -04:00
|
|
|
CURL_LIBS="-L$curl_prefix/lib -lcurl"
|
|
|
|
CURL_CFLAGS="-I$curl_prefix/include"
|
|
|
|
elif test "x$CURL_CONFIG" != "x"; then
|
|
|
|
if ! test -x "$CURL_CONFIG"; then
|
|
|
|
AC_MSG_ERROR([$CURL_CONFIG cannot be executed])
|
|
|
|
fi
|
|
|
|
CURL_LIBS="$($CURL_CONFIG --libs)"
|
|
|
|
CURL_CFLAGS="$($CURL_CONFIG --cflags)"
|
|
|
|
else
|
2003-07-23 22:31:36 -04:00
|
|
|
if test "x$prefix" = "xNONE"; then
|
|
|
|
curl_prefix="/usr/local"
|
|
|
|
else
|
|
|
|
curl_prefix="$prefix"
|
2003-07-17 21:09:23 -04:00
|
|
|
fi
|
2003-07-23 22:31:36 -04:00
|
|
|
CURL_LIBS="-L$curl_prefix/lib -lcurl"
|
|
|
|
CURL_CFLAGS="-I$curl_prefix/include"
|
2003-07-17 21:09:23 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
curl_ok="yes"
|
|
|
|
|
2003-07-26 20:15:52 -04:00
|
|
|
xt_curl_CPPFLAGS="$CPPFLAGS"
|
|
|
|
xt_curl_LIBS="$LIBS"
|
2003-07-21 13:33:03 -04:00
|
|
|
CPPFLAGS="$CPPFLAGS $CURL_CFLAGS"
|
|
|
|
LIBS="$CURL_LIBS $LIBS"
|
2003-07-17 21:09:23 -04:00
|
|
|
dnl
|
|
|
|
dnl Now check if the installed libcurl is sufficiently new.
|
|
|
|
dnl
|
|
|
|
AC_CHECK_HEADERS([curl/curl.h],, curl_ok="no")
|
|
|
|
AC_MSG_CHECKING(for libcurl)
|
2003-07-26 20:15:52 -04:00
|
|
|
if test "$curl_ok" = "yes"
|
|
|
|
then
|
|
|
|
AC_RUN_IFELSE(AC_LANG_SOURCE([
|
2003-07-17 21:09:23 -04:00
|
|
|
#include <curl/curl.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2003-07-26 20:15:52 -04:00
|
|
|
]),,[curl_ok="no"])
|
2003-07-17 21:09:23 -04:00
|
|
|
fi
|
|
|
|
if test "$curl_ok" = "yes"; then
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_CURL, 1, [Define if you have libcurl.])
|
|
|
|
ifelse([$1], , :, [$1])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
2003-07-23 22:31:36 -04:00
|
|
|
CURL_LIBS=""
|
|
|
|
CURL_CFLAGS=""
|
2003-07-17 21:09:23 -04:00
|
|
|
ifelse([$2], , :, [$2])
|
|
|
|
fi
|
2003-07-26 20:15:52 -04:00
|
|
|
CPPFLAGS="$xt_curl_CPPFLAGS"
|
|
|
|
LIBS="$xt_curl_LIBS"
|
2008-04-18 21:54:11 -04:00
|
|
|
fi
|
|
|
|
AC_SUBST(CURL_CFLAGS)
|
|
|
|
AC_SUBST(CURL_LIBS)
|
2003-07-17 21:09:23 -04:00
|
|
|
])
|