Modify backend to use new auth cookie format
[blerg.git] / m4 / yajl.m4
1 # ===========================================================================
2 #       URL
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 #   AX_CHECK_YAJL()
8 #
9 # DESCRIPTION
10 #
11 #
12 # LICENSE
13 #
14 #   Copyright (c) 2011 Boris Manojlovic <boris@steki.net>
15 #
16 #   This program is free software; you can redistribute it and/or modify it
17 #   under the terms of the GNU General Public License as published by the
18 #   Free Software Foundation; either version 2 of the License, or (at your
19 #   option) any later version.
20 #
21 #   This program is distributed in the hope that it will be useful, but
22 #   WITHOUT ANY WARRANTY; without even the implied warranty of
23 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
24 #   Public License for more details.
25 #
26 #   You should have received a copy of the GNU General Public License along
27 #   with this program. If not, see <http://www.gnu.org/licenses/>.
28 #
29 #   As a special exception, the respective Autoconf Macro's copyright owner
30 #   gives unlimited permission to copy, distribute and modify the configure
31 #   scripts that are the output of Autoconf when processing the Macro. You
32 #   need not follow the terms of the GNU General Public License when using
33 #   or distributing such scripts, even though portions of the text of the
34 #   Macro appear in them. The GNU General Public License (GPL) does govern
35 #   all other use of the material that constitutes the Autoconf Macro.
36 #
37 #   This special exception to the GPL applies to versions of the Autoconf
38 #   Macro released by the Autoconf Archive. When you make and distribute a
39 #   modified version of the Autoconf Macro, you may extend this special
40 #   exception to the GPL to apply to your modified version as well.
41
42 #serial 1
43
44 AU_ALIAS([CHECK_YAJL], [AX_CHECK_YAJL])
45 AC_DEFUN([AX_CHECK_YAJL],
46 #
47 # Handle user hints
48 #
49 [AC_ARG_WITH(yajl,
50 [
51   --with-yajl=DIR root directory path of yajl installation [defaults to
52                     /usr/local or /usr if not found in /usr/local]
53   --without-yajl to disable yajl usage completely],
54 [
55 if test "$withval" != "no"; then
56         if test -d "$withval" ; then
57                 WANT_YAJL="yes"
58                 yajl_places="$withval"
59         else
60                 AC_MSG_WARN([Sorry, $withval does not exist])
61         fi
62 fi
63 ],[
64 dnl just provide default places where it most probably could be found
65 yajl_places="/usr/local /usr /opt/local /sw"
66 ])
67
68 #
69 # Locate yajl
70 #
71
72 if test -n "$yajl_places" ; then
73         # check the user supplied or any other more or less 'standard' place:
74         for YAJL_HOME in ${yajl_places} ; do
75           if test -f "${YAJL_HOME}/include/yajl/yajl_parse.h"; then break; fi
76           YAJL_HOME=""
77         done
78
79         # if yajl.h was nowhere to be found, give a notice and bail out
80         if test ! -n "${YAJL_HOME}"; then
81           AC_MSG_ERROR(No yajl.h in any include directory of ${yajl_places}: either specify a valid yajl installation with --with-yajl=DIR or disable yajl usage with --without-yajl)
82         fi
83
84         AC_LANG_SAVE
85         AC_LANG_C
86         AC_CHECK_LIB(yajl, yajl_parse, [yajl_cv_libyajl=yes], [yajl_cv_libyajl=no])
87         AC_CHECK_HEADER(yajl/yajl_parse.h, [yajl_cv_yajl_parse_h=yes], [yajl_cv_yajl_parse_h=no])
88         AC_LANG_RESTORE
89         YAJL_LIBS="-lyajl"
90         YAJL_CFLAGS="-I${YAJL_HOME}/include"
91         if test "$yajl_cv_libyajl" != "yes" -a "$yajl_cv_yajl_parse_h" != "yes"
92         then
93                 # If either header or library was not found, revert and bomb
94                 AC_MSG_ERROR(either specify a valid yajl installation with --with-yajl=DIR or disable yajl usage with --without-yajl)
95         fi
96 fi
97 AC_SUBST(YAJL_LIBS)
98 AC_SUBST(YAJL_CFLAGS)
99 AC_SUBST(YAJL_LDFLAGS) dnl no really use for this library
100 ])