forked from enlightenment/efl
[eio] check if threads, grp.h and fchmod() are available
SVN revision: 53723
This commit is contained in:
parent
ab84f4da58
commit
c2d941930c
|
@ -71,6 +71,24 @@ EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
|
|||
AC_HEADER_ASSERT
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_HEADERS([grp.h])
|
||||
EFL_CHECK_THREADS(
|
||||
[
|
||||
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||
have_threads="POSIX"
|
||||
else
|
||||
if test "x${_efl_have_win32_threads}" = "xyes" ; then
|
||||
have_threads="Win32"
|
||||
else
|
||||
have_threads="no"
|
||||
fi
|
||||
fi
|
||||
],
|
||||
[have_threads="no"])
|
||||
|
||||
if test "x${have_threads}" = "xno" ; then
|
||||
AC_MSG_ERROR([Threads not supported. Be sure to have pthread on non Windows OS])
|
||||
fi
|
||||
|
||||
### Checks for types
|
||||
|
||||
|
@ -105,8 +123,7 @@ esac
|
|||
AC_SUBST(EFL_EIO_BUILD)
|
||||
|
||||
### Checks for library functions
|
||||
AC_FUNC_ALLOCA
|
||||
AC_CHECK_FUNCS(strlcpy)
|
||||
AC_CHECK_FUNCS([fchmod])
|
||||
|
||||
have_splice="no"
|
||||
AC_TRY_LINK([
|
||||
|
@ -143,6 +160,8 @@ echo
|
|||
echo
|
||||
echo "Configuration Options Summary:"
|
||||
echo
|
||||
echo " Thread Support.......: ${have_threads}"
|
||||
echo
|
||||
echo " Documentation........: ${build_doc}"
|
||||
echo
|
||||
echo "Compilation............: make (or gmake)"
|
||||
|
|
|
@ -0,0 +1,206 @@
|
|||
dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
|
||||
dnl rwlock code added by Mike Blumenkrantz <mike at zentific dot com>
|
||||
dnl This code is public domain and can be freely used or copied.
|
||||
|
||||
dnl Macro that check if POSIX or Win32 threads library is available or not.
|
||||
|
||||
dnl Usage: EFL_CHECK_THREADS(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||
dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
|
||||
dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
|
||||
dnl Defines EFL_HAVE_POSIX_THREADS or EFL_HAVE_WIN32_THREADS, and EFL_HAVE_THREADS
|
||||
|
||||
AC_DEFUN([EFL_CHECK_THREADS],
|
||||
[
|
||||
|
||||
dnl configure option
|
||||
|
||||
AC_ARG_ENABLE([posix-threads],
|
||||
[AC_HELP_STRING([--disable-posix-threads], [enable POSIX threads code @<:@default=auto@:>@])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
_efl_enable_posix_threads="yes"
|
||||
else
|
||||
_efl_enable_posix_threads="no"
|
||||
fi
|
||||
],
|
||||
[_efl_enable_posix_threads="auto"])
|
||||
|
||||
AC_MSG_CHECKING([whether to build POSIX threads code])
|
||||
AC_MSG_RESULT([${_efl_enable_posix_threads}])
|
||||
|
||||
AC_ARG_ENABLE([win32-threads],
|
||||
[AC_HELP_STRING([--disable-win32-threads], [enable Win32 threads code @<:@default=no@:>@])],
|
||||
[
|
||||
if test "x${enableval}" = "xyes" ; then
|
||||
_efl_enable_win32_threads="yes"
|
||||
else
|
||||
_efl_enable_win32_threads="no"
|
||||
fi
|
||||
],
|
||||
[_efl_enable_win32_threads="no"])
|
||||
|
||||
AC_MSG_CHECKING([whether to build Windows threads code])
|
||||
AC_MSG_RESULT([${_efl_enable_win32_threads}])
|
||||
|
||||
dnl
|
||||
dnl * no + no
|
||||
dnl * yes + no : win32: error, other : pthread
|
||||
dnl * yes + yes : win32 : wthread, other : pthread
|
||||
dnl * no + yes : win32 : wthread, other : error
|
||||
|
||||
if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_enable_win32_threads}" = "xyes" ; then
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
_efl_enable_posix_threads=no
|
||||
;;
|
||||
*)
|
||||
_efl_enable_win32_threads=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "x${_efl_enable_win32_threads}" = "xyes" ; then
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Win32 threads support requested but non Windows system found.])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test "x${_efl_enable_posix_threads}" = "xyes" ; then
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
AC_MSG_ERROR([POSIX threads support requested but Windows system found.])
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl check if the compiler supports POSIX threads
|
||||
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
;;
|
||||
solaris*)
|
||||
_efl_thread_cflags="-mt"
|
||||
_efl_thread_libs="-mt"
|
||||
;;
|
||||
*)
|
||||
_efl_thread_cflags="-pthread"
|
||||
_efl_thread_libs="-pthread"
|
||||
;;
|
||||
esac
|
||||
|
||||
_efl_have_posix_threads="no"
|
||||
_efl_have_win32_threads="no"
|
||||
|
||||
if test "x${_efl_enable_posix_threads}" = "xyes" || test "x${_efl_enable_posix_threads}" = "xauto" ; then
|
||||
|
||||
SAVE_CFLAGS=${CFLAGS}
|
||||
CFLAGS="${CFLAGS} ${_efl_threads_cflags}"
|
||||
SAVE_LIBS=${LIBS}
|
||||
LIBS="${LIBS} ${_efl_threads_libs}"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <pthread.h>
|
||||
]],
|
||||
[[
|
||||
pthread_t id;
|
||||
id = pthread_self();
|
||||
]])],
|
||||
[_efl_have_posix_threads="yes"],
|
||||
[_efl_have_posix_threads="no"])
|
||||
CFLAGS=${SAVE_CFLAGS}
|
||||
LIBS=${SAVE_LIBS}
|
||||
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether system support POSIX threads])
|
||||
AC_MSG_RESULT([${_efl_have_posix_threads}])
|
||||
if test "$x{_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads}" = "xno"; then
|
||||
AC_MSG_ERROR([POSIX threads support requested but not found.])
|
||||
fi
|
||||
|
||||
EFL_PTHREAD_CFLAGS=""
|
||||
EFL_PTHREAD_LIBS=""
|
||||
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||
EFL_PTHREAD_CFLAGS=${_efl_thread_cflags}
|
||||
EFL_PTHREAD_LIBS=${_efl_thread_libs}
|
||||
fi
|
||||
|
||||
AC_SUBST(EFL_PTHREAD_CFLAGS)
|
||||
AC_SUBST(EFL_PTHREAD_LIBS)
|
||||
|
||||
_efl_enable_debug_threads="no"
|
||||
AC_ARG_ENABLE([debug-threads],
|
||||
[AC_HELP_STRING([--enable-debug-threads], [disable assert when you forgot to call eina_threads_init])],
|
||||
[_efl_enable_debug_threads="${enableval}"])
|
||||
|
||||
have_debug_threads="no"
|
||||
if test "x${_efl_have_posix_threads}" = "xyes" -a "x${_efl_enable_debug_threads}" = "xyes"; then
|
||||
have_debug_threads="yes"
|
||||
AC_DEFINE([EFL_DEBUG_THREADS], [1], [Assert when forgot to call eina_threads_init])
|
||||
fi
|
||||
|
||||
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||
AC_DEFINE([EFL_HAVE_POSIX_THREADS], [1], [Define to mention that POSIX threads are supported])
|
||||
fi
|
||||
|
||||
if test "x${_efl_enable_win32_threads}" = "xyes" ; then
|
||||
_efl_have_win32_threads="yes"
|
||||
AC_DEFINE([EFL_HAVE_WIN32_THREADS], [1], [Define to mention that Win32 threads are supported])
|
||||
fi
|
||||
|
||||
if test "x${_efl_have_posix_threads}" = "xyes" || test "x${_efl_have_win32_threads}" = "xyes" ; then
|
||||
AC_DEFINE([EFL_HAVE_THREADS], [1], [Define to mention that POSIX or Win32 threads are supported])
|
||||
fi
|
||||
|
||||
AS_IF([test "x$_efl_have_posix_threads" = "xyes" || test "x$_efl_have_win32_threads" = "xyes"], [$1], [$2])
|
||||
])
|
||||
|
||||
dnl Usage: EFL_CHECK_SPINLOCK(ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND])
|
||||
dnl Defines EFL_HAVE_POSIX_THREADS_SPINLOCK
|
||||
AC_DEFUN([EFL_CHECK_SPINLOCK],
|
||||
[
|
||||
|
||||
dnl check if the compiler supports pthreads spinlock
|
||||
|
||||
_efl_have_posix_threads_spinlock="no"
|
||||
|
||||
if test "x${_efl_have_posix_threads}" = "xyes" ; then
|
||||
|
||||
SAVE_CFLAGS=${CFLAGS}
|
||||
CFLAGS="${CFLAGS} ${EFL_PTHREAD_CFLAGS}"
|
||||
SAVE_LIBS=${LIBS}
|
||||
LIBS="${LIBS} ${EFL_PTHREAD_LIBS}"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[
|
||||
#include <pthread.h>
|
||||
]],
|
||||
[[
|
||||
pthread_spinlock_t lock;
|
||||
int res;
|
||||
res = pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE);
|
||||
]])],
|
||||
[_efl_have_posix_threads_spinlock="yes"],
|
||||
[_efl_have_posix_threads_spinlock="no"])
|
||||
CFLAGS=${SAVE_CFLAGS}
|
||||
LIBS=${SAVE_LIBS}
|
||||
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
|
||||
AC_MSG_RESULT([${_efl_have_posix_threads_spinlock}])
|
||||
if test "x${_efl_enable_posix_threads}" = "xyes" && test "x${_efl_have_posix_threads_spinlock}" = "xno" ; then
|
||||
AC_MSG_WARN([POSIX threads support requested but spinlocks are not supported])
|
||||
fi
|
||||
|
||||
if test "x${_efl_have_posix_threads_spinlock}" = "xyes" ; then
|
||||
AC_DEFINE([EFL_HAVE_POSIX_THREADS_SPINLOCK], [1], [Define to mention that POSIX threads spinlocks are supported])
|
||||
fi
|
||||
AS_IF([test "x$_efl_have_posix_threads_spinlock" = "xyes"], [$1], [$2])
|
||||
])
|
||||
|
|
@ -485,8 +485,13 @@ eio_file_copy_do(Ecore_Thread *thread, Eio_File_Progress *copy)
|
|||
goto on_error;
|
||||
|
||||
/* change access right to match source */
|
||||
#ifdef HAVE_CHMOD
|
||||
if (fchmod(out, buf.st_mode) != 0)
|
||||
goto on_error;
|
||||
#else
|
||||
if (chmod(copy->dest, buf.st_mode) != 0)
|
||||
goto on_error;
|
||||
#endif
|
||||
|
||||
close(out);
|
||||
close(in);
|
||||
|
|
|
@ -28,9 +28,19 @@
|
|||
#include <dirent.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#ifdef HAVE_GRP_H
|
||||
# include <grp.h>
|
||||
#endif
|
||||
|
||||
#ifdef EFL_HAVE_POSIX_THREADS
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#ifdef EFL_HAVE_WIN32_THREADS
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <Ecore.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue