Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / curl.m4
bloba1aaed374f359a7da207974cd6e02d8e06c8c369
1 dnl  
2 dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl  2011 Free Software Foundation, Inc.
4 dnl  
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.
9 dnl  
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)`"
27       else
28               AC_MSG_ERROR([${with_curl_incl} directory doesn't contain curl/curl.h])
29       fi
30     fi
31   ])
33   curlconfig=""
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`"
40     else
41       for i in $incllist; do
42         if test -f $i/curl/curl.h; then
43           ac_cv_path_curl_incl="-I$i"
44                 break
45         fi
46       done
47     fi
49     if test x"${ac_cv_path_curl_incl}" = x ; then
50       AC_CHECK_HEADERS(curl/curl.h)
51     fi
53     AC_MSG_CHECKING([for libcurl header])
54     if test x"${ac_cv_path_curl_incl}" != x ; then
55       AC_MSG_RESULT(yes)
56     else
57       AC_MSG_RESULT(no)
58     fi
59   fi
62   if test x"${ac_cv_path_curl_incl}" != x"/usr/include"; then
63     ac_cv_path_curl_incl="${ac_cv_path_curl_incl}"
64   else
65     ac_cv_path_curl_incl=""
66   fi
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"
74       else # }{
75         AC_MSG_ERROR([${with_curl_lib} directory doesn't contain libcurl.])
76       fi # }
77     fi # }
78   ])
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 ::'`
87     else # }{
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})
94             break
95           else # }{
96             ac_cv_path_curl_lib="-lcurl"
97             AC_MSG_RESULT(yes)
98             break
99           fi # }
100         fi # }
101       done # }
102       if test x"${ac_cv_path_curl_lib}" = x; then # {
103         AC_MSG_RESULT(no)
104       fi # }
105     fi # }
107   fi # }
109   if test x"${ac_cv_path_curl_incl}" != x ; then
110     CURL_CFLAGS="${ac_cv_path_curl_incl}"
111   else
112     CURL_CFLAGS=""
113   fi
115   if ${ENABLE_STATIC}; then
116     CURL_CFLAGS="$CURL_CFLAGS -DCURL_STATICLIB"
117   fi
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.)
123     save_LIBS="$LIBS"
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?
128     LIBS="$save_LIBS"
129   else
130     CURL_LIBS=""
131   fi
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
140       fi
141     fi
142   fi
144   AC_SUBST(CURL_CFLAGS)
145   AC_SUBST(CURL_LIBS)
148 # Local Variables:
149 # c-basic-offset: 2
150 # tab-width: 2
151 # indent-tabs-mode: nil
152 # End: