summaryrefslogtreecommitdiff
path: root/configure.ac
blob: fbef15ce2dfe2d610bba2da85e0096b2534de6d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
AC_PREREQ([2.60])

m4_define([RELEASE], 2.0.0)

AC_INIT([mtd-utils], [RELEASE], [linux-mtd@lists.infradead.org], mtd-utils)

AC_CONFIG_HEADERS([include/config.h])

AC_ARG_ENABLE([unit-tests],
	[AS_HELP_STRING([--enable-unit-tests], [Compile unit test programs])],
	[case "${enableval}" in
	yes) AM_CONDITIONAL([UNIT_TESTS], [true]) ;;
	no)  AM_CONDITIONAL([UNIT_TESTS], [false]) ;;
	*) AC_MSG_ERROR([bad value ${enableval} for --enable-unit-tests]) ;;
	esac],
	[AM_CONDITIONAL([UNIT_TESTS], [false])])

AM_COND_IF([UNIT_TESTS], [: ${CFLAGS=""}], [])


AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-bzip2])
AM_SILENT_RULES([yes])
AC_PROG_LIBTOOL
AC_DISABLE_STATIC
AC_PROG_CC
AC_PROG_INSTALL


AC_SEARCH_LIBS([clock_gettime],[rt posix4])
AC_CHECK_FUNCS([clock_gettime])

AC_ARG_ENABLE([tests],
	[AS_HELP_STRING([--disable-tests], [Compile test programs])],
	[case "${enableval}" in
	yes) AM_CONDITIONAL([BUILD_TESTS], [true]) ;;
	no)  AM_CONDITIONAL([BUILD_TESTS], [false]) ;;
	*) AC_MSG_ERROR([bad value ${enableval} for --disable-tests]) ;;
	esac],
	[AM_CONDITIONAL([BUILD_TESTS], [true])])

AM_COND_IF([BUILD_TESTS],
	[AX_PTHREAD([], [AC_MSG_ERROR([pthread missing])])])


AC_ARG_ENABLE([install-tests],
	[AS_HELP_STRING([--enable-install-tests], [Install test programs])],
	[case "${enableval}" in
	yes) AM_CONDITIONAL([INSTALL_TESTS], [true]) ;;
	no)  AM_CONDITIONAL([INSTALL_TESTS], [false]) ;;
	*) AC_MSG_ERROR([bad value ${enableval} for --enable-install-tests]) ;;
	esac],
	[AM_CONDITIONAL([INSTALL_TESTS], [false])])


AM_COND_IF([INSTALL_TESTS],
	[AC_SUBST(testbindir, ["\$libexecpath"])],
	[AC_SUBST(testbindir, ["\".\""])])


AC_CONFIG_FILES([tests/fs-tests/fs_help_all.sh
	tests/fs-tests/fs_run_all.sh
	tests/fs-tests/stress/fs_stress00.sh
	tests/fs-tests/stress/fs_stress01.sh
	tests/ubi-tests/runubitests.sh
	tests/ubi-tests/ubi-stress-test.sh])


need_uuid="no"
need_zlib="no"
need_lzo="no"

AC_ARG_WITH([jffs],
	[AS_HELP_STRING([--without-jffs], [Disable jffsX utilities])],
	[case "${withval}" in
	yes) AM_CONDITIONAL([BUILD_JFFSX], [true]) ;;
	no)  AM_CONDITIONAL([BUILD_JFFSX], [false]) ;;
	*) AC_MSG_ERROR([bad value ${withval} for --without-jffs]) ;;
	esac],
	[AM_CONDITIONAL([BUILD_JFFSX], [true])])

AC_ARG_WITH([ubifs],
	[AS_HELP_STRING([--without-ubifs], [Disable ubifs utilities])],
	[case "${withval}" in
	yes) AM_CONDITIONAL([BUILD_UBIFS], [true]) ;;
	no)  AM_CONDITIONAL([BUILD_UBIFS], [false]) ;;
	*) AC_MSG_ERROR([bad value ${withval} for --without-ubifs]) ;;
	esac],
	[AM_CONDITIONAL([BUILD_UBIFS], [true])])

AM_COND_IF([BUILD_UBIFS], [
	need_uuid="yes"
	need_zlib="yes"
	need_lzo="yes"
])

AM_COND_IF([BUILD_JFFSX], [
	need_zlib="yes"
	need_lzo="yes"
])

if test "x$need_zlib" = "xyes"; then
	PKG_CHECK_MODULES(ZLIB, [zlib])
fi

if test "x$need_uuid" = "xyes"; then
	PKG_CHECK_MODULES(UUID, [uuid])
fi


AC_ARG_WITH([xattr],
	[AS_HELP_STRING([--without-xattr],
		[Disable support forextended file attributes])],
	[case "${withval}" in
	yes) AM_CONDITIONAL([WITHOUT_XATTR], [false]) ;;
	no)  AM_CONDITIONAL([WITHOUT_XATTR], [true]) ;;
	*) AC_MSG_ERROR([bad value ${withval} for --without-xattr]) ;;
	esac],
	[AM_CONDITIONAL([WITHOUT_XATTR], [false])])

AC_CHECK_HEADER(sys/xattr.h, [], [AM_CONDITIONAL([WITHOUT_XATTR], [true])])
AC_CHECK_HEADER(sys/acl.h, [], [AM_CONDITIONAL([WITHOUT_XATTR], [true])])


AC_ARG_WITH([lzo],
	[AS_HELP_STRING([--without-lzo], [Disable support for LZO compression])],
	[case "${withval}" in
	yes) AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"]) ;;
	no)  AM_CONDITIONAL([WITHOUT_LZO], [true]) ;;
	*) AC_MSG_ERROR([bad value ${withval} for --without-lzo]) ;;
	esac],
	[AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"])])


AC_CHECK_HEADERS([execinfo.h], [execinfo_found=yes])
AM_CONDITIONAL([HAVE_EXECINFO], [test "x$execinfo_found" == "xyes"])

AM_COND_IF([UNIT_TESTS], [PKG_CHECK_MODULES(CMOCKA, [ cmocka ])], [])

AM_COND_IF([WITHOUT_LZO], [], [
	have_lzo="yes"
	AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
	AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
	AC_CHECK_LIB([lzo2], [lzo1x_1_15_compress], [LZO_LIBS="-llzo2"],
		[AC_CHECK_LIB([lzo],[lzo1x_1_15_compress],[LZO_LIBS="-llzo"],
			[have_lzo="no"]
		)]
	)
	test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo missing])
])

AC_CHECK_SIZEOF([off_t])

AC_CHECK_SIZEOF([loff_t])

AC_OUTPUT([Makefile])