OSDN Git Service

Updates for parted-1.8.0rc3
[android-x86/external-parted.git] / configure.ac
1 dnl GNU Parted - a library and front end for manipulation hard disk partitions
2 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005
3 dnl                     Free Software Foundation, Inc.
4 dnl
5 dnl This file may be modified and/or distributed without restriction.
6
7 AC_PREREQ(2.50)
8
9 AC_INIT(include/parted/parted.h)
10
11 dnl Versioning
12 dnl Shamelessly pulled straight from glib's configure.in ...
13 dnl Making releases:
14 dnl    PED_MICRO_VERSION += 1;
15 dnl    PED_INTERFACE_AGE += 1;
16 dnl    PED_BINARY_AGE += 1;
17 dnl if any functions have been added, set PED_INTERFACE_AGE to 0.
18 dnl if backwards compatibility has been broken (eg. functions removed,
19 dnl function signatures changed),
20 dnl set PED_BINARY_AGE _and_ PED_INTERFACE_AGE to 0.
21 PED_MAJOR_VERSION=1
22 PED_MINOR_VERSION=8
23 PED_MICRO_VERSION=0
24 PED_INTERFACE_AGE=0
25 PED_BINARY_AGE=0
26 PED_VERSION_SUFFIX=rc3
27 PED_VERSION=$PED_MAJOR_VERSION.$PED_MINOR_VERSION.$PED_MICRO_VERSION$PED_VERSION_SUFFIX
28
29 LT_RELEASE=$PED_MAJOR_VERSION.$PED_MINOR_VERSION
30 LT_CURRENT=`expr $PED_MICRO_VERSION - $PED_INTERFACE_AGE`
31 LT_REVISION=$PED_INTERFACE_AGE
32 LT_AGE=`expr $PED_BINARY_AGE - $PED_INTERFACE_AGE`
33
34 AC_SUBST(LT_RELEASE)
35 AC_SUBST(LT_CURRENT)
36 AC_SUBST(LT_REVISION)
37 AC_SUBST(LT_AGE)
38
39 PACKAGE=parted
40 VERSION=$PED_VERSION
41
42 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
43  
44 AM_CONFIG_HEADER(config.h)
45
46 AC_CANONICAL_HOST
47 case "$host_os" in
48         linux*) OS=linux ;;
49         gnu*)   OS=gnu ;;
50         beos*)  OS=beos ;;
51         *)      AC_MSG_ERROR([Unknown or unsupported OS "$host_os".  Only "linux", "gnu" and "beos" are supported in this version of GNU Parted.]) ;;
52 esac
53 AC_SUBST(OS)
54
55 dnl Command-line options
56 AC_ARG_WITH(readline,
57         [  --with-readline         support fancy command line editing], ,
58         with_readline=yes
59 )
60
61 AC_ARG_ENABLE(mtrace,
62         [  --enable-mtrace         enable malloc() debugging], ,
63         enable_mtrace=no
64 )
65 if test "$enable_mtrace" = yes; then
66         AC_DEFINE(ENABLE_MTRACE, 1, [Mtrace malloc() debugging])
67 fi
68
69 AC_ARG_ENABLE(device-mapper,
70         [  --enable-device-mapper  enable device mapper support [default=no]], ,
71         enable_device_mapper=no
72 )
73 if test "$enable_device_mapper" = yes; then
74         AC_DEFINE(ENABLE_DEVICE_MAPPER, 1, [device mapper (libdevmapper) support])
75 fi
76
77 AC_ARG_ENABLE(discover-only,
78         [  --enable-discover-only  support only reading/probing [default=no]], ,
79         enable_discover_only=no
80 )
81 if test "$enable_discover_only" = yes; then
82         AC_DEFINE(DISCOVER_ONLY, 1, [Probing functionality only])
83 fi
84
85 PARTED_LIBS=""
86 AC_ARG_ENABLE(dynamic-loading,
87 [  --enable-dynamic-loading  support dynamic fs libraries [default=yes]], ,
88         if test "$enable_discover_only" = yes; then
89                 enable_dynamic_loading=no
90         else
91                 enable_dynamic_loading=yes
92         fi
93 )
94 if test "$enable_discover_only" = yes -a "$enable_dynamic_loading" = yes; then
95         AC_MSG_ERROR(
96 [You can't use --enable-dynamic-loading and --disable-discover-only together]
97         )
98 fi
99
100 AC_ARG_ENABLE(fs,
101         [  --enable-fs             include filesystem support [default=yes]], ,
102         enable_fs=yes
103 )
104 if test "$enable_fs" = yes; then
105         AC_DEFINE(ENABLE_FS, 1,
106                   [Include file system support.  i.e. libparted/fs_...])
107 fi
108
109 AC_ARG_ENABLE(debug,
110         [  --enable-debug          compile in assertions [default=yes]], ,
111         enable_debug=yes
112 )
113
114 if test "$enable_debug" = yes; then
115         AC_DEFINE(DEBUG, 1, [Enable assertions, etc.])
116 fi
117
118 AC_ARG_ENABLE(read-only,
119         [  --enable-read-only      disable writing (for debugging) [default=no]]
120         , ,
121         enable_read_only=no
122 )
123 if test "$enable_read_only" = yes; then
124         AC_DEFINE(READ_ONLY, 1, [Disable all writing code])
125 fi
126
127 PARTEDLDFLAGS=
128 AC_SUBST(PARTEDLDFLAGS)
129
130 AC_ARG_ENABLE(pc98,
131         [  --enable-pc98          build with pc98 support [default=yes]], ,
132         enable_pc98=yes
133 )
134 if test "$enable_pc98" = yes; then
135         AC_DEFINE(ENABLE_PC98, 1,
136                   [Include PC98 partition tables.  (Sometimes excluded to avoid
137                    collisions with msdos partition tables])
138 fi
139
140 AC_ARG_ENABLE(Werror,
141         [  --enable-Werror         build with gcc -Werror [default=yes]], ,
142         enable_Werror=yes
143 )
144
145 AC_ARG_ENABLE(hfs-extract-fs,
146         [  --enable-hfs-extract-fs Extract special HFS files for debugging [default=no]], ,
147         enable_hfs_extract_fs=no
148 )
149 if test "$enable_hfs_extract_fs" = yes; then
150        AC_DEFINE(HFS_EXTRACT_FS, 1,
151                  [Extract low level special HFS(+) files for debugging purposes
152                   when using the "check" command (NOT FOR PACKAGING)])
153 fi
154
155 dnl make libc threadsafe (not required for us, but useful other users of
156 dnl libparted)
157 CFLAGS="$CFLAGS -D_REENTRANT"
158
159 dnl Check for programs.
160 AC_ISC_POSIX
161 AC_PROG_CC
162 AC_PROG_GCC_TRADITIONAL
163
164 dnl This test must come as early as possible after the compiler configuration
165 dnl tests, because the choice of the file model can (in principle) affect
166 dnl whether functions and headers are available, whether they work, etc.
167 AC_SYS_LARGEFILE
168
169 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=${ac_cv_sys_file_offset_bits}"
170 AC_CHECK_SIZEOF(off_t, 64, [
171         #include <stdio.h>
172         #include <sys/types.h>
173         #include <unistd.h>
174 ])
175
176 AM_ENABLE_SHARED
177 if test "$OS" = linux -a $ac_cv_sizeof_off_t -lt 8; then
178         dnl Need to disable shared libraries, to get llseek() to work.  Long
179         dnl story.  The short story is: lseek() isn't in glibc, so a syscall
180         dnl must be made.  syscalls can't be made from within shared libraries,
181         dnl because of a bug (?) in gcc.
182         AC_MSG_WARN(
183 off_t is less than 8 bytes.  Using llseek syscall, and disabling shared
184 libraries.)
185         AM_DISABLE_SHARED
186 fi
187 AM_PROG_LIBTOOL
188
189 dnl Initialize i18n:
190 ALL_LINGUAS="ca cs da de es fr gl id it ja nl nn hu pl pt pt_BR ru sv tr uk vi zh_CN zh_TW"
191 AM_GNU_GETTEXT_VERSION([0.12.1])
192 AM_GNU_GETTEXT([external])
193 CFLAGS="$CFLAGS -DLOCALEDIR=\"\\\"$datadir/locale\\\"\""
194 if test "$USE_INCLUDED_LIBINTL" = "yes"; then
195         AC_MSG_ERROR(
196 GNU Parted requires gettext to be installed for compilation -
197 if native language support is desired.  Either disable native language support
198 with:
199         $ ./configure --disable-nls
200 Or install gettext.  GNU gettext is available from
201         http://ftp.gnu.org/gnu/gettext
202 )
203         exit
204 fi
205 CFLAGS="$CFLAGS -DLOCALEDIR=\"\\\"$datadir/locale\\\"\""
206
207 dnl Check for libdl, if we are doing dynamic loading
208 DL_LIBS=""
209 if test "$enable_dynamic_loading" = yes; then
210         AC_CHECK_LIB(dl, dlopen,
211                 DL_LIBS="-ldl"
212                 PARTED_LIBS="$PARTED_LIBS -ldl"
213                 AC_DEFINE(DYNAMIC_LOADING, 1, [Lazy linking to fs libs]),
214                 AC_MSG_ERROR(
215                         [-ldl not found!  Try using --disable-dynamic-loading]
216                 )
217                 exit
218         )
219 fi
220 AC_SUBST(DL_LIBS)
221
222 dnl Check for libuuid
223 UUID_LIBS=""
224 AC_CHECK_LIB(uuid, uuid_generate, UUID_LIBS="-luuid",
225         AC_MSG_ERROR(
226 GNU Parted requires libuuid - a part of the e2fsprogs package (but
227 sometimes distributed separately in uuid-devel or similar)
228 This can probably be found on your distribution's CD or FTP site or at:
229          http://web.mit.edu/tytso/www/linux/e2fsprogs.html
230 Note: if you are using precompiled packages you will also need the development
231 package as well (which may be called e2fsprogs-devel or something similar).
232 If you compile e2fsprogs yourself then you need to do 'make install' and
233 'make install-libs'.
234         )
235         exit
236 )
237 AC_SUBST(UUID_LIBS)
238
239 dnl Check for libdevmapper
240 DM_LIBS=""
241 if test "$enable_device_mapper" = yes; then
242         AC_CHECK_LIB(devmapper, dm_task_create,
243                 DM_LIBS="-ldevmapper -lselinux -lsepol",
244                 AC_MSG_ERROR(
245                         [libdevmapper not found!  Try using --disable-device-mapper]
246                 )
247                 exit
248         )
249 fi
250 AC_SUBST(DM_LIBS)
251
252 dnl Check for libreiserfs
253 REISER_LIBS=""
254 if test "$enable_dynamic_loading" = no -a "$enable_discover_only" = no; then
255         OLD_LIBS="$LIBS"
256         AC_CHECK_LIB(dal, dal_equals,
257                 LIBS="-ldal"
258                 AC_CHECK_LIB(reiserfs, reiserfs_fs_probe,
259                         REISER_LIBS="-ldal -lreiserfs"
260                         AC_DEFINE(HAVE_LIBREISERFS, 1, [Have libreiserfs])
261                 )
262                 AC_CHECK_LIB(reiserfs, reiserfs_fs_check,
263                         AC_DEFINE(HAVE_REISERFS_FS_CHECK, 1, [Have reiserfs_fs_check()])
264                 )
265         )
266         LIBS="$OLD_LIBS"
267 fi
268 AC_SUBST(REISER_LIBS)
269
270 dnl Check for termcap
271 if test "$with_readline" = yes; then
272         OLD_LIBS="$LIBS"
273         LIBS=""
274         AC_SEARCH_LIBS(tgetent, ncurses curses termcap termlib,
275                 PARTED_LIBS="$PARTED_LIBS $LIBS",
276                 AC_MSG_ERROR(
277 termcap could not be found which is required for the
278 --with-readline option (which is enabled by default).  Either disable readline
279 support with --without-readline or download and install termcap from:
280         ftp.gnu.org/gnu/termcap
281 Note: if you are using precompiled packages you will also need the development
282   package as well (which may be called termcap-devel or something similar).
283 Note: (n)curses also seems to work as a substitute for termcap.  This was
284   not found either - but you could try installing that as well.
285 )
286         exit
287         )
288         LIBS="$OLD_LIBS"
289 fi
290
291 dnl Check for readline
292 if test "$with_readline" = yes; then
293         OLD_LIBS="$LIBS"
294         LIBS="$LIBS $PARTED_LIBS"
295         AC_CHECK_LIB(readline, readline,
296                 PARTED_LIBS="-lreadline $PARTED_LIBS"
297                 AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline]),
298                 AC_MSG_ERROR(
299 GNU Readline could not be found which is required for the
300 --with-readline (which is enabled by default).  Either disable readline support with
301 --without-readline or downloaded and install it from:
302         ftp.gnu.org/gnu/readline
303 Note: if you are using precompiled packages you will also need the development
304 package as well (which may be called readline-devel or something similar).
305 )
306                 exit,
307                 $PARTED_LIBS
308         )
309         LIBS="$OLD_LIBS"
310 fi
311
312 AC_SUBST(PARTED_LIBS)
313
314 dnl Check for OS specific libraries
315
316 dnl GNU/Hurd:
317 if test "$OS" = gnu; then
318         CFLAGS="$CFLAGS -D_GNU_SOURCE=1"
319
320 dnl libshouldbeinlibc
321         AC_CHECK_LIB(shouldbeinlibc, vm_deallocate,
322                 OS_LIBS="$OS_LIBS -lshouldbeinlibc",
323                 AC_MSG_ERROR(
324 GNU Parted requires libshouldbeinlibc when running on
325 GNU/Hurd systems.  It is a standard part of a GNU/Hurd system.
326                 )
327                 exit
328         )
329
330 dnl libstore may depend on libparted being present.
331 dnl Aren't circular dependencies wonderful?
332         OLD_LIBS="$LIBS"
333         LIBS=
334
335         AC_CHECK_LIB(parted, ped_device_read)
336
337 dnl libstore
338         AC_CHECK_LIB(store, store_open,
339                 OS_LIBS="$OS_LIBS -lstore",
340                 AC_MSG_ERROR(
341 GNU Parted requires libstore when running on GNU/Hurd
342 systems.  It is a standard part of a GNU/Hurd system.
343                 )
344                 exit,
345                 $OS_LIBS $UUID_LIBS $DM_LIBS $LIBS
346         )
347         LIBS="$OLD_LIBS"
348 fi
349
350 dnl BeOS/ZETA/Haiku:
351
352 if test "$OS" = beos; then
353         dnl Include the socket library, as it is a depedency of libuuid
354         dnl and so also of us (due to socket() call in libuuid)
355         OS_LIBS="$OS_LIBS -lsocket"
356 fi      
357
358 AC_SUBST(OS_LIBS)
359
360 dnl One day, gettext might support libtool...
361 dnl if test "$USE_INCLUDED_LIBINTL" = "yes"; then
362 dnl     INTLINCS='-I$(top_srcdir)/intl'
363 dnl fi
364 AC_SUBST(INTLINCS)
365
366
367 dnl Checks for header files.
368 AC_CHECK_HEADER(uuid/uuid.h, ,
369         AC_MSG_ERROR(
370 GNU Parted requires libuuid - a part of the e2fsprogs package.
371 You seem to have the library installed but not the headers.  These are usually
372 found in a corresponding development package (usually called e2fsprogs-devel).
373 If you can't find one try:
374         http://web.mit.edu/tytso/www/linux/e2fsprogs.html
375 )
376         exit
377 )
378
379 AC_CHECK_HEADERS(getopt.h) 
380
381 dnl required for libparted/llseek.c  (TODO: make linux-x86 only)
382 if test "$OS" = linux; then
383         AC_CHECK_HEADER(linux/unistd.h)
384 fi
385
386 if test "$with_readline" = yes; then
387         AC_CHECK_HEADERS(readline/readline.h readline/history.h, ,
388                 AC_MSG_ERROR(
389 The headers for GNU Readline could not be found which
390 are required for the --with-readline option.  You seem to have the GNU readline
391 library installed but not the headers.  These are usually found in a
392 corresponding development package (usually called readline-devel).  If you can't
393 find one try:
394         ftp.gnu.org/gnu/readline
395 Alternatively you can disable readline support with --without-readline
396 )
397         exit
398         )
399 fi
400
401 AC_CHECK_HEADERS(termcap.h)
402
403 if test "$USE_NLS" = yes; then
404         AC_CHECK_HEADERS(wctype.h, ,
405                 AC_MSG_ERROR(
406 One or more of the header files that are required for
407 native language support (wctype.h) could not be found.  Either get a newer
408 version of GNU libc and its headers - which can be obtained from:
409         ftp.gnu.org/gnu/glibc
410 Or disable native language support with the --disable-nls option
411 )
412         exit
413         )
414 fi
415
416 dnl Checks for typedefs, structures and compiler characteristics.
417 AC_PROG_LD
418
419 AC_C_BIGENDIAN
420 AC_C_INLINE
421 AC_C_CONST
422 AC_C_RESTRICT
423
424
425 dnl Checks for library functions.
426 AC_CHECK_FUNCS(sigaction)
427 AC_CHECK_FUNCS(getuid)
428
429 if test "$with_readline" = yes; then
430         OLD_LIBS="$LIBS"
431         LIBS="$LIBS $PARTED_LIBS -lreadline"
432         AC_CHECK_FUNCS(rl_completion_matches)
433         LIBS="$OLD_LIBS"
434 fi
435
436 OLD_CFLAGS="$CFLAGS"
437 CFLAGS=-D_GNU_SOURCE=1
438 AC_CHECK_FUNCS(canonicalize_file_name)
439 CFLAGS="$OLD_CFLAGS"
440
441 CFLAGS="$CFLAGS -W -Wall -Wno-unused -Wno-switch -Wno-format"
442
443 if test "$enable_Werror" = yes; then
444         CFLAGS="$CFLAGS -Werror"
445 fi
446
447 DATE=$(date '+%d %b %Y %H:%M')
448 USER=$(whoami)
449 HOST=$(hostname)
450 BUILDINFO="$USER@$HOST, $DATE"
451 AC_SUBST(BUILDINFO)
452
453 AC_OUTPUT([
454 Makefile
455 include/Makefile
456 include/parted/Makefile
457 libparted/Makefile
458 libparted/labels/Makefile
459 libparted/fs/Makefile
460 libparted/fs/amiga/Makefile
461 libparted/fs/ext2/Makefile
462 libparted/fs/fat/Makefile
463 libparted/fs/hfs/Makefile
464 libparted/fs/jfs/Makefile
465 libparted/fs/linux_swap/Makefile
466 libparted/fs/ntfs/Makefile
467 libparted/fs/reiserfs/Makefile
468 libparted/fs/ufs/Makefile
469 libparted/fs/xfs/Makefile
470 parted/Makefile
471 partprobe/Makefile
472 doc/Makefile
473 doc/C/Makefile
474 doc/pt_BR/Makefile
475 debug/Makefile
476 debug/clearfat/Makefile
477 debug/test/Makefile
478 po/Makefile.in
479 parted.spec
480 ])
481
482 echo
483 echo Type \'make\' to compile parted.