-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I think build fails because Debian sid alpha's /usr/include/bits/fcntl.h
lacks fallocate prototype.

I committed the change to rewrite check for fallocate to see the
compiler can compile code using fallocate instead of simple
AC_CHECK_FUNCS([fallocate]).

http://aria2.svn.sourceforge.net/viewvc/aria2?revision=2289&view=revision

Patch attached.

Best regards,

Tatsuhiro Tsujikawa
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxO8KEACgkQfoQD1dZzw2YkNgCgvVJw1vQiOT7NIvwz6J7+FK6y
GK4AoNsbkLYm8zXSKkgk852Qrg93G1mD
=RnC6
-----END PGP SIGNATURE-----
Index: test/Makefile.in
===================================================================
--- test/Makefile.in	(revision 2288)
+++ test/Makefile.in	(revision 2289)
@@ -157,11 +157,11 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
 	$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
-	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
-	$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
-	$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
-	$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
-	$(top_srcdir)/m4/inttypes-pri.m4 \
+	$(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
+	$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
+	$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+	$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
 	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
 	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
 	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \
Index: m4/fallocate.m4
===================================================================
--- m4/fallocate.m4	(revision 0)
+++ m4/fallocate.m4	(revision 2289)
@@ -0,0 +1,17 @@
+AC_DEFUN([ARIA2_CHECK_FALLOCATE],
+[
+AC_MSG_CHECKING([for fallocate])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <fcntl.h>
+]],
+[[
+fallocate(2, 0, 0, 4096);
+]])],
+[have_fallocate=yes],
+[have_fallocate=no])
+AC_MSG_RESULT([$have_fallocate])
+if test "x$have_fallocate" = "xyes"; then
+  AC_DEFINE([HAVE_FALLOCATE], [1],
+            [Define to 1 if you have the `fallocate' function.])
+fi
+])
Index: configure
===================================================================
--- configure	(revision 2288)
+++ configure	(revision 2289)
@@ -14793,17 +14793,38 @@
 fi
 done
 
-for ac_func in fallocate
-do :
-  ac_fn_cxx_check_func "$LINENO" "fallocate" "ac_cv_func_fallocate"
-if test "x$ac_cv_func_fallocate" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_FALLOCATE 1
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fallocate" >&5
+$as_echo_n "checking for fallocate... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <fcntl.h>
+
+int
+main ()
+{
+
+fallocate(2, 0, 0, 4096);
+
+  ;
+  return 0;
+}
 _ACEOF
- have_fallocate=yes
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  have_fallocate=yes
+else
+  have_fallocate=no
 fi
-done
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_fallocate" >&5
+$as_echo "$have_fallocate" >&6; }
+if test "x$have_fallocate" = "xyes"; then
 
+$as_echo "#define HAVE_FALLOCATE 1" >>confdefs.h
+
+fi
+
 if test "x$have_posix_fallocate" = "xyes" ||
    test "x$have_fallocate" = "xyes"; then
 
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 2288)
+++ Makefile.in	(revision 2289)
@@ -46,11 +46,11 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
 	$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
-	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
-	$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
-	$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
-	$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
-	$(top_srcdir)/m4/inttypes-pri.m4 \
+	$(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
+	$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
+	$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+	$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
 	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
 	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
 	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \
Index: src/Makefile.in
===================================================================
--- src/Makefile.in	(revision 2288)
+++ src/Makefile.in	(revision 2289)
@@ -289,11 +289,11 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
 	$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
-	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
-	$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
-	$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
-	$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
-	$(top_srcdir)/m4/inttypes-pri.m4 \
+	$(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
+	$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
+	$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+	$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
 	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
 	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
 	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2288)
+++ ChangeLog	(revision 2289)
@@ -1,3 +1,9 @@
+2010-07-27  Tatsuhiro Tsujikawa  <t-tujik...@users.sourceforge.net>
+
+	Rewritten check for fallocate using AC_COMPILE_IFELSE.
+	* configure.ac
+	* m4/fallocate.m4
+
 2010-07-26  Tatsuhiro Tsujikawa  <t-tujik...@users.sourceforge.net>
 
 	Fixed the bug that HAVE_SOME_FALLOCATE gets undefined if fallocate
Index: configure.ac
===================================================================
--- configure.ac	(revision 2288)
+++ configure.ac	(revision 2289)
@@ -356,7 +356,7 @@
 AM_CONDITIONAL([HAVE_EPOLL], [test "x$have_epoll" = "xyes"])
 
 AC_CHECK_FUNCS([posix_fallocate],[have_posix_fallocate=yes])
-AC_CHECK_FUNCS([fallocate], [have_fallocate=yes])
+ARIA2_CHECK_FALLOCATE
 if test "x$have_posix_fallocate" = "xyes" ||
    test "x$have_fallocate" = "xyes"; then
   AC_DEFINE([HAVE_SOME_FALLOCATE], [1],
Index: doc/Makefile.in
===================================================================
--- doc/Makefile.in	(revision 2288)
+++ doc/Makefile.in	(revision 2289)
@@ -41,11 +41,11 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
 	$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
-	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
-	$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
-	$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
-	$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
-	$(top_srcdir)/m4/inttypes-pri.m4 \
+	$(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
+	$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
+	$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+	$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
 	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
 	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
 	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \
Index: lib/Makefile.in
===================================================================
--- lib/Makefile.in	(revision 2288)
+++ lib/Makefile.in	(revision 2289)
@@ -39,11 +39,11 @@
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
 	$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
-	$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
-	$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
-	$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
-	$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
-	$(top_srcdir)/m4/inttypes-pri.m4 \
+	$(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
+	$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
+	$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
+	$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+	$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
 	$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
 	$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
 	$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \
Index: aclocal.m4
===================================================================
--- aclocal.m4	(revision 2288)
+++ aclocal.m4	(revision 2289)
@@ -952,6 +952,7 @@
 m4_include([m4/aria2_arg.m4])
 m4_include([m4/codeset.m4])
 m4_include([m4/cppunit.m4])
+m4_include([m4/fallocate.m4])
 m4_include([m4/gettext.m4])
 m4_include([m4/glibc2.m4])
 m4_include([m4/glibc21.m4])

Reply via email to