nut/m4/nut_check_libneon.m4

69 lines
2 KiB
Text
Raw Permalink Normal View History

2010-03-25 23:20:59 +00:00
dnl Check for LIBNEON compiler flags. On success, set nut_have_neon="yes"
2011-01-26 09:35:08 +00:00
dnl and set LIBNEON_CFLAGS and LIBNEON_LIBS. On failure, set
2010-03-25 23:20:59 +00:00
dnl nut_have_neon="no". This macro can be run multiple times, but will
dnl do the checking only once.
AC_DEFUN([NUT_CHECK_LIBNEON],
[
if test -z "${nut_have_neon_seen}"; then
nut_have_neon_seen=yes
2011-01-26 09:35:08 +00:00
dnl save CFLAGS and LIBS
2010-03-25 23:20:59 +00:00
CFLAGS_ORIG="${CFLAGS}"
2011-01-26 09:35:08 +00:00
LIBS_ORIG="${LIBS}"
2010-03-25 23:20:59 +00:00
dnl See which version of the neon library (if any) is installed
AC_MSG_CHECKING(for libneon version via pkg-config (0.25.0 minimum required))
2011-01-26 09:35:08 +00:00
NEON_VERSION="`pkg-config --silence-errors --modversion neon 2>/dev/null`"
if test "$?" != "0" -o -z "${NEON_VERSION}"; then
NEON_VERSION="none"
2010-03-25 23:20:59 +00:00
fi
2011-01-26 09:35:08 +00:00
AC_MSG_RESULT(${NEON_VERSION} found)
2010-03-25 23:20:59 +00:00
AC_MSG_CHECKING(for libneon cflags)
2011-01-26 09:35:08 +00:00
AC_ARG_WITH(neon-includes,
AS_HELP_STRING([@<:@--with-neon-includes=CFLAGS@:>@], [include flags for the neon library]),
[
case "${withval}" in
yes|no)
AC_MSG_ERROR(invalid option --with(out)-neon-includes - see docs/configure.txt)
;;
*)
CFLAGS="${withval}"
;;
esac
], [CFLAGS="`pkg-config --silence-errors --cflags neon 2>/dev/null`"])
2010-03-25 23:20:59 +00:00
AC_MSG_RESULT([${CFLAGS}])
AC_MSG_CHECKING(for libneon ldflags)
2011-01-26 09:35:08 +00:00
AC_ARG_WITH(neon-libs,
AS_HELP_STRING([@<:@--with-neon-libs=LIBS@:>@], [linker flags for the neon library]),
[
case "${withval}" in
yes|no)
AC_MSG_ERROR(invalid option --with(out)-neon-libs - see docs/configure.txt)
;;
*)
LIBS="${withval}"
;;
esac
], [LIBS="`pkg-config --silence-errors --libs neon 2>/dev/null`"])
AC_MSG_RESULT([${LIBS}])
2010-03-25 23:20:59 +00:00
dnl check if neon is usable
AC_CHECK_HEADERS(ne_xmlreq.h, [nut_have_neon=yes], [nut_have_neon=no], [AC_INCLUDES_DEFAULT])
AC_CHECK_FUNCS(ne_xml_dispatch_request, [], [nut_have_neon=no])
if test "${nut_have_neon}" = "yes"; then
dnl Check for connect timeout support in library (optional)
AC_CHECK_FUNCS(ne_set_connect_timeout ne_sock_connect_timeout)
LIBNEON_CFLAGS="${CFLAGS}"
2011-01-26 09:35:08 +00:00
LIBNEON_LIBS="${LIBS}"
2010-03-25 23:20:59 +00:00
fi
2011-01-26 09:35:08 +00:00
dnl restore original CFLAGS and LIBS
2010-03-25 23:20:59 +00:00
CFLAGS="${CFLAGS_ORIG}"
2011-01-26 09:35:08 +00:00
LIBS="${LIBS_ORIG}"
2010-03-25 23:20:59 +00:00
fi
])