Merge branch 'clone_fd'
[fuse.git] / configure.ac
blob513c4344319144f6c5e6c6e0e9ceafe1e68831c6
1 AC_INIT(fuse, 3.0.0_pre0)
2 AC_PREREQ(2.59d)
3 AC_CONFIG_MACRO_DIR([m4])
4 AC_CANONICAL_TARGET
5 AM_INIT_AUTOMAKE([subdir-objects])
6 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
7 AC_CONFIG_HEADERS(include/config.h)
9 AC_PROG_LIBTOOL
10 AC_PROG_CC_STDC
11 AC_SYS_LARGEFILE
12 AC_PROG_MKDIR_P
13 AM_PROG_CC_C_O
15 case $target_os in
16      *linux*)   arch=linux;;
17      *netbsd*)  arch=netbsd;;
18      *bsd*)     arch=bsd;;
19      *)         arch=unknown;;
20 esac
22 if test "$ac_env_CFLAGS_set" != set; then
23         CFLAGS="-Wall -W -Wno-sign-compare -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -g -O2 -fno-strict-aliasing"
26 AC_ARG_ENABLE(lib,
27         [  --enable-lib            Compile with library ])
28 AC_ARG_ENABLE(util,
29         [  --enable-util           Compile with util ])
30 AC_ARG_ENABLE(example,
31         [  --enable-example        Compile with examples ])
32 AC_ARG_ENABLE(mtab,
33         [  --disable-mtab          Disable and ignore usage of /etc/mtab ])
35 AC_ARG_WITH(pkgconfigdir,
36             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
37             [pkgconfigdir=$withval],
38             [pkgconfigdir='${libdir}/pkgconfig'])
39 AC_SUBST(pkgconfigdir)
41 subdirs2="include"
43 if test "$enable_lib" != "no"; then
44         subdirs2="$subdirs2 lib";
46 if test "$arch" = linux -a "$enable_util" != "no"; then
47         subdirs2="$subdirs2 util";
49 if test "$enable_example" != "no"; then
50         subdirs2="$subdirs2 example";
52 if test "$enable_mtab" = "no"; then
53         AC_DEFINE(IGNORE_MTAB, 1, [Don't update /etc/mtab])
56 AC_CHECK_FUNCS([fork setxattr fdatasync splice vmsplice utimensat pipe2])
57 AC_CHECK_FUNCS([posix_fallocate fstatat openat readlinkat])
58 AC_CHECK_MEMBERS([struct stat.st_atim])
59 AC_CHECK_MEMBERS([struct stat.st_atimespec])
61 LIBS=
62 AC_SEARCH_LIBS(dlopen, [dl])
63 AC_SEARCH_LIBS(clock_gettime, [rt])
64 libfuse_libs=$LIBS
65 LIBS=
66 AC_CHECK_LIB(ulockmgr, ulockmgr_op)
67 fusexmp_fh_libs=$LIBS
68 AC_SUBST(fusexmp_fh_libs)
69 LIBS=
71 AC_ARG_WITH([libiconv-prefix],
72 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
73     for dir in `echo "$withval" | tr : ' '`; do
74       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
75       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
76     done
77    ])
78 AM_ICONV
79 libfuse_libs="$libfuse_libs $LTLIBICONV"
80 AM_CONDITIONAL(ICONV, test "$am_cv_func_iconv" = yes)
81 AC_SUBST(libfuse_libs)
83 if test -z "$MOUNT_FUSE_PATH"; then
84         MOUNT_FUSE_PATH=/sbin
85         AC_MSG_NOTICE([MOUNT_FUSE_PATH env var not set, using default $MOUNT_FUSE_PATH])
87 AC_SUBST(MOUNT_FUSE_PATH)
88 if test -z "$UDEV_RULES_PATH"; then
89         UDEV_RULES_PATH="${prefix}/lib/udev/rules.d"
90         AC_MSG_NOTICE([UDEV_RULES_PATH env var not set, using default $UDEV_RULES_PATH])
92 AC_SUBST(UDEV_RULES_PATH)
93 if test -z "$INIT_D_PATH"; then
94         INIT_D_PATH=/etc/init.d
95         AC_MSG_NOTICE([INIT_D_PATH env var not set, using default $INIT_D_PATH])
97 AC_SUBST(INIT_D_PATH)
99 AC_SUBST(subdirs2)
101 AM_CONDITIONAL(LINUX, test "$arch" = linux)
102 AM_CONDITIONAL(NETBSD, test "$arch" = netbsd)
103 AM_CONDITIONAL(BSD, test "$arch" = bsd)
105 util_linux_ok=yes
106 if test "$arch" = linux -a "$cross_compiling" != "yes"; then
107         AC_MSG_CHECKING([if umount supports --fake --no-canonicalize])
108         # exit code of umount is 1 if option is unrecognised, 2 otherwise
109         umount --fake --no-canonicalize > /dev/null 2>&1
110         if test $? != 1; then
111                 AC_MSG_RESULT([yes])
112         else
113                 firstline=`umount --fake --no-canonicalize 2>&1 | head -1`
114                 if test "$firstline" = 'umount: only root can use "--fake" option'; then
115                         AC_MSG_RESULT([yes])
116                 else
117                         AC_MSG_RESULT([$firstline])
118                         util_linux_ok=no
119                 fi
120         fi
123 AC_CONFIG_FILES([fuse3.pc Makefile lib/Makefile util/Makefile example/Makefile include/Makefile doc/Makefile])
124 AC_OUTPUT
126 if test "$util_linux_ok" = no; then
127         AC_MSG_WARN([
128 ******************************************************************
129 * Please install util-linux version 2.18 or later which supports *
130 * --fake and --no-canonicalize options in mount and umount       *
131 ******************************************************************])