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