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

Rewritten check for fallocate using AC_COMPILE_IFELSE.
	* configure.ac
	* m4/fallocate.m4
pull/1/head
Tatsuhiro Tsujikawa 2010-07-27 14:37:25 +00:00
parent 253c0ba353
commit 27e96877b7
10 changed files with 79 additions and 34 deletions

View File

@ -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> 2010-07-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that HAVE_SOME_FALLOCATE gets undefined if fallocate Fixed the bug that HAVE_SOME_FALLOCATE gets undefined if fallocate

View File

@ -46,11 +46,11 @@ DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \ $(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \ $(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/inttypes-pri.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/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \

1
aclocal.m4 vendored
View File

@ -952,6 +952,7 @@ AC_SUBST([am__untar])
m4_include([m4/aria2_arg.m4]) m4_include([m4/aria2_arg.m4])
m4_include([m4/codeset.m4]) m4_include([m4/codeset.m4])
m4_include([m4/cppunit.m4]) m4_include([m4/cppunit.m4])
m4_include([m4/fallocate.m4])
m4_include([m4/gettext.m4]) m4_include([m4/gettext.m4])
m4_include([m4/glibc2.m4]) m4_include([m4/glibc2.m4])
m4_include([m4/glibc21.m4]) m4_include([m4/glibc21.m4])

35
configure vendored
View File

@ -14793,16 +14793,37 @@ _ACEOF
fi fi
done done
for ac_func in fallocate
do : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fallocate" >&5
ac_fn_cxx_check_func "$LINENO" "fallocate" "ac_cv_func_fallocate" $as_echo_n "checking for fallocate... " >&6; }
if test "x$ac_cv_func_fallocate" = x""yes; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat >>confdefs.h <<_ACEOF /* end confdefs.h. */
#define HAVE_FALLOCATE 1
#include <fcntl.h>
int
main ()
{
fallocate(2, 0, 0, 4096);
;
return 0;
}
_ACEOF _ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
have_fallocate=yes 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 fi
done
if test "x$have_posix_fallocate" = "xyes" || if test "x$have_posix_fallocate" = "xyes" ||
test "x$have_fallocate" = "xyes"; then test "x$have_fallocate" = "xyes"; then

View File

@ -356,7 +356,7 @@ fi
AM_CONDITIONAL([HAVE_EPOLL], [test "x$have_epoll" = "xyes"]) AM_CONDITIONAL([HAVE_EPOLL], [test "x$have_epoll" = "xyes"])
AC_CHECK_FUNCS([posix_fallocate],[have_posix_fallocate=yes]) 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" || if test "x$have_posix_fallocate" = "xyes" ||
test "x$have_fallocate" = "xyes"; then test "x$have_fallocate" = "xyes"; then
AC_DEFINE([HAVE_SOME_FALLOCATE], [1], AC_DEFINE([HAVE_SOME_FALLOCATE], [1],

View File

@ -41,11 +41,11 @@ DIST_COMMON = $(dist_doc_DATA) $(dist_doc_xmlrpc_DATA) \
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \ $(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \ $(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/inttypes-pri.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/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \

View File

@ -39,11 +39,11 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \ $(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \ $(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/inttypes-pri.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/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \

17
m4/fallocate.m4 Normal file
View File

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

View File

@ -289,11 +289,11 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \ $(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \ $(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/inttypes-pri.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/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \

View File

@ -157,11 +157,11 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \ $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cppunit.m4 \
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \ $(top_srcdir)/m4/fallocate.m4 $(top_srcdir)/m4/gettext.m4 \
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \ $(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
$(top_srcdir)/m4/inttypes-pri.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/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcares.m4 \