summaryrefslogtreecommitdiff
path: root/configure.ac (plain)
blob: 2b578af46e566e4dcac6f8207571decc405c47bb
1#
2# configure.ac - Source file to generate "./configure" to prepare package for
3# compilation.
4#
5# Copyright (c) 2000-2006 Anton Altaparmakov
6# Copyright (c) 2005-2009 Szabolcs Szakacsits
7# Copyright (C) 2007-2008 Alon Bar-Lev
8#
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.
13#
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.
18#
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
23
24# Autoconf
25AC_PREREQ(2.59)
26AC_INIT([ntfs-3g],[2010.5.16],[ntfs-3g-devel@lists.sf.net])
27LIBNTFS_3G_VERSION="76"
28AC_CONFIG_SRCDIR([src/ntfs-3g.c])
29
30# Environment
31AC_CANONICAL_HOST
32AC_CANONICAL_TARGET
33
34# Automake
35AM_INIT_AUTOMAKE([${PACKAGE_NAME}], [${PACKAGE_VERSION}])
36AC_CONFIG_HEADERS([config.h])
37AC_CONFIG_MACRO_DIR([m4])
38AM_MAINTAINER_MODE
39
40# Options
41AC_ARG_ENABLE(
42 [debug],
43 [AS_HELP_STRING([--enable-debug],[enable debugging code and output])],
44 ,
45 [enable_debug="no"]
46)
47
48AC_ARG_ENABLE(
49 [warnings],
50 [AS_HELP_STRING([--enable-warnings],[enable lots of compiler warnings])],
51 ,
52 [enable_warnings="no"]
53)
54
55AC_ARG_ENABLE(
56 [pedantic],
57 [AS_HELP_STRING([--enable-pedantic],[enable compile pedantic mode])],
58 ,
59 [enable_pedantic="no"]
60)
61
62AC_ARG_ENABLE(
63 [really-static],
64 [AS_HELP_STRING([--enable-really-static],[create fully static binaries])],
65 ,
66 [enable_really_static="no"]
67)
68
69AC_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 ]
79)
80
81AC_ARG_ENABLE(
82 [ldscript],
83 [AS_HELP_STRING([--enable-ldscript],[use ldscript instead of .so symlink])],
84 ,
85 [enable_ldscript="no"]
86)
87
88AC_ARG_ENABLE(
89 [ldconfig],
90 [AS_HELP_STRING([--disable-ldconfig],[do not update dynamic linker cache using ldconfig])],
91 ,
92 [enable_ldconfig="yes"]
93)
94
95AC_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"]
100)
101
102AC_ARG_ENABLE(
103 [mtab],
104 [AS_HELP_STRING([--disable-mtab],[disable and ignore usage of /etc/mtab])],
105 ,
106 [enable_mtab="yes"]
107)
108
109AC_ARG_ENABLE(
110 [posix-acls],
111 [AS_HELP_STRING([--enable-posix-acls],[enable POSIX ACL support])],
112 ,
113 [enable_posix_acls="no"]
114)
115
116AC_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"]
121)
122
123AC_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 ]
133)
134
135# pthread_rwlock_t requires _GNU_SOURCE
136AC_GNU_SOURCE
137
138# Programs
139AC_PROG_CC(gcc cc)
140AC_PROG_LN_S
141AM_PROG_CC_C_O
142
143ifdef(
144 [LT_INIT],
145 [LT_INIT],
146 [AC_PROG_LIBTOOL]
147)
148
149AC_PATH_PROG([MV], [mv])
150AC_PATH_PROG([RM], [rm])
151AC_PATH_PROG([SED], [sed])
152AC_ARG_VAR([LDCONFIG], [ldconfig utility])
153AC_PATH_PROG([LDCONFIG], [ldconfig], [true], [/sbin /usr/sbin $PATH])
154
155# Environment
156AC_MSG_CHECKING([Windows OS])
157case "${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 ;;
167*)
168 AC_MSG_RESULT([no])
169 WINDOWS="no"
170 ;;
171esac
172
173AC_MSG_CHECKING([fuse compatibility])
174case "${target_os}" in
175linux*)
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 ;;
183darwin*|netbsd*|solaris*)
184 with_fuse="external"
185 ;;
186freebsd*)
187 AC_MSG_ERROR([Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs])
188 ;;
189*)
190 AC_MSG_ERROR([ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only.])
191 ;;
192esac
193AC_MSG_RESULT([${with_fuse}])
194
195case "${target_os}" in
196solaris*)
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 ;;
201esac
202
203if 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
212fi
213
214# Libraries
215if 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 )
233else
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,[ ]*$,,'`
250fi
251
252# Checks for header files.
253AC_HEADER_STDC
254AC_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])
261
262# Checks for typedefs, structures, and compiler characteristics.
263AC_HEADER_STDBOOL
264AC_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 ,
275)
276AC_C_INLINE
277AC_TYPE_OFF_T
278AC_TYPE_SIZE_T
279AC_STRUCT_ST_BLOCKS
280AC_CHECK_MEMBERS([struct stat.st_rdev])
281AC_CHECK_MEMBERS([struct stat.st_atim])
282AC_CHECK_MEMBERS([struct stat.st_atimespec])
283AC_CHECK_MEMBERS([struct stat.st_atimensec])
284
285# For the 'nfconv' patch (Mac OS X only):
286case "${target_os}" in
287darwin*)
288 if test "${enable_nfconv}" = "yes"; then
289 AC_CHECK_HEADER(
290 [CoreFoundation/CoreFoundation.h],
291 [
292 LDFLAGS="${LDFLAGS} -framework CoreFoundation"
293 AC_DEFINE(
294 [ENABLE_NFCONV],
295 [1],
296 [Define to 1 if the nfconv patch should be enabled]
297 )
298 ],
299 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.]])
300 )
301 fi
302 ;;
303esac
304
305# Checks for library functions.
306AC_FUNC_GETMNTENT
307AC_FUNC_MBRTOWC
308AC_FUNC_MEMCMP
309AC_FUNC_STAT
310AC_FUNC_STRFTIME
311AC_FUNC_UTIME_NULL
312AC_FUNC_VPRINTF
313AC_CHECK_FUNCS([ \
314 atexit basename daemon dup2 fdatasync ffs getopt_long hasmntopt \
315 mbsinit memmove memset realpath regcomp setlocale setxattr \
316 strcasecmp strchr strdup strerror strnlen strsep strtol strtoul \
317 sysconf utime utimensat gettimeofday clock_gettime fork \
318])
319AC_SYS_LARGEFILE
320
321if test "$GCC" = "yes" ; then
322 # We add -Wall to enable some compiler warnings.
323 CFLAGS="${CFLAGS} -Wall"
324fi
325
326if test "${enable_pedantic}" = "yes"; then
327 enable_warnings="yes"
328 CFLAGS="${CFLAGS} -pedantic"
329fi
330
331if test "${enable_warnings}" = "yes"; then
332 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"
333fi
334
335if test "${enable_debug}" = "yes"; then
336 CFLAGS="${CFLAGS} -ggdb3 -DDEBUG"
337 AC_DEFINE(
338 [ENABLE_DEBUG],
339 [1],
340 [Define to 1 if debug should be enabled]
341 )
342fi
343
344test "${enable_device_default_io_ops}" = "no" && AC_DEFINE(
345 [NO_NTFS_DEVICE_DEFAULT_IO_OPS],
346 [1],
347 [Don't use default IO ops]
348)
349
350test "${enable_mtab}" = "no" && AC_DEFINE([IGNORE_MTAB], [1], [Don't update /etc/mtab])
351test "${enable_posix_acls}" != "no" && AC_DEFINE([POSIXACLS], [1], [POSIX ACL support])
352
353test "${enable_really_static}" = "yes" && enable_library="no"
354test "${enable_library}" = "no" && enable_ldconfig="no"
355
356if test "x${DISTCHECK_HACK}" != "x"; then
357 enable_mount_helper="no"
358 enable_ldconfig="no"
359fi
360
361# Settings
362pkgconfigdir="\$(libdir)/pkgconfig"
363ntfs3gincludedir="\$(includedir)/ntfs-3g"
364# Executables should be installed to the root filesystem, otherwise
365# automounting NTFS volumes can fail during boot if the driver binaries
366# and their dependencies are on an unmounted partition. Use --exec-prefix
367# to override this.
368if test "x${exec_prefix}" = "xNONE"; then
369 rootbindir="/bin"
370 rootsbindir="/sbin"
371 rootlibdir="/lib${libdir##*/lib}"
372else
373 rootbindir="\$(bindir)"
374 rootsbindir="\$(sbindir)"
375 rootlibdir="\$(libdir)"
376fi
377AC_SUBST([pkgconfigdir])
378AC_SUBST([ntfs3gincludedir])
379AC_SUBST([rootbindir])
380AC_SUBST([rootsbindir])
381AC_SUBST([rootlibdir])
382AC_SUBST([LIBNTFS_3G_VERSION])
383AC_SUBST([LIBFUSE_LITE_LIBS])
384AC_SUBST([OUTPUT_FORMAT])
385AM_CONDITIONAL([FUSE_INTERNAL], [test "${with_fuse}" = "internal"])
386AM_CONDITIONAL([GENERATE_LDSCRIPT], [test "${enable_ldscript}" = "yes"])
387AM_CONDITIONAL([WINDOWS], [test "${WINDOWS}" = "yes"])
388AM_CONDITIONAL([NTFS_DEVICE_DEFAULT_IO_OPS], [test "${enable_device_default_io_ops}" = "yes"])
389AM_CONDITIONAL([RUN_LDCONFIG], [test "${enable_ldconfig}" = "yes"])
390AM_CONDITIONAL([REALLYSTATIC], [test "${enable_really_static}" = "yes"])
391AM_CONDITIONAL([INSTALL_LIBRARY], [test "${enable_library}" = "yes"])
392AM_CONDITIONAL([ENABLE_MOUNT_HELPER], [test "${enable_mount_helper}" = "yes"])
393
394# workaround for <autoconf-2.60
395if test -z "${docdir}"; then
396 docdir="\$(datarootdir)/doc/\$(PACKAGE_NAME)"
397 AC_SUBST([docdir])
398fi
399# workaround for <automake-1.10
400if test -z "${MKDIR_P}"; then
401 MKDIR_P="\$(mkdir_p)"
402 AC_SUBST([MKDIR_P])
403fi
404
405# generate files
406AC_CONFIG_FILES([
407 Makefile
408 include/Makefile
409 include/fuse-lite/Makefile
410 include/ntfs-3g/Makefile
411 libfuse-lite/Makefile
412 libntfs-3g/Makefile
413 libntfs-3g/libntfs-3g.pc
414 libntfs-3g/libntfs-3g.script.so
415 src/Makefile
416 src/ntfs-3g.8
417 src/ntfs-3g.probe.8
418 src/ntfs-3g.usermap.8
419 src/ntfs-3g.secaudit.8
420])
421AC_OUTPUT
422
423if test "${with_fuse}" = "external"; then
424 if ! echo "x$FUSE_LIB_PATH" | grep -- "x-L/lib" > /dev/null; then
425 cat <<EOF
426****************************************************************************
427* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING *
428* The FUSE user space binaries were NOT installed with root directory *
429* executable prefix. This means that automounting NTFS volumes during boot *
430* could fail. This can be fixed the below way by reinstalling FUSE using *
431* the right 'configure' option during FUSE compilation: *
432* ./configure --exec-prefix=/ *
433* make && sudo make install *
434* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING *
435****************************************************************************
436EOF
437 fi
438fi
439
440echo "You can type now 'make' to build ntfs-3g."
441
442