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