Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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