]>
Commit | Line | Data |
---|---|---|
795ca3e5 AK |
1 | ## |
2 | ## Copyright 1999-2000 Sistina Software, Inc. | |
3 | ## | |
4 | ## This is free software released under the GNU General Public License. | |
5 | ## There is no warranty for this software. See the file COPYING for | |
6 | ## details. | |
7 | ## | |
8 | ## See the file CONTRIBUTORS for a list of contributors. | |
9 | ## | |
10 | ## This file is maintained by: | |
11 | ## AJ Lewis <lewis@sistina.com> | |
12 | ## | |
13 | ## File name: configure.in | |
14 | ## | |
15 | ## Description: Input file for autoconf. Generates the configure script | |
16 | ## that tries to keep everything nice and portable. It also | |
17 | ## simplifies distribution package building considerably. | |
18 | ################################################################################ | |
19 | ||
20 | dnl Process this file with autoconf to produce a configure script. | |
13c7b701 | 21 | AC_INIT(lib/device/dev-cache.h) |
795ca3e5 AK |
22 | |
23 | dnl setup the directory where autoconf has auxilary files | |
24 | AC_CONFIG_AUX_DIR(autoconf) | |
25 | ||
26 | dnl Checks for programs. | |
27 | AC_PROG_AWK | |
28 | AC_PROG_CC | |
29 | AC_PROG_INSTALL | |
30 | AC_PROG_LN_S | |
31 | AC_PROG_MAKE_SET | |
32 | AC_PROG_RANLIB | |
33 | ||
34 | dnl Checks for header files. | |
35 | AC_HEADER_DIRENT | |
36 | AC_HEADER_STDC | |
37 | AC_CHECK_HEADERS(fcntl.h malloc.h sys/ioctl.h unistd.h) | |
38 | ||
39 | dnl Checks for typedefs, structures, and compiler characteristics. | |
40 | AC_C_CONST | |
41 | AC_C_INLINE | |
42 | AC_TYPE_OFF_T | |
43 | AC_TYPE_PID_T | |
44 | AC_TYPE_SIZE_T | |
45 | AC_STRUCT_ST_RDEV | |
46 | AC_HEADER_TIME | |
47 | ||
b896caa1 AK |
48 | dnl Get system type |
49 | AC_CANONICAL_SYSTEM | |
50 | ||
51 | case "$host_os" in | |
52 | linux*) | |
8106cdd5 AK |
53 | CFLAGS= |
54 | CLDFLAGS="-Wl,--version-script,.export.sym" | |
55 | CLDWHOLEARCHIVE="-Wl,-whole-archive" | |
56 | CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive" | |
57 | LD_DEPS=".export.sym" | |
d68a82ec | 58 | LD_FLAGS="-Wl,--export-dynamic" |
8106cdd5 AK |
59 | SOFLAG="-shared" |
60 | DEVMAPPER=yes | |
61 | ODIRECT=yes ;; | |
62 | darwin*) | |
63 | CFLAGS="-no-cpp-precomp -fno-common" | |
64 | CLDFLAGS= | |
65 | CLDWHOLEARCHIVE="-all_load" | |
66 | CLDNOWHOLEARCHIVE= | |
67 | LD_DEPS= | |
d68a82ec | 68 | LD_FLAGS= |
8106cdd5 AK |
69 | SOFLAG="-dynamiclib" |
70 | DEVMAPPER=no | |
71 | ODIRECT=no ;; | |
b896caa1 AK |
72 | esac |
73 | ||
795ca3e5 AK |
74 | dnl -- prefix is /usr by default, the exec_prefix default is setup later |
75 | AC_PREFIX_DEFAULT(/usr) | |
76 | ||
a38df97f AK |
77 | OWNER="root" |
78 | GROUP="root" | |
79 | ||
795ca3e5 AK |
80 | dnl -- setup the ownership of the files |
81 | AC_ARG_WITH(user, | |
82 | [ --with-user=USER Set the owner of installed files ], | |
a38df97f AK |
83 | [ OWNER="$withval" ]) |
84 | ||
85 | if test x$OWNER != x; then | |
86 | OWNER="-o $OWNER" | |
87 | fi | |
795ca3e5 AK |
88 | |
89 | dnl -- setup the group ownership of the files | |
90 | AC_ARG_WITH(group, | |
91 | [ --with-group=GROUP Set the group owner of installed files ], | |
a38df97f AK |
92 | [ GROUP="$withval" ]) |
93 | ||
94 | if test x$GROUP != x; then | |
95 | GROUP="-g $GROUP" | |
96 | fi | |
795ca3e5 | 97 | |
7d1552c9 AK |
98 | dnl -- LVM1 tool fallback option |
99 | AC_ARG_ENABLE(lvm1_fallback, [ --enable-lvm1_fallback Use this to fall back and use LVM1 binaries if | |
100 | device-mapper is missing from the kernel], LVM1_FALLBACK=$enableval, LVM1_FALLBACK=no) | |
101 | ||
102 | if test x$LVM1_FALLBACK = xyes; then | |
103 | CFLAGS="$CFLAGS -DLVM1_FALLBACK" | |
104 | fi | |
105 | ||
5a52dca9 AK |
106 | dnl -- format1 inclusion type |
107 | AC_ARG_WITH(lvm1, | |
108 | [ --with-lvm1=TYPE LVM1 metadata support: internal/shared/none | |
109 | [TYPE=internal] ], | |
110 | [ LVM1="$withval" ], | |
111 | [ LVM1="internal" ]) | |
112 | ||
113 | if [[ "x$LVM1" != xnone -a "x$LVM1" != xinternal -a "x$LVM1" != xshared ]]; | |
114 | then AC_MSG_ERROR( | |
115 | --with-lvm1 parameter invalid | |
116 | ) | |
117 | exit | |
118 | fi; | |
119 | ||
b896caa1 AK |
120 | if test x$LVM1 = xinternal; then |
121 | CFLAGS="$CFLAGS -DLVM1_INTERNAL" | |
122 | fi | |
123 | ||
d8ac0fbc AK |
124 | dnl -- format_pool inclusion type |
125 | AC_ARG_WITH(pool, | |
60329273 | 126 | [ --with-pool=TYPE GFS pool read-only support: internal/shared/none |
d8ac0fbc AK |
127 | [TYPE=internal] ], |
128 | [ POOL="$withval" ], | |
129 | [ POOL="internal" ]) | |
130 | ||
131 | if [[ "x$POOL" != xnone -a "x$POOL" != xinternal -a "x$POOL" != xshared ]]; | |
132 | then AC_MSG_ERROR( | |
133 | --with-pool parameter invalid | |
134 | ) | |
135 | exit | |
136 | fi; | |
137 | ||
138 | if test x$POOL = xinternal; then | |
139 | CFLAGS="$CFLAGS -DPOOL_INTERNAL" | |
140 | fi | |
141 | ||
142 | ||
8ef2b021 | 143 | AC_ARG_ENABLE(jobs, [ --enable-jobs=NUM Number of jobs to run simultaneously], JOBS=-j$enableval, JOBS=-j2) |
795ca3e5 | 144 | |
4922197a AK |
145 | dnl -- snapshots inclusion type |
146 | AC_ARG_WITH(snapshots, | |
147 | [ --with-snapshots=TYPE Snapshot support: internal/shared/none | |
148 | [TYPE=internal] ], | |
149 | [ SNAPSHOTS="$withval" ], | |
150 | [ SNAPSHOTS="internal" ]) | |
151 | ||
152 | if [[ "x$SNAPSHOTS" != xnone -a "x$SNAPSHOTS" != xinternal -a "x$SNAPSHOTS" != xshared ]]; | |
153 | then AC_MSG_ERROR( | |
154 | --with-snapshots parameter invalid | |
155 | ) | |
156 | exit | |
157 | fi; | |
158 | ||
159 | if test x$SNAPSHOTS = xinternal; then | |
160 | CFLAGS="$CFLAGS -DSNAPSHOT_INTERNAL" | |
161 | fi | |
162 | ||
163 | dnl -- mirrors inclusion type | |
164 | AC_ARG_WITH(mirrors, | |
165 | [ --with-mirrors=TYPE Mirror support: internal/shared/none | |
166 | [TYPE=internal] ], | |
167 | [ MIRRORS="$withval" ], | |
168 | [ MIRRORS="internal" ]) | |
169 | ||
170 | if [[ "x$MIRRORS" != xnone -a "x$MIRRORS" != xinternal -a "x$MIRRORS" != xshared ]]; | |
171 | then AC_MSG_ERROR( | |
172 | --with-mirrors parameter invalid | |
173 | ) | |
174 | exit | |
175 | fi; | |
176 | ||
177 | if test x$MIRRORS = xinternal; then | |
178 | CFLAGS="$CFLAGS -DMIRRORED_INTERNAL" | |
179 | fi | |
180 | ||
8106cdd5 AK |
181 | dnl Enables staticly-linked tools |
182 | AC_ARG_ENABLE(static_link, [ --enable-static_link Use this to link the tools to their libraries | |
795ca3e5 AK |
183 | statically. Default is dynamic linking], STATIC_LINK=$enableval, STATIC_LINK=no) |
184 | ||
5a52dca9 AK |
185 | dnl Enable readline |
186 | AC_ARG_ENABLE(readline, [ --enable-readline Enable readline support], \ | |
187 | READLINE=$enableval, READLINE=no) | |
795ca3e5 | 188 | |
b896caa1 AK |
189 | if test x$READLINE = xyes; then |
190 | CFLAGS="$CFLAGS -DREADLINE_SUPPORT" | |
191 | fi | |
192 | ||
69792976 | 193 | echo $ac_n "checking whether to enable debugging""... $ac_c" 1>&6 |
8ef2b021 AK |
194 | dnl Enable Debugging |
195 | AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging], \ | |
196 | DEBUG=yes, DEBUG=no) | |
69792976 | 197 | echo "$ac_t""$DEBUG" 1>&6 |
8ef2b021 | 198 | |
69792976 | 199 | echo $ac_n "checking whether to enable device-mapper""... $ac_c" 1>&6 |
199e490e AK |
200 | dnl Disable devmapper |
201 | AC_ARG_ENABLE(devmapper, [ --disable-devmapper Disable device-mapper interaction], \ | |
8106cdd5 | 202 | DEVMAPPER=no) |
69792976 | 203 | echo "$ac_t""$DEVMAPPER" 1>&6 |
199e490e | 204 | |
b896caa1 AK |
205 | if test x$DEVMAPPER = xyes; then |
206 | CFLAGS="$CFLAGS -DDEVMAPPER_SUPPORT" | |
207 | fi | |
208 | ||
69792976 | 209 | echo $ac_n "checking whether to enable O_DIRECT""... $ac_c" 1>&6 |
2dc95e1c AK |
210 | dnl Disable O_DIRECT |
211 | AC_ARG_ENABLE(o_direct, [ --disable-o_direct Disable O_DIRECT], \ | |
8106cdd5 | 212 | ODIRECT=no) |
69792976 | 213 | echo "$ac_t""$ODIRECT" 1>&6 |
2dc95e1c AK |
214 | |
215 | if test x$ODIRECT = xyes; then | |
216 | CFLAGS="$CFLAGS -DO_DIRECT_SUPPORT" | |
217 | fi | |
218 | ||
8106cdd5 AK |
219 | echo $ac_n "checking whether to compile liblvm2cmd.so""... $ac_c" 1>&6 |
220 | dnl Enable cmdlib | |
221 | AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library], \ | |
222 | CMDLIB=yes, CMDLIB=no) | |
223 | echo "$ac_t""$CMDLIB" 1>&6 | |
224 | ||
225 | if test x$CMDLIB = xyes; then | |
226 | CFLAGS="$CFLAGS -DCMDLIB" | |
227 | fi | |
228 | ||
795ca3e5 AK |
229 | dnl Mess with default exec_prefix |
230 | if [[ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ]]; | |
231 | then exec_prefix=""; | |
232 | fi; | |
233 | ||
234 | dnl Checks for library functions. | |
235 | AC_PROG_GCC_TRADITIONAL | |
236 | AC_TYPE_SIGNAL | |
237 | AC_FUNC_VPRINTF | |
238 | AC_CHECK_FUNCS(mkdir rmdir uname) | |
239 | ||
240 | dnl check for termcap (Shamelessly copied from parted 1.4.17) | |
241 | if test x$READLINE = xyes; then | |
242 | AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib, , | |
243 | AC_MSG_ERROR( | |
244 | termcap could not be found which is required for the | |
245 | --enable-readline option (which is enabled by default). Either disable readline | |
246 | support with --disable-readline or download and install termcap from: | |
247 | ftp.gnu.org/gnu/termcap | |
248 | Note: if you are using precompiled packages you will also need the development | |
249 | package as well (which may be called termcap-devel or something similar). | |
250 | Note: (n)curses also seems to work as a substitute for termcap. This was | |
251 | not found either - but you could try installing that as well. | |
252 | ) | |
253 | exit | |
254 | ) | |
255 | fi | |
256 | ||
26e7f2e0 AK |
257 | dnl Check for dlopen |
258 | AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no) | |
259 | ||
74583a91 | 260 | if [[ "x$HAVE_LIBDL" = xyes -a "x$STATIC_LINK" = xno ]]; then |
b896caa1 | 261 | CFLAGS="$CFLAGS -DHAVE_LIBDL" |
26e7f2e0 | 262 | LIBS="-ldl $LIBS" |
d68a82ec AK |
263 | else |
264 | HAVE_LIBDL=no | |
26e7f2e0 AK |
265 | fi |
266 | ||
d68a82ec | 267 | dnl Check for shared/static conflicts |
d8ac0fbc | 268 | if [[ \( "x$LVM1" = xshared -o "x$POOL" = xshared -o \ |
4922197a AK |
269 | "x$SNAPSHOTS" = xshared -o "x$MIRRORS" = xshared \ |
270 | \) -a "x$STATIC_LINK" = xyes ]]; | |
d68a82ec | 271 | then AC_MSG_ERROR( |
036f273a | 272 | Features cannot be 'shared' when building statically |
d68a82ec AK |
273 | ) |
274 | exit | |
036f273a AK |
275 | fi |
276 | ||
277 | dnl Check for is_selinux_enabled | |
278 | AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no) | |
279 | ||
280 | if test x$HAVE_SELINUX = xyes; then | |
281 | CFLAGS="$CFLAGS -DHAVE_SELINUX" | |
282 | LIBS="-lselinux $LIBS" | |
283 | fi | |
d68a82ec | 284 | |
b896caa1 AK |
285 | dnl Check for getopt |
286 | AC_CHECK_HEADERS(getopt.h, CFLAGS="$CFLAGS -DHAVE_GETOPTLONG") | |
287 | ||
795ca3e5 AK |
288 | dnl Check for readline (Shamelessly copied from parted 1.4.17) |
289 | if test x$READLINE = xyes; then | |
290 | AC_CHECK_LIB(readline, readline, , | |
291 | AC_MSG_ERROR( | |
292 | GNU Readline could not be found which is required for the | |
293 | --enable-readline option (which is enabled by default). Either disable readline | |
294 | support with --disable-readline or download and install readline from: | |
295 | ftp.gnu.org/gnu/readline | |
296 | Note: if you are using precompiled packages you will also need the development | |
297 | package as well (which may be called readline-devel or something similar). | |
298 | ) | |
299 | exit | |
300 | ) | |
b896caa1 AK |
301 | AC_CHECK_FUNC(rl_completion_matches, CFLAGS="$CFLAGS -DHAVE_RL_COMPLETION_MATCHES") |
302 | ||
795ca3e5 AK |
303 | fi |
304 | ||
69792976 AK |
305 | echo $ac_n "checking whether to enable internationalisation""... $ac_c" 1>&6 |
306 | dnl Internationalisation stuff | |
307 | AC_ARG_ENABLE(nls, [ --enable-nls Enable Native Language Support],\ | |
308 | INTL=yes, INTL=no) | |
309 | echo "$ac_t""$INTL" 1>&6 | |
310 | ||
311 | if test x$INTL = xyes; then | |
312 | INTL_PACKAGE="lvm2" | |
313 | AC_PATH_PROG(MSGFMT, msgfmt) | |
314 | if [[ "x$MSGFMT" == x ]]; | |
315 | then AC_MSG_ERROR( | |
316 | msgfmt not found in path $PATH | |
317 | ) | |
318 | exit | |
319 | fi; | |
320 | ||
321 | AC_ARG_WITH(localedir, | |
322 | [ --with-localedir=DIR Translation files in DIR [PREFIX/share/locale]], | |
323 | [ LOCALEDIR="$withval" ], | |
324 | [ LOCALEDIR='${prefix}/share/locale' ]) | |
325 | fi | |
326 | ||
4a7f3eb2 | 327 | AC_ARG_WITH(confdir, |
0a62c911 | 328 | [ --with-confdir=DIR Configuration files in DIR [/etc]], |
4a7f3eb2 | 329 | [ CONFDIR="$withval" ], |
0a62c911 AK |
330 | [ CONFDIR='/etc' ]) |
331 | ||
332 | AC_ARG_WITH(staticdir, | |
333 | [ --with-staticdir=DIR Static binary in DIR [EXEC_PREFIX/sbin]], | |
334 | [ STATICDIR="$withval" ], | |
335 | [ STATICDIR='${exec_prefix}/sbin' ]) | |
336 | ||
4a7f3eb2 | 337 | |
fae0c576 AK |
338 | if test "-f VERSION"; then |
339 | LVM_VERSION="\"`cat VERSION`\"" | |
340 | else | |
341 | LVM_VERSION="Unknown" | |
342 | fi | |
343 | ||
795ca3e5 AK |
344 | AC_SUBST(JOBS) |
345 | AC_SUBST(STATIC_LINK) | |
5a52dca9 | 346 | AC_SUBST(LVM1) |
d8ac0fbc | 347 | AC_SUBST(POOL) |
4922197a AK |
348 | AC_SUBST(SNAPSHOTS) |
349 | AC_SUBST(MIRRORS) | |
795ca3e5 AK |
350 | AC_SUBST(OWNER) |
351 | AC_SUBST(GROUP) | |
b896caa1 | 352 | AC_SUBST(CFLAGS) |
8106cdd5 AK |
353 | AC_SUBST(CLDFLAGS) |
354 | AC_SUBST(CLDWHOLEARCHIVE) | |
355 | AC_SUBST(CLDNOWHOLEARCHIVE) | |
356 | AC_SUBST(LD_DEPS) | |
d68a82ec | 357 | AC_SUBST(LD_FLAGS) |
8106cdd5 | 358 | AC_SUBST(SOFLAG) |
5f68d858 | 359 | AC_SUBST(LIBS) |
fae0c576 | 360 | AC_SUBST(LVM_VERSION) |
7d1552c9 | 361 | AC_SUBST(LVM1_FALLBACK) |
8ef2b021 | 362 | AC_SUBST(DEBUG) |
199e490e | 363 | AC_SUBST(DEVMAPPER) |
26e7f2e0 | 364 | AC_SUBST(HAVE_LIBDL) |
036f273a | 365 | AC_SUBST(HAVE_SELINUX) |
8106cdd5 | 366 | AC_SUBST(CMDLIB) |
69792976 AK |
367 | AC_SUBST(MSGFMT) |
368 | AC_SUBST(LOCALEDIR) | |
4a7f3eb2 | 369 | AC_SUBST(CONFDIR) |
0a62c911 | 370 | AC_SUBST(STATICDIR) |
69792976 AK |
371 | AC_SUBST(INTL_PACKAGE) |
372 | AC_SUBST(INTL) | |
8106cdd5 | 373 | |
795ca3e5 AK |
374 | dnl First and last lines should not contain files to generate in order to |
375 | dnl keep utility scripts running properly | |
376 | AC_OUTPUT( \ | |
377 | Makefile \ | |
378 | make.tmpl \ | |
4a7f3eb2 | 379 | doc/Makefile \ |
fa42e649 | 380 | include/Makefile \ |
795ca3e5 | 381 | lib/Makefile \ |
5a52dca9 | 382 | lib/format1/Makefile \ |
d8ac0fbc | 383 | lib/format_pool/Makefile \ |
4922197a AK |
384 | lib/mirror/Makefile \ |
385 | lib/snapshot/Makefile \ | |
795ca3e5 | 386 | man/Makefile \ |
69792976 | 387 | po/Makefile \ |
795ca3e5 | 388 | tools/Makefile \ |
fae0c576 | 389 | tools/version.h \ |
e6efb2b0 | 390 | test/mm/Makefile \ |
43b7b8cf | 391 | test/device/Makefile \ |
e0304b58 | 392 | test/format1/Makefile \ |
d1b28647 | 393 | test/regex/Makefile \ |
291ec3b6 | 394 | test/filters/Makefile \ |
795ca3e5 | 395 | ) |
2dc95e1c AK |
396 | |
397 | if test x$ODIRECT != xyes; then | |
398 | echo | |
399 | echo Warning: O_DIRECT disabled. | |
400 | echo Use of pvmove may cause machine to lock up under low memory conditions. | |
401 | echo | |
402 | fi |