Merge branch 'mr/autoconf-fread'

* mr/autoconf-fread:
  autoconf: Test FREAD_READS_DIRECTORIES
This commit is contained in:
Junio C Hamano 2008-03-14 00:27:59 -07:00
commit 5ad9db3d04
2 changed files with 21 additions and 0 deletions

View file

@ -46,4 +46,5 @@ NO_MKDTEMP=@NO_MKDTEMP@
NO_ICONV=@NO_ICONV@
OLD_ICONV=@OLD_ICONV@
NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
SNPRINTF_RETURNS_BOGUS=@SNPRINTF_RETURNS_BOGUS@

View file

@ -327,6 +327,26 @@ else
fi
AC_SUBST(NO_C99_FORMAT)
#
# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
# when attempting to read from an fopen'ed directory.
AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],
[ac_cv_fread_reads_directories],
[
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[[char c;
FILE *f = fopen(".", "r");
return f && fread(&c, 1, 1, f)]])],
[ac_cv_fread_reads_directories=no],
[ac_cv_fread_reads_directories=yes])
])
if test $ac_cv_fread_reads_directories = yes; then
FREAD_READS_DIRECTORIES=UnfortunatelyYes
else
FREAD_READS_DIRECTORIES=
fi
AC_SUBST(FREAD_READS_DIRECTORIES)
#
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
# or vsnprintf() return -1 instead of number of characters which would
# have been written to the final string if enough space had been available.