]>
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 |
d0191583 JM |
44 | FSADM=no |
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 AK |
64 | dnl -- Checks for programs. |
65 | AC_PROG_AWK | |
66 | AC_PROG_CC | |
d0191583 JM |
67 | |
68 | dnl probably no longer needed in 2008, but... | |
69 | AC_PROG_GCC_TRADITIONAL | |
8ce0cbda AK |
70 | AC_PROG_INSTALL |
71 | AC_PROG_LN_S | |
72 | AC_PROG_MAKE_SET | |
fddafd51 | 73 | AC_PROG_MKDIR_P |
5556819a | 74 | AC_PROG_RANLIB |
8a2fc586 AK |
75 | AC_PATH_PROG(CFLOW_CMD, cflow) |
76 | AC_PATH_PROG(CSCOPE_CMD, cscope) | |
8ce0cbda AK |
77 | |
78 | ################################################################################ | |
d0191583 | 79 | dnl -- Check for header files. |
80992638 AK |
80 | AC_HEADER_DIRENT |
81 | AC_HEADER_STDC | |
ad6254c5 AK |
82 | AC_HEADER_SYS_WAIT |
83 | AC_HEADER_TIME | |
84 | ||
d0191583 JM |
85 | AC_CHECK_HEADERS([locale.h stddef.h syslog.h sys/file.h sys/time.h assert.h \ |
86 | libgen.h signal.h sys/mman.h sys/resource.h sys/utsname.h sys/wait.h time.h], , | |
87 | [AC_MSG_ERROR(bailing out)]) | |
ad6254c5 AK |
88 | |
89 | case "$host_os" in | |
90 | linux*) | |
91 | AC_CHECK_HEADERS(asm/byteorder.h linux/fs.h malloc.h,,AC_MSG_ERROR(bailing out)) ;; | |
92 | darwin*) | |
93 | AC_CHECK_HEADERS(machine/endian.h sys/disk.h,,AC_MSG_ERROR(bailing out)) ;; | |
94 | esac | |
80992638 | 95 | |
d0191583 JM |
96 | AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h getopt.h inttypes.h limits.h \ |
97 | stdarg.h stdio.h stdlib.h string.h sys/ioctl.h sys/param.h sys/stat.h \ | |
98 | sys/types.h unistd.h], , [AC_MSG_ERROR(bailing out)]) | |
99 | AC_CHECK_HEADERS(termios.h sys/statvfs.h) | |
100 | ||
80992638 | 101 | ################################################################################ |
d0191583 | 102 | dnl -- Check for typedefs, structures, and compiler characteristics. |
80992638 AK |
103 | AC_C_CONST |
104 | AC_C_INLINE | |
d0191583 | 105 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
80992638 AK |
106 | AC_TYPE_OFF_T |
107 | AC_TYPE_PID_T | |
d0191583 | 108 | AC_TYPE_SIGNAL |
80992638 | 109 | AC_TYPE_SIZE_T |
ad6254c5 | 110 | AC_TYPE_MODE_T |
7a197a62 | 111 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
ad6254c5 AK |
112 | AC_STRUCT_TM |
113 | ||
114 | ################################################################################ | |
115 | dnl -- Check for functions | |
d0191583 JM |
116 | AC_CHECK_FUNCS([gethostname getpagesize memset mkdir rmdir munmap setlocale \ |
117 | strcasecmp strchr strdup strncasecmp strerror strrchr strstr strtol strtoul \ | |
118 | uname], , [AC_MSG_ERROR(bailing out)]) | |
ad6254c5 AK |
119 | AC_FUNC_ALLOCA |
120 | AC_FUNC_CLOSEDIR_VOID | |
121 | AC_FUNC_FORK | |
122 | AC_FUNC_LSTAT | |
123 | AC_FUNC_MALLOC | |
124 | AC_FUNC_MEMCMP | |
125 | AC_FUNC_MMAP | |
126 | AC_FUNC_STAT | |
127 | AC_FUNC_STRTOD | |
d0191583 | 128 | AC_FUNC_VPRINTF |
80992638 AK |
129 | |
130 | ################################################################################ | |
8ce0cbda | 131 | dnl -- Prefix is /usr by default, the exec_prefix default is setup later |
795ca3e5 AK |
132 | AC_PREFIX_DEFAULT(/usr) |
133 | ||
80992638 | 134 | ################################################################################ |
8ce0cbda | 135 | dnl -- Setup the ownership of the files |
ad6254c5 | 136 | AC_MSG_CHECKING(file owner) |
80992638 AK |
137 | OWNER="root" |
138 | ||
795ca3e5 | 139 | AC_ARG_WITH(user, |
d0191583 | 140 | [ --with-user=USER Set the owner of installed files [[USER=root]] ], |
a38df97f | 141 | [ OWNER="$withval" ]) |
ad6254c5 | 142 | AC_MSG_RESULT($OWNER) |
a38df97f AK |
143 | |
144 | if test x$OWNER != x; then | |
145 | OWNER="-o $OWNER" | |
146 | fi | |
795ca3e5 | 147 | |
80992638 | 148 | ################################################################################ |
8ce0cbda | 149 | dnl -- Setup the group ownership of the files |
ad6254c5 | 150 | AC_MSG_CHECKING(group owner) |
80992638 | 151 | GROUP="root" |
795ca3e5 | 152 | AC_ARG_WITH(group, |
d0191583 | 153 | [ --with-group=GROUP Set the group owner of installed files [[GROUP=root]] ], |
a38df97f | 154 | [ GROUP="$withval" ]) |
ad6254c5 | 155 | AC_MSG_RESULT($GROUP) |
a38df97f AK |
156 | |
157 | if test x$GROUP != x; then | |
158 | GROUP="-g $GROUP" | |
159 | fi | |
795ca3e5 | 160 | |
80992638 | 161 | ################################################################################ |
7d1552c9 | 162 | dnl -- LVM1 tool fallback option |
ad6254c5 | 163 | AC_MSG_CHECKING(whether to enable lvm1 fallback) |
7d1552c9 AK |
164 | AC_ARG_ENABLE(lvm1_fallback, [ --enable-lvm1_fallback Use this to fall back and use LVM1 binaries if |
165 | device-mapper is missing from the kernel], LVM1_FALLBACK=$enableval, LVM1_FALLBACK=no) | |
ad6254c5 | 166 | AC_MSG_RESULT($LVM1_FALLBACK) |
7d1552c9 AK |
167 | |
168 | if test x$LVM1_FALLBACK = xyes; then | |
72b2cb61 | 169 | 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 |
170 | fi |
171 | ||
80992638 | 172 | ################################################################################ |
5a52dca9 | 173 | dnl -- format1 inclusion type |
ad6254c5 | 174 | AC_MSG_CHECKING(whether to include support for lvm1 metadata) |
5a52dca9 AK |
175 | AC_ARG_WITH(lvm1, |
176 | [ --with-lvm1=TYPE LVM1 metadata support: internal/shared/none | |
177 | [TYPE=internal] ], | |
178 | [ LVM1="$withval" ], | |
179 | [ LVM1="internal" ]) | |
ad6254c5 | 180 | AC_MSG_RESULT($LVM1) |
5a52dca9 AK |
181 | |
182 | if [[ "x$LVM1" != xnone -a "x$LVM1" != xinternal -a "x$LVM1" != xshared ]]; | |
183 | then AC_MSG_ERROR( | |
184 | --with-lvm1 parameter invalid | |
185 | ) | |
5a52dca9 AK |
186 | fi; |
187 | ||
b896caa1 | 188 | if test x$LVM1 = xinternal; then |
72b2cb61 | 189 | AC_DEFINE([LVM1_INTERNAL], 1, [Define to 1 to include built-in support for LVM1 metadata.]) |
b896caa1 AK |
190 | fi |
191 | ||
80992638 | 192 | ################################################################################ |
d8ac0fbc | 193 | dnl -- format_pool inclusion type |
ad6254c5 | 194 | AC_MSG_CHECKING(whether to include support for GFS pool metadata) |
d8ac0fbc | 195 | AC_ARG_WITH(pool, |
60329273 | 196 | [ --with-pool=TYPE GFS pool read-only support: internal/shared/none |
d8ac0fbc AK |
197 | [TYPE=internal] ], |
198 | [ POOL="$withval" ], | |
199 | [ POOL="internal" ]) | |
ad6254c5 | 200 | AC_MSG_RESULT($POOL) |
d8ac0fbc AK |
201 | |
202 | if [[ "x$POOL" != xnone -a "x$POOL" != xinternal -a "x$POOL" != xshared ]]; | |
203 | then AC_MSG_ERROR( | |
204 | --with-pool parameter invalid | |
205 | ) | |
d8ac0fbc AK |
206 | fi; |
207 | ||
208 | if test x$POOL = xinternal; then | |
72b2cb61 | 209 | AC_DEFINE([POOL_INTERNAL], 1, [Define to 1 to include built-in support for GFS pool metadata.]) |
d8ac0fbc AK |
210 | fi |
211 | ||
80992638 | 212 | ################################################################################ |
d3c8211f | 213 | dnl -- cluster_locking inclusion type |
ad6254c5 | 214 | AC_MSG_CHECKING(whether to include support for cluster locking) |
d3c8211f AK |
215 | AC_ARG_WITH(cluster, |
216 | [ --with-cluster=TYPE Cluster LVM locking support: internal/shared/none | |
217 | [TYPE=internal] ], | |
218 | [ CLUSTER="$withval" ]) | |
ad6254c5 | 219 | AC_MSG_RESULT($CLUSTER) |
d3c8211f AK |
220 | |
221 | if [[ "x$CLUSTER" != xnone -a "x$CLUSTER" != xinternal -a "x$CLUSTER" != xshared ]]; | |
222 | then AC_MSG_ERROR( | |
223 | --with-cluster parameter invalid | |
224 | ) | |
d3c8211f AK |
225 | fi; |
226 | ||
227 | if test x$CLUSTER = xinternal; then | |
72b2cb61 | 228 | AC_DEFINE([CLUSTER_LOCKING_INTERNAL], 1, [Define to 1 to include built-in support for clustered LVM locking.]) |
d3c8211f | 229 | fi |
d8ac0fbc | 230 | |
80992638 | 231 | ################################################################################ |
4922197a | 232 | dnl -- snapshots inclusion type |
ad6254c5 | 233 | AC_MSG_CHECKING(whether to include snapshots) |
4922197a AK |
234 | AC_ARG_WITH(snapshots, |
235 | [ --with-snapshots=TYPE Snapshot support: internal/shared/none | |
236 | [TYPE=internal] ], | |
237 | [ SNAPSHOTS="$withval" ], | |
238 | [ SNAPSHOTS="internal" ]) | |
ad6254c5 | 239 | AC_MSG_RESULT($SNAPSHOTS) |
4922197a AK |
240 | |
241 | if [[ "x$SNAPSHOTS" != xnone -a "x$SNAPSHOTS" != xinternal -a "x$SNAPSHOTS" != xshared ]]; | |
242 | then AC_MSG_ERROR( | |
243 | --with-snapshots parameter invalid | |
244 | ) | |
4922197a AK |
245 | fi; |
246 | ||
247 | if test x$SNAPSHOTS = xinternal; then | |
72b2cb61 | 248 | AC_DEFINE([SNAPSHOT_INTERNAL], 1, [Define to 1 to include built-in support for snapshots.]) |
4922197a AK |
249 | fi |
250 | ||
80992638 | 251 | ################################################################################ |
4922197a | 252 | dnl -- mirrors inclusion type |
ad6254c5 | 253 | AC_MSG_CHECKING(whether to include mirrors) |
4922197a AK |
254 | AC_ARG_WITH(mirrors, |
255 | [ --with-mirrors=TYPE Mirror support: internal/shared/none | |
256 | [TYPE=internal] ], | |
257 | [ MIRRORS="$withval" ], | |
258 | [ MIRRORS="internal" ]) | |
ad6254c5 | 259 | AC_MSG_RESULT($MIRRORS) |
4922197a AK |
260 | |
261 | if [[ "x$MIRRORS" != xnone -a "x$MIRRORS" != xinternal -a "x$MIRRORS" != xshared ]]; | |
262 | then AC_MSG_ERROR( | |
263 | --with-mirrors parameter invalid | |
264 | ) | |
4922197a AK |
265 | fi; |
266 | ||
267 | if test x$MIRRORS = xinternal; then | |
72b2cb61 | 268 | AC_DEFINE([MIRRORED_INTERNAL], 1, [Define to 1 to include built-in support for mirrors.]) |
4922197a AK |
269 | fi |
270 | ||
80992638 | 271 | ################################################################################ |
8ce0cbda | 272 | dnl -- Enable readline |
ad6254c5 | 273 | AC_MSG_CHECKING(whether to enable readline) |
2c189a57 JM |
274 | AC_ARG_ENABLE([readline], |
275 | [ --enable-readline Enable readline support], | |
276 | [READLINE=$enableval], [READLINE=no]) | |
ad6254c5 | 277 | AC_MSG_RESULT($READLINE) |
795ca3e5 | 278 | |
8b1a3214 AK |
279 | ################################################################################ |
280 | dnl -- Disable realtime clock support | |
281 | AC_MSG_CHECKING(whether to enable realtime support) | |
3d978351 | 282 | AC_ARG_ENABLE(realtime, [ --disable-realtime Disable realtime clock support], |
8b1a3214 AK |
283 | REALTIME=$enableval) |
284 | AC_MSG_RESULT($REALTIME) | |
285 | ||
80992638 | 286 | ################################################################################ |
8ce0cbda | 287 | dnl -- Build cluster LVM daemon |
ad6254c5 | 288 | AC_MSG_CHECKING(whether to build cluster LVM daemon) |
a266258f | 289 | AC_ARG_WITH(clvmd, |
5c7fc7c4 | 290 | [ --with-clvmd=TYPE Build cluster LVM Daemon: cman/gulm/none/all |
a266258f AK |
291 | [TYPE=none] ], |
292 | [ CLVMD="$withval" ], | |
293 | [ CLVMD="none" ]) | |
294 | if test x$CLVMD = xyes; then | |
5c7fc7c4 | 295 | CLVMD=all |
b1098701 | 296 | fi |
ad6254c5 | 297 | AC_MSG_RESULT($CLVMD) |
80992638 | 298 | |
8ce0cbda | 299 | dnl -- If clvmd enabled without cluster locking, automagically include it |
a266258f | 300 | if test x$CLVMD != xnone && test x$CLUSTER = xnone; then |
d3c8211f AK |
301 | CLUSTER=internal |
302 | fi | |
d3c8211f | 303 | |
80992638 | 304 | ################################################################################ |
8ce0cbda | 305 | dnl -- Enable debugging |
ad6254c5 AK |
306 | AC_MSG_CHECKING(whether to enable debugging) |
307 | AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging], | |
d0191583 | 308 | DEBUG=$enableval, DEBUG=no) |
ad6254c5 | 309 | AC_MSG_RESULT($DEBUG) |
8ef2b021 | 310 | |
8ce0cbda AK |
311 | dnl -- Normally turn off optimisation for debug builds |
312 | if test x$DEBUG = xyes; then | |
313 | COPTIMISE_FLAG= | |
8a2fc586 AK |
314 | else |
315 | CSCOPE_CMD= | |
8ce0cbda AK |
316 | fi |
317 | ||
318 | ################################################################################ | |
319 | dnl -- Override optimisation | |
ad6254c5 | 320 | AC_MSG_CHECKING(for C optimisation flag) |
8ce0cbda | 321 | AC_ARG_WITH(optimisation, |
d0191583 | 322 | [ --with-optimisation=OPT C optimisation flag [[OPT=-O2]] ], |
8ce0cbda | 323 | [ COPTIMISE_FLAG="$withval" ]) |
ad6254c5 | 324 | AC_MSG_RESULT($COPTIMISE_FLAG) |
8ce0cbda | 325 | |
fddafd51 ZK |
326 | ################################################################################ |
327 | dnl -- Enable profiling | |
5556819a | 328 | AC_MSG_CHECKING(whether to gather gcov profiling data) |
fddafd51 | 329 | AC_ARG_ENABLE(profiling, |
5556819a AK |
330 | AC_HELP_STRING(--enable-profiling, [Gather gcov profiling data]), |
331 | PROFILING=$enableval, PROFILING=no) | |
332 | AC_MSG_RESULT($PROFILING) | |
333 | ||
334 | if test "x$PROFILING" = xyes; then | |
335 | COPTIMISE_FLAG="$COPTIMISE_FLAG -fprofile-arcs -ftest-coverage" | |
336 | AC_PATH_PROG(LCOV, lcov) | |
337 | AC_PATH_PROG(GENHTML, genhtml) | |
338 | fi | |
fddafd51 | 339 | |
80992638 | 340 | ################################################################################ |
8ce0cbda | 341 | dnl -- Disable devmapper |
ad6254c5 AK |
342 | AC_MSG_CHECKING(whether to use device-mapper) |
343 | AC_ARG_ENABLE(devmapper, [ --disable-devmapper Disable device-mapper interaction], | |
344 | DEVMAPPER=$enableval) | |
345 | AC_MSG_RESULT($DEVMAPPER) | |
199e490e | 346 | |
b896caa1 | 347 | if test x$DEVMAPPER = xyes; then |
72b2cb61 | 348 | AC_DEFINE([DEVMAPPER_SUPPORT], 1, [Define to 1 to enable device-mapper interaction.]) |
b896caa1 AK |
349 | fi |
350 | ||
80992638 | 351 | ################################################################################ |
8ce0cbda | 352 | dnl -- Disable O_DIRECT |
ad6254c5 AK |
353 | AC_MSG_CHECKING(whether to enable O_DIRECT) |
354 | AC_ARG_ENABLE(o_direct, [ --disable-o_direct Disable O_DIRECT], | |
355 | ODIRECT=$enableval) | |
356 | AC_MSG_RESULT($ODIRECT) | |
2dc95e1c AK |
357 | |
358 | if test x$ODIRECT = xyes; then | |
72b2cb61 | 359 | AC_DEFINE([O_DIRECT_SUPPORT], 1, [Define to 1 to enable O_DIRECT support.]) |
2dc95e1c AK |
360 | fi |
361 | ||
80992638 | 362 | ################################################################################ |
8ce0cbda | 363 | dnl -- Enable cmdlib |
ad6254c5 AK |
364 | AC_MSG_CHECKING(whether to compile liblvm2cmd.so) |
365 | AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library], | |
366 | CMDLIB=$enableval, CMDLIB=no) | |
367 | AC_MSG_RESULT($CMDLIB) | |
aa4d1e31 JM |
368 | AC_SUBST([LVM2CMD_LIB]) |
369 | test $CMDLIB=yes \ | |
370 | && LVM2CMD_LIB=-llvm2cmd \ | |
371 | || LVM2CMD_LIB= | |
8106cdd5 | 372 | |
80992638 | 373 | ################################################################################ |
8ce0cbda | 374 | dnl -- Enable fsadm |
1995c9ff | 375 | AC_MSG_CHECKING(whether to install fsadm) |
ad6254c5 AK |
376 | AC_ARG_ENABLE(fsadm, [ --enable-fsadm Enable fsadm], |
377 | FSADM=$enableval) | |
378 | AC_MSG_RESULT($FSADM) | |
809fae91 | 379 | |
06f62ad1 AK |
380 | ################################################################################ |
381 | dnl -- enable dmeventd handling | |
382 | AC_MSG_CHECKING(whether to use dmeventd) | |
383 | AC_ARG_ENABLE(dmeventd, [ --enable-dmeventd Enable the device-mapper event daemon], | |
384 | DMEVENTD=$enableval) | |
385 | AC_MSG_RESULT($DMEVENTD) | |
386 | ||
387 | dnl -- dmeventd currently requires internal mirror support | |
388 | if test x$DMEVENTD = xyes && test x$MIRRORS != xinternal; then | |
389 | AC_MSG_ERROR( | |
390 | --enable-dmeventd currently requires --with-mirrors=internal | |
391 | ) | |
392 | fi | |
393 | ||
15d91f5a | 394 | if test x$DMEVENTD = xyes; then |
72b2cb61 | 395 | AC_DEFINE([DMEVENTD], 1, [Define to 1 to enable the device-mapper event daemon.]) |
15d91f5a | 396 | fi |
80992638 | 397 | ################################################################################ |
d0191583 | 398 | dnl -- Clear default exec_prefix - install into /sbin rather than /usr/sbin |
795ca3e5 AK |
399 | if [[ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ]]; |
400 | then exec_prefix=""; | |
401 | fi; | |
402 | ||
80992638 | 403 | ################################################################################ |
8ce0cbda | 404 | dnl -- Check for termcap (Shamelessly copied from parted 1.4.17) |
795ca3e5 AK |
405 | if test x$READLINE = xyes; then |
406 | AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib, , | |
407 | AC_MSG_ERROR( | |
408 | termcap could not be found which is required for the | |
409 | --enable-readline option (which is enabled by default). Either disable readline | |
410 | support with --disable-readline or download and install termcap from: | |
411 | ftp.gnu.org/gnu/termcap | |
412 | Note: if you are using precompiled packages you will also need the development | |
413 | package as well (which may be called termcap-devel or something similar). | |
414 | Note: (n)curses also seems to work as a substitute for termcap. This was | |
415 | not found either - but you could try installing that as well. | |
416 | ) | |
795ca3e5 AK |
417 | ) |
418 | fi | |
419 | ||
80992638 | 420 | ################################################################################ |
8ce0cbda | 421 | dnl -- Check for dlopen |
26e7f2e0 AK |
422 | AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no) |
423 | ||
7e9e9502 | 424 | if [[ "x$HAVE_LIBDL" = xyes ]]; then |
72b2cb61 | 425 | AC_DEFINE([HAVE_LIBDL], 1, [Define to 1 if dynamic libraries are available.]) |
26e7f2e0 | 426 | LIBS="-ldl $LIBS" |
d68a82ec AK |
427 | else |
428 | HAVE_LIBDL=no | |
26e7f2e0 AK |
429 | fi |
430 | ||
80992638 | 431 | ################################################################################ |
8ce0cbda | 432 | dnl -- Check for shared/static conflicts |
80992638 AK |
433 | if [[ \( "x$LVM1" = xshared -o "x$POOL" = xshared -o "x$CLUSTER" = xshared \ |
434 | -o "x$SNAPSHOTS" = xshared -o "x$MIRRORS" = xshared \ | |
4922197a | 435 | \) -a "x$STATIC_LINK" = xyes ]]; |
d68a82ec | 436 | then AC_MSG_ERROR( |
036f273a | 437 | Features cannot be 'shared' when building statically |
d68a82ec | 438 | ) |
036f273a AK |
439 | fi |
440 | ||
d0191583 JM |
441 | ################################################################################ |
442 | dnl -- Enables statically-linked tools | |
443 | AC_MSG_CHECKING(whether to use static linking) | |
444 | AC_ARG_ENABLE(static_link, | |
445 | [ --enable-static_link Use this to link the tools to their libraries | |
446 | statically. Default is dynamic linking], | |
447 | STATIC_LINK=$enableval, STATIC_LINK=no) | |
448 | AC_MSG_RESULT($STATIC_LINK) | |
449 | ||
450 | ################################################################################ | |
451 | dnl -- Disable selinux | |
452 | AC_MSG_CHECKING(whether to enable selinux support) | |
453 | AC_ARG_ENABLE(selinux, [ --disable-selinux Disable selinux support], | |
454 | SELINUX=$enableval) | |
455 | AC_MSG_RESULT($SELINUX) | |
456 | ||
80992638 | 457 | ################################################################################ |
8a2fc586 | 458 | dnl -- Check for selinux |
80992638 | 459 | if test x$SELINUX = xyes; then |
8a2fc586 | 460 | AC_CHECK_LIB(sepol, sepol_check_context, HAVE_SEPOL=yes, HAVE_SEPOL=no) |
8a2fc586 AK |
461 | |
462 | if test x$HAVE_SEPOL = xyes; then | |
d0191583 JM |
463 | AC_DEFINE([HAVE_SEPOL], 1, |
464 | [Define to 1 if sepol_check_context is available.]) | |
8a2fc586 AK |
465 | LIBS="-lsepol $LIBS" |
466 | fi | |
467 | ||
80992638 AK |
468 | AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no) |
469 | ||
470 | if test x$HAVE_SELINUX = xyes; then | |
72b2cb61 | 471 | AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.]) |
80992638 AK |
472 | LIBS="-lselinux $LIBS" |
473 | else | |
ad6254c5 | 474 | AC_MSG_WARN(Disabling selinux) |
80992638 | 475 | fi |
66e941e8 | 476 | |
d0191583 | 477 | # With --enable-static_link and selinux enabled, linking |
66e941e8 JM |
478 | # fails on at least Debian unstable due to unsatisfied references |
479 | # to pthread_mutex_lock and _unlock. See if we need -lpthread. | |
480 | if test "$STATIC_LINK-$HAVE_SELINUX" = yes-yes; then | |
481 | lvm_saved_libs=$LIBS | |
482 | LIBS="$LIBS -static" | |
483 | AC_SEARCH_LIBS([pthread_mutex_lock], [pthread], | |
484 | [test "$ac_cv_search_pthread_mutex_lock" = "none required" || | |
485 | LIB_PTHREAD=-lpthread]) | |
486 | LIBS=$lvm_saved_libs | |
487 | fi | |
036f273a | 488 | fi |
d68a82ec | 489 | |
8b1a3214 AK |
490 | ################################################################################ |
491 | dnl -- Check for realtime clock support | |
492 | if test x$REALTIME = xyes; then | |
8b1a3214 | 493 | AC_CHECK_LIB(rt, clock_gettime, HAVE_REALTIME=yes, HAVE_REALTIME=no) |
8b1a3214 AK |
494 | |
495 | if test x$HAVE_REALTIME = xyes; then | |
496 | AC_DEFINE([HAVE_REALTIME], 1, [Define to 1 to include support for realtime clock.]) | |
497 | LIBS="-lrt $LIBS" | |
498 | else | |
499 | AC_MSG_WARN(Disabling realtime clock) | |
500 | fi | |
501 | fi | |
502 | ||
80992638 | 503 | ################################################################################ |
8ce0cbda | 504 | dnl -- Check for getopt |
d0191583 | 505 | AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.])) |
b896caa1 | 506 | |
80992638 | 507 | ################################################################################ |
8ce0cbda | 508 | dnl -- Check for readline (Shamelessly copied from parted 1.4.17) |
795ca3e5 AK |
509 | if test x$READLINE = xyes; then |
510 | AC_CHECK_LIB(readline, readline, , | |
511 | AC_MSG_ERROR( | |
512 | GNU Readline could not be found which is required for the | |
513 | --enable-readline option (which is enabled by default). Either disable readline | |
514 | support with --disable-readline or download and install readline from: | |
515 | ftp.gnu.org/gnu/readline | |
516 | Note: if you are using precompiled packages you will also need the development | |
517 | package as well (which may be called readline-devel or something similar). | |
518 | ) | |
795ca3e5 | 519 | ) |
2c189a57 JM |
520 | AC_CHECK_FUNC([rl_completion_matches], |
521 | AC_DEFINE([HAVE_RL_COMPLETION_MATCHES], 1, | |
522 | [Define to 1 if rl_completion_matches() is available.])) | |
523 | AC_DEFINE([READLINE_SUPPORT], 1, | |
524 | [Define to 1 to include the LVM readline shell.]) | |
795ca3e5 AK |
525 | fi |
526 | ||
80992638 | 527 | ################################################################################ |
8ce0cbda | 528 | dnl -- Internationalisation stuff |
ad6254c5 AK |
529 | AC_MSG_CHECKING(whether to enable internationalisation) |
530 | AC_ARG_ENABLE(nls, [ --enable-nls Enable Native Language Support], | |
531 | INTL=$enableval, INTL=no) | |
532 | AC_MSG_RESULT($INTL) | |
69792976 AK |
533 | |
534 | if test x$INTL = xyes; then | |
535 | INTL_PACKAGE="lvm2" | |
536 | AC_PATH_PROG(MSGFMT, msgfmt) | |
537 | if [[ "x$MSGFMT" == x ]]; | |
538 | then AC_MSG_ERROR( | |
539 | msgfmt not found in path $PATH | |
540 | ) | |
69792976 AK |
541 | fi; |
542 | ||
543 | AC_ARG_WITH(localedir, | |
d0191583 JM |
544 | [ --with-localedir=DIR Translation files in DIR [[PREFIX/share/locale]] ], |
545 | [ LOCALEDIR="$withval" ], | |
546 | [ LOCALEDIR='${prefix}/share/locale' ]) | |
69792976 AK |
547 | fi |
548 | ||
80992638 | 549 | ################################################################################ |
4a7f3eb2 | 550 | AC_ARG_WITH(confdir, |
0a62c911 | 551 | [ --with-confdir=DIR Configuration files in DIR [/etc]], |
d0191583 JM |
552 | [ CONFDIR="$withval" ], |
553 | [ CONFDIR='/etc' ]) | |
0a62c911 AK |
554 | |
555 | AC_ARG_WITH(staticdir, | |
556 | [ --with-staticdir=DIR Static binary in DIR [EXEC_PREFIX/sbin]], | |
d0191583 JM |
557 | [ STATICDIR="$withval" ], |
558 | [ STATICDIR='${exec_prefix}/sbin' ]) | |
0a62c911 | 559 | |
33f732c5 AK |
560 | AC_ARG_WITH(dmdir, |
561 | [ --with-dmdir=DIR Build against device-mapper source tree in DIR], | |
d0191583 | 562 | [ DMDIR="$withval" CPPFLAGS="$CPPFLAGS -I$DMDIR/include"], |
33f732c5 AK |
563 | [ DMDIR= ]) |
564 | ||
09339e2b | 565 | # Convert a relative dir name to absolute. |
25fbec5b AK |
566 | case $DMDIR in |
567 | /*) ;; | |
568 | *) DMDIR="`pwd`/$DMDIR" ;; | |
09339e2b JM |
569 | esac |
570 | ||
ad6254c5 AK |
571 | ################################################################################ |
572 | dnl -- Ensure additional headers required | |
573 | if test x$READLINE = xyes; then | |
574 | AC_CHECK_HEADERS(readline/readline.h readline/history.h,,AC_MSG_ERROR(bailing out)) | |
575 | fi | |
576 | ||
5c7fc7c4 | 577 | if test x$CLVMD != xnone; then |
ad6254c5 AK |
578 | 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)) |
579 | AC_CHECK_FUNCS(dup2 getmntent memmove select socket,,AC_MSG_ERROR(bailing out)) | |
580 | AC_FUNC_GETMNTENT | |
581 | # AC_FUNC_REALLOC | |
582 | AC_FUNC_SELECT_ARGTYPES | |
583 | fi | |
584 | ||
ad6254c5 AK |
585 | if test x$CLUSTER != xnone; then |
586 | AC_CHECK_HEADERS(sys/socket.h sys/un.h,,AC_MSG_ERROR(bailing out)) | |
587 | AC_CHECK_FUNCS(socket,,AC_MSG_ERROR(bailing out)) | |
588 | fi | |
589 | ||
590 | if test x$HAVE_LIBDL = xyes; then | |
591 | AC_CHECK_HEADERS(dlfcn.h,,AC_MSG_ERROR(bailing out)) | |
592 | fi | |
593 | ||
594 | if test x$INTL = xyes; then | |
595 | AC_CHECK_HEADERS(libintl.h,,AC_MSG_ERROR(bailing out)) | |
596 | fi | |
597 | ||
2293567c | 598 | AC_CHECK_HEADERS(libdevmapper.h,,AC_MSG_ERROR(bailing out)) |
ad6254c5 AK |
599 | |
600 | if test x$HAVE_SELINUX = xyes; then | |
601 | AC_CHECK_HEADERS(selinux/selinux.h,,AC_MSG_ERROR(bailing out)) | |
602 | fi | |
4a7f3eb2 | 603 | |
a653923f AK |
604 | ################################################################################ |
605 | AC_PATH_PROG(MODPROBE_CMD, modprobe) | |
606 | ||
607 | if test x$MODPROBE_CMD != x; then | |
72b2cb61 | 608 | AC_DEFINE_UNQUOTED([MODPROBE_CMD], ["$MODPROBE_CMD"], [The path to 'modprobe', if available.]) |
a653923f AK |
609 | fi |
610 | ||
80992638 | 611 | ################################################################################ |
d0191583 | 612 | LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\"" |
fae0c576 | 613 | |
80992638 | 614 | ################################################################################ |
d0191583 | 615 | AC_SUBST(BUILD_DMEVENTD) |
b896caa1 | 616 | AC_SUBST(CFLAGS) |
d0191583 | 617 | AC_SUBST(CFLOW_CMD) |
8106cdd5 | 618 | AC_SUBST(CLDFLAGS) |
8106cdd5 | 619 | AC_SUBST(CLDNOWHOLEARCHIVE) |
d0191583 JM |
620 | AC_SUBST(CLDWHOLEARCHIVE) |
621 | AC_SUBST(CLUSTER) | |
622 | AC_SUBST(CLVMD) | |
623 | AC_SUBST(CMDLIB) | |
624 | AC_SUBST(COPTIMISE_FLAG) | |
625 | AC_SUBST(CSCOPE_CMD) | |
8ef2b021 | 626 | AC_SUBST(DEBUG) |
199e490e | 627 | AC_SUBST(DEVMAPPER) |
d0191583 JM |
628 | AC_SUBST(DMDIR) |
629 | # FIXME: rename to LVM_USE_DMEVENTD | |
630 | AC_SUBST(DMEVENTD) | |
631 | AC_SUBST(DM_COMPAT) | |
632 | AC_SUBST(DM_DEVICE_GID) | |
633 | AC_SUBST(DM_DEVICE_MODE) | |
634 | AC_SUBST(DM_DEVICE_UID) | |
635 | AC_SUBST(DM_IOCTLS) | |
636 | AC_SUBST(DM_LIB_VERSION) | |
637 | AC_SUBST(FSADM) | |
638 | AC_SUBST(GROUP) | |
26e7f2e0 | 639 | AC_SUBST(HAVE_LIBDL) |
8b1a3214 | 640 | AC_SUBST(HAVE_REALTIME) |
d0191583 JM |
641 | AC_SUBST(HAVE_SELINUX) |
642 | AC_SUBST(INTL) | |
643 | AC_SUBST(INTL_PACKAGE) | |
644 | AC_SUBST(JOBS) | |
645 | AC_SUBST(LDDEPS) | |
646 | AC_SUBST(LIBS) | |
647 | AC_SUBST(LIB_SUFFIX) | |
69792976 | 648 | AC_SUBST(LOCALEDIR) |
d0191583 JM |
649 | AC_SUBST(LVM1) |
650 | AC_SUBST(LVM1_FALLBACK) | |
651 | # FIXME: rename to LVM_CONF_DIR | |
4a7f3eb2 | 652 | AC_SUBST(CONFDIR) |
d0191583 JM |
653 | AC_SUBST(LVM_VERSION) |
654 | AC_SUBST(MIRRORS) | |
655 | AC_SUBST(MSGFMT) | |
656 | AC_SUBST(OWNER) | |
657 | AC_SUBST(PKGCONFIG) | |
658 | AC_SUBST(POOL) | |
659 | AC_SUBST(SNAPSHOTS) | |
0a62c911 | 660 | AC_SUBST(STATICDIR) |
d0191583 | 661 | AC_SUBST(STATIC_LINK) |
66e941e8 | 662 | AC_SUBST([LIB_PTHREAD]) |
8106cdd5 | 663 | |
80992638 | 664 | ################################################################################ |
d3a356b4 | 665 | dnl -- First and last lines should not contain files to generate in order to |
8ce0cbda | 666 | dnl -- keep utility scripts running properly |
d3a356b4 JM |
667 | AC_CONFIG_FILES([ |
668 | Makefile | |
669 | make.tmpl | |
d0191583 JM |
670 | include/Makefile |
671 | lib/Makefile | |
672 | man/Makefile | |
673 | po/Makefile | |
674 | dmeventd/Makefile | |
d3a356b4 JM |
675 | daemons/Makefile |
676 | daemons/clvmd/Makefile | |
d3a356b4 | 677 | dmeventd/mirror/Makefile |
67961c7c | 678 | dmeventd/snapshot/Makefile |
d3a356b4 | 679 | doc/Makefile |
d3a356b4 JM |
680 | lib/format1/Makefile |
681 | lib/format_pool/Makefile | |
682 | lib/locking/Makefile | |
683 | lib/mirror/Makefile | |
684 | lib/snapshot/Makefile | |
685 | test/Makefile | |
d3a356b4 JM |
686 | scripts/Makefile |
687 | tools/Makefile | |
688 | tools/version.h | |
7a197a62 AK |
689 | ]) |
690 | AC_OUTPUT | |
2dc95e1c AK |
691 | |
692 | if test x$ODIRECT != xyes; then | |
ad6254c5 | 693 | AC_MSG_WARN(Warning: O_DIRECT disabled: low-memory pvmove may lock up) |
2dc95e1c | 694 | fi |
809fae91 AK |
695 | |
696 | if test x$FSADM == xyes; then | |
ad6254c5 | 697 | AC_MSG_WARN(fsadm support is untested) |
809fae91 | 698 | fi |
06f62ad1 AK |
699 | |
700 | if test x$DMEVENTD == xyes; then | |
701 | AC_MSG_WARN(dmeventd support is untested) | |
702 | fi |