--- /dev/null
+# ===========================================================================
+# URL
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_YAJL()
+#
+# DESCRIPTION
+#
+#
+# LICENSE
+#
+# Copyright (c) 2011 Boris Manojlovic <boris@steki.net>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 1
+
+AU_ALIAS([CHECK_YAJL], [AX_CHECK_YAJL])
+AC_DEFUN([AX_CHECK_YAJL],
+#
+# Handle user hints
+#
+[AC_ARG_WITH(yajl,
+[
+ --with-yajl=DIR root directory path of yajl installation [defaults to
+ /usr/local or /usr if not found in /usr/local]
+ --without-yajl to disable yajl usage completely],
+[
+if test "$withval" != "no"; then
+ if test -d "$withval" ; then
+ WANT_YAJL="yes"
+ yajl_places="$withval"
+ else
+ AC_MSG_WARN([Sorry, $withval does not exist])
+ fi
+fi
+],[
+dnl just provide default places where it most probably could be found
+yajl_places="/usr/local /usr /opt/local /sw"
+])
+
+#
+# Locate yajl
+#
+
+if test -n "$yajl_places" ; then
+ # check the user supplied or any other more or less 'standard' place:
+ for YAJL_HOME in ${yajl_places} ; do
+ if test -f "${YAJL_HOME}/include/yajl/yajl_parse.h"; then break; fi
+ YAJL_HOME=""
+ done
+
+ # if yajl.h was nowhere to be found, give a notice and bail out
+ if test ! -n "${YAJL_HOME}"; then
+ 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)
+ fi
+
+ AC_LANG_SAVE
+ AC_LANG_C
+ AC_CHECK_LIB(yajl, yajl_parse, [yajl_cv_libyajl=yes], [yajl_cv_libyajl=no])
+ AC_CHECK_HEADER(yajl/yajl_parse.h, [yajl_cv_yajl_parse_h=yes], [yajl_cv_yajl_parse_h=no])
+ AC_LANG_RESTORE
+ YAJL_LIBS="-lyajl"
+ YAJL_CFLAGS="-I${YAJL_HOME}/include"
+ if test "$yajl_cv_libyajl" != "yes" -a "$yajl_cv_yajl_parse_h" != "yes"
+ then
+ # If either header or library was not found, revert and bomb
+ AC_MSG_ERROR(either specify a valid yajl installation with --with-yajl=DIR or disable yajl usage with --without-yajl)
+ fi
+fi
+AC_SUBST(YAJL_LIBS)
+AC_SUBST(YAJL_CFLAGS)
+AC_SUBST(YAJL_LDFLAGS) dnl no really use for this library
+])