source: branches/samba-3.5.x/lib/replace/repdir.m4@ 778

Last change on this file since 778 was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 2.5 KB
Line 
1AC_CACHE_CHECK([for broken readdir],libreplace_cv_READDIR_NEEDED,[
2 AC_TRY_RUN([
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"])
8])
9
10AC_CHECK_FUNCS(dirfd)
11AC_HAVE_DECL(dirfd, [#include <dirent.h>])
12
13#
14# try to replace with getdirentries() if needed
15#
16if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
17AC_CHECK_FUNCS(getdirentries)
18AC_VERIFY_C_PROTOTYPE([long telldir(const DIR *dir)],
19 [
20 return 0;
21 ],[
22 AC_DEFINE(TELLDIR_TAKES_CONST_DIR, 1, [Whether telldir takes a const pointer])
23 ],[],[
24 #include <dirent.h>
25 ])
26
27AC_VERIFY_C_PROTOTYPE([int seekdir(DIR *dir, long ofs)],
28 [
29 return 0;
30 ],[
31 AC_DEFINE(SEEKDIR_RETURNS_INT, 1, [Whether seekdir returns an int])
32 ],[],[
33 #include <dirent.h>
34 ])
35AC_CACHE_CHECK([for replacing readdir using getdirentries()],libreplace_cv_READDIR_GETDIRENTRIES,[
36 AC_TRY_RUN([
37#define _LIBREPLACE_REPLACE_H
38#include "$libreplacedir/repdir_getdirentries.c"
39#define test_readdir_os2_delete main
40#include "$libreplacedir/test/os2_delete.c"],
41 [libreplace_cv_READDIR_GETDIRENTRIES=yes],
42 [libreplace_cv_READDIR_GETDIRENTRIES=no])
43])
44fi
45if test x"$libreplace_cv_READDIR_GETDIRENTRIES" = x"yes"; then
46 AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
47 AC_DEFINE(REPLACE_READDIR_GETDIRENTRIES,1,[replace readdir using getdirentries()])
48 LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdirentries.o"
49 libreplace_cv_READDIR_NEEDED=no
50fi
51
52#
53# try to replace with getdents() if needed
54#
55if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
56AC_CHECK_FUNCS(getdents)
57AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_cv_READDIR_GETDENTS,[
58 AC_TRY_RUN([
59#define _LIBREPLACE_REPLACE_H
60#error _donot_use_getdents_replacement_anymore
61#include "$libreplacedir/repdir_getdents.c"
62#define test_readdir_os2_delete main
63#include "$libreplacedir/test/os2_delete.c"],
64 [libreplace_cv_READDIR_GETDENTS=yes],
65 [libreplace_cv_READDIR_GETDENTS=no])
66])
67fi
68if test x"$libreplace_cv_READDIR_GETDENTS" = x"yes"; then
69 AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
70 AC_DEFINE(REPLACE_READDIR_GETDENTS,1,[replace readdir using getdents()])
71 LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/repdir_getdents.o"
72 libreplace_cv_READDIR_NEEDED=no
73fi
74
75AC_MSG_CHECKING([a usable readdir()])
76if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
77 AC_MSG_RESULT(no)
78 AC_MSG_WARN([the provided readdir() is broken])
79else
80 AC_MSG_RESULT(yes)
81fi
Note: See TracBrowser for help on using the repository browser.