Avoid overriding the check-local rule, hushing automake warning
[gnash.git] / macros / curl.m4
blob123a17534b6c58e734ea132ab8a54757a1198abb
1 dnl  
2 dnl    Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
3 dnl  
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.
8 dnl  
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)`"
26       else
27               AC_MSG_ERROR([${with_curl_incl} directory doesn't contain curl/curl.h])
28       fi
29     fi
30   ])
32   curlconfig=""
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`"
39     else
40       for i in $incllist; do
41         if test -f $i/curl/curl.h; then
42           ac_cv_path_curl_incl="-I$i"
43                 break
44         fi
45       done
46     fi
48     if test x"${ac_cv_path_curl_incl}" = x ; then
49       AC_CHECK_HEADERS(curl/curl.h)
50     fi
52     AC_MSG_CHECKING([for libcurl header])
53     if test x"${ac_cv_path_curl_incl}" != x ; then
54       AC_MSG_RESULT(yes)
55     else
56       AC_MSG_RESULT(no)
57     fi
58   fi
61   if test x"${ac_cv_path_curl_incl}" != x"/usr/include"; then
62     ac_cv_path_curl_incl="${ac_cv_path_curl_incl}"
63   else
64     ac_cv_path_curl_incl=""
65   fi
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"
73       else # }{
74         AC_MSG_ERROR([${with_curl_lib} directory doesn't contain libcurl.])
75       fi # }
76     fi # }
77   ])
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 ::'`
86     else # }{
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})
93             break
94           else # }{
95             ac_cv_path_curl_lib="-lcurl"
96             AC_MSG_RESULT(yes)
97             break
98           fi # }
99         fi # }
100       done # }
101       if test x"${ac_cv_path_curl_lib}" = x; then # {
102         AC_MSG_RESULT(no)
103       fi # }
104     fi # }
106   fi # }
108   if test x"${ac_cv_path_curl_incl}" != x ; then
109     CURL_CFLAGS="${ac_cv_path_curl_incl}"
110   else
111     CURL_CFLAGS=""
112   fi
114   if ${ENABLE_STATIC}; then
115     CURL_CFLAGS="$CURL_CFLAGS -DCURL_STATICLIB"
116   fi
118   if test x"${ac_cv_path_curl_lib}" != x ; then
119     CURL_LIBS="${ac_cv_path_curl_lib}"
120   else
121     CURL_LIBS=""
122   fi
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])
128   fi
130   AC_SUBST(CURL_CFLAGS)
131   AC_SUBST(CURL_LIBS)
134 # Local Variables:
135 # c-basic-offset: 2
136 # tab-width: 2
137 # indent-tabs-mode: nil
138 # End: