Merge branch 'fuse_2_9_bugfix'
[fuse.git] / configure.ac
blob274ac70ad3b2919cc0ec69cb631889e0a183d189
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
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
11 AC_PROG_MKDIR_P
12 AM_PROG_CC_C_O
14 case $target_os in
15      *linux*)   arch=linux;;
16      *netbsd*)  arch=netbsd;;
17      *bsd*)     arch=bsd;;
18      *)         arch=unknown;;
19 esac
21 if test "$ac_env_CFLAGS_set" != set; then
22         CFLAGS="-Wall -W -Wno-sign-compare -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings -g -O2 -fno-strict-aliasing"
25 AC_ARG_ENABLE(lib,
26         [  --enable-lib            Compile with library ])
27 AC_ARG_ENABLE(util,
28         [  --enable-util           Compile with util ])
29 AC_ARG_ENABLE(example,
30         [  --enable-example        Compile with examples ])
31 AC_ARG_ENABLE(mtab,
32         [  --disable-mtab          Disable and ignore usage of /etc/mtab ])
34 AC_ARG_WITH(pkgconfigdir,
35             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
36             [pkgconfigdir=$withval],
37             [pkgconfigdir='${libdir}/pkgconfig'])
38 AC_SUBST(pkgconfigdir)
40 subdirs2="include"
42 if test "$enable_lib" != "no"; then
43         subdirs2="$subdirs2 lib";
45 if test "$arch" = linux -a "$enable_util" != "no"; then
46         subdirs2="$subdirs2 util";
48 if test "$enable_example" != "no"; then
49         subdirs2="$subdirs2 example";
51 if test "$enable_mtab" = "no"; then
52         AC_DEFINE(IGNORE_MTAB, 1, [Don't update /etc/mtab])
55 AC_CHECK_FUNCS([fork setxattr fdatasync splice vmsplice utimensat])
56 AC_CHECK_FUNCS([posix_fallocate])
57 AC_CHECK_MEMBERS([struct stat.st_atim])
58 AC_CHECK_MEMBERS([struct stat.st_atimespec])
60 LIBS=
61 AC_SEARCH_LIBS(dlopen, [dl])
62 AC_SEARCH_LIBS(clock_gettime, [rt])
63 libfuse_libs=$LIBS
64 LIBS=
65 AC_ARG_WITH([libiconv-prefix],
66 [  --with-libiconv-prefix=DIR  search for libiconv in DIR/include and DIR/lib], [
67     for dir in `echo "$withval" | tr : ' '`; do
68       if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
69       if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
70     done
71    ])
72 AM_ICONV
73 libfuse_libs="$libfuse_libs $LTLIBICONV"
74 AM_CONDITIONAL(ICONV, test "$am_cv_func_iconv" = yes)
75 AC_SUBST(libfuse_libs)
77 if test -z "$MOUNT_FUSE_PATH"; then
78         MOUNT_FUSE_PATH=/sbin
80 AC_SUBST(MOUNT_FUSE_PATH)
81 if test -z "$UDEV_RULES_PATH"; then
82         UDEV_RULES_PATH=/etc/udev/rules.d
84 AC_SUBST(UDEV_RULES_PATH)
85 if test -z "$INIT_D_PATH"; then
86         INIT_D_PATH=/etc/init.d
88 AC_SUBST(INIT_D_PATH)
90 AC_SUBST(subdirs2)
92 AM_CONDITIONAL(LINUX, test "$arch" = linux)
93 AM_CONDITIONAL(NETBSD, test "$arch" = netbsd)
94 AM_CONDITIONAL(BSD, test "$arch" = bsd)
96 util_linux_ok=yes
97 if test "$arch" = linux -a "$cross_compiling" != "yes"; then
98         AC_MSG_CHECKING([if umount supports --fake --no-canonicalize])
99         # exit code of umount is 1 if option is unrecognised, 2 otherwise
100         umount --fake --no-canonicalize > /dev/null 2>&1
101         if test $? != 1; then
102                 AC_MSG_RESULT([yes])
103         else
104                 firstline=`umount --fake --no-canonicalize 2>&1 | head -1`
105                 if test "$firstline" = 'umount: only root can use "--fake" option'; then
106                         AC_MSG_RESULT([yes])
107                 else
108                         AC_MSG_RESULT([$firstline])
109                         util_linux_ok=no
110                 fi
111         fi
114 AC_CONFIG_FILES([fuse.pc Makefile lib/Makefile util/Makefile example/Makefile include/Makefile doc/Makefile])
115 AC_OUTPUT
117 if test "$util_linux_ok" = no; then
118         AC_MSG_WARN([
119 ******************************************************************
120 * Please install util-linux version 2.18 or later which supports *
121 * --fake and --no-canonicalize options in mount and umount       *
122 ******************************************************************])