]> wimlib.net Git - wimlib/blob - configure.ac
Debian package updates
[wimlib] / configure.ac
1 AC_INIT([wimlib], [1.0.4], [ebiggers3@gmail.com])
2 AC_CONFIG_SRCDIR([src/wim.c])
3 AC_CONFIG_MACRO_DIR([m4])
4 AC_CONFIG_AUX_DIR([build-aux])
5 AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects])
6 AC_C_BIGENDIAN
7 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
8 LT_INIT
9 AC_CONFIG_HEADERS([config.h])
10 AC_CONFIG_FILES([Makefile
11                 doc/Doxyfile
12                 wimlib.pc
13                 doc/imagex.1
14                 doc/imagex-append.1
15                 doc/imagex-apply.1
16                 doc/imagex-capture.1
17                 doc/imagex-delete.1
18                 doc/imagex-dir.1
19                 doc/imagex-export.1
20                 doc/imagex-info.1
21                 doc/imagex-join.1
22                 doc/imagex-mount.1
23                 doc/imagex-mountrw.1
24                 doc/imagex-split.1
25                 doc/imagex-unmount.1
26                 doc/mkwinpeimg.1
27                 ])
28 AC_PROG_CC
29 AM_PROG_CC_C_O
30
31 AC_CHECK_FUNCS([utimensat lutimes utime])
32 AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \
33                   sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \
34                   errno.h attr/xattr.h utime.h])
35
36
37 AM_ICONV
38 if test "x$am_cv_func_iconv" != "xyes"; then
39         AC_MSG_ERROR([Cannot find the iconv() function.
40         iconv() is used to convert between UTF-8 and UTF-16 encodings of WIM
41         filenames and XML data.  Wimlib cannot be compiled without it.  iconv()
42         is available in the latest version of glibc and sometimes in other
43         libraries.])
44 fi
45
46
47 AC_ARG_WITH(pkgconfigdir,
48             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
49             [pkgconfigdir=$withval],
50             [pkgconfigdir='${libdir}/pkgconfig'])
51 AC_SUBST(pkgconfigdir)
52
53 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
54              [AC_MSG_ERROR(["cannot find libxml2"])])
55 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
56 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
57 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
58 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
59
60 AC_MSG_CHECKING([whether to include debugging messages])
61 AC_ARG_ENABLE([debug],
62         AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
63         [ENABLE_DEBUG=$enableval],
64         [ENABLE_DEBUG=no]
65         )
66 AC_MSG_RESULT([$ENABLE_DEBUG])
67 if test "x$ENABLE_DEBUG" = "xyes"; then
68         AC_DEFINE([ENABLE_DEBUG], [1],
69                         [Define to 1 if including lots of debug messages.])
70 fi
71
72 AC_MSG_CHECKING([whether to include more debugging messages])
73 AC_ARG_ENABLE([more_debug],
74         AS_HELP_STRING([--enable-more-debug],
75                         [include even more debugging messages]),
76         [ENABLE_MORE_DEBUG=$enableval],
77         [ENABLE_MORE_DEBUG=no]
78         )
79 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
80 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
81         AC_DEFINE([ENABLE_MORE_DEBUG], [1],
82                         [Define to 1 if including even more debug messages.])
83 fi
84
85 AC_MSG_CHECKING([whether to include error messages])
86 AC_ARG_ENABLE([error_messages],
87         AS_HELP_STRING([--disable-error-messages],
88                         [do not compile in error messsages]),
89         [ENABLE_ERROR_MESSAGES=$enableval],
90         [ENABLE_ERROR_MESSAGES=yes]
91         )
92 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
93 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
94         AC_DEFINE([ENABLE_ERROR_MESSAGES], [1],
95                         [Define to 1 if including error messages])
96 fi
97
98 AC_MSG_CHECKING([whether to support custom memory allocation functions])
99 AC_ARG_ENABLE([custom_memory_allocator],
100         AS_HELP_STRING([--disable-custom-memory-allocator],
101                        [do not support the use of custom memory allocation
102                         functions]),
103         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
104         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
105         )
106 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
107 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
108         AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1],
109                 [Define to 1 if supporting custom memory allocation functions])
110 fi
111
112 AC_MSG_CHECKING([whether to include assertions])
113 AC_ARG_ENABLE([assertions],
114         AS_HELP_STRING([--disable-assertions], [do not include assertions]),
115         [ENABLE_ASSERTIONS=$enableval],
116         [ENABLE_ASSERTIONS=yes]
117         )
118 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
119 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
120         AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
121 fi
122
123
124 AC_MSG_CHECKING([whether to include compression verification])
125 AC_ARG_ENABLE([verify_compression],
126               AS_HELP_STRING([--disable-verify-compression], [disable
127                                 checking if blocks we compress can be correctly
128                                 decompressed]),
129         [ENABLE_VERIFY_COMPRESSION=$enableval],
130         [ENABLE_VERIFY_COMPRESSION=yes]
131         )
132 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
133 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
134         AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
135                    compressed data])
136 fi
137
138 AC_MSG_CHECKING([whether to include support for ntfs-3g])
139 AC_ARG_WITH([ntfs-3g],
140               AS_HELP_STRING([--without-ntfs-3g], [build without NTFS-3g.
141                               This will disable the ability to use NTFS-specific
142                               information when capturing or applying WIMs to a
143                               NTFS filesystem.]),
144         [WITH_NTFS_3G=$withval],
145         [WITH_NTFS_3G=yes]
146         )
147 AC_MSG_RESULT([$WITH_NTFS_3G])
148 if test "x$WITH_NTFS_3G" = "xyes"; then
149         AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 to enable support for
150                    NTFS-specific information])
151
152         AC_CHECK_LIB([ntfs-3g], [ntfs_mount], [],
153                         [AC_MSG_ERROR([Cannot find libntfs-3g.
154         Without libntfs-3g, wimlib cannot include support for capturing and
155         applying WIMs on NTFS filesystems while preserving NTFS-specific data
156         such as security descriptors and alternate data streams.  You should
157         either install libntfs-3g, or configure with --without-ntfs-3g to
158         disable support for these NTFS-specific features.])])
159         LIBNTFS_3G_LDADD="`pkg-config --libs libntfs-3g`"
160         LIBNTFS_3G_CFLAGS="`pkg-config --cflags libntfs-3g`"
161 else
162         LIBNTFS_3G_LDADD=
163         LIBNTFS_3G_CFLAGS=
164 fi
165 AM_CONDITIONAL([WITH_NTFS_3G], [test "x$WITH_NTFS_3G" = "xyes"])
166
167 AC_SUBST([LIBNTFS_3G_LDADD], [$LIBNTFS_3G_LDADD])
168 AC_SUBST([LIBNTFS_3G_CFLAGS], [$LIBNTFS_3G_CFLAGS])
169
170 AC_MSG_CHECKING([whether to include support for mounting WIMs])
171 AC_ARG_WITH([fuse],
172                 AS_HELP_STRING([--without-fuse], [build without libfuse.
173                                         This will disable the ability to mount
174                                         WIM files.]),
175         [WITH_FUSE=$withval],
176         [WITH_FUSE=yes]
177         )
178 AC_MSG_RESULT([$WITH_FUSE])
179 if test "x$WITH_FUSE" = "xyes"; then
180         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
181
182
183         AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
184                         [AC_MSG_ERROR([Cannot find libfuse.
185         Without libfuse, wimlib cannot include support for mounting WIMs.  You
186         should either install libfuse, or configure with --without-fuse to
187         disable support for mounting WIMs.])
188         ])
189         AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
190                      [AC_MSG_ERROR([Cannot find librt for POSIX message queue
191         functions.  Without these functions, wimlib cannot include support for
192         mounting WIMs.  You should either update your C library to a recent
193         version of glibc, or configure with --without-fuse to disable support
194         for mounting WIMs.])
195         ])
196         LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
197         LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
198 else
199         LIBFUSE_LDADD=
200         LIBFUSE_CFLAGS=
201 fi
202 AM_CONDITIONAL([WITH_FUSE], [test "x$WITH_FUSE" = "xyes"])
203 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
204 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
205
206 ENABLE_XATTR=no
207 AC_ARG_ENABLE([xattr],
208         [AS_HELP_STRING([--enable-xattr], [Enable the xattr interface to access WIM
209                         alternate data streams (default: autodetect)])],
210         [ENABLE_XATTR=$enableval],
211         [AC_CHECK_FUNC([setxattr],
212                 [AC_CHECK_HEADER([attr/xattr.h],
213                         [ENABLE_XATTR=yes],
214                         [AC_MSG_WARN([Cannot find the "attr/xattr.h" header.  You will not be
215                          able to use the xattr interface to access WIM alternate data
216                          streams.])])],
217                 [AC_MSG_WARN([Cannot find the setxattr() function.  You will not be
218                  able to use the xattr interface to access WIM alternate data
219                  streams.])])])
220
221 if test "x$ENABLE_XATTR" = "xyes"; then
222         AC_DEFINE([ENABLE_XATTR], [1], [Define to 1 if using the xattr
223                         interface to WIM alternate data streams])
224 fi
225
226 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
227 AC_ARG_ENABLE([ssse3-sha1],
228             AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
229                                 of SHA1 from Intel, accelerated with vector
230                                 instructions (SSSE3-enabled CPU required)]),
231         [ENABLE_SSSE3_SHA1=$enableval],
232         [ENABLE_SSSE3_SHA1=no]
233         )
234
235 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
236 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
237         AC_DEFINE([ENABLE_SSSE3_SHA1], [1],
238                         [Define to 1 if using vectorized implementation of SHA1])
239         SSSE3_SHA1_OBJ=sha1-ssse3.lo
240         AX_PROG_NASM
241         AC_SUBST([NASM], [$nasm])
242 else
243         SSSE3_SHA1_OBJ=
244 fi
245 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
246
247 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
248         WITH_LIBCRYPTO=no
249 else
250         AC_ARG_WITH([libcrypto],
251             AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
252                                         rather than use external libcrypto from
253                                         OpenSSL (default is autodetect)]),
254         [WITH_LIBCRYPTO=$withval],
255         [AC_CHECK_LIB([crypto], [SHA1],
256                      [WITH_LIBCRYPTO=yes],
257                      [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
258                      WITH_LIBCRYPTO=no
259                      ])])
260 fi
261 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
262 AC_MSG_RESULT([$WITH_LIBCRYPTO])
263
264 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
265         AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
266         LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
267         if test $? -ne 0; then
268                 LIBCRYPTO_LDADD=-lcrypto;
269         fi
270         LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
271 else
272         LIBCRYPTO_LDADD=
273         LIBCRYPTO_CFLAGS=
274 fi
275 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
276 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
277 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])
278
279 AC_OUTPUT