1 ###############################################################################
3 AC_INIT([wimlib], m4_esyscmd_s([tools/get-version-number]),
4 [https://wimlib.net/forums/])
5 AC_CONFIG_SRCDIR([src/wim.c])
6 AC_CONFIG_MACRO_DIR([m4])
7 AC_CONFIG_AUX_DIR([build-aux])
8 AM_INIT_AUTOMAKE([-Wall -Werror subdir-objects foreign])
11 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
14 AC_CONFIG_HEADERS([config.h])
15 AC_CONFIG_FILES([Makefile] [doc/Doxyfile] [wimlib.pc])
16 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
18 PKGCONFIG_PRIVATE_REQUIRES=""
19 PKGCONFIG_PRIVATE_LIBS=""
21 ###############################################################################
22 # General platform features #
23 ###############################################################################
29 WINDOWS_NATIVE_BUILD="no"
31 PLATFORM_CFLAGS="-fvisibility=hidden"
37 WINDOWS_NATIVE_BUILD="yes"
38 # -D__MINGW_USE_VC2005_COMPAT: make time_t 64-bit on 32-bit Windows.
39 PLATFORM_CPPFLAGS="-D_POSIX -D_POSIX_THREAD_SAFE_FUNCTIONS -DUNICODE -D_UNICODE -D_CRT_NON_CONFORMING_SWPRINTFS -D__MINGW_USE_VC2005_COMPAT -D_WIN32_WINNT=0x0600"
40 PLATFORM_CFLAGS="-municode -mno-ms-bitfields"
41 PLATFORM_LDFLAGS="-no-undefined"
42 WITH_NTFS_3G_DEFAULT="no"
43 WITH_FUSE_DEFAULT="no"
47 WITH_NTFS_3G_DEFAULT="yes"
48 WITH_FUSE_DEFAULT="yes"
52 WITH_NTFS_3G_DEFAULT="yes"
53 WITH_FUSE_DEFAULT="no"
57 AC_SUBST([PLATFORM_CPPFLAGS], [$PLATFORM_CPPFLAGS])
58 AC_SUBST([PLATFORM_CFLAGS], [$PLATFORM_CFLAGS])
59 AC_SUBST([PLATFORM_LDFLAGS], [$PLATFORM_LDFLAGS])
60 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"])
62 # Useful functions which we can do without.
63 AC_CHECK_FUNCS([futimens utimensat flock mempcpy \
64 openat fstatat readlinkat fdopendir posix_fallocate \
65 llistxattr lgetxattr fsetxattr lsetxattr getopt_long_only])
67 # Header checks, most of which are only here to satisfy conditional includes
68 # made by the libntfs-3g headers.
69 AC_CHECK_HEADERS([alloca.h \
88 # Does stat() support nanosecond-precision timestamps? (This is relevant on
89 # UNIX but not on Windows.)
90 AC_CHECK_MEMBER([struct stat.st_mtim],
91 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
92 [Define to 1 if stat() supports nanosecond precision
95 [#include <sys/stat.h>])
97 # Check for possible support for the Linux getrandom() system call
98 AC_CHECK_DECL([__NR_getrandom],
99 [AC_DEFINE([HAVE_NR_GETRANDOM], [1], [Define to 1 if the system
100 headers define a system call number for getrandom()])],
102 [#include <sys/syscall.h>])
104 ###############################################################################
105 # Required libraries #
106 ###############################################################################
108 # ------------------------------ pthreads -------------------------------------
109 if test "$WINDOWS_NATIVE_BUILD" != "yes"; then
110 AX_PTHREAD([], [AC_MSG_ERROR(["cannot find pthreads library"])])
113 # ------------------------------ libxml2 --------------------------------------
114 PKG_CHECK_MODULES([LIBXML2], [libxml-2.0])
115 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libxml-2.0"
117 ###############################################################################
118 # Configuration options #
119 ###############################################################################
121 # ------------------------- ntfs-3g support -----------------------------------
123 AC_MSG_CHECKING([whether to include support for ntfs-3g])
124 AC_ARG_WITH([ntfs-3g],
125 [AS_HELP_STRING([--without-ntfs-3g],
126 [build without libntfs-3g. This will disable the
127 ability to capture or apply a WIM image directly
128 from/to an unmounted NTFS volume.])],
129 [WITH_NTFS_3G=$withval],
130 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
131 AC_MSG_RESULT([$WITH_NTFS_3G])
133 if test "$WITH_NTFS_3G" = "yes"; then
134 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g >= 2011.4.12], [],
135 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12 or
136 later! Without libntfs-3g, wimlib cannot include support for
137 capturing or applying a WIM image directly from/to an unmounted
138 NTFS volume while preserving NTFS-specific data such as
139 security descriptors and named data streams. Either install
140 libntfs-3g, or configure --without-ntfs-3g to disable this
142 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
143 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3G support])
145 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
147 # ------------------------ FUSE mount support ---------------------------------
149 AC_MSG_CHECKING([whether to include support for mounting WIMs])
151 [AS_HELP_STRING([--without-fuse],
152 [build without libfuse. This will disable the
153 ability to mount WIM images.])],
154 [WITH_FUSE=$withval],
155 [WITH_FUSE=$WITH_FUSE_DEFAULT])
156 AC_MSG_RESULT([$WITH_FUSE])
158 if test "$WITH_FUSE" = "yes"; then
160 PKG_CHECK_MODULES([LIBFUSE], [fuse], [],
161 [AC_MSG_ERROR([Cannot find libfuse!
162 Without libfuse, wimlib cannot include support for mounting WIM
163 images. Either install libfuse, or configure --without-fuse to
164 disable this feature.])])
165 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
166 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
168 AC_CHECK_LIB([rt], [mq_open], [],
169 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
170 Extensions Library)! wimlib needs this for the POSIX message queue
171 functions, which are used in the code for mounting WIM images. Recent
172 versions of glibc include this library. Either install this library, or
173 configure --without-fuse to disable support for mounting WIM images.])])
175 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
176 AC_SUBST([LIBRT_LIBS], [-lrt])
178 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
180 # ----------------------------- Other options ---------------------------------
182 AC_ARG_WITH(pkgconfigdir,
183 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
184 [pkgconfigdir=$withval],
185 [pkgconfigdir='${libdir}/pkgconfig'])
186 AC_SUBST(pkgconfigdir)
188 AC_MSG_CHECKING([whether to enable supporting code for tests])
189 AC_ARG_ENABLE([test-support],
190 [AS_HELP_STRING([--enable-test-support],
191 [Enable supporting code for tests (developers only)])],
192 [ENABLE_TEST_SUPPORT=$enableval],
193 [ENABLE_TEST_SUPPORT=no])
194 AC_MSG_RESULT([$ENABLE_TEST_SUPPORT])
195 if test "$ENABLE_TEST_SUPPORT" = "yes" ; then
196 AC_DEFINE([ENABLE_TEST_SUPPORT], [1],
197 [Define to 1 to enable supporting code for tests])
199 AM_CONDITIONAL([ENABLE_TEST_SUPPORT], [test "$ENABLE_TEST_SUPPORT" = "yes"])
201 ###############################################################################
203 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
204 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])