2 # Process this file with autoconf to produce a configure script.
6 # Get version from file VERSION
7 m4_define([f2fs_tools_version], m4_esyscmd([sed -n '1p' VERSION | tr -d '\n']))
8 m4_define([f2fs_tools_date], m4_esyscmd([sed -n '2p' VERSION | tr -d '\n']))
9 m4_define([f2fs_tools_gitdate],
10 m4_esyscmd([git log -1 --pretty=format:%ci 2> /dev/null]))
12 AC_INIT([F2FS tools], [f2fs_tools_version],
13 [linux-f2fs-devel@lists.sourceforge.net])
15 AC_DEFINE([F2FS_TOOLS_VERSION], "f2fs_tools_version", [f2fs-tools version])
16 AC_DEFINE([F2FS_MAJOR_VERSION], m4_bpatsubst(f2fs_tools_version,
17 [\([0-9]*\)\(\w\|\W\)*], [\1]),
18 [Major version for f2fs-tools])
19 AC_DEFINE([F2FS_MINOR_VERSION], m4_bpatsubst(f2fs_tools_version,
20 [\([0-9]*\).\([0-9]*\)\(\w\|\W\)*], [\2]),
21 [Minor version for f2fs-tools])
23 AS_IF([test -d .git],[
24 AC_DEFINE([F2FS_TOOLS_DATE],
25 "m4_bpatsubst(f2fs_tools_gitdate,
26 [\([0-9-]*\)\(\w\|\W\)*], [\1])",
27 [f2fs-tools date based on Git commits])],[
28 AC_DEFINE([F2FS_TOOLS_DATE],
30 [f2fs-tools date based on Source releases])])
32 AC_CONFIG_SRCDIR([config.h.in])
33 AC_CONFIG_HEADER([config.h])
34 AC_CONFIG_MACRO_DIR([m4])
35 AC_CONFIG_AUX_DIR([build-aux])
36 AM_INIT_AUTOMAKE([foreign tar-pax dist-xz])
38 # Test configure options.
39 AC_ARG_WITH([selinux],
40 AS_HELP_STRING([--without-selinux],
41 [Ignore presence of libselinux and disable selinux support]))
44 AS_HELP_STRING([--without-blkid],
45 [Ignore presence of libblkid and disable blkid support]))
47 # Checks for programs.
50 AC_PATH_PROG([LDCONFIG], [ldconfig],
51 [AC_MSG_ERROR([ldconfig not found])],
54 # Checks for libraries.
55 AC_CHECK_LIB([lzo2], [main],
56 [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
57 AC_DEFINE([HAVE_LIBLZO2], [1],
58 [Define if you have liblzo2])
61 AC_CHECK_LIB([lz4], [main],
62 [AC_SUBST([liblz4_LIBS], ["-llz4"])
63 AC_DEFINE([HAVE_LIBLZ4], [1],
64 [Define if you have liblz4])
67 PKG_CHECK_MODULES([libuuid], [uuid])
69 AS_IF([test "x$with_selinux" != "xno"],
70 [PKG_CHECK_MODULES([libselinux], [libselinux],
71 [have_selinux=yes], [have_selinux=no])],
75 AS_IF([test "x$have_selinux" = "xyes"],
76 [AC_DEFINE([HAVE_LIBSELINUX], [1], [Use libselinux])],
77 [AS_IF([test "x$with_selinux" = "xyes"],
78 [AC_MSG_ERROR([selinux support requested but libselinux not found])]
82 AS_IF([test "x$with_blkid" != "xno"],
83 [PKG_CHECK_MODULES([libblkid], [blkid],
84 [have_blkid=yes], [have_blkid=no])],
88 AS_IF([test "x$have_blkid" = "xyes"],
89 [AC_DEFINE([HAVE_LIBBLKID], [1], [Use blkid])],
90 [AS_IF([test "x$with_blkid" = "xyes"],
91 [AC_MSG_ERROR([blkid support requested but libblkid not found])]
95 # Checks for header files.
96 AC_CHECK_HEADERS(m4_flatten([
124 # Checks for typedefs, structures, and compiler characteristics.
130 # Checks for library functions.
132 AC_CHECK_FUNCS_ONCE([
146 AS_IF([test "$ac_cv_header_byteswap_h" = "yes"],
147 [AC_CHECK_DECLS([bswap_64],,,[#include <byteswap.h>])])
150 dnl Check to see if llseek() is declared in unistd.h. On some libc's
151 dnl it is, and on others it isn't..... Thank you glibc developers....
153 AC_CHECK_DECL(llseek,[AC_DEFINE(HAVE_LLSEEK_PROTOTYPE, 1,
154 [Define to 1 if llseek declared in unistd.h])],,
155 [#include <unistd.h>])
157 dnl Check to see if lseek64() is declared in unistd.h. Glibc's header files
158 dnl are so convoluted that I can't tell whether it will always be defined,
159 dnl and if it isn't defined while lseek64 is defined in the library,
160 dnl disaster will strike.
162 dnl Warning! Use of --enable-gcc-wall may throw off this test.
165 AC_CHECK_DECL(lseek64,[AC_DEFINE(HAVE_LSEEK64_PROTOTYPE, 1,
166 [Define to 1 if lseek64 declared in unistd.h])],,
167 [#define _LARGEFILE_SOURCE
168 #define _LARGEFILE64_SOURCE
169 #include <unistd.h>])
174 # AC_CANONICAL_HOST is needed to access the 'host_os' variable
181 # Detect the target system
193 AC_MSG_ERROR(["OS $host_os is not supported"])
197 # Pass the conditionals to automake
198 AM_CONDITIONAL([LINUX], [test "$build_linux" = "yes"])
199 AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])
200 AM_CONDITIONAL([OSX], [test "$build_mac" = "yes"])
202 # Install directories
203 #AC_PREFIX_DEFAULT([/usr])
204 #AC_SUBST([sbindir], [/sbin])
205 #AC_SUBST([sysconfdir], [/etc])
206 #AC_SUBST([localstatedir], [/var])
208 AC_ARG_WITH([root-libdir],
209 [ --with-root-libdir=DIR override location for /lib/libf2fs.so],
210 root_libdir=$withval,
213 if test "$root_libdir" = NONE ; then
214 root_libdir="$libdir"
216 AC_SUBST(root_libdir)
225 tools/sg_write_buffer/Makefile
226 tools/f2fs_io/Makefile
229 AC_CHECK_MEMBER([struct blk_zone.capacity],
230 [AC_DEFINE(HAVE_BLK_ZONE_REP_V2, [1], [report zones includes zone capacity])],
231 [], [[#include <linux/blkzoned.h>]])
233 # export library version info for mkfs/libf2fs_format_la
234 AC_SUBST(FMT_CURRENT, 7)
235 AC_SUBST(FMT_REVISION, 0)
238 # export library version info for lib/libf2fs_la
239 AC_SUBST(LIBF2FS_CURRENT, 8)
240 AC_SUBST(LIBF2FS_REVISION, 0)
241 AC_SUBST(LIBF2FS_AGE, 0)