Support for splitting WIMs
[wimlib] / configure.ac
1 AC_INIT([wimlib], [0.7.0], [ebiggers3@gmail.com])
2 AC_CONFIG_SRCDIR([src/wim.c])
3 AM_INIT_AUTOMAKE([-Wall -Werror])
4 AC_CONFIG_MACRO_DIR([m4])
5 AC_C_BIGENDIAN
6 AM_PROG_AR
7 LT_INIT
8 AC_CONFIG_HEADERS([config.h])
9 AC_CONFIG_FILES([Makefile 
10                 doc/Makefile 
11                 doc/Doxyfile
12                 src/Makefile 
13                 programs/Makefile
14                 wimlib.pc
15                 doc/imagex.1
16                 doc/imagex-append.1
17                 doc/imagex-apply.1
18                 doc/imagex-capture.1
19                 doc/imagex-delete.1
20                 doc/imagex-dir.1
21                 doc/imagex-export.1
22                 doc/imagex-info.1
23                 doc/imagex-join.1
24                 doc/imagex-mount.1
25                 doc/imagex-mountrw.1
26                 doc/imagex-split.1
27                 doc/imagex-unmount.1
28                 doc/mkwinpeimg.1
29                 rpm/wimlib.spec
30                 archlinux/PKGBUILD
31                 ])
32 AC_PROG_CC
33
34
35 AM_ICONV
36 if test "x$am_cv_func_iconv" != "xyes"; then
37         AC_MSG_ERROR([Cannot find the iconv() function.
38         iconv() is used to convert between UTF-8 and UTF-16 encodings of WIM
39         filenames and XML data.  Wimlib cannot be compiled without it.  iconv()
40         is available in the latest version of glibc and sometimes in other
41         libraries.])
42 fi
43
44 AC_ARG_WITH(pkgconfigdir,
45             [  --with-pkgconfigdir=DIR      pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
46             [pkgconfigdir=$withval],
47             [pkgconfigdir='${libdir}/pkgconfig'])
48 AC_SUBST(pkgconfigdir)
49
50 AC_CHECK_LIB([xml2], [xmlParseFile], [have_libxml=true],
51              [AC_MSG_ERROR(["cannot find libxml2"])])
52 LIBXML2_LDADD=`pkg-config libxml-2.0 --libs`
53 LIBXML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
54 AC_SUBST([LIBXML2_LDADD], [$LIBXML2_LDADD])
55 AC_SUBST([LIBXML2_CFLAGS], [$LIBXML2_CFLAGS])
56
57 AC_MSG_CHECKING([whether to include debugging messages])
58 AC_ARG_ENABLE([debug], 
59         AS_HELP_STRING([--enable-debug], [include lots of debugging messages]),
60         [ENABLE_DEBUG=$enableval],
61         [ENABLE_DEBUG=no]
62         )
63 AC_MSG_RESULT([$ENABLE_DEBUG])
64 if test "x$ENABLE_DEBUG" = "xyes"; then
65         AC_DEFINE([ENABLE_DEBUG], [1], 
66                         [Define to 1 if including lots of debug messages.])
67 fi
68
69 AC_MSG_CHECKING([whether to include more debugging messages])
70 AC_ARG_ENABLE([more_debug], 
71         AS_HELP_STRING([--enable-more-debug], 
72                         [include even more debugging messages]),
73         [ENABLE_MORE_DEBUG=$enableval],
74         [ENABLE_MORE_DEBUG=no]
75         )
76 AC_MSG_RESULT([$ENABLE_MORE_DEBUG])
77 if test "x$ENABLE_MORE_DEBUG" = "xyes"; then
78         AC_DEFINE([ENABLE_MORE_DEBUG], [1], 
79                         [Define to 1 if including even more debug messages.])
80 fi
81
82 AC_MSG_CHECKING([whether to include error messages])
83 AC_ARG_ENABLE([error_messages], 
84         AS_HELP_STRING([--disable-error-messages], 
85                         [do not compile in error messsages]),
86         [ENABLE_ERROR_MESSAGES=$enableval],
87         [ENABLE_ERROR_MESSAGES=yes]
88         )
89 AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES])
90 if test "x$ENABLE_ERROR_MESSAGES" = "xyes"; then
91         AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], 
92                         [Define to 1 if including error messages])
93 fi
94
95 AC_MSG_CHECKING([whether to support custom memory allocation functions])
96 AC_ARG_ENABLE([custom_memory_allocator], 
97         AS_HELP_STRING([--disable-custom-memory-allocator], 
98                        [do not support the use of custom memory allocation
99                         functions]),
100         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=$enableval],
101         [ENABLE_CUSTOM_MEMORY_ALLOCATOR=yes]
102         )
103 AC_MSG_RESULT([$ENABLE_CUSTOM_MEMORY_ALLOCATOR])
104 if test "x$ENABLE_CUSTOM_MEMORY_ALLOCATOR" = "xyes"; then
105         AC_DEFINE([ENABLE_CUSTOM_MEMORY_ALLOCATOR], [1], 
106                 [Define to 1 if supporting custom memory allocation functions])
107 fi
108
109 AC_MSG_CHECKING([whether to include assertions])
110 AC_ARG_ENABLE([assertions],
111         AS_HELP_STRING([--disable-assertions], [do not include assertions]),
112         [ENABLE_ASSERTIONS=$enableval],
113         [ENABLE_ASSERTIONS=yes]
114         )
115 AC_MSG_RESULT([$ENABLE_ASSERTIONS])
116 if test "x$ENABLE_ASSERTIONS" = "xyes"; then
117         AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.])
118 fi
119
120
121 AC_MSG_CHECKING([whether to include compression verification])
122 AC_ARG_ENABLE([verify_compression],
123               AS_HELP_STRING([--disable-verify-compression], [disable
124                                 checking if blocks we compress can be correctly
125                                 decompressed]),
126         [ENABLE_VERIFY_COMPRESSION=$enableval],
127         [ENABLE_VERIFY_COMPRESSION=yes]
128         )
129 AC_MSG_RESULT([$ENABLE_VERIFY_COMPRESSION])
130 if test "x$ENABLE_VERIFY_COMPRESSION" = "xyes"; then
131         AC_DEFINE([ENABLE_VERIFY_COMPRESSION], [1], [Define to 1 to verify
132                    compressed data])
133 fi
134
135 AC_MSG_CHECKING([whether to include support for mounting WIMs])
136 AC_ARG_WITH([fuse],
137                 AS_HELP_STRING([--without-fuse], [build without libfuse.  
138                                         This will disable the ability to mount 
139                                         WIM files.]),
140         [WITH_FUSE=$withval],
141         [WITH_FUSE=yes]
142         )
143 AC_MSG_RESULT([$WITH_FUSE])
144 if test "x$WITH_FUSE" = "xyes"; then
145         AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE.])
146
147
148         AC_CHECK_LIB([fuse], [fuse_main_real], [have_fuse=true],
149                         [AC_MSG_ERROR([Cannot find libfuse.  
150         Without libfuse, WIMLIB cannot include support for mounting WIMs.  You
151         should either install libfuse, or configure with --without-fuse to
152         disable support for mounting WIMs.])
153         ])
154         AC_CHECK_LIB([rt], [mq_open], [have_posix_mq=true],
155                      [AC_MSG_ERROR([Cannot find librt for POSIX message queue
156         functions.  Without these functions, WIMLIB cannot include support for
157         mounting WIMs.  You should either update your C library to a recent
158         version of glibc, or configure with --without-fuse to disable support
159         for mounting WIMs.])
160         ])
161         LIBFUSE_LDADD="`pkg-config --libs fuse` -lrt"
162         LIBFUSE_CFLAGS="`pkg-config --cflags fuse`"
163 else
164         LIBFUSE_LDADD=
165         LIBFUSE_CFLAGS=
166 fi
167 AC_SUBST([LIBFUSE_LDADD], [$LIBFUSE_LDADD])
168 AC_SUBST([LIBFUSE_CFLAGS], [$LIBFUSE_CFLAGS])
169
170 AC_MSG_CHECKING([whether to use SSSE3-accelerated SHA1 ])
171 AC_ARG_ENABLE([ssse3-sha1],
172             AS_HELP_STRING([--enable-ssse3-sha1], [use assembly language implementation
173                                 of SHA1 from Intel, accelerated with vector
174                                 instructions (SSSE3-enabled CPU required)]),
175         [ENABLE_SSSE3_SHA1=$enableval],
176         [ENABLE_SSSE3_SHA1=no]
177         )
178         
179 AC_MSG_RESULT([$ENABLE_SSSE3_SHA1])
180 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
181         AC_DEFINE([ENABLE_SSSE3_SHA1], [1], 
182                         [Define to 1 if using vectorized implementation of SHA1])
183         SSSE3_SHA1_OBJ=sha1-ssse3.lo
184         AX_PROG_NASM
185         AC_SUBST([NASM], [$nasm])
186 else
187         SSSE3_SHA1_OBJ=
188 fi
189 AC_SUBST([SSSE3_SHA1_OBJ], [$SSSE3_SHA1_OBJ])
190
191 if test "x$ENABLE_SSSE3_SHA1" = "xyes"; then
192         WITH_LIBCRYPTO=no
193 else
194         AC_ARG_WITH([libcrypto],
195             AS_HELP_STRING([--without-libcrypto], [build in the SHA1 algorithm,
196                                         rather than use external libcrypto from
197                                         OpenSSL (default is autodetect)]),
198         [WITH_LIBCRYPTO=$withval],
199         [AC_CHECK_LIB([crypto], [SHA1], 
200                      [WITH_LIBCRYPTO=yes],
201                      [AC_MSG_WARN([Cannot find libcrypto: using stand-alone SHA1 code instead of OpenSSL])
202                      WITH_LIBCRYPTO=no
203                      ])])
204 fi
205 AC_MSG_CHECKING([whether to use SHA1 function from system libcrypto])
206 AC_MSG_RESULT([$WITH_LIBCRYPTO])
207
208 if test "x$WITH_LIBCRYPTO" = "xyes" -a "x$ENABLE_SSSE3_SHA1" = "xno"; then
209         AC_DEFINE([WITH_LIBCRYPTO], [1], [Define to 1 if using libcrypto SHA1])
210         LIBCRYPTO_LDADD=`pkg-config --libs libcrypto 2>/dev/null`
211         if test $? -ne 0; then
212                 LIBCRYPTO_LDADD=-lcrypto;
213         fi
214         LIBCRYPTO_CFLAGS=`pkg-config --cflags libcrypto 2>/dev/null`
215 else
216         LIBCRYPTO_LDADD=
217         LIBCRYPTO_CFLAGS=
218 fi
219 AC_SUBST([LIBCRYPTO_LDADD], [$LIBCRYPTO_LDADD])
220 AC_SUBST([LIBCRYPTO_CFLAGS], [$LIBCRYPTO_CFLAGS])
221 AC_SUBST([SHA1_SOURCES], [$SHA1_SOURCES])
222
223 AC_OUTPUT