eina: improve system header detection.

SVN revision: 65900
This commit is contained in:
Cedric BAIL 2011-12-05 13:57:10 +00:00
parent 30af9a785f
commit 1561954c05
4 changed files with 58 additions and 10 deletions

View File

@ -355,10 +355,9 @@ AM_CONDITIONAL([BUILD_TILER_EXAMPLE], [test "x${build_tiler_example}" = "xyes"])
### 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"
@ -372,6 +371,14 @@ if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
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])
@ -384,8 +391,17 @@ AC_CHECK_TYPES([siginfo_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

View File

@ -130,12 +130,17 @@ eina_amalgamation.c: $(base_sources) Makefile
@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

View File

@ -40,11 +40,15 @@ void *alloca (size_t);
#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 '/'
@ -60,6 +64,7 @@ void *alloca (size_t);
#include "eina_list.h"
#include "eina_lock.h"
#include "eina_mmap.h"
#include "eina_log.h"
#ifdef HAVE_ESCAPE_H
# include <Escape.h>
@ -95,9 +100,8 @@ void *alloca (size_t);
#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;
@ -107,6 +111,7 @@ struct _Eina_File_Iterator
char dir[1];
};
#endif
struct _Eina_File
{
@ -134,6 +139,7 @@ struct _Eina_File
Eina_Bool delete_me : 1;
};
typedef struct _Eina_File_Map Eina_File_Map;
struct _Eina_File_Map
{
void *map;
@ -156,6 +162,7 @@ static int _eina_file_log_dom = -1;
* 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)
{
@ -390,6 +397,7 @@ _eina_file_stat_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data)
return EINA_TRUE;
}
#endif
static void
_eina_file_real_close(Eina_File *file)
@ -738,6 +746,7 @@ eina_file_split(char *path)
EAPI Eina_Iterator *
eina_file_ls(const char *dir)
{
#ifdef HAVE_DIRENT_H
Eina_File_Iterator *it;
size_t length;
@ -773,11 +782,16 @@ eina_file_ls(const char *dir)
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;
@ -825,11 +839,16 @@ eina_file_direct_ls(const char *dir)
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;
@ -877,6 +896,10 @@ eina_file_stat_ls(const char *dir)
it->iterator.free = FUNC_ITERATOR_FREE(_eina_file_direct_ls_iterator_free);
return &it->iterator;
#else
(void) dir;
return NULL;
#endif
}
EAPI Eina_File *
@ -887,7 +910,9 @@ eina_file_open(const char *path, Eina_Bool shared)
char *filename;
struct stat file_stat;
int fd = -1;
#ifdef HAVE_EXECVP
int flags;
#endif
EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL);

View File

@ -38,7 +38,9 @@ extern "C"
void *alloca (size_t);
#endif
#include <strings.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <string.h>
#include <ctype.h>