1##***************************************************************************** 2# AUTHOR: 3# Derived from x_ac_json. 4# 5# SYNOPSIS: 6# X_AC_YAML() 7# 8# DESCRIPTION: 9# Check for libyaml parser library. 10# Right now, just check for libyaml header and library. 11# 12# WARNINGS: 13# This macro must be placed after AC_PROG_CC and before AC_PROG_LIBTOOL. 14##***************************************************************************** 15 16AC_DEFUN([X_AC_YAML], [ 17 _x_ac_yaml_dirs="/usr /usr/local" 18 _x_ac_yaml_libs="lib64 lib" 19 20 AC_ARG_WITH( 21 [yaml], 22 AS_HELP_STRING(--with-yaml=PATH,Specify path to libyaml installation), 23 [AS_IF([test "x$with_yaml" != xno],[_x_ac_yaml_dirs="$with_yaml $_x_ac_yaml_dirs"])]) 24 25 if [test "x$with_yaml" = xno]; then 26 AC_MSG_WARN([support for libyaml disabled]) 27 else 28 AC_CACHE_CHECK( 29 [for libyaml installation], 30 [x_ac_cv_yaml_dir], 31 [ 32 for d in $_x_ac_yaml_dirs; do 33 test -d "$d" || continue 34 test -d "$d/include" || continue 35 test -f "$d/include/yaml.h" || continue 36 for bit in $_x_ac_yaml_libs; do 37 _x_ac_yaml_libs_save="$LIBS" 38 LIBS="-L$d/$bit -lyaml $LIBS" 39 AC_LINK_IFELSE( 40 [AC_LANG_CALL([], yaml_parser_load)], 41 AS_VAR_SET(x_ac_cv_yaml_dir, $d)) 42 LIBS="$_x_ac_yaml_libs_save" 43 test -n "$x_ac_cv_yaml_dir" && break 44 done 45 test -n "$x_ac_cv_yaml_dir" && break 46 done 47 ]) 48 49 if test -z "$x_ac_cv_yaml_dir"; then 50 AC_MSG_WARN([unable to locate libyaml parser library]) 51 else 52 AC_DEFINE([HAVE_YAML], [1], [Define if you are compiling with libyaml parser.]) 53 YAML_CPPFLAGS="-I$x_ac_cv_yaml_dir/include" 54 YAML_LDFLAGS="-L$x_ac_cv_yaml_dir/$bit -lyaml" 55 fi 56 57 AC_SUBST(YAML_CPPFLAGS) 58 AC_SUBST(YAML_LDFLAGS) 59 fi 60 61 AM_CONDITIONAL(WITH_YAML, test -n "$x_ac_cv_yaml_dir") 62]) 63