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