### Checks for header files
AC_HEADER_ASSERT
-AC_HEADER_DIRENT
AC_HEADER_TIME
EFL_CHECK_PATH_MAX
-AC_CHECK_HEADERS([unistd.h libgen.h inttypes.h stdint.h sys/types.h siginfo.h])
+AC_CHECK_HEADERS([unistd.h libgen.h inttypes.h stdint.h sys/types.h siginfo.h strings.h sys/mman.h])
if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
EINA_CONFIGURE_HAVE_INTTYPES_H="#define EINA_HAVE_INTTYPES_H"
fi
AC_SUBST([EINA_CONFIGURE_HAVE_STDINT_H])
+if test "x${ac_cv_header_strings_h}" = "xyes" ; then
+ AC_DEFINE([HAVE_STRINGS_H], [1], [Define to 1 if you have the <strings.h> header file.])
+fi
+
+if test "x${ac_cv_header_sys_mman_h}" = "xyes" ; then
+ AC_DEFINE([HAVE_MMAN_H], [1], [Define to 1 if you have the <sys/mman.h> header file.])
+fi
+
### Checks for types
AC_CHECK_SIZEOF([wchar_t])
#endif
]])
-### Checks for structures
+### Check if dirent.h is usable
+AC_CHECK_TYPES([struct dirent], [have_dirent="yes"], [have_dirent="no"],
+ [[#include <dirent.h>
+ ]])
+
+if test "x${have_dirent_h}" = "xyes" ; then
+ EINA_CONFIGURE_HAVE_DIRENT_H="#define EINA_HAVE_DIRENT_H"
+ AC_DEFINE([HAVE_DIRENT_H], [1], [Define to 1 if you have a valid <dirent.h> header file.])
+fi
+AC_SUBST([EINA_CONFIGURE_HAVE_DIRENT_H])
### Checks for compiler characteristics
AC_C_CONST
@echo "#include <stdio.h>" >> eina_amalgamation.c
@echo "#include <stdlib.h>" >> eina_amalgamation.c
@echo "#include <string.h>" >> eina_amalgamation.c
- @echo "#include <dlfcn.h>" >> eina_amalgamation.c
+ @echo "#ifdef HAVE_DLOPEN" >> eina_amalgamation.c
+ @echo "# include <dlfcn.h>" >> eina_amalgamation.c
+ @echo "#endif" >> eina_amalgamation.c
@echo "#include <sys/types.h>" >> eina_amalgamation.c
- @echo "#include <dirent.h>" >> eina_amalgamation.c
+ @echo "#ifdef HAVE_DIRENT_H" >> eina_amalgamation.c
+ @echo "# include <dirent.h>" >> eina_amalgamation.c
+ @echo "#endif" >> eina_amalgamation.c
@echo "#include <assert.h>" >> eina_amalgamation.c
@echo "#include <errno.h>" >> eina_amalgamation.c
@echo "#include <fnmatch.h>" >> eina_amalgamation.c
+ @echo "#include <fcntl.h>" >> eina_amalgamation.c
@echo "#ifdef HAVE_EVIL" >> eina_amalgamation.c
@echo "# include <Evil.h>" >> eina_amalgamation.c
#include <string.h>
#include <stddef.h>
-#include <dirent.h>
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <sys/mman.h>
+#ifdef HAVE_MMAN_H
+# include <sys/mman.h>
+#endif
#include <fcntl.h>
#define PATH_DELIM '/'
#include "eina_list.h"
#include "eina_lock.h"
#include "eina_mmap.h"
+#include "eina_log.h"
#ifdef HAVE_ESCAPE_H
# include <Escape.h>
#define EINA_SMALL_PAGE 4096
# define EINA_HUGE_PAGE 16 * 1024 * 1024
+#ifdef HAVE_DIRENT_H
typedef struct _Eina_File_Iterator Eina_File_Iterator;
-typedef struct _Eina_File_Map Eina_File_Map;
-
struct _Eina_File_Iterator
{
Eina_Iterator iterator;
char dir[1];
};
+#endif
struct _Eina_File
{
Eina_Bool delete_me : 1;
};
+typedef struct _Eina_File_Map Eina_File_Map;
struct _Eina_File_Map
{
void *map;
* The code and description of the issue can be found at :
* http://womble.decadent.org.uk/readdir_r-advisory.html
*/
+#ifdef HAVE_DIRENT_H
static long
_eina_name_max(DIR *dirp)
{
return EINA_TRUE;
}
+#endif
static void
_eina_file_real_close(Eina_File *file)
EAPI Eina_Iterator *
eina_file_ls(const char *dir)
{
+#ifdef HAVE_DIRENT_H
Eina_File_Iterator *it;
size_t length;
it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_ls_iterator_free);
return &it->iterator;
+#else
+ (void) dir;
+ return NULL;
+#endif
}
EAPI Eina_Iterator *
eina_file_direct_ls(const char *dir)
{
+#ifdef HAVE_DIRENT_H
Eina_File_Direct_Iterator *it;
size_t length;
it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_direct_ls_iterator_free);
return &it->iterator;
+#else
+ (void) dir;
+ return NULL;
+#endif
}
EAPI Eina_Iterator *
eina_file_stat_ls(const char *dir)
{
+#ifdef HAVE_DIRENT_H
Eina_File_Direct_Iterator *it;
size_t length;
it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_direct_ls_iterator_free);
return &it->iterator;
+#else
+ (void) dir;
+ return NULL;
+#endif
}
EAPI Eina_File *
char *filename;
struct stat file_stat;
int fd = -1;
+#ifdef HAVE_EXECVP
int flags;
+#endif
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);
void *alloca (size_t);
#endif
-#include <strings.h>
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
#include <string.h>
#include <ctype.h>