summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-14 07:27:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-03-14 07:27:59 (GMT)
commit5ad9db3d040bf77031958c8f51a0106818119617 (patch)
treec8927949dc4581a659e9c7231fb2a029c30ddbb7
parent16007f3916b885d29de6c48832aa6a4213ab7588 (diff)
parent8ce1f243e5456eab52486b955389be2521dfcca5 (diff)
downloadgit-5ad9db3d040bf77031958c8f51a0106818119617.zip
git-5ad9db3d040bf77031958c8f51a0106818119617.tar.gz
git-5ad9db3d040bf77031958c8f51a0106818119617.tar.bz2
Merge branch 'mr/autoconf-fread'
* mr/autoconf-fread: autoconf: Test FREAD_READS_DIRECTORIES
-rw-r--r--config.mak.in1
-rw-r--r--configure.ac20
2 files changed, 21 insertions, 0 deletions
diff --git a/config.mak.in b/config.mak.in
index 8e1cd5f..7868dfd 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -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@
diff --git a/configure.ac b/configure.ac
index 287149d..82584e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.