git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] autoconf: Test FREAD_READS_DIRECTORIES
@ 2008-03-05  8:39 Michal Rokos
  0 siblings, 0 replies; only message in thread
From: Michal Rokos @ 2008-03-05  8:39 UTC (permalink / raw)
  To: GIT

Add test for FREAD_READS_DIRECTORIES to configure script.

When "." could be opened and fread reads more than 0 items, 
FREAD_READS_DIRECTORIES will be set.

Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>

diff --git a/config.mak.in b/config.mak.in
index ee6c33d..516c468 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -46,3 +46,4 @@ NO_MKDTEMP=@NO_MKDTEMP@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@
+FREAD_READS_DIRECTORIES=@FREAD_READS_DIRECTORIES@
diff --git a/configure.ac b/configure.ac
index 85d7ef5..2deeb44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -326,6 +326,26 @@ else
 	NO_C99_FORMAT=
 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)
 
 
 ## Checks for library functions.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-05  8:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-05  8:39 [PATCH v4] autoconf: Test FREAD_READS_DIRECTORIES Michal Rokos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).