Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 639 lines (564 sloc) 20.903 kB
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
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.
e874faa @kientzle Bump trunk to 3.0.900a so it will be ready to
kientzle authored
7 m4_define([LIBARCHIVE_VERSION_S],[3.0.900a])
8 m4_define([LIBARCHIVE_VERSION_N],[3000900])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
9
80bdb4b @kientzle Mark this as 2.6.901a - as of this point, FreeBSD-CURRENT is in sync …
kientzle authored
10 dnl bsdtar and bsdcpio versioning tracks libarchive
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
11 m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
80bdb4b @kientzle Mark this as 2.6.901a - as of this point, FreeBSD-CURRENT is in sync …
kientzle authored
12 m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S())
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
13
77cfbb9 Revert r2412 and require autoconf 2.65 instead.
Joerg Sonnenberger authored
14 AC_PREREQ(2.65)
15
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
16 #
17 # Now starts the "real" configure script.
18 #
19
66319e4 @kientzle Use the preferred spelling of FreeBSD.org.
kientzle authored
20 AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@FreeBSD.org])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
21 # Make sure the srcdir contains "libarchive" directory
22 AC_CONFIG_SRCDIR([libarchive])
23 # Use auxiliary subscripts from this subdirectory (cleans up root)
4c9c2bc @kientzle Move some of the autoconf support files into build/autoconf.
kientzle authored
24 AC_CONFIG_AUX_DIR([build/autoconf])
79cb8e5 Issue 15, part 14. Build system
Charles Wilson authored
25 # M4 scripts
80b5f20 @kientzle Files that are used by the autoconf build system belong in
kientzle authored
26 AC_CONFIG_MACRO_DIR([build/autoconf])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
27 # Must follow AC_CONFIG macros above...
28 AM_INIT_AUTOMAKE()
29
f2488cf @kientzle Update shared library version computation for upcoming 3.0.0a release.
kientzle authored
30 # Libtool's "interface version" can be computed from the libarchive version.
31
32 # Libtool interface version bumps on any API change, so increments
33 # whenever libarchive minor version does.
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
34 ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 ))
f2488cf @kientzle Update shared library version computation for upcoming 3.0.0a release.
kientzle authored
35 # Libarchive 2.7 == libtool interface 9 = 2 + 7
36 # Libarchive 2.8 == libtool interface 10 = 2 + 8
7eeddea @kientzle Leave libtool version 11 for a possible libarchive 2.9 release.
kientzle authored
37 # Libarchive 2.9 == libtool interface 11 = 2 + 8
38 # Libarchive 3.0 == libtool interface 12
39 # Libarchive 3.x == libtool interface 12 + x
40 ARCHIVE_INTERFACE=`echo $((12 + ${ARCHIVE_MINOR}))`
f2488cf @kientzle Update shared library version computation for upcoming 3.0.0a release.
kientzle authored
41 # Libarchive revision is bumped on any source change === libtool revision
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
42 ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 ))
f2488cf @kientzle Update shared library version computation for upcoming 3.0.0a release.
kientzle authored
43 # Libarchive minor is bumped on any interface addition === libtool age
7f6d230 @kientzle Rename ARCHIVE_LIBTOOL_MAJOR to ARCHIVE_INTERFACE.
kientzle authored
44 ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
45
46 # Stick the version numbers into config.h
47 AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()",
48 [Version number of libarchive])
49 AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()",
50 [Version number of libarchive as a single integer])
51 AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()",
52 [Version number of bsdcpio])
53 AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()",
54 [Version number of bsdtar])
55
56 # The shell variables here must be the same as the AC_SUBST() variables
57 # below, but the shell variable names apparently cannot be the same as
58 # the m4 macro names above. Why? Ask autoconf.
59 BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S()
60 BSDTAR_VERSION_STRING=BSDTAR_VERSION_S()
61 LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S()
62 LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N()
63
64 # Substitute the above version numbers into the various files below.
65 # Yes, I believe this is the fourth time we define what are essentially
66 # the same symbols. Why? Ask autoconf.
67 AC_SUBST(ARCHIVE_LIBTOOL_VERSION)
68 AC_SUBST(BSDCPIO_VERSION_STRING)
69 AC_SUBST(BSDTAR_VERSION_STRING)
70 AC_SUBST(LIBARCHIVE_VERSION_STRING)
71 AC_SUBST(LIBARCHIVE_VERSION_NUMBER)
72
73 AC_CONFIG_HEADERS([config.h])
74 AC_CONFIG_FILES([Makefile])
bafc3c6 @kientzle pkgconfig support from Xavier, plus a couple of missing files added to
kientzle authored
75 AC_CONFIG_FILES([build/pkgconfig/libarchive.pc])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
76
79cb8e5 Issue 15, part 14. Build system
Charles Wilson authored
77 # Check for host type
78 AC_CANONICAL_HOST
79
80 dnl Compilation on mingw and Cygwin needs special Makefile rules
81 inc_windows_files=no
82 inc_cygwin_files=no
83 case "$host_os" in
84 *mingw* ) inc_windows_files=yes ;;
85 *cygwin*) inc_cygwin_files=yes ;;
86 esac
87 AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
88 AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
89
c31d1bc Ensure __USE_MINGW_ANSI_STDIO is defined for MinGW builds.
Charles Wilson authored
90 dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc)
91 PLATFORMCPPFLAGS=
92 case "$host_os" in
93 *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;;
94 esac
95 AC_SUBST(PLATFORMCPPFLAGS)
96
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
97 # Checks for programs.
98 AC_PROG_CC
99 AM_PROG_CC_C_O
6ca9835 @ggcueroad Eliminate compiling failure on OpenSolaris.
ggcueroad authored
100 AC_USE_SYSTEM_EXTENSIONS
01a4df5 @kientzle Revert a change that was inadvertently picked up in r2793.
kientzle authored
101 AC_LIBTOOL_WIN32_DLL
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
102 AC_PROG_LIBTOOL
103 AC_CHECK_TOOL([STRIP],[strip])
104
105 #
106 # Options for building bsdtar.
107 #
108 # Default is to build bsdtar, but allow people to override that.
109 #
110 AC_ARG_ENABLE([bsdtar],
111 [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)])
112 AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar])
113 AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar])
114 AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])],
115 [], [enable_bsdtar=yes])
116
117 case "$enable_bsdtar" in
118 yes)
119 if test "$enable_static" = "no"; then
120 static_bsdtar=no
121 else
122 static_bsdtar=yes
123 fi
124 build_bsdtar=yes
125 ;;
126 dynamic|shared)
127 if test "$enable_shared" = "no"; then
128 AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive])
129 fi
130 build_bsdtar=yes
131 static_bsdtar=no
132 ;;
133 static)
134 build_bsdtar=yes
135 static_bsdtar=yes
136 ;;
137 no)
138 build_bsdtar=no
139 static_bsdtar=no
140 ;;
141 *)
142 AC_MSG_FAILURE([Unsupported value for --enable-bsdtar])
143 ;;
144 esac
145
146 AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ])
147 AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ])
148
149 #
150 # Options for building bsdcpio.
151 #
152 # Default is not to build bsdcpio, but that can be overridden.
153 #
154 AC_ARG_ENABLE([bsdcpio],
f9a97a0 @kientzle Enable bsdcpio by default.
kientzle authored
155 [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
156 AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio])
157 AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio])
f9a97a0 @kientzle Enable bsdcpio by default.
kientzle authored
158 AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])],
159 [], [enable_bsdcpio=yes])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
160
161 case "$enable_bsdcpio" in
162 yes)
163 if test "$enable_static" = "no"; then
164 static_bsdcpio=no
165 else
166 static_bsdcpio=yes
167 fi
168 build_bsdcpio=yes
169 ;;
170 dynamic|shared)
171 if test "$enabled_shared" = "no"; then
172 AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive])
173 fi
174 build_bsdcpio=yes
175 ;;
176 static)
177 build_bsdcpio=yes
178 static_bsdcpio=yes
179 ;;
180 no)
181 build_bsdcpio=no
182 static_bsdcpio=no
183 ;;
184 *)
185 AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio])
186 ;;
187 esac
188
189 AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ])
190 AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ])
191
197cc2d Refine win32 api checks and usage.
Charles Wilson authored
192 # Set up defines needed before including any headers
193 case $host in
194 *mingw* | *cygwin* )
195 AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
196 AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
197 ;;
198 esac
199
f88e0e7 @ggcueroad Use CoreServices framework for Mac OS X in configure.ac, the same thi…
ggcueroad authored
200 # We need CoreServices on Mac OS.
3def082 @ggcueroad On Mac OS, Link CoreFoundation to avoid build failure.
ggcueroad authored
201 case $host in
202 *darwin* )
f88e0e7 @ggcueroad Use CoreServices framework for Mac OS X in configure.ac, the same thi…
ggcueroad authored
203 LIBS="${LIBS} -framework CoreServices"
3def082 @ggcueroad On Mac OS, Link CoreFoundation to avoid build failure.
ggcueroad authored
204 ;;
205 esac
206
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
207 # Checks for header files.
208 AC_HEADER_DIRENT
209 AC_HEADER_SYS_WAIT
3ee2350 @ggcueroad endian.h and sys/endian.h, which I added to use in r3515, are no long…
ggcueroad authored
210 AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h])
c247a74 @ggcueroad Rework lzh and lzx decoding to improve its performance.
ggcueroad authored
211 AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
95c7468 Properly check if EXT2_IOC_GETFLAGS is actually usable.
Joerg Sonnenberger authored
212
213 AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable],
214 [ac_cv_have_decl_EXT2_IOC_GETFLAGS],
215 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h>
216 @%:@include <ext2fs/ext2_fs.h>],
217 [int x = EXT2_IOC_GETFLAGS])],
218 [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])],
219 [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])])
220
221 AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes],
222 [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1],
223 [Define to 1 if you have a working EXT2_IOC_GETFLAGS])])
224
d216d02 @ggcueroad Determine sparse files through API such as lseek(HOLE).
ggcueroad authored
225 AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h])
996334f @ggcueroad Add support for archive_read_disk_current_filesystem_is_synthetic and
ggcueroad authored
226 AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h])
2008fc2 @kientzle Oooops. Forgot to add check signal.h, which is used by the
kientzle authored
227 AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h])
b21f351 @kientzle Write side of FreeBSD-specific extended attribute support.
kientzle authored
228 AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
3ee2350 @ggcueroad endian.h and sys/endian.h, which I added to use in r3515, are no long…
ggcueroad authored
229 AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h])
e3d450a @ggcueroad Add archive_read_disk_current_filesystem_is_synthetic and
ggcueroad authored
230 AC_CHECK_HEADERS([sys/mkdev.h sys/mount.h])
0cb2837 @ggcueroad Improve checking of statfs in LSB.
ggcueroad authored
231 AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h])
996334f @ggcueroad Add support for archive_read_disk_current_filesystem_is_synthetic and
ggcueroad authored
232 AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h])
233 AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h])
d7ae3cc @kientzle Correct the detection of wincrypt.h and winioctl.h
kientzle authored
234 AC_CHECK_HEADERS([windows.h])
235 # check windows.h first; the other headers require it.
236 AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[],
237 [[#ifdef HAVE_WINDOWS_H
238 # include <windows.h>
239 #endif
240 ]])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
241
242 # Checks for libraries.
2186dc2 @kientzle Provide configure options to suppress use of zlib, bzlib, and lzmadec.
kientzle authored
243 AC_ARG_WITH([zlib],
244 AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib]))
245
246 if test "x$with_zlib" != "xno"; then
247 AC_CHECK_HEADERS([zlib.h])
248 AC_CHECK_LIB(z,inflate)
249 fi
250
251 AC_ARG_WITH([bz2lib],
252 AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib]))
253
254 if test "x$with_bz2lib" != "xno"; then
255 AC_CHECK_HEADERS([bzlib.h])
256 AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
257 fi
258
259 AC_ARG_WITH([lzmadec],
260 AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec]))
261
262 if test "x$with_lzmadec" != "xno"; then
263 AC_CHECK_HEADERS([lzmadec.h])
264 AC_CHECK_LIB(lzmadec,lzmadec_decode)
265 fi
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
266
c91b353 @kientzle An attempt to fix the autoconf build now that we like to have iconv.
kientzle authored
267 AC_ARG_WITH([iconv],
268 AS_HELP_STRING([--without-iconv], [Don't try to link against iconv]))
269
270 if test "x$with_iconv" != "xno"; then
0981a12 @ggcueroad Avoid warning about iconv.h during configure.
ggcueroad authored
271 AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>])
d975ebe @ggcueroad Use ICONV_CONST instead of ICONV_IS_POSIX; switch a detection of icon…
ggcueroad authored
272 AM_ICONV
17fd872 @kientzle Fix the iconv probe and actually use the result.
kientzle authored
273 if test "x$am_cv_func_iconv" = "xyes"; then
89032bf @ggcueroad Use locale_charset() instead of nl_langinfo(CODESET) for GNU libiconv.
ggcueroad authored
274 AC_CHECK_HEADERS([localcharset.h])
275 am_save_LIBS="$LIBS"
276 LIBS="${LIBS} ${LIBICONV}"
277 AC_CHECK_FUNCS([locale_charset])
278 LIBS="${am_save_LIBS}"
279 if test "x$ac_cv_func_locale_charset" != "xyes"; then
280 # If locale_charset() is not in libiconv, we have to find libcharset.
281 AC_CHECK_LIB(charset,locale_charset)
282 fi
283 fi
c91b353 @kientzle An attempt to fix the autoconf build now that we like to have iconv.
kientzle authored
284 fi
285
c25e0da @ggcueroad Add support xz format and compressing lzma format.
ggcueroad authored
286 AC_ARG_WITH([lzma],
287 AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
288
289 if test "x$with_lzma" != "xno"; then
290 AC_CHECK_HEADERS([lzma.h])
291 AC_CHECK_LIB(lzma,lzma_stream_decoder)
292 fi
293
00ac902 @amejia1 Implement crypto support with the Nettle crypto library.
amejia1 authored
294 AC_ARG_WITH([nettle],
295 AS_HELP_STRING([--without-nettle], [Don't build with crypto support from Nettle]))
eace442 @kientzle Issue 22: --without-openssl skips probing for the hash functions.
kientzle authored
296 AC_ARG_WITH([openssl],
d2c0930 @ggcueroad Add support for xar reader.
ggcueroad authored
297 AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl]))
b0f3a5e @kientzle Disable OpenSSL probe on Darwin.
kientzle authored
298 case "$host_os" in
299 *darwin* ) with_openssl=no ;;
300 esac
d2c0930 @ggcueroad Add support for xar reader.
ggcueroad authored
301
302 AC_ARG_WITH([xml2],
303 AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2]))
304 AC_ARG_WITH([expat],
305 AS_HELP_STRING([--without-expat], [Don't build support for xar through expat]))
306
307 if test "x$with_xml2" != "xno"; then
308 AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}])
309 if test "x$XML2_CONFIG" != "x"; then
310 CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
e861099 @kientzle If we're using xml2-config to link libxml2, use it to get
kientzle authored
311 LIBS="${LIBS} `${XML2_CONFIG} --libs`"
5256aa1 @amejia1 Remove duplicate entry of -lxml2 in LIBS variable.
amejia1 authored
312 AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library))
313 else
314 AC_CHECK_LIB(xml2,xmlInitParser)
d2c0930 @ggcueroad Add support for xar reader.
ggcueroad authored
315 fi
b7115a7 @ggcueroad Add xar writer.
ggcueroad authored
316 AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h])
d2c0930 @ggcueroad Add support for xar reader.
ggcueroad authored
317 fi
318 if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then
319 if test "x$with_expat" != "xno"; then
aa5b327 @ggcueroad Don't check whether bsdxml is available or not.
ggcueroad authored
320 AC_CHECK_HEADERS([expat.h])
321 AC_CHECK_LIB(expat,XML_ParserCreate)
d2c0930 @ggcueroad Add support for xar reader.
ggcueroad authored
322 fi
323 fi
eace442 @kientzle Issue 22: --without-openssl skips probing for the hash functions.
kientzle authored
324
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
325 # TODO: Give the user the option of using a pre-existing system
326 # libarchive. This will define HAVE_LIBARCHIVE which will cause
327 # bsdtar_platform.h to use #include <...> for the libarchive headers.
328 # Need to include Makefile.am magic to link against system
329 # -larchive in that case.
330 #AC_CHECK_LIB(archive,archive_version)
331
332 # Checks for typedefs, structures, and compiler characteristics.
333 AC_C_CONST
92165c9 [MinGW/MSVC] Use correct types for (replacement) uid_t and git_d
Charles Wilson authored
334 # AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW
335 # and MSVC. Use a customized version.
336 la_TYPE_UID_T
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
337 AC_TYPE_MODE_T
338 # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
339 # most systems... default to "long long" instead.
340 AC_CHECK_TYPE(off_t, [long long])
341 AC_TYPE_SIZE_T
342 AC_CHECK_TYPE(id_t, [unsigned long])
343 AC_CHECK_TYPE(uintptr_t, [unsigned int])
8ac32d2 @kientzle archive_entry support for storing and managing birthtime data
kientzle authored
344
9d72ea7 @ggcueroad Introduce ISO writer.
ggcueroad authored
345 # Check for tm_gmtoff in struct tm
346 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,
347 [
348 #include <time.h>
349 ])
350
a3b61f4 @ggcueroad Tweak setup_current_filesystem() for FreeBSD to be able to be used
ggcueroad authored
351 # Check for f_namemax in struct statfs
352 AC_CHECK_MEMBERS([struct statfs.f_namemax],,,
353 [
354 #include <sys/param.h>
355 #include <sys/mount.h>
356 ])
357
19c22e9 @bradking Check for 'struct statvfs' member 'f_iosize'
bradking authored
358 # Check for f_iosize in struct statvfs
359 AC_CHECK_MEMBERS([struct statvfs.f_iosize],,,
360 [
361 #include <sys/statvfs.h>
362 ])
363
8ac32d2 @kientzle archive_entry support for storing and managing birthtime data
kientzle authored
364 # Check for birthtime in struct stat
365 AC_CHECK_MEMBERS([struct stat.st_birthtime])
366
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
367 # Check for high-resolution timestamps in struct stat
8ac32d2 @kientzle archive_entry support for storing and managing birthtime data
kientzle authored
368 AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
369 AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
370 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
d831cc4 add support for sub-second resolution timestamps on Tru64 and AIX
Björn Jacke authored
371 AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX
372 AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64
a0b5f83 add sub-second timestamp resolution for GNU Hurd
Björn Jacke authored
373 AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd
c15d8e2 @kientzle A couple of extra configuration tests, inspired by missing features
kientzle authored
374 # Check for block size support in struct stat
375 AC_CHECK_MEMBERS([struct stat.st_blksize])
c5e9786 @kientzle IFC
kientzle authored
376 # Check for st_flags in struct stat (BSD fflags)
377 AC_CHECK_MEMBERS([struct stat.st_flags])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
378
379 # If you have uintmax_t, we assume printf supports %ju
380 # If you have unsigned long long, we assume printf supports %llu
381 # TODO: Check for %ju and %llu support directly.
382 AC_CHECK_TYPES([uintmax_t, unsigned long long])
383
566a663 @kientzle Add autoconf logic to ensure we have int32_t, uint32_t, int16_t, and …
kientzle authored
384 # We use C99-style integer types
385 # Declare them if the local platform doesn't already do so.
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
386 AC_TYPE_INTMAX_T
387 AC_TYPE_UINTMAX_T
566a663 @kientzle Add autoconf logic to ensure we have int32_t, uint32_t, int16_t, and …
kientzle authored
388 AC_TYPE_INT64_T
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
389 AC_TYPE_UINT64_T
566a663 @kientzle Add autoconf logic to ensure we have int32_t, uint32_t, int16_t, and …
kientzle authored
390 AC_TYPE_INT32_T
391 AC_TYPE_UINT32_T
392 AC_TYPE_INT16_T
393 AC_TYPE_UINT16_T
3de335e @ggcueroad Fix build failure on Visual Studio.
ggcueroad authored
394 AC_TYPE_UINT8_T
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
395
a1f91bd @ggcueroad In configure, SSIZE_MAX requires limits.h
ggcueroad authored
396 AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
397
398 AC_CHECK_DECL([SSIZE_MAX],
399 [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.])],
400 [],
401 [#include <limits.h>])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
402
403 AC_CHECK_DECL([EFTYPE],
404 [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
405 [],
406 [#include <errno.h>])
407 AC_CHECK_DECL([EILSEQ],
408 [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])],
409 [],
410 [#include <errno.h>])
778a496 Issue 15, part 12. wchar_t is only 16 bits
Charles Wilson authored
411 AC_CHECK_TYPE([wchar_t],
412 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl
413 AC_CHECK_SIZEOF([wchar_t])],
414 [])
415
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
416 AC_HEADER_TIME
417
418 # Checks for library functions.
419 AC_PROG_GCC_TRADITIONAL
420 AC_HEADER_MAJOR
421 AC_FUNC_FSEEKO
422 AC_FUNC_MEMCMP
423 AC_FUNC_LSTAT
424 AC_FUNC_STAT
425 AC_FUNC_STRERROR_R
426 AC_FUNC_STRFTIME
427 AC_FUNC_VPRINTF
197cc2d Refine win32 api checks and usage.
Charles Wilson authored
428 # check for:
429 # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES)
430 # To avoid necessity for including windows.h or special forward declaration
431 # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
432 AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
411d7de @ggcueroad Unbreak build on msys; further portability.
ggcueroad authored
433 AC_CHECK_FUNCS([chflags chown chroot ctime_r])
ba463cc @ggcueroad Avoid the difference between posix and Windows about behavior of
ggcueroad authored
434 AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork])
4f1939c @ggcueroad Detect futimesat.
ggcueroad authored
435 AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
436 AC_CHECK_FUNCS([futimens futimes futimesat])
a3b61f4 @ggcueroad Tweak setup_current_filesystem() for FreeBSD to be able to be used
ggcueroad authored
437 AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r])
21467bd @kientzle Minor improvement of iconv detection; really something
kientzle authored
438 AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r])
496b187 @ggcueroad Improve archive_wstring_append_from_mbs function; use mbsnrtowcs or
ggcueroad authored
439 AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes])
399121d @ggcueroad We should use mbrtowc/mbtowc at archive_wstring_append_from_mbs inste…
ggcueroad authored
440 AC_CHECK_FUNCS([mbrtowc mbsnrtowcs memmove memset])
496b187 @ggcueroad Improve archive_wstring_append_from_mbs function; use mbsnrtowcs or
ggcueroad authored
441 AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp])
09654df @kientzle Only recognize the POSIX-compliant version of readdir_r.
kientzle authored
442 AC_CHECK_FUNCS([nl_langinfo openat pipe poll readlink readlinkat])
4ba1f7d @ggcueroad Prove that statfs is available.
ggcueroad authored
443 AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
125047f @kientzle Chuck Wilson's fixes for Cygwin and MinGW builds.
kientzle authored
444 AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
c9ad879 @ggcueroad Cover r1583.
ggcueroad authored
445 AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork])
7a4bf76 @ggcueroad Use wcsnrtombs() at archive_string_append_from_wcs_to_mbs() if availa…
ggcueroad authored
446 AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wcsnrtombs wctomb wmemcmp wmemcpy])
0d47a86 @ggcueroad Drop a use of CRL function _get_current_locale(), which msys does not…
ggcueroad authored
447 AC_CHECK_FUNCS([_ctime64_s _fseeki64])
5fb156f @ggcueroad Unbreak build on msys.
ggcueroad authored
448 AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64])
ed58502 Testsuite fixes for cygwin-1.5
Charles Wilson authored
449 # detects cygwin-1.7, as opposed to older versions
450 AC_CHECK_FUNCS([cygwin_conv_path])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
451
09654df @kientzle Only recognize the POSIX-compliant version of readdir_r.
kientzle authored
452 # There are several variants of readdir_r around; we only
453 # accept the POSIX-compliant version.
454 AC_COMPILE_IFELSE(
455 [AC_LANG_PROGRAM([[#include <dirent.h>]],
456 [[DIR *dir; struct dirent e, *r;
c8f9784 @kientzle Implement POSIX readdir_r checks in CMakeLists.txt.
kientzle authored
457 return(readdir_r(dir, &e, &r));]])],
09654df @kientzle Only recognize the POSIX-compliant version of readdir_r.
kientzle authored
458 [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])]
459 )
460
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
461 # FreeBSD's nl_langinfo supports an option to specify whether the
462 # current locale uses month/day or day/month ordering. It makes the
463 # output a little prettier...
464 AC_CHECK_DECL([D_MD_ORDER],
465 [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])],
466 [],
467 [#if HAVE_LANGINFO_H
468 #include <langinfo.h>
469 #endif
470 ])
471
472 # Check for dirent.d_namlen field explicitly
473 # (This is a bit more straightforward than, if not quite as portable as,
474 # the recipe given by the autoconf maintainers.)
475 AC_CHECK_MEMBER(struct dirent.d_namlen,,,
476 [#if HAVE_DIRENT_H
477 #include <dirent.h>
478 #endif
479 ])
480
481 # Check for Extended Attributes support
482 AC_ARG_ENABLE([xattr],
483 AS_HELP_STRING([--disable-xattr],
484 [Enable Extended Attributes support (default: check)]))
485
486 if test "x$enable_xattr" != "xno"; then
487 AC_CHECK_HEADERS([attr/xattr.h])
9204d6e add autoconf tests for AIX' EA interface
Björn Jacke authored
488 AC_CHECK_HEADERS([sys/xattr.h sys/ea.h])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
489 AC_CHECK_LIB(attr,setxattr)
faec39a @kientzle Add a check for wcrtomb() and control the FreeBSD extattr function
kientzle authored
490 AC_CHECK_FUNCS([extattr_get_file extattr_list_file])
491 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file])
0f5b79c @ggcueroad Use flistxattr/fgetxattr to get extended attributes on Linux
ggcueroad authored
492 AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr])
faec39a @kientzle Add a check for wcrtomb() and control the FreeBSD extattr function
kientzle authored
493 AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr])
9204d6e add autoconf tests for AIX' EA interface
Björn Jacke authored
494 AC_CHECK_FUNCS([fgetea flistea fsetea getea])
495 AC_CHECK_FUNCS([lgetea listea llistea lsetea])
6d23f1c Only include the FreeBSD-style extended attribute support, if
Joerg Sonnenberger authored
496 AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h>
497 #include <sys/extattr.h>
498 ])
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
499 fi
500
501 # Check for ACL support
502 #
503 # The ACL support in libarchive is written against the POSIX1e draft,
504 # which was never officially approved and varies quite a bit across
505 # platforms. Worse, some systems have completely non-POSIX acl functions,
506 # which makes the following checks rather more complex than I would like.
507 #
508 AC_ARG_ENABLE([acl],
509 AS_HELP_STRING([--disable-acl],
510 [Enable ACL support (default: check)]))
511
512 if test "x$enable_acl" != "xno"; then
513 AC_CHECK_HEADERS([sys/acl.h])
514 AC_CHECK_LIB([acl],[acl_get_file])
515 AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file])
516
517 AC_CHECK_TYPES(acl_permset_t,,,
518 [#if HAVE_SYS_TYPES_H
519 #include <sys/types.h>
520 #endif
521 #if HAVE_SYS_ACL_H
522 #include <sys/acl.h>
523 #endif
524 ])
525
526 # The "acl_get_perm()" function was omitted from the POSIX draft.
527 # (It's a pretty obvious oversight; otherwise, there's no way to
528 # test for specific permissions in a permset.) Linux uses the obvious
529 # name, FreeBSD adds _np to mark it as "non-Posix extension."
530 # Test for both as a double-check that we really have POSIX-style ACL support.
fc68ea3 @kientzle Probe acl_get_link and acl_get_link_np so that ACLs are properly
kientzle authored
531 AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,,
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
532 [#if HAVE_SYS_TYPES_H
533 #include <sys/types.h>
534 #endif
535 #if HAVE_SYS_ACL_H
536 #include <sys/acl.h>
537 #endif
538 ])
539
540 # MacOS has an acl.h that isn't POSIX. It can be detected by
541 # checking for ACL_USER
542 AC_CHECK_DECL([ACL_USER],
543 [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])],
544 [],
545 [#include <sys/acl.h>])
546 fi
547
548 # Additional requirements
549 AC_SYS_LARGEFILE
550
2d53ab9 @amejia1 Change how crypto support is implemented within libarchive.
amejia1 authored
551 dnl NOTE: Crypto checks must run last.
552 AC_DEFUN([CRYPTO_CHECK], [
553 if test "$found_$1" != yes; then
554 saved_LIBS="$LIBS"
555 saved_CPPFLAGS="$CPPFLAGS"
38644a9 @kientzle For out-of-tree builds, the placeholder config file
kientzle authored
556 CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive"
6986a2e @kientzle Crypto checks are cumulative; the test program needs
kientzle authored
557 LIBS="$LIBS $mdLIBS $4"
2d53ab9 @amejia1 Change how crypto support is implemented within libarchive.
amejia1 authored
558 touch "check_crypto_md.h"
559 AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2])
560 AC_LINK_IFELSE([AC_LANG_SOURCE([
561 #define ARCHIVE_$1_COMPILE_TEST
562 #define ARCHIVE_CRYPTO_$1_$2
563 #define PLATFORM_CONFIG_H "check_crypto_md.h"
564
565 $(cat "$srcdir/libarchive/archive_crypto.c")
566
567 int
568 main(int argc, char **argv)
569 {
570 archive_$3_ctx ctx;
571 archive_$3_init(&ctx);
572 archive_$3_update(&ctx, *argv, argc);
573 archive_$3_final(&ctx, NULL);
574 return 0;
575 }
576 ])],
577 [ AC_MSG_RESULT([yes])
578 found_$1=yes
475d3fe @amejia1 Remove duplicate libraries in $LIBS variable.
amejia1 authored
579 if [[ -n "$4" ]]; then
9d486c6 @kientzle Issue 212: A more accurate way to determine if a partucular
kientzle authored
580 # The .$4 avoids -e, which doesn't work on Solaris 10
581 # The _$mdLIBS allows .$4 to match at beginning of string <sigh>
582 test -n "$(echo _$mdLIBS | $GREP .$4)" || mdLIBS="$mdLIBS $4"
475d3fe @amejia1 Remove duplicate libraries in $LIBS variable.
amejia1 authored
583 fi
2d53ab9 @amejia1 Change how crypto support is implemented within libarchive.
amejia1 authored
584 AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.])
585 ],
586 [ AC_MSG_RESULT([no])])
587 LIBS="$saved_LIBS"
588 CPPFLAGS="$saved_CPPFLAGS"
589 rm "check_crypto_md.h"
590 fi
591 ])
592
593 CRYPTO_CHECK(MD5, LIBC, md5)
594 CRYPTO_CHECK(MD5, LIBSYSTEM, md5)
595 CRYPTO_CHECK(RMD160, LIBC, rmd160)
596 CRYPTO_CHECK(SHA1, LIBC, sha1)
597 CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1)
598 CRYPTO_CHECK(SHA256, LIBC, sha256)
599 CRYPTO_CHECK(SHA256, LIBC2, sha256)
600 CRYPTO_CHECK(SHA256, LIBC3, sha256)
601 CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256)
602 CRYPTO_CHECK(SHA384, LIBC, sha384)
603 CRYPTO_CHECK(SHA384, LIBC2, sha384)
604 CRYPTO_CHECK(SHA384, LIBC3, sha384)
605 CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384)
606 CRYPTO_CHECK(SHA512, LIBC, sha512)
607 CRYPTO_CHECK(SHA512, LIBC2, sha512)
608 CRYPTO_CHECK(SHA512, LIBC3, sha512)
609 CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512)
610
00ac902 @amejia1 Implement crypto support with the Nettle crypto library.
amejia1 authored
611 if test "x$with_nettle" != "xno"; then
612 CRYPTO_CHECK(MD5, NETTLE, md5, -lnettle)
613 CRYPTO_CHECK(RMD160, NETTLE, rmd160, -lnettle)
614 CRYPTO_CHECK(SHA1, NETTLE, sha1, -lnettle)
615 CRYPTO_CHECK(SHA256, NETTLE, sha256, -lnettle)
616 CRYPTO_CHECK(SHA384, NETTLE, sha384, -lnettle)
617 CRYPTO_CHECK(SHA512, NETTLE, sha512, -lnettle)
618 fi
2d53ab9 @amejia1 Change how crypto support is implemented within libarchive.
amejia1 authored
619 if test "x$with_openssl" != "xno"; then
620 CRYPTO_CHECK(MD5, OPENSSL, md5, -lcrypto)
621 CRYPTO_CHECK(RMD160, OPENSSL, rmd160, -lcrypto)
622 CRYPTO_CHECK(SHA1, OPENSSL, sha1, -lcrypto)
623 CRYPTO_CHECK(SHA256, OPENSSL, sha256, -lcrypto)
624 CRYPTO_CHECK(SHA384, OPENSSL, sha384, -lcrypto)
625 CRYPTO_CHECK(SHA512, OPENSSL, sha512, -lcrypto)
626 fi
f870911 @kientzle In autoconf configure, probe OpenSSL first, then libmd.
kientzle authored
627
628 # Probe libmd AFTER OpenSSL/libcrypto.
629 # The two are incompatible and OpenSSL is more complete.
630 CRYPTO_CHECK(MD5, LIBMD, md5, -lmd)
631 CRYPTO_CHECK(RMD160, LIBMD, rmd160, -lmd)
632 CRYPTO_CHECK(SHA1, LIBMD, sha1, -lmd)
633 CRYPTO_CHECK(SHA256, LIBMD, sha256, -lmd)
634 CRYPTO_CHECK(SHA512, LIBMD, sha512, -lmd)
635
2d53ab9 @amejia1 Change how crypto support is implemented within libarchive.
amejia1 authored
636 LIBS="$LIBS $mdLIBS"
637
b3cfa26 @kientzle Fill in the libarchive-portable build infrastructure that uses autoco…
kientzle authored
638 AC_OUTPUT
Something went wrong with that request. Please try again.