ntfs-3g version 2010.3.6
[tomato.git] / release / src / router / ntfs-3g / configure.ac
blobfe9709085cc5f1cad7ea53c7db4b5be0d204c410
2 # configure.ac - Source file to generate "./configure" to prepare package for
3 #                compilation.
5 # Copyright (c) 2000-2006 Anton Altaparmakov
6 # Copyright (c) 2005-2009 Szabolcs Szakacsits
7 # Copyright (C) 2007-2008 Alon Bar-Lev
9 # This program/include file is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as published
11 # by the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program/include file is distributed in the hope that it will be
15 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program (in the main directory of the NTFS-3G
21 # distribution in the file COPYING); if not, write to the Free Software
22 # Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 # Autoconf
25 AC_PREREQ(2.59)
26 AC_INIT([ntfs-3g],[2010.3.6],[ntfs-3g-devel@lists.sf.net])
27 LIBNTFS_3G_VERSION="75"
28 AC_CONFIG_SRCDIR([src/ntfs-3g.c])
30 # Environment
31 AC_CANONICAL_HOST
32 AC_CANONICAL_TARGET
34 # Automake
35 AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
36 AC_CONFIG_HEADERS([config.h])
37 AC_CONFIG_MACRO_DIR([m4])
38 AM_MAINTAINER_MODE
40 # Options
41 AC_ARG_ENABLE(
42         [debug],
43         [AS_HELP_STRING([--enable-debug],[enable debugging code and output])],
44         ,
45         [enable_debug="no"]
48 AC_ARG_ENABLE(
49         [warnings],
50         [AS_HELP_STRING([--enable-warnings],[enable lots of compiler warnings])],
51         ,
52         [enable_warnings="no"]
55 AC_ARG_ENABLE(
56         [pedantic],
57         [AS_HELP_STRING([--enable-pedantic],[enable compile pedantic mode])],
58         ,
59         [enable_pedantic="no"]
62 AC_ARG_ENABLE(
63         [really-static],
64         [AS_HELP_STRING([--enable-really-static],[create fully static binaries])],
65         ,
66         [enable_really_static="no"]
69 AC_ARG_ENABLE(
70         [mount-helper],
71         [AS_HELP_STRING([--enable-mount-helper],[install mount helper @<:@default=enabled for linux@:>@])],
72         ,
73         [
74                 case "${target_os}" in
75                         linux*) enable_mount_helper="yes" ;;
76                         *) enable_mount_helper="no" ;;
77                 esac
78         ]
81 AC_ARG_ENABLE(
82         [ldscript],
83         [AS_HELP_STRING([--enable-ldscript],[use ldscript instead of .so symlink])],
84         ,
85         [enable_ldscript="no"]
88 AC_ARG_ENABLE(
89         [ldconfig],
90         [AS_HELP_STRING([--disable-ldconfig],[do not update dynamic linker cache using ldconfig])],
91         ,
92         [enable_ldconfig="yes"]
95 AC_ARG_ENABLE(
96         [library],
97         [AS_HELP_STRING([--disable-library],[do not install libntfs-3g but link it into ntfs-3g])],
98         ,
99         [enable_library="yes"]
102 AC_ARG_ENABLE(
103         [mtab],
104         [AS_HELP_STRING([--disable-mtab],[disable and ignore usage of /etc/mtab])],
105         ,
106         [enable_mtab="yes"]
109 AC_ARG_ENABLE(
110         [posix-acls],
111         [AS_HELP_STRING([--enable-posix-acls],[enable POSIX ACL support])],
112         ,
113         [enable_posix_acls="no"]
116 AC_ARG_ENABLE(
117         [device-default-io-ops],
118         [AS_HELP_STRING([--disable-device-default-io-ops],[install default IO ops])],
119         ,
120         [enable_device_default_io_ops="yes"]
123 AC_ARG_ENABLE(
124         [nfconv],
125         [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@:>@])],
126         [enable_nfconv="no"],
127         [
128                 case "${target_os}" in
129                         darwin*) enable_nfconv="yes" ;;
130                         *) enable_nfconv="no" ;;
131                 esac
132         ]
135 # pthread_rwlock_t requires _GNU_SOURCE
136 AC_GNU_SOURCE
138 # Programs
139 AC_PROG_CC(gcc cc)
140 AC_PROG_LN_S
141 AM_PROG_CC_C_O
143 ifdef(
144         [LT_INIT],
145         [LT_INIT],
146         [AC_PROG_LIBTOOL]
149 AC_PATH_PROG([MV], [mv])
150 AC_PATH_PROG([RM], [rm])
151 AC_PATH_PROG([SED], [sed])
152 AC_ARG_VAR([LDCONFIG], [ldconfig utility])
153 AC_PATH_PROG([LDCONFIG], [ldconfig], [true], [/sbin /usr/sbin $PATH])
155 # Environment
156 AC_MSG_CHECKING([Windows OS])
157 case "${target}" in
158 *-mingw32*|*-winnt*|*-cygwin*)
159         AC_MSG_RESULT([yes])
160         WINDOWS="yes"
161         AC_DEFINE(
162                 [WINDOWS],
163                 [1],
164                 [Define to 1 if this is a Windows OS]
165         )
166         ;;
168         AC_MSG_RESULT([no])
169         WINDOWS="no"
170         ;;
171 esac
173 AC_MSG_CHECKING([fuse compatibility])
174 case "${target_os}" in
175 linux*)
176         AC_ARG_WITH(
177                 [fuse],
178                 [AS_HELP_STRING([--with-fuse=<internal|external>],[Select FUSE library: internal or external @<:@default=internal@:>@])],
179                 ,
180                 [with_fuse="internal"]
181         )
182         ;;
183 darwin*|netbsd*|solaris*)
184         with_fuse="external"
185         ;;
186 freebsd*)
187         AC_MSG_ERROR([Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs])
188         ;;
190         AC_MSG_ERROR([ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only.])
191         ;;
192 esac
193 AC_MSG_RESULT([${with_fuse}])
195 case "${target_os}" in
196 solaris*)
197         if test "x$GCC" != "xyes" ; then
198                 AC_MSG_ERROR([ntfs-3g can be built only with gcc on Solaris. Install it by 'pkg install gcc-dev' and retry.)])
199         fi
200         ;;
201 esac
203 if test "${enable_ldscript}" = "yes"; then
204         AC_MSG_CHECKING([Output format])
205         OUTPUT_FORMAT="$(${CC} ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | ${SED} -n 's/^OUTPUT_FORMAT("\([[^"]]*\)",.*/\1/p')"
206         if test -z "${OUTPUT_FORMAT}"; then
207                 AC_MSG_RESULT([None])
208         else
209                 AC_MSG_RESULT([${OUTPUT_FORMAT}])
210                 OUTPUT_FORMAT="OUTPUT_FORMAT ( ${OUTPUT_FORMAT} )"
211         fi
214 # Libraries
215 if test "${with_fuse}" = "internal"; then
216         AC_CHECK_LIB(
217                 [pthread],
218                 [pthread_create],
219                 [LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lpthread"],
220                 [AC_MSG_ERROR([Cannot find pthread library])]
221         )
222         AC_DEFINE(
223                 [_REENTRANT],
224                 [1],
225                 [Required define if using POSIX threads]
226         )
227         # required so that we re-compile anything
228         AC_DEFINE(
229                 [FUSE_INTERNAL],
230                 [1],
231                 [Define to 1 if using internal fuse]
232         )
233 else
234         if test -z "$PKG_CONFIG"; then
235                 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
236         fi
237         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/])
238         # Libraries often install their metadata .pc files in directories
239         # not searched by pkg-config. Let's workaround this. 
240         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
241         PKG_CHECK_MODULES(
242                 [FUSE_MODULE],
243                 [fuse >= 2.6.0],
244                 ,
245                 [
246                         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])
247                 ]
248         )
249         FUSE_LIB_PATH=`$PKG_CONFIG --libs-only-L fuse | sed -e 's,/[/]*,/,g' -e 's,[ ]*$,,'`
252 # Checks for header files.
253 AC_HEADER_STDC
254 AC_CHECK_HEADERS([ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \
255         mntent.h stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h \
256         strings.h errno.h time.h unistd.h utime.h wchar.h getopt.h features.h \
257         endian.h byteswap.h sys/byteorder.h sys/endian.h sys/param.h \
258         sys/ioctl.h sys/mkdev.h sys/mount.h sys/stat.h sys/types.h sys/vfs.h \
259         sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h linux/hdreg.h \
260         machine/endian.h windows.h syslog.h])
262 # Checks for typedefs, structures, and compiler characteristics.
263 AC_HEADER_STDBOOL
264 AC_C_BIGENDIAN(
265         ,
266         [
267                 AC_DEFINE(
268                         [WORDS_LITTLEENDIAN],
269                         [1],
270                         [Define to 1 if your processor stores words with the least significant
271                         byte first (like Intel and VAX, unlike Motorola and SPARC).]
272                 )
273         ]
274         ,
276 AC_C_INLINE
277 AC_TYPE_OFF_T
278 AC_TYPE_SIZE_T
279 AC_STRUCT_ST_BLOCKS
280 AC_CHECK_MEMBERS([struct stat.st_rdev])
281 AC_CHECK_MEMBERS([struct stat.st_atim])
282 AC_CHECK_MEMBERS([struct stat.st_atimespec])
284 # For the 'nfconv' patch (Mac OS X only):
285 case "${target_os}" in
286 darwin*)
287         if test "${enable_nfconv}" = "yes"; then
288                 AC_CHECK_HEADER(
289                         [CoreFoundation/CoreFoundation.h],
290                         [
291                                 LDFLAGS="${LDFLAGS} -framework CoreFoundation"
292                                 AC_DEFINE(
293                                         [ENABLE_NFCONV],
294                                         [1],
295                                         [Define to 1 if the nfconv patch should be enabled]
296                                 )
297                         ],
298                         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.]])
299                 )
300         fi
301         ;;
302 esac
304 # Checks for library functions.
305 AC_FUNC_GETMNTENT
306 AC_FUNC_MBRTOWC
307 AC_FUNC_MEMCMP
308 AC_FUNC_STAT
309 AC_FUNC_STRFTIME
310 AC_FUNC_UTIME_NULL
311 AC_FUNC_VPRINTF
312 AC_CHECK_FUNCS([ \
313         atexit basename daemon dup2 fdatasync ffs getopt_long hasmntopt \
314         mbsinit memmove memset realpath regcomp setlocale setxattr \
315         strcasecmp strchr strdup strerror strnlen strsep strtol strtoul \
316         sysconf utime utimensat gettimeofday clock_gettime fork \
318 AC_SYS_LARGEFILE
320 if test "$GCC" = "yes" ; then
321         # We add -Wall to enable some compiler warnings.
322         CFLAGS="${CFLAGS} -Wall"
325 if test "${enable_pedantic}" = "yes"; then
326         enable_warnings="yes"
327         CFLAGS="${CFLAGS} -pedantic"
330 if test "${enable_warnings}" = "yes"; then
331         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"
334 if test "${enable_debug}" = "yes"; then
335         CFLAGS="${CFLAGS} -ggdb3 -DDEBUG"
336         AC_DEFINE(
337                 [ENABLE_DEBUG],
338                 [1],
339                 [Define to 1 if debug should be enabled]
340         )
343 test "${enable_device_default_io_ops}" = "no" && AC_DEFINE(
344         [NO_NTFS_DEVICE_DEFAULT_IO_OPS],
345         [1],
346         [Don't use default IO ops]
349 test "${enable_mtab}" = "no" && AC_DEFINE([IGNORE_MTAB], [1], [Don't update /etc/mtab])
350 test "${enable_posix_acls}" != "no" && AC_DEFINE([POSIXACLS], [1], [POSIX ACL support])
352 test "${enable_really_static}" = "yes" && enable_library="no"
353 test "${enable_library}" = "no" && enable_ldconfig="no"
355 if test "x${DISTCHECK_HACK}" != "x"; then
356         enable_mount_helper="no"
357         enable_ldconfig="no"
360 # Settings
361 pkgconfigdir="\$(libdir)/pkgconfig"
362 ntfs3gincludedir="\$(includedir)/ntfs-3g"
363 # Executables should be installed to the root filesystem, otherwise 
364 # automounting NTFS volumes can fail during boot if the driver binaries 
365 # and their dependencies are on an unmounted partition. Use --exec-prefix
366 # to override this.
367 if test "x${exec_prefix}" = "xNONE"; then
368         rootbindir="/bin"
369         rootsbindir="/sbin"
370         rootlibdir="/lib${libdir##*/lib}"
371 else
372         rootbindir="\$(bindir)"
373         rootsbindir="\$(sbindir)"
374         rootlibdir="\$(libdir)"
376 AC_SUBST([pkgconfigdir])
377 AC_SUBST([ntfs3gincludedir])
378 AC_SUBST([rootbindir])
379 AC_SUBST([rootsbindir])
380 AC_SUBST([rootlibdir])
381 AC_SUBST([LIBNTFS_3G_VERSION])
382 AC_SUBST([LIBFUSE_LITE_LIBS])
383 AC_SUBST([OUTPUT_FORMAT])
384 AM_CONDITIONAL([FUSE_INTERNAL], [test "${with_fuse}" = "internal"])
385 AM_CONDITIONAL([GENERATE_LDSCRIPT], [test "${enable_ldscript}" = "yes"])
386 AM_CONDITIONAL([WINDOWS], [test "${WINDOWS}" = "yes"])
387 AM_CONDITIONAL([NTFS_DEVICE_DEFAULT_IO_OPS], [test "${enable_device_default_io_ops}" = "yes"])
388 AM_CONDITIONAL([RUN_LDCONFIG], [test "${enable_ldconfig}" = "yes"])
389 AM_CONDITIONAL([REALLYSTATIC], [test "${enable_really_static}" = "yes"])
390 AM_CONDITIONAL([INSTALL_LIBRARY], [test "${enable_library}" = "yes"])
391 AM_CONDITIONAL([ENABLE_MOUNT_HELPER], [test "${enable_mount_helper}" = "yes"])
393 # workaround for <autoconf-2.60
394 if test -z "${docdir}"; then
395         docdir="\$(datarootdir)/doc/\$(PACKAGE_NAME)"
396         AC_SUBST([docdir])
398 # workaround for <automake-1.10
399 if test -z "${MKDIR_P}"; then
400         MKDIR_P="\$(mkdir_p)"
401         AC_SUBST([MKDIR_P])
404 # generate files
405 AC_CONFIG_FILES([
406         Makefile
407         include/Makefile
408         include/fuse-lite/Makefile
409         include/ntfs-3g/Makefile
410         libfuse-lite/Makefile
411         libntfs-3g/Makefile
412         libntfs-3g/libntfs-3g.pc
413         libntfs-3g/libntfs-3g.script.so
414         src/Makefile
415         src/ntfs-3g.8
416         src/ntfs-3g.probe.8
417         src/ntfs-3g.usermap.8
418         src/ntfs-3g.secaudit.8
420 AC_OUTPUT
422 if test "${with_fuse}" = "external"; then
423         if ! echo "x$FUSE_LIB_PATH" | grep -- "x-L/lib" > /dev/null; then
424                 cat <<EOF
425 ****************************************************************************
426 * WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING   *
427 * The FUSE user space binaries were NOT installed with root directory      *
428 * executable prefix. This means that automounting NTFS volumes during boot *
429 * could fail. This can be fixed the below way by reinstalling FUSE using   *
430 * the right 'configure' option during FUSE compilation:                    *
431 *       ./configure --exec-prefix=/                                        *
432 *       make && sudo make install                                          *
433 * WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING   *
434 ****************************************************************************
436         fi
439 echo "You can type now 'make' to build ntfs-3g."