2 dnl # Check for a libfetch - either fetch(3) or libcurl.
4 dnl # There are two configuration dimensions:
5 dnl # * fetch(3) vs libcurl
6 dnl # * static vs dynamic
8 dnl # fetch(3) is only dynamic.
9 dnl # We use sover 6, which first appeared in FreeBSD 8.0-RELEASE.
11 dnl # libcurl development packages include curl-config(1) – we want:
13 dnl # * version at least 7.16 (October 2006), for sover 4
14 dnl # * to decide if it's static or not
16 AC_DEFUN([ZFS_AC_CONFIG_USER_LIBFETCH], [
17 AC_MSG_CHECKING([for libfetch])
27 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
28 #include <sys/param.h>
31 ]], [fetchGetURL("", "");])], [
35 LIBFETCH_SONAME="libfetch.so.6"
37 AC_MSG_RESULT([fetch(3)])
41 if test -z "$have_libfetch"; then
42 if curl-config --protocols 2>/dev/null | grep -q HTTPS &&
43 test "$(printf "%u" "0x$(curl-config --vernum)")" -ge "$(printf "%u" "0x071000")"; then
46 if test "$(curl-config --built-shared)" = "yes"; then
48 LIBFETCH_SONAME="libcurl.so.4"
50 AC_MSG_RESULT([libcurl])
52 LIBFETCH_LIBS="$(curl-config --libs)"
53 AC_MSG_RESULT([libcurl (static)])
56 CCFLAGS="$CCFLAGS $(curl-config --cflags)"
60 if test -z "$have_libfetch"; then
64 AC_SUBST([LIBFETCH_LIBS])
65 AC_SUBST([LIBFETCH_DYNAMIC])
66 AC_SUBST([LIBFETCH_SONAME])
67 AC_DEFINE_UNQUOTED([LIBFETCH_IS_FETCH], [$LIBFETCH_IS_FETCH], [libfetch is fetch(3)])
68 AC_DEFINE_UNQUOTED([LIBFETCH_IS_LIBCURL], [$LIBFETCH_IS_LIBCURL], [libfetch is libcurl])
69 AC_DEFINE_UNQUOTED([LIBFETCH_DYNAMIC], [$LIBFETCH_DYNAMIC], [whether the chosen libfetch is to be loaded at run-time])
70 AC_DEFINE_UNQUOTED([LIBFETCH_SONAME], ["$LIBFETCH_SONAME"], [soname of chosen libfetch])