OSDN Git Service

maint: adjust the URL that will appear in the generated announcement
[android-x86/external-parted.git] / configure.ac
index 53d88b5..3915ac0 100644 (file)
@@ -1,9 +1,9 @@
 dnl GNU Parted - a library and front end for manipulation hard disk partitions
-dnl Copyright (C) 1998-2002, 2005-2009 Free Software Foundation, Inc.
+dnl Copyright (C) 1998-2002, 2005-2011 Free Software Foundation, Inc.
 dnl
 dnl This file may be modified and/or distributed without restriction.
 
-AC_PREREQ([2.61])
+AC_PREREQ([2.63])
 AC_INIT([GNU parted], m4_esyscmd([build-aux/git-version-gen .version]),
         [bug-parted@gnu.org])
 
@@ -29,7 +29,7 @@ dnl set PED_BINARY_AGE _and_ PED_INTERFACE_AGE to 0.
 # Derive these numbers from $PACKAGE_VERSION, which is set
 # when autoconf creates configure (see AC_INIT, above).
 PED_MAJOR_VERSION=`echo "$PACKAGE_VERSION"|sed 's/\..*//'`
-PED_MINOR_VERSION=`echo "$PACKAGE_VERSION"|sed 's/^[0-9][0-9]*\.//;s/\..*//'`
+PED_MINOR_VERSION=`echo "$PACKAGE_VERSION"|sed 's/^[[0-9]][[0-9]]*\.//;s/\..*//'`
 case $PACKAGE_VERSION in
   *.*.*.*.*)
     PED_MICRO_VERSION=`echo "$PACKAGE_VERSION" \
@@ -52,7 +52,7 @@ AC_SUBST([LT_CURRENT])
 AC_SUBST([LT_REVISION])
 AC_SUBST([LT_AGE])
 
-AM_INIT_AUTOMAKE([1.10b dist-xz color-tests parallel-tests])
+AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz color-tests parallel-tests])
 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
 
 AC_CANONICAL_HOST
@@ -79,10 +79,10 @@ if test "$enable_mtrace" = yes; then
 fi
 
 AC_SUBST([ENABLE_DEVICE_MAPPER])
-ENABLE_DEVICE_MAPPER=no
+ENABLE_DEVICE_MAPPER=yes
 AC_ARG_ENABLE([device-mapper],
-       [  --enable-device-mapper  enable device mapper support [default=no]],
-       [ENABLE_DEVICE_MAPPER=yes])
+       [  --enable-device-mapper  enable device mapper support [default=yes]],
+       [ENABLE_DEVICE_MAPPER=$enable_device_mapper])
 if test $ENABLE_DEVICE_MAPPER = yes; then
        AC_DEFINE([ENABLE_DEVICE_MAPPER],
                   1, [device mapper (libdevmapper) support])
@@ -110,21 +110,13 @@ AC_ARG_ENABLE([dynamic-loading],
                enable_dynamic_loading=yes
        fi
 )
-if test "$enable_discover_only" = yes -a "$enable_dynamic_loading" = yes; then
+if test "$enable_discover_only" = yes \
+ && test "$enable_dynamic_loading" = yes; then
        AC_MSG_ERROR(
 [You can't use --enable-dynamic-loading and --disable-discover-only together]
        )
 fi
 
-AC_ARG_ENABLE([fs],
-       [  --enable-fs             include filesystem support [default=yes]], ,
-       enable_fs=yes
-)
-if test "$enable_fs" = yes; then
-       AC_DEFINE([ENABLE_FS], [1],
-                 [Include file system support.  i.e. libparted/fs_...])
-fi
-
 AC_ARG_ENABLE([debug],
        [  --enable-debug          compile in assertions [default=yes]], ,
        enable_debug=yes
@@ -156,11 +148,6 @@ if test "$enable_pc98" = yes; then
                   collisions with msdos partition tables])
 fi
 
-AC_ARG_ENABLE([Werror],
-       [  --enable-Werror         build with gcc -Werror [default=yes]], ,
-       enable_Werror=yes
-)
-
 AC_ARG_ENABLE([hfs-extract-fs],
        [  --enable-hfs-extract-fs Extract special HFS files for debugging [default=no]], ,
        enable_hfs_extract_fs=no
@@ -191,6 +178,90 @@ AC_SYS_LARGEFILE
 
 gl_INIT
 
+AC_ARG_ENABLE([gcc-warnings],
+  [AS_HELP_STRING([--enable-gcc-warnings],
+                 [turn on lots of GCC warnings (for developers)])],
+  [case $enableval in
+     yes|no) ;;
+     *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
+   esac
+   gl_gcc_warnings=$enableval],
+  [gl_gcc_warnings=no]
+)
+
+if test "$gl_gcc_warnings" = yes; then
+  gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
+  AC_SUBST([WERROR_CFLAGS])
+
+  nw=
+  # This, $nw, is the list of warnings we disable.
+  nw="$nw -Wdeclaration-after-statement" # too useful to forbid
+  nw="$nw -Waggregate-return"       # anachronistic
+  nw="$nw -Wlong-long"              # C90 is anachronistic (lib/gethrxtime.h)
+  nw="$nw -Wc++-compat"             # We don't care about C++ compilers
+  nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
+  nw="$nw -Wtraditional"            # Warns on #elif which we use often
+  nw="$nw -Wcast-qual"              # Too many warnings for now
+  nw="$nw -Wconversion"             # Too many warnings for now
+  nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
+  nw="$nw -Wsign-conversion"        # Too many warnings for now
+  nw="$nw -Wtraditional-conversion" # Too many warnings for now
+  nw="$nw -Wunreachable-code"       # Too many warnings for now
+  nw="$nw -Wpadded"                 # Our structs are not padded
+  nw="$nw -Wredundant-decls"        # openat.h declares e.g., mkdirat
+  nw="$nw -Wlogical-op"             # any use of fwrite provokes this
+  nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
+  nw="$nw -Wvla"                    # warnings in gettext.h
+  nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
+  nw="$nw -Wswitch-enum"            # Too many warnings for now
+  nw="$nw -Wswitch-default"         # Too many warnings for now
+  # Too many warnings for now
+  nw="$nw -Wattributes"
+  nw="$nw -Wstrict-prototypes"
+  nw="$nw -Wold-style-definition"
+  nw="$nw -Wpacked"
+  nw="$nw -Wmissing-prototypes"
+  nw="$nw -Wmissing-declarations"
+  nw="$nw -Wmissing-noreturn"
+  # things I might fix soon:
+  nw="$nw -Wfloat-equal"            # sort.c, seq.c
+  nw="$nw -Wmissing-format-attribute" # copy.c
+  nw="$nw -Wunsafe-loop-optimizations" # a few src/*.c
+  nw="$nw -Winline"                 # system.h's readdir_ignoring_dot_and_dotdot
+  nw="$nw -Wstrict-overflow"        # expr.c, pr.c, tr.c, factor.c
+  nw="$nw -Wstack-protector"        # libparted/label/gpt.c
+  # ?? -Wstrict-overflow
+
+  gl_MANYWARN_ALL_GCC([ws])
+  gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
+  for w in $ws; do
+    gl_WARN_ADD([$w])
+  done
+  gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
+  gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
+  gl_WARN_ADD([-Wno-unused-macros]) # Too many warnings for now
+
+  # FIXME: investigate these
+  gl_WARN_ADD([-Wno-jump-misses-init])
+
+  # In spite of excluding -Wlogical-op above, it is enabled, as of
+  # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
+  gl_WARN_ADD([-Wno-logical-op])
+
+  gl_WARN_ADD([-fdiagnostics-show-option])
+
+  AC_SUBST([WARN_CFLAGS])
+
+  AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
+  AC_DEFINE([_FORTIFY_SOURCE], [2],
+    [enable compile-time and run-time bounds-checking, and some warnings])
+  AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
+fi
+
+
+
 AC_CHECK_SIZEOF([off_t], [64], [
        #include <stdio.h>
        #include <sys/types.h>
@@ -198,7 +269,7 @@ AC_CHECK_SIZEOF([off_t], [64], [
 ])
 
 AM_ENABLE_SHARED
-if test "$OS" = linux -a $ac_cv_sizeof_off_t -lt 8; then
+if test "$OS" = linux && test $ac_cv_sizeof_off_t -lt 8; then
        dnl Need to disable shared libraries, to get llseek() to work.  Long
        dnl story.  The short story is: lseek() isn't in glibc, so a syscall
        dnl must be made.  syscalls can't be made from within shared libraries,
@@ -208,27 +279,30 @@ off_t is less than 8 bytes.  Using llseek syscall, and disabling shared
 libraries.)
        AM_DISABLE_SHARED
 fi
-AM_PROG_LIBTOOL
+AC_PROG_LIBTOOL
 
-AM_GNU_GETTEXT_VERSION([0.15])
+AM_GNU_GETTEXT_VERSION([0.18])
 AM_GNU_GETTEXT([external])
 if test "$USE_INCLUDED_LIBINTL" = "yes"; then
-       AC_MSG_ERROR(
+       AC_MSG_ERROR([
 GNU Parted requires gettext to be installed for compilation -
 if native language support is desired.  Either disable native language support
 with:
        $ ./configure --disable-nls
 Or install gettext.  GNU gettext is available from
        http://ftp.gnu.org/gnu/gettext
-)
+])
 fi
 
 dnl Check for libdl, if we are doing dynamic loading
 DL_LIBS=""
+AC_SUBST([DYNAMIC_LOADING])
+DYNAMIC_LOADING=no
 if test "$enable_dynamic_loading" = yes; then
        AC_CHECK_LIB([dl], [dlopen],
                DL_LIBS="-ldl"
                PARTED_LIBS="$PARTED_LIBS -ldl"
+               DYNAMIC_LOADING=yes
                AC_DEFINE([DYNAMIC_LOADING], [1], [Lazy linking to fs libs]),
                AC_MSG_ERROR(
                        [-ldl not found!  Try using --disable-dynamic-loading]
@@ -240,17 +314,13 @@ AC_SUBST([DL_LIBS])
 dnl Check for libuuid
 UUID_LIBS=""
 AC_CHECK_LIB([uuid], [uuid_generate], [UUID_LIBS="-luuid"],
-       AC_MSG_ERROR(
-GNU Parted requires libuuid - a part of the e2fsprogs package (but
-sometimes distributed separately in uuid-devel or similar)
+       [AC_MSG_ERROR(dnl
+[GNU Parted requires libuuid - a part of the util-linux-ng package (but
+usually distributed separately in libuuid-devel, uuid-dev or similar)
 This can probably be found on your distribution's CD or FTP site or at:
-         http://web.mit.edu/tytso/www/linux/e2fsprogs.html
-Note: if you are using precompiled packages you will also need the development
-package as well (which may be called e2fsprogs-devel or something similar).
-If you compile e2fsprogs yourself then you need to do 'make install' and
-'make install-libs'.
-       )
-)
+    http://userweb.kernel.org/~kzak/util-linux-ng/
+Note: originally, libuuid was part of the e2fsprogs package.  Later, it
+moved to util-linux-ng-2.16, and that package is now the preferred source.])])
 AC_SUBST([UUID_LIBS])
 
 dnl Check for libdevmapper
@@ -258,8 +328,16 @@ DM_LIBS=
 if test $ENABLE_DEVICE_MAPPER = yes; then
   AC_CHECK_LIB([devmapper], [dm_task_create],
     [DM_LIBS=-ldevmapper],
-    [AC_MSG_ERROR([libdevmapper not found!  Try using --disable-device-mapper])
-      ])
+    [AC_MSG_ERROR(dnl
+[libdevmapper could not be found, but is required for the
+--enable-device-mapper option, which is enabled by default.  Either disable
+device-mapper support with --disable-device-mapper or download and install
+device-mapper from:
+       http://sources.redhat.com/dm/
+Note: if you are using precompiled packages you will need the development
+package as well (it may be called device-mapper-devel or something similar).]
+    )]
+  )
 fi
 AC_SUBST([DM_LIBS])
 
@@ -272,7 +350,7 @@ AC_SUBST([SELINUX_LIBS])
 
 dnl Check for libreiserfs
 REISER_LIBS=""
-if test "$enable_dynamic_loading" = no -a "$enable_discover_only" = no; then
+if test "$enable_dynamic_loading" = no && test "$enable_discover_only" = no; then
        OLD_LIBS="$LIBS"
        AC_CHECK_LIB([dal], [dal_equals],
                LIBS="-ldal"
@@ -293,18 +371,16 @@ if test "$with_readline" = yes; then
        OLD_LIBS="$LIBS"
        LIBS=""
        AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
-               PARTED_LIBS="$PARTED_LIBS $LIBS",
-               AC_MSG_ERROR(
-termcap could not be found which is required for the
+               [PARTED_LIBS="$PARTED_LIBS $LIBS"],
+               [AC_MSG_ERROR(dnl
+[termcap could not be found which is required for the
 --with-readline option (which is enabled by default).  Either disable readline
 support with --without-readline or download and install termcap from:
        ftp.gnu.org/gnu/termcap
 Note: if you are using precompiled packages you will also need the development
   package as well (which may be called termcap-devel or something similar).
 Note: (n)curses also seems to work as a substitute for termcap.  This was
-  not found either - but you could try installing that as well.
-)
-       )
+  not found either - but you could try installing that as well.])])
        LIBS="$OLD_LIBS"
 fi
 
@@ -319,13 +395,13 @@ if test "$with_readline" = yes; then
        AC_CHECK_LIB([readline], [readline],
                found_working_libreadline=yes,
                AC_MSG_ERROR(
-GNU Readline could not be found which is required for the
+[GNU Readline could not be found which is required for the
 --with-readline (which is enabled by default).  Either disable readline support with
 --without-readline or downloaded and install it from:
         ftp.gnu.org/gnu/readline
 Note: if you are using precompiled packages you will also need the development
 package as well (which may be called readline-devel or something similar).
-)
+])
                ,
                $PARTED_LIBS
        )
@@ -354,8 +430,8 @@ package as well (which may be called readline-devel or something similar).
        AC_CHECK_LIB([readline], [rl_variable_value],
                     ,
                     AC_MSG_ERROR(
-Your version of libreadline is too old to be used.
-Consider upgrading to version 5.2 or newer.)
+[Your version of libreadline is too old to be used.
+Consider upgrading to version 5.2 or newer.])
                     found_working_libreadline=no,
                     $PARTED_LIBS)
 
@@ -376,8 +452,8 @@ dnl libshouldbeinlibc
        AC_CHECK_LIB([shouldbeinlibc], [vm_deallocate],
                OS_LIBS="$OS_LIBS -lshouldbeinlibc",
                AC_MSG_ERROR(
-GNU Parted requires libshouldbeinlibc when running on
-GNU/Hurd systems.  It is a standard part of a GNU/Hurd system.
+[GNU Parted requires libshouldbeinlibc when running on
+GNU/Hurd systems.  It is a standard part of a GNU/Hurd system.]
                )
        )
 
@@ -392,8 +468,8 @@ dnl libstore
        AC_CHECK_LIB([store], [store_open],
                OS_LIBS="$OS_LIBS -lstore",
                AC_MSG_ERROR(
-GNU Parted requires libstore when running on GNU/Hurd
-systems.  It is a standard part of a GNU/Hurd system.
+[GNU Parted requires libstore when running on GNU/Hurd
+systems.  It is a standard part of a GNU/Hurd system.]
                )
                ,
                $OS_LIBS $UUID_LIBS $DM_LIBS $LIBS
@@ -420,16 +496,16 @@ AC_SUBST([INTLINCS])
 
 dnl Checks for header files.
 AC_CHECK_HEADER([uuid/uuid.h], ,
-       AC_MSG_ERROR(
-GNU Parted requires libuuid - a part of the e2fsprogs package.
+       [AC_MSG_ERROR(
+[GNU Parted requires libuuid - a part of the e2fsprogs package.
 You seem to have the library installed but not the headers.  These are usually
 found in a corresponding development package (usually called e2fsprogs-devel).
 If you can't find one try:
-        http://web.mit.edu/tytso/www/linux/e2fsprogs.html
-)
+        http://web.mit.edu/tytso/www/linux/e2fsprogs.html])]
 )
 
 AC_CHECK_HEADERS([getopt.h])
+AC_CHECK_HEADERS([linux/ext2_fs.h])
 
 dnl required for libparted/llseek.c  (TODO: make linux-x86 only)
 if test "$OS" = linux; then
@@ -438,15 +514,14 @@ fi
 
 if test "$with_readline" = yes; then
        AC_CHECK_HEADERS([readline/readline.h readline/history.h], ,
-               AC_MSG_ERROR(
-The headers for GNU Readline could not be found which
+               [AC_MSG_ERROR(
+[The headers for GNU Readline could not be found which
 are required for the --with-readline option.  You seem to have the GNU readline
 library installed but not the headers.  These are usually found in a
 corresponding development package (usually called readline-devel).  If you can't
 find one try:
         ftp.gnu.org/gnu/readline
-Alternatively you can disable readline support with --without-readline
-)
+Alternatively you can disable readline support with --without-readline])]
        )
 fi
 
@@ -454,13 +529,12 @@ AC_CHECK_HEADERS([termcap.h])
 
 if test "$USE_NLS" = yes; then
        AC_CHECK_HEADERS([wctype.h], ,
-               AC_MSG_ERROR(
-One or more of the header files that are required for
+               [AC_MSG_ERROR(
+[One or more of the header files that are required for
 native language support (wctype.h) could not be found.  Either get a newer
 version of GNU libc and its headers - which can be obtained from:
        ftp.gnu.org/gnu/glibc
-Or disable native language support with the --disable-nls option
-)
+Or disable native language support with the --disable-nls option])]
        )
 fi
 
@@ -472,6 +546,7 @@ AC_CHECK_HEADER([execinfo.h], [
 ])
 
 AM_CONDITIONAL([COMPILE_FOR_S390], [test "$host_cpu" = s390 || test "$host_cpu" = s390x])
+AM_CONDITIONAL([BUILD_LINUX], [test "$OS" = linux])
 
 dnl check for "check", unit testing library/header
 PKG_CHECK_MODULES([CHECK], [check >= 0.9.3], have_check=yes, have_check=no)
@@ -504,18 +579,24 @@ fi
 
 AC_CHECK_FUNCS([canonicalize_file_name])
 
-# CFLAGS="$CFLAGS -W -Wall -Wno-unused -Wno-switch -Wno-format"
-
-if test "$enable_Werror" = yes; then
-       CFLAGS="$CFLAGS -Werror"
-fi
-
 DATE=$(date '+%d %b %Y %H:%M')
 USER=$(whoami)
 HOST=$(hostname)
 BUILDINFO="$USER@$HOST, $DATE"
 AC_SUBST([BUILDINFO])
 
+LIB_BLKID=
+AC_SUBST([LIB_BLKID])
+pe_saved_libs=$LIBS
+  AC_SEARCH_LIBS([blkid_probe_get_topology], [blkid],
+    [test "$ac_cv_search_blkid_probe_get_topology" = "none required" \
+     || LIB_BLKID=$ac_cv_search_blkid_probe_get_topology])
+  AC_CHECK_FUNC([blkid_probe_get_topology], [use_blkid=1], [use_blkid=0])
+LIBS=$pe_saved_libs
+AC_DEFINE_UNQUOTED([USE_BLKID], [$use_blkid],
+  [Define if you have sufficient blkid support.])
+AC_CHECK_HEADERS_ONCE([blkid/blkid.h])
+
 AC_OUTPUT([
 Makefile
 lib/Makefile
@@ -534,6 +615,7 @@ libparted/fs/ntfs/Makefile
 libparted/fs/reiserfs/Makefile
 libparted/fs/ufs/Makefile
 libparted/fs/xfs/Makefile
+libparted/fs/nilfs2/Makefile
 libparted/tests/Makefile
 libparted.pc
 parted/Makefile
@@ -542,7 +624,6 @@ doc/Makefile
 doc/C/Makefile
 doc/pt_BR/Makefile
 debug/Makefile
-debug/clearfat/Makefile
 debug/test/Makefile
 tests/Makefile
 po/Makefile.in