1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.68])
5
6# Get version from file VERSION
7m4_define([f2fs_tools_version], m4_esyscmd([sed -n '1p' VERSION | tr -d '\n']))
8m4_define([f2fs_tools_date], m4_esyscmd([sed -n '2p' VERSION | tr -d '\n']))
9m4_define([f2fs_tools_gitdate],
10		m4_esyscmd([git log -1 --pretty=format:%ci 2> /dev/null]))
11
12AC_INIT([F2FS tools], [f2fs_tools_version],
13			[linux-f2fs-devel@lists.sourceforge.net])
14
15AC_DEFINE([F2FS_TOOLS_VERSION], "f2fs_tools_version", [f2fs-tools version])
16AC_DEFINE([F2FS_MAJOR_VERSION], m4_bpatsubst(f2fs_tools_version,
17				[\([0-9]*\)\(\w\|\W\)*], [\1]),
18				[Major version for f2fs-tools])
19AC_DEFINE([F2FS_MINOR_VERSION], m4_bpatsubst(f2fs_tools_version,
20				[\([0-9]*\).\([0-9]*\)\(\w\|\W\)*], [\2]),
21				[Minor version for f2fs-tools])
22
23AC_CHECK_FILE(.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],
29		"f2fs_tools_date",
30		[f2fs-tools date based on Source releases]))
31
32AC_CONFIG_SRCDIR([config.h.in])
33AC_CONFIG_HEADER([config.h])
34AC_CONFIG_MACRO_DIR([m4])
35AC_CONFIG_AUX_DIR([build-aux])
36AM_INIT_AUTOMAKE([foreign tar-pax dist-xz])
37
38AC_CHECK_HEADERS_ONCE([
39	fcntl.h
40	mntent.h
41	stdlib.h
42	string.h
43	unistd.h
44	sys/ioctl.h
45	sys/mount.h
46])
47
48# Checks for programs.
49AC_PROG_CC
50AC_PROG_LIBTOOL
51AC_PATH_PROG([LDCONFIG], [ldconfig],
52       [AC_MSG_ERROR([ldconfig not found])],
53       [$PATH:/sbin])
54
55# Checks for libraries.
56PKG_CHECK_MODULES([libuuid], [uuid])
57
58# Checks for header files.
59AC_CHECK_HEADERS([linux/fs.h fcntl.h mntent.h stdlib.h string.h \
60		sys/ioctl.h sys/mount.h unistd.h linux/falloc.h byteswap.h])
61
62# Checks for typedefs, structures, and compiler characteristics.
63AC_C_INLINE
64AC_TYPE_INT32_T
65AC_TYPE_INT8_T
66AC_TYPE_SIZE_T
67
68# Checks for library functions.
69AC_FUNC_GETMNTENT
70AC_CHECK_FUNCS_ONCE([
71	getmntent
72	memset
73])
74
75AS_IF([test "$ac_cv_header_byteswap_h" = "yes"],
76      [AC_CHECK_DECLS([bswap_64],,,[#include <byteswap.h>])])
77
78# Install directories
79AC_PREFIX_DEFAULT([/usr])
80AC_SUBST([sbindir], [/sbin])
81AC_SUBST([sysconfdir], [/etc])
82AC_SUBST([localstatedir], [/var])
83AC_CONFIG_FILES([
84	Makefile
85	man/Makefile
86	lib/Makefile
87	mkfs/Makefile
88	fsck/Makefile
89	tools/Makefile
90])
91
92AC_OUTPUT
93