1 ###############################################################################
3 AC_INIT([wimlib], m4_esyscmd_s([tools/get-version-number.sh]),
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])
15 AC_CONFIG_HEADERS([config.h])
16 AC_CONFIG_FILES([Makefile] [doc/Doxyfile] [wimlib.pc])
17 AC_CONFIG_FILES([programs/mkwinpeimg], [chmod +x programs/mkwinpeimg])
19 PKGCONFIG_PRIVATE_REQUIRES=""
20 PKGCONFIG_PRIVATE_LIBS=""
22 ###############################################################################
23 # General platform features #
24 ###############################################################################
30 WINDOWS_NATIVE_BUILD="no"
32 PLATFORM_CFLAGS="-fvisibility=hidden"
38 WINDOWS_NATIVE_BUILD="yes"
39 # -D__MINGW_USE_VC2005_COMPAT: make time_t 64-bit on 32-bit Windows.
40 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"
41 PLATFORM_CFLAGS="-municode -mno-ms-bitfields"
42 PLATFORM_LDFLAGS="-no-undefined"
43 WITH_NTFS_3G_DEFAULT="no"
44 WITH_FUSE_DEFAULT="no"
48 WITH_NTFS_3G_DEFAULT="yes"
49 WITH_FUSE_DEFAULT="yes"
53 WITH_NTFS_3G_DEFAULT="yes"
54 WITH_FUSE_DEFAULT="no"
58 AC_SUBST([PLATFORM_CPPFLAGS], [$PLATFORM_CPPFLAGS])
59 AC_SUBST([PLATFORM_CFLAGS], [$PLATFORM_CFLAGS])
60 AC_SUBST([PLATFORM_LDFLAGS], [$PLATFORM_LDFLAGS])
61 AM_CONDITIONAL([WINDOWS_NATIVE_BUILD], [test "$WINDOWS_NATIVE_BUILD" = "yes"])
63 # Useful functions which we can do without.
64 AC_CHECK_FUNCS([futimens utimensat flock mempcpy \
65 openat fstatat readlinkat fdopendir posix_fallocate \
66 llistxattr lgetxattr fsetxattr lsetxattr getopt_long_only])
68 # Header checks, most of which are only here to satisfy conditional includes
69 # made by the libntfs-3g headers.
70 AC_CHECK_HEADERS([alloca.h \
89 # Does stat() support nanosecond-precision timestamps? (This is relevant on
90 # UNIX but not on Windows.)
91 AC_CHECK_MEMBER([struct stat.st_mtim],
92 [AC_DEFINE([HAVE_STAT_NANOSECOND_PRECISION], [1],
93 [Define to 1 if stat() supports nanosecond precision
96 [#include <sys/stat.h>])
98 ###############################################################################
99 # Required libraries #
100 ###############################################################################
102 # ------------------------------ pthreads -------------------------------------
103 if test "$WINDOWS_NATIVE_BUILD" != "yes"; then
104 AX_PTHREAD([], [AC_MSG_ERROR(["cannot find pthreads library"])])
107 ###############################################################################
108 # Configuration options #
109 ###############################################################################
111 # ------------------------- ntfs-3g support -----------------------------------
113 AC_MSG_CHECKING([whether to include support for ntfs-3g])
114 AC_ARG_WITH([ntfs-3g],
115 [AS_HELP_STRING([--without-ntfs-3g],
116 [build without libntfs-3g. This will disable the
117 ability to capture or apply a WIM image directly
118 from/to an unmounted NTFS volume.])],
119 [WITH_NTFS_3G=$withval],
120 [WITH_NTFS_3G=$WITH_NTFS_3G_DEFAULT])
121 AC_MSG_RESULT([$WITH_NTFS_3G])
123 if test "$WITH_NTFS_3G" = "yes"; then
124 PKG_CHECK_MODULES([LIBNTFS_3G], [libntfs-3g >= 2011.4.12], [],
125 [AC_MSG_ERROR([Cannot find libntfs-3g version 2011-4-12 or
126 later! Without libntfs-3g, wimlib cannot include support for
127 capturing or applying a WIM image directly from/to an unmounted
128 NTFS volume while preserving NTFS-specific data such as
129 security descriptors and named data streams. Either install
130 libntfs-3g, or configure --without-ntfs-3g to disable this
131 feature. If your operating system packages development files
132 separately, the package you need to install may be called
133 ntfs-3g-dev, ntfs-3g-devel, or similar.])])
134 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
135 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3G support])
137 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
139 # ------------------------ FUSE mount support ---------------------------------
141 AC_MSG_CHECKING([whether to include support for mounting WIMs])
143 [AS_HELP_STRING([--without-fuse],
144 [build without libfuse3. This will disable the
145 ability to mount WIM images.])],
146 [WITH_FUSE=$withval],
147 [WITH_FUSE=$WITH_FUSE_DEFAULT])
148 AC_MSG_RESULT([$WITH_FUSE])
150 if test "$WITH_FUSE" = "yes"; then
152 PKG_CHECK_MODULES([LIBFUSE], [fuse3], [],
153 [AC_MSG_ERROR([Cannot find libfuse3!
154 Without libfuse3, wimlib cannot include support for mounting WIM
155 images. Either install libfuse3, or configure --without-fuse to
156 disable this feature. If your operating system packages
157 development files separately, the package you need to install
158 may be called libfuse3-dev, fuse-devel, or similar.])])
159 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
160 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
162 AC_CHECK_LIB([rt], [mq_open], [],
163 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
164 Extensions Library)! wimlib needs this for the POSIX message queue
165 functions, which are used in the code for mounting WIM images. Recent
166 versions of glibc include this library. Either install this library, or
167 configure --without-fuse to disable support for mounting WIM images.])])
169 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
170 AC_SUBST([LIBRT_LIBS], [-lrt])
172 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
174 # ----------------------------- Other options ---------------------------------
176 AC_ARG_WITH(pkgconfigdir,
177 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
178 [pkgconfigdir=$withval],
179 [pkgconfigdir='${libdir}/pkgconfig'])
180 AC_SUBST(pkgconfigdir)
182 AC_MSG_CHECKING([whether to enable supporting code for tests])
183 AC_ARG_ENABLE([test-support],
184 [AS_HELP_STRING([--enable-test-support],
185 [Enable supporting code for tests (developers only)])],
186 [ENABLE_TEST_SUPPORT=$enableval],
187 [ENABLE_TEST_SUPPORT=no])
188 AC_MSG_RESULT([$ENABLE_TEST_SUPPORT])
189 if test "$ENABLE_TEST_SUPPORT" = "yes" ; then
190 AC_DEFINE([ENABLE_TEST_SUPPORT], [1],
191 [Define to 1 to enable supporting code for tests])
193 AM_CONDITIONAL([ENABLE_TEST_SUPPORT], [test "$ENABLE_TEST_SUPPORT" = "yes"])
195 ###############################################################################
197 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
198 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])