| 1 |
dnl Checks for libfuse required headers and functions |
| 2 |
dnl |
| 3 |
dnl Version: 20240413 |
| 4 |
|
| 5 |
dnl Function to detect if libfuse is available |
| 6 |
dnl ac_libfuse_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l<library> arguments |
| 7 |
AC_DEFUN([AX_LIBFUSE_CHECK_LIB], |
| 8 |
[AS_IF( |
| 9 |
[test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfuse" = xno], |
| 10 |
[ac_cv_libfuse=no], |
| 11 |
[dnl Check if the directory provided as parameter exists |
| 12 |
dnl For both --with-libfuse which returns "yes" and --with-libfuse= which returns "" |
| 13 |
dnl treat them as auto-detection. |
| 14 |
AS_IF( |
| 15 |
[test "x$ac_cv_with_libfuse" != x && test "x$ac_cv_with_libfuse" != xauto-detect && test "x$ac_cv_with_libfuse" != xyes], |
| 16 |
[AS_IF( |
| 17 |
[test -d "$ac_cv_with_libfuse"], |
| 18 |
[CFLAGS="$CFLAGS -I${ac_cv_with_libfuse}/include" |
| 19 |
LDFLAGS="$LDFLAGS -L${ac_cv_with_libfuse}/lib"], |
| 20 |
[AC_MSG_FAILURE( |
| 21 |
[no such directory: $ac_cv_with_libfuse], |
| 22 |
[1]) |
| 23 |
])], |
| 24 |
[dnl Check for a pkg-config file |
| 25 |
AS_IF( |
| 26 |
[test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], |
| 27 |
[PKG_CHECK_MODULES( |
| 28 |
[fuse3], |
| 29 |
[fuse3 >= 3.0], |
| 30 |
[ac_cv_libfuse=libfuse3], |
| 31 |
[ac_cv_libfuse=no]) |
| 32 |
|
| 33 |
AS_IF( |
| 34 |
[test "x$ac_cv_libfuse" = xno], |
| 35 |
[PKG_CHECK_MODULES( |
| 36 |
[fuse], |
| 37 |
[fuse >= 2.6], |
| 38 |
[ac_cv_libfuse=libfuse], |
| 39 |
[ac_cv_libfuse=no]) |
| 40 |
]) |
| 41 |
|
| 42 |
AS_IF( |
| 43 |
[test "x$ac_cv_libfuse" = xlibfuse3], |
| 44 |
[ac_cv_libfuse_CPPFLAGS="$pkg_cv_fuse3_CFLAGS -D_FILE_OFFSET_BITS=64" |
| 45 |
ac_cv_libfuse_LIBADD="$pkg_cv_fuse3_LIBS"]) |
| 46 |
|
| 47 |
AS_IF( |
| 48 |
[test "x$ac_cv_libfuse" = xlibfuse], |
| 49 |
[ac_cv_libfuse_CPPFLAGS="$pkg_cv_fuse_CFLAGS -D_FILE_OFFSET_BITS=64" |
| 50 |
ac_cv_libfuse_LIBADD="$pkg_cv_fuse_LIBS"]) |
| 51 |
]) |
| 52 |
]) |
| 53 |
|
| 54 |
backup_CPPFLAGS="$CPPFLAGS" |
| 55 |
|
| 56 |
dnl Check for libfuse and libfuse3 |
| 57 |
AS_IF( |
| 58 |
[test "x$ac_cv_libfuse" != xlibfuse && test "x$ac_cv_libfuse" != xlibfuse3], |
| 59 |
[dnl Check for headers |
| 60 |
|
| 61 |
CPPFLAGS="$backup_CPPFLAGS -DFUSE_USE_VERSION=30" |
| 62 |
AC_CHECK_HEADERS([fuse.h]) |
| 63 |
|
| 64 |
AS_IF( |
| 65 |
[test "x$ac_cv_header_fuse_h" = xyes], |
| 66 |
[ac_cv_libfuse=libfuse3], |
| 67 |
[CPPFLAGS="$backup_CPPFLAGS -DFUSE_USE_VERSION=26" |
| 68 |
AC_CHECK_HEADERS([fuse.h]) |
| 69 |
|
| 70 |
AS_IF( |
| 71 |
[test "x$ac_cv_header_fuse_h" = xyes], |
| 72 |
[ac_cv_libfuse=libfuse]) |
| 73 |
]) |
| 74 |
|
| 75 |
AS_IF( |
| 76 |
[test "x$ac_cv_header_fuse_h" = xno], |
| 77 |
[ac_cv_libfuse=no], |
| 78 |
[dnl Check for the individual functions |
| 79 |
AC_CHECK_LIB( |
| 80 |
fuse, |
| 81 |
fuse_invalidate, |
| 82 |
[ac_cv_libfuse=libfuse], |
| 83 |
[ac_cv_libfuse=libfuse3]) |
| 84 |
|
| 85 |
AC_CHECK_LIB( |
| 86 |
fuse, |
| 87 |
fuse_daemonize, |
| 88 |
[ac_cv_libfuse_dummy=yes], |
| 89 |
[ac_cv_libfuse=no]) |
| 90 |
AC_CHECK_LIB( |
| 91 |
fuse, |
| 92 |
fuse_destroy, |
| 93 |
[ac_cv_libfuse_dummy=yes], |
| 94 |
[ac_cv_libfuse=no]) |
| 95 |
AC_CHECK_LIB( |
| 96 |
fuse, |
| 97 |
fuse_mount, |
| 98 |
[ac_cv_libfuse_dummy=yes], |
| 99 |
[ac_cv_libfuse=no]) |
| 100 |
AC_CHECK_LIB( |
| 101 |
fuse, |
| 102 |
fuse_new, |
| 103 |
[ac_cv_libfuse_dummy=yes], |
| 104 |
[ac_cv_libfuse=no]) |
| 105 |
|
| 106 |
dnl libfuse and libfuse3 require -D_FILE_OFFSET_BITS=64 to be set |
| 107 |
ac_cv_libfuse_CPPFLAGS="-D_FILE_OFFSET_BITS=64" |
| 108 |
|
| 109 |
AS_IF( |
| 110 |
[test "x$ac_cv_libfuse" = xlibfuse3], |
| 111 |
[ac_cv_libfuse_LIBADD="-lfuse3"], |
| 112 |
[ac_cv_libfuse_LIBADD="-lfuse"]) |
| 113 |
]) |
| 114 |
]) |
| 115 |
|
| 116 |
dnl Check for libosxfuse |
| 117 |
AS_IF( |
| 118 |
[test "x$ac_cv_with_libfuse" != xno && test "x$ac_cv_header_fuse_h" = xno], |
| 119 |
[CPPFLAGS="$backup_CPPFLAGS -DFUSE_USE_VERSION=26" |
| 120 |
AC_CHECK_HEADERS([osxfuse/fuse.h]) |
| 121 |
|
| 122 |
AS_IF( |
| 123 |
[test "x$ac_cv_header_osxfuse_fuse_h" = xno], |
| 124 |
[ac_cv_libfuse=no], |
| 125 |
[dnl Check for the individual functions |
| 126 |
ac_cv_libfuse=libosxfuse |
| 127 |
|
| 128 |
AC_CHECK_LIB( |
| 129 |
osxfuse, |
| 130 |
fuse_daemonize, |
| 131 |
[ac_cv_libfuse_dummy=yes], |
| 132 |
[ac_cv_libfuse=no]) |
| 133 |
AC_CHECK_LIB( |
| 134 |
osxfuse, |
| 135 |
fuse_destroy, |
| 136 |
[ac_cv_libfuse_dummy=yes], |
| 137 |
[ac_cv_libfuse=no]) |
| 138 |
AC_CHECK_LIB( |
| 139 |
osxfuse, |
| 140 |
fuse_mount, |
| 141 |
[ac_cv_libfuse_dummy=yes], |
| 142 |
[ac_cv_libfuse=no]) |
| 143 |
AC_CHECK_LIB( |
| 144 |
osxfuse, |
| 145 |
fuse_new, |
| 146 |
[ac_cv_libfuse_dummy=yes], |
| 147 |
[ac_cv_libfuse=no]) |
| 148 |
|
| 149 |
dnl libosxfuse requires -D_FILE_OFFSET_BITS=64 to be set |
| 150 |
ac_cv_libfuse_CPPFLAGS="-D_FILE_OFFSET_BITS=64" |
| 151 |
|
| 152 |
ac_cv_libfuse_LIBADD="-losxfuse"; |
| 153 |
]) |
| 154 |
]) |
| 155 |
|
| 156 |
AS_IF( |
| 157 |
[test "x$ac_cv_libfuse" != xyes && test "x$ac_cv_with_libfuse" != x && test "x$ac_cv_with_libfuse" != xauto-detect && test "x$ac_cv_with_libfuse" != xyes], |
| 158 |
[AC_MSG_FAILURE( |
| 159 |
[unable to find supported libfuse in directory: $ac_cv_with_libfuse], |
| 160 |
[1]) |
| 161 |
]) |
| 162 |
|
| 163 |
CPPFLAGS="$backup_CPPFLAGS" |
| 164 |
]) |
| 165 |
|
| 166 |
AS_IF( |
| 167 |
[test "x$ac_cv_libfuse" = xlibfuse], |
| 168 |
[AC_DEFINE( |
| 169 |
[HAVE_LIBFUSE], |
| 170 |
[1], |
| 171 |
[Define to 1 if you have the 'fuse' library (-lfuse).]) |
| 172 |
]) |
| 173 |
AS_IF( |
| 174 |
[test "x$ac_cv_libfuse" = xlibfuse3], |
| 175 |
[AC_DEFINE( |
| 176 |
[HAVE_LIBFUSE3], |
| 177 |
[1], |
| 178 |
[Define to 1 if you have the 'fuse3' library (-lfuse3).]) |
| 179 |
]) |
| 180 |
AS_IF( |
| 181 |
[test "x$ac_cv_libfuse" = xlibosxfuse], |
| 182 |
[AC_DEFINE( |
| 183 |
[HAVE_LIBOSXFUSE], |
| 184 |
[1], |
| 185 |
[Define to 1 if you have the 'osxfuse' library (-losxfuse).]) |
| 186 |
]) |
| 187 |
|
| 188 |
AS_IF( |
| 189 |
[test "x$ac_cv_libfuse" != xno], |
| 190 |
[AC_SUBST( |
| 191 |
[HAVE_LIBFUSE], |
| 192 |
[1]) ], |
| 193 |
[AC_SUBST( |
| 194 |
[HAVE_LIBFUSE], |
| 195 |
[0]) |
| 196 |
]) |
| 197 |
]) |
| 198 |
|
| 199 |
dnl Function to detect how to enable libfuse |
| 200 |
AC_DEFUN([AX_LIBFUSE_CHECK_ENABLE], |
| 201 |
[AX_COMMON_ARG_WITH( |
| 202 |
[libfuse], |
| 203 |
[libfuse], |
| 204 |
[search for libfuse in includedir and libdir or in the specified DIR, or no if not to use libfuse], |
| 205 |
[auto-detect], |
| 206 |
[DIR]) |
| 207 |
|
| 208 |
dnl Check for a shared library version |
| 209 |
AX_LIBFUSE_CHECK_LIB |
| 210 |
|
| 211 |
AS_IF( |
| 212 |
[test "x$ac_cv_libfuse_CPPFLAGS" != "x"], |
| 213 |
[AC_SUBST( |
| 214 |
[LIBFUSE_CPPFLAGS], |
| 215 |
[$ac_cv_libfuse_CPPFLAGS]) |
| 216 |
]) |
| 217 |
AS_IF( |
| 218 |
[test "x$ac_cv_libfuse_LIBADD" != "x"], |
| 219 |
[AC_SUBST( |
| 220 |
[LIBFUSE_LIBADD], |
| 221 |
[$ac_cv_libfuse_LIBADD]) |
| 222 |
]) |
| 223 |
|
| 224 |
AS_IF( |
| 225 |
[test "x$ac_cv_libfuse" = xlibfuse], |
| 226 |
[AC_SUBST( |
| 227 |
[ax_libfuse_pc_libs_private], |
| 228 |
[-lfuse]) |
| 229 |
]) |
| 230 |
AS_IF( |
| 231 |
[test "x$ac_cv_libfuse" = xlibfuse3], |
| 232 |
[AC_SUBST( |
| 233 |
[ax_libfuse_pc_libs_private], |
| 234 |
[-lfuse3]) |
| 235 |
]) |
| 236 |
AS_IF( |
| 237 |
[test "x$ac_cv_libfuse" = xlibosxfuse], |
| 238 |
[AC_SUBST( |
| 239 |
[ax_libfuse_pc_libs_private], |
| 240 |
[-losxfuse]) |
| 241 |
]) |
| 242 |
|
| 243 |
AS_IF( |
| 244 |
[test "x$ac_cv_libfuse" = xlibfuse], |
| 245 |
[AC_SUBST( |
| 246 |
[ax_libfuse_spec_requires], |
| 247 |
[fuse-libs]) |
| 248 |
AC_SUBST( |
| 249 |
[ax_libfuse_spec_build_requires], |
| 250 |
[fuse-devel]) |
| 251 |
]) |
| 252 |
AS_IF( |
| 253 |
[test "x$ac_cv_libfuse" = xlibfuse3], |
| 254 |
[AC_SUBST( |
| 255 |
[ax_libfuse_spec_requires], |
| 256 |
[fuse3-libs]) |
| 257 |
AC_SUBST( |
| 258 |
[ax_libfuse_spec_build_requires], |
| 259 |
[fuse3-devel]) |
| 260 |
]) |
| 261 |
]) |
| 262 |
|