1 AC_CACHE_CHECK([for broken readdir],libreplace_cv_READDIR_NEEDED,[
3 #define test_readdir_os2_delete main
4 #include "$libreplacedir/test/os2_delete.c"],
5 [libreplace_cv_READDIR_NEEDED=no],
6 [libreplace_cv_READDIR_NEEDED=yes],
7 [libreplace_cv_READDIR_NEEDED="assuming not"])
11 # try to replace with getdirentries() if needed
13 if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
14 AC_CHECK_FUNCS(getdirentries)
15 AC_VERIFY_C_PROTOTYPE([long telldir(const DIR *dir)],
19 AC_DEFINE(TELLDIR_TAKES_CONST_DIR, 1, [Whether telldir takes a const pointer])
24 AC_VERIFY_C_PROTOTYPE([int seekdir(DIR *dir, long ofs)],
28 AC_DEFINE(SEEKDIR_RETURNS_INT, 1, [Whether seekdir returns an int])
32 AC_CACHE_CHECK([for replacing readdir using getdirentries()],libreplace_cv_READDIR_GETDIRENTRIES,[
34 #define _LIBREPLACE_REPLACE_H
35 #include "$libreplacedir/repdir_getdirentries.c"
36 #define test_readdir_os2_delete main
37 #include "$libreplacedir/test/os2_delete.c"],
38 [libreplace_cv_READDIR_GETDIRENTRIES=yes],
39 [libreplace_cv_READDIR_GETDIRENTRIES=no])
42 if test x"$libreplace_cv_READDIR_GETDIRENTRIES" = x"yes"; then
43 AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
44 AC_DEFINE(REPLACE_READDIR_GETDIRENTRIES,1,[replace readdir using getdirentries()])
45 LIBREPLACEOBJ="${LIBREPLACEOBJ} repdir_getdirentries.o"
46 libreplace_cv_READDIR_NEEDED=no
50 # try to replace with getdents() if needed
52 if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
53 AC_CHECK_FUNCS(getdents)
54 AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_cv_READDIR_GETDENTS,[
56 #define _LIBREPLACE_REPLACE_H
57 #error _donot_use_getdents_replacement_anymore
58 #include "$libreplacedir/repdir_getdents.c"
59 #define test_readdir_os2_delete main
60 #include "$libreplacedir/test/os2_delete.c"],
61 [libreplace_cv_READDIR_GETDENTS=yes],
62 [libreplace_cv_READDIR_GETDENTS=no])
65 if test x"$libreplace_cv_READDIR_GETDENTS" = x"yes"; then
66 AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
67 AC_DEFINE(REPLACE_READDIR_GETDENTS,1,[replace readdir using getdents()])
68 LIBREPLACEOBJ="${LIBREPLACEOBJ} repdir_getdents.o"
69 libreplace_cv_READDIR_NEEDED=no
72 AC_MSG_CHECKING([a usable readdir()])
73 if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
75 AC_MSG_WARN([the provided readdir() is broken])