2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
5 dnl This program is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 AC_DEFUN([GNASH_PATH_CURL],
21 dnl Look for the header
22 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})
23 AC_CACHE_VAL(ac_cv_path_curl_incl,[
24 if test x"${with_curl_incl}" != x ; then
25 if test -f ${with_curl_incl}/curl/curl.h ; then
26 ac_cv_path_curl_incl="`(cd ${with_curl_incl}; pwd)`"
28 AC_MSG_ERROR([${with_curl_incl} directory doesn't contain curl/curl.h])
34 AC_PATH_PROG(curlconfig, curl-config, ,[${pathlist}])
36 dnl If the path hasn't been specified, go look for it.
37 if test x"${ac_cv_path_curl_incl}" = x; then
38 if test x"${curlconfig}" != "x"; then
39 ac_cv_path_curl_incl="`${curlconfig} --cflags`"
41 for i in $incllist; do
42 if test -f $i/curl/curl.h; then
43 ac_cv_path_curl_incl="-I$i"
49 if test x"${ac_cv_path_curl_incl}" = x ; then
50 AC_CHECK_HEADERS(curl/curl.h)
53 AC_MSG_CHECKING([for libcurl header])
54 if test x"${ac_cv_path_curl_incl}" != x ; then
62 if test x"${ac_cv_path_curl_incl}" != x"/usr/include"; then
63 ac_cv_path_curl_incl="${ac_cv_path_curl_incl}"
65 ac_cv_path_curl_incl=""
68 dnl Look for the library
69 AC_ARG_WITH(curl_lib, AC_HELP_STRING([--with-curl-lib], [directory where curl library is]), with_curl_lib=${withval})
70 AC_CACHE_VAL(ac_cv_path_curl_lib,[
71 if test x"${with_curl_lib}" != x ; then # {
72 if test -f ${with_curl_lib}/libcurl.a -o -f ${with_curl_lib}/libcurl.${shlibext}; then # {
73 ac_cv_path_curl_lib="-L`(cd ${with_curl_lib}; pwd)` -lcurl"
75 AC_MSG_ERROR([${with_curl_lib} directory doesn't contain libcurl.])
80 dnl If the path hasn't been specified, go look for it.
81 if test x"${ac_cv_path_curl_lib}" = x; then # {
82 if test x"${curlconfig}" != "x" -a x"${darwin}" = xno; then # {
83 dnl curl-config gives us way to many libraries, which create nasty linking
84 dnl dependancy issue, so we strip them off here. The real dependencies are
85 dnl are taken care of by other config tests.
86 ac_cv_path_curl_lib=`${curlconfig} --libs | sed -e 's/lcurl.*/lcurl/' -e 's:-L/usr/lib ::'`
88 AC_MSG_CHECKING([for libcurl library])
89 for i in $libslist; do # {
90 if test -f $i/libcurl.a -o -f $i/libcurl.${shlibext}; then # {
91 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then # {
92 ac_cv_path_curl_lib="-L$i -lcurl"
93 AC_MSG_RESULT(${ac_cv_path_curl_lib})
96 ac_cv_path_curl_lib="-lcurl"
102 if test x"${ac_cv_path_curl_lib}" = x; then # {
109 if test x"${ac_cv_path_curl_incl}" != x ; then
110 CURL_CFLAGS="${ac_cv_path_curl_incl}"
115 if ${ENABLE_STATIC}; then
116 CURL_CFLAGS="$CURL_CFLAGS -DCURL_STATICLIB"
119 if test x"${ac_cv_path_curl_lib}" != x ; then
120 CURL_LIBS="${ac_cv_path_curl_lib}"
121 dnl libcurl3-dev on Ubuntu has a dependency on lber, and Gnash won't link
122 dnl on most machines without it. (Ubuntu packaging bug.)
124 LIBS="$LIBS $CURL_LIBS"
125 AC_TRY_LINK_FUNC(curl_easy_init, [],
126 [AC_CHECK_LIB(lber, ber_free, [CURL_LIBS="$CURL_LIBS -llber"])])
127 dnl FIXME: complain if that didn't do the trick?
133 AM_CONDITIONAL(CURL, [test -n "$CURL_LIBS"])
135 if test -n "$CURL_LIBS"; then
136 AC_DEFINE(USE_CURL, [1], [Define this if you want to enable curl usage])
137 if test x"${curlconfig}" != "x"; then
138 if test x"`${curlconfig} --protocols|grep RTMP`" != x; then
139 curl_rtmp_support=yes
144 AC_SUBST(CURL_CFLAGS)
151 # indent-tabs-mode: nil