• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.69])
5
6m4_define([erofs_utils_version], m4_esyscmd_s([scripts/get-version-number]))
7m4_define([erofs_utils_date], m4_esyscmd([sed -n '2p' VERSION | tr -d '\n']))
8
9AC_INIT([erofs-utils], [erofs_utils_version], [linux-erofs@lists.ozlabs.org])
10AC_CONFIG_SRCDIR([config.h.in])
11AC_CONFIG_HEADERS([config.h])
12AC_CONFIG_MACRO_DIR([m4])
13AC_CONFIG_AUX_DIR(config)
14AM_INIT_AUTOMAKE([foreign -Wall])
15
16# Checks for programs.
17AM_PROG_AR
18AC_PROG_CC
19AC_PROG_INSTALL
20
21LT_INIT
22
23# Test presence of pkg-config
24AC_MSG_CHECKING([pkg-config m4 macros])
25if test m4_ifdef([PKG_CHECK_MODULES], [yes], [no]) = "yes"; then
26  AC_MSG_RESULT([yes]);
27else
28  AC_MSG_RESULT([no]);
29  AC_MSG_ERROR([pkg-config is required. See pkg-config.freedesktop.org])
30fi
31
32dnl Check if the flag is supported by compiler
33dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
34AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
35  AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
36    [ac_save_CFLAGS="$CFLAGS"
37     CFLAGS="$CFLAGS $1"
38     AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
39       [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
40       [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
41     CFLAGS="$ac_save_CFLAGS"
42    ])
43
44  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
45    [$2], [$3])
46])
47
48dnl Check if the flag is supported by compiler (cacheable)
49dnl CC_CHECK_CFLAG([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
50AC_DEFUN([CC_CHECK_CFLAG], [
51  AC_CACHE_CHECK([if $CC supports $1 flag],
52    AS_TR_SH([cc_cv_cflags_$1]),
53    CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
54  )
55
56  AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
57    [$2], [$3])
58])
59
60dnl CC_CHECK_CFLAGS([FLAG1 FLAG2], [action-if-found], [action-if-not])
61AC_DEFUN([CC_CHECK_CFLAGS], [
62  for flag in $1; do
63    CC_CHECK_CFLAG($flag, [$2], [$3])
64  done
65])
66
67dnl EROFS_UTILS_PARSE_DIRECTORY
68dnl Input:  $1 = a string to a relative or absolute directory
69dnl Output: $2 = the variable to set with the absolute directory
70AC_DEFUN([EROFS_UTILS_PARSE_DIRECTORY],
71[
72 dnl Check if argument is a directory
73 if test -d $1 ; then
74    dnl Get the absolute path of the directory
75    dnl in case of relative directory.
76    dnl If realpath is not a valid command,
77    dnl an error is produced and we keep the given path.
78    local_tmp=`realpath $1 2>/dev/null`
79    if test "$local_tmp" != "" ; then
80       if test -d "$local_tmp" ; then
81           $2="$local_tmp"
82       else
83           $2=$1
84       fi
85    else
86       $2=$1
87    fi
88    dnl Check for space in the directory
89    if test `echo $1|cut -d' ' -f1` != $1 ; then
90        AC_MSG_ERROR($1 directory shall not contain any space.)
91    fi
92 else
93    AC_MSG_ERROR($1 shall be a valid directory)
94 fi
95])
96
97AC_ARG_VAR([MAX_BLOCK_SIZE], [The maximum block size which erofs-utils supports])
98
99AC_MSG_CHECKING([whether to enable multi-threading support])
100AC_ARG_ENABLE([multithreading],
101    AS_HELP_STRING([--enable-multithreading],
102                   [enable multi-threading support (EXPERIMENTAL) @<:@default=no@:>@]),
103    [enable_multithreading="$enableval"],
104    [enable_multithreading="no"])
105AC_MSG_RESULT([$enable_multithreading])
106
107AC_ARG_ENABLE([debug],
108    [AS_HELP_STRING([--enable-debug],
109                    [enable debugging mode @<:@default=no@:>@])],
110    [enable_debug="$enableval"],
111    [enable_debug="no"])
112
113AC_ARG_ENABLE([werror],
114    [AS_HELP_STRING([--enable-werror],
115                    [enable -Werror @<:@default=no@:>@])],
116    [enable_werror="$enableval"],
117    [enable_werror="no"])
118
119AC_ARG_ENABLE([fuzzing],
120    [AS_HELP_STRING([--enable-fuzzing],
121                    [set up fuzzing mode @<:@default=no@:>@])],
122    [enable_fuzzing="$enableval"],
123    [enable_fuzzing="no"])
124
125AC_ARG_ENABLE(lz4,
126   [AS_HELP_STRING([--disable-lz4], [disable LZ4 compression support @<:@default=auto@:>@])],
127   [enable_lz4="$enableval"])
128
129AC_ARG_ENABLE(lzma,
130   [AS_HELP_STRING([--disable-lzma], [disable LZMA compression support @<:@default=auto@:>@])],
131   [enable_lzma="$enableval"])
132
133AC_ARG_WITH(zlib,
134   [AS_HELP_STRING([--without-zlib],
135      [Ignore presence of zlib inflate support @<:@default=auto@:>@])])
136
137AC_ARG_WITH(libdeflate,
138   [AS_HELP_STRING([--with-libdeflate],
139      [Enable and build with libdeflate inflate support @<:@default=disabled@:>@])], [],
140      [with_libdeflate="no"])
141
142AC_ARG_WITH(libzstd,
143   [AS_HELP_STRING([--with-libzstd],
144      [Enable and build with of libzstd support @<:@default=auto@:>@])])
145
146AC_ARG_WITH(qpl,
147   [AS_HELP_STRING([--with-qpl],
148      [Enable and build with Intel QPL support @<:@default=disabled@:>@])], [],
149      [with_qpl="no"])
150
151AC_ARG_ENABLE(fuse,
152   [AS_HELP_STRING([--enable-fuse], [enable erofsfuse @<:@default=no@:>@])],
153   [enable_fuse="$enableval"], [enable_fuse="no"])
154
155AC_ARG_ENABLE([static-fuse],
156    [AS_HELP_STRING([--enable-static-fuse],
157                    [build erofsfuse as a static library @<:@default=no@:>@])],
158    [enable_static_fuse="$enableval"],
159    [enable_static_fuse="no"])
160
161AC_ARG_WITH(uuid,
162   [AS_HELP_STRING([--without-uuid],
163      [Ignore presence of libuuid and disable uuid support @<:@default=enabled@:>@])])
164
165AC_ARG_WITH(selinux,
166   [AS_HELP_STRING([--with-selinux],
167      [enable and build with selinux support @<:@default=no@:>@])],
168   [case "$with_selinux" in
169      yes|no) ;;
170      *) AC_MSG_ERROR([invalid argument to --with-selinux])
171      ;;
172    esac], [with_selinux=no])
173
174# Checks for libraries.
175
176# Checks for header files.
177AC_CHECK_HEADERS(m4_flatten([
178	dirent.h
179	execinfo.h
180	fcntl.h
181	getopt.h
182	inttypes.h
183	linux/aufs_type.h
184	linux/falloc.h
185	linux/fs.h
186	linux/types.h
187	linux/xattr.h
188	limits.h
189	stddef.h
190	stdint.h
191	stdlib.h
192	string.h
193	sys/ioctl.h
194	sys/mman.h
195	sys/random.h
196	sys/sendfile.h
197	sys/stat.h
198	sys/statfs.h
199	sys/sysmacros.h
200	sys/time.h
201	unistd.h
202]))
203
204AC_HEADER_TIOCGWINSZ
205
206# Checks for typedefs, structures, and compiler characteristics.
207AC_C_INLINE
208AC_TYPE_INT64_T
209AC_TYPE_SIZE_T
210AC_TYPE_SSIZE_T
211AC_CHECK_MEMBERS([struct stat.st_rdev])
212AC_CHECK_MEMBERS([struct stat.st_atim])
213AC_CHECK_MEMBERS([struct stat.st_atimensec])
214AC_TYPE_UINT64_T
215
216#
217# Check to see if llseek() is declared in unistd.h.  On some libc's
218# it is, and on others it isn't..... Thank you glibc developers....
219#
220AC_CHECK_DECL(llseek,
221  [AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
222    [Define to 1 if llseek declared in unistd.h])],,
223  [#include <unistd.h>])
224
225#
226# Check to see if lseek64() is declared in unistd.h.  Glibc's header files
227# are so convoluted that I can't tell whether it will always be defined,
228# and if it isn't defined while lseek64 is defined in the library,
229# disaster will strike.
230#
231# Warning!  Use of --enable-gcc-wall may throw off this test.
232#
233AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
234  [Define to 1 if lseek64 declared in unistd.h])],,
235  [#define _LARGEFILE_SOURCE
236   #define _LARGEFILE64_SOURCE
237   #include <unistd.h>])
238
239AC_CHECK_DECL(memrchr,[AC_DEFINE(HAVE_MEMRCHR, 1,
240  [Define to 1 if memrchr declared in string.h])],,
241  [#define _GNU_SOURCE
242   #include <string.h>])
243
244# Checks for library functions.
245AC_CHECK_FUNCS(m4_flatten([
246	backtrace
247	copy_file_range
248	fallocate
249	gettimeofday
250	lgetxattr
251	llistxattr
252	lsetxattr
253	memset
254	realpath
255	lseek64
256	ftello64
257	pread64
258	pwrite64
259	posix_fadvise
260	fstatfs
261	sendfile
262	strdup
263	strerror
264	strrchr
265	strtoull
266	sysconf
267	tmpfile64
268	utimensat]))
269
270# Detect maximum block size if necessary
271AS_IF([test "x$MAX_BLOCK_SIZE" = "x"], [
272  AC_CACHE_CHECK([sysconf (_SC_PAGESIZE)], [erofs_cv_max_block_size],
273               AC_RUN_IFELSE([AC_LANG_PROGRAM(
274[[
275#include <unistd.h>
276#include <stdio.h>
277]],
278[[
279    int result;
280    FILE *f;
281
282    result = sysconf(_SC_PAGESIZE);
283    if (result < 0)
284	return 1;
285
286    f = fopen("conftest.out", "w");
287    if (!f)
288	return 1;
289
290    fprintf(f, "%d", result);
291    fclose(f);
292    return 0;
293]])],
294                             [erofs_cv_max_block_size=`cat conftest.out`],
295                             [erofs_cv_max_block_size=4096],
296                             [erofs_cv_max_block_size=4096]))
297], [erofs_cv_max_block_size=$MAX_BLOCK_SIZE])
298
299# Configure multi-threading support
300AS_IF([test "x$enable_multithreading" != "xno"], [
301  AC_CHECK_HEADERS([pthread.h])
302  AC_CHECK_LIB([pthread], [pthread_mutex_lock], [],
303    AC_MSG_ERROR([libpthread is required for multi-threaded build]))
304  AC_DEFINE(EROFS_MT_ENABLED, 1, [Enable multi-threading support])
305], [])
306
307# Configure debug mode
308AS_IF([test "x$enable_debug" != "xno"], [], [
309  dnl Turn off all assert checking.
310  CPPFLAGS="$CPPFLAGS -DNDEBUG"
311])
312
313# Configure -Werror
314AS_IF([test "x$enable_werror" != "xyes"], [], [
315  CPPFLAGS="$CPPFLAGS -Werror"
316])
317
318# Configure libuuid
319AS_IF([test "x$with_uuid" != "xno"], [
320  PKG_CHECK_MODULES([libuuid], [uuid])
321  # Paranoia: don't trust the result reported by pkgconfig before trying out
322  saved_LIBS="$LIBS"
323  saved_CPPFLAGS=${CPPFLAGS}
324  CPPFLAGS="${libuuid_CFLAGS} ${CPPFLAGS}"
325  LIBS="${libuuid_LIBS} $LIBS"
326  AC_MSG_CHECKING([libuuid usability])
327  AC_TRY_LINK([
328#include <uuid.h>
329], [
330uuid_t tmp;
331
332uuid_generate(tmp);
333return 0;
334], [have_uuid="yes"
335    AC_MSG_RESULT([yes])], [
336    have_uuid="no"
337    AC_MSG_RESULT([no])
338    AC_MSG_ERROR([libuuid doesn't work properly])])
339  LIBS="${saved_LIBS}"
340  CPPFLAGS="${saved_CPPFLAGS}"], [have_uuid="no"])
341
342# Configure selinux
343AS_IF([test "x$with_selinux" != "xno"], [
344  PKG_CHECK_MODULES([libselinux], [libselinux])
345  # Paranoia: don't trust the result reported by pkgconfig before trying out
346  saved_LIBS="$LIBS"
347  saved_CPPFLAGS=${CPPFLAGS}
348  CPPFLAGS="${libselinux_CFLAGS} ${CPPFLAGS}"
349  LIBS="${libselinux_LIBS} $LIBS"
350  AC_CHECK_LIB(selinux, selabel_lookup, [
351    have_selinux="yes" ], [
352    AC_MSG_ERROR([libselinux doesn't work properly])])
353  LIBS="${saved_LIBS}"
354  CPPFLAGS="${saved_CPPFLAGS}"], [have_selinux="no"])
355
356# Configure fuse
357AS_IF([test "x$enable_fuse" != "xno"], [
358  # Paranoia: don't trust the result reported by pkgconfig before trying out
359  saved_LIBS="$LIBS"
360  saved_CPPFLAGS=${CPPFLAGS}
361  PKG_CHECK_MODULES([libfuse3], [fuse3 >= 3.0], [
362    PKG_CHECK_MODULES([libfuse3_0], [fuse3 >= 3.0 fuse3 < 3.2], [
363      AC_DEFINE([FUSE_USE_VERSION], [30], [used FUSE API version])
364    ], [
365      PKG_CHECK_MODULES([libfuse3_2], [fuse3 >= 3.2], [
366        AC_DEFINE([FUSE_USE_VERSION], [32], [used FUSE API version])
367      ])
368    ])
369    CPPFLAGS="${libfuse3_CFLAGS} ${CPPFLAGS}"
370    LIBS="${libfuse3_LIBS} $LIBS"
371    AC_CHECK_LIB(fuse3, fuse_session_new, [], [
372    AC_MSG_ERROR([libfuse3 (>= 3.0) doesn't work properly for lowlevel api])])
373    have_fuse="yes"
374  ], [
375    PKG_CHECK_MODULES([libfuse2], [fuse >= 2.6], [
376      AC_DEFINE([FUSE_USE_VERSION], [26], [used FUSE API version])
377      CPPFLAGS="${libfuse2_CFLAGS} ${CPPFLAGS}"
378      LIBS="${libfuse2_LIBS} $LIBS"
379      AC_CHECK_LIB(fuse, fuse_lowlevel_new, [], [
380        AC_MSG_ERROR([libfuse (>= 2.6) doesn't work properly for lowlevel api])])
381      have_fuse="yes"
382    ], [have_fuse="no"])
383  ])
384  LIBS="${saved_LIBS}"
385  CPPFLAGS="${saved_CPPFLAGS}"], [have_fuse="no"])
386
387# Configure lz4
388AS_IF([test "x$enable_lz4" != "xno"], [
389  saved_CPPFLAGS=${CPPFLAGS}
390  PKG_CHECK_MODULES([liblz4], [liblz4], [
391    # Paranoia: don't trust the result reported by pkgconfig before trying out
392    saved_LIBS="$LIBS"
393    saved_CPPFLAGS=${CPPFLAGS}
394    CPPFLAGS="${liblz4_CFLAGS} ${CPPFLAGS}"
395    LIBS="${liblz4_LIBS} $LIBS"
396    AC_CHECK_HEADERS([lz4.h],[
397      AC_CHECK_LIB(lz4, LZ4_compress_destSize, [
398        AC_CHECK_DECL(LZ4_compress_destSize, [have_lz4="yes"],
399          [], [[
400#include <lz4.h>
401        ]])
402      ])
403      AC_CHECK_LIB(lz4, LZ4_compress_HC_destSize, [
404        AC_CHECK_DECL(LZ4_compress_HC_destSize, [have_lz4hc="yes"],
405          [], [[
406#include <lz4hc.h>
407        ]])
408      ])
409    ])
410    LIBS="${saved_LIBS}"
411    CPPFLAGS="${saved_CPPFLAGS}"
412  ], [[]])
413  AS_IF([test "x$enable_lz4" = "xyes" -a "x$have_lz4" != "xyes"], [
414    AC_MSG_ERROR([Cannot find a proper liblz4 version])
415  ])
416])
417
418# Configure liblzma
419have_liblzma="no"
420AS_IF([test "x$enable_lzma" != "xno"], [
421  saved_CPPFLAGS=${CPPFLAGS}
422  PKG_CHECK_MODULES([liblzma], [liblzma], [
423    # Paranoia: don't trust the result reported by pkgconfig before trying out
424    saved_LIBS="$LIBS"
425    saved_CPPFLAGS=${CPPFLAGS}
426    CPPFLAGS="${liblzma_CFLAGS} ${CPPFLAGS}"
427    LIBS="${liblzma_LIBS} $LIBS"
428    AC_CHECK_HEADERS([lzma.h],[
429      AC_CHECK_LIB(lzma, lzma_microlzma_encoder, [
430        AC_CHECK_DECL(lzma_microlzma_encoder, [have_liblzma="yes"],
431          [], [[
432#include <lzma.h>
433        ]])
434      ])
435    ])
436    LIBS="${saved_LIBS}"
437    CPPFLAGS="${saved_CPPFLAGS}"
438  ], [[]])
439  AS_IF([test "x$enable_lzma" = "xyes" -a "x$have_liblzma" != "xyes"], [
440    AC_MSG_ERROR([Cannot find a proper liblzma version])
441  ])
442])
443
444# Configure zlib
445have_zlib="no"
446AS_IF([test "x$with_zlib" != "xno"], [
447  PKG_CHECK_MODULES([zlib], [zlib], [
448    # Paranoia: don't trust the result reported by pkgconfig before trying out
449    saved_LIBS="$LIBS"
450    saved_CPPFLAGS=${CPPFLAGS}
451    CPPFLAGS="${zlib_CFLAGS} ${CPPFLAGS}"
452    LIBS="${zlib_LIBS} $LIBS"
453    AC_CHECK_HEADERS([zlib.h],[
454      AC_CHECK_LIB(z, inflate, [], [
455        AC_MSG_ERROR([zlib doesn't work properly])])
456      AC_CHECK_DECL(inflate, [have_zlib="yes"],
457        [AC_MSG_ERROR([zlib doesn't work properly])], [[
458#include <zlib.h>
459      ]])
460    ])
461    LIBS="${saved_LIBS}"
462    CPPFLAGS="${saved_CPPFLAGS}"], [
463    AS_IF([test "x$with_zlib" = "xyes"], [
464      AC_MSG_ERROR([Cannot find proper zlib])
465    ])
466  ])
467])
468
469# Configure libdeflate
470AS_IF([test "x$with_libdeflate" != "xno"], [
471  PKG_CHECK_MODULES([libdeflate], [libdeflate])
472  # Paranoia: don't trust the result reported by pkgconfig before trying out
473  saved_LIBS="$LIBS"
474  saved_CPPFLAGS=${CPPFLAGS}
475  CPPFLAGS="${libdeflate_CFLAGS} ${CPPFLAGS}"
476  LIBS="${libdeflate_LIBS} $LIBS"
477  AC_CHECK_LIB(deflate, libdeflate_deflate_decompress, [
478    have_libdeflate="yes" ], [
479    AC_MSG_ERROR([libdeflate doesn't work properly])])
480  LIBS="${saved_LIBS}"
481  CPPFLAGS="${saved_CPPFLAGS}"], [have_libdeflate="no"])
482
483# Configure libzstd
484have_libzstd="no"
485AS_IF([test "x$with_libzstd" != "xno"], [
486  PKG_CHECK_MODULES([libzstd], [libzstd >= 1.4.0], [
487    # Paranoia: don't trust the result reported by pkgconfig before trying out
488    saved_LIBS="$LIBS"
489    saved_CPPFLAGS=${CPPFLAGS}
490    CPPFLAGS="${libzstd_CFLAGS} ${CPPFLAGS}"
491    LIBS="${libzstd_LIBS} $LIBS"
492    AC_CHECK_HEADERS([zstd.h],[
493      AC_CHECK_LIB(zstd, ZSTD_compress2, [], [
494        AC_MSG_ERROR([libzstd doesn't work properly])])
495      AC_CHECK_DECL(ZSTD_compress2, [have_libzstd="yes"],
496        [AC_MSG_ERROR([libzstd doesn't work properly])], [[
497#include <zstd.h>
498      ]])
499      AC_CHECK_FUNCS([ZSTD_getFrameContentSize])
500    ])
501    LIBS="${saved_LIBS}"
502    CPPFLAGS="${saved_CPPFLAGS}"], [
503    AS_IF([test "x$with_libzstd" = "xyes"], [
504      AC_MSG_ERROR([Cannot find proper libzstd])
505    ])
506  ])
507])
508
509# Configure Intel QPL
510have_qpl="no"
511AS_IF([test "x$with_qpl" != "xno"], [
512  PKG_CHECK_MODULES([libqpl], [qpl >= 1.5.0], [
513    # Paranoia: don't trust the result reported by pkgconfig before trying out
514    saved_LIBS="$LIBS"
515    saved_CPPFLAGS=${CPPFLAGS}
516    CPPFLAGS="${libqpl_CFLAGS} ${CPPFLAGS}"
517    LIBS="${libqpl_LIBS} $LIBS"
518    AC_CHECK_HEADERS([qpl/qpl.h],[
519      AC_CHECK_LIB(qpl, qpl_execute_job, [], [
520        AC_MSG_ERROR([libqpl doesn't work properly])])
521      AC_CHECK_DECL(qpl_execute_job, [have_qpl="yes"],
522        [AC_MSG_ERROR([libqpl doesn't work properly])], [[
523#include <qpl/qpl.h>
524      ]])
525    ])
526    LIBS="${saved_LIBS}"
527    CPPFLAGS="${saved_CPPFLAGS}"], [
528    AS_IF([test "x$with_qpl" = "xyes"], [
529      AC_MSG_ERROR([Cannot find proper libqpl])
530    ])
531  ])
532])
533
534# Enable 64-bit off_t
535CFLAGS+=" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
536
537# Configure fuzzing mode
538AS_IF([test "x$enable_fuzzing" != "xyes"], [], [
539  CC_CHECK_CFLAGS(["-fsanitize=address,fuzzer-no-link"], [
540    CFLAGS="$CFLAGS -g -O1 -fsanitize=address,fuzzer-no-link"
541  ], [
542    AC_MSG_ERROR([Compiler doesn't support `-fsanitize=address,fuzzer-no-link`])
543  ])
544])
545AM_CONDITIONAL([ENABLE_FUZZING], [test "x${enable_fuzzing}" = "xyes"])
546
547# Set up needed symbols, conditionals and compiler/linker flags
548AM_CONDITIONAL([ENABLE_EROFS_MT], [test "x${enable_multithreading}" != "xno"])
549AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"])
550AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"])
551AM_CONDITIONAL([ENABLE_FUSE], [test "x${have_fuse}" = "xyes"])
552AM_CONDITIONAL([ENABLE_LIBLZMA], [test "x${have_liblzma}" = "xyes"])
553AM_CONDITIONAL([ENABLE_LIBDEFLATE], [test "x${have_libdeflate}" = "xyes"])
554AM_CONDITIONAL([ENABLE_LIBZSTD], [test "x${have_libzstd}" = "xyes"])
555AM_CONDITIONAL([ENABLE_QPL], [test "x${have_qpl}" = "xyes"])
556AM_CONDITIONAL([ENABLE_STATIC_FUSE], [test "x${enable_static_fuse}" = "xyes"])
557
558if test "x$have_uuid" = "xyes"; then
559  AC_DEFINE([HAVE_LIBUUID], 1, [Define to 1 if libuuid is found])
560fi
561
562if test "x$have_selinux" = "xyes"; then
563  AC_DEFINE([HAVE_LIBSELINUX], 1, [Define to 1 if libselinux is found])
564fi
565
566if test "x${have_lz4}" = "xyes"; then
567  AC_DEFINE([LZ4_ENABLED], [1], [Define to 1 if lz4 is enabled.])
568
569  if test "x${have_lz4hc}" = "xyes"; then
570    AC_DEFINE([LZ4HC_ENABLED], [1], [Define to 1 if lz4hc is enabled.])
571  fi
572fi
573
574if test "x${have_liblzma}" = "xyes"; then
575  AC_DEFINE([HAVE_LIBLZMA], [1], [Define to 1 if liblzma is enabled.])
576  liblzma_LIBS="-llzma"
577  test -z "${with_liblzma_libdir}" ||
578    liblzma_LIBS="-L${with_liblzma_libdir} $liblzma_LIBS"
579  test -z "${with_liblzma_incdir}" ||
580    liblzma_CFLAGS="-I${with_liblzma_incdir}"
581  AC_SUBST([liblzma_LIBS])
582  AC_SUBST([liblzma_CFLAGS])
583fi
584
585if test "x$have_zlib" = "xyes"; then
586  AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if zlib is found])
587fi
588
589if test "x$have_libdeflate" = "xyes"; then
590  AC_DEFINE([HAVE_LIBDEFLATE], 1, [Define to 1 if libdeflate is found])
591fi
592
593if test "x$have_libzstd" = "xyes"; then
594  AC_DEFINE([HAVE_LIBZSTD], 1, [Define to 1 if libzstd is found])
595fi
596
597if test "x$have_qpl" = "xyes"; then
598  AC_DEFINE([HAVE_QPL], 1, [Define to 1 if qpl is found])
599  AC_SUBST([libqpl_LIBS])
600  AC_SUBST([libqpl_CFLAGS])
601fi
602
603# Dump maximum block size
604AS_IF([test "x$erofs_cv_max_block_size" = "x"],
605      [$erofs_cv_max_block_size = 4096], [])
606
607AC_DEFINE_UNQUOTED([EROFS_MAX_BLOCK_SIZE], [$erofs_cv_max_block_size],
608		   [The maximum block size which erofs-utils supports])
609
610AC_CONFIG_FILES([Makefile
611		 man/Makefile
612		 lib/Makefile
613		 mkfs/Makefile
614		 dump/Makefile
615		 fuse/Makefile
616		 fsck/Makefile])
617AC_OUTPUT
618