fuse: Autodetect Solaris 11 FUSE
[openafs.git] / src / cf / fuse.m4
1 dnl FUSE Autoconf glue.  Build with FUSE if it's available; if it's not,
2 dnl don't enable the FUSE build.  If --enable is given explicitly, FUSE
3 dnl must be found or we bail out.
4
5 AC_DEFUN([OPENAFS_FUSE_DEFS],
6  [ENABLE_FUSE_CLIENT=afsd.fuse
7   CLIENT_UAFS_DEP=libuafs])
8
9 dnl Solaris 11 has a FUSE package, but it does not come with a pkg-config
10 dnl fuse.pc configuration. The libraries, headers, etc are in predictable
11 dnl places, though.
12 AC_DEFUN([OPENAFS_SUN511_FUSE],
13  [AS_CASE([$AFS_SYSNAME],
14    [sun4x_511|sunx86_511],
15     [sol11fuse=
16      fuse_cppflags=-D_FILE_OFFSET_BITS=64
17      save_CPPFLAGS="$CPPFLAGS"
18      CPPFLAGS="$fuse_cppflags $CPPFLAGS"
19      AC_CHECK_HEADER([fuse.h], [sol11fuse=yes])
20      AS_IF([test x"$sol11fuse" = xyes],
21       [FUSE_CFLAGS="$fuse_cppflags"
22        FUSE_LIBS=-lfuse
23        openafs_fuse=yes
24        OPENAFS_FUSE_DEFS])
25      CPPFLAGS="$save_CPPFLAGS"])])
26
27 AC_DEFUN([OPENAFS_FUSE],
28 [openafs_fuse=
29  ENABLE_FUSE_CLIENT=
30  CLIENT_UAFS_DEP=
31  AC_ARG_ENABLE([fuse-client],
32     [AS_HELP_STRING([--disable-fuse-client],
33         [disable building of the FUSE userspace client, afsd.fuse
34          (defaults to enabled)])],
35     [openafs_fuse="$enableval"])
36
37  AS_IF([test -z "$openafs_fuse"],
38     [PKG_CHECK_EXISTS([fuse], [openafs_fuse=yes], [OPENAFS_SUN511_FUSE])])
39
40  AS_IF([test x"$openafs_fuse" = xyes && test x"$ENABLE_FUSE_CLIENT" = x],
41     [PKG_CHECK_MODULES([FUSE], [fuse],
42        [OPENAFS_FUSE_DEFS],
43        [OPENAFS_SUN511_FUSE
44            AS_IF([test x"ENABLE_FUSE_CLIENT" = x],
45                [AC_MSG_ERROR(["$FUSE_PACKAGE_ERRORS"])])])])
46  AC_SUBST([ENABLE_FUSE_CLIENT])
47  AC_SUBST([CLIENT_UAFS_DEP])
48  AC_SUBST([FUSE_CFLAGS])
49  AC_SUBST([FUSE_LIBS])])