1 dnl GNU Parted - a library and front end for manipulation hard disk partitions
2 dnl Copyright (C) 1998-2002, 2005-2009 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.10b dist-xz color-tests parallel-tests silent-rules])
62 *) AC_MSG_ERROR([Unknown or unsupported OS "$host_os". Only "linux", "gnu" and "beos" are supported in this version of GNU Parted.]) ;;
66 dnl Command-line options
67 AC_ARG_WITH([readline],
68 [ --with-readline support fancy command line editing], ,
72 AC_ARG_ENABLE([mtrace],
73 [ --enable-mtrace enable malloc() debugging], ,
76 if test "$enable_mtrace" = yes; then
77 AC_DEFINE([ENABLE_MTRACE], [1], [Mtrace malloc() debugging])
80 AC_SUBST([ENABLE_DEVICE_MAPPER])
81 ENABLE_DEVICE_MAPPER=no
82 AC_ARG_ENABLE([device-mapper],
83 [ --enable-device-mapper enable device mapper support [default=no]],
84 [ENABLE_DEVICE_MAPPER=yes])
85 if test $ENABLE_DEVICE_MAPPER = yes; then
86 AC_DEFINE([ENABLE_DEVICE_MAPPER],
87 1, [device mapper (libdevmapper) support])
90 AC_ARG_ENABLE([selinux],
91 [ --enable-selinux enable SELinux support [default=no]], ,
95 AC_ARG_ENABLE([discover-only],
96 [ --enable-discover-only support only reading/probing [default=no]], ,
97 enable_discover_only=no
99 if test "$enable_discover_only" = yes; then
100 AC_DEFINE([DISCOVER_ONLY], [1], [Probing functionality only])
104 AC_ARG_ENABLE([dynamic-loading],
105 [ --enable-dynamic-loading support dynamic fs libraries [default=yes]], ,
106 if test "$enable_discover_only" = yes; then
107 enable_dynamic_loading=no
109 enable_dynamic_loading=yes
112 if test "$enable_discover_only" = yes -a "$enable_dynamic_loading" = yes; then
114 [You can't use --enable-dynamic-loading and --disable-discover-only together]
119 [ --enable-fs include filesystem support [default=yes]], ,
122 if test "$enable_fs" = yes; then
123 AC_DEFINE([ENABLE_FS], [1],
124 [Include file system support. i.e. libparted/fs_...])
127 AC_ARG_ENABLE([debug],
128 [ --enable-debug compile in assertions [default=yes]], ,
132 if test "$enable_debug" = yes; then
133 AC_DEFINE([DEBUG], [1], [Enable assertions, etc.])
136 AC_ARG_ENABLE([read-only],
137 [ --enable-read-only disable writing (for debugging) [default=no]]
141 if test "$enable_read_only" = yes; then
142 AC_DEFINE([READ_ONLY], [1], [Disable all writing code])
146 AC_SUBST([PARTEDLDFLAGS])
148 AC_ARG_ENABLE([pc98],
149 [ --enable-pc98 build with pc98 support [default=yes]], ,
152 if test "$enable_pc98" = yes; then
153 AC_DEFINE([ENABLE_PC98], [1],
154 [Include PC98 partition tables. (Sometimes excluded to avoid
155 collisions with msdos partition tables])
158 AC_ARG_ENABLE([Werror],
159 [ --enable-Werror build with gcc -Werror [default=yes]], ,
163 AC_ARG_ENABLE([hfs-extract-fs],
164 [ --enable-hfs-extract-fs Extract special HFS files for debugging [default=no]], ,
165 enable_hfs_extract_fs=no
167 if test "$enable_hfs_extract_fs" = yes; then
168 AC_DEFINE([HFS_EXTRACT_FS], [1],
169 [Extract low level special HFS(+) files for debugging purposes
170 when using the "check" command (NOT FOR PACKAGING)])
173 dnl make libc threadsafe (not required for us, but useful other users of
175 AM_CPPFLAGS="$AM_CPPFLAGS -D_REENTRANT"
177 dnl Check for programs.
180 AC_PROG_GCC_TRADITIONAL
184 parted_FIND_USABLE_TEST_DIR
186 dnl This test must come as early as possible after the compiler configuration
187 dnl tests, because the choice of the file model can (in principle) affect
188 dnl whether functions and headers are available, whether they work, etc.
193 AC_CHECK_SIZEOF([off_t], [64], [
195 #include <sys/types.h>
200 if test "$OS" = linux -a $ac_cv_sizeof_off_t -lt 8; then
201 dnl Need to disable shared libraries, to get llseek() to work. Long
202 dnl story. The short story is: lseek() isn't in glibc, so a syscall
203 dnl must be made. syscalls can't be made from within shared libraries,
204 dnl because of a bug (?) in gcc.
206 off_t is less than 8 bytes. Using llseek syscall, and disabling shared
212 AM_GNU_GETTEXT_VERSION([0.15])
213 AM_GNU_GETTEXT([external])
214 if test "$USE_INCLUDED_LIBINTL" = "yes"; then
216 GNU Parted requires gettext to be installed for compilation -
217 if native language support is desired. Either disable native language support
219 $ ./configure --disable-nls
220 Or install gettext. GNU gettext is available from
221 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]
239 dnl Check for libuuid
241 AC_CHECK_LIB([uuid], [uuid_generate], [UUID_LIBS="-luuid"],
243 GNU Parted requires libuuid - a part of the e2fsprogs package (but
244 sometimes distributed separately in uuid-devel or similar)
245 This can probably be found on your distribution's CD or FTP site or at:
246 http://web.mit.edu/tytso/www/linux/e2fsprogs.html
247 Note: if you are using precompiled packages you will also need the development
248 package as well (which may be called e2fsprogs-devel or something similar).
249 If you compile e2fsprogs yourself then you need to do 'make install' and
253 AC_SUBST([UUID_LIBS])
255 dnl Check for libdevmapper
257 if test $ENABLE_DEVICE_MAPPER = yes; then
258 AC_CHECK_LIB([devmapper], [dm_task_create],
259 [DM_LIBS=-ldevmapper],
260 [AC_MSG_ERROR([libdevmapper not found! Try using --disable-device-mapper])
265 dnl Check for SELinux
267 if test "$enable_selinux" = yes; then
268 SELINUX_LIBS="-lselinux -lsepol"
270 AC_SUBST([SELINUX_LIBS])
272 dnl Check for libreiserfs
274 if test "$enable_dynamic_loading" = no -a "$enable_discover_only" = no; then
276 AC_CHECK_LIB([dal], [dal_equals],
278 AC_CHECK_LIB([reiserfs], [reiserfs_fs_probe],
279 REISER_LIBS="-ldal -lreiserfs"
280 AC_DEFINE([HAVE_LIBREISERFS], [1], [Have libreiserfs])
282 AC_CHECK_LIB([reiserfs], [reiserfs_fs_check],
283 AC_DEFINE([HAVE_REISERFS_FS_CHECK], [1], [Have reiserfs_fs_check()])
288 AC_SUBST([REISER_LIBS])
290 dnl Check for termcap
291 if test "$with_readline" = yes; then
294 AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
295 PARTED_LIBS="$PARTED_LIBS $LIBS",
297 termcap could not be found which is required for the
298 --with-readline option (which is enabled by default). Either disable readline
299 support with --without-readline or download and install termcap from:
300 ftp.gnu.org/gnu/termcap
301 Note: if you are using precompiled packages you will also need the development
302 package as well (which may be called termcap-devel or something similar).
303 Note: (n)curses also seems to work as a substitute for termcap. This was
304 not found either - but you could try installing that as well.
310 dnl Check for readline
311 dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
312 dnl detected one earlier. libreadline on some platforms (e.g., RHEL and
313 dnl Fedora) is left with
314 if test "$with_readline" = yes; then
316 LIBS="$LIBS $PARTED_LIBS"
317 found_working_libreadline=no
318 AC_CHECK_LIB([readline], [readline],
319 found_working_libreadline=yes,
321 GNU Readline could not be found which is required for the
322 --with-readline (which is enabled by default). Either disable readline support with
323 --without-readline or downloaded and install it from:
324 ftp.gnu.org/gnu/readline
325 Note: if you are using precompiled packages you will also need the development
326 package as well (which may be called readline-devel or something similar).
331 LIBS="$OLD_LIBS $PARTED_LIBS"
333 # See if libreadline is too old to be used.
334 # The readline function in Debian's libreadline5 5.0-10 fails to
335 # print to stdout the response (from stdin) to a prompt, when stdout
336 # is redirected, while 5.2-3 works fine. That failure would cause
337 # several of parted's tests to failure.
338 # The purist approach would be to write a run-test, but that's
339 # not friendly to cross-compilers, so here's a compromise:
341 # See if libreadline defines one of these symbols:
342 # [this is the list of public symbols that are in 5.2, but not 5.0]
344 # $ diff -u /tmp/readline-5.[02]|grep '+T.[^_]'
346 # +T rl_variable_value
347 # +T rl_reset_screen_size
348 # +T alloc_history_entry
349 # +T copy_history_entry
350 # +T replace_history_data
352 # If not, then reject this readline lib.
353 AC_CHECK_LIB([readline], [rl_variable_value],
356 Your version of libreadline is too old to be used.
357 Consider upgrading to version 5.2 or newer.)
358 found_working_libreadline=no,
361 if test $found_working_libreadline = yes; then
362 PARTED_LIBS="-lreadline $PARTED_LIBS"
363 AC_DEFINE([HAVE_LIBREADLINE], [1], [have readline])
368 AC_SUBST([PARTED_LIBS])
370 dnl Check for OS specific libraries
373 if test "$OS" = gnu; then
374 dnl libshouldbeinlibc
375 AC_CHECK_LIB([shouldbeinlibc], [vm_deallocate],
376 OS_LIBS="$OS_LIBS -lshouldbeinlibc",
378 GNU Parted requires libshouldbeinlibc when running on
379 GNU/Hurd systems. It is a standard part of a GNU/Hurd system.
383 dnl libstore may depend on libparted being present.
384 dnl Aren't circular dependencies wonderful?
388 AC_CHECK_LIB([parted], [ped_device_read])
391 AC_CHECK_LIB([store], [store_open],
392 OS_LIBS="$OS_LIBS -lstore",
394 GNU Parted requires libstore when running on GNU/Hurd
395 systems. It is a standard part of a GNU/Hurd system.
398 $OS_LIBS $UUID_LIBS $DM_LIBS $LIBS
405 if test "$OS" = beos; then
406 dnl Include the socket library, as it is a depedency of libuuid
407 dnl and so also of us (due to socket() call in libuuid)
408 OS_LIBS="$OS_LIBS -lsocket"
413 dnl One day, gettext might support libtool...
414 dnl if test "$USE_INCLUDED_LIBINTL" = "yes"; then
415 dnl INTLINCS='-I$(top_srcdir)/intl'
420 dnl Checks for header files.
421 AC_CHECK_HEADER([uuid/uuid.h], ,
423 GNU Parted requires libuuid - a part of the e2fsprogs package.
424 You seem to have the library installed but not the headers. These are usually
425 found in a corresponding development package (usually called e2fsprogs-devel).
426 If you can't find one try:
427 http://web.mit.edu/tytso/www/linux/e2fsprogs.html
431 AC_CHECK_HEADERS([getopt.h])
433 dnl required for libparted/llseek.c (TODO: make linux-x86 only)
434 if test "$OS" = linux; then
435 AC_CHECK_HEADER([linux/unistd.h])
438 if test "$with_readline" = yes; then
439 AC_CHECK_HEADERS([readline/readline.h readline/history.h], ,
441 The headers for GNU Readline could not be found which
442 are required for the --with-readline option. You seem to have the GNU readline
443 library installed but not the headers. These are usually found in a
444 corresponding development package (usually called readline-devel). If you can't
446 ftp.gnu.org/gnu/readline
447 Alternatively you can disable readline support with --without-readline
452 AC_CHECK_HEADERS([termcap.h])
454 if test "$USE_NLS" = yes; then
455 AC_CHECK_HEADERS([wctype.h], ,
457 One or more of the header files that are required for
458 native language support (wctype.h) could not be found. Either get a newer
459 version of GNU libc and its headers - which can be obtained from:
460 ftp.gnu.org/gnu/glibc
461 Or disable native language support with the --disable-nls option
466 AC_CHECK_HEADER([execinfo.h], [
467 AC_CHECK_LIB([c], [backtrace], [
468 AC_DEFINE([HAVE_BACKTRACE], [1], [Has backtrace support])
469 LDFLAGS="$LDFLAGS -rdynamic"
473 AM_CONDITIONAL([COMPILE_FOR_S390], [test "$host_cpu" = s390 || test "$host_cpu" = s390x])
475 dnl check for "check", unit testing library/header
476 PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
477 if test "$have_check" != "yes"; then
478 AC_MSG_RESULT([Unable to locate check version 0.9.3 or higher: not building])
480 AM_CONDITIONAL([HAVE_CHECK], [test "$have_check" = yes])
482 dnl Checks for typedefs, structures and compiler characteristics.
490 dnl Checks for library functions.
491 AC_CHECK_FUNCS([sigaction])
492 AC_CHECK_FUNCS([getuid])
494 dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
495 dnl detected one earlier. libreadline on some platforms (e.g., RHEL and
496 dnl Fedora) is left with
497 if test "$with_readline" = yes; then
499 LIBS="$LIBS $PARTED_LIBS -lreadline"
500 AC_CHECK_FUNCS([rl_completion_matches])
504 AC_CHECK_FUNCS([canonicalize_file_name])
506 # CFLAGS="$CFLAGS -W -Wall -Wno-unused -Wno-switch -Wno-format"
508 if test "$enable_Werror" = yes; then
509 CFLAGS="$CFLAGS -Werror"
512 DATE=$(date '+%d %b %Y %H:%M')
515 BUILDINFO="$USER@$HOST, $DATE"
516 AC_SUBST([BUILDINFO])
522 include/parted/Makefile
524 libparted/labels/Makefile
525 libparted/fs/Makefile
526 libparted/fs/amiga/Makefile
527 libparted/fs/ext2/Makefile
528 libparted/fs/fat/Makefile
529 libparted/fs/hfs/Makefile
530 libparted/fs/jfs/Makefile
531 libparted/fs/linux_swap/Makefile
532 libparted/fs/ntfs/Makefile
533 libparted/fs/reiserfs/Makefile
534 libparted/fs/ufs/Makefile
535 libparted/fs/xfs/Makefile
536 libparted/tests/Makefile
544 debug/clearfat/Makefile
551 echo Type \'make\' to compile parted.