2 # configure.ac - Source file to generate "./configure" to prepare package for
5 # Copyright (c) 2000-2013 Anton Altaparmakov
6 # Copyright (c) 2003 Jan Kratochvil
7 # Copyright (c) 2005-2009 Szabolcs Szakacsits
8 # Copyright (C) 2007-2008 Alon Bar-Lev
10 # This program/include file is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as published
12 # by the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program/include file is distributed in the hope that it will be
16 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program (in the main directory of the NTFS-3G
22 # distribution in the file COPYING); if not, write to the Free Software
23 # Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 AC_INIT([ntfs-3g],[2015.3.14],[ntfs-3g-devel@lists.sf.net])
28 LIBNTFS_3G_VERSION="86"
29 AC_CONFIG_SRCDIR([src/ntfs-3g.c])
36 AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
37 AC_CONFIG_HEADERS([config.h])
38 AC_CONFIG_MACRO_DIR([m4])
44 [AS_HELP_STRING([--enable-debug],[enable debugging code and output])],
51 [AS_HELP_STRING([--enable-warnings],[enable lots of compiler warnings])],
53 [enable_warnings="no"]
58 [AS_HELP_STRING([--enable-pedantic],[enable compile pedantic mode])],
60 [enable_pedantic="no"]
65 [AS_HELP_STRING([--enable-really-static],[create fully static binaries])],
67 [enable_really_static="no"]
72 [AS_HELP_STRING([--enable-mount-helper],[install mount helper @<:@default=enabled for linux@:>@])],
75 case "${target_os}" in
76 linux*) enable_mount_helper="yes" ;;
77 *) enable_mount_helper="no" ;;
84 [AS_HELP_STRING([--enable-ldscript],[use ldscript instead of .so symlink])],
86 [enable_ldscript="no"]
91 [AS_HELP_STRING([--disable-ldconfig],[do not update dynamic linker cache using ldconfig])],
93 [enable_ldconfig="yes"]
98 [AS_HELP_STRING([--disable-library],[do not install libntfs-3g but link it into ntfs-3g])],
100 [enable_library="yes"]
105 [AS_HELP_STRING([--disable-mtab],[disable and ignore usage of /etc/mtab])],
112 [AS_HELP_STRING([--enable-posix-acls],[enable POSIX ACL support])],
114 [enable_posix_acls="no"]
119 [AS_HELP_STRING([--enable-xattr-mappings],[enable system extended attributes mappings])],
121 [enable_xattr_mappings="no"]
125 [device-default-io-ops],
126 [AS_HELP_STRING([--disable-device-default-io-ops],[install default IO ops])],
128 [enable_device_default_io_ops="yes"]
133 [AS_HELP_STRING([--disable-ntfs-3g],[disable the ntfs-3g FUSE driver])],
135 [enable_ntfs_3g="yes"]
140 [AS_HELP_STRING([--disable-ntfsprogs],[disable ntfsprogs utilities
143 [enable_ntfsprogs="yes"]
146 AC_ARG_ENABLE(crypto,
147 AS_HELP_STRING(--enable-crypto,enable crypto related code and utilities
154 [AS_HELP_STRING([--enable-extras],[enable extra ntfsprogs utilities
162 [AS_HELP_STRING([--enable-quarantined],[enable quarantined ntfsprogs utilities
165 [enable_quarantined="no"]
170 [AS_HELP_STRING([--disable-nfconv],[disable the 'nfconv' patch, which adds support for Unicode normalization form conversion when built on Mac OS X @<:@default=enabled for Mac OS X@:>@])],
171 [enable_nfconv="no"],
173 case "${target_os}" in
174 darwin*) enable_nfconv="yes" ;;
175 *) enable_nfconv="no" ;;
180 # pthread_rwlock_t requires _GNU_SOURCE
197 AC_PATH_PROG([MV], [mv])
198 AC_PATH_PROG([RM], [rm])
199 AC_PATH_PROG([SED], [sed])
200 AC_ARG_VAR([LDCONFIG], [ldconfig utility])
201 AC_PATH_PROG([LDCONFIG], [ldconfig], [true], [/sbin /usr/sbin $PATH])
204 AC_MSG_CHECKING([Windows OS])
206 *-mingw32*|*-winnt*|*-cygwin*)
212 [Define to 1 if this is a Windows OS]
221 if test "x${enable_ntfs_3g}" = "xyes"; then
222 AC_MSG_CHECKING([fuse compatibility])
223 case "${target_os}" in
227 [AS_HELP_STRING([--with-fuse=<internal|external>],[Select FUSE library: internal or external @<:@default=internal@:>@])],
229 [with_fuse="internal"]
232 darwin*|netbsd*|kfreebsd*-gnu)
236 AC_MSG_ERROR([Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs])
239 AC_MSG_ERROR([ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only.])
242 AC_MSG_RESULT([${with_fuse}])
247 case "${target_os}" in
249 if test "x$GCC" != "xyes" ; then
250 AC_MSG_ERROR([ntfs-3g can be built only with gcc on Solaris. Install it by 'pkg install gcc-dev' and retry.)])
255 if test "${enable_ldscript}" = "yes"; then
256 AC_MSG_CHECKING([Output format])
257 OUTPUT_FORMAT="$(${CC} ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | ${SED} -n 's/^OUTPUT_FORMAT("\([[^"]]*\)",.*/\1/p')"
258 if test -z "${OUTPUT_FORMAT}"; then
259 AC_MSG_RESULT([None])
261 AC_MSG_RESULT([${OUTPUT_FORMAT}])
262 OUTPUT_FORMAT="OUTPUT_FORMAT ( ${OUTPUT_FORMAT} )"
267 if test "${with_fuse}" = "internal"; then
271 [LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lpthread"],
272 [AC_MSG_ERROR([Cannot find pthread library])]
277 [Required define if using POSIX threads]
279 # required so that we re-compile anything
283 [Define to 1 if using internal fuse]
286 AC_MSG_CHECKING([Solaris OS])
291 [[#if !((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)))]]
292 [[#error "Not a Solaris system."]]
298 LIBFUSE_LITE_CFLAGS="${LIBFUSE_LITE_CFLAGS} -std=c99 -D__SOLARIS__ -D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
299 LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lxnet"
306 elif test "${with_fuse}" = "external"; then
307 if test -z "$PKG_CONFIG"; then
308 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
310 test "x${PKG_CONFIG}" = "xno" && AC_MSG_ERROR([pkg-config wasn't found! Please install from your vendor, or see http://pkg-config.freedesktop.org/wiki/])
311 # Libraries often install their metadata .pc files in directories
312 # not searched by pkg-config. Let's workaround this.
313 export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/lib/pkgconfig:/usr/lib/pkgconfig:/opt/gnome/lib/pkgconfig:/usr/share/pkgconfig:/usr/local/lib/pkgconfig:$prefix/lib/pkgconfig:/opt/gnome/share/pkgconfig:/usr/local/share/pkgconfig
319 AC_MSG_ERROR([FUSE >= 2.6.0 was not found. Either older FUSE is still present, or FUSE is not fully installed (e.g. fuse, libfuse, libfuse2, libfuse-dev, etc packages). Source code: http://fuse.sf.net])
322 FUSE_LIB_PATH=`$PKG_CONFIG --libs-only-L fuse | sed -e 's,/[/]*,/,g' -e 's,[ ]*$,,'`
325 # Autodetect whether we can build crypto stuff or not.
327 if test "$enable_crypto" != "no"; then
329 AM_PATH_LIBGCRYPT(1.2.2, [ have_libgcrypt=true ],
331 if test "$enable_crypto" = "yes"; then
332 AC_MSG_ERROR([ntfsprogs crypto code requires the gcrypt library.])
334 AC_MSG_WARN([ntfsprogs crypto code requires the gcrypt library.])
338 PKG_CHECK_MODULES(GNUTLS, gnutls >= 1.4.4, [ have_libgnutls=true ],
339 if test "$enable_crypto" = "yes"; then
340 AC_MSG_ERROR([ntfsprogs crypto code requires the gnutls library.])
342 AC_MSG_WARN([ntfsprogs crypto code requires the gnutls library.])
345 if test "$have_libgcrypt" = "true"; then
346 if test "$have_libgnutls" = "true"; then
348 AC_DEFINE([ENABLE_CRYPTO], 1,
349 [Define this to 1 if you want to enable support of
350 encrypted files in libntfs and utilities.])
354 AM_CONDITIONAL(ENABLE_CRYPTO, $compile_crypto)
356 # add --with-extra-includes and --with-extra-libs switch to ./configure
357 all_libraries="$all_libraries $USER_LDFLAGS"
358 all_includes="$all_includes $USER_INCLUDES"
359 AC_SUBST(all_includes)
360 AC_SUBST(all_libraries)
362 # Specify support for generating DCE compliant UUIDs (aka GUIDs). We check if
363 # uuid/uuid.h header is present and the uuid library is present that goes with
364 # it and then check if uuid_generate() is present and usable.
366 # DCE UUIDs are enabled by default and can be disabled with the --disable-uuid
367 # option to the configure script.
369 --with-uuid@<:@=PFX@:>@ generate DCE compliant UUIDs, with optional prefix
370 to uuid library and headers @<:@default=detect@:>@
371 --without-uuid do not generate DCE compliant UUIDs],
372 if test "$with_uuid" = "yes"; then
374 elif test "$with_uuid" = "no"; then
381 if test "x$extrapath" != "x"; then
382 if test "x$extrapath" != "xdefault"; then
383 MKNTFS_CPPFLAGS="$MKNTFS_CPPFLAGS -I$extrapath/include"
384 MKNTFS_LIBS="$MKNTFS_LIBS -L$extrapath/lib"
387 search_for_luuid="yes"
388 AC_CHECK_HEADER([uuid/uuid.h],
391 AC_MSG_WARN([ntfsprogs DCE compliant UUID generation code requires the uuid library.])
392 search_for_luuid="no"
396 if test "x$search_for_luuid" != "xno"; then
397 # Look for uuid_generate in the standard C library.
398 AC_CHECK_FUNC([uuid_generate],
400 AC_DEFINE([ENABLE_UUID], 1,
401 [Define this to 1 if you want to enable
402 generation of DCE compliant UUIDs.])
403 search_for_luuid="no"
409 if test "x$search_for_luuid" != "xno"; then
410 # Look for uuid_generate in the 'uuid' library.
411 AC_CHECK_LIB([uuid], [uuid_generate],
413 AC_DEFINE([ENABLE_UUID], 1,
414 [Define this to 1 if you want to enable
415 generation of DCE compliant UUIDs.])
416 MKNTFS_LIBS="$MKNTFS_LIBS -luuid"
417 search_for_luuid="no"
423 if test "x$search_for_luuid" != "xno"; then
424 AC_MSG_WARN([ntfsprogs DCE compliant UUID generation code requires the uuid library.])
428 # Specify support for obtaining the correct BIOS legacy geometry needed for
429 # Windows to boot in CHS mode. We check if hd.h header is present and the hd
430 # library is present that goes with it and then check if the hd_list() function
431 # is present and usable.
433 # Using the hd library is enabled by default and can be disabled with the
434 # --disable-hd option to the configure script.
436 --with-hd@<:@=PFX@:>@ use Windows compliant disk geometry, with optional
437 prefix to hd library and headers @<:@default=detect@:>@
438 --without-hd do not use Windows compliant disk geometry],
439 if test "$with_hd" = "yes"; then
441 elif test "$with_hd" = "no"; then
448 if test "x$extrapath2" != "x"; then
449 if test "x$extrapath2" != "xdefault"; then
450 LIBNTFS_CPPFLAGS="$LIBNTFS_CPPFLAGS -I$extrapath2/include"
451 LIBNTFS_LIBS="$LIBNTFS_LIBS -L$extrapath2/lib"
453 AC_CHECK_HEADER([hd.h],
454 AC_CHECK_LIB([hd], [hd_list],
455 AC_DEFINE([ENABLE_HD], 1,
456 [Define this to 1 if you want to enable use of Windows
457 compliant disk geometry.])
458 LIBNTFS_LIBS="$LIBNTFS_LIBS -lhd"
459 NTFSPROGS_STATIC_LIBS="$NTFSPROGS_STATIC_LIBS -lhd",
460 AC_MSG_WARN([ntfsprogs Windows compliant geometry code requires the hd library.]),
462 AC_MSG_WARN([ntfsprogs Windows compliant geometry code requires the hd library.]),
466 # Checks for header files.
468 AC_CHECK_HEADERS([ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \
469 mntent.h stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h \
470 strings.h errno.h time.h unistd.h utime.h wchar.h getopt.h features.h \
471 regex.h endian.h byteswap.h sys/byteorder.h sys/disk.h sys/endian.h \
472 sys/param.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/stat.h sys/types.h \
473 sys/vfs.h sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h \
474 linux/fs.h inttypes.h linux/hdreg.h \
475 machine/endian.h windows.h syslog.h pwd.h malloc.h])
477 # Checks for typedefs, structures, and compiler characteristics.
483 [WORDS_LITTLEENDIAN],
485 [Define to 1 if your processor stores words with the least significant
486 byte first (like Intel and VAX, unlike Motorola and SPARC).]
496 AC_CHECK_MEMBERS([struct stat.st_rdev])
497 AC_CHECK_MEMBERS([struct stat.st_atim])
498 AC_CHECK_MEMBERS([struct stat.st_atimespec])
499 AC_CHECK_MEMBERS([struct stat.st_atimensec])
501 # For the 'nfconv' patch (Mac OS X only):
502 case "${target_os}" in
504 if test "${enable_nfconv}" = "yes"; then
506 [CoreFoundation/CoreFoundation.h],
508 LDFLAGS="${LDFLAGS} -framework CoreFoundation"
512 [Define to 1 if the nfconv patch should be enabled]
515 AC_MSG_ERROR([[Cannot find CoreFoundation required for 'nfconv' functionality Mac OS X. You may use the --disable-nfconv 'configure' option to avoid this error.]])
521 # Checks for library functions.
530 atexit basename daemon dup2 fdatasync ffs getopt_long hasmntopt \
531 mbsinit memmove memset realpath regcomp setlocale setxattr \
532 strcasecmp strchr strdup strerror strnlen strsep strtol strtoul \
533 sysconf utime utimensat gettimeofday clock_gettime fork memcpy random snprintf \
537 if test "$GCC" = "yes" ; then
538 # We add -Wall to enable some compiler warnings.
539 CFLAGS="${CFLAGS} -Wall"
542 if test "${enable_pedantic}" = "yes"; then
543 enable_warnings="yes"
544 CFLAGS="${CFLAGS} -pedantic"
547 if test "${enable_warnings}" = "yes"; then
548 CFLAGS="${CFLAGS} -W -Wall -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wmultichar -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wformat -Wformat-security -Wuninitialized"
551 if test "${enable_debug}" = "yes"; then
552 CFLAGS="${CFLAGS} -ggdb3 -DDEBUG"
556 [Define to 1 if debug should be enabled]
560 test "${enable_device_default_io_ops}" = "no" && AC_DEFINE(
561 [NO_NTFS_DEVICE_DEFAULT_IO_OPS],
563 [Don't use default IO ops]
566 test "${enable_mtab}" = "no" && AC_DEFINE([IGNORE_MTAB], [1], [Don't update /etc/mtab])
567 test "${enable_posix_acls}" != "no" && AC_DEFINE([POSIXACLS], [1], [POSIX ACL support])
568 test "${enable_xattr_mappings}" != "no" && AC_DEFINE([XATTR_MAPPINGS], [1], [system extended attributes mappings])
570 test "${enable_really_static}" = "yes" && enable_library="no"
571 test "${enable_library}" = "no" && enable_ldconfig="no"
573 if test "x${DISTCHECK_HACK}" != "x"; then
574 enable_mount_helper="no"
579 pkgconfigdir="\$(libdir)/pkgconfig"
580 ntfs3gincludedir="\$(includedir)/ntfs-3g"
581 # Executables should be installed to the root filesystem, otherwise
582 # automounting NTFS volumes can fail during boot if the driver binaries
583 # and their dependencies are on an unmounted partition. Use --exec-prefix
585 if test "x${exec_prefix}" = "xNONE"; then
588 rootlibdir="/lib${libdir##*/lib}"
590 rootbindir="\$(bindir)"
591 rootsbindir="\$(sbindir)"
592 rootlibdir="\$(libdir)"
594 AC_SUBST([pkgconfigdir])
595 AC_SUBST([ntfs3gincludedir])
596 AC_SUBST([rootbindir])
597 AC_SUBST([rootsbindir])
598 AC_SUBST([rootlibdir])
599 AC_SUBST([LIBNTFS_3G_VERSION])
600 AC_SUBST([LIBFUSE_LITE_CFLAGS])
601 AC_SUBST([LIBFUSE_LITE_LIBS])
602 AC_SUBST([MKNTFS_CPPFLAGS])
603 AC_SUBST([MKNTFS_LIBS])
604 AC_SUBST([LIBNTFS_CPPFLAGS])
605 AC_SUBST([LIBNTFS_LIBS])
606 AC_SUBST([NTFSPROGS_STATIC_LIBS])
607 AC_SUBST([OUTPUT_FORMAT])
608 AM_CONDITIONAL([FUSE_INTERNAL], [test "${with_fuse}" = "internal"])
609 AM_CONDITIONAL([GENERATE_LDSCRIPT], [test "${enable_ldscript}" = "yes"])
610 AM_CONDITIONAL([WINDOWS], [test "${WINDOWS}" = "yes"])
611 AM_CONDITIONAL([NTFS_DEVICE_DEFAULT_IO_OPS], [test "${enable_device_default_io_ops}" = "yes"])
612 AM_CONDITIONAL([RUN_LDCONFIG], [test "${enable_ldconfig}" = "yes"])
613 AM_CONDITIONAL([REALLYSTATIC], [test "${enable_really_static}" = "yes"])
614 AM_CONDITIONAL([INSTALL_LIBRARY], [test "${enable_library}" = "yes"])
615 AM_CONDITIONAL([ENABLE_MOUNT_HELPER], [test "${enable_mount_helper}" = "yes"])
616 AM_CONDITIONAL([ENABLE_NTFS_3G], [test "${enable_ntfs_3g}" = "yes"])
617 AM_CONDITIONAL([ENABLE_NTFSPROGS], [test "${enable_ntfsprogs}" = "yes"])
618 AM_CONDITIONAL([ENABLE_EXTRAS], [test "${enable_extras}" = "yes"])
619 AM_CONDITIONAL([ENABLE_QUARANTINED], [test "${enable_quarantined}" = "yes"])
621 # workaround for <autoconf-2.60
622 if test -z "${docdir}"; then
623 docdir="\$(datarootdir)/doc/\$(PACKAGE_NAME)"
626 # workaround for <automake-1.10
627 if test -z "${MKDIR_P}"; then
628 MKDIR_P="\$(mkdir_p)"
636 include/fuse-lite/Makefile
637 include/ntfs-3g/Makefile
638 libfuse-lite/Makefile
640 libntfs-3g/libntfs-3g.pc
641 libntfs-3g/libntfs-3g.script.so
645 ntfsprogs/ntfsclone.8
646 ntfsprogs/ntfscluster.8
651 ntfsprogs/ntfslabel.8
653 ntfsprogs/ntfsprogs.8
654 ntfsprogs/ntfsresize.8
655 ntfsprogs/ntfsundelete.8
656 ntfsprogs/ntfsdecrypt.8
658 ntfsprogs/ntfstruncate.8
659 ntfsprogs/ntfsfallocate.8
663 src/ntfs-3g.usermap.8
664 src/ntfs-3g.secaudit.8
668 if test "${with_fuse}" = "external"; then
669 if ! echo "x$FUSE_LIB_PATH" | grep -- "x-L/lib" > /dev/null; then
671 ****************************************************************************
672 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING *
673 * The FUSE user space binaries were NOT installed with root directory *
674 * executable prefix. This means that automounting NTFS volumes during boot *
675 * could fail. This can be fixed the below way by reinstalling FUSE using *
676 * the right 'configure' option during FUSE compilation: *
677 * ./configure --exec-prefix=/ *
678 * make && sudo make install *
679 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING *
680 ****************************************************************************
685 echo "You can type now 'make' to build ntfs-3g."