--- 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 + 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])