1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
--- configure.ac.orig 2018-11-07 18:12:55 UTC
+++ configure.ac
@@ -122,6 +122,33 @@ if test "$tX_threads" = "no"; then
AC_MSG_ERROR([** failed to detect pthreads implementation **])
fi
+AC_CHECK_FUNC(scandir,
+ if test "x$uname" = xSunOS -o "x$uname" = xQNX; then
+ AC_MSG_WARN(Not using $uname scandir emulation function.)
+ else
+ AC_DEFINE(HAVE_SCANDIR, 1, [Has scandir])
+ fi)
+
+dnl Do we have the POSIX compatible scandir() prototype?
+AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
+ ac_cv_cxx_scandir_posix,[
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([
+ #include <dirent.h>
+ int func (const char *d, dirent ***list, void *sort) {
+ int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
+ }
+ ],[
+ ], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
+ AC_LANG_RESTORE
+ ])
+
+if test "$ac_cv_cxx_scandir_posix" = yes; then
+ AC_DEFINE(HAVE_SCANDIR_POSIX, 1, [scandir conforms to POSIX])
+fi
+
+
AC_SEARCH_LIBS([dlclose], [dl])
|