<commit_before>Index: src/scandir.c
===================================================================
--- src/scandir.c	(revision 9266)
+++ src/scandir.c	(working copy)
@@ -52,7 +52,6 @@
 #    if defined(__GNUC__)
 #      warning Attempting to use the deprecated scandir() replacement function
 #    endif /*__GNUC__*/
-#    error No compatible scandir implementation found (STR 2687 applies!)

 #  endif /* !HAVE_SCANDIR */
 #endif
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision 9266)
+++ src/CMakeLists.txt	(working copy)
@@ -220,7 +220,7 @@
 endif(MSVC)

 if(USE_THREADS)
-   target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT})
+   target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT} -ldl)
 endif(USE_THREADS)

 if(USE_X11)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 9266)
+++ CMakeLists.txt	(working copy)
@@ -168,7 +168,10 @@
 CHECK_FUNCTION_EXISTS(png_get_valid          HAVE_PNG_GET_VALID)
 CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha  HAVE_PNG_SET_TRNS_TO_ALPHA)

-CHECK_FUNCTION_EXISTS(scandir                HAVE_SCANDIR)
+if(NOT APPLE)
+  CHECK_FUNCTION_EXISTS(scandir                HAVE_SCANDIR)
+endif()
+
 CHECK_FUNCTION_EXISTS(snprintf               HAVE_SNPRINTF)

 # not really true but we convert strcasecmp calls to _stricmp calls in flstring.h
@@ -316,6 +319,7 @@
 #######################################################################
 if(APPLE)
    option(OPTION_APPLE_X11 "use X11" OFF)
+   set(HAVE_SCANDIR 1 CACHE INTERNAL "")
 endif(APPLE)

 if(NOT APPLE OR OPTION_APPLE_X11)
Index: filename_list.cxx
===================================================================
--- filename_list.cxx	(revision 9266)
+++ filename_list.cxx	(working copy)
@@ -110,7 +110,7 @@
   // The vast majority of UNIX systems want the sort function to have this
   // prototype, most likely so that it can be passed to qsort without any
   // changes:
-  int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort);
+  int n = scandir(dirloc, list, 0, (int(*)(const dirent**,const dirent**))sort);<commit_msg>BUG: Incorrect path to target file<commit_after>Index: src/scandir.c
===================================================================
--- src/scandir.c	(revision 9266)
+++ src/scandir.c	(working copy)
@@ -52,7 +52,6 @@
 #    if defined(__GNUC__)
 #      warning Attempting to use the deprecated scandir() replacement function
 #    endif /*__GNUC__*/
-#    error No compatible scandir implementation found (STR 2687 applies!)

 #  endif /* !HAVE_SCANDIR */
 #endif
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt	(revision 9266)
+++ src/CMakeLists.txt	(working copy)
@@ -220,7 +220,7 @@
 endif(MSVC)

 if(USE_THREADS)
-   target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT})
+   target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT} -ldl)
 endif(USE_THREADS)

 if(USE_X11)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 9266)
+++ CMakeLists.txt	(working copy)
@@ -168,7 +168,10 @@
 CHECK_FUNCTION_EXISTS(png_get_valid          HAVE_PNG_GET_VALID)
 CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha  HAVE_PNG_SET_TRNS_TO_ALPHA)

-CHECK_FUNCTION_EXISTS(scandir                HAVE_SCANDIR)
+if(NOT APPLE)
+  CHECK_FUNCTION_EXISTS(scandir                HAVE_SCANDIR)
+endif()
+
 CHECK_FUNCTION_EXISTS(snprintf               HAVE_SNPRINTF)

 # not really true but we convert strcasecmp calls to _stricmp calls in flstring.h
@@ -316,6 +319,7 @@
 #######################################################################
 if(APPLE)
    option(OPTION_APPLE_X11 "use X11" OFF)
+   set(HAVE_SCANDIR 1 CACHE INTERNAL "")
 endif(APPLE)

 if(NOT APPLE OR OPTION_APPLE_X11)
Index: filename_list.cxx
===================================================================
--- src/filename_list.cxx	(revision 9266)
+++ src/filename_list.cxx	(working copy)
@@ -110,7 +110,7 @@
   // The vast majority of UNIX systems want the sort function to have this
   // prototype, most likely so that it can be passed to qsort without any
   // changes:
-  int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort);
+  int n = scandir(dirloc, list, 0, (int(*)(const dirent**,const dirent**))sort);
{'fraction_non_alphanumeric': 0.25947786606129397, 'fraction_numerical': 0.03178206583427923, 'mean_word_length': 4.938005390835579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '877228', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1416, 'n_words': 322}