]>
Commit | Line | Data |
---|---|---|
b3cfa26b TK |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | ||
3 | dnl First, define all of the version numbers up front. | |
4 | dnl In particular, this allows the version macro to be used in AC_INIT | |
5 | ||
6 | dnl These first two version numbers are updated automatically on each release. | |
62935818 TK |
7 | m4_define([LIBARCHIVE_VERSION_S],[3.2.2]) |
8 | m4_define([LIBARCHIVE_VERSION_N],[3002002]) | |
b3cfa26b | 9 | |
80bdb4b4 | 10 | dnl bsdtar and bsdcpio versioning tracks libarchive |
b3cfa26b | 11 | m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) |
80bdb4b4 | 12 | m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) |
5d3f56d2 | 13 | m4_define([BSDCAT_VERSION_S],LIBARCHIVE_VERSION_S()) |
b3cfa26b | 14 | |
4c6269cb | 15 | AC_PREREQ([2.69]) |
77cfbb98 | 16 | |
b3cfa26b TK |
17 | # |
18 | # Now starts the "real" configure script. | |
19 | # | |
20 | ||
a580c98e | 21 | AC_INIT([libarchive],[LIBARCHIVE_VERSION_S()],[libarchive-discuss@googlegroups.com]) |
b3cfa26b TK |
22 | # Make sure the srcdir contains "libarchive" directory |
23 | AC_CONFIG_SRCDIR([libarchive]) | |
24 | # Use auxiliary subscripts from this subdirectory (cleans up root) | |
4c9c2bcd | 25 | AC_CONFIG_AUX_DIR([build/autoconf]) |
79cb8e5b | 26 | # M4 scripts |
80b5f20f | 27 | AC_CONFIG_MACRO_DIR([build/autoconf]) |
b3cfa26b TK |
28 | # Must follow AC_CONFIG macros above... |
29 | AM_INIT_AUTOMAKE() | |
3bf4a20e | 30 | AM_MAINTAINER_MODE([enable]) |
fcfe9113 | 31 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
b3cfa26b | 32 | |
f2488cf6 TK |
33 | # Libtool's "interface version" can be computed from the libarchive version. |
34 | ||
35 | # Libtool interface version bumps on any API change, so increments | |
36 | # whenever libarchive minor version does. | |
b3cfa26b | 37 | ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) |
f2488cf6 TK |
38 | # Libarchive 2.7 == libtool interface 9 = 2 + 7 |
39 | # Libarchive 2.8 == libtool interface 10 = 2 + 8 | |
7eeddea4 TK |
40 | # Libarchive 2.9 == libtool interface 11 = 2 + 8 |
41 | # Libarchive 3.0 == libtool interface 12 | |
bdf2c171 AM |
42 | # Libarchive 3.1 == libtool interface 13 |
43 | ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` | |
f2488cf6 | 44 | # Libarchive revision is bumped on any source change === libtool revision |
b3cfa26b | 45 | ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) |
f2488cf6 | 46 | # Libarchive minor is bumped on any interface addition === libtool age |
7f6d230a | 47 | ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR |
b3cfa26b TK |
48 | |
49 | # Stick the version numbers into config.h | |
50 | AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", | |
51 | [Version number of libarchive]) | |
52 | AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", | |
53 | [Version number of libarchive as a single integer]) | |
54 | AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", | |
55 | [Version number of bsdcpio]) | |
56 | AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", | |
57 | [Version number of bsdtar]) | |
5d3f56d2 MK |
58 | AC_DEFINE([BSDCAT_VERSION_STRING],"BSDTAR_VERSION_S()", |
59 | [Version number of bsdcat]) | |
b3cfa26b TK |
60 | |
61 | # The shell variables here must be the same as the AC_SUBST() variables | |
62 | # below, but the shell variable names apparently cannot be the same as | |
63 | # the m4 macro names above. Why? Ask autoconf. | |
64 | BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() | |
65 | BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() | |
5d3f56d2 | 66 | BSDCAT_VERSION_STRING=BSDCAT_VERSION_S() |
b3cfa26b TK |
67 | LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() |
68 | LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() | |
69 | ||
70 | # Substitute the above version numbers into the various files below. | |
71 | # Yes, I believe this is the fourth time we define what are essentially | |
72 | # the same symbols. Why? Ask autoconf. | |
73 | AC_SUBST(ARCHIVE_LIBTOOL_VERSION) | |
74 | AC_SUBST(BSDCPIO_VERSION_STRING) | |
75 | AC_SUBST(BSDTAR_VERSION_STRING) | |
5d3f56d2 | 76 | AC_SUBST(BSDCAT_VERSION_STRING) |
b3cfa26b TK |
77 | AC_SUBST(LIBARCHIVE_VERSION_STRING) |
78 | AC_SUBST(LIBARCHIVE_VERSION_NUMBER) | |
79 | ||
80 | AC_CONFIG_HEADERS([config.h]) | |
81 | AC_CONFIG_FILES([Makefile]) | |
bafc3c6b | 82 | AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) |
b3cfa26b | 83 | |
79cb8e5b CW |
84 | # Check for host type |
85 | AC_CANONICAL_HOST | |
86 | ||
87 | dnl Compilation on mingw and Cygwin needs special Makefile rules | |
88 | inc_windows_files=no | |
89 | inc_cygwin_files=no | |
90 | case "$host_os" in | |
91 | *mingw* ) inc_windows_files=yes ;; | |
1e2b6c98 | 92 | *cygwin* | *msys*) inc_cygwin_files=yes ;; |
79cb8e5b CW |
93 | esac |
94 | AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) | |
95 | AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) | |
96 | ||
c31d1bc4 CW |
97 | dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) |
98 | PLATFORMCPPFLAGS= | |
99 | case "$host_os" in | |
100 | *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;; | |
101 | esac | |
102 | AC_SUBST(PLATFORMCPPFLAGS) | |
103 | ||
b3cfa26b TK |
104 | # Checks for programs. |
105 | AC_PROG_CC | |
106 | AM_PROG_CC_C_O | |
6ca9835b | 107 | AC_USE_SYSTEM_EXTENSIONS |
01a4df54 | 108 | AC_LIBTOOL_WIN32_DLL |
b3cfa26b TK |
109 | AC_PROG_LIBTOOL |
110 | AC_CHECK_TOOL([STRIP],[strip]) | |
1c6adda3 | 111 | AC_PROG_MKDIR_P |
b3cfa26b TK |
112 | |
113 | # | |
114 | # Options for building bsdtar. | |
115 | # | |
116 | # Default is to build bsdtar, but allow people to override that. | |
117 | # | |
118 | AC_ARG_ENABLE([bsdtar], | |
119 | [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) | |
120 | AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) | |
121 | AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) | |
122 | AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], | |
123 | [], [enable_bsdtar=yes]) | |
124 | ||
125 | case "$enable_bsdtar" in | |
126 | yes) | |
127 | if test "$enable_static" = "no"; then | |
128 | static_bsdtar=no | |
129 | else | |
130 | static_bsdtar=yes | |
131 | fi | |
132 | build_bsdtar=yes | |
133 | ;; | |
134 | dynamic|shared) | |
135 | if test "$enable_shared" = "no"; then | |
136 | AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) | |
137 | fi | |
138 | build_bsdtar=yes | |
139 | static_bsdtar=no | |
140 | ;; | |
141 | static) | |
142 | build_bsdtar=yes | |
143 | static_bsdtar=yes | |
144 | ;; | |
145 | no) | |
146 | build_bsdtar=no | |
147 | static_bsdtar=no | |
148 | ;; | |
149 | *) | |
150 | AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) | |
151 | ;; | |
152 | esac | |
153 | ||
154 | AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) | |
155 | AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) | |
156 | ||
5d3f56d2 MK |
157 | # |
158 | # Options for building bsdcat. | |
159 | # | |
160 | # Default is to build bsdcat, but allow people to override that. | |
161 | # | |
162 | AC_ARG_ENABLE([bsdcat], | |
163 | [AS_HELP_STRING([--enable-bsdcat], [enable build of bsdcat (default)]) | |
164 | AS_HELP_STRING([--enable-bsdcat=static], [force static build of bsdcat]) | |
165 | AS_HELP_STRING([--enable-bsdcat=shared], [force dynamic build of bsdcat]) | |
166 | AS_HELP_STRING([--disable-bsdcat], [disable build of bsdcat])], | |
167 | [], [enable_bsdcat=yes]) | |
168 | ||
169 | case "$enable_bsdcat" in | |
170 | yes) | |
171 | if test "$enable_static" = "no"; then | |
172 | static_bsdcat=no | |
173 | else | |
174 | static_bsdcat=yes | |
175 | fi | |
176 | build_bsdcat=yes | |
177 | ;; | |
178 | dynamic|shared) | |
179 | if test "$enable_shared" = "no"; then | |
180 | AC_MSG_FAILURE([Shared linking of bsdcat requires shared libarchive]) | |
181 | fi | |
182 | build_bsdcat=yes | |
183 | static_bsdcat=no | |
184 | ;; | |
185 | static) | |
186 | build_bsdcat=yes | |
187 | static_bsdcat=yes | |
188 | ;; | |
189 | no) | |
190 | build_bsdcat=no | |
191 | static_bsdcat=no | |
192 | ;; | |
193 | *) | |
194 | AC_MSG_FAILURE([Unsupported value for --enable-bsdcat]) | |
195 | ;; | |
196 | esac | |
197 | ||
198 | AM_CONDITIONAL([BUILD_BSDCAT], [ test "$build_bsdcat" = yes ]) | |
199 | AM_CONDITIONAL([STATIC_BSDCAT], [ test "$static_bsdcat" = yes ]) | |
200 | ||
b3cfa26b TK |
201 | # |
202 | # Options for building bsdcpio. | |
203 | # | |
204 | # Default is not to build bsdcpio, but that can be overridden. | |
205 | # | |
206 | AC_ARG_ENABLE([bsdcpio], | |
f9a97a03 | 207 | [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) |
b3cfa26b TK |
208 | AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) |
209 | AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) | |
f9a97a03 TK |
210 | AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], |
211 | [], [enable_bsdcpio=yes]) | |
b3cfa26b TK |
212 | |
213 | case "$enable_bsdcpio" in | |
214 | yes) | |
215 | if test "$enable_static" = "no"; then | |
216 | static_bsdcpio=no | |
217 | else | |
218 | static_bsdcpio=yes | |
219 | fi | |
220 | build_bsdcpio=yes | |
221 | ;; | |
222 | dynamic|shared) | |
223 | if test "$enabled_shared" = "no"; then | |
224 | AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) | |
225 | fi | |
226 | build_bsdcpio=yes | |
227 | ;; | |
228 | static) | |
229 | build_bsdcpio=yes | |
230 | static_bsdcpio=yes | |
231 | ;; | |
232 | no) | |
233 | build_bsdcpio=no | |
234 | static_bsdcpio=no | |
235 | ;; | |
236 | *) | |
237 | AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) | |
238 | ;; | |
239 | esac | |
240 | ||
241 | AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) | |
242 | AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) | |
243 | ||
197cc2d1 CW |
244 | # Set up defines needed before including any headers |
245 | case $host in | |
1e2b6c98 | 246 | *mingw* | *cygwin* | *msys* ) |
8f8bf1f9 TK |
247 | AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) |
248 | AC_DEFINE([WINVER], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) | |
249 | AC_DEFINE([NTDDI_VERSION], 0x05020000, [Define to '0x05020000' for Windows Server 2003 APIs.]) | |
197cc2d1 CW |
250 | ;; |
251 | esac | |
252 | ||
b3cfa26b | 253 | # Checks for header files. |
b3cfa26b TK |
254 | AC_HEADER_DIRENT |
255 | AC_HEADER_SYS_WAIT | |
b30c530a | 256 | AC_CHECK_HEADERS([copyfile.h ctype.h]) |
c247a74f | 257 | AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h]) |
95c74682 JS |
258 | |
259 | AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable], | |
260 | [ac_cv_have_decl_EXT2_IOC_GETFLAGS], | |
261 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h> | |
262 | @%:@include <ext2fs/ext2_fs.h>], | |
263 | [int x = EXT2_IOC_GETFLAGS])], | |
264 | [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])], | |
265 | [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])]) | |
266 | ||
267 | AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes], | |
268 | [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1], | |
269 | [Define to 1 if you have a working EXT2_IOC_GETFLAGS])]) | |
270 | ||
d216d028 | 271 | AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) |
407f6e94 | 272 | AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h]) |
9769e6f7 MN |
273 | AC_CHECK_HEADERS([locale.h paths.h poll.h pthread.h pwd.h]) |
274 | AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h]) | |
8c1c0a7a | 275 | AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h]) |
b30c530a | 276 | AC_CHECK_HEADERS([sys/cdefs.h sys/extattr.h]) |
fb67a295 | 277 | AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h]) |
0cb2837d | 278 | AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h]) |
996334f3 MN |
279 | AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h]) |
280 | AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) | |
d7ae3cca | 281 | AC_CHECK_HEADERS([windows.h]) |
178bf9b8 | 282 | AC_CHECK_HEADERS([Bcrypt.h]) |
d7ae3cca TK |
283 | # check windows.h first; the other headers require it. |
284 | AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], | |
285 | [[#ifdef HAVE_WINDOWS_H | |
286 | # include <windows.h> | |
287 | #endif | |
288 | ]]) | |
b3cfa26b TK |
289 | |
290 | # Checks for libraries. | |
2186dc24 TK |
291 | AC_ARG_WITH([zlib], |
292 | AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) | |
293 | ||
294 | if test "x$with_zlib" != "xno"; then | |
295 | AC_CHECK_HEADERS([zlib.h]) | |
296 | AC_CHECK_LIB(z,inflate) | |
297 | fi | |
298 | ||
299 | AC_ARG_WITH([bz2lib], | |
300 | AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) | |
301 | ||
302 | if test "x$with_bz2lib" != "xno"; then | |
303 | AC_CHECK_HEADERS([bzlib.h]) | |
1a0f8974 | 304 | case "$host_os" in |
1e2b6c98 | 305 | *mingw* | *cygwin* | *msys*) |
1a0f8974 AM |
306 | dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore |
307 | dnl use AC_LINK_IFELSE. | |
308 | AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2]) | |
309 | old_LIBS="$LIBS" | |
310 | LIBS="-lbz2 $LIBS" | |
311 | AC_LINK_IFELSE( | |
312 | [AC_LANG_SOURCE(#include <bzlib.h> | |
313 | int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })], | |
314 | [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes], | |
315 | [ac_cv_lib_bz2_BZ2_bzDecompressInit=no]) | |
316 | LIBS="$old_LIBS" | |
317 | AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit) | |
318 | if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then | |
319 | AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).]) | |
320 | LIBS="-lbz2 $LIBS" | |
321 | fi | |
322 | ;; | |
323 | *) | |
324 | AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) | |
325 | ;; | |
326 | esac | |
2186dc24 TK |
327 | fi |
328 | ||
c91b3538 TK |
329 | AC_ARG_WITH([iconv], |
330 | AS_HELP_STRING([--without-iconv], [Don't try to link against iconv])) | |
331 | ||
332 | if test "x$with_iconv" != "xno"; then | |
d975ebec | 333 | AM_ICONV |
1354b7df | 334 | AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>]) |
17fd872a | 335 | if test "x$am_cv_func_iconv" = "xyes"; then |
89032bfd MN |
336 | AC_CHECK_HEADERS([localcharset.h]) |
337 | am_save_LIBS="$LIBS" | |
338 | LIBS="${LIBS} ${LIBICONV}" | |
339 | AC_CHECK_FUNCS([locale_charset]) | |
340 | LIBS="${am_save_LIBS}" | |
341 | if test "x$ac_cv_func_locale_charset" != "xyes"; then | |
342 | # If locale_charset() is not in libiconv, we have to find libcharset. | |
343 | AC_CHECK_LIB(charset,locale_charset) | |
344 | fi | |
345 | fi | |
c91b3538 TK |
346 | fi |
347 | ||
724f3f91 MN |
348 | AC_ARG_WITH([lz4], |
349 | AS_HELP_STRING([--without-lz4], [Don't build support for lz4 through liblz4])) | |
350 | ||
351 | if test "x$with_lz4" != "xno"; then | |
352 | AC_CHECK_HEADERS([lz4.h lz4hc.h]) | |
353 | AC_CHECK_LIB(lz4,LZ4_decompress_safe) | |
354 | fi | |
355 | ||
c25e0da2 MN |
356 | AC_ARG_WITH([lzma], |
357 | AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) | |
358 | ||
359 | if test "x$with_lzma" != "xno"; then | |
360 | AC_CHECK_HEADERS([lzma.h]) | |
361 | AC_CHECK_LIB(lzma,lzma_stream_decoder) | |
b05a2733 TK |
362 | # Some pre-release (but widely distributed) versions of liblzma |
363 | # included a disabled version of lzma_stream_encoder_mt that | |
364 | # fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need | |
365 | # to do something more complex here: | |
366 | AC_CACHE_CHECK( | |
367 | [whether we have multithread support in lzma], | |
368 | ac_cv_lzma_has_mt, | |
7c3148ec JS |
369 | [AC_LINK_IFELSE([ |
370 | AC_LANG_PROGRAM([[#include <lzma.h>] | |
371 | [#if LZMA_VERSION < 50020000] | |
372 | [#error unsupported] | |
373 | [#endif]], | |
b05a2733 TK |
374 | [[lzma_stream_encoder_mt(0, 0);]])], |
375 | [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])]) | |
9690ea4f JR |
376 | if test "x$ac_cv_lzma_has_mt" != xno; then |
377 | AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.]) | |
378 | fi | |
c25e0da2 MN |
379 | fi |
380 | ||
6b29a1cc MN |
381 | AC_ARG_WITH([lzo2], |
382 | AS_HELP_STRING([--without-lzo2], [Don't build support for lzop through liblzo2])) | |
383 | ||
384 | if test "x$with_lzo2" != "xno"; then | |
385 | AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h]) | |
386 | AC_CHECK_LIB(lzo2,lzo1x_decompress_safe) | |
387 | fi | |
388 | ||
00ac9023 AM |
389 | AC_ARG_WITH([nettle], |
390 | AS_HELP_STRING([--without-nettle], [Don't build with crypto support from Nettle])) | |
eace4421 | 391 | AC_ARG_WITH([openssl], |
d2c0930d | 392 | AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) |
b0f3a5e1 TK |
393 | case "$host_os" in |
394 | *darwin* ) with_openssl=no ;; | |
395 | esac | |
d2c0930d MN |
396 | |
397 | AC_ARG_WITH([xml2], | |
398 | AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) | |
399 | AC_ARG_WITH([expat], | |
400 | AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) | |
401 | ||
402 | if test "x$with_xml2" != "xno"; then | |
f7b0a9f3 KM |
403 | PKG_PROG_PKG_CONFIG |
404 | PKG_CHECK_MODULES(LIBXML2_PC, [libxml-2.0], [ | |
405 | CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}" | |
406 | LIBS="${LIBS} ${LIBXML2_PC_LIBS}" | |
5256aa1a | 407 | AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) |
f7b0a9f3 | 408 | ], [ |
5256aa1a | 409 | AC_CHECK_LIB(xml2,xmlInitParser) |
f7b0a9f3 | 410 | ]) |
b7115a7d | 411 | AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) |
d2c0930d MN |
412 | fi |
413 | if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then | |
414 | if test "x$with_expat" != "xno"; then | |
aa5b327f MN |
415 | AC_CHECK_HEADERS([expat.h]) |
416 | AC_CHECK_LIB(expat,XML_ParserCreate) | |
d2c0930d MN |
417 | fi |
418 | fi | |
eace4421 | 419 | |
9fe06744 AM |
420 | AC_ARG_ENABLE([posix-regex-lib], |
421 | [AS_HELP_STRING([--enable-posix-regex-lib], | |
422 | [choose what library to use for POSIX regular expression support (default: auto)]) | |
423 | AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support]) | |
424 | AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support]) | |
425 | AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support]) | |
426 | AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])], | |
427 | [], [enable_posix_regex_lib=auto]) | |
428 | ||
429 | posix_regex_lib_found= | |
430 | if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then | |
431 | AC_CHECK_HEADERS([regex.h]) | |
c9b68f41 | 432 | if test "x$ac_cv_header_regex_h" != "xno"; then |
9797fb4e AM |
433 | AC_CHECK_FUNC(regcomp) |
434 | if test "x$ac_cv_func_regcomp" = xyes; then | |
435 | posix_regex_lib_found=1 | |
436 | else | |
437 | AC_CHECK_LIB(regex,regcomp) | |
438 | if test "x$ac_cv_lib_regex_regcomp" = xyes; then | |
439 | posix_regex_lib_found=1 | |
440 | fi | |
441 | fi | |
c9b68f41 MN |
442 | fi |
443 | fi | |
9fe06744 AM |
444 | if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then |
445 | AC_CHECK_HEADERS([pcreposix.h]) | |
9797fb4e | 446 | AC_CHECK_LIB(pcreposix,regcomp) |
d16c4871 AM |
447 | if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then |
448 | AC_MSG_NOTICE(trying libpcreposix check again with libpcre) | |
449 | unset ac_cv_lib_pcreposix_regcomp | |
450 | AC_CHECK_LIB(pcre,pcre_exec) | |
451 | AC_CHECK_LIB(pcreposix,regcomp) | |
452 | if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then | |
453 | AC_MSG_CHECKING(if PCRE_STATIC needs to be defined) | |
454 | AC_LINK_IFELSE( | |
455 | [AC_LANG_SOURCE(#include <pcreposix.h> | |
456 | int main() { return regcomp(NULL, NULL, 0); })], | |
457 | [without_pcre_static=yes], | |
458 | [without_pcre_static=no]) | |
459 | AC_LINK_IFELSE( | |
460 | [AC_LANG_SOURCE(#define PCRE_STATIC | |
461 | #include <pcreposix.h> | |
462 | int main() { return regcomp(NULL, NULL, 0); })], | |
463 | [with_pcre_static=yes], | |
464 | [with_pcre_static=no]) | |
465 | if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then | |
466 | AC_MSG_RESULT(yes) | |
467 | AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.]) | |
468 | elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then | |
469 | AC_MSG_RESULT(no) | |
470 | fi | |
471 | posix_regex_lib_found=1 | |
91717f72 | 472 | fi |
d16c4871 AM |
473 | else |
474 | posix_regex_lib_found=1 | |
9797fb4e | 475 | fi |
9fe06744 | 476 | fi |
c9b68f41 | 477 | |
b3cfa26b TK |
478 | # TODO: Give the user the option of using a pre-existing system |
479 | # libarchive. This will define HAVE_LIBARCHIVE which will cause | |
480 | # bsdtar_platform.h to use #include <...> for the libarchive headers. | |
481 | # Need to include Makefile.am magic to link against system | |
482 | # -larchive in that case. | |
483 | #AC_CHECK_LIB(archive,archive_version) | |
484 | ||
9f6c6d5d EVW |
485 | # Checks for supported compiler flags |
486 | AX_APPEND_COMPILE_FLAGS([-Wall -Wformat -Wformat-security]) | |
487 | ||
b3cfa26b TK |
488 | # Checks for typedefs, structures, and compiler characteristics. |
489 | AC_C_CONST | |
a580c98e | 490 | # la_TYPE_UID_T defaults to "int", which is incorrect for MinGW |
92165c97 CW |
491 | # and MSVC. Use a customized version. |
492 | la_TYPE_UID_T | |
b3cfa26b TK |
493 | AC_TYPE_MODE_T |
494 | # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on | |
495 | # most systems... default to "long long" instead. | |
496 | AC_CHECK_TYPE(off_t, [long long]) | |
497 | AC_TYPE_SIZE_T | |
498 | AC_CHECK_TYPE(id_t, [unsigned long]) | |
499 | AC_CHECK_TYPE(uintptr_t, [unsigned int]) | |
8ac32d27 | 500 | |
9d72ea76 MN |
501 | # Check for tm_gmtoff in struct tm |
502 | AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, | |
503 | [ | |
504 | #include <time.h> | |
505 | ]) | |
506 | ||
a3b61f44 MN |
507 | # Check for f_namemax in struct statfs |
508 | AC_CHECK_MEMBERS([struct statfs.f_namemax],,, | |
509 | [ | |
510 | #include <sys/param.h> | |
511 | #include <sys/mount.h> | |
512 | ]) | |
513 | ||
19c22e92 BK |
514 | # Check for f_iosize in struct statvfs |
515 | AC_CHECK_MEMBERS([struct statvfs.f_iosize],,, | |
516 | [ | |
517 | #include <sys/statvfs.h> | |
518 | ]) | |
519 | ||
8ac32d27 TK |
520 | # Check for birthtime in struct stat |
521 | AC_CHECK_MEMBERS([struct stat.st_birthtime]) | |
522 | ||
b3cfa26b | 523 | # Check for high-resolution timestamps in struct stat |
8ac32d27 | 524 | AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) |
b3cfa26b TK |
525 | AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) |
526 | AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) | |
d831cc4b BJ |
527 | AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX |
528 | AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 | |
a0b5f839 | 529 | AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd |
c15d8e24 TK |
530 | # Check for block size support in struct stat |
531 | AC_CHECK_MEMBERS([struct stat.st_blksize]) | |
c5e9786e TK |
532 | # Check for st_flags in struct stat (BSD fflags) |
533 | AC_CHECK_MEMBERS([struct stat.st_flags]) | |
b3cfa26b TK |
534 | |
535 | # If you have uintmax_t, we assume printf supports %ju | |
536 | # If you have unsigned long long, we assume printf supports %llu | |
537 | # TODO: Check for %ju and %llu support directly. | |
538 | AC_CHECK_TYPES([uintmax_t, unsigned long long]) | |
539 | ||
566a6636 TK |
540 | # We use C99-style integer types |
541 | # Declare them if the local platform doesn't already do so. | |
b3cfa26b | 542 | AC_TYPE_INTMAX_T |
b3cfa26b | 543 | AC_TYPE_UINTMAX_T |
566a6636 | 544 | AC_TYPE_INT64_T |
b3cfa26b | 545 | AC_TYPE_UINT64_T |
566a6636 TK |
546 | AC_TYPE_INT32_T |
547 | AC_TYPE_UINT32_T | |
548 | AC_TYPE_INT16_T | |
549 | AC_TYPE_UINT16_T | |
3de335e1 | 550 | AC_TYPE_UINT8_T |
b3cfa26b | 551 | |
2f637b08 TK |
552 | AC_CHECK_DECLS([SIZE_MAX, INT32_MAX, INT32_MIN]) |
553 | AC_CHECK_DECLS([INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) | |
b699d5c6 | 554 | AC_CHECK_DECLS([INTMAX_MAX, INTMAX_MIN, UINTMAX_MAX]) |
a1f91bd1 MN |
555 | |
556 | AC_CHECK_DECL([SSIZE_MAX], | |
557 | [AC_DEFINE(HAVE_DECL_SSIZE_MAX, 1, [Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you don't.])], | |
558 | [], | |
559 | [#include <limits.h>]) | |
b3cfa26b TK |
560 | |
561 | AC_CHECK_DECL([EFTYPE], | |
562 | [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], | |
563 | [], | |
564 | [#include <errno.h>]) | |
565 | AC_CHECK_DECL([EILSEQ], | |
566 | [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], | |
567 | [], | |
568 | [#include <errno.h>]) | |
778a496c CW |
569 | AC_CHECK_TYPE([wchar_t], |
570 | [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl | |
571 | AC_CHECK_SIZEOF([wchar_t])], | |
572 | []) | |
573 | ||
b3cfa26b TK |
574 | AC_HEADER_TIME |
575 | ||
576 | # Checks for library functions. | |
577 | AC_PROG_GCC_TRADITIONAL | |
578 | AC_HEADER_MAJOR | |
579 | AC_FUNC_FSEEKO | |
580 | AC_FUNC_MEMCMP | |
581 | AC_FUNC_LSTAT | |
582 | AC_FUNC_STAT | |
583 | AC_FUNC_STRERROR_R | |
584 | AC_FUNC_STRFTIME | |
585 | AC_FUNC_VPRINTF | |
197cc2d1 CW |
586 | # check for: |
587 | # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) | |
588 | # To avoid necessity for including windows.h or special forward declaration | |
589 | # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' | |
590 | AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) | |
de0a204e | 591 | AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r dirfd]) |
ba463cc3 | 592 | AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork]) |
4f1939c9 MN |
593 | AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate]) |
594 | AC_CHECK_FUNCS([futimens futimes futimesat]) | |
a3b61f44 | 595 | AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r]) |
21467bd9 | 596 | AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r]) |
496b1876 | 597 | AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes]) |
47a98250 | 598 | AC_CHECK_FUNCS([mbrtowc memmove memset]) |
496b1876 | 599 | AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) |
8c1c0a7a | 600 | AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat]) |
9769e6f7 | 601 | AC_CHECK_FUNCS([readpassphrase]) |
4ba1f7d7 | 602 | AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) |
125047fc | 603 | AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) |
c9ad879b | 604 | AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) |
b6ba5603 | 605 | AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove]) |
0d47a868 | 606 | AC_CHECK_FUNCS([_ctime64_s _fseeki64]) |
5fb156f9 | 607 | AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64]) |
ed585028 CW |
608 | # detects cygwin-1.7, as opposed to older versions |
609 | AC_CHECK_FUNCS([cygwin_conv_path]) | |
b3cfa26b | 610 | |
e7642e12 JS |
611 | # DragonFly uses vfsconf, FreeBSD xvfsconf. |
612 | AC_CHECK_TYPES(struct vfsconf,,, | |
613 | [#if HAVE_SYS_TYPES_H | |
614 | #include <sys/types.h> | |
615 | #endif | |
616 | #include <sys/mount.h> | |
617 | ]) | |
618 | ||
a847b455 TK |
619 | AC_CHECK_TYPES(struct xvfsconf,,, |
620 | [#if HAVE_SYS_TYPES_H | |
621 | #include <sys/types.h> | |
622 | #endif | |
623 | #include <sys/mount.h> | |
624 | ]) | |
625 | ||
09654df8 TK |
626 | # There are several variants of readdir_r around; we only |
627 | # accept the POSIX-compliant version. | |
628 | AC_COMPILE_IFELSE( | |
629 | [AC_LANG_PROGRAM([[#include <dirent.h>]], | |
630 | [[DIR *dir; struct dirent e, *r; | |
c8f97841 | 631 | return(readdir_r(dir, &e, &r));]])], |
09654df8 TK |
632 | [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] |
633 | ) | |
634 | ||
b3cfa26b TK |
635 | # FreeBSD's nl_langinfo supports an option to specify whether the |
636 | # current locale uses month/day or day/month ordering. It makes the | |
637 | # output a little prettier... | |
638 | AC_CHECK_DECL([D_MD_ORDER], | |
639 | [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], | |
640 | [], | |
641 | [#if HAVE_LANGINFO_H | |
642 | #include <langinfo.h> | |
643 | #endif | |
644 | ]) | |
645 | ||
b3cfa26b TK |
646 | # Check for dirent.d_namlen field explicitly |
647 | # (This is a bit more straightforward than, if not quite as portable as, | |
648 | # the recipe given by the autoconf maintainers.) | |
649 | AC_CHECK_MEMBER(struct dirent.d_namlen,,, | |
650 | [#if HAVE_DIRENT_H | |
651 | #include <dirent.h> | |
652 | #endif | |
653 | ]) | |
654 | ||
655 | # Check for Extended Attributes support | |
656 | AC_ARG_ENABLE([xattr], | |
657 | AS_HELP_STRING([--disable-xattr], | |
b30c530a | 658 | [Disable Extended Attributes support (default: check)])) |
b3cfa26b TK |
659 | |
660 | if test "x$enable_xattr" != "xno"; then | |
661 | AC_CHECK_HEADERS([attr/xattr.h]) | |
9204d6e8 | 662 | AC_CHECK_HEADERS([sys/xattr.h sys/ea.h]) |
b25635ff | 663 | AC_SEARCH_LIBS([setxattr], [attr]) |
faec39ad TK |
664 | AC_CHECK_FUNCS([extattr_get_file extattr_list_file]) |
665 | AC_CHECK_FUNCS([extattr_set_fd extattr_set_file]) | |
0f5b79c8 | 666 | AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr]) |
faec39ad | 667 | AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr]) |
9204d6e8 BJ |
668 | AC_CHECK_FUNCS([fgetea flistea fsetea getea]) |
669 | AC_CHECK_FUNCS([lgetea listea llistea lsetea]) | |
6d23f1c5 JS |
670 | AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h> |
671 | #include <sys/extattr.h> | |
672 | ]) | |
b3cfa26b TK |
673 | fi |
674 | ||
675 | # Check for ACL support | |
676 | # | |
677 | # The ACL support in libarchive is written against the POSIX1e draft, | |
678 | # which was never officially approved and varies quite a bit across | |
679 | # platforms. Worse, some systems have completely non-POSIX acl functions, | |
680 | # which makes the following checks rather more complex than I would like. | |
681 | # | |
682 | AC_ARG_ENABLE([acl], | |
683 | AS_HELP_STRING([--disable-acl], | |
b30c530a | 684 | [Disable ACL support (default: check)])) |
b3cfa26b TK |
685 | |
686 | if test "x$enable_acl" != "xno"; then | |
b30c530a | 687 | AC_CHECK_HEADERS([acl/libacl.h]) |
b3cfa26b TK |
688 | AC_CHECK_HEADERS([sys/acl.h]) |
689 | AC_CHECK_LIB([acl],[acl_get_file]) | |
b4099917 TK |
690 | AC_CHECK_FUNCS([acl_create_entry acl_get_fd_np]) |
691 | AC_CHECK_FUNCS([acl_init acl_set_fd acl_set_fd_np acl_set_file]) | |
b3cfa26b TK |
692 | |
693 | AC_CHECK_TYPES(acl_permset_t,,, | |
694 | [#if HAVE_SYS_TYPES_H | |
695 | #include <sys/types.h> | |
696 | #endif | |
697 | #if HAVE_SYS_ACL_H | |
698 | #include <sys/acl.h> | |
699 | #endif | |
700 | ]) | |
701 | ||
702 | # The "acl_get_perm()" function was omitted from the POSIX draft. | |
703 | # (It's a pretty obvious oversight; otherwise, there's no way to | |
704 | # test for specific permissions in a permset.) Linux uses the obvious | |
705 | # name, FreeBSD adds _np to mark it as "non-Posix extension." | |
992652f4 MM |
706 | # Test for both as a double-check that we really have POSIX-style ACL |
707 | # support. | |
fc68ea32 | 708 | AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,, |
b3cfa26b TK |
709 | [#if HAVE_SYS_TYPES_H |
710 | #include <sys/types.h> | |
711 | #endif | |
712 | #if HAVE_SYS_ACL_H | |
713 | #include <sys/acl.h> | |
714 | #endif | |
715 | ]) | |
716 | ||
992652f4 MM |
717 | # Check for acl_is_trivial_np on FreeBSD |
718 | AC_CHECK_FUNCS(acl_is_trivial_np,,, | |
719 | [#if HAVE_SYS_TYPES_H | |
720 | #include <sys/types.h> | |
721 | #endif | |
722 | #if HAVE_SYS_ACL_H | |
723 | #include <sys/acl.h> | |
724 | #endif | |
725 | ]) | |
726 | ||
77ab581c MM |
727 | # Check for ACL_TYPE_NFS4 |
728 | AC_CHECK_DECL([ACL_TYPE_NFS4], | |
729 | [AC_DEFINE(HAVE_ACL_TYPE_NFS4, 1, [True for FreeBSD with NFSv4 ACL support])], | |
730 | [], | |
731 | [#include <sys/acl.h>]) | |
732 | ||
b3cfa26b TK |
733 | # MacOS has an acl.h that isn't POSIX. It can be detected by |
734 | # checking for ACL_USER | |
735 | AC_CHECK_DECL([ACL_USER], | |
736 | [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])], | |
737 | [], | |
738 | [#include <sys/acl.h>]) | |
85fb5122 MM |
739 | |
740 | # Solaris and derivates ACLs | |
741 | AC_CHECK_LIB([sec], [acl_get]) | |
742 | AC_CHECK_TYPES([aclent_t], [], [], [[#include <sys/acl.h>]]) | |
743 | AC_CHECK_TYPES([ace_t], [], [], [[#include <sys/acl.h>]]) | |
744 | AC_CHECK_FUNCS(acl_get facl_get acl_set facl_set) | |
b3cfa26b TK |
745 | fi |
746 | ||
747 | # Additional requirements | |
748 | AC_SYS_LARGEFILE | |
749 | ||
2d53ab9e AM |
750 | dnl NOTE: Crypto checks must run last. |
751 | AC_DEFUN([CRYPTO_CHECK], [ | |
752 | if test "$found_$1" != yes; then | |
2d53ab9e | 753 | saved_CPPFLAGS="$CPPFLAGS" |
38644a9a | 754 | CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" |
2d53ab9e AM |
755 | touch "check_crypto_md.h" |
756 | AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2]) | |
757 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
758 | #define ARCHIVE_$1_COMPILE_TEST | |
759 | #define ARCHIVE_CRYPTO_$1_$2 | |
760 | #define PLATFORM_CONFIG_H "check_crypto_md.h" | |
761 | ||
c4c6533b | 762 | $(cat "$srcdir/libarchive/archive_digest.c") |
2d53ab9e AM |
763 | |
764 | int | |
765 | main(int argc, char **argv) | |
766 | { | |
767 | archive_$3_ctx ctx; | |
768 | archive_$3_init(&ctx); | |
769 | archive_$3_update(&ctx, *argv, argc); | |
770 | archive_$3_final(&ctx, NULL); | |
771 | return 0; | |
772 | } | |
773 | ])], | |
774 | [ AC_MSG_RESULT([yes]) | |
775 | found_$1=yes | |
177cf35b | 776 | found_$2=yes |
2d53ab9e AM |
777 | AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.]) |
778 | ], | |
779 | [ AC_MSG_RESULT([no])]) | |
2d53ab9e AM |
780 | CPPFLAGS="$saved_CPPFLAGS" |
781 | rm "check_crypto_md.h" | |
782 | fi | |
783 | ]) | |
784 | ||
275000df MN |
785 | AC_DEFUN([CRYPTO_CHECK_WIN], [ |
786 | if test "$found_$1" != yes; then | |
787 | AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN]) | |
788 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
275000df MN |
789 | #define ARCHIVE_$1_COMPILE_TEST |
790 | #include <windows.h> | |
791 | #include <wincrypt.h> | |
792 | ||
793 | int | |
794 | main(int argc, char **argv) | |
795 | { | |
796 | (void)argc; | |
797 | (void)argv; | |
798 | ||
799 | return ($2); | |
800 | } | |
801 | ])], | |
802 | [ AC_MSG_RESULT([yes]) | |
803 | found_$1=yes | |
177cf35b | 804 | found_WIN=yes |
275000df MN |
805 | AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.]) |
806 | ], | |
807 | [ AC_MSG_RESULT([no])]) | |
808 | fi | |
809 | ]) | |
810 | ||
811 | case "$host_os" in | |
1e2b6c98 | 812 | *mingw* | *cygwin* | *msys*) |
275000df MN |
813 | ;; |
814 | *) | |
815 | CRYPTO_CHECK(MD5, LIBC, md5) | |
816 | CRYPTO_CHECK(MD5, LIBSYSTEM, md5) | |
817 | CRYPTO_CHECK(RMD160, LIBC, rmd160) | |
818 | CRYPTO_CHECK(SHA1, LIBC, sha1) | |
819 | CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1) | |
820 | CRYPTO_CHECK(SHA256, LIBC, sha256) | |
821 | CRYPTO_CHECK(SHA256, LIBC2, sha256) | |
822 | CRYPTO_CHECK(SHA256, LIBC3, sha256) | |
823 | CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256) | |
824 | CRYPTO_CHECK(SHA384, LIBC, sha384) | |
825 | CRYPTO_CHECK(SHA384, LIBC2, sha384) | |
826 | CRYPTO_CHECK(SHA384, LIBC3, sha384) | |
827 | CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384) | |
828 | CRYPTO_CHECK(SHA512, LIBC, sha512) | |
829 | CRYPTO_CHECK(SHA512, LIBC2, sha512) | |
830 | CRYPTO_CHECK(SHA512, LIBC3, sha512) | |
831 | CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512) | |
832 | ;; | |
833 | esac | |
2d53ab9e | 834 | |
00ac9023 | 835 | if test "x$with_nettle" != "xno"; then |
177cf35b | 836 | AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) |
48e40df7 | 837 | AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h]) |
177cf35b | 838 | saved_LIBS=$LIBS |
48e40df7 | 839 | AC_CHECK_LIB(nettle,nettle_sha1_init) |
177cf35b AM |
840 | CRYPTO_CHECK(MD5, NETTLE, md5) |
841 | CRYPTO_CHECK(RMD160, NETTLE, rmd160) | |
842 | CRYPTO_CHECK(SHA1, NETTLE, sha1) | |
843 | CRYPTO_CHECK(SHA256, NETTLE, sha256) | |
844 | CRYPTO_CHECK(SHA384, NETTLE, sha384) | |
845 | CRYPTO_CHECK(SHA512, NETTLE, sha512) | |
846 | if test "x$found_NETTLE" != "xyes"; then | |
847 | LIBS=$saved_LIBS | |
848 | fi | |
00ac9023 | 849 | fi |
48e40df7 | 850 | |
2d53ab9e | 851 | if test "x$with_openssl" != "xno"; then |
177cf35b AM |
852 | AC_CHECK_HEADERS([openssl/evp.h]) |
853 | saved_LIBS=$LIBS | |
045e5c5a | 854 | case "$host_os" in |
1e2b6c98 | 855 | *mingw* | *cygwin* | *msys*) |
045e5c5a AM |
856 | case "$host_cpu" in |
857 | x86_64) | |
48e40df7 | 858 | AC_CHECK_LIB(eay64,OPENSSL_config) |
045e5c5a | 859 | if test "x$ac_cv_lib_eay64_main" != "xyes"; then |
48e40df7 | 860 | AC_CHECK_LIB(eay32,OPENSSL_config) |
045e5c5a AM |
861 | fi |
862 | ;; | |
863 | *) | |
48e40df7 | 864 | AC_CHECK_LIB(eay32,OPENSSL_config) |
045e5c5a AM |
865 | ;; |
866 | esac | |
867 | ;; | |
868 | *) | |
48e40df7 | 869 | AC_CHECK_LIB(crypto,OPENSSL_config) |
045e5c5a AM |
870 | ;; |
871 | esac | |
fdd5acfe AM |
872 | CRYPTO_CHECK(MD5, OPENSSL, md5) |
873 | CRYPTO_CHECK(RMD160, OPENSSL, rmd160) | |
874 | CRYPTO_CHECK(SHA1, OPENSSL, sha1) | |
875 | CRYPTO_CHECK(SHA256, OPENSSL, sha256) | |
876 | CRYPTO_CHECK(SHA384, OPENSSL, sha384) | |
877 | CRYPTO_CHECK(SHA512, OPENSSL, sha512) | |
177cf35b AM |
878 | if test "x$found_OPENSSL" != "xyes"; then |
879 | LIBS=$saved_LIBS | |
ce08c484 MN |
880 | else |
881 | AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) | |
177cf35b | 882 | fi |
f593e038 | 883 | AC_CHECK_LIB(crypto,EVP_CIPHER_CTX_init) |
2d53ab9e | 884 | fi |
f8709112 TK |
885 | |
886 | # Probe libmd AFTER OpenSSL/libcrypto. | |
887 | # The two are incompatible and OpenSSL is more complete. | |
177cf35b AM |
888 | AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) |
889 | saved_LIBS=$LIBS | |
48e40df7 | 890 | AC_CHECK_LIB(md,MD5Init) |
fdd5acfe AM |
891 | CRYPTO_CHECK(MD5, LIBMD, md5) |
892 | CRYPTO_CHECK(RMD160, LIBMD, rmd160) | |
893 | CRYPTO_CHECK(SHA1, LIBMD, sha1) | |
894 | CRYPTO_CHECK(SHA256, LIBMD, sha256) | |
895 | CRYPTO_CHECK(SHA512, LIBMD, sha512) | |
177cf35b AM |
896 | if test "x$found_LIBMD" != "xyes"; then |
897 | LIBS=$saved_LIBS | |
898 | fi | |
2d53ab9e | 899 | |
c078ff5d | 900 | case "$host_os" in |
1e2b6c98 | 901 | *mingw* | *cygwin* | *msys*) |
c078ff5d AM |
902 | CRYPTO_CHECK_WIN(MD5, CALG_MD5) |
903 | CRYPTO_CHECK_WIN(SHA1, CALG_SHA1) | |
904 | CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256) | |
905 | CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384) | |
906 | CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512) | |
907 | ;; | |
908 | esac | |
909 | ||
af77429c PB |
910 | # Ensure test directories are present if building out-of-tree |
911 | AC_CONFIG_COMMANDS([mkdirs], | |
41a759a7 | 912 | [mkdir -p libarchive/test tar/test cat/test cpio/test]) |
af77429c | 913 | |
b3cfa26b | 914 | AC_OUTPUT |