File: curl.m4

package info (click to toggle)
gnash 0.8.11~git20160608-1.3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 31,076 kB
  • ctags: 20,266
  • sloc: cpp: 162,017; xml: 34,270; ansic: 17,168; makefile: 8,648; sh: 3,384; lisp: 3,195; exp: 1,210; python: 593; php: 174; perl: 69; sql: 33; sed: 16
file content (152 lines) | stat: -rw-r--r-- 4,994 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
dnl  
dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
dnl  2011 Free Software Foundation, Inc.
dnl  
dnl  This program is free software; you can redistribute it and/or modify
dnl  it under the terms of the GNU General Public License as published by
dnl  the Free Software Foundation; either version 3 of the License, or
dnl  (at your option) any later version.
dnl  
dnl  This program is distributed in the hope that it will be useful,
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl  GNU General Public License for more details.
dnl  You should have received a copy of the GNU General Public License
dnl  along with this program; if not, write to the Free Software
dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


AC_DEFUN([GNASH_PATH_CURL],
[
  dnl Look for the header
  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})
    AC_CACHE_VAL(ac_cv_path_curl_incl,[
    if test x"${with_curl_incl}" != x ; then
      if test -f ${with_curl_incl}/curl/curl.h ; then
	      ac_cv_path_curl_incl="`(cd ${with_curl_incl}; pwd)`"
      else
	      AC_MSG_ERROR([${with_curl_incl} directory doesn't contain curl/curl.h])
      fi
    fi
  ])

  curlconfig=""
  AC_PATH_PROG(curlconfig, curl-config, ,[${pathlist}])

  dnl If the path hasn't been specified, go look for it.
  if test x"${ac_cv_path_curl_incl}" = x; then
    if test x"${curlconfig}" != "x"; then
      ac_cv_path_curl_incl="`${curlconfig} --cflags`"
    else
      for i in $incllist; do
        if test -f $i/curl/curl.h; then
          ac_cv_path_curl_incl="-I$i"
	        break
        fi
      done
    fi

    if test x"${ac_cv_path_curl_incl}" = x ; then
      AC_CHECK_HEADERS(curl/curl.h)
    fi

    AC_MSG_CHECKING([for libcurl header])
    if test x"${ac_cv_path_curl_incl}" != x ; then
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
    fi
  fi


  if test x"${ac_cv_path_curl_incl}" != x"/usr/include"; then
    ac_cv_path_curl_incl="${ac_cv_path_curl_incl}"
  else
    ac_cv_path_curl_incl=""
  fi

  dnl Look for the library
  AC_ARG_WITH(curl_lib, AC_HELP_STRING([--with-curl-lib], [directory where curl library is]), with_curl_lib=${withval})
    AC_CACHE_VAL(ac_cv_path_curl_lib,[
    if test x"${with_curl_lib}" != x ; then # {
      if test -f ${with_curl_lib}/libcurl.a -o -f ${with_curl_lib}/libcurl.${shlibext}; then # {
        ac_cv_path_curl_lib="-L`(cd ${with_curl_lib}; pwd)` -lcurl"
      else # }{
        AC_MSG_ERROR([${with_curl_lib} directory doesn't contain libcurl.])
      fi # }
    fi # }
  ])

  dnl If the path hasn't been specified, go look for it.
  if test x"${ac_cv_path_curl_lib}" = x; then # {
    if test x"${curlconfig}" != "x" -a x"${darwin}" = xno; then # {
      dnl curl-config gives us way to many libraries, which create nasty linking
      dnl dependancy issue, so we strip them off here. The real dependencies are
      dnl are taken care of by other config tests.
      ac_cv_path_curl_lib=`${curlconfig} --libs | sed -e 's/lcurl.*/lcurl/' -e 's:-L/usr/lib ::'`
    else # }{
      AC_MSG_CHECKING([for libcurl library])
      for i in $libslist; do # {
        if test -f $i/libcurl.a -o -f $i/libcurl.${shlibext}; then # {
          if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then # {
            ac_cv_path_curl_lib="-L$i -lcurl"
            AC_MSG_RESULT(${ac_cv_path_curl_lib})
            break
          else # }{
            ac_cv_path_curl_lib="-lcurl"
            AC_MSG_RESULT(yes)
            break
          fi # }
        fi # }
      done # }
      if test x"${ac_cv_path_curl_lib}" = x; then # {
        AC_MSG_RESULT(no)
      fi # }
    fi # }

  fi # }

  if test x"${ac_cv_path_curl_incl}" != x ; then
    CURL_CFLAGS="${ac_cv_path_curl_incl}"
  else
    CURL_CFLAGS=""
  fi

  if ${ENABLE_STATIC}; then
    CURL_CFLAGS="$CURL_CFLAGS -DCURL_STATICLIB"
  fi

  if test x"${ac_cv_path_curl_lib}" != x ; then
    CURL_LIBS="${ac_cv_path_curl_lib}"
    dnl libcurl3-dev on Ubuntu has a dependency on lber, and Gnash won't link
    dnl on most machines without it. (Ubuntu packaging bug.)
    save_LIBS="$LIBS"
    LIBS="$LIBS $CURL_LIBS"
    AC_TRY_LINK_FUNC(curl_easy_init, [], 
      [AC_CHECK_LIB(lber, ber_free, [CURL_LIBS="$CURL_LIBS -llber"])])
    dnl FIXME: complain if that didn't do the trick?
    LIBS="$save_LIBS"
  else
    CURL_LIBS=""
  fi

  AM_CONDITIONAL(CURL, [test -n "$CURL_LIBS"])

  if test -n "$CURL_LIBS"; then
    AC_DEFINE(USE_CURL, [1], [Define this if you want to enable curl usage])
    if test x"${curlconfig}" != "x"; then
      if test x"`${curlconfig} --protocols|grep RTMP`" != x; then
        curl_rtmp_support=yes
      fi
    fi
  fi

  AC_SUBST(CURL_CFLAGS)
  AC_SUBST(CURL_LIBS)
])

# Local Variables:
# c-basic-offset: 2
# tab-width: 2
# indent-tabs-mode: nil
# End: