[build] Add yajl related macros.

pull/128/head
Suresh Sundriyal 9 years ago
parent 145982ee6a
commit fdf73c5744

@ -0,0 +1,22 @@
AC_DEFUN([LNAV_ADDTO], [
if test "x$$1" = "x"; then
test "x$verbose" = "xyes" && echo " setting $1 to \"$2\""
$1="$2"
else
ats_addto_bugger="$2"
for i in $ats_addto_bugger; do
ats_addto_duplicate="0"
for j in $$1; do
if test "x$i" = "x$j"; then
ats_addto_duplicate="1"
break
fi
done
if test $ats_addto_duplicate = "0"; then
test "x$verbose" = "xyes" && echo " adding \"$i\" to $1"
$1="$$1 $i"
fi
done
fi
])dnl

@ -18,28 +18,6 @@ dnl
dnl lnav_with_jemalloc.m4: lnav's jemalloc autoconf macros
dnl
dnl
AC_DEFUN([LNAV_ADDTO], [
if test "x$$1" = "x"; then
test "x$verbose" = "xyes" && echo " setting $1 to \"$2\""
$1="$2"
else
ats_addto_bugger="$2"
for i in $ats_addto_bugger; do
ats_addto_duplicate="0"
for j in $$1; do
if test "x$i" = "x$j"; then
ats_addto_duplicate="1"
break
fi
done
if test $ats_addto_duplicate = "0"; then
test "x$verbose" = "xyes" && echo " adding \"$i\" to $1"
$1="$$1 $i"
fi
done
fi
])dnl
AC_DEFUN([LNAV_WITH_JEMALLOC], [
enable_jemalloc=no
AC_ARG_WITH([jemalloc], [AC_HELP_STRING([--with-jemalloc=DIR], [use a specific jemalloc library])],

@ -0,0 +1,69 @@
AC_DEFUN([LNAV_WITH_LOCAL_YAJL],
[
ENABLE_LOCAL_YAJL="no"
AC_ARG_WITH([yajl],
AC_HELP_STRING(
[--with-yajl=DIR],
[use a local installed version of yajl]
),
[
if test "$withval" != "no"; then
ENABLE_LOCAL_YAJL="yes"
modify_env_variables="no"
case "$withval" in
yes)
AC_MSG_NOTICE([Checking for yajl libs])
;;
*)
yajl_include="$withval/include"
yajl_ldflags="$withval/lib"
modify_env_variables="yes"
AC_MSG_NOTICE([Checking for yajl libs in $withval])
;;
esac
fi
]
)
HAVE_LOCAL_YAJL=0
YAJL_HAVE_LOCAL_HEADERS=0
YAJL_HAVE_LOCAL_LIBS=0
if test "$ENABLE_LOCAL_YAJL" != "no"; then
saved_ldflags=$LDFLAGS
saved_cppflags=$CPPFLAGS
saved_libtool_link_flags=$LIBTOOL_LIBK_FLAGS
if test "$modify_env_variables" != "no"; then
LNAV_ADDTO(CPPFLAGS, [-I${yajl_include}])
LNAV_ADDTO(LDFLAGS, [-L${yajl_ldflags}])
LNAV_ADDTO(LIBTOOL_LINK_FLAGS, [-R${yajl_ldflags}])
fi
AC_SEARCH_LIBS([yajl_gen_alloc], [yajl], [YAJL_HAVE_LOCAL_LIBS=1])
if test "$YAJL_HAVE_LOCAL_LIBS" != "0"; then
AC_MSG_NOTICE([Checking for yajl headers])
AC_CHECK_HEADERS([yajl/yajl_parse.h], [YAJL_HAVE_LOCAL_HEADERS=1])
if test "$YAJL_HAVE_LOCAL_HEADERS" != "0"; then
HAVE_LOCAL_YAJL=1
LNAV_ADDTO(LIBS, [-lyajl])
else
AC_MSG_WARN([yajl not found on the local system])
fi
if test "$HAVE_LOCAL_YAJL" = "0"; then
CPPFLAGS=$saved_cppflags
LDFLAGS=$saved_ldflags
LIBTOOL_LIBK_FLAGS=$saved_libtool_link_flags
fi
fi
fi
if test "$HAVE_LOCAL_YAJL" = "0"; then
AC_MSG_NOTICE([compiling with the included version of yajl])
fi
AC_SUBST(HAVE_LOCAL_YAJL)
])dnl
Loading…
Cancel
Save