2 # configure.ac - Source file to generate "./configure" to prepare package for
5 # Copyright (c) 2000-2006 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],[2013.1.13],[ntfs-3g-devel@lists.sf.net])
28 LIBNTFS_3G_VERSION="84"
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([--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@:>@])],
163 [enable_nfconv="no"],
165 case "${target_os}" in
166 darwin*) enable_nfconv="yes" ;;
167 *) enable_nfconv="no" ;;
172 # pthread_rwlock_t requires _GNU_SOURCE
189 AC_PATH_PROG([MV], [mv])
190 AC_PATH_PROG([RM], [rm])
191 AC_PATH_PROG([SED], [sed])
192 AC_ARG_VAR([LDCONFIG], [ldconfig utility])
193 AC_PATH_PROG([LDCONFIG], [ldconfig], [true], [/sbin /usr/sbin $PATH])
196 AC_MSG_CHECKING([Windows OS])
198 *-mingw32*|*-winnt*|*-cygwin*)
204 [Define to 1 if this is a Windows OS]
213 if test "x${enable_ntfs_3g}" = "xyes"; then
214 AC_MSG_CHECKING([fuse compatibility])
215 case "${target_os}" in
219 [AS_HELP_STRING([--with-fuse=<internal|external>],[Select FUSE library: internal or external @<:@default=internal@:>@])],
221 [with_fuse="internal"]
224 darwin*|netbsd*|kfreebsd*-gnu)
228 AC_MSG_ERROR([Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs])
231 AC_MSG_ERROR([ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only.])
234 AC_MSG_RESULT([${with_fuse}])
239 case "${target_os}" in
241 if test "x$GCC" != "xyes" ; then
242 AC_MSG_ERROR([ntfs-3g can be built only with gcc on Solaris. Install it by 'pkg install gcc-dev' and retry.)])
247 if test "${enable_ldscript}" = "yes"; then
248 AC_MSG_CHECKING([Output format])
249 OUTPUT_FORMAT="$(${CC} ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | ${SED} -n 's/^OUTPUT_FORMAT("\([[^"]]*\)",.*/\1/p')"
250 if test -z "${OUTPUT_FORMAT}"; then
251 AC_MSG_RESULT([None])
253 AC_MSG_RESULT([${OUTPUT_FORMAT}])
254 OUTPUT_FORMAT="OUTPUT_FORMAT ( ${OUTPUT_FORMAT} )"
259 if test "${with_fuse}" = "internal"; then
263 [LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lpthread"],
264 [AC_MSG_ERROR([Cannot find pthread library])]
269 [Required define if using POSIX threads]
271 # required so that we re-compile anything
275 [Define to 1 if using internal fuse]
278 AC_MSG_CHECKING([Solaris OS])
283 [[#if !((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)))]]
284 [[#error "Not a Solaris system."]]
290 LIBFUSE_LITE_CFLAGS="${LIBFUSE_LITE_CFLAGS} -std=c99 -D__SOLARIS__ -D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
291 LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lxnet"
298 elif test "${with_fuse}" = "external"; then
299 if test -z "$PKG_CONFIG"; then
300 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
302 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/])
303 # Libraries often install their metadata .pc files in directories
304 # not searched by pkg-config. Let's workaround this.
305 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
311 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])
314 FUSE_LIB_PATH=`$PKG_CONFIG --libs-only-L fuse | sed -e 's,/[/]*,/,g' -e 's,[ ]*$,,'`
317 # Autodetect whether we can build crypto stuff or not.
319 if test "$enable_crypto" != "no"; then
321 AM_PATH_LIBGCRYPT(1.2.2, [ have_libgcrypt=true ],
323 if test "$enable_crypto" = "yes"; then
324 AC_MSG_ERROR([ntfsprogs crypto code requires the gcrypt library.])
326 AC_MSG_WARN([ntfsprogs crypto code requires the gcrypt library.])
330 PKG_CHECK_MODULES(GNUTLS, gnutls >= 1.4.4, [ have_libgnutls=true ],
331 if test "$enable_crypto" = "yes"; then
332 AC_MSG_ERROR([ntfsprogs crypto code requires the gnutls library.])
334 AC_MSG_WARN([ntfsprogs crypto code requires the gnutls library.])
337 if test "$have_libgcrypt" = "true"; then
338 if test "$have_libgnutls" = "true"; then
340 AC_DEFINE([ENABLE_CRYPTO], 1,
341 [Define this to 1 if you want to enable support of
342 encrypted files in libntfs and utilities.])
346 AM_CONDITIONAL(ENABLE_CRYPTO, $compile_crypto)
348 # add --with-extra-includes and --with-extra-libs switch to ./configure
349 all_libraries="$all_libraries $USER_LDFLAGS"
350 all_includes="$all_includes $USER_INCLUDES"
351 AC_SUBST(all_includes)
352 AC_SUBST(all_libraries)
354 # Specify support for generating DCE compliant UUIDs (aka GUIDs). We check if
355 # uuid/uuid.h header is present and the uuid library is present that goes with
356 # it and then check if uuid_generate() is present and usable.
358 # DCE UUIDs are enabled by default and can be disabled with the --disable-uuid
359 # option to the configure script.
361 --with-uuid@<:@=PFX@:>@ generate DCE compliant UUIDs, with optional prefix
362 to uuid library and headers @<:@default=detect@:>@
363 --without-uuid do not generate DCE compliant UUIDs],
364 if test "$with_uuid" = "yes"; then
366 elif test "$with_uuid" = "no"; then
373 if test "x$extrapath" != "x"; then
374 if test "x$extrapath" != "xdefault"; then
375 MKNTFS_CPPFLAGS="$MKNTFS_CPPFLAGS -I$extrapath/include"
376 MKNTFS_LIBS="$MKNTFS_LIBS -L$extrapath/lib"
379 search_for_luuid="yes"
380 AC_CHECK_HEADER([uuid/uuid.h],
383 AC_MSG_WARN([ntfsprogs DCE compliant UUID generation code requires the uuid library.])
384 search_for_luuid="no"
388 if test "x$search_for_luuid" != "xno"; then
389 # Look for uuid_generate in the standard C library.
390 AC_CHECK_FUNC([uuid_generate],
392 AC_DEFINE([ENABLE_UUID], 1,
393 [Define this to 1 if you want to enable
394 generation of DCE compliant UUIDs.])
395 search_for_luuid="no"
401 if test "x$search_for_luuid" != "xno"; then
402 # Look for uuid_generate in the 'uuid' library.
403 AC_CHECK_LIB([uuid], [uuid_generate],
405 AC_DEFINE([ENABLE_UUID], 1,
406 [Define this to 1 if you want to enable
407 generation of DCE compliant UUIDs.])
408 MKNTFS_LIBS="$MKNTFS_LIBS -luuid"
409 search_for_luuid="no"
415 if test "x$search_for_luuid" != "xno"; then
416 AC_MSG_WARN([ntfsprogs DCE compliant UUID generation code requires the uuid library.])
420 # Checks for header files.
422 AC_CHECK_HEADERS([ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \
423 mntent.h stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h \
424 strings.h errno.h time.h unistd.h utime.h wchar.h getopt.h features.h \
425 endian.h byteswap.h sys/byteorder.h sys/disk.h sys/endian.h \
426 sys/param.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/stat.h sys/types.h \
427 sys/vfs.h sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h \
428 linux/hdreg.h machine/endian.h windows.h syslog.h pwd.h malloc.h])
430 # Checks for typedefs, structures, and compiler characteristics.
436 [WORDS_LITTLEENDIAN],
438 [Define to 1 if your processor stores words with the least significant
439 byte first (like Intel and VAX, unlike Motorola and SPARC).]
449 AC_CHECK_MEMBERS([struct stat.st_rdev])
450 AC_CHECK_MEMBERS([struct stat.st_atim])
451 AC_CHECK_MEMBERS([struct stat.st_atimespec])
452 AC_CHECK_MEMBERS([struct stat.st_atimensec])
454 # For the 'nfconv' patch (Mac OS X only):
455 case "${target_os}" in
457 if test "${enable_nfconv}" = "yes"; then
459 [CoreFoundation/CoreFoundation.h],
461 LDFLAGS="${LDFLAGS} -framework CoreFoundation"
465 [Define to 1 if the nfconv patch should be enabled]
468 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.]])
474 # Checks for library functions.
483 atexit basename daemon dup2 fdatasync ffs getopt_long hasmntopt \
484 mbsinit memmove memset realpath regcomp setlocale setxattr \
485 strcasecmp strchr strdup strerror strnlen strsep strtol strtoul \
486 sysconf utime utimensat gettimeofday clock_gettime fork memcpy random snprintf \
490 if test "$GCC" = "yes" ; then
491 # We add -Wall to enable some compiler warnings.
492 CFLAGS="${CFLAGS} -Wall"
495 if test "${enable_pedantic}" = "yes"; then
496 enable_warnings="yes"
497 CFLAGS="${CFLAGS} -pedantic"
500 if test "${enable_warnings}" = "yes"; then
501 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"
504 if test "${enable_debug}" = "yes"; then
505 CFLAGS="${CFLAGS} -ggdb3 -DDEBUG"
509 [Define to 1 if debug should be enabled]
513 test "${enable_device_default_io_ops}" = "no" && AC_DEFINE(
514 [NO_NTFS_DEVICE_DEFAULT_IO_OPS],
516 [Don't use default IO ops]
519 test "${enable_mtab}" = "no" && AC_DEFINE([IGNORE_MTAB], [1], [Don't update /etc/mtab])
520 test "${enable_posix_acls}" != "no" && AC_DEFINE([POSIXACLS], [1], [POSIX ACL support])
521 test "${enable_xattr_mappings}" != "no" && AC_DEFINE([XATTR_MAPPINGS], [1], [system extended attributes mappings])
523 test "${enable_really_static}" = "yes" && enable_library="no"
524 test "${enable_library}" = "no" && enable_ldconfig="no"
526 if test "x${DISTCHECK_HACK}" != "x"; then
527 enable_mount_helper="no"
532 pkgconfigdir="\$(libdir)/pkgconfig"
533 ntfs3gincludedir="\$(includedir)/ntfs-3g"
534 # Executables should be installed to the root filesystem, otherwise
535 # automounting NTFS volumes can fail during boot if the driver binaries
536 # and their dependencies are on an unmounted partition. Use --exec-prefix
538 if test "x${exec_prefix}" = "xNONE"; then
541 rootlibdir="/lib${libdir##*/lib}"
543 rootbindir="\$(bindir)"
544 rootsbindir="\$(sbindir)"
545 rootlibdir="\$(libdir)"
547 AC_SUBST([pkgconfigdir])
548 AC_SUBST([ntfs3gincludedir])
549 AC_SUBST([rootbindir])
550 AC_SUBST([rootsbindir])
551 AC_SUBST([rootlibdir])
552 AC_SUBST([LIBNTFS_3G_VERSION])
553 AC_SUBST([LIBFUSE_LITE_CFLAGS])
554 AC_SUBST([LIBFUSE_LITE_LIBS])
555 AC_SUBST([MKNTFS_CPPFLAGS])
556 AC_SUBST([MKNTFS_LIBS])
557 AC_SUBST([OUTPUT_FORMAT])
558 AM_CONDITIONAL([FUSE_INTERNAL], [test "${with_fuse}" = "internal"])
559 AM_CONDITIONAL([GENERATE_LDSCRIPT], [test "${enable_ldscript}" = "yes"])
560 AM_CONDITIONAL([WINDOWS], [test "${WINDOWS}" = "yes"])
561 AM_CONDITIONAL([NTFS_DEVICE_DEFAULT_IO_OPS], [test "${enable_device_default_io_ops}" = "yes"])
562 AM_CONDITIONAL([RUN_LDCONFIG], [test "${enable_ldconfig}" = "yes"])
563 AM_CONDITIONAL([REALLYSTATIC], [test "${enable_really_static}" = "yes"])
564 AM_CONDITIONAL([INSTALL_LIBRARY], [test "${enable_library}" = "yes"])
565 AM_CONDITIONAL([ENABLE_MOUNT_HELPER], [test "${enable_mount_helper}" = "yes"])
566 AM_CONDITIONAL([ENABLE_NTFS_3G], [test "${enable_ntfs_3g}" = "yes"])
567 AM_CONDITIONAL([ENABLE_NTFSPROGS], [test "${enable_ntfsprogs}" = "yes"])
568 AM_CONDITIONAL([ENABLE_EXTRAS], [test "${enable_extras}" = "yes"])
570 # workaround for <autoconf-2.60
571 if test -z "${docdir}"; then
572 docdir="\$(datarootdir)/doc/\$(PACKAGE_NAME)"
575 # workaround for <automake-1.10
576 if test -z "${MKDIR_P}"; then
577 MKDIR_P="\$(mkdir_p)"
585 include/fuse-lite/Makefile
586 include/ntfs-3g/Makefile
587 libfuse-lite/Makefile
589 libntfs-3g/libntfs-3g.pc
590 libntfs-3g/libntfs-3g.script.so
594 ntfsprogs/ntfsclone.8
595 ntfsprogs/ntfscluster.8
600 ntfsprogs/ntfslabel.8
602 ntfsprogs/ntfsprogs.8
603 ntfsprogs/ntfsresize.8
604 ntfsprogs/ntfsundelete.8
608 src/ntfs-3g.usermap.8
609 src/ntfs-3g.secaudit.8
613 if test "${with_fuse}" = "external"; then
614 if ! echo "x$FUSE_LIB_PATH" | grep -- "x-L/lib" > /dev/null; then
616 ****************************************************************************
617 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING *
618 * The FUSE user space binaries were NOT installed with root directory *
619 * executable prefix. This means that automounting NTFS volumes during boot *
620 * could fail. This can be fixed the below way by reinstalling FUSE using *
621 * the right 'configure' option during FUSE compilation: *
622 * ./configure --exec-prefix=/ *
623 * make && sudo make install *
624 * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING *
625 ****************************************************************************
630 echo "You can type now 'make' to build ntfs-3g."