Author: AlbrechtS
Date: 2009-07-23 16:08:12 -0700 (Thu, 23 Jul 2009)
New Revision: 6834
Log:
Fixed glibc 2.10 compiler problems (Fedora 11 and others) with scandir()
(STR #2202, #2205, #2223).


Modified:
   trunk/CHANGES
   trunk/configh.in
   trunk/configure.in
   trunk/src/filename_list.cxx

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES       2009-07-23 22:51:56 UTC (rev 6833)
+++ trunk/CHANGES       2009-07-23 23:08:12 UTC (rev 6834)
@@ -2571,5 +2571,10 @@
   default Window::layout() method yet still do the operating system
   stuff needed to resize the window. Only tested on X11.
 
+////////////////////////////////////////////////////////////////
 
+Fixed glibc 2.10 compiler problems (Fedora 11 and others) with scandir()
+(STR #2202, #2205, #2223)
 
+
+

Modified: trunk/configh.in
===================================================================
--- trunk/configh.in    2009-07-23 22:51:56 UTC (rev 6833)
+++ trunk/configh.in    2009-07-23 23:08:12 UTC (rev 6834)
@@ -182,6 +182,7 @@
 #undef HAVE_SYS_DIR_H
 #undef HAVE_NDIR_H
 #undef HAVE_SCANDIR
+#undef HAVE_SCANDIR_POSIX
 
 /* If not set fltk will define it's own versions of these string
    functions. By including the fltk/string.h header file you will

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in  2009-07-23 22:51:56 UTC (rev 6833)
+++ trunk/configure.in  2009-07-23 23:08:12 UTC (rev 6834)
@@ -333,6 +333,25 @@
         AC_DEFINE(HAVE_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)
+fi
+
 dnl String headers and functions...
 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))

Modified: trunk/src/filename_list.cxx
===================================================================
--- trunk/src/filename_list.cxx 2009-07-23 22:51:56 UTC (rev 6833)
+++ trunk/src/filename_list.cxx 2009-07-23 23:08:12 UTC (rev 6834)
@@ -62,11 +62,11 @@
   // This version is when we define our own scandir (WIN32 and perhaps
   // some Unix systems):
   int n = scandir(d, list, 0, sort);
+#elif defined(HAVE_SCANDIR_POSIX)
+  // POSIX (2008) defines the comparison function like this:
+  int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
 #elif defined(__linux) || defined (__FreeBSD__) || defined (__NetBSD__)
   int n = scandir(d, list, 0, (int(*)(const void*,const void*))sort);
-#elif defined(__hpux) || defined(__CYGWIN__)
-  // HP-UX, Cygwin define the comparison function like this:
-  int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
 #elif defined(__osf__) || defined(__sgi)
   // OSF, DU 4.0x
   int n = scandir(d, list, 0, (int(*)(dirent **, dirent **))sort);

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to