autoconf: Test FREAD_READS_DIRECTORIES
PATCH v5 1/1 autoconf: Test FREAD_READS_DIRECTORIES
Add test for FREAD_READS_DIRECTORIES to detect when fread() reads fopen'ed directory.
Signed-off-by Michal Rokos <[email protected]>
Tested-by Johannes Schindelin <[email protected]>
Tested-by Mike Ralphson <[email protected]>
config.mak.in +1 -0
@@ -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@
configure.ac +20 -0
@@ -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.
Hi,
Quoted 5 lines · Michal Rokos
Add test for
FREAD_READS_DIRECTORIESto detect whenfread()reads fopen'ed directory.Signed-off-by Michal Rokos <[email protected]>Tested-by Johannes Schindelin <[email protected]>
Umm... technically, you are correct, but because of that libsocket bug, it did not work...
Ciao,
Dscho