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