forked from enlightenment/efl
efl: refactor EFL_CHECK_LIB() and EFL_CHECK_FUNC()
- introduce EFL_CHECK_LIB_CODE() that does the try-link - introduce EFL_FIND_LIB_FOR_CODE() that will use EFL_CHECK_LIB_CODE() into multiple libraries - also fix dladdr() test (was missing .h in #include <stdlib>) SVN revision: 81909
This commit is contained in:
parent
458b70bbe6
commit
8bbef8fe28
|
@ -12,534 +12,224 @@ dnl iconv
|
||||||
dnl setxattr (an al.)
|
dnl setxattr (an al.)
|
||||||
dnl shm_open
|
dnl shm_open
|
||||||
|
|
||||||
|
dnl EFL_CHECK_LIB_CODE(EFL, LIB, VARIABLE, HEADER, BODY)
|
||||||
|
dnl wrapper around AC_LINK_IFELSE(AC_LANG_PROGRAM()) to check
|
||||||
|
dnl if some code would work with the given lib.
|
||||||
|
dnl If the code work, EFL_ADD_LIBS(EFL, LIB) will be called
|
||||||
|
dnl At the end VARIABLE will be "yes" or "no"
|
||||||
|
AC_DEFUN([EFL_CHECK_LIB_CODE],
|
||||||
|
[
|
||||||
|
LIBS_save="${LIBS}"
|
||||||
|
LIBS="${LIBS} $2"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([$4], [$5])],
|
||||||
|
[EFL_ADD_LIBS([$1], [$2])
|
||||||
|
$3="yes"], [$3="no"])
|
||||||
|
LIBS="${LIBS_save}"
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl EFL_FIND_LIB_FOR_CODE(EFL, LIBS, VARIABLE, HEADER, BODY)
|
||||||
|
AC_DEFUN([EFL_FIND_LIB_FOR_CODE],
|
||||||
|
[
|
||||||
|
dnl first try without lib (libc)
|
||||||
|
EFL_CHECK_LIB_CODE([$1], [], [$3], [$4], [$5])
|
||||||
|
|
||||||
|
if test "${$3}" = "no" && test "x$2" != "x"; then
|
||||||
|
dnl loop through given libraries
|
||||||
|
for trylib in $2; do
|
||||||
|
EFL_CHECK_LIB_CODE([$1], [${trylib}], [$3], [$4], [$5])
|
||||||
|
if test "${$3}" = "yes"; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_DIRFD is for internal use
|
dnl _EFL_CHECK_FUNC_DIRFD is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_DIRFD(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_DIRFD(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_DIRFD],
|
AC_DEFUN([_EFL_CHECK_FUNC_DIRFD],
|
||||||
[
|
[EFL_CHECK_LIB_CODE([$1], [], [$2], [[
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[
|
|
||||||
AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#ifdef HAVE_DIRENT_H
|
#ifdef HAVE_DIRENT_H
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
]],
|
]], [[DIR *dirp; return dirfd(dirp);]])
|
||||||
[[
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
DIR *dirp;
|
|
||||||
return dirfd(dirp);
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
],
|
|
||||||
[_efl_have_fct="yes"],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_DLADDR_PRIV is for internal use
|
|
||||||
dnl _EFL_CHECK_FUNC_DLADDR_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_DLADDR_PRIV],
|
|
||||||
[
|
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
LIBS_save="${LIBS}"
|
|
||||||
LIBS="${LIBS} $2"
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
# define _GNU_SOURCE
|
|
||||||
#endif
|
|
||||||
#include <stdlib>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
int res = dladdr(NULL, NULL);
|
|
||||||
]])],
|
|
||||||
[
|
|
||||||
m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
|
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
|
|
||||||
_efl_have_fct="yes"
|
|
||||||
],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
LIBS="${LIBS_save}"
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_DLADDR is for internal use
|
dnl _EFL_CHECK_FUNC_DLADDR is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_DLADDR(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_DLADDR(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_DLADDR],
|
AC_DEFUN([_EFL_CHECK_FUNC_DLADDR],
|
||||||
[
|
[
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
mingw*)
|
mingw*)
|
||||||
_efl_have_fct="yes"
|
$2="yes"
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ldl"
|
EFL_ADD_LIBS([$1], [-ldl])
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_efl_have_fct="no"
|
EFL_FIND_LIB_FOR_CODE([$1], [-ldl], [$2], [[
|
||||||
|
|
||||||
dnl Check is dladdr is in libc
|
|
||||||
_EFL_CHECK_FUNC_DLADDR_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
|
|
||||||
dnl Check is dlopen is in libdl
|
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_DLADDR_PRIV([$1], [-ldl], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_DLOPEN_PRIV is for internal use
|
|
||||||
dnl _EFL_CHECK_FUNC_DLOPEN_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_DLOPEN_PRIV],
|
|
||||||
[
|
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
LIBS_save="${LIBS}"
|
|
||||||
LIBS="${LIBS} $2"
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#include <dlfcn.h>
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
void *h = dlopen(0, 0);
|
|
||||||
]])],
|
|
||||||
[
|
|
||||||
m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
|
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
|
|
||||||
_efl_have_fct="yes"
|
|
||||||
],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
LIBS="${LIBS_save}"
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_DLOPEN is for internal use
|
|
||||||
dnl _EFL_CHECK_FUNC_DLOPEN(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_DLOPEN],
|
|
||||||
[
|
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
case "$host_os" in
|
|
||||||
mingw*)
|
|
||||||
_efl_have_fct="yes"
|
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ldl"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
_efl_have_fct="no"
|
|
||||||
|
|
||||||
dnl Check is dlopen is in libc
|
|
||||||
_EFL_CHECK_FUNC_DLOPEN_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
|
|
||||||
dnl Check is dlopen is in libdl
|
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_DLOPEN_PRIV([$1], [-ldl], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_DLSYM_PRIV is for internal use
|
|
||||||
dnl _EFL_CHECK_FUNC_DLSYM_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_DLSYM_PRIV],
|
|
||||||
[
|
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
LIBS_save="${LIBS}"
|
|
||||||
LIBS="${LIBS} $2"
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
# define _GNU_SOURCE
|
# define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
]],
|
]], [[int res = dladdr(NULL, NULL);]])
|
||||||
[[
|
;;
|
||||||
void *res = dlsym(NULL, NULL);
|
esac
|
||||||
]])],
|
])
|
||||||
[
|
|
||||||
m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
|
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
|
|
||||||
_efl_have_fct="yes"
|
|
||||||
],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
LIBS="${LIBS_save}"
|
dnl _EFL_CHECK_FUNC_DLOPEN is for internal use
|
||||||
|
dnl _EFL_CHECK_FUNC_DLOPEN(EFL, VARIABLE)
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
|
AC_DEFUN([_EFL_CHECK_FUNC_DLOPEN],
|
||||||
|
[
|
||||||
m4_popdef([DOWNEFL])
|
case "$host_os" in
|
||||||
m4_popdef([UPEFL])
|
mingw*)
|
||||||
|
$2="yes"
|
||||||
|
EFL_ADD_LIBS([$1], [-ldl])
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
EFL_FIND_LIB_FOR_CODE([$1], [-ldl], [$2], [[
|
||||||
|
#include <dlfcn.h>
|
||||||
|
]], [[void *h = dlopen(0, 0);]])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_DLSYM is for internal use
|
dnl _EFL_CHECK_FUNC_DLSYM is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_DLSYM(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_DLSYM(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_DLSYM],
|
AC_DEFUN([_EFL_CHECK_FUNC_DLSYM],
|
||||||
[
|
[
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
mingw*)
|
mingw*)
|
||||||
_efl_have_fct="yes"
|
$2="yes"
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ldl"
|
EFL_ADD_LIBS([$1], [-ldl])
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_efl_have_fct="no"
|
EFL_FIND_LIB_FOR_CODE([$1], [-ldl], [$2], [[
|
||||||
|
#ifndef _GNU_SOURCE
|
||||||
dnl Check is dlsym is in libc
|
# define _GNU_SOURCE
|
||||||
_EFL_CHECK_FUNC_DLSYM_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
dnl Check is dlopen is in libdl
|
#include <dlfcn.h>
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
]], [[void *res = dlsym(NULL, NULL);]])
|
||||||
_EFL_CHECK_FUNC_DLSYM_PRIV([$1], [-ldl], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_FNMATCH_PRIV is for internal use
|
|
||||||
dnl _EFL_CHECK_FUNC_FNMATCH_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_FNMATCH_PRIV],
|
|
||||||
[
|
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
LIBS_save="${LIBS}"
|
|
||||||
LIBS="${LIBS} $2"
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <fnmatch.h>
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
int g = fnmatch(NULL, NULL, 0);
|
|
||||||
]])],
|
|
||||||
[
|
|
||||||
m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
|
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
|
|
||||||
_efl_have_fct="yes"
|
|
||||||
],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
LIBS="${LIBS_save}"
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_FNMATCH is for internal use
|
dnl _EFL_CHECK_FUNC_FNMATCH is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_FNMATCH(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_FNMATCH(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_FNMATCH],
|
AC_DEFUN([_EFL_CHECK_FUNC_FNMATCH],
|
||||||
[
|
[
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
mingw*)
|
mingw*)
|
||||||
_efl_have_fct="yes"
|
$2="yes"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
dnl Check is fnmatch is in libc
|
EFL_FIND_LIB_FOR_CODE([$1], [-lfnmatch -liberty], [$2], [[
|
||||||
_EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
#include <stdlib.h>
|
||||||
|
#include <fnmatch.h>
|
||||||
dnl Check is fnmatch is in libfnmatch
|
]], [[int g = fnmatch(NULL, NULL, 0);]])
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [-lfnmatch], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Check is fnmatch is in libiberty
|
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_FNMATCH_PRIV([$1], [-liberty], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_GETTIMEOFDAY is for internal use
|
dnl _EFL_CHECK_FUNC_GETTIMEOFDAY is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_GETTIMEOFDAY(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_GETTIMEOFDAY(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_GETTIMEOFDAY],
|
AC_DEFUN([_EFL_CHECK_FUNC_GETTIMEOFDAY],
|
||||||
[
|
[
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
mingw*)
|
mingw*)
|
||||||
_efl_have_fct="yes"
|
$2="yes"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_LINK_IFELSE(
|
EFL_CHECK_LIB_CODE([$1], [], [$2], [[
|
||||||
[AC_LANG_PROGRAM([[
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
]],
|
]], [[int res = gettimeofday(NULL, NULL);]])
|
||||||
[[
|
|
||||||
int res;
|
|
||||||
res = gettimeofday(NULL, NULL);
|
|
||||||
]])],
|
|
||||||
[_efl_have_fct="yes"],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
if test "x${_efl_have_fct}" = "xno" && test "x${enable_exotic}" = "xyes"; then
|
if test "${$2}" = "no" && test "x${enable_exotic}" = "xyes"; then
|
||||||
SAVE_LIBS="${LIBS}"
|
|
||||||
SAVE_CFLAGS="${CFLAGS}"
|
SAVE_CFLAGS="${CFLAGS}"
|
||||||
LIBS="${LIBS} ${EXOTIC_LIBS}"
|
|
||||||
CFLAGS="${CFLAGS} ${EXOTIC_CFLAGS}"
|
CFLAGS="${CFLAGS} ${EXOTIC_CFLAGS}"
|
||||||
AC_LINK_IFELSE(
|
EFL_CHECK_LIB_CODE([$1], [${EXOTIC_LIBS}], [$2], [[
|
||||||
[AC_LANG_PROGRAM([[
|
|
||||||
#include <Exotic.h>
|
#include <Exotic.h>
|
||||||
]],
|
]], [[int res = gettimeofday(NULL, NULL);]])
|
||||||
[[
|
|
||||||
int res;
|
|
||||||
res = gettimeofday(NULL, NULL);
|
|
||||||
]])],
|
|
||||||
[_efl_have_fct="yes"],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
LIBS="${SAVE_LIBS}"
|
|
||||||
CFLAGS="${SAVE_CFLAGS}"
|
CFLAGS="${SAVE_CFLAGS}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_ICONV_PRIV is for internal use
|
|
||||||
dnl _EFL_CHECK_FUNC_ICONV_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_ICONV_PRIV],
|
|
||||||
[
|
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
LIBS_save="${LIBS}"
|
|
||||||
LIBS="${LIBS} $2"
|
|
||||||
AC_LINK_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <iconv.h>
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
iconv_t ic;
|
|
||||||
size_t count = iconv(ic, NULL, NULL, NULL, NULL);
|
|
||||||
]])],
|
|
||||||
[
|
|
||||||
m4_defn([UPEFL])[]_LIBS="${m4_defn([UPEFL])[]_LIBS} $2"
|
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
|
|
||||||
_efl_have_fct="yes"
|
|
||||||
],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
LIBS="${LIBS_save}"
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_ICONV is for internal use
|
dnl _EFL_CHECK_FUNC_ICONV is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_ICONV(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_ICONV(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_ICONV],
|
AC_DEFUN([_EFL_CHECK_FUNC_ICONV],
|
||||||
[
|
[dnl
|
||||||
AC_ARG_WITH([iconv-link],
|
AC_ARG_WITH([iconv-link],
|
||||||
AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
|
AC_HELP_STRING([--with-iconv-link=ICONV_LINK], [explicitly specify an iconv link option]),
|
||||||
[
|
[
|
||||||
_efl_have_fct="yes"
|
$2="yes"
|
||||||
iconv_libs=${withval}
|
iconv_libs=${withval}
|
||||||
],
|
],
|
||||||
[_efl_have_fct="no"])
|
[$2="no"])
|
||||||
|
|
||||||
AC_MSG_CHECKING([for explicit iconv link options])
|
|
||||||
if test "x${iconv_libs}" = "x" ; then
|
if test "x${iconv_libs}" = "x" ; then
|
||||||
AC_MSG_RESULT([no explicit iconv link option])
|
EFL_FIND_LIB_FOR_CODE([$1], [-liconv -liconv_plug], [$2], [[
|
||||||
else
|
#include <stdlib.h>
|
||||||
AC_MSG_RESULT([${iconv_libs}])
|
#include <iconv.h>
|
||||||
|
]], [[iconv_t ic; size_t count = iconv(ic, NULL, NULL, NULL, NULL);]])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Check is iconv is in libc
|
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_ICONV_PRIV([$1], [], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Check is iconv is in libiconv
|
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_ICONV_PRIV([$1], [-liconv], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Check is iconv is in libiconv_plug
|
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_ICONV_PRIV([$1], [-liconv_plug], [_efl_have_fct="yes"], [_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_SETXATTR is for internal use
|
dnl _EFL_CHECK_FUNC_SETXATTR is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_SETXATTR(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_SETXATTR(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_SETXATTR],
|
AC_DEFUN([_EFL_CHECK_FUNC_SETXATTR],
|
||||||
[
|
[EFL_CHECK_LIB_CODE([$1], [], [$2], [[
|
||||||
AC_COMPILE_IFELSE(
|
|
||||||
[AC_LANG_PROGRAM(
|
|
||||||
[[
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/xattr.h>
|
#include <sys/xattr.h>
|
||||||
]],
|
]], [[
|
||||||
[[
|
|
||||||
size_t tmp = listxattr("/", NULL, 0);
|
size_t tmp = listxattr("/", NULL, 0);
|
||||||
tmp = getxattr("/", "user.ethumb.md5", NULL, 0);
|
tmp = getxattr("/", "user.ethumb.md5", NULL, 0);
|
||||||
setxattr("/", "user.ethumb.md5", NULL, 0, 0);
|
setxattr("/", "user.ethumb.md5", NULL, 0, 0);
|
||||||
]])],
|
]])
|
||||||
[_efl_have_fct="yes"],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
if test "${$2}" = "yes"; then
|
||||||
])
|
AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.])
|
||||||
|
fi
|
||||||
dnl _EFL_CHECK_FUNC_SHM_OPEN_PRIV is for internal use
|
|
||||||
dnl _EFL_CHECK_FUNC_SHM_OPEN_PRIV(EFL, LIB, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_SHM_OPEN_PRIV],
|
|
||||||
[
|
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
|
||||||
|
|
||||||
LIBS_save="${LIBS}"
|
|
||||||
LIBS="${LIBS} $2"
|
|
||||||
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);
|
|
||||||
]])],
|
|
||||||
[
|
|
||||||
m4_defn([UPEFL])[]_LIBS="$m4_defn([UPEFL])[]_LIBS $2"
|
|
||||||
requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} $2"
|
|
||||||
_efl_have_fct="yes"
|
|
||||||
],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
|
|
||||||
LIBS="${LIBS_save}"
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$3], [$4])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])
|
|
||||||
m4_popdef([UPEFL])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_FUNC_SHM_OPEN is for internal use
|
dnl _EFL_CHECK_FUNC_SHM_OPEN is for internal use
|
||||||
dnl _EFL_CHECK_FUNC_SHM_OPEN(EFL, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND)
|
dnl _EFL_CHECK_FUNC_SHM_OPEN(EFL, VARIABLE)
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_FUNC_SHM_OPEN],
|
AC_DEFUN([_EFL_CHECK_FUNC_SHM_OPEN],
|
||||||
[
|
[EFL_FIND_LIB_FOR_CODE([$1], [-lrt], [$2], [[
|
||||||
_efl_have_fct="no"
|
#include <sys/mman.h>
|
||||||
|
#include <sys/stat.h> /* For mode constants */
|
||||||
dnl Check is shm_open is in libc
|
#include <fcntl.h> /* For O_* constants */
|
||||||
_EFL_CHECK_FUNC_SHM_OPEN_PRIV([$1], [],
|
]], [[
|
||||||
[_efl_have_fct="yes"],
|
int fd = shm_open("/dev/null", O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
[_efl_have_fct="no"])
|
]])
|
||||||
|
|
||||||
dnl Check is shm_open is in librt
|
|
||||||
if test "x${_efl_have_fct}" = "xno" ; then
|
|
||||||
_EFL_CHECK_FUNC_SHM_OPEN_PRIV([$1], [-lrt],
|
|
||||||
[_efl_have_fct="yes"],
|
|
||||||
[_efl_have_fct="no"])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AS_IF([test "x${_efl_have_fct}" = "xyes"], [$2], [$3])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Macro that checks function availability
|
dnl Macro that checks function availability
|
||||||
dnl
|
dnl
|
||||||
dnl EFL_CHECK_FUNC(EFL, FUNCTION)
|
dnl EFL_CHECK_FUNC(EFL, FUNCTION)
|
||||||
dnl AC_SUBST : EFL_CFLAGS and EFL_LIBS (EFL being replaced by its value)
|
dnl AC_SUBST : EFL_CFLAGS and EFL_LIBS (EFL being replaced by its value)
|
||||||
dnl AC_DEFINE : EFL_HAVE_FUNCTION (FUNCTION being replaced by its value)
|
dnl AC_DEFINE : HAVE_FUNCTION (FUNCTION being replaced by its value)
|
||||||
dnl result in efl_func_function (function being replaced by its value)
|
dnl result in efl_func_function (function being replaced by its value)
|
||||||
|
|
||||||
AC_DEFUN([EFL_CHECK_FUNC],
|
AC_DEFUN([EFL_CHECK_FUNC],
|
||||||
[
|
[dnl
|
||||||
m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl
|
m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl
|
||||||
m4_pushdef([DOWN], m4_translit([$2], [-A-Z], [_a-z]))dnl
|
m4_pushdef([DOWN], m4_translit([$2], [-A-Z], [_a-z]))dnl
|
||||||
|
|
||||||
m4_default([_EFL_CHECK_FUNC_]m4_defn([UP]))($1, [have_fct="yes"], [have_fct="no"])
|
m4_default([_EFL_CHECK_FUNC_]m4_defn([UP]))($1, [have_fct])
|
||||||
|
AC_MSG_CHECKING([for $2])
|
||||||
if test "x$2" = "xsetxattr" ; then
|
|
||||||
AC_MSG_CHECKING([for extended attributes])
|
|
||||||
else
|
|
||||||
AC_MSG_CHECKING([for ]m4_defn([DOWN]))
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_RESULT([${have_fct}])
|
AC_MSG_RESULT([${have_fct}])
|
||||||
|
|
||||||
if test "x${have_fct}" = "xyes" ; then
|
if test "x${have_fct}" = "xyes" ; then
|
||||||
if test "x$2" = "xsetxattr" ; then
|
|
||||||
AC_DEFINE([HAVE_XATTR], [1], [Define to 1 if you have the `listxattr', `setxattr' and `getxattr' functions.])
|
|
||||||
else
|
|
||||||
AC_DEFINE([HAVE_]m4_defn([UP]), [1], [Define to 1 if you have the `]m4_defn([DOWN])[' function.])
|
AC_DEFINE([HAVE_]m4_defn([UP]), [1], [Define to 1 if you have the `]m4_defn([DOWN])[' function.])
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
efl_func_[]m4_defn([DOWN])="${have_fct}"
|
efl_func_[]m4_defn([DOWN])="${have_fct}"
|
||||||
|
m4_popdef([DOWN])dnl
|
||||||
m4_popdef([DOWN])
|
m4_popdef([UP])dnl
|
||||||
m4_popdef([UP])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Macro that iterates over a sequence of space separated functions
|
dnl Macro that iterates over a sequence of space separated functions
|
||||||
|
@ -548,6 +238,4 @@ dnl
|
||||||
dnl EFL_CHECK_FUNCS(EFL, FUNCTIONS)
|
dnl EFL_CHECK_FUNCS(EFL, FUNCTIONS)
|
||||||
|
|
||||||
AC_DEFUN([EFL_CHECK_FUNCS],
|
AC_DEFUN([EFL_CHECK_FUNCS],
|
||||||
[
|
[m4_foreach_w([fct], [$2], [EFL_CHECK_FUNC($1, m4_defn([fct]))])])
|
||||||
m4_foreach_w([fct], [$2], [EFL_CHECK_FUNC($1, m4_defn([fct]))])
|
|
||||||
])
|
|
||||||
|
|
|
@ -12,18 +12,16 @@ dnl it will abort (AC_MSG_ERROR) if libjpeg is not found.
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_LIB_LIBJPEG],
|
AC_DEFUN([_EFL_CHECK_LIB_LIBJPEG],
|
||||||
[dnl
|
[dnl
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
EFL_CHECK_LIB_CODE([$1], [-ljpeg], [have_fct], [[
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
#include <stdio.h>
|
||||||
|
#include <jpeglib.h>
|
||||||
|
]], [[
|
||||||
|
struct jpeg_error_mgr er; void *error = jpeg_std_error(&er);
|
||||||
|
]])
|
||||||
|
|
||||||
AC_CHECK_HEADER([jpeglib.h], [],
|
if test "${have_fct}" = "no"; then
|
||||||
[AC_MSG_ERROR([Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file])])
|
AC_MSG_ERROR([Cannot find libjpeg. Make sure your CFLAGS and LDFLAGS environment variable are set properly.])
|
||||||
|
fi
|
||||||
AC_CHECK_LIB([jpeg], [jpeg_std_error],
|
|
||||||
[requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -ljpeg"],
|
|
||||||
[AC_MSG_ERROR([Cannot find libjpeg library. Make sure your LDFLAGS environment variable contains include lines for the location of this file])])
|
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])dnl
|
|
||||||
m4_popdef([UPEFL])dnl
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl _EFL_CHECK_LIB_ZLIB is for internal use
|
dnl _EFL_CHECK_LIB_ZLIB is for internal use
|
||||||
|
@ -32,25 +30,23 @@ dnl it will abort (AC_MSG_ERROR) if zlib is not found.
|
||||||
|
|
||||||
AC_DEFUN([_EFL_CHECK_LIB_ZLIB],
|
AC_DEFUN([_EFL_CHECK_LIB_ZLIB],
|
||||||
[dnl
|
[dnl
|
||||||
m4_pushdef([UPEFL], m4_translit([$1], [-a-z], [_A-Z]))dnl
|
|
||||||
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
m4_pushdef([DOWNEFL], m4_translit([$1], [-A-Z], [_a-z]))dnl
|
||||||
|
|
||||||
PKG_CHECK_EXISTS([zlib >= 1.2.3], [_efl_have_lib="yes"], [_efl_have_lib="no"])
|
PKG_CHECK_EXISTS([zlib >= 1.2.3], [_efl_have_lib="yes"], [_efl_have_lib="no"])
|
||||||
|
|
||||||
if test "x${_efl_have_lib}" = "xyes" ; then
|
if test "${_efl_have_lib}" = "yes"; then
|
||||||
requirements_pc_[]m4_defn([DOWNEFL])="${requirements_pc_[]m4_defn([DOWNEFL])} zlib >= 1.2.3"
|
requirements_pc_[]m4_defn([DOWNEFL])="${requirements_pc_[]m4_defn([DOWNEFL])} zlib >= 1.2.3"
|
||||||
requirements_pc_deps_[]m4_defn([DOWNEFL])="${requirements_pc_deps_[]m4_defn([DOWNEFL])} zlib >= 1.2.3"
|
requirements_pc_deps_[]m4_defn([DOWNEFL])="${requirements_pc_deps_[]m4_defn([DOWNEFL])} zlib >= 1.2.3"
|
||||||
else
|
else
|
||||||
AC_CHECK_HEADER([zlib.h], [],
|
EFL_CHECK_LIB_CODE([$1], [-lz], [have_fct], [[
|
||||||
[AC_MSG_ERROR([Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file])])
|
#include <zlib.h>
|
||||||
|
]], [[const char *v = zlibVersion();]])
|
||||||
|
|
||||||
AC_CHECK_LIB([z], [zlibVersion],
|
if test "${have_fct}" = "no"; then
|
||||||
[requirements_libs_[]m4_defn([DOWNEFL])="${requirements_libs_[]m4_defn([DOWNEFL])} -lz"],
|
AC_MSG_ERROR([Cannot find zlib. Make sure your CFLAGS and LDFLAGS environment variable are set properly.])
|
||||||
[AC_MSG_ERROR([Cannot find libjpeg library. Make sure your LDFLAGS environment variable contains include lines for the location of this file])])
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
m4_popdef([DOWNEFL])dnl
|
m4_popdef([DOWNEFL])dnl
|
||||||
m4_popdef([UPEFL])dnl
|
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Macro that checks for a library
|
dnl Macro that checks for a library
|
||||||
|
@ -61,11 +57,9 @@ dnl it will abort if library is not found
|
||||||
AC_DEFUN([EFL_CHECK_LIB],
|
AC_DEFUN([EFL_CHECK_LIB],
|
||||||
[dnl
|
[dnl
|
||||||
m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl
|
m4_pushdef([UP], m4_translit([$2], [-a-z], [_A-Z]))dnl
|
||||||
|
|
||||||
AC_MSG_CHECKING([for $2])
|
|
||||||
m4_default([_EFL_CHECK_LIB_]m4_defn([UP]))($1)
|
m4_default([_EFL_CHECK_LIB_]m4_defn([UP]))($1)
|
||||||
|
AC_MSG_CHECKING([for $2])
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
|
|
||||||
m4_popdef([UP])dnl
|
m4_popdef([UP])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue