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