2 dnl Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program; if not, write to the Free Software
15 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 AC_DEFUN([GNASH_PATH_CURL],
20 dnl Look for the header
21 AC_ARG_WITH(curl_incl, AC_HELP_STRING([--with-curl-incl], [directory where libcurl header is (w/out the curl/ prefix)]), with_curl_incl=${withval})
22 AC_CACHE_VAL(ac_cv_path_curl_incl,[
23 if test x"${with_curl_incl}" != x ; then
24 if test -f ${with_curl_incl}/curl/curl.h ; then
25 ac_cv_path_curl_incl="`(cd ${with_curl_incl}; pwd)`"
27 AC_MSG_ERROR([${with_curl_incl} directory doesn't contain curl/curl.h])
33 AC_PATH_PROG(curlconfig, curl-config, ,[${pathlist}])
35 dnl If the path hasn't been specified, go look for it.
36 if test x"${ac_cv_path_curl_incl}" = x; then
37 if test x"${curlconfig}" != "x"; then
38 ac_cv_path_curl_incl="`${curlconfig} --cflags`"
40 for i in $incllist; do
41 if test -f $i/curl/curl.h; then
42 ac_cv_path_curl_incl="-I$i"
48 if test x"${ac_cv_path_curl_incl}" = x ; then
49 AC_CHECK_HEADERS(curl/curl.h)
52 AC_MSG_CHECKING([for libcurl header])
53 if test x"${ac_cv_path_curl_incl}" != x ; then
61 if test x"${ac_cv_path_curl_incl}" != x"/usr/include"; then
62 ac_cv_path_curl_incl="${ac_cv_path_curl_incl}"
64 ac_cv_path_curl_incl=""
67 dnl Look for the library
68 AC_ARG_WITH(curl_lib, AC_HELP_STRING([--with-curl-lib], [directory where curl library is]), with_curl_lib=${withval})
69 AC_CACHE_VAL(ac_cv_path_curl_lib,[
70 if test x"${with_curl_lib}" != x ; then # {
71 if test -f ${with_curl_lib}/libcurl.a -o -f ${with_curl_lib}/libcurl.${shlibext}; then # {
72 ac_cv_path_curl_lib="-L`(cd ${with_curl_lib}; pwd)` -lcurl"
74 AC_MSG_ERROR([${with_curl_lib} directory doesn't contain libcurl.])
79 dnl If the path hasn't been specified, go look for it.
80 if test x"${ac_cv_path_curl_lib}" = x; then # {
81 if test x"${curlconfig}" != "x" -a x"${darwin}" = xno; then # {
82 dnl curl-config gives us way to many libraries, which create nasty linking
83 dnl dependancy issue, so we strip them off here. The real dependencies are
84 dnl are taken care of by other config tests.
85 ac_cv_path_curl_lib=`${curlconfig} --libs | sed -e 's/lcurl.*/lcurl/' -e 's:-L/usr/lib ::'`
87 AC_MSG_CHECKING([for libcurl library])
88 for i in $libslist; do # {
89 if test -f $i/libcurl.a -o -f $i/libcurl.${shlibext}; then # {
90 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then # {
91 ac_cv_path_curl_lib="-L$i -lcurl"
92 AC_MSG_RESULT(${ac_cv_path_curl_lib})
95 ac_cv_path_curl_lib="-lcurl"
101 if test x"${ac_cv_path_curl_lib}" = x; then # {
108 if test x"${ac_cv_path_curl_incl}" != x ; then
109 CURL_CFLAGS="${ac_cv_path_curl_incl}"
114 if ${ENABLE_STATIC}; then
115 CURL_CFLAGS="$CURL_CFLAGS -DCURL_STATICLIB"
118 if test x"${ac_cv_path_curl_lib}" != x ; then
119 CURL_LIBS="${ac_cv_path_curl_lib}"
124 AM_CONDITIONAL(CURL, [test -n "$CURL_LIBS"])
126 if test -n "$CURL_LIBS"; then
127 AC_DEFINE(USE_CURL, [1], [Define this if you want to enable curl usage])
130 AC_SUBST(CURL_CFLAGS)
137 # indent-tabs-mode: nil