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
132 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES libntfs-3g"
133 AC_DEFINE([WITH_NTFS_3G], [1], [Define to 1 if using NTFS-3G support])
135 AM_CONDITIONAL([WITH_NTFS_3G], [test "$WITH_NTFS_3G" = "yes"])
137 # ------------------------ FUSE mount support ---------------------------------
139 AC_MSG_CHECKING([whether to include support for mounting WIMs])
141 [AS_HELP_STRING([--without-fuse],
142 [build without libfuse. This will disable the
143 ability to mount WIM images.])],
144 [WITH_FUSE=$withval],
145 [WITH_FUSE=$WITH_FUSE_DEFAULT])
146 AC_MSG_RESULT([$WITH_FUSE])
148 if test "$WITH_FUSE" = "yes"; then
150 PKG_CHECK_MODULES([LIBFUSE], [fuse], [],
151 [AC_MSG_ERROR([Cannot find libfuse!
152 Without libfuse, wimlib cannot include support for mounting WIM
153 images. Either install libfuse, or configure --without-fuse to
154 disable this feature.])])
155 PKGCONFIG_PRIVATE_REQUIRES="$PKGCONFIG_PRIVATE_REQUIRES fuse"
156 AC_DEFINE([WITH_FUSE], [1], [Define to 1 if using FUSE support])
158 AC_CHECK_LIB([rt], [mq_open], [],
159 [AC_MSG_ERROR([Cannot find librt (the POSIX.1b Realtime
160 Extensions Library)! wimlib needs this for the POSIX message queue
161 functions, which are used in the code for mounting WIM images. Recent
162 versions of glibc include this library. Either install this library, or
163 configure --without-fuse to disable support for mounting WIM images.])])
165 PKGCONFIG_PRIVATE_LIBS="$PKGCONFIG_PRIVATE_LIBS -lrt"
166 AC_SUBST([LIBRT_LIBS], [-lrt])
168 AM_CONDITIONAL([WITH_FUSE], [test "$WITH_FUSE" = "yes"])
170 # ----------------------------- Other options ---------------------------------
172 AC_ARG_WITH(pkgconfigdir,
173 [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@],
174 [pkgconfigdir=$withval],
175 [pkgconfigdir='${libdir}/pkgconfig'])
176 AC_SUBST(pkgconfigdir)
178 AC_MSG_CHECKING([whether to enable supporting code for tests])
179 AC_ARG_ENABLE([test-support],
180 [AS_HELP_STRING([--enable-test-support],
181 [Enable supporting code for tests (developers only)])],
182 [ENABLE_TEST_SUPPORT=$enableval],
183 [ENABLE_TEST_SUPPORT=no])
184 AC_MSG_RESULT([$ENABLE_TEST_SUPPORT])
185 if test "$ENABLE_TEST_SUPPORT" = "yes" ; then
186 AC_DEFINE([ENABLE_TEST_SUPPORT], [1],
187 [Define to 1 to enable supporting code for tests])
189 AM_CONDITIONAL([ENABLE_TEST_SUPPORT], [test "$ENABLE_TEST_SUPPORT" = "yes"])
191 ###############################################################################
193 AC_SUBST([PKGCONFIG_PRIVATE_REQUIRES], [$PKGCONFIG_PRIVATE_REQUIRES])
194 AC_SUBST([PKGCONFIG_PRIVATE_LIBS], [$PKGCONFIG_PRIVATE_LIBS])