aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMichal Rokos <michal.rokos@nextsoft.cz>2008-03-11 09:48:34 +0100
committerJunio C Hamano <gitster@pobox.com>2008-03-11 02:10:43 -0700
commit8ce1f243e5456eab52486b955389be2521dfcca5 (patch)
treee58ad41abd98a26bd62439d7a962f6f229d8b600 /configure.ac
parent50753d00d691c1ea16bc72446705aee2c128fc2f (diff)
downloadgit-8ce1f243e5456eab52486b955389be2521dfcca5.tar.gz
git-8ce1f243e5456eab52486b955389be2521dfcca5.tar.xz
autoconf: Test FREAD_READS_DIRECTORIES
Add test for FREAD_READS_DIRECTORIES to detect when fread() reads fopen'ed directory. Tested on these platforms: AIX 5.3 - FREAD_READS_DIRECTORIES=UnfortunatelyYes HP-UX B.11.11 - FREAD_READS_DIRECTORIES=UnfortunatelyYes HP-UX B.11.23 - FREAD_READS_DIRECTORIES=UnfortunatelyYes Linux 2.6.25-rc4 - FREAD_READS_DIRECTORIES= Tru64 V5.1 - FREAD_READS_DIRECTORIES=UnfortunatelyYes Windows - FREAD_READS_DIRECTORIES= Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz> Tested-by: Mike Ralphson <mike@abacus.co.uk> Tested-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac20
1 files changed, 20 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 287149d30..82584e915 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.