You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
3.0 KiB

#
# Zabbix
# Copyright (C) 2001-2023 Zabbix SIA
#
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
AC_DEFUN([YAML_TRY_LINK],
[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <assert.h>
#include <yaml.h>
]],[[
yaml_parser_t parser;
assert(yaml_parser_initialize(&parser));
]])],[found_yaml="yes"],[AC_MSG_FAILURE([error])])
])dnl
AC_DEFUN([LIBYAML_CHECK_CONFIG],
[
AC_ARG_WITH([libyaml],[
If you want to specify YAML installation directories:
AS_HELP_STRING([--with-libyaml@<:@=DIR@:>@],[use specific YAML library @<:@default=yes@:>@, DIR is the YAML library install directory.])],
[
if test "$withval" = "no"; then
want_yaml="no"
_libyaml_dir="no"
elif test "$withval" = "yes"; then
want_yaml="yes"
_libyaml_dir="no"
else
want_yaml="yes"
_libyaml_dir=$withval
fi
],
[
want_yaml=ifelse([$1],,[yes],[$1])
_libyaml_dir="no"
]
)dnl
if test "x$want_yaml" = "xyes"; then
AC_REQUIRE([PKG_PROG_PKG_CONFIG])
m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG()], [:])
AC_MSG_CHECKING(for yaml-0.1 support)
if test "x$_libyaml_dir" = "xno"; then
if test -x "$PKG_CONFIG" && `$PKG_CONFIG --exists yaml-0.1`; then
YAML_CFLAGS="`$PKG_CONFIG --cflags yaml-0.1`"
YAML_LDFLAGS="`$PKG_CONFIG --libs yaml-0.1`"
YAML_LIBRARY_PATH=""
YAML_LIBS="`$PKG_CONFIG --libs yaml-0.1`"
found_yaml="yes"
else
found_yaml="no"
AC_MSG_RESULT(no)
fi
else
if test -f $_libyaml_dir/include/yaml.h; then
YAML_CFLAGS=-I$_libyaml_dir/include
YAML_LDFLAGS=-L$_libyaml_dir/lib
YAML_LIBRARY_PATH="$_libyaml_dir/lib"
YAML_LIBS="-lyaml"
found_yaml="yes"
else
found_yaml="no"
AC_MSG_RESULT(no)
fi
fi
fi
if test "x$found_yaml" = "xyes"; then
am_save_cflags="$CFLAGS"
am_save_ldflags="$LDFLAGS"
am_save_libs="$LIBS"
CFLAGS="$CFLAGS $YAML_CFLAGS"
LDFLAGS="$LDFLAGS $YAML_LDFLAGS"
LIBS="$LIBS $YAML_LIBS"
found_yaml="no"
YAML_TRY_LINK([no])
CFLAGS="$am_save_cflags"
LDFLAGS="$am_save_ldflags"
LIBS="$am_save_libs"
if test "x$found_yaml" = "xyes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi # if test "x$found_yaml" = "xyes"; then
else
YAML_CFLAGS=""
YAML_LDFLAGS=""
YAML_LIBRARY_PATH=""
YAML_LIBS=""
fi # if test "x$found_yaml" = "xyes"; then
AC_SUBST(YAML_CFLAGS)
AC_SUBST(YAML_LDFLAGS)
AC_SUBST(YAML_LIBRARY_PATH)
AC_SUBST(YAML_LIBS)
])dnl