]>
Commit | Line | Data |
---|---|---|
d0191583 | 1 | ############################################################################### |
ad6254c5 | 2 | ## Copyright (C) 2000-2004 Sistina Software, Inc. All rights reserved. |
d0191583 | 3 | ## Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. |
795ca3e5 | 4 | ## |
ad6254c5 AK |
5 | ## This copyrighted material is made available to anyone wishing to use, |
6 | ## modify, copy, or redistribute it subject to the terms and conditions | |
7 | ## of the GNU General Public License v.2. | |
795ca3e5 | 8 | ## |
ad6254c5 AK |
9 | ## You should have received a copy of the GNU General Public License |
10 | ## along with this program; if not, write to the Free Software Foundation, | |
11 | ## Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
795ca3e5 AK |
12 | ################################################################################ |
13 | ||
7a197a62 | 14 | AC_PREREQ(2.57) |
80992638 | 15 | ################################################################################ |
8ce0cbda | 16 | dnl -- Process this file with autoconf to produce a configure script. |
7a197a62 AK |
17 | AC_INIT |
18 | AC_CONFIG_SRCDIR([lib/device/dev-cache.h]) | |
d0191583 | 19 | AC_CONFIG_HEADERS([lib/misc/configure.h]) |
72b2cb61 | 20 | |
80992638 | 21 | ################################################################################ |
ad6254c5 | 22 | dnl -- Setup the directory where autoconf has auxilary files |
d3a356b4 | 23 | AC_CONFIG_AUX_DIR(autoconf) |
795ca3e5 | 24 | |
80992638 | 25 | ################################################################################ |
8ce0cbda | 26 | dnl -- Get system type |
7a197a62 | 27 | AC_CANONICAL_TARGET([]) |
b896caa1 AK |
28 | |
29 | case "$host_os" in | |
30 | linux*) | |
8ce0cbda | 31 | COPTIMISE_FLAG="-O2" |
80992638 | 32 | CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym" |
8106cdd5 AK |
33 | CLDWHOLEARCHIVE="-Wl,-whole-archive" |
34 | CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive" | |
80992638 AK |
35 | LDDEPS="$LDDEPS .export.sym" |
36 | LDFLAGS="$LDFLAGS -Wl,--export-dynamic" | |
d0191583 | 37 | LIB_SUFFIX=so |
8106cdd5 | 38 | DEVMAPPER=yes |
1a9ea74d | 39 | ODIRECT=yes |
d0191583 | 40 | DM_IOCTLS=yes |
80992638 | 41 | SELINUX=yes |
8b1a3214 | 42 | REALTIME=yes |
d3c8211f | 43 | CLUSTER=internal |
f6fc418d | 44 | FSADM=yes |
d0191583 | 45 | ;; |
8106cdd5 | 46 | darwin*) |
80992638 | 47 | CFLAGS="$CFLAGS -no-cpp-precomp -fno-common" |
8ce0cbda | 48 | COPTIMISE_FLAG="-O2" |
80992638 | 49 | CLDFLAGS="$CLDFLAGS" |
8106cdd5 AK |
50 | CLDWHOLEARCHIVE="-all_load" |
51 | CLDNOWHOLEARCHIVE= | |
d0191583 | 52 | LIB_SUFFIX=dylib |
a653923f | 53 | DEVMAPPER=yes |
1a9ea74d | 54 | ODIRECT=no |
d0191583 | 55 | DM_IOCTLS=no |
80992638 | 56 | SELINUX=no |
8b1a3214 | 57 | REALTIME=no |
d3c8211f | 58 | CLUSTER=none |
d0191583 JM |
59 | FSADM=no |
60 | ;; | |
b896caa1 AK |
61 | esac |
62 | ||
80992638 | 63 | ################################################################################ |
8ce0cbda | 64 | dnl -- Checks for programs. |
5951ef33 | 65 | AC_PROG_SED |
8ce0cbda AK |
66 | AC_PROG_AWK |
67 | AC_PROG_CC | |
d0191583 JM |
68 | |
69 | dnl probably no longer needed in 2008, but... | |
70 | AC_PROG_GCC_TRADITIONAL | |
8ce0cbda AK |
71 | AC_PROG_INSTALL |
72 | AC_PROG_LN_S | |
73 | AC_PROG_MAKE_SET | |
fddafd51 | 74 | AC_PROG_MKDIR_P |
5556819a | 75 | AC_PROG_RANLIB |
8a2fc586 AK |
76 | AC_PATH_PROG(CFLOW_CMD, cflow) |
77 | AC_PATH_PROG(CSCOPE_CMD, cscope) | |
8ce0cbda AK |
78 | |
79 | ################################################################################ | |
d0191583 | 80 | dnl -- Check for header files. |
80992638 AK |
81 | AC_HEADER_DIRENT |
82 | AC_HEADER_STDC | |
ad6254c5 AK |
83 | AC_HEADER_SYS_WAIT |
84 | AC_HEADER_TIME | |
85 | ||
d0191583 JM |
86 | AC_CHECK_HEADERS([locale.h stddef.h syslog.h sys/file.h sys/time.h assert.h \ |
87 | libgen.h signal.h sys/mman.h sys/resource.h sys/utsname.h sys/wait.h time.h], , | |
88 | [AC_MSG_ERROR(bailing out)]) | |
ad6254c5 AK |
89 | |
90 | case "$host_os" in | |
91 | linux*) | |
92 | AC_CHECK_HEADERS(asm/byteorder.h linux/fs.h malloc.h,,AC_MSG_ERROR(bailing out)) ;; | |
93 | darwin*) | |
94 | AC_CHECK_HEADERS(machine/endian.h sys/disk.h,,AC_MSG_ERROR(bailing out)) ;; | |
95 | esac | |
80992638 | 96 | |
d0191583 JM |
97 | AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h inttypes.h limits.h \ |
98 | stdarg.h stdio.h stdlib.h string.h sys/ioctl.h sys/param.h sys/stat.h \ | |
99 | sys/types.h unistd.h], , [AC_MSG_ERROR(bailing out)]) | |
100 | AC_CHECK_HEADERS(termios.h sys/statvfs.h) | |
101 | ||
80992638 | 102 | ################################################################################ |
d0191583 | 103 | dnl -- Check for typedefs, structures, and compiler characteristics. |
80992638 AK |
104 | AC_C_CONST |
105 | AC_C_INLINE | |
d0191583 | 106 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
80992638 AK |
107 | AC_TYPE_OFF_T |
108 | AC_TYPE_PID_T | |
d0191583 | 109 | AC_TYPE_SIGNAL |
80992638 | 110 | AC_TYPE_SIZE_T |
ad6254c5 | 111 | AC_TYPE_MODE_T |
7a197a62 | 112 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
ad6254c5 AK |
113 | AC_STRUCT_TM |
114 | ||
115 | ################################################################################ | |
116 | dnl -- Check for functions | |
d0191583 JM |
117 | AC_CHECK_FUNCS([gethostname getpagesize memset mkdir rmdir munmap setlocale \ |
118 | strcasecmp strchr strdup strncasecmp strerror strrchr strstr strtol strtoul \ | |
119 | uname], , [AC_MSG_ERROR(bailing out)]) | |
ad6254c5 AK |
120 | AC_FUNC_ALLOCA |
121 | AC_FUNC_CLOSEDIR_VOID | |
122 | AC_FUNC_FORK | |
123 | AC_FUNC_LSTAT | |
124 | AC_FUNC_MALLOC | |
125 | AC_FUNC_MEMCMP | |
126 | AC_FUNC_MMAP | |
127 | AC_FUNC_STAT | |
128 | AC_FUNC_STRTOD | |
d0191583 | 129 | AC_FUNC_VPRINTF |
80992638 AK |
130 | |
131 | ################################################################################ | |
8ce0cbda | 132 | dnl -- Prefix is /usr by default, the exec_prefix default is setup later |
795ca3e5 AK |
133 | AC_PREFIX_DEFAULT(/usr) |
134 | ||
80992638 | 135 | ################################################################################ |
8ce0cbda | 136 | dnl -- Setup the ownership of the files |
ad6254c5 | 137 | AC_MSG_CHECKING(file owner) |
80992638 AK |
138 | OWNER="root" |
139 | ||
795ca3e5 | 140 | AC_ARG_WITH(user, |
d0191583 | 141 | [ --with-user=USER Set the owner of installed files [[USER=root]] ], |
a38df97f | 142 | [ OWNER="$withval" ]) |
ad6254c5 | 143 | AC_MSG_RESULT($OWNER) |
a38df97f AK |
144 | |
145 | if test x$OWNER != x; then | |
146 | OWNER="-o $OWNER" | |
147 | fi | |
795ca3e5 | 148 | |
80992638 | 149 | ################################################################################ |
8ce0cbda | 150 | dnl -- Setup the group ownership of the files |
ad6254c5 | 151 | AC_MSG_CHECKING(group owner) |
80992638 | 152 | GROUP="root" |
795ca3e5 | 153 | AC_ARG_WITH(group, |
d0191583 | 154 | [ --with-group=GROUP Set the group owner of installed files [[GROUP=root]] ], |
a38df97f | 155 | [ GROUP="$withval" ]) |
ad6254c5 | 156 | AC_MSG_RESULT($GROUP) |
a38df97f AK |
157 | |
158 | if test x$GROUP != x; then | |
159 | GROUP="-g $GROUP" | |
160 | fi | |
795ca3e5 | 161 | |
f6fc418d AK |
162 | ################################################################################ |
163 | dnl -- Setup device mode | |
164 | AC_MSG_CHECKING(device node mode) | |
165 | ||
166 | AC_ARG_WITH(device-mode, | |
167 | [ --with-device-mode=MODE Set the mode used for new device nodes [[MODE=0600]] ], | |
168 | [ DM_DEVICE_MODE="$withval" ], [ DM_DEVICE_MODE="0600" ] ) | |
169 | AC_MSG_RESULT($DM_DEVICE_MODE) | |
170 | ||
80992638 | 171 | ################################################################################ |
7d1552c9 | 172 | dnl -- LVM1 tool fallback option |
ad6254c5 | 173 | AC_MSG_CHECKING(whether to enable lvm1 fallback) |
7d1552c9 AK |
174 | AC_ARG_ENABLE(lvm1_fallback, [ --enable-lvm1_fallback Use this to fall back and use LVM1 binaries if |
175 | device-mapper is missing from the kernel], LVM1_FALLBACK=$enableval, LVM1_FALLBACK=no) | |
ad6254c5 | 176 | AC_MSG_RESULT($LVM1_FALLBACK) |
7d1552c9 AK |
177 | |
178 | if test x$LVM1_FALLBACK = xyes; then | |
72b2cb61 | 179 | AC_DEFINE([LVM1_FALLBACK], 1, [Define to 1 if 'lvm' should fall back to using LVM1 binaries if device-mapper is missing from the kernel]) |
7d1552c9 AK |
180 | fi |
181 | ||
80992638 | 182 | ################################################################################ |
5a52dca9 | 183 | dnl -- format1 inclusion type |
ad6254c5 | 184 | AC_MSG_CHECKING(whether to include support for lvm1 metadata) |
5a52dca9 AK |
185 | AC_ARG_WITH(lvm1, |
186 | [ --with-lvm1=TYPE LVM1 metadata support: internal/shared/none | |
187 | [TYPE=internal] ], | |
188 | [ LVM1="$withval" ], | |
189 | [ LVM1="internal" ]) | |
ad6254c5 | 190 | AC_MSG_RESULT($LVM1) |
5a52dca9 AK |
191 | |
192 | if [[ "x$LVM1" != xnone -a "x$LVM1" != xinternal -a "x$LVM1" != xshared ]]; | |
193 | then AC_MSG_ERROR( | |
194 | --with-lvm1 parameter invalid | |
195 | ) | |
5a52dca9 AK |
196 | fi; |
197 | ||
b896caa1 | 198 | if test x$LVM1 = xinternal; then |
72b2cb61 | 199 | AC_DEFINE([LVM1_INTERNAL], 1, [Define to 1 to include built-in support for LVM1 metadata.]) |
b896caa1 AK |
200 | fi |
201 | ||
80992638 | 202 | ################################################################################ |
d8ac0fbc | 203 | dnl -- format_pool inclusion type |
ad6254c5 | 204 | AC_MSG_CHECKING(whether to include support for GFS pool metadata) |
d8ac0fbc | 205 | AC_ARG_WITH(pool, |
60329273 | 206 | [ --with-pool=TYPE GFS pool read-only support: internal/shared/none |
d8ac0fbc AK |
207 | [TYPE=internal] ], |
208 | [ POOL="$withval" ], | |
209 | [ POOL="internal" ]) | |
ad6254c5 | 210 | AC_MSG_RESULT($POOL) |
d8ac0fbc AK |
211 | |
212 | if [[ "x$POOL" != xnone -a "x$POOL" != xinternal -a "x$POOL" != xshared ]]; | |
213 | then AC_MSG_ERROR( | |
214 | --with-pool parameter invalid | |
215 | ) | |
d8ac0fbc AK |
216 | fi; |
217 | ||
218 | if test x$POOL = xinternal; then | |
72b2cb61 | 219 | AC_DEFINE([POOL_INTERNAL], 1, [Define to 1 to include built-in support for GFS pool metadata.]) |
d8ac0fbc AK |
220 | fi |
221 | ||
80992638 | 222 | ################################################################################ |
d3c8211f | 223 | dnl -- cluster_locking inclusion type |
ad6254c5 | 224 | AC_MSG_CHECKING(whether to include support for cluster locking) |
d3c8211f AK |
225 | AC_ARG_WITH(cluster, |
226 | [ --with-cluster=TYPE Cluster LVM locking support: internal/shared/none | |
227 | [TYPE=internal] ], | |
228 | [ CLUSTER="$withval" ]) | |
ad6254c5 | 229 | AC_MSG_RESULT($CLUSTER) |
d3c8211f AK |
230 | |
231 | if [[ "x$CLUSTER" != xnone -a "x$CLUSTER" != xinternal -a "x$CLUSTER" != xshared ]]; | |
232 | then AC_MSG_ERROR( | |
233 | --with-cluster parameter invalid | |
234 | ) | |
d3c8211f AK |
235 | fi; |
236 | ||
237 | if test x$CLUSTER = xinternal; then | |
72b2cb61 | 238 | AC_DEFINE([CLUSTER_LOCKING_INTERNAL], 1, [Define to 1 to include built-in support for clustered LVM locking.]) |
d3c8211f | 239 | fi |
d8ac0fbc | 240 | |
80992638 | 241 | ################################################################################ |
4922197a | 242 | dnl -- snapshots inclusion type |
ad6254c5 | 243 | AC_MSG_CHECKING(whether to include snapshots) |
4922197a AK |
244 | AC_ARG_WITH(snapshots, |
245 | [ --with-snapshots=TYPE Snapshot support: internal/shared/none | |
246 | [TYPE=internal] ], | |
247 | [ SNAPSHOTS="$withval" ], | |
248 | [ SNAPSHOTS="internal" ]) | |
ad6254c5 | 249 | AC_MSG_RESULT($SNAPSHOTS) |
4922197a AK |
250 | |
251 | if [[ "x$SNAPSHOTS" != xnone -a "x$SNAPSHOTS" != xinternal -a "x$SNAPSHOTS" != xshared ]]; | |
252 | then AC_MSG_ERROR( | |
253 | --with-snapshots parameter invalid | |
254 | ) | |
4922197a AK |
255 | fi; |
256 | ||
257 | if test x$SNAPSHOTS = xinternal; then | |
72b2cb61 | 258 | AC_DEFINE([SNAPSHOT_INTERNAL], 1, [Define to 1 to include built-in support for snapshots.]) |
4922197a AK |
259 | fi |
260 | ||
80992638 | 261 | ################################################################################ |
4922197a | 262 | dnl -- mirrors inclusion type |
ad6254c5 | 263 | AC_MSG_CHECKING(whether to include mirrors) |
4922197a AK |
264 | AC_ARG_WITH(mirrors, |
265 | [ --with-mirrors=TYPE Mirror support: internal/shared/none | |
266 | [TYPE=internal] ], | |
267 | [ MIRRORS="$withval" ], | |
268 | [ MIRRORS="internal" ]) | |
ad6254c5 | 269 | AC_MSG_RESULT($MIRRORS) |
4922197a AK |
270 | |
271 | if [[ "x$MIRRORS" != xnone -a "x$MIRRORS" != xinternal -a "x$MIRRORS" != xshared ]]; | |
272 | then AC_MSG_ERROR( | |
273 | --with-mirrors parameter invalid | |
274 | ) | |
4922197a AK |
275 | fi; |
276 | ||
277 | if test x$MIRRORS = xinternal; then | |
72b2cb61 | 278 | AC_DEFINE([MIRRORED_INTERNAL], 1, [Define to 1 to include built-in support for mirrors.]) |
4922197a AK |
279 | fi |
280 | ||
80992638 | 281 | ################################################################################ |
1b523347 | 282 | dnl -- Disable readline |
ad6254c5 | 283 | AC_MSG_CHECKING(whether to enable readline) |
2c189a57 | 284 | AC_ARG_ENABLE([readline], |
1b523347 | 285 | [ --disable-readline Disable readline support], |
ea7cfb00 | 286 | [READLINE=$enableval], [READLINE=maybe]) |
ad6254c5 | 287 | AC_MSG_RESULT($READLINE) |
795ca3e5 | 288 | |
8b1a3214 AK |
289 | ################################################################################ |
290 | dnl -- Disable realtime clock support | |
291 | AC_MSG_CHECKING(whether to enable realtime support) | |
3d978351 | 292 | AC_ARG_ENABLE(realtime, [ --disable-realtime Disable realtime clock support], |
8b1a3214 AK |
293 | REALTIME=$enableval) |
294 | AC_MSG_RESULT($REALTIME) | |
295 | ||
80992638 | 296 | ################################################################################ |
8ce0cbda | 297 | dnl -- Build cluster LVM daemon |
ad6254c5 | 298 | AC_MSG_CHECKING(whether to build cluster LVM daemon) |
a266258f | 299 | AC_ARG_WITH(clvmd, |
5c7fc7c4 | 300 | [ --with-clvmd=TYPE Build cluster LVM Daemon: cman/gulm/none/all |
a266258f AK |
301 | [TYPE=none] ], |
302 | [ CLVMD="$withval" ], | |
303 | [ CLVMD="none" ]) | |
304 | if test x$CLVMD = xyes; then | |
5c7fc7c4 | 305 | CLVMD=all |
b1098701 | 306 | fi |
ad6254c5 | 307 | AC_MSG_RESULT($CLVMD) |
80992638 | 308 | |
8ce0cbda | 309 | dnl -- If clvmd enabled without cluster locking, automagically include it |
a266258f | 310 | if test x$CLVMD != xnone && test x$CLUSTER = xnone; then |
d3c8211f AK |
311 | CLUSTER=internal |
312 | fi | |
d3c8211f | 313 | |
80992638 | 314 | ################################################################################ |
8ce0cbda | 315 | dnl -- Enable debugging |
ad6254c5 AK |
316 | AC_MSG_CHECKING(whether to enable debugging) |
317 | AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging], | |
d0191583 | 318 | DEBUG=$enableval, DEBUG=no) |
ad6254c5 | 319 | AC_MSG_RESULT($DEBUG) |
8ef2b021 | 320 | |
8ce0cbda AK |
321 | dnl -- Normally turn off optimisation for debug builds |
322 | if test x$DEBUG = xyes; then | |
323 | COPTIMISE_FLAG= | |
8a2fc586 AK |
324 | else |
325 | CSCOPE_CMD= | |
8ce0cbda AK |
326 | fi |
327 | ||
328 | ################################################################################ | |
329 | dnl -- Override optimisation | |
ad6254c5 | 330 | AC_MSG_CHECKING(for C optimisation flag) |
8ce0cbda | 331 | AC_ARG_WITH(optimisation, |
d0191583 | 332 | [ --with-optimisation=OPT C optimisation flag [[OPT=-O2]] ], |
8ce0cbda | 333 | [ COPTIMISE_FLAG="$withval" ]) |
ad6254c5 | 334 | AC_MSG_RESULT($COPTIMISE_FLAG) |
8ce0cbda | 335 | |
fddafd51 ZK |
336 | ################################################################################ |
337 | dnl -- Enable profiling | |
5556819a | 338 | AC_MSG_CHECKING(whether to gather gcov profiling data) |
fddafd51 | 339 | AC_ARG_ENABLE(profiling, |
5556819a AK |
340 | AC_HELP_STRING(--enable-profiling, [Gather gcov profiling data]), |
341 | PROFILING=$enableval, PROFILING=no) | |
342 | AC_MSG_RESULT($PROFILING) | |
343 | ||
344 | if test "x$PROFILING" = xyes; then | |
345 | COPTIMISE_FLAG="$COPTIMISE_FLAG -fprofile-arcs -ftest-coverage" | |
b145d876 ZK |
346 | AC_PATH_PROG(LCOV, lcov, no) |
347 | AC_PATH_PROG(GENHTML, genhtml, no) | |
348 | if test "$LCOV" = no -o "$GENHTML" = no ; then | |
349 | AC_MSG_ERROR([lcov and genhtml are required for profiling]) | |
350 | fi | |
5556819a | 351 | fi |
fddafd51 | 352 | |
80992638 | 353 | ################################################################################ |
8ce0cbda | 354 | dnl -- Disable devmapper |
ad6254c5 | 355 | AC_MSG_CHECKING(whether to use device-mapper) |
f6fc418d | 356 | AC_ARG_ENABLE(devmapper, [ --disable-devmapper Disable LVM2 device-mapper interaction], |
ad6254c5 AK |
357 | DEVMAPPER=$enableval) |
358 | AC_MSG_RESULT($DEVMAPPER) | |
199e490e | 359 | |
b896caa1 | 360 | if test x$DEVMAPPER = xyes; then |
f6fc418d | 361 | AC_DEFINE([DEVMAPPER_SUPPORT], 1, [Define to 1 to enable LVM2 device-mapper interaction.]) |
b896caa1 AK |
362 | fi |
363 | ||
f6fc418d AK |
364 | ################################################################################ |
365 | dnl -- Compatibility mode | |
366 | AC_ARG_ENABLE(compat, [ --enable-compat Enable support for old device-mapper versions], | |
367 | DM_COMPAT=$enableval, DM_COMPAT=no) | |
368 | ||
369 | ################################################################################ | |
370 | dnl -- Disable ioctl | |
371 | AC_ARG_ENABLE(ioctl, [ --disable-driver Disable calls to device-mapper in the kernel], | |
372 | DM_IOCTLS=$enableval) | |
373 | ||
80992638 | 374 | ################################################################################ |
8ce0cbda | 375 | dnl -- Disable O_DIRECT |
ad6254c5 AK |
376 | AC_MSG_CHECKING(whether to enable O_DIRECT) |
377 | AC_ARG_ENABLE(o_direct, [ --disable-o_direct Disable O_DIRECT], | |
378 | ODIRECT=$enableval) | |
379 | AC_MSG_RESULT($ODIRECT) | |
2dc95e1c AK |
380 | |
381 | if test x$ODIRECT = xyes; then | |
72b2cb61 | 382 | AC_DEFINE([O_DIRECT_SUPPORT], 1, [Define to 1 to enable O_DIRECT support.]) |
2dc95e1c AK |
383 | fi |
384 | ||
80992638 | 385 | ################################################################################ |
8ce0cbda | 386 | dnl -- Enable cmdlib |
ad6254c5 AK |
387 | AC_MSG_CHECKING(whether to compile liblvm2cmd.so) |
388 | AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library], | |
389 | CMDLIB=$enableval, CMDLIB=no) | |
390 | AC_MSG_RESULT($CMDLIB) | |
aa4d1e31 | 391 | AC_SUBST([LVM2CMD_LIB]) |
2a9a80c9 | 392 | test x$CMDLIB = xyes \ |
aa4d1e31 JM |
393 | && LVM2CMD_LIB=-llvm2cmd \ |
394 | || LVM2CMD_LIB= | |
8106cdd5 | 395 | |
f6fc418d AK |
396 | ################################################################################ |
397 | dnl -- Enable pkg-config | |
398 | AC_ARG_ENABLE(pkgconfig, [ --enable-pkgconfig Install pkgconfig support], | |
399 | PKGCONFIG=$enableval, PKGCONFIG=no) | |
2a9a80c9 | 400 | |
80992638 | 401 | ################################################################################ |
8ce0cbda | 402 | dnl -- Enable fsadm |
1995c9ff | 403 | AC_MSG_CHECKING(whether to install fsadm) |
ad6254c5 AK |
404 | AC_ARG_ENABLE(fsadm, [ --enable-fsadm Enable fsadm], |
405 | FSADM=$enableval) | |
406 | AC_MSG_RESULT($FSADM) | |
809fae91 | 407 | |
06f62ad1 AK |
408 | ################################################################################ |
409 | dnl -- enable dmeventd handling | |
410 | AC_MSG_CHECKING(whether to use dmeventd) | |
411 | AC_ARG_ENABLE(dmeventd, [ --enable-dmeventd Enable the device-mapper event daemon], | |
412 | DMEVENTD=$enableval) | |
413 | AC_MSG_RESULT($DMEVENTD) | |
414 | ||
f6fc418d AK |
415 | BUILD_DMEVENTD=$DMEVENTD |
416 | ||
06f62ad1 | 417 | dnl -- dmeventd currently requires internal mirror support |
2a9a80c9 PR |
418 | if test x$DMEVENTD = xyes; then |
419 | if test x$MIRRORS != xinternal; then | |
420 | AC_MSG_ERROR( | |
421 | --enable-dmeventd currently requires --with-mirrors=internal | |
422 | ) | |
423 | fi | |
424 | if test x$CMDLIB = xno; then | |
425 | AC_MSG_ERROR( | |
426 | --enable-dmeventd requires --enable-cmdlib to be used as well | |
427 | ) | |
428 | fi | |
06f62ad1 AK |
429 | fi |
430 | ||
15d91f5a | 431 | if test x$DMEVENTD = xyes; then |
72b2cb61 | 432 | AC_DEFINE([DMEVENTD], 1, [Define to 1 to enable the device-mapper event daemon.]) |
15d91f5a | 433 | fi |
f6fc418d AK |
434 | |
435 | ################################################################################ | |
436 | dnl -- getline included in recent libc | |
437 | ||
438 | AC_CHECK_LIB(c, getline, AC_DEFINE([HAVE_GETLINE], 1, | |
439 | [Define to 1 if getline is available.])) | |
440 | ||
441 | ################################################################################ | |
442 | dnl -- canonicalize_file_name included in recent libc | |
443 | ||
444 | AC_CHECK_LIB(c, canonicalize_file_name, | |
445 | AC_DEFINE([HAVE_CANONICALIZE_FILE_NAME], 1, | |
446 | [Define to 1 if canonicalize_file_name is available.])) | |
447 | ||
80992638 | 448 | ################################################################################ |
d0191583 | 449 | dnl -- Clear default exec_prefix - install into /sbin rather than /usr/sbin |
795ca3e5 AK |
450 | if [[ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ]]; |
451 | then exec_prefix=""; | |
452 | fi; | |
453 | ||
80992638 | 454 | ################################################################################ |
8ce0cbda | 455 | dnl -- Check for termcap (Shamelessly copied from parted 1.4.17) |
ea7cfb00 JM |
456 | if test x$READLINE != xno; then |
457 | AC_SEARCH_LIBS([tgetent], [ncurses curses termcap termlib], | |
458 | [tg_found=yes], [tg_found=no]) | |
459 | test x$READLINE:$tg_found = xyes:no && | |
460 | AC_MSG_ERROR( | |
795ca3e5 AK |
461 | termcap could not be found which is required for the |
462 | --enable-readline option (which is enabled by default). Either disable readline | |
463 | support with --disable-readline or download and install termcap from: | |
464 | ftp.gnu.org/gnu/termcap | |
465 | Note: if you are using precompiled packages you will also need the development | |
466 | package as well (which may be called termcap-devel or something similar). | |
467 | Note: (n)curses also seems to work as a substitute for termcap. This was | |
468 | not found either - but you could try installing that as well. | |
469 | ) | |
795ca3e5 AK |
470 | fi |
471 | ||
80992638 | 472 | ################################################################################ |
8ce0cbda | 473 | dnl -- Check for dlopen |
26e7f2e0 AK |
474 | AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no) |
475 | ||
7e9e9502 | 476 | if [[ "x$HAVE_LIBDL" = xyes ]]; then |
72b2cb61 | 477 | AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dynamic libraries are available.]) |
26e7f2e0 | 478 | LIBS="-ldl $LIBS" |
d68a82ec AK |
479 | else |
480 | HAVE_LIBDL=no | |
26e7f2e0 AK |
481 | fi |
482 | ||
80992638 | 483 | ################################################################################ |
8ce0cbda | 484 | dnl -- Check for shared/static conflicts |
80992638 AK |
485 | if [[ \( "x$LVM1" = xshared -o "x$POOL" = xshared -o "x$CLUSTER" = xshared \ |
486 | -o "x$SNAPSHOTS" = xshared -o "x$MIRRORS" = xshared \ | |
4922197a | 487 | \) -a "x$STATIC_LINK" = xyes ]]; |
d68a82ec | 488 | then AC_MSG_ERROR( |
036f273a | 489 | Features cannot be 'shared' when building statically |
d68a82ec | 490 | ) |
036f273a AK |
491 | fi |
492 | ||
d0191583 JM |
493 | ################################################################################ |
494 | dnl -- Enables statically-linked tools | |
495 | AC_MSG_CHECKING(whether to use static linking) | |
496 | AC_ARG_ENABLE(static_link, | |
497 | [ --enable-static_link Use this to link the tools to their libraries | |
498 | statically. Default is dynamic linking], | |
499 | STATIC_LINK=$enableval, STATIC_LINK=no) | |
500 | AC_MSG_RESULT($STATIC_LINK) | |
501 | ||
502 | ################################################################################ | |
503 | dnl -- Disable selinux | |
504 | AC_MSG_CHECKING(whether to enable selinux support) | |
505 | AC_ARG_ENABLE(selinux, [ --disable-selinux Disable selinux support], | |
506 | SELINUX=$enableval) | |
507 | AC_MSG_RESULT($SELINUX) | |
508 | ||
80992638 | 509 | ################################################################################ |
8a2fc586 | 510 | dnl -- Check for selinux |
80992638 | 511 | if test x$SELINUX = xyes; then |
8a2fc586 | 512 | AC_CHECK_LIB(sepol, sepol_check_context, HAVE_SEPOL=yes, HAVE_SEPOL=no) |
8a2fc586 AK |
513 | |
514 | if test x$HAVE_SEPOL = xyes; then | |
d0191583 JM |
515 | AC_DEFINE([HAVE_SEPOL], 1, |
516 | [Define to 1 if sepol_check_context is available.]) | |
8a2fc586 AK |
517 | LIBS="-lsepol $LIBS" |
518 | fi | |
519 | ||
80992638 AK |
520 | AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no) |
521 | ||
522 | if test x$HAVE_SELINUX = xyes; then | |
72b2cb61 | 523 | AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.]) |
80992638 AK |
524 | LIBS="-lselinux $LIBS" |
525 | else | |
ad6254c5 | 526 | AC_MSG_WARN(Disabling selinux) |
80992638 | 527 | fi |
66e941e8 | 528 | |
d0191583 | 529 | # With --enable-static_link and selinux enabled, linking |
66e941e8 JM |
530 | # fails on at least Debian unstable due to unsatisfied references |
531 | # to pthread_mutex_lock and _unlock. See if we need -lpthread. | |
532 | if test "$STATIC_LINK-$HAVE_SELINUX" = yes-yes; then | |
533 | lvm_saved_libs=$LIBS | |
534 | LIBS="$LIBS -static" | |
535 | AC_SEARCH_LIBS([pthread_mutex_lock], [pthread], | |
536 | [test "$ac_cv_search_pthread_mutex_lock" = "none required" || | |
537 | LIB_PTHREAD=-lpthread]) | |
538 | LIBS=$lvm_saved_libs | |
539 | fi | |
036f273a | 540 | fi |
d68a82ec | 541 | |
8b1a3214 AK |
542 | ################################################################################ |
543 | dnl -- Check for realtime clock support | |
544 | if test x$REALTIME = xyes; then | |
8b1a3214 | 545 | AC_CHECK_LIB(rt, clock_gettime, HAVE_REALTIME=yes, HAVE_REALTIME=no) |
8b1a3214 AK |
546 | |
547 | if test x$HAVE_REALTIME = xyes; then | |
548 | AC_DEFINE([HAVE_REALTIME], 1, [Define to 1 to include support for realtime clock.]) | |
549 | LIBS="-lrt $LIBS" | |
550 | else | |
551 | AC_MSG_WARN(Disabling realtime clock) | |
552 | fi | |
553 | fi | |
554 | ||
80992638 | 555 | ################################################################################ |
8ce0cbda | 556 | dnl -- Check for getopt |
d0191583 | 557 | AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.])) |
b896caa1 | 558 | |
80992638 | 559 | ################################################################################ |
8ce0cbda | 560 | dnl -- Check for readline (Shamelessly copied from parted 1.4.17) |
ea7cfb00 | 561 | if test x$READLINE != xno; then |
0ad6b7e2 JM |
562 | rl_found=yes |
563 | AC_CHECK_LIB([readline], [readline], , [rl_found=no]) | |
ea7cfb00 JM |
564 | test x$READLINE:$rl_found = xyes:no && |
565 | AC_MSG_ERROR( | |
795ca3e5 AK |
566 | GNU Readline could not be found which is required for the |
567 | --enable-readline option (which is enabled by default). Either disable readline | |
568 | support with --disable-readline or download and install readline from: | |
569 | ftp.gnu.org/gnu/readline | |
570 | Note: if you are using precompiled packages you will also need the development | |
571 | package as well (which may be called readline-devel or something similar). | |
572 | ) | |
ea7cfb00 | 573 | if test $rl_found = yes; then |
0ad6b7e2 | 574 | AC_CHECK_FUNCS([rl_completion_matches]) |
ea7cfb00 JM |
575 | AC_DEFINE([READLINE_SUPPORT], 1, |
576 | [Define to 1 to include the LVM readline shell.]) | |
577 | fi | |
795ca3e5 AK |
578 | fi |
579 | ||
80992638 | 580 | ################################################################################ |
8ce0cbda | 581 | dnl -- Internationalisation stuff |
ad6254c5 AK |
582 | AC_MSG_CHECKING(whether to enable internationalisation) |
583 | AC_ARG_ENABLE(nls, [ --enable-nls Enable Native Language Support], | |
584 | INTL=$enableval, INTL=no) | |
585 | AC_MSG_RESULT($INTL) | |
69792976 AK |
586 | |
587 | if test x$INTL = xyes; then | |
f6fc418d | 588 | # FIXME - Move this - can be device-mapper too |
69792976 AK |
589 | INTL_PACKAGE="lvm2" |
590 | AC_PATH_PROG(MSGFMT, msgfmt) | |
591 | if [[ "x$MSGFMT" == x ]]; | |
592 | then AC_MSG_ERROR( | |
593 | msgfmt not found in path $PATH | |
594 | ) | |
69792976 AK |
595 | fi; |
596 | ||
597 | AC_ARG_WITH(localedir, | |
d0191583 JM |
598 | [ --with-localedir=DIR Translation files in DIR [[PREFIX/share/locale]] ], |
599 | [ LOCALEDIR="$withval" ], | |
600 | [ LOCALEDIR='${prefix}/share/locale' ]) | |
69792976 AK |
601 | fi |
602 | ||
80992638 | 603 | ################################################################################ |
4a7f3eb2 | 604 | AC_ARG_WITH(confdir, |
0a62c911 | 605 | [ --with-confdir=DIR Configuration files in DIR [/etc]], |
d0191583 JM |
606 | [ CONFDIR="$withval" ], |
607 | [ CONFDIR='/etc' ]) | |
0a62c911 AK |
608 | |
609 | AC_ARG_WITH(staticdir, | |
610 | [ --with-staticdir=DIR Static binary in DIR [EXEC_PREFIX/sbin]], | |
d0191583 JM |
611 | [ STATICDIR="$withval" ], |
612 | [ STATICDIR='${exec_prefix}/sbin' ]) | |
0a62c911 | 613 | |
68f2de6d AK |
614 | AC_ARG_WITH(usrlibdir, |
615 | [ --with-usrlibdir=DIR], | |
616 | [ usrlibdir="$withval"], | |
617 | [ usrlibdir='${prefix}/lib' ]) | |
618 | ||
619 | AC_ARG_WITH(usrsbindir, | |
620 | [ --with-usrsbindir=DIR], | |
621 | [ usrsbindir="$withval"], | |
622 | [ usrsbindir='${prefix}/sbin' ]) | |
623 | ||
ad6254c5 AK |
624 | ################################################################################ |
625 | dnl -- Ensure additional headers required | |
626 | if test x$READLINE = xyes; then | |
627 | AC_CHECK_HEADERS(readline/readline.h readline/history.h,,AC_MSG_ERROR(bailing out)) | |
628 | fi | |
629 | ||
5c7fc7c4 | 630 | if test x$CLVMD != xnone; then |
ad6254c5 AK |
631 | AC_CHECK_HEADERS(mntent.h netdb.h netinet/in.h pthread.h search.h sys/mount.h sys/socket.h sys/uio.h sys/un.h utmpx.h,,AC_MSG_ERROR(bailing out)) |
632 | AC_CHECK_FUNCS(dup2 getmntent memmove select socket,,AC_MSG_ERROR(bailing out)) | |
633 | AC_FUNC_GETMNTENT | |
634 | # AC_FUNC_REALLOC | |
635 | AC_FUNC_SELECT_ARGTYPES | |
636 | fi | |
637 | ||
ad6254c5 AK |
638 | if test x$CLUSTER != xnone; then |
639 | AC_CHECK_HEADERS(sys/socket.h sys/un.h,,AC_MSG_ERROR(bailing out)) | |
640 | AC_CHECK_FUNCS(socket,,AC_MSG_ERROR(bailing out)) | |
641 | fi | |
642 | ||
643 | if test x$HAVE_LIBDL = xyes; then | |
644 | AC_CHECK_HEADERS(dlfcn.h,,AC_MSG_ERROR(bailing out)) | |
645 | fi | |
646 | ||
647 | if test x$INTL = xyes; then | |
648 | AC_CHECK_HEADERS(libintl.h,,AC_MSG_ERROR(bailing out)) | |
649 | fi | |
650 | ||
2293567c | 651 | AC_CHECK_HEADERS(libdevmapper.h,,AC_MSG_ERROR(bailing out)) |
ad6254c5 AK |
652 | |
653 | if test x$HAVE_SELINUX = xyes; then | |
654 | AC_CHECK_HEADERS(selinux/selinux.h,,AC_MSG_ERROR(bailing out)) | |
655 | fi | |
4a7f3eb2 | 656 | |
a653923f AK |
657 | ################################################################################ |
658 | AC_PATH_PROG(MODPROBE_CMD, modprobe) | |
659 | ||
660 | if test x$MODPROBE_CMD != x; then | |
72b2cb61 | 661 | AC_DEFINE_UNQUOTED([MODPROBE_CMD], ["$MODPROBE_CMD"], [The path to 'modprobe', if available.]) |
a653923f AK |
662 | fi |
663 | ||
80992638 | 664 | ################################################################################ |
f6fc418d AK |
665 | dnl -- dmeventd pidfile and executable path |
666 | AH_TEMPLATE(DMEVENTD_PIDFILE, [Path to dmeventd pidfile.]) | |
667 | if test "$BUILD_DMEVENTD" = yes; then | |
668 | AC_ARG_WITH(dmeventd-pidfile, | |
669 | [ --with-dmeventd-pidfile=PATH dmeventd pidfile [[/var/run/dmeventd.pid]] ], | |
670 | [ AC_DEFINE_UNQUOTED(DMEVENTD_PIDFILE,"$withval") ], | |
671 | [ AC_DEFINE_UNQUOTED(DMEVENTD_PIDFILE,"/var/run/dmeventd.pid") ]) | |
672 | fi | |
673 | ||
674 | AH_TEMPLATE(DMEVENTD_PATH, [Path to dmeventd binary.]) | |
675 | if test "$BUILD_DMEVENTD" = yes; then | |
676 | dmeventd_prefix="$exec_prefix" | |
677 | if test "x$dmeventd_prefix" = "xNONE"; then | |
678 | dmeventd_prefix="$prefix" | |
679 | fi | |
680 | if test "x$dmeventd_prefix" = "xNONE"; then | |
681 | dmeventd_prefix="" | |
682 | fi | |
683 | AC_ARG_WITH(dmeventd-path, | |
684 | [ --with-dmeventd-path=PATH dmeventd path [[${exec_prefix}/sbin/dmeventd]] ], | |
685 | [ AC_DEFINE_UNQUOTED(DMEVENTD_PATH,"$withval") ], | |
686 | [ AC_DEFINE_UNQUOTED(DMEVENTD_PATH,"$dmeventd_prefix/sbin/dmeventd") ]) | |
687 | fi | |
688 | ||
689 | ################################################################################ | |
690 | dnl -- which kernel interface to use (ioctl only) | |
691 | AC_MSG_CHECKING(for kernel interface choice) | |
692 | AC_ARG_WITH(interface, | |
693 | [ --with-interface=IFACE Choose kernel interface (ioctl) [[ioctl]] ], | |
694 | [ interface="$withval" ], | |
695 | [ interface=ioctl ]) | |
696 | if [[ "x$interface" != xioctl ]]; | |
697 | then | |
698 | AC_MSG_ERROR(--with-interface=ioctl required. fs no longer supported.) | |
699 | fi | |
700 | AC_MSG_RESULT($interface) | |
701 | ||
702 | ################################################################################ | |
703 | DM_LIB_VERSION="\"`cat VERSION_LIB 2>/dev/null || echo Unknown`\"" | |
f58b35b5 AK |
704 | AC_DEFINE_UNQUOTED(DM_LIB_VERSION, $DM_LIB_VERSION, [Library version]) |
705 | ||
d0191583 | 706 | LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\"" |
fae0c576 | 707 | |
80992638 | 708 | ################################################################################ |
d0191583 | 709 | AC_SUBST(BUILD_DMEVENTD) |
b896caa1 | 710 | AC_SUBST(CFLAGS) |
d0191583 | 711 | AC_SUBST(CFLOW_CMD) |
8106cdd5 | 712 | AC_SUBST(CLDFLAGS) |
8106cdd5 | 713 | AC_SUBST(CLDNOWHOLEARCHIVE) |
d0191583 JM |
714 | AC_SUBST(CLDWHOLEARCHIVE) |
715 | AC_SUBST(CLUSTER) | |
716 | AC_SUBST(CLVMD) | |
717 | AC_SUBST(CMDLIB) | |
718 | AC_SUBST(COPTIMISE_FLAG) | |
719 | AC_SUBST(CSCOPE_CMD) | |
8ef2b021 | 720 | AC_SUBST(DEBUG) |
199e490e | 721 | AC_SUBST(DEVMAPPER) |
d0191583 JM |
722 | AC_SUBST(DMEVENTD) |
723 | AC_SUBST(DM_COMPAT) | |
724 | AC_SUBST(DM_DEVICE_GID) | |
725 | AC_SUBST(DM_DEVICE_MODE) | |
726 | AC_SUBST(DM_DEVICE_UID) | |
727 | AC_SUBST(DM_IOCTLS) | |
728 | AC_SUBST(DM_LIB_VERSION) | |
729 | AC_SUBST(FSADM) | |
730 | AC_SUBST(GROUP) | |
26e7f2e0 | 731 | AC_SUBST(HAVE_LIBDL) |
8b1a3214 | 732 | AC_SUBST(HAVE_REALTIME) |
d0191583 JM |
733 | AC_SUBST(HAVE_SELINUX) |
734 | AC_SUBST(INTL) | |
735 | AC_SUBST(INTL_PACKAGE) | |
736 | AC_SUBST(JOBS) | |
737 | AC_SUBST(LDDEPS) | |
738 | AC_SUBST(LIBS) | |
739 | AC_SUBST(LIB_SUFFIX) | |
69792976 | 740 | AC_SUBST(LOCALEDIR) |
d0191583 JM |
741 | AC_SUBST(LVM1) |
742 | AC_SUBST(LVM1_FALLBACK) | |
4a7f3eb2 | 743 | AC_SUBST(CONFDIR) |
d0191583 JM |
744 | AC_SUBST(LVM_VERSION) |
745 | AC_SUBST(MIRRORS) | |
746 | AC_SUBST(MSGFMT) | |
747 | AC_SUBST(OWNER) | |
748 | AC_SUBST(PKGCONFIG) | |
749 | AC_SUBST(POOL) | |
750 | AC_SUBST(SNAPSHOTS) | |
0a62c911 | 751 | AC_SUBST(STATICDIR) |
d0191583 | 752 | AC_SUBST(STATIC_LINK) |
66e941e8 | 753 | AC_SUBST([LIB_PTHREAD]) |
f6fc418d AK |
754 | AC_SUBST(interface) |
755 | AC_SUBST(kerneldir) | |
756 | AC_SUBST(missingkernel) | |
757 | AC_SUBST(kernelvsn) | |
758 | AC_SUBST(tmpdir) | |
68f2de6d AK |
759 | AC_SUBST(usrlibdir) |
760 | AC_SUBST(usrsbindir) | |
8106cdd5 | 761 | |
80992638 | 762 | ################################################################################ |
d3a356b4 | 763 | dnl -- First and last lines should not contain files to generate in order to |
8ce0cbda | 764 | dnl -- keep utility scripts running properly |
d3a356b4 JM |
765 | AC_CONFIG_FILES([ |
766 | Makefile | |
767 | make.tmpl | |
768 | daemons/Makefile | |
769 | daemons/clvmd/Makefile | |
f6fc418d AK |
770 | daemons/dmeventd/Makefile |
771 | daemons/dmeventd/libdevmapper-event.pc | |
b7edb5bf | 772 | daemons/dmeventd/plugins/Makefile |
f6fc418d AK |
773 | daemons/dmeventd/plugins/mirror/Makefile |
774 | daemons/dmeventd/plugins/snapshot/Makefile | |
d3a356b4 | 775 | doc/Makefile |
f6fc418d AK |
776 | include/Makefile |
777 | lib/Makefile | |
d3a356b4 JM |
778 | lib/format1/Makefile |
779 | lib/format_pool/Makefile | |
780 | lib/locking/Makefile | |
781 | lib/mirror/Makefile | |
782 | lib/snapshot/Makefile | |
f6fc418d AK |
783 | libdm/Makefile |
784 | libdm/libdevmapper.pc | |
785 | man/Makefile | |
786 | po/Makefile | |
d3a356b4 | 787 | scripts/Makefile |
f6fc418d | 788 | test/Makefile |
d3a356b4 JM |
789 | tools/Makefile |
790 | tools/version.h | |
7a197a62 AK |
791 | ]) |
792 | AC_OUTPUT | |
2dc95e1c AK |
793 | |
794 | if test x$ODIRECT != xyes; then | |
ad6254c5 | 795 | AC_MSG_WARN(Warning: O_DIRECT disabled: low-memory pvmove may lock up) |
2dc95e1c | 796 | fi |