Bläddra i källkod

2010-07-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Rewritten check for fallocate using AC_COMPILE_IFELSE.
	* configure.ac
	* m4/fallocate.m4
Tatsuhiro Tsujikawa 15 år sedan
förälder
incheckning
27e96877b7
10 ändrade filer med 79 tillägg och 34 borttagningar
  1. 6 0
      ChangeLog
  2. 5 5
      Makefile.in
  3. 1 0
      aclocal.m4
  4. 29 8
      configure
  5. 1 1
      configure.ac
  6. 5 5
      doc/Makefile.in
  7. 5 5
      lib/Makefile.in
  8. 17 0
      m4/fallocate.m4
  9. 5 5
      src/Makefile.in
  10. 5 5
      test/Makefile.in

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2010-07-27  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Rewritten check for fallocate using AC_COMPILE_IFELSE.
+	* configure.ac
+	* m4/fallocate.m4
+
 2010-07-26  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Fixed the bug that HAVE_SOME_FALLOCATE gets undefined if fallocate

+ 5 - 5
Makefile.in

@@ -46,11 +46,11 @@ DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
 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 \

+ 1 - 0
aclocal.m4

@@ -952,6 +952,7 @@ AC_SUBST([am__untar])
 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])

+ 29 - 8
configure

@@ -14793,16 +14793,37 @@ _ACEOF
 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
+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
-done
 
 if test "x$have_posix_fallocate" = "xyes" ||
    test "x$have_fallocate" = "xyes"; then

+ 1 - 1
configure.ac

@@ -356,7 +356,7 @@ fi
 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],

+ 5 - 5
doc/Makefile.in

@@ -41,11 +41,11 @@ DIST_COMMON = $(dist_doc_DATA) $(dist_doc_xmlrpc_DATA) \
 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 \

+ 5 - 5
lib/Makefile.in

@@ -39,11 +39,11 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 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 \

+ 17 - 0
m4/fallocate.m4

@@ -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
+])

+ 5 - 5
src/Makefile.in

@@ -289,11 +289,11 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c
 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 \

+ 5 - 5
test/Makefile.in

@@ -157,11 +157,11 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 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 \