Skip to content

Commit

Permalink
2010-07-27 Tatsuhiro Tsujikawa <[email protected]>
Browse files Browse the repository at this point in the history
	Rewritten check for fallocate using AC_COMPILE_IFELSE.
	* configure.ac
	* m4/fallocate.m4
  • Loading branch information
tatsuhiro-t committed Jul 27, 2010
1 parent 253c0ba commit 27e9687
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 34 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2010-07-27 Tatsuhiro Tsujikawa <[email protected]>

Rewritten check for fallocate using AC_COMPILE_IFELSE.
* configure.ac
* m4/fallocate.m4

2010-07-26 Tatsuhiro Tsujikawa <[email protected]>

Fixed the bug that HAVE_SOME_FALLOCATE gets undefined if fallocate
Expand Down
10 changes: 5 additions & 5 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
37 changes: 29 additions & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
10 changes: 5 additions & 5 deletions doc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions lib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
17 changes: 17 additions & 0 deletions m4/fallocate.m4
Original file line number Diff line number Diff line change
@@ -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
])
10 changes: 5 additions & 5 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 27e9687

Please sign in to comment.