1 dnl GNU Parted - a library and front end for manipulation hard disk partitions
2 dnl Copyright (C) 1998-2002, 2005-2011 Free Software Foundation, Inc.
4 dnl This file may be modified and/or distributed without restriction.
7 AC_INIT([GNU parted], m4_esyscmd([build-aux/git-version-gen .version]),
10 # When the most recent signed tag is v1.8.8.1,
11 # the above might set e.g., PACKAGE_VERSION='1.8.8.1.1-0bfc'
13 AC_CONFIG_SRCDIR([include/parted/parted.h])
15 AC_CONFIG_HEADERS([lib/config.h:lib/config.h.in])
16 AC_CONFIG_AUX_DIR([build-aux])
19 dnl Shamelessly pulled straight from glib's configure.in ...
21 dnl PED_MICRO_VERSION += 1;
22 dnl PED_INTERFACE_AGE += 1;
23 dnl PED_BINARY_AGE += 1;
24 dnl if any functions have been added, set PED_INTERFACE_AGE to 0.
25 dnl if backwards compatibility has been broken (eg. functions removed,
26 dnl function signatures changed),
27 dnl set PED_BINARY_AGE _and_ PED_INTERFACE_AGE to 0.
29 # Derive these numbers from $PACKAGE_VERSION, which is set
30 # when autoconf creates configure (see AC_INIT, above).
31 PED_MAJOR_VERSION=`echo "$PACKAGE_VERSION"|sed 's/\..*//'`
32 PED_MINOR_VERSION=`echo "$PACKAGE_VERSION"|sed 's/^[[0-9]][[0-9]]*\.//;s/\..*//'`
33 case $PACKAGE_VERSION in
35 PED_MICRO_VERSION=`echo "$PACKAGE_VERSION" \
36 | sed 's/^[^.]*\.[^.]*\.//;s/\..*//'`
38 *) PED_MICRO_VERSION=0;;
44 PED_VERSION=$PED_MAJOR_VERSION.$PED_MINOR_VERSION.$PED_MICRO_VERSION$PED_VERSION_SUFFIX
46 LT_RELEASE=$PED_MAJOR_VERSION.$PED_MINOR_VERSION
47 LT_CURRENT=`expr $PED_MICRO_VERSION - $PED_INTERFACE_AGE`
48 LT_REVISION=$PED_INTERFACE_AGE
49 LT_AGE=`expr $PED_BINARY_AGE - $PED_INTERFACE_AGE`
50 AC_SUBST([LT_RELEASE])
51 AC_SUBST([LT_CURRENT])
52 AC_SUBST([LT_REVISION])
55 AM_INIT_AUTOMAKE([1.11 dist-xz color-tests parallel-tests])
56 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
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
68 AC_ARG_WITH([readline],
69 [ --with-readline support fancy command line editing], ,
73 AC_ARG_ENABLE([mtrace],
74 [ --enable-mtrace enable malloc() debugging], ,
77 if test "$enable_mtrace" = yes; then
78 AC_DEFINE([ENABLE_MTRACE], [1], [Mtrace malloc() debugging])
81 AC_SUBST([ENABLE_DEVICE_MAPPER])
82 ENABLE_DEVICE_MAPPER=yes
83 AC_ARG_ENABLE([device-mapper],
84 [ --enable-device-mapper enable device mapper support [default=yes]],
85 [ENABLE_DEVICE_MAPPER=$enable_device_mapper])
86 if test $ENABLE_DEVICE_MAPPER = yes; then
87 AC_DEFINE([ENABLE_DEVICE_MAPPER],
88 1, [device mapper (libdevmapper) support])
91 AC_ARG_ENABLE([selinux],
92 [ --enable-selinux enable SELinux support [default=no]], ,
96 AC_ARG_ENABLE([discover-only],
97 [ --enable-discover-only support only reading/probing [default=no]], ,
98 enable_discover_only=no
100 if test "$enable_discover_only" = yes; then
101 AC_DEFINE([DISCOVER_ONLY], [1], [Probing functionality only])
105 AC_ARG_ENABLE([dynamic-loading],
106 [ --enable-dynamic-loading support dynamic fs libraries [default=yes]], ,
107 if test "$enable_discover_only" = yes; then
108 enable_dynamic_loading=no
110 enable_dynamic_loading=yes
113 if test "$enable_discover_only" = yes \
114 && test "$enable_dynamic_loading" = yes; then
116 [You can't use --enable-dynamic-loading and --disable-discover-only together]
121 [ --enable-fs include filesystem support [default=yes]], ,
124 if test "$enable_fs" = yes; then
125 AC_DEFINE([ENABLE_FS], [1],
126 [Include file system support. i.e. libparted/fs_...])
129 AC_ARG_ENABLE([debug],
130 [ --enable-debug compile in assertions [default=yes]], ,
134 if test "$enable_debug" = yes; then
135 AC_DEFINE([DEBUG], [1], [Enable assertions, etc.])
138 AC_ARG_ENABLE([read-only],
139 [ --enable-read-only disable writing (for debugging) [default=no]]
143 if test "$enable_read_only" = yes; then
144 AC_DEFINE([READ_ONLY], [1], [Disable all writing code])
148 AC_SUBST([PARTEDLDFLAGS])
150 AC_ARG_ENABLE([pc98],
151 [ --enable-pc98 build with pc98 support [default=yes]], ,
154 if test "$enable_pc98" = yes; then
155 AC_DEFINE([ENABLE_PC98], [1],
156 [Include PC98 partition tables. (Sometimes excluded to avoid
157 collisions with msdos partition tables])
160 AC_ARG_ENABLE([Werror],
161 [ --enable-Werror build with gcc -Werror [default=yes]], ,
165 AC_ARG_ENABLE([hfs-extract-fs],
166 [ --enable-hfs-extract-fs Extract special HFS files for debugging [default=no]], ,
167 enable_hfs_extract_fs=no
169 if test "$enable_hfs_extract_fs" = yes; then
170 AC_DEFINE([HFS_EXTRACT_FS], [1],
171 [Extract low level special HFS(+) files for debugging purposes
172 when using the "check" command (NOT FOR PACKAGING)])
175 dnl make libc threadsafe (not required for us, but useful other users of
177 AM_CPPFLAGS="$AM_CPPFLAGS -D_REENTRANT"
179 dnl Check for programs.
182 AC_PROG_GCC_TRADITIONAL
186 parted_FIND_USABLE_TEST_DIR
188 dnl This test must come as early as possible after the compiler configuration
189 dnl tests, because the choice of the file model can (in principle) affect
190 dnl whether functions and headers are available, whether they work, etc.
195 AC_ARG_ENABLE([gcc-warnings],
196 [AS_HELP_STRING([--enable-gcc-warnings],
197 [turn on lots of GCC warnings (for developers)])],
200 *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
202 gl_gcc_warnings=$enableval],
206 if test "$gl_gcc_warnings" = yes; then
207 gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
208 AC_SUBST([WERROR_CFLAGS])
211 # This, $nw, is the list of warnings we disable.
212 nw="$nw -Wdeclaration-after-statement" # too useful to forbid
213 nw="$nw -Waggregate-return" # anachronistic
214 nw="$nw -Wlong-long" # C90 is anachronistic (lib/gethrxtime.h)
215 nw="$nw -Wc++-compat" # We don't care about C++ compilers
216 nw="$nw -Wundef" # Warns on '#if GNULIB_FOO' etc in gnulib
217 nw="$nw -Wtraditional" # Warns on #elif which we use often
218 nw="$nw -Wcast-qual" # Too many warnings for now
219 nw="$nw -Wconversion" # Too many warnings for now
220 nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
221 nw="$nw -Wsign-conversion" # Too many warnings for now
222 nw="$nw -Wtraditional-conversion" # Too many warnings for now
223 nw="$nw -Wunreachable-code" # Too many warnings for now
224 nw="$nw -Wpadded" # Our structs are not padded
225 nw="$nw -Wredundant-decls" # openat.h declares e.g., mkdirat
226 nw="$nw -Wlogical-op" # any use of fwrite provokes this
227 nw="$nw -Wformat-nonliteral" # who.c and pinky.c strftime uses
228 nw="$nw -Wvla" # warnings in gettext.h
229 nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
230 nw="$nw -Wswitch-enum" # Too many warnings for now
231 nw="$nw -Wswitch-default" # Too many warnings for now
232 # Too many warnings for now
233 nw="$nw -Wattributes"
234 nw="$nw -Wstrict-prototypes"
235 nw="$nw -Wold-style-definition"
237 nw="$nw -Wmissing-prototypes"
238 nw="$nw -Wmissing-declarations"
239 nw="$nw -Wmissing-noreturn"
240 # things I might fix soon:
241 nw="$nw -Wfloat-equal" # sort.c, seq.c
242 nw="$nw -Wmissing-format-attribute" # copy.c
243 nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
244 nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
245 nw="$nw -Wstrict-overflow" # expr.c, pr.c, tr.c, factor.c
246 nw="$nw -Wstack-protector" # libparted/label/gpt.c
247 # ?? -Wstrict-overflow
249 gl_MANYWARN_ALL_GCC([ws])
250 gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
254 gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
255 gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
256 gl_WARN_ADD([-Wno-pointer-sign]) # Too many warnings for now
257 gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
258 gl_WARN_ADD([-Wno-unused-macros]) # Too many warnings for now
260 # FIXME: investigate these
261 gl_WARN_ADD([-Wno-jump-misses-init])
263 # In spite of excluding -Wlogical-op above, it is enabled, as of
264 # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
265 gl_WARN_ADD([-Wno-logical-op])
267 gl_WARN_ADD([-fdiagnostics-show-option])
269 AC_SUBST([WARN_CFLAGS])
271 AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
272 AC_DEFINE([_FORTIFY_SOURCE], [2],
273 [enable compile-time and run-time bounds-checking, and some warnings])
274 AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
279 AC_CHECK_SIZEOF([off_t], [64], [
281 #include <sys/types.h>
286 if test "$OS" = linux && test $ac_cv_sizeof_off_t -lt 8; then
287 dnl Need to disable shared libraries, to get llseek() to work. Long
288 dnl story. The short story is: lseek() isn't in glibc, so a syscall
289 dnl must be made. syscalls can't be made from within shared libraries,
290 dnl because of a bug (?) in gcc.
292 off_t is less than 8 bytes. Using llseek syscall, and disabling shared
298 AM_GNU_GETTEXT_VERSION([0.18])
299 AM_GNU_GETTEXT([external])
300 if test "$USE_INCLUDED_LIBINTL" = "yes"; then
302 GNU Parted requires gettext to be installed for compilation -
303 if native language support is desired. Either disable native language support
305 $ ./configure --disable-nls
306 Or install gettext. GNU gettext is available from
307 http://ftp.gnu.org/gnu/gettext
311 dnl Check for libdl, if we are doing dynamic loading
313 AC_SUBST([DYNAMIC_LOADING])
315 if test "$enable_dynamic_loading" = yes; then
316 AC_CHECK_LIB([dl], [dlopen],
318 PARTED_LIBS="$PARTED_LIBS -ldl"
320 AC_DEFINE([DYNAMIC_LOADING], [1], [Lazy linking to fs libs]),
322 [-ldl not found! Try using --disable-dynamic-loading]
328 dnl Check for libuuid
330 AC_CHECK_LIB([uuid], [uuid_generate], [UUID_LIBS="-luuid"],
332 [GNU Parted requires libuuid - a part of the util-linux-ng package (but
333 usually distributed separately in libuuid-devel, uuid-dev or similar)
334 This can probably be found on your distribution's CD or FTP site or at:
335 http://userweb.kernel.org/~kzak/util-linux-ng/
336 Note: originally, libuuid was part of the e2fsprogs package. Later, it
337 moved to util-linux-ng-2.16, and that package is now the preferred source.])])
338 AC_SUBST([UUID_LIBS])
340 dnl Check for libdevmapper
342 if test $ENABLE_DEVICE_MAPPER = yes; then
343 AC_CHECK_LIB([devmapper], [dm_task_create],
344 [DM_LIBS=-ldevmapper],
346 [libdevmapper could not be found, but is required for the
347 --enable-device-mapper option, which is enabled by default. Either disable
348 device-mapper support with --disable-device-mapper or download and install
350 http://sources.redhat.com/dm/
351 Note: if you are using precompiled packages you will need the development
352 package as well (it may be called device-mapper-devel or something similar).]
358 dnl Check for SELinux
360 if test "$enable_selinux" = yes; then
361 SELINUX_LIBS="-lselinux -lsepol"
363 AC_SUBST([SELINUX_LIBS])
365 dnl Check for libreiserfs
367 if test "$enable_dynamic_loading" = no && test "$enable_discover_only" = no; then
369 AC_CHECK_LIB([dal], [dal_equals],
371 AC_CHECK_LIB([reiserfs], [reiserfs_fs_probe],
372 REISER_LIBS="-ldal -lreiserfs"
373 AC_DEFINE([HAVE_LIBREISERFS], [1], [Have libreiserfs])
375 AC_CHECK_LIB([reiserfs], [reiserfs_fs_check],
376 AC_DEFINE([HAVE_REISERFS_FS_CHECK], [1], [Have reiserfs_fs_check()])
381 AC_SUBST([REISER_LIBS])
383 dnl Check for termcap
384 if test "$with_readline" = yes; then
387 AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
388 [PARTED_LIBS="$PARTED_LIBS $LIBS"],
390 [termcap could not be found which is required for the
391 --with-readline option (which is enabled by default). Either disable readline
392 support with --without-readline or download and install termcap from:
393 ftp.gnu.org/gnu/termcap
394 Note: if you are using precompiled packages you will also need the development
395 package as well (which may be called termcap-devel or something similar).
396 Note: (n)curses also seems to work as a substitute for termcap. This was
397 not found either - but you could try installing that as well.])])
401 dnl Check for readline
402 dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
403 dnl detected one earlier. libreadline on some platforms (e.g., RHEL and
404 dnl Fedora) is left with
405 if test "$with_readline" = yes; then
407 LIBS="$LIBS $PARTED_LIBS"
408 found_working_libreadline=no
409 AC_CHECK_LIB([readline], [readline],
410 found_working_libreadline=yes,
412 [GNU Readline could not be found which is required for the
413 --with-readline (which is enabled by default). Either disable readline support with
414 --without-readline or downloaded and install it from:
415 ftp.gnu.org/gnu/readline
416 Note: if you are using precompiled packages you will also need the development
417 package as well (which may be called readline-devel or something similar).
422 LIBS="$OLD_LIBS $PARTED_LIBS"
424 # See if libreadline is too old to be used.
425 # The readline function in Debian's libreadline5 5.0-10 fails to
426 # print to stdout the response (from stdin) to a prompt, when stdout
427 # is redirected, while 5.2-3 works fine. That failure would cause
428 # several of parted's tests to failure.
429 # The purist approach would be to write a run-test, but that's
430 # not friendly to cross-compilers, so here's a compromise:
432 # See if libreadline defines one of these symbols:
433 # [this is the list of public symbols that are in 5.2, but not 5.0]
435 # $ diff -u /tmp/readline-5.[02]|grep '+T.[^_]'
437 # +T rl_variable_value
438 # +T rl_reset_screen_size
439 # +T alloc_history_entry
440 # +T copy_history_entry
441 # +T replace_history_data
443 # If not, then reject this readline lib.
444 AC_CHECK_LIB([readline], [rl_variable_value],
447 [Your version of libreadline is too old to be used.
448 Consider upgrading to version 5.2 or newer.])
449 found_working_libreadline=no,
452 if test $found_working_libreadline = yes; then
453 PARTED_LIBS="-lreadline $PARTED_LIBS"
454 AC_DEFINE([HAVE_LIBREADLINE], [1], [have readline])
459 AC_SUBST([PARTED_LIBS])
461 dnl Check for OS specific libraries
464 if test "$OS" = gnu; then
465 dnl libshouldbeinlibc
466 AC_CHECK_LIB([shouldbeinlibc], [vm_deallocate],
467 OS_LIBS="$OS_LIBS -lshouldbeinlibc",
469 [GNU Parted requires libshouldbeinlibc when running on
470 GNU/Hurd systems. It is a standard part of a GNU/Hurd system.]
474 dnl libstore may depend on libparted being present.
475 dnl Aren't circular dependencies wonderful?
479 AC_CHECK_LIB([parted], [ped_device_read])
482 AC_CHECK_LIB([store], [store_open],
483 OS_LIBS="$OS_LIBS -lstore",
485 [GNU Parted requires libstore when running on GNU/Hurd
486 systems. It is a standard part of a GNU/Hurd system.]
489 $OS_LIBS $UUID_LIBS $DM_LIBS $LIBS
496 if test "$OS" = beos; then
497 dnl Include the socket library, as it is a depedency of libuuid
498 dnl and so also of us (due to socket() call in libuuid)
499 OS_LIBS="$OS_LIBS -lsocket"
504 dnl One day, gettext might support libtool...
505 dnl if test "$USE_INCLUDED_LIBINTL" = "yes"; then
506 dnl INTLINCS='-I$(top_srcdir)/intl'
511 dnl Checks for header files.
512 AC_CHECK_HEADER([uuid/uuid.h], ,
514 [GNU Parted requires libuuid - a part of the e2fsprogs package.
515 You seem to have the library installed but not the headers. These are usually
516 found in a corresponding development package (usually called e2fsprogs-devel).
517 If you can't find one try:
518 http://web.mit.edu/tytso/www/linux/e2fsprogs.html])]
521 AC_CHECK_HEADERS([getopt.h])
523 dnl required for libparted/llseek.c (TODO: make linux-x86 only)
524 if test "$OS" = linux; then
525 AC_CHECK_HEADER([linux/unistd.h])
528 if test "$with_readline" = yes; then
529 AC_CHECK_HEADERS([readline/readline.h readline/history.h], ,
531 [The headers for GNU Readline could not be found which
532 are required for the --with-readline option. You seem to have the GNU readline
533 library installed but not the headers. These are usually found in a
534 corresponding development package (usually called readline-devel). If you can't
536 ftp.gnu.org/gnu/readline
537 Alternatively you can disable readline support with --without-readline])]
541 AC_CHECK_HEADERS([termcap.h])
543 if test "$USE_NLS" = yes; then
544 AC_CHECK_HEADERS([wctype.h], ,
546 [One or more of the header files that are required for
547 native language support (wctype.h) could not be found. Either get a newer
548 version of GNU libc and its headers - which can be obtained from:
549 ftp.gnu.org/gnu/glibc
550 Or disable native language support with the --disable-nls option])]
554 AC_CHECK_HEADER([execinfo.h], [
555 AC_CHECK_LIB([c], [backtrace], [
556 AC_DEFINE([HAVE_BACKTRACE], [1], [Has backtrace support])
557 LDFLAGS="$LDFLAGS -rdynamic"
561 AM_CONDITIONAL([COMPILE_FOR_S390], [test "$host_cpu" = s390 || test "$host_cpu" = s390x])
562 AM_CONDITIONAL([BUILD_LINUX], [test "$OS" = linux])
564 dnl check for "check", unit testing library/header
565 PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
566 if test "$have_check" != "yes"; then
567 AC_MSG_RESULT([Unable to locate check version 0.9.3 or higher: not building])
569 AM_CONDITIONAL([HAVE_CHECK], [test "$have_check" = yes])
571 dnl Checks for typedefs, structures and compiler characteristics.
579 dnl Checks for library functions.
580 AC_CHECK_FUNCS([sigaction])
581 AC_CHECK_FUNCS([getuid])
583 dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
584 dnl detected one earlier. libreadline on some platforms (e.g., RHEL and
585 dnl Fedora) is left with
586 if test "$with_readline" = yes; then
588 LIBS="$LIBS $PARTED_LIBS -lreadline"
589 AC_CHECK_FUNCS([rl_completion_matches])
593 AC_CHECK_FUNCS([canonicalize_file_name])
595 # CFLAGS="$CFLAGS -W -Wall -Wno-unused -Wno-switch -Wno-format"
597 if test "$enable_Werror" = yes; then
598 CFLAGS="$CFLAGS -Werror"
601 DATE=$(date '+%d %b %Y %H:%M')
604 BUILDINFO="$USER@$HOST, $DATE"
605 AC_SUBST([BUILDINFO])
608 AC_SUBST([LIB_BLKID])
610 AC_SEARCH_LIBS([blkid_probe_get_topology], [blkid],
611 [test "$ac_cv_search_blkid_probe_get_topology" = "none required" \
612 || LIB_BLKID=$ac_cv_search_blkid_probe_get_topology])
613 AC_CHECK_FUNC([blkid_probe_get_topology], [use_blkid=1], [use_blkid=0])
615 AC_DEFINE_UNQUOTED([USE_BLKID], [$use_blkid],
616 [Define if you have sufficient blkid support.])
617 AC_CHECK_HEADERS_ONCE([blkid/blkid.h])
623 include/parted/Makefile
625 libparted/labels/Makefile
626 libparted/fs/Makefile
627 libparted/fs/amiga/Makefile
628 libparted/fs/ext2/Makefile
629 libparted/fs/fat/Makefile
630 libparted/fs/hfs/Makefile
631 libparted/fs/jfs/Makefile
632 libparted/fs/linux_swap/Makefile
633 libparted/fs/ntfs/Makefile
634 libparted/fs/reiserfs/Makefile
635 libparted/fs/ufs/Makefile
636 libparted/fs/xfs/Makefile
637 libparted/fs/nilfs2/Makefile
638 libparted/tests/Makefile
646 debug/clearfat/Makefile
653 echo Type \'make\' to compile parted.