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 |
25 | AC_PREREQ(2.59) |
26 | AC_INIT([ntfs-3g],[2010.5.16],[ntfs-3g-devel@lists.sf.net]) |
27 | LIBNTFS_3G_VERSION="76" |
28 | AC_CONFIG_SRCDIR([src/ntfs-3g.c]) |
29 | |
30 | # Environment |
31 | AC_CANONICAL_HOST |
32 | AC_CANONICAL_TARGET |
33 | |
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 |
39 | |
40 | # Options |
41 | AC_ARG_ENABLE( |
42 | [debug], |
43 | [AS_HELP_STRING([--enable-debug],[enable debugging code and output])], |
44 | , |
45 | [enable_debug="no"] |
46 | ) |
47 | |
48 | AC_ARG_ENABLE( |
49 | [warnings], |
50 | [AS_HELP_STRING([--enable-warnings],[enable lots of compiler warnings])], |
51 | , |
52 | [enable_warnings="no"] |
53 | ) |
54 | |
55 | AC_ARG_ENABLE( |
56 | [pedantic], |
57 | [AS_HELP_STRING([--enable-pedantic],[enable compile pedantic mode])], |
58 | , |
59 | [enable_pedantic="no"] |
60 | ) |
61 | |
62 | AC_ARG_ENABLE( |
63 | [really-static], |
64 | [AS_HELP_STRING([--enable-really-static],[create fully static binaries])], |
65 | , |
66 | [enable_really_static="no"] |
67 | ) |
68 | |
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 | ] |
79 | ) |
80 | |
81 | AC_ARG_ENABLE( |
82 | [ldscript], |
83 | [AS_HELP_STRING([--enable-ldscript],[use ldscript instead of .so symlink])], |
84 | , |
85 | [enable_ldscript="no"] |
86 | ) |
87 | |
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"] |
93 | ) |
94 | |
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"] |
100 | ) |
101 | |
102 | AC_ARG_ENABLE( |
103 | [mtab], |
104 | [AS_HELP_STRING([--disable-mtab],[disable and ignore usage of /etc/mtab])], |
105 | , |
106 | [enable_mtab="yes"] |
107 | ) |
108 | |
109 | AC_ARG_ENABLE( |
110 | [posix-acls], |
111 | [AS_HELP_STRING([--enable-posix-acls],[enable POSIX ACL support])], |
112 | , |
113 | [enable_posix_acls="no"] |
114 | ) |
115 | |
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"] |
121 | ) |
122 | |
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 | ] |
133 | ) |
134 | |
135 | # pthread_rwlock_t requires _GNU_SOURCE |
136 | AC_GNU_SOURCE |
137 | |
138 | # Programs |
139 | AC_PROG_CC(gcc cc) |
140 | AC_PROG_LN_S |
141 | AM_PROG_CC_C_O |
142 | |
143 | ifdef( |
144 | [LT_INIT], |
145 | [LT_INIT], |
146 | [AC_PROG_LIBTOOL] |
147 | ) |
148 | |
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]) |
154 | |
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 | ;; |
167 | *) |
168 | AC_MSG_RESULT([no]) |
169 | WINDOWS="no" |
170 | ;; |
171 | esac |
172 | |
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 | ;; |
189 | *) |
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}]) |
194 | |
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 |
202 | |
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 |
212 | fi |
213 | |
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,[ ]*$,,'` |
250 | fi |
251 | |
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]) |
261 | |
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 | , |
275 | ) |
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]) |
283 | AC_CHECK_MEMBERS([struct stat.st_atimensec]) |
284 | |
285 | # For the 'nfconv' patch (Mac OS X only): |
286 | case "${target_os}" in |
287 | darwin*) |
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 | ;; |
303 | esac |
304 | |
305 | # Checks for library functions. |
306 | AC_FUNC_GETMNTENT |
307 | AC_FUNC_MBRTOWC |
308 | AC_FUNC_MEMCMP |
309 | AC_FUNC_STAT |
310 | AC_FUNC_STRFTIME |
311 | AC_FUNC_UTIME_NULL |
312 | AC_FUNC_VPRINTF |
313 | AC_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 | ]) |
319 | AC_SYS_LARGEFILE |
320 | |
321 | if test "$GCC" = "yes" ; then |
322 | # We add -Wall to enable some compiler warnings. |
323 | CFLAGS="${CFLAGS} -Wall" |
324 | fi |
325 | |
326 | if test "${enable_pedantic}" = "yes"; then |
327 | enable_warnings="yes" |
328 | CFLAGS="${CFLAGS} -pedantic" |
329 | fi |
330 | |
331 | if 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" |
333 | fi |
334 | |
335 | if 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 | ) |
342 | fi |
343 | |
344 | test "${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 | |
350 | test "${enable_mtab}" = "no" && AC_DEFINE([IGNORE_MTAB], [1], [Don't update /etc/mtab]) |
351 | test "${enable_posix_acls}" != "no" && AC_DEFINE([POSIXACLS], [1], [POSIX ACL support]) |
352 | |
353 | test "${enable_really_static}" = "yes" && enable_library="no" |
354 | test "${enable_library}" = "no" && enable_ldconfig="no" |
355 | |
356 | if test "x${DISTCHECK_HACK}" != "x"; then |
357 | enable_mount_helper="no" |
358 | enable_ldconfig="no" |
359 | fi |
360 | |
361 | # Settings |
362 | pkgconfigdir="\$(libdir)/pkgconfig" |
363 | ntfs3gincludedir="\$(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. |
368 | if test "x${exec_prefix}" = "xNONE"; then |
369 | rootbindir="/bin" |
370 | rootsbindir="/sbin" |
371 | rootlibdir="/lib${libdir##*/lib}" |
372 | else |
373 | rootbindir="\$(bindir)" |
374 | rootsbindir="\$(sbindir)" |
375 | rootlibdir="\$(libdir)" |
376 | fi |
377 | AC_SUBST([pkgconfigdir]) |
378 | AC_SUBST([ntfs3gincludedir]) |
379 | AC_SUBST([rootbindir]) |
380 | AC_SUBST([rootsbindir]) |
381 | AC_SUBST([rootlibdir]) |
382 | AC_SUBST([LIBNTFS_3G_VERSION]) |
383 | AC_SUBST([LIBFUSE_LITE_LIBS]) |
384 | AC_SUBST([OUTPUT_FORMAT]) |
385 | AM_CONDITIONAL([FUSE_INTERNAL], [test "${with_fuse}" = "internal"]) |
386 | AM_CONDITIONAL([GENERATE_LDSCRIPT], [test "${enable_ldscript}" = "yes"]) |
387 | AM_CONDITIONAL([WINDOWS], [test "${WINDOWS}" = "yes"]) |
388 | AM_CONDITIONAL([NTFS_DEVICE_DEFAULT_IO_OPS], [test "${enable_device_default_io_ops}" = "yes"]) |
389 | AM_CONDITIONAL([RUN_LDCONFIG], [test "${enable_ldconfig}" = "yes"]) |
390 | AM_CONDITIONAL([REALLYSTATIC], [test "${enable_really_static}" = "yes"]) |
391 | AM_CONDITIONAL([INSTALL_LIBRARY], [test "${enable_library}" = "yes"]) |
392 | AM_CONDITIONAL([ENABLE_MOUNT_HELPER], [test "${enable_mount_helper}" = "yes"]) |
393 | |
394 | # workaround for <autoconf-2.60 |
395 | if test -z "${docdir}"; then |
396 | docdir="\$(datarootdir)/doc/\$(PACKAGE_NAME)" |
397 | AC_SUBST([docdir]) |
398 | fi |
399 | # workaround for <automake-1.10 |
400 | if test -z "${MKDIR_P}"; then |
401 | MKDIR_P="\$(mkdir_p)" |
402 | AC_SUBST([MKDIR_P]) |
403 | fi |
404 | |
405 | # generate files |
406 | AC_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 | ]) |
421 | AC_OUTPUT |
422 | |
423 | if 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 | **************************************************************************** |
436 | EOF |
437 | fi |
438 | fi |
439 | |
440 | echo "You can type now 'make' to build ntfs-3g." |
441 | |
442 |