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 a binary is built or not
+dnl Macro that checks if a binary is built or not
dnl Usage: EFL_ENABLE_BIN(binary)
dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being tranformed into _)
AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$2], [$3])
])
+
+dnl Macro that specifies the binary to be used
+
+dnl Usage: EFL_WITH_BIN(binary, package, msg)
+dnl Call AC_SUBST(BINARY_PRG) (BINARY is the uppercase of binary, - being tranformed into _)
+dnl Define with_binary (- is tranformed into _)
+dnl Define conditional BUILD_BINARY (BINARY is the uppercase of binary, - being tranformed into _)
+
+AC_DEFUN([EFL_WITH_BIN],
+[
+
+m4_pushdef([UP], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
+m4_pushdef([DOWN], m4_translit([[$1]], [-A-Z], [_a-z]))dnl
+
+AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+AC_MSG_NOTICE([$PKG_CONFIG])
+
+with_[]m4_defn([DOWN])=m4_esyscmd($PKG_CONFIG --variable=prefix $2)/bin/m4_defn([DOWN])
+
+dnl configure option
+
+AC_ARG_WITH([$1],
+ [AC_HELP_STRING([--with-$1-bin=PATH], [specify a specific path to ]DOWN)],
+ [
+ with_[]m4_defn([DOWN])=$withval
+ _efl_msg="( explicitely set)"
+ ])
+
+AC_MSG_NOTICE([$msg: ]m4_defn([DOWN])[$_efl_msg])
+
+AC_SUBST(with_[]m4_defn([DOWN]))
+
+AS_IF([test "x$have_[]m4_defn([DOWN])" = "xyes"], [$4], [$5])
+
+])
-dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
+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 several ASM instruction sets are available or not.
+dnl Macro that check if several pthread library is available or not.
-dnl Usage: EFL_CHECK_EFL_CHECK_PTHREAD(want_pthread_spin[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl Call AC_SUBST(EFL_PTHREAD_FLAGS)
+dnl Usage: EFL_CHECK_PTHREAD(want_pthread_spin[, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Call AC_SUBST(EFL_PTHREAD_CFLAGS)
+dnl Call AC_SUBST(EFL_PTHREAD_LIBS)
dnl Define EFL_HAVE_PTHREAD
+dnl Define EFL_HAVE_PTHREAD_SPINLOCK
AC_DEFUN([EFL_CHECK_PTHREAD],
[
dnl configure option
AC_ARG_ENABLE([pthread],
- [AC_HELP_STRING([--disable-pthread], [enable POSIX threads code @<:@default=yes@:>@])],
+ [AC_HELP_STRING([--disable-pthread], [enable POSIX threads code @<:@default=auto@:>@])],
[
if test "x${enableval}" = "xyes" ; then
_efl_enable_pthread="yes"
_efl_enable_pthread="no"
fi
],
- [_efl_enable_pthread="yes"])
+ [_efl_enable_pthread="auto"])
AC_MSG_CHECKING([whether to build POSIX threads code])
AC_MSG_RESULT([${_efl_enable_pthread}])
_efl_have_pthread="no"
-if test "x${_efl_enable_pthread}" = "xyes" ; then
+if test "x${_efl_enable_pthread}" = "xyes" || test "x${_efl_enable_pthread}" = "xauto" ; then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
fi
AC_MSG_CHECKING([whether system support POSIX threads])
-AC_MSG_RESULT([${_efl_enable_pthread}])
+AC_MSG_RESULT([${_efl_have_pthread}])
+if test "$x{_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread}" = "xno"; then
+ AC_MSG_ERROR([pthread support requested but not found.])
+fi
if test "x${_efl_have_pthread}" = "xyes" ; then
case "$host_os" in
mingw*)
EFL_PTHREAD_CFLAGS=""
- EFL_PTHREAD_LIBS="-lpthreadGCE2"
+ EFL_PTHREAD_LIBS="-lpthreadGC2"
;;
solaris*)
EFL_PTHREAD_CFLAGS="-mt"
AC_MSG_CHECKING([whether to build POSIX threads spinlock code])
AC_MSG_RESULT([${_efl_have_pthread_spinlock}])
+if test "$x{_efl_enable_pthread}" = "xyes" && test "x${_efl_have_pthread_spinlock}" = "xno"; then
+ AC_MSG_ERROR([pthread support requested but spinlocks are not supported])
+fi
if test "x${_efl_have_pthread_spinlock}" = "xyes" ; then
AC_DEFINE(EFL_HAVE_PTHREAD_SPINLOCK, 1, [Define to mention that POSIX threads spinlocks are supported])