]>
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 | ||
77 | dnl -- setup the ownership of the files | |
78 | AC_ARG_WITH(user, | |
79 | [ --with-user=USER Set the owner of installed files ], | |
80 | [ OWNER="$withval" ], | |
81 | [ OWNER="root" ]) | |
82 | ||
83 | dnl -- setup the group ownership of the files | |
84 | AC_ARG_WITH(group, | |
85 | [ --with-group=GROUP Set the group owner of installed files ], | |
86 | [ GROUP="$withval" ], | |
87 | [ GROUP="root" ]) | |
88 | ||
7d1552c9 AK |
89 | dnl -- LVM1 tool fallback option |
90 | AC_ARG_ENABLE(lvm1_fallback, [ --enable-lvm1_fallback Use this to fall back and use LVM1 binaries if | |
91 | device-mapper is missing from the kernel], LVM1_FALLBACK=$enableval, LVM1_FALLBACK=no) | |
92 | ||
93 | if test x$LVM1_FALLBACK = xyes; then | |
94 | CFLAGS="$CFLAGS -DLVM1_FALLBACK" | |
95 | fi | |
96 | ||
5a52dca9 AK |
97 | dnl -- format1 inclusion type |
98 | AC_ARG_WITH(lvm1, | |
99 | [ --with-lvm1=TYPE LVM1 metadata support: internal/shared/none | |
100 | [TYPE=internal] ], | |
101 | [ LVM1="$withval" ], | |
102 | [ LVM1="internal" ]) | |
103 | ||
104 | if [[ "x$LVM1" != xnone -a "x$LVM1" != xinternal -a "x$LVM1" != xshared ]]; | |
105 | then AC_MSG_ERROR( | |
106 | --with-lvm1 parameter invalid | |
107 | ) | |
108 | exit | |
109 | fi; | |
110 | ||
b896caa1 AK |
111 | if test x$LVM1 = xinternal; then |
112 | CFLAGS="$CFLAGS -DLVM1_INTERNAL" | |
113 | fi | |
114 | ||
8ef2b021 | 115 | AC_ARG_ENABLE(jobs, [ --enable-jobs=NUM Number of jobs to run simultaneously], JOBS=-j$enableval, JOBS=-j2) |
795ca3e5 | 116 | |
8106cdd5 AK |
117 | dnl Enables staticly-linked tools |
118 | AC_ARG_ENABLE(static_link, [ --enable-static_link Use this to link the tools to their libraries | |
795ca3e5 AK |
119 | statically. Default is dynamic linking], STATIC_LINK=$enableval, STATIC_LINK=no) |
120 | ||
5a52dca9 AK |
121 | dnl Enable readline |
122 | AC_ARG_ENABLE(readline, [ --enable-readline Enable readline support], \ | |
123 | READLINE=$enableval, READLINE=no) | |
795ca3e5 | 124 | |
b896caa1 AK |
125 | if test x$READLINE = xyes; then |
126 | CFLAGS="$CFLAGS -DREADLINE_SUPPORT" | |
127 | fi | |
128 | ||
69792976 | 129 | echo $ac_n "checking whether to enable debugging""... $ac_c" 1>&6 |
8ef2b021 AK |
130 | dnl Enable Debugging |
131 | AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging], \ | |
132 | DEBUG=yes, DEBUG=no) | |
69792976 | 133 | echo "$ac_t""$DEBUG" 1>&6 |
8ef2b021 | 134 | |
69792976 | 135 | echo $ac_n "checking whether to enable device-mapper""... $ac_c" 1>&6 |
199e490e AK |
136 | dnl Disable devmapper |
137 | AC_ARG_ENABLE(devmapper, [ --disable-devmapper Disable device-mapper interaction], \ | |
8106cdd5 | 138 | DEVMAPPER=no) |
69792976 | 139 | echo "$ac_t""$DEVMAPPER" 1>&6 |
199e490e | 140 | |
b896caa1 AK |
141 | if test x$DEVMAPPER = xyes; then |
142 | CFLAGS="$CFLAGS -DDEVMAPPER_SUPPORT" | |
143 | fi | |
144 | ||
69792976 | 145 | echo $ac_n "checking whether to enable O_DIRECT""... $ac_c" 1>&6 |
2dc95e1c AK |
146 | dnl Disable O_DIRECT |
147 | AC_ARG_ENABLE(o_direct, [ --disable-o_direct Disable O_DIRECT], \ | |
8106cdd5 | 148 | ODIRECT=no) |
69792976 | 149 | echo "$ac_t""$ODIRECT" 1>&6 |
2dc95e1c AK |
150 | |
151 | if test x$ODIRECT = xyes; then | |
152 | CFLAGS="$CFLAGS -DO_DIRECT_SUPPORT" | |
153 | fi | |
154 | ||
8106cdd5 AK |
155 | echo $ac_n "checking whether to compile liblvm2cmd.so""... $ac_c" 1>&6 |
156 | dnl Enable cmdlib | |
157 | AC_ARG_ENABLE(cmdlib, [ --enable-cmdlib Build shared command library], \ | |
158 | CMDLIB=yes, CMDLIB=no) | |
159 | echo "$ac_t""$CMDLIB" 1>&6 | |
160 | ||
161 | if test x$CMDLIB = xyes; then | |
162 | CFLAGS="$CFLAGS -DCMDLIB" | |
163 | fi | |
164 | ||
795ca3e5 AK |
165 | dnl Mess with default exec_prefix |
166 | if [[ "x$exec_prefix" = xNONE -a "x$prefix" = xNONE ]]; | |
167 | then exec_prefix=""; | |
168 | fi; | |
169 | ||
170 | dnl Checks for library functions. | |
171 | AC_PROG_GCC_TRADITIONAL | |
172 | AC_TYPE_SIGNAL | |
173 | AC_FUNC_VPRINTF | |
174 | AC_CHECK_FUNCS(mkdir rmdir uname) | |
175 | ||
176 | dnl check for termcap (Shamelessly copied from parted 1.4.17) | |
177 | if test x$READLINE = xyes; then | |
178 | AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib, , | |
179 | AC_MSG_ERROR( | |
180 | termcap could not be found which is required for the | |
181 | --enable-readline option (which is enabled by default). Either disable readline | |
182 | support with --disable-readline or download and install termcap from: | |
183 | ftp.gnu.org/gnu/termcap | |
184 | Note: if you are using precompiled packages you will also need the development | |
185 | package as well (which may be called termcap-devel or something similar). | |
186 | Note: (n)curses also seems to work as a substitute for termcap. This was | |
187 | not found either - but you could try installing that as well. | |
188 | ) | |
189 | exit | |
190 | ) | |
191 | fi | |
192 | ||
26e7f2e0 AK |
193 | dnl Check for dlopen |
194 | AC_CHECK_LIB(dl, dlopen, HAVE_LIBDL=yes, HAVE_LIBDL=no) | |
195 | ||
d68a82ec | 196 | if [[ "x$HAVE_LIBDL" = xyes -a "xSTATIC_LINK" = xno ]]; then |
b896caa1 | 197 | CFLAGS="$CFLAGS -DHAVE_LIBDL" |
26e7f2e0 | 198 | LIBS="-ldl $LIBS" |
d68a82ec AK |
199 | else |
200 | HAVE_LIBDL=no | |
26e7f2e0 AK |
201 | fi |
202 | ||
d68a82ec AK |
203 | dnl Check for shared/static conflicts |
204 | if [[ "x$LVM1" = xshared -a "x$STATIC_LINK" = xyes ]]; | |
205 | then AC_MSG_ERROR( | |
036f273a | 206 | Features cannot be 'shared' when building statically |
d68a82ec AK |
207 | ) |
208 | exit | |
036f273a AK |
209 | fi |
210 | ||
211 | dnl Check for is_selinux_enabled | |
212 | AC_CHECK_LIB(selinux, is_selinux_enabled, HAVE_SELINUX=yes, HAVE_SELINUX=no) | |
213 | ||
214 | if test x$HAVE_SELINUX = xyes; then | |
215 | CFLAGS="$CFLAGS -DHAVE_SELINUX" | |
216 | LIBS="-lselinux $LIBS" | |
217 | fi | |
d68a82ec | 218 | |
b896caa1 AK |
219 | dnl Check for getopt |
220 | AC_CHECK_HEADERS(getopt.h, CFLAGS="$CFLAGS -DHAVE_GETOPTLONG") | |
221 | ||
795ca3e5 AK |
222 | dnl Check for readline (Shamelessly copied from parted 1.4.17) |
223 | if test x$READLINE = xyes; then | |
224 | AC_CHECK_LIB(readline, readline, , | |
225 | AC_MSG_ERROR( | |
226 | GNU Readline could not be found which is required for the | |
227 | --enable-readline option (which is enabled by default). Either disable readline | |
228 | support with --disable-readline or download and install readline from: | |
229 | ftp.gnu.org/gnu/readline | |
230 | Note: if you are using precompiled packages you will also need the development | |
231 | package as well (which may be called readline-devel or something similar). | |
232 | ) | |
233 | exit | |
234 | ) | |
b896caa1 AK |
235 | AC_CHECK_FUNC(rl_completion_matches, CFLAGS="$CFLAGS -DHAVE_RL_COMPLETION_MATCHES") |
236 | ||
795ca3e5 AK |
237 | fi |
238 | ||
69792976 AK |
239 | echo $ac_n "checking whether to enable internationalisation""... $ac_c" 1>&6 |
240 | dnl Internationalisation stuff | |
241 | AC_ARG_ENABLE(nls, [ --enable-nls Enable Native Language Support],\ | |
242 | INTL=yes, INTL=no) | |
243 | echo "$ac_t""$INTL" 1>&6 | |
244 | ||
245 | if test x$INTL = xyes; then | |
246 | INTL_PACKAGE="lvm2" | |
247 | AC_PATH_PROG(MSGFMT, msgfmt) | |
248 | if [[ "x$MSGFMT" == x ]]; | |
249 | then AC_MSG_ERROR( | |
250 | msgfmt not found in path $PATH | |
251 | ) | |
252 | exit | |
253 | fi; | |
254 | ||
255 | AC_ARG_WITH(localedir, | |
256 | [ --with-localedir=DIR Translation files in DIR [PREFIX/share/locale]], | |
257 | [ LOCALEDIR="$withval" ], | |
258 | [ LOCALEDIR='${prefix}/share/locale' ]) | |
259 | fi | |
260 | ||
4a7f3eb2 | 261 | AC_ARG_WITH(confdir, |
0a62c911 | 262 | [ --with-confdir=DIR Configuration files in DIR [/etc]], |
4a7f3eb2 | 263 | [ CONFDIR="$withval" ], |
0a62c911 AK |
264 | [ CONFDIR='/etc' ]) |
265 | ||
266 | AC_ARG_WITH(staticdir, | |
267 | [ --with-staticdir=DIR Static binary in DIR [EXEC_PREFIX/sbin]], | |
268 | [ STATICDIR="$withval" ], | |
269 | [ STATICDIR='${exec_prefix}/sbin' ]) | |
270 | ||
4a7f3eb2 | 271 | |
fae0c576 AK |
272 | if test "-f VERSION"; then |
273 | LVM_VERSION="\"`cat VERSION`\"" | |
274 | else | |
275 | LVM_VERSION="Unknown" | |
276 | fi | |
277 | ||
795ca3e5 AK |
278 | AC_SUBST(JOBS) |
279 | AC_SUBST(STATIC_LINK) | |
5a52dca9 | 280 | AC_SUBST(LVM1) |
795ca3e5 AK |
281 | AC_SUBST(OWNER) |
282 | AC_SUBST(GROUP) | |
b896caa1 | 283 | AC_SUBST(CFLAGS) |
8106cdd5 AK |
284 | AC_SUBST(CLDFLAGS) |
285 | AC_SUBST(CLDWHOLEARCHIVE) | |
286 | AC_SUBST(CLDNOWHOLEARCHIVE) | |
287 | AC_SUBST(LD_DEPS) | |
d68a82ec | 288 | AC_SUBST(LD_FLAGS) |
8106cdd5 | 289 | AC_SUBST(SOFLAG) |
5f68d858 | 290 | AC_SUBST(LIBS) |
fae0c576 | 291 | AC_SUBST(LVM_VERSION) |
7d1552c9 | 292 | AC_SUBST(LVM1_FALLBACK) |
8ef2b021 | 293 | AC_SUBST(DEBUG) |
199e490e | 294 | AC_SUBST(DEVMAPPER) |
26e7f2e0 | 295 | AC_SUBST(HAVE_LIBDL) |
036f273a | 296 | AC_SUBST(HAVE_SELINUX) |
8106cdd5 | 297 | AC_SUBST(CMDLIB) |
69792976 AK |
298 | AC_SUBST(MSGFMT) |
299 | AC_SUBST(LOCALEDIR) | |
4a7f3eb2 | 300 | AC_SUBST(CONFDIR) |
0a62c911 | 301 | AC_SUBST(STATICDIR) |
69792976 AK |
302 | AC_SUBST(INTL_PACKAGE) |
303 | AC_SUBST(INTL) | |
8106cdd5 | 304 | |
795ca3e5 AK |
305 | dnl First and last lines should not contain files to generate in order to |
306 | dnl keep utility scripts running properly | |
307 | AC_OUTPUT( \ | |
308 | Makefile \ | |
309 | make.tmpl \ | |
4a7f3eb2 | 310 | doc/Makefile \ |
fa42e649 | 311 | include/Makefile \ |
795ca3e5 | 312 | lib/Makefile \ |
5a52dca9 | 313 | lib/format1/Makefile \ |
795ca3e5 | 314 | man/Makefile \ |
69792976 | 315 | po/Makefile \ |
795ca3e5 | 316 | tools/Makefile \ |
fae0c576 | 317 | tools/version.h \ |
e6efb2b0 | 318 | test/mm/Makefile \ |
43b7b8cf | 319 | test/device/Makefile \ |
e0304b58 | 320 | test/format1/Makefile \ |
d1b28647 | 321 | test/regex/Makefile \ |
291ec3b6 | 322 | test/filters/Makefile \ |
795ca3e5 | 323 | ) |
2dc95e1c AK |
324 | |
325 | if test x$ODIRECT != xyes; then | |
326 | echo | |
327 | echo Warning: O_DIRECT disabled. | |
328 | echo Use of pvmove may cause machine to lock up under low memory conditions. | |
329 | echo | |
330 | fi |