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