1 dnl GNU Parted - a library and front end for manipulation hard disk partitions
2 dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2007
3 dnl Free Software Foundation, Inc.
5 dnl This file may be modified and/or distributed without restriction.
8 AC_INIT([GNU parted], m4_esyscmd([build-aux/git-version-gen .version]),
11 # When the most recent signed tag is v1.8.8.1,
12 # the above might set e.g., PACKAGE_VERSION='1.8.8.1.1-0bfc'
14 AC_CONFIG_SRCDIR(include/parted/parted.h)
16 AC_CONFIG_HEADERS([lib/config.h:lib/config.h.in])
17 AC_CONFIG_AUX_DIR(build-aux)
20 dnl Shamelessly pulled straight from glib's configure.in ...
22 dnl PED_MICRO_VERSION += 1;
23 dnl PED_INTERFACE_AGE += 1;
24 dnl PED_BINARY_AGE += 1;
25 dnl if any functions have been added, set PED_INTERFACE_AGE to 0.
26 dnl if backwards compatibility has been broken (eg. functions removed,
27 dnl function signatures changed),
28 dnl set PED_BINARY_AGE _and_ PED_INTERFACE_AGE to 0.
30 # Derive these numbers from $PACKAGE_VERSION, which is set
31 # when autoconf creates configure (see AC_INIT, above).
32 PED_MAJOR_VERSION=`echo "$PACKAGE_VERSION"|sed 's/\..*//'`
33 PED_MINOR_VERSION=`echo "$PACKAGE_VERSION"|sed 's/^[0-9][0-9]*\.//;s/\..*//'`
34 case $PACKAGE_VERSION in
36 PED_MICRO_VERSION=`echo "$PACKAGE_VERSION" \
37 | sed 's/^[^.]*\.[^.]*\.//;s/\..*//'`
39 *) PED_MICRO_VERSION=0;;
45 PED_VERSION=$PED_MAJOR_VERSION.$PED_MINOR_VERSION.$PED_MICRO_VERSION$PED_VERSION_SUFFIX
47 LT_RELEASE=$PED_MAJOR_VERSION.$PED_MINOR_VERSION
48 LT_CURRENT=`expr $PED_MICRO_VERSION - $PED_INTERFACE_AGE`
49 LT_REVISION=$PED_INTERFACE_AGE
50 LT_AGE=`expr $PED_BINARY_AGE - $PED_INTERFACE_AGE`
56 AM_INIT_AUTOMAKE([1.10 dist-bzip2])
63 *) AC_MSG_ERROR([Unknown or unsupported OS "$host_os". Only "linux", "gnu" and "beos" are supported in this version of GNU Parted.]) ;;
67 dnl Command-line options
69 [ --with-readline support fancy command line editing], ,
74 [ --enable-mtrace enable malloc() debugging], ,
77 if test "$enable_mtrace" = yes; then
78 AC_DEFINE(ENABLE_MTRACE, 1, [Mtrace malloc() debugging])
81 AC_ARG_ENABLE(device-mapper,
82 [ --enable-device-mapper enable device mapper support [default=no]], ,
83 enable_device_mapper=no
85 if test "$enable_device_mapper" = yes; then
86 AC_DEFINE(ENABLE_DEVICE_MAPPER, 1, [device mapper (libdevmapper) support])
89 AC_ARG_ENABLE(selinux,
90 [ --enable-selinux enable SELinux support [default=no]], ,
94 AC_ARG_ENABLE(discover-only,
95 [ --enable-discover-only support only reading/probing [default=no]], ,
96 enable_discover_only=no
98 if test "$enable_discover_only" = yes; then
99 AC_DEFINE(DISCOVER_ONLY, 1, [Probing functionality only])
103 AC_ARG_ENABLE(dynamic-loading,
104 [ --enable-dynamic-loading support dynamic fs libraries [default=yes]], ,
105 if test "$enable_discover_only" = yes; then
106 enable_dynamic_loading=no
108 enable_dynamic_loading=yes
111 if test "$enable_discover_only" = yes -a "$enable_dynamic_loading" = yes; then
113 [You can't use --enable-dynamic-loading and --disable-discover-only together]
118 [ --enable-fs include filesystem support [default=yes]], ,
121 if test "$enable_fs" = yes; then
122 AC_DEFINE(ENABLE_FS, 1,
123 [Include file system support. i.e. libparted/fs_...])
127 [ --enable-debug compile in assertions [default=yes]], ,
131 if test "$enable_debug" = yes; then
132 AC_DEFINE(DEBUG, 1, [Enable assertions, etc.])
135 AC_ARG_ENABLE(read-only,
136 [ --enable-read-only disable writing (for debugging) [default=no]]
140 if test "$enable_read_only" = yes; then
141 AC_DEFINE(READ_ONLY, 1, [Disable all writing code])
145 AC_SUBST(PARTEDLDFLAGS)
148 [ --enable-pc98 build with pc98 support [default=yes]], ,
151 if test "$enable_pc98" = yes; then
152 AC_DEFINE(ENABLE_PC98, 1,
153 [Include PC98 partition tables. (Sometimes excluded to avoid
154 collisions with msdos partition tables])
157 AC_ARG_ENABLE(Werror,
158 [ --enable-Werror build with gcc -Werror [default=yes]], ,
162 AC_ARG_ENABLE(hfs-extract-fs,
163 [ --enable-hfs-extract-fs Extract special HFS files for debugging [default=no]], ,
164 enable_hfs_extract_fs=no
166 if test "$enable_hfs_extract_fs" = yes; then
167 AC_DEFINE(HFS_EXTRACT_FS, 1,
168 [Extract low level special HFS(+) files for debugging purposes
169 when using the "check" command (NOT FOR PACKAGING)])
172 dnl make libc threadsafe (not required for us, but useful other users of
174 AM_CPPFLAGS="$AM_CPPFLAGS -D_REENTRANT"
176 dnl Check for programs.
179 AC_PROG_GCC_TRADITIONAL
183 parted_FIND_USABLE_TEST_DIR
185 dnl This test must come as early as possible after the compiler configuration
186 dnl tests, because the choice of the file model can (in principle) affect
187 dnl whether functions and headers are available, whether they work, etc.
192 AC_CHECK_SIZEOF(off_t, 64, [
194 #include <sys/types.h>
199 if test "$OS" = linux -a $ac_cv_sizeof_off_t -lt 8; then
200 dnl Need to disable shared libraries, to get llseek() to work. Long
201 dnl story. The short story is: lseek() isn't in glibc, so a syscall
202 dnl must be made. syscalls can't be made from within shared libraries,
203 dnl because of a bug (?) in gcc.
205 off_t is less than 8 bytes. Using llseek syscall, and disabling shared
211 AM_GNU_GETTEXT_VERSION([0.15])
212 AM_GNU_GETTEXT([external])
213 if test "$USE_INCLUDED_LIBINTL" = "yes"; then
215 GNU Parted requires gettext to be installed for compilation -
216 if native language support is desired. Either disable native language support
218 $ ./configure --disable-nls
219 Or install gettext. GNU gettext is available from
220 http://ftp.gnu.org/gnu/gettext
225 dnl Check for libdl, if we are doing dynamic loading
227 if test "$enable_dynamic_loading" = yes; then
228 AC_CHECK_LIB(dl, dlopen,
230 PARTED_LIBS="$PARTED_LIBS -ldl"
231 AC_DEFINE(DYNAMIC_LOADING, 1, [Lazy linking to fs libs]),
233 [-ldl not found! Try using --disable-dynamic-loading]
240 dnl Check for libuuid
242 AC_CHECK_LIB(uuid, uuid_generate, UUID_LIBS="-luuid",
244 GNU Parted requires libuuid - a part of the e2fsprogs package (but
245 sometimes distributed separately in uuid-devel or similar)
246 This can probably be found on your distribution's CD or FTP site or at:
247 http://web.mit.edu/tytso/www/linux/e2fsprogs.html
248 Note: if you are using precompiled packages you will also need the development
249 package as well (which may be called e2fsprogs-devel or something similar).
250 If you compile e2fsprogs yourself then you need to do 'make install' and
257 dnl Check for libdevmapper
259 if test "$enable_device_mapper" = yes; then
260 AC_CHECK_LIB(devmapper, dm_task_create,
261 DM_LIBS="-ldevmapper",
263 [libdevmapper not found! Try using --disable-device-mapper]
270 dnl Check for SELinux
272 if test "$enable_selinux" = yes; then
273 SELINUX_LIBS="-lselinux -lsepol"
275 AC_SUBST(SELINUX_LIBS)
277 dnl Check for libreiserfs
279 if test "$enable_dynamic_loading" = no -a "$enable_discover_only" = no; then
281 AC_CHECK_LIB(dal, dal_equals,
283 AC_CHECK_LIB(reiserfs, reiserfs_fs_probe,
284 REISER_LIBS="-ldal -lreiserfs"
285 AC_DEFINE(HAVE_LIBREISERFS, 1, [Have libreiserfs])
287 AC_CHECK_LIB(reiserfs, reiserfs_fs_check,
288 AC_DEFINE(HAVE_REISERFS_FS_CHECK, 1, [Have reiserfs_fs_check()])
293 AC_SUBST(REISER_LIBS)
295 dnl Check for termcap
296 if test "$with_readline" = yes; then
299 AC_SEARCH_LIBS(tgetent, tinfo ncurses curses termcap termlib,
300 PARTED_LIBS="$PARTED_LIBS $LIBS",
302 termcap could not be found which is required for the
303 --with-readline option (which is enabled by default). Either disable readline
304 support with --without-readline or download and install termcap from:
305 ftp.gnu.org/gnu/termcap
306 Note: if you are using precompiled packages you will also need the development
307 package as well (which may be called termcap-devel or something similar).
308 Note: (n)curses also seems to work as a substitute for termcap. This was
309 not found either - but you could try installing that as well.
316 dnl Check for readline
317 dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
318 dnl detected one earlier. libreadline on some platforms (e.g., RHEL and
319 dnl Fedora) is left with
320 if test "$with_readline" = yes; then
322 LIBS="$LIBS $PARTED_LIBS"
323 found_working_libreadline=no
324 AC_CHECK_LIB(readline, readline,
325 found_working_libreadline=yes,
327 GNU Readline could not be found which is required for the
328 --with-readline (which is enabled by default). Either disable readline support with
329 --without-readline or downloaded and install it from:
330 ftp.gnu.org/gnu/readline
331 Note: if you are using precompiled packages you will also need the development
332 package as well (which may be called readline-devel or something similar).
337 LIBS="$OLD_LIBS $PARTED_LIBS"
339 # See if libreadline is too old to be used.
340 # The readline function in Debian's libreadline5 5.0-10 fails to
341 # print to stdout the response (from stdin) to a prompt, when stdout
342 # is redirected, while 5.2-3 works fine. That failure would cause
343 # several of parted's tests to failure.
344 # The purist approach would be to write a run-test, but that's
345 # not friendly to cross-compilers, so here's a compromise:
347 # See if libreadline defines one of these symbols:
348 # [this is the list of public symbols that are in 5.2, but not 5.0]
350 # $ diff -u /tmp/readline-5.[02]|grep '+T.[^_]'
352 # +T rl_variable_value
353 # +T rl_reset_screen_size
354 # +T alloc_history_entry
355 # +T copy_history_entry
356 # +T replace_history_data
358 # If not, then reject this readline lib.
359 AC_CHECK_LIB([readline], [rl_variable_value],
362 Your version of libreadline is too old to be used.
363 Consider upgrading to version 5.2 or newer.)
364 found_working_libreadline=no,
367 if test $found_working_libreadline = yes; then
368 PARTED_LIBS="-lreadline $PARTED_LIBS"
369 AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline])
374 AC_SUBST(PARTED_LIBS)
376 dnl Check for OS specific libraries
379 if test "$OS" = gnu; then
380 dnl libshouldbeinlibc
381 AC_CHECK_LIB(shouldbeinlibc, vm_deallocate,
382 OS_LIBS="$OS_LIBS -lshouldbeinlibc",
384 GNU Parted requires libshouldbeinlibc when running on
385 GNU/Hurd systems. It is a standard part of a GNU/Hurd system.
390 dnl libstore may depend on libparted being present.
391 dnl Aren't circular dependencies wonderful?
395 AC_CHECK_LIB(parted, ped_device_read)
398 AC_CHECK_LIB(store, store_open,
399 OS_LIBS="$OS_LIBS -lstore",
401 GNU Parted requires libstore when running on GNU/Hurd
402 systems. It is a standard part of a GNU/Hurd system.
405 $OS_LIBS $UUID_LIBS $DM_LIBS $LIBS
412 if test "$OS" = beos; then
413 dnl Include the socket library, as it is a depedency of libuuid
414 dnl and so also of us (due to socket() call in libuuid)
415 OS_LIBS="$OS_LIBS -lsocket"
420 dnl One day, gettext might support libtool...
421 dnl if test "$USE_INCLUDED_LIBINTL" = "yes"; then
422 dnl INTLINCS='-I$(top_srcdir)/intl'
427 dnl Checks for header files.
428 AC_CHECK_HEADER(uuid/uuid.h, ,
430 GNU Parted requires libuuid - a part of the e2fsprogs package.
431 You seem to have the library installed but not the headers. These are usually
432 found in a corresponding development package (usually called e2fsprogs-devel).
433 If you can't find one try:
434 http://web.mit.edu/tytso/www/linux/e2fsprogs.html
439 AC_CHECK_HEADERS(getopt.h)
441 dnl required for libparted/llseek.c (TODO: make linux-x86 only)
442 if test "$OS" = linux; then
443 AC_CHECK_HEADER(linux/unistd.h)
446 if test "$with_readline" = yes; then
447 AC_CHECK_HEADERS(readline/readline.h readline/history.h, ,
449 The headers for GNU Readline could not be found which
450 are required for the --with-readline option. You seem to have the GNU readline
451 library installed but not the headers. These are usually found in a
452 corresponding development package (usually called readline-devel). If you can't
454 ftp.gnu.org/gnu/readline
455 Alternatively you can disable readline support with --without-readline
461 AC_CHECK_HEADERS(termcap.h)
463 if test "$USE_NLS" = yes; then
464 AC_CHECK_HEADERS(wctype.h, ,
466 One or more of the header files that are required for
467 native language support (wctype.h) could not be found. Either get a newer
468 version of GNU libc and its headers - which can be obtained from:
469 ftp.gnu.org/gnu/glibc
470 Or disable native language support with the --disable-nls option
476 AC_CHECK_HEADER([execinfo.h], [
477 AC_CHECK_LIB(c, backtrace, [
478 AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
479 LDFLAGS="$LDFLAGS -rdynamic"
483 dnl Checks for #defines.
486 #if defined __s390__ || defined __s390x__
487 # message s390 defined
489 ]])], [compile_for_s390="no"], [compile_for_s390="yes"])
490 AM_CONDITIONAL([COMPILE_FOR_S390], [test "$compile_for_s390" = "yes"])
492 dnl check for "check", unit testing library/header
493 PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
494 if test "$have_check" != "yes"; then
495 AC_MSG_RESULT([Unable to locate check version 0.9.3 or higher: not building])
497 AM_CONDITIONAL([HAVE_CHECK], [test "$have_check" = yes])
499 dnl Checks for typedefs, structures and compiler characteristics.
507 dnl Checks for library functions.
508 AC_CHECK_FUNCS(sigaction)
509 AC_CHECK_FUNCS(getuid)
511 dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
512 dnl detected one earlier. libreadline on some platforms (e.g., RHEL and
513 dnl Fedora) is left with
514 if test "$with_readline" = yes; then
516 LIBS="$LIBS $PARTED_LIBS -lreadline"
517 AC_CHECK_FUNCS(rl_completion_matches)
521 AC_CHECK_FUNCS(canonicalize_file_name)
523 # CFLAGS="$CFLAGS -W -Wall -Wno-unused -Wno-switch -Wno-format"
525 if test "$enable_Werror" = yes; then
526 CFLAGS="$CFLAGS -Werror"
529 DATE=$(date '+%d %b %Y %H:%M')
532 BUILDINFO="$USER@$HOST, $DATE"
539 include/parted/Makefile
541 libparted/labels/Makefile
542 libparted/fs/Makefile
543 libparted/fs/amiga/Makefile
544 libparted/fs/ext2/Makefile
545 libparted/fs/fat/Makefile
546 libparted/fs/hfs/Makefile
547 libparted/fs/jfs/Makefile
548 libparted/fs/linux_swap/Makefile
549 libparted/fs/ntfs/Makefile
550 libparted/fs/reiserfs/Makefile
551 libparted/fs/ufs/Makefile
552 libparted/fs/xfs/Makefile
553 libparted/tests/Makefile
561 debug/clearfat/Makefile
568 echo Type \'make\' to compile parted.