forked from enlightenment/efl
Eina: fix shm_open() check (can be in libc or librt) + various autotools cleaning
This works in linux and windows, and should fix shm_detection on BSD (including Mac) BSD, Mac and solaris users : please check that it compiles and shm_open is detected SVN revision: 69608
This commit is contained in:
parent
13f1bc5049
commit
f00cf44117
|
@ -260,6 +260,7 @@ AM_CONDITIONAL(EINA_ENABLE_BENCHMARK_E17, test "x${enable_benchmark_e17}" = "xye
|
|||
|
||||
### Checks for programs
|
||||
AC_PROG_CC
|
||||
#for src/tests...
|
||||
AC_PROG_CXX
|
||||
|
||||
# pkg-config
|
||||
|
@ -309,12 +310,12 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# Evil library for compilation on Windows CE
|
||||
# Evil library for compilation on Windows
|
||||
|
||||
EFL_EINA_BUILD=""
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
PKG_CHECK_MODULES([EVIL], [evil >= 1.0.0])
|
||||
PKG_CHECK_EXISTS([EVIL], [evil >= 1.0.0])
|
||||
AC_DEFINE([HAVE_EVIL], [1], [Set to 1 if evil package is installed])
|
||||
requirement_eina="${requirement_eina} evil"
|
||||
EFL_EINA_BUILD="-DEFL_EINA_BUILD"
|
||||
|
@ -322,6 +323,35 @@ case "$host_os" in
|
|||
esac
|
||||
AC_SUBST([EFL_EINA_BUILD])
|
||||
|
||||
# Checks for portability layer
|
||||
|
||||
PKG_CHECK_MODULES([EXOTIC],
|
||||
[exotic],
|
||||
[enable_exotic="yes"],
|
||||
[enable_exotic="no"])
|
||||
|
||||
if test "x${enable_exotic}" = "xyes"; then
|
||||
requirement_eina="exotic ${requirement_eina}"
|
||||
EINA_CFLAGS="${EINA_CFLAGS} ${EXOTIC_CFLAGS}"
|
||||
EINA_LIBS="${EXOTIC_LIBS}"
|
||||
|
||||
EINA_CONFIGURE_HAVE_EXOTIC="#define EINA_HAVE_EXOTIC"
|
||||
AC_DEFINE([HAVE_EXOTIC_H], [1], [Define to 1 if you have Exotic.])
|
||||
fi
|
||||
AM_CONDITIONAL([EINA_HAVE_EXOTIC], [test "x${enable_exotic}" = "xyes"])
|
||||
AC_SUBST([EINA_CONFIGURE_HAVE_EXOTIC])
|
||||
|
||||
case "$host_vendor" in
|
||||
ps3*)
|
||||
PKG_CHECK_MODULES([ESCAPE], [escape])
|
||||
AC_DEFINE(HAVE_ESCAPE, 1, [Set to 1 if Escape package is installed])
|
||||
requirement_eina="${requirement_eina} escape"
|
||||
EINA_CFLAGS="${ESCAPE_CFLAGS} ${EINA_CFLAGS}"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST([EINA_CFLAGS])
|
||||
|
||||
# Check ememoa memory pool library
|
||||
|
||||
AC_ARG_ENABLE([ememoa],
|
||||
|
@ -352,8 +382,56 @@ PKG_CHECK_MODULES([ECORE_EVAS],
|
|||
|
||||
AM_CONDITIONAL([BUILD_TILER_EXAMPLE], [test "x${build_tiler_example}" = "xyes"])
|
||||
|
||||
### Checks for header files
|
||||
AC_HEADER_ASSERT
|
||||
AC_HEADER_TIME
|
||||
AC_HEADER_DIRENT
|
||||
|
||||
AC_CHECK_HEADERS([unistd.h libgen.h inttypes.h stdint.h sys/types.h siginfo.h strings.h sys/mman.h execinfo.h mcheck.h])
|
||||
|
||||
if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
|
||||
EINA_CONFIGURE_HAVE_INTTYPES_H="#define EINA_HAVE_INTTYPES_H"
|
||||
AC_DEFINE([HAVE_INTTYPES_H], [1], [Define to 1 if you have the <inttypes.h> header file.])
|
||||
fi
|
||||
AC_SUBST([EINA_CONFIGURE_HAVE_INTTYPES_H])
|
||||
|
||||
if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
|
||||
EINA_CONFIGURE_HAVE_STDINT_H="#define EINA_HAVE_STDINT_H"
|
||||
AC_DEFINE([HAVE_STDINT_H], [1], [Define to 1 if you have the <stdint.h> header file.])
|
||||
fi
|
||||
AC_SUBST([EINA_CONFIGURE_HAVE_STDINT_H])
|
||||
|
||||
### Checks for types
|
||||
|
||||
# wchar_t
|
||||
|
||||
AC_CHECK_SIZEOF([wchar_t])
|
||||
EINA_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
|
||||
AC_SUBST([EINA_SIZEOF_WCHAR_T])
|
||||
AC_CHECK_TYPES([siginfo_t], [], [],
|
||||
[[
|
||||
#include <signal.h>
|
||||
#if HAVE_SIGINFO_H
|
||||
# include <siginfo.h>
|
||||
#endif
|
||||
]])
|
||||
|
||||
# struct dirent
|
||||
|
||||
AC_CHECK_TYPES([struct dirent], [have_dirent="yes"], [have_dirent="no"],
|
||||
[[
|
||||
#include <dirent.h>
|
||||
]])
|
||||
|
||||
if test "x${have_dirent}" = "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 structures
|
||||
|
||||
### Checks for compiler characteristics
|
||||
AC_C_CONST
|
||||
AC_C_BIGENDIAN
|
||||
AC_C_INLINE
|
||||
AC_PROG_CC_STDC
|
||||
|
@ -384,58 +462,16 @@ m4_ifdef([v_mic],
|
|||
|
||||
EFL_COMPILER_FLAG([-Wshadow])
|
||||
|
||||
### Checks for portability layer
|
||||
|
||||
PKG_CHECK_MODULES([EXOTIC],
|
||||
[exotic],
|
||||
[enable_exotic="yes"],
|
||||
[enable_exotic="no"])
|
||||
|
||||
if test "x${enable_exotic}" = "xyes"; then
|
||||
requirement_eina="exotic ${requirement_eina}"
|
||||
EINA_CFLAGS="${EINA_CFLAGS} ${EXOTIC_CFLAGS}"
|
||||
EINA_LIBS="${EXOTIC_LIBS}"
|
||||
|
||||
EINA_CONFIGURE_HAVE_EXOTIC="#define EINA_HAVE_EXOTIC"
|
||||
AC_DEFINE([HAVE_EXOTIC_H], [1], [Define to 1 if you have Exotic.])
|
||||
fi
|
||||
AM_CONDITIONAL([EINA_HAVE_EXOTIC], [test "x${enable_exotic}" = "xyes"])
|
||||
AC_SUBST([EINA_CONFIGURE_HAVE_EXOTIC])
|
||||
|
||||
case "$host_vendor" in
|
||||
ps3*)
|
||||
PKG_CHECK_MODULES([ESCAPE], [escape])
|
||||
AC_DEFINE(HAVE_ESCAPE, 1, [Set to 1 if Escape package is installed])
|
||||
requirement_eina="${requirement_eina} escape"
|
||||
EINA_CFLAGS="${ESCAPE_CFLAGS} ${EINA_CFLAGS}"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST([EINA_CFLAGS])
|
||||
EFL_CHECK_PATH_MAX
|
||||
|
||||
### Checks for linker characteristics
|
||||
EINA_LIBS=
|
||||
lt_enable_auto_import=""
|
||||
case "${host_os}" in
|
||||
mingw*)
|
||||
EINA_LIBS="${EINA_LIBS} -ldl ${EVIL_LIBS} -lm"
|
||||
EINA_LIBS="${EINA_LIBS} ${EVIL_LIBS}"
|
||||
lt_enable_auto_import="-Wl,--enable-auto-import"
|
||||
;;
|
||||
dragonfly*|openbsd*)
|
||||
EINA_LIBS="${EINA_LIBS} -lm"
|
||||
;;
|
||||
freebsd*|netbsd*)
|
||||
EINA_LIBS="${EINA_LIBS} -lrt -lm"
|
||||
;;
|
||||
darwin*)
|
||||
EINA_LIBS="${EINA_LIBS} -lm"
|
||||
;;
|
||||
cygwin*)
|
||||
EINA_LIBS="${EINA_LIBS} -ldl -lm"
|
||||
;;
|
||||
*)
|
||||
EINA_LIBS="${EINA_LIBS} -lrt -ldl -lm"
|
||||
;;
|
||||
esac
|
||||
case "$host_vendor" in
|
||||
ps3*)
|
||||
|
@ -448,63 +484,18 @@ AC_SUBST([lt_enable_auto_import])
|
|||
|
||||
EFL_LINKER_FLAG([-fno-strict-aliasing])
|
||||
|
||||
CFLAGS="${CFLAGS} ${EINA_CFLAGS}"
|
||||
LDFLAGS="${LDFLAGS} ${EINA_LDFLAGS}"
|
||||
LIBS="${LIBS} ${EINA_LIBS}"
|
||||
|
||||
### Checks for header files
|
||||
AC_HEADER_ASSERT
|
||||
AC_HEADER_TIME
|
||||
EFL_CHECK_PATH_MAX
|
||||
AC_CHECK_HEADERS([unistd.h libgen.h inttypes.h stdint.h sys/types.h siginfo.h strings.h sys/mman.h execinfo.h])
|
||||
|
||||
if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
|
||||
EINA_CONFIGURE_HAVE_INTTYPES_H="#define EINA_HAVE_INTTYPES_H"
|
||||
AC_DEFINE([HAVE_INTTYPES_H], [1], [Define to 1 if you have the <inttypes.h> header file.])
|
||||
fi
|
||||
AC_SUBST([EINA_CONFIGURE_HAVE_INTTYPES_H])
|
||||
|
||||
if test "x${ac_cv_header_inttypes_h}" = "xyes" ; then
|
||||
EINA_CONFIGURE_HAVE_STDINT_H="#define EINA_HAVE_STDINT_H"
|
||||
AC_DEFINE([HAVE_STDINT_H], [1], [Define to 1 if you have the <stdint.h> header file.])
|
||||
fi
|
||||
AC_SUBST([EINA_CONFIGURE_HAVE_STDINT_H])
|
||||
|
||||
### Checks for types
|
||||
|
||||
AC_CHECK_SIZEOF([wchar_t])
|
||||
EINA_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
|
||||
AC_SUBST([EINA_SIZEOF_WCHAR_T])
|
||||
AC_CHECK_TYPES([siginfo_t], [], [],
|
||||
[[#include <signal.h>
|
||||
#if HAVE_SIGINFO_H
|
||||
# include <siginfo.h>
|
||||
#endif
|
||||
]])
|
||||
|
||||
### 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}" = "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 library functions
|
||||
AC_ISC_POSIX
|
||||
AC_FUNC_ALLOCA
|
||||
AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp backtrace backtrace_symbols])
|
||||
AC_CHECK_FUNCS([strlcpy openat fstatat fpathconf execvp backtrace backtrace_symbols malloc_usable_size mtrace])
|
||||
|
||||
AC_MSG_CHECKING([for dirfd])
|
||||
AC_LINK_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <dirent.h>
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
]],
|
||||
[[
|
||||
int main(void)
|
||||
|
@ -523,12 +514,6 @@ if test "x${have_dirfd}" = "xyes" ; then
|
|||
AC_DEFINE([HAVE_DIRFD], [1], [ Define to 1 if you have the `dirfd' function or macro.])
|
||||
fi
|
||||
|
||||
# check debug information for malloc
|
||||
AC_CHECK_FUNCS([malloc_usable_size], [malloc_true_size="yes"], [malloc_true_size="no"])
|
||||
if test "x${malloc_true_size}" = "xyes" ; then
|
||||
AC_DEFINE([HAVE_MALLOC_USABLE_SIZE], [1], [We will be able to know the exact amount of wasted memory])
|
||||
fi
|
||||
|
||||
want_debug_malloc="no"
|
||||
AC_ARG_ENABLE([debug-malloc],
|
||||
[AC_HELP_STRING([--enable-debug-malloc], [enable debugging of malloc usage overhead in our allocator @<:@default=enabled@:>@])],
|
||||
|
@ -540,7 +525,7 @@ AC_ARG_ENABLE([debug-malloc],
|
|||
fi
|
||||
], [want_debug_malloc="no"])
|
||||
|
||||
if test "x${malloc_true_size}" = "xyes" -a "x${want_debug_malloc}" = "xyes"; then
|
||||
if test "x${ac_cv_func_malloc_usable_size}" = "xyes" && test "x${want_debug_malloc}" = "xyes"; then
|
||||
AC_DEFINE([EINA_DEBUG_MALLOC], [1], [Turn on debugging overhead in mempool])
|
||||
fi
|
||||
|
||||
|
@ -551,6 +536,7 @@ case "$host_os" in
|
|||
# managed by evil
|
||||
AC_DEFINE([HAVE_DLADDR])
|
||||
AC_DEFINE([HAVE_DLOPEN])
|
||||
dlopen_libs="-ldl"
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_FUNCS([dlopen], [res="yes"], [res="no"])
|
||||
|
@ -598,8 +584,6 @@ if test "x${enable_log}" = "xyes"; then
|
|||
fi
|
||||
AC_SUBST([EINA_CONFIGURE_ENABLE_LOG])
|
||||
|
||||
AC_CHECK_HEADERS([mcheck.h], [AC_DEFINE([HAVE_MCHECK], [1], [Have mcheck.h])])
|
||||
AC_CHECK_FUNCS([mtrace], [AC_DEFINE([HAVE_MTRACE], [1], [Have mtrace])])
|
||||
|
||||
# iconv library
|
||||
have_iconv="no"
|
||||
|
@ -702,37 +686,8 @@ if test "x${have_iconv}" = "xyes" ; then
|
|||
AC_DEFINE([HAVE_ICONV], [1], [Set to 1 if iconv library is installed])
|
||||
fi
|
||||
|
||||
# shmopen
|
||||
have_shmopen=no
|
||||
AC_MSG_CHECKING([for shm_open availability])
|
||||
|
||||
LIBS_save="${LIBS}"
|
||||
LIBS="${LIBS} -lrt"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h> /* For mode constants */
|
||||
#include <fcntl.h> /* For O_* constants */
|
||||
]],
|
||||
[[
|
||||
int fd;
|
||||
|
||||
fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
]])],
|
||||
[have_shmopen="yes"],
|
||||
[have_shmopen="no"])
|
||||
|
||||
LIBS="${LIBS_save}"
|
||||
|
||||
AC_MSG_RESULT([${have_shmopen}])
|
||||
|
||||
if test "x${have_shmopen}" = "xyes"; then
|
||||
AC_DEFINE([HAVE_SHMOPEN], [1], [Define to 1 if you have the `shm_open' function.])
|
||||
rt_libs="-lrt"
|
||||
fi
|
||||
|
||||
AC_SUBST([rt_libs])
|
||||
# shm_open
|
||||
EFL_CHECK_SHM_OPEN([have_shm_open="yes"], [have_shm_open="no"])
|
||||
|
||||
# extended attribute
|
||||
|
||||
|
@ -859,6 +814,7 @@ echo " Amalgamation.........: ${do_amalgamation}"
|
|||
echo " Iconv support........: ${have_iconv}"
|
||||
echo " File dirfd...........: ${have_dirfd}"
|
||||
echo " File xattr...........: ${have_xattr}"
|
||||
echo " shm_open.............: ${have_shm_open}"
|
||||
echo
|
||||
echo " Documentation........: ${build_doc}"
|
||||
echo " Tests................: ${enable_tests}"
|
||||
|
|
|
@ -8,5 +8,5 @@ Description: A Library that implements fast data types and miscellaneous tools
|
|||
@pkgconfig_requires_private@: @requirement_eina@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -leina @EFL_PTHREAD_LIBS@
|
||||
Libs.private: @EFL_FNMATCH_LIBS@ @EFL_PTHREAD_LIBS@ @rt_libs@ @iconv_libs@ @EINA_LIBS@
|
||||
Libs.private: @EFL_FNMATCH_LIBS@ @EFL_SHM_OPEN_LIBS@ @EFL_PTHREAD_LIBS@ @iconv_libs@ @EINA_LIBS@
|
||||
Cflags: -I${includedir}/eina-@VMAJ@ -I${includedir}/eina-@VMAJ@/eina
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
|
||||
dnl That code is public domain and can be freely used or copied.
|
||||
|
||||
dnl Macro that check if shm_open function is available or not.
|
||||
|
||||
dnl Usage: EFL_CHECK_SHM_OPEN([, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Call AC_SUBST(EFL_SHM_OPEN_LIBS)
|
||||
dnl Define HAVE_SHM_OPEN to 1if shm_open is available
|
||||
|
||||
AC_DEFUN([EFL_CHECK_SHM_OPEN],
|
||||
[
|
||||
_efl_have_shm_open="no"
|
||||
|
||||
dnl Check is shm_open is in libc
|
||||
|
||||
AC_MSG_CHECKING([for shm_open in libc])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h> /* For mode constants */
|
||||
#include <fcntl.h> /* For O_* constants */
|
||||
]],
|
||||
[[
|
||||
int fd;
|
||||
|
||||
fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
]])],
|
||||
[_efl_have_shm_open="yes"],
|
||||
[_efl_have_shm_open="no"])
|
||||
|
||||
AC_MSG_RESULT([${_efl_have_shm_open}])
|
||||
|
||||
if test "x$_efl_have_shm_open" = "xno" ; then
|
||||
AC_MSG_CHECKING([for shm_open in librt])
|
||||
|
||||
LIBS_save="${LIBS}"
|
||||
LIBS="${LIBS} -lrt"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h> /* For mode constants */
|
||||
#include <fcntl.h> /* For O_* constants */
|
||||
]],
|
||||
[[
|
||||
int fd;
|
||||
|
||||
fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
]])],
|
||||
[
|
||||
EFL_SHM_OPEN_LIBS="-lrt"
|
||||
_efl_have_shm_open="yes"],
|
||||
[_efl_have_shm_open="no"])
|
||||
|
||||
LIBS="${LIBS_save}"
|
||||
|
||||
AC_MSG_RESULT([${_efl_have_shm_open}])
|
||||
fi
|
||||
|
||||
AC_SUBST([EFL_SHM_OPEN_LIBS])
|
||||
|
||||
if test "x$_efl_have_shm_open" = "xyes" ; then
|
||||
AC_DEFINE([HAVE_SHM_OPEN], [1], [Define to 1 if you have the `shm_open' function.])
|
||||
fi
|
||||
|
||||
AS_IF([test "x$_efl_have_shm_open" = "xyes"], [$1], [$2])
|
||||
|
||||
])
|
|
@ -170,7 +170,7 @@ else
|
|||
libeina_la_SOURCES = $(base_sources)
|
||||
endif
|
||||
|
||||
libeina_la_LIBADD = @iconv_libs@ @rt_libs@ @EINA_LIBS@ @dlopen_libs@
|
||||
libeina_la_LIBADD = @iconv_libs@ @EFL_SHM_OPEN_LIBS@ @EINA_LIBS@ @dlopen_libs@ -lm
|
||||
libeina_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@
|
||||
libeina_la_CFLAGS = @EINA_CFLAGS@ @EFL_PTHREAD_CFLAGS@
|
||||
|
||||
|
|
|
@ -953,7 +953,7 @@ eina_file_open(const char *path, Eina_Bool shared)
|
|||
if (!filename) return NULL;
|
||||
|
||||
if (shared)
|
||||
#ifdef HAVE_SHMOPEN
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
fd = shm_open(filename, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
#else
|
||||
goto on_error;
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MCHECK
|
||||
#ifdef HAVE_MCHECK_H
|
||||
# ifdef HAVE_MTRACE
|
||||
# define MT 1
|
||||
# endif
|
||||
|
|
|
@ -86,7 +86,7 @@ module_dummy_la_CPPFLAGS = \
|
|||
-I$(top_builddir)/src/include \
|
||||
-I$(top_builddir)/src/lib \
|
||||
@EFL_EINA_BUILD@
|
||||
module_dummy_la_LIBADD = $(top_builddir)/src/lib/libeina.la @EINA_LIBS@
|
||||
module_dummy_la_LIBADD = $(top_builddir)/src/lib/libeina.la @EINA_LIBS@ -lm
|
||||
module_dummy_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
|
||||
module_dummy_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
|
|
Loading…
Reference in New Issue