aboutsummaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-09 16:48:40 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-09 16:48:40 +0000
commit57090b2abbb9dea419c99c5ce33a48e07ec33725 (patch)
treec5f6dd8cf2883a413994f0be2c6fb5df2b2d0c3f /m4
parentf0a7a2a75170043bb3c44e511cc3558dc585293c (diff)
downloadefl-57090b2abbb9dea419c99c5ce33a48e07ec33725.tar.gz
efl-57090b2abbb9dea419c99c5ce33a48e07ec33725.tar.xz
efl-57090b2abbb9dea419c99c5ce33a48e07ec33725.zip
efl: improve X detection by Joel Klinghed.
* Split out ecore_imf_xim to do its own check * Fixed problem with xcb's makekeys, no rule for $(top_builddir)/src/utils/ecore/makekeys$(EXEEXT) exists so make used an implicit rule (ignoring any cflags of course) * Fixed gl_x11 engine to build with either Xlib or XCB (xcb flags were missing) * Added EFL_FIND_X and replace any used of AC_PATH_X{,TRA}. First looks for Xorg pkg-config files then if those arn't found it falls back to old AC_PATH_X. Also generalized common header and lib checks. Could probably use some polishing (the AC_CACHE_VAL cruft especially) but this is what I have time for tonight. Now X11 should be found on non-standard locations by means of xmkmf, --x-includes/--x-libraries and also pkg-config. SVN revision: 82475
Diffstat (limited to 'm4')
-rw-r--r--m4/ecore_check_c_extension.m48
-rw-r--r--m4/efl_find_x.m4193
-rw-r--r--m4/evas_check_engine.m4399
3 files changed, 369 insertions, 231 deletions
diff --git a/m4/ecore_check_c_extension.m4 b/m4/ecore_check_c_extension.m4
index f6e88ac57..da4b44fe0 100644
--- a/m4/ecore_check_c_extension.m4
+++ b/m4/ecore_check_c_extension.m4
@@ -4,13 +4,15 @@ AC_DEFUN([ECORE_CHECK_X_EXTENSION],
pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
SAVE_CFLAGS=$CFLAGS
- CFLAGS="$x_cflags ${x_includes:+-I${x_includes}}"
+ CFLAGS="$CFLAGS $ECORE_X_XLIB_cflags"
AC_CHECK_HEADER(X11/extensions/$2,
[
+ SAVE_LIBS=$LIBS
+ LIBS="$LIBS $ECORE_X_XLIB_libs"
AC_CHECK_LIB($3, $4,
[AC_DEFINE(ECORE_[]UP, 1, [Build support for $1])],
- [AC_MSG_ERROR([Missing support for X extension: $1])],
- [$x_libs])
+ [AC_MSG_ERROR([Missing support for X extension: $1])])
+ LIBS=$SAVE_LIBS
],
[AC_MSG_ERROR([Missing X11/extensions/$2])],
[ #include <X11/Xlib.h> ]
diff --git a/m4/efl_find_x.m4 b/m4/efl_find_x.m4
new file mode 100644
index 000000000..dad401fcf
--- /dev/null
+++ b/m4/efl_find_x.m4
@@ -0,0 +1,193 @@
+# efl_find.x.m4 - Macros to locate X11. -*- Autoconf -*-
+# EFL_FIND_X(VARIABLE-PREFIX, [headers = "X11/Xlib.h"],
+# [libs-and-functions = "X11 XOpenDisplay"],
+# [action-if-found], [action-if-not-found])
+# checks for X11 using, in order:
+# 1) Xorg pkg-config files (using enviroment variables EFL_X11_CFLAGS
+# and EFL_X11_LIBS if set, but only if x11.pc exists)
+# 2) command line options: --x-includes=dir, --x-libraries=dir
+# assume there is an X11 in the given directories
+# 3) XMKMF environment variable if set
+# 4) xmkmf executable if found
+# 5) list of "standard" directories
+#
+# 2-5 is handled by A_PATH_X
+#
+# If a X11 is found, [action-if-success] is run and VARIABLE_cflags and
+# VARIABLE_libs and VARIABLE_libdirs are defined and substituted.
+# VARIABLE_libs will contain all of the libs listed in libs-and-functions.
+# VARIABLE_libdirs will contain all -Lpath:s found in VARIABLE_libs
+#
+# headers is a list of headers to look for. libs-and-functions is a list of
+# library and function pairs to look for.
+# Each lib and function is checked in pairs, example:
+# EFL_FIND_X([EVAS_X11], [X11/X.h], [X11 XCreateImage Xext XShmCreateImage])
+# will look for XCreateImage in X11 and XShmCreateImage in Xext and include
+# both -lX11 and -lXext in VARIABLE_libs
+#
+# action-if-found is only called if X11, all headers, all libraries and
+# all functions are found.
+# You can call EFL_FIND_X multiple times with different lists of headers, libs
+# and functions.
+
+AC_DEFUN([EFL_FIND_X],
+[
+ # Must print something as AC_CACHE_VAL writes (cached) if the value is cached
+ AC_MSG_CHECKING([how to find X])
+ efl_x11_need_result=1
+ AC_CACHE_VAL(efl_cv_x11_cache,
+ [
+ # this is ugly and breaks that AC_CACHE_VAL may not have side effects
+ # but I can't think of a better way right now
+ efl_x11_need_result=0
+ PKG_CHECK_EXISTS([x11],
+ [
+ AC_MSG_RESULT([use pkg-config])
+ PKG_CHECK_MODULES([EFL_X11],[x11],
+ [
+ efl_cv_have_x11=yes
+ efl_cv_x11_pkgconf=yes
+ efl_cv_x11_cflags=$EFL_X11_CFLAGS
+ efl_cv_x11_libs_pre=$EFL_X11_LIBS
+ efl_cv_x11_libs_post=
+ ])
+ ],
+ [
+ AC_MSG_RESULT([use xmkmf])
+ # Fallback to old AC_PATH_XTRA
+ AC_PATH_X
+ AC_PATH_XTRA
+ if test "$no_x" = yes; then
+ efl_cv_have_x11=no
+ else
+ efl_cv_have_x11=yes
+ efl_cv_x11_pkgconf=no
+ efl_cv_x11_cflags=$X_CFLAGS
+ efl_cv_x11_libs_pre="$X_PRE_LIBS $X_LIBS"
+ efl_cv_x11_libs_post=$X_EXTRA_LIBS
+ fi
+ ])
+ # Record where we found X for the cache.
+ if test "x$efl_cv_have_x11" = "xno"; then
+ efl_cv_x11_cache="efl_cv_have_x11=no"
+ else
+ efl_cv_x11_cache="efl_cv_have_x11=yes\
+ efl_cv_x11_pkgconf='$efl_cv_x11_pkgconf'\
+ efl_cv_x11_cflags='$efl_cv_x11_cflags'\
+ efl_cv_x11_libs_pre='$efl_cv_x11_libs_pre'\
+ efl_cv_x11_libs_post='$efl_cv_x11_libs_post'"
+ fi
+ ])
+ if test "x$efl_x11_need_result" = "x1"; then
+ AC_MSG_RESULT([already found])
+ fi
+ eval "$efl_cv_x11_cache"
+
+ if test "x$efl_cv_have_x11" = "xyes"; then
+ ELF_X11_CFLAGS_save="$CFLAGS"
+ ELF_X11_CPPFLAGS_save="$CPPFLAGS"
+ CFLAGS="$CFLAGS $efl_cv_x11_cflags"
+ CPPFLAGS="$CPPFLAGS $efl_cv_x11_cflags"
+ efl_x11_found_all=1
+ for efl_x11_header in ifelse([$2], , "X11/Xlib.h", [$2]); do
+ AC_CHECK_HEADER([$efl_x11_header],,[
+ efl_x11_found_all=0
+ break])
+ done
+ CPPFLAGS="$ELF_X11_CPPFLAGS_save"
+ CFLAGS="$ELF_X11_CFLAGS_save"
+
+ if test "x$efl_x11_found_all" = "x1"; then
+ EFL_X11_LIBS_save="$LIBS"
+ if test "x$efl_cv_x11_pkgconf" = "xyes"; then
+ efl_x11_modules="x11"
+ efl_x11_lib=""
+ for efl_x11_lib_function in ifelse([$3], , "X11 XOpenDisplay", [$3]); do
+ if test -z "$efl_x11_lib"; then
+ efl_x11_lib="$efl_x11_lib_function"
+ case $efl_x11_lib in
+ X11)
+ ;;
+ Xss)
+ efl_x11_modules="$efl_x11_modules xscrnsaver"
+ ;;
+ *)
+ efl_x11_lib=`echo $efl_x11_lib | tr '[A-Z]' '[a-z]'`
+ efl_x11_modules="$efl_x11_modules $efl_x11_lib"
+ ;;
+ esac
+ else
+ efl_x11_lib=
+ fi
+ done
+
+ PKG_CHECK_EXISTS([$efl_x11_modules],
+ [
+ PKG_CHECK_MODULES([$1],[$efl_x11_modules],
+ [
+ efl_x11_cflags=$[]$1[]_CFLAGS
+ efl_x11_libs=$[]$1[]_LIBS
+
+ LIBS="$LIBS $[]$1[]_LIBS"
+ efl_x11_lib=""
+ for efl_x11_lib_function in ifelse([$3], , "X11 XOpenDisplay", [$3]); do
+ if test -z "$efl_x11_lib"; then
+ efl_x11_lib="$efl_x11_lib_function"
+ else
+ # This is a ugly way of using AC_CHECK_FUNC with different
+ # LIBS
+ eval "unset ac_cv_func_$efl_x11_lib_function"
+ AC_CHECK_FUNC([$efl_x11_lib_function],,
+ [
+ efl_x11_found_all=0
+ break])
+ efl_x11_lib=
+ fi
+ done
+ ])
+ ],[efl_x11_found_all=0])
+ else
+ LIBS="$LIBS $efl_cv_x11_libs_pre"
+ efl_x11_libs="$efl_cv_x11_libs_pre"
+ efl_x11_lib=""
+ for efl_x11_lib_function in ifelse([$3], , "X11 XOpenDisplay", [$3]); do
+ if test -z "$efl_x11_lib"; then
+ efl_x11_lib="$efl_x11_lib_function"
+ else
+ AC_CHECK_LIB([$efl_x11_lib], [$efl_x11_lib_function],,[
+ efl_x11_found_all=0
+ break],["$efl_cv_x11_libs_post"])
+ efl_x11_libs="$efl_x11_libs -l$efl_x11_lib"
+ efl_x11_lib=
+ fi
+ done
+ if test -n "$efl_cv_x11_libs_post"; then
+ efl_x11_libs="$efl_x11_libs $efl_cv_x11_libs_post"
+ fi
+ fi
+ LIBS="$EFL_X11_LIBS_save"
+ fi
+ fi
+
+ if test "x$efl_x11_found_all" = "x1"; then
+ efl_x11_libdirs=""
+ for efl_x11_option in "$efl_x11_libs"; do
+ case $efl_x11_option in
+ -L*)
+ efl_x11_libdirs="$efl_x11_libdirs $efl_x11_option"
+ ;;
+ *)
+ ;;
+ esac
+ done
+
+ AC_SUBST([$1][_cflags],[$efl_cv_x11_cflags])
+ AC_SUBST([$1][_libs],[$efl_x11_libs])
+ AC_SUBST([$1][_libdirs],[$efl_x11_libdirs])
+
+ ifelse([$4], , :, [$4])
+ else
+ ifelse([$5], , :, [$5])
+ fi
+])
+
diff --git a/m4/evas_check_engine.m4 b/m4/evas_check_engine.m4
index e63303349..90d4b528c 100644
--- a/m4/evas_check_engine.m4
+++ b/m4/evas_check_engine.m4
@@ -4,44 +4,16 @@ dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_XLIB(engine, simple, want_static[, ACTIO
AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_XLIB],
[
-have_dep="no"
-evas_engine_[]$1[]_cflags=""
-evas_engine_[]$1[]_libs=""
-
-AC_PATH_X
-AC_PATH_XTRA
-
-AC_CHECK_HEADER([X11/X.h], [have_dep="yes"])
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([X11], [XCreateImage], [have_dep="yes"], [have_dep="no"])
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([Xext], [XShmCreateImage], [have_dep="yes"], [have_dep="no"])
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- if test "x$2" = "xyes" ; then
- x_libs="${x_libs} -lX11 -lXext"
- else
- x_dir=${x_dir:-/usr/X11R6}
- x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
- x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
- fi
- evas_engine_[]$1[]_cflags="${x_cflags}"
- evas_engine_[]$1[]_libs="${x_libs}"
-fi
-
-if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
- requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
-fi
-
-AC_SUBST([evas_engine_$1_cflags])
-AC_SUBST([evas_engine_$1_libs])
-
-AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
-
+EFL_FIND_X(evas_engine_[]$1,
+ [X11/X.h], [X11 XCreateImage Xext XShmCreateImage],
+ [
+ if test "x$3" = "xstatic"; then
+ requirements_libs_evas="$evas_engine_[]$1[]_libs $requirements_libs_evas"
+ fi
+ ifelse([$4], , :, [$4])
+ ],[
+ ifelse([$5], , :, [$5])
+ ])
])
dnl use: EVAS_CHECK_ENGINE_DEP_GL_XLIB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
@@ -49,16 +21,19 @@ dnl use: EVAS_CHECK_ENGINE_DEP_GL_XLIB(engine, simple, want_static[, ACTION-IF-F
AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_XLIB],
[
-evas_engine_[]$1[]_cflags=""
-evas_engine_[]$1[]_libs=""
-
-AC_PATH_X
-AC_PATH_XTRA
-
-AC_CHECK_HEADER([GL/gl.h],
- [have_dep="yes"],
- [have_dep="no"],
- [
+EFL_FIND_X(evas_engine_[]$1,
+ [X11/Xlib.h X11/Xatom.h X11/Xutil.h X11/extensions/Xrender.h X11/Xresource.h],
+ [X11 XCreateColormap Xrender XRenderCreatePicture],
+ [
+ CFLAGS_save="$CFLAGS"
+ CFLAGS="$evas_engine_[]$1[]_cflags $CFLAGS"
+ CPPFLAGS_save="$CPPFLAGS"
+ CPPFLAGS="$evas_engine_[]$1[]_cflags $CPPFLAGS"
+
+ AC_CHECK_HEADER([GL/gl.h],
+ [have_dep="yes"],
+ [have_dep="no"],
+ [
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glx.h>
@@ -67,72 +42,52 @@ AC_CHECK_HEADER([GL/gl.h],
#include <X11/Xutil.h>
#include <X11/extensions/Xrender.h>
#include <X11/Xresource.h>
- ])
+ ])
-gl_pt_lib="";
-have_gl_pt="no"
+ gl_pt_lib=""
+ have_gl_pt="no"
-AC_MSG_CHECKING([whether pthread_create() is supported])
-CFLAGS_save="${CFLAGS}"
-CFLAGS="${CFLAGS} -pthread"
-LIBS_save="${LIBS}"
-LIBS="${LIBS} -pthread"
-AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[
+ AC_MSG_CHECKING([whether pthread_create() is supported])
+ CFLAGS_pt_save="$CFLAGS"
+ CFLAGS="$CFLAGS -pthread"
+ LIBS_pt_save="$LIBS"
+ LIBS="$LIBS -pthread"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
#include <pthread.h>
- ]],
- [[
+ ]],
+ [[
pthread_create(NULL, NULL, NULL, NULL);
- ]])],
- [have_gl_pt="yes"],
- [have_gl_pt="no"])
-CFLAGS=${CFLAGS_save}
-LIBS=${LIBS_save}
-AC_MSG_RESULT([${have_gl_pt}])
-
-if test "x$have_gl_pt" = "xyes" ; then
- gl_pt_lib=" -pthread"
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([X11], [XCreateColormap], [have_dep="yes"], [have_dep="no"])
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([Xrender], [XRenderCreatePicture], [have_dep="yes"], [have_dep="no"])
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lX11 -lXext -lXrender -lm $gl_pt_lib])
-fi
-
-if test "x${gl_flavor_gles}" = "xyes" ; then
- have_dep=no
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- if test "x$2" = "xyes" ; then
- x_libs="${x_libs} -lX11 -lXext -lXrender"
- else
- x_dir=${x_dir:-/usr/X11R6}
- x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
- x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
- fi
- evas_engine_[]$1[]_cflags="-I/usr/include ${x_cflags}"
- evas_engine_[]$1[]_libs="${x_libs} -lGL $gl_pt_lib"
- evas_engine_gl_common_libs="-lGL $gl_pt_lib"
-else
- if test "x$2" = "xyes" ; then
- x_libs="${x_libs} -lX11 -lXext -lXrender"
- else
- x_dir=${x_dir:-/usr/X11R6}
- x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
- x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
- fi
- AC_CHECK_HEADER([GLES2/gl2.h],
- [have_egl="yes"],
- [have_egl="no"],
- [
+ ]])],
+ [have_gl_pt="yes"],
+ [have_gl_pt="no"])
+ CFLAGS=$CFLAGS_pt_save
+ LIBS=$LIBS_pt_save
+ AC_MSG_RESULT([$have_gl_pt])
+
+ if test "x$have_gl_pt" = "xyes" ; then
+ gl_pt_lib=" -pthread"
+ fi
+
+ if test "x$have_dep" = "xyes"; then
+ LIBS_save="$LIBS"
+ LIBS="$LIBS $evas_engine_[]$1[]_libs"
+ AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lm $gl_pt_lib])
+ LIBS="$LIBS_save"
+ fi
+
+ if test "x${gl_flavor_gles}" = "xyes" ; then
+ have_dep=no
+ fi
+
+ if test "x$have_dep" = "xyes" ; then
+ evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs -lGL $gl_pt_lib"
+ evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGL $gl_pt_lib"
+ else
+ AC_CHECK_HEADER([GLES2/gl2.h],
+ [have_egl="yes"],
+ [have_egl="no"],
+ [
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
@@ -141,29 +96,30 @@ else
#include <X11/Xutil.h>
#include <X11/extensions/Xrender.h>
#include <X11/Xresource.h>
- ])
- if test "x${have_egl}" = "xyes" ; then
- AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL ${x_libs} -lm $gl_pt_lib)
- if test "x${have_glesv2}" = "xyes" ; then
- evas_engine_[]$1[]_cflags="${x_cflags}"
- evas_engine_[]$1[]_libs="${x_libs} -lGLESv2 -lEGL -lm $gl_pt_lib"
- evas_engine_gl_common_libs="-lGLESv2 -lm $gl_pt_lib"
- have_dep="yes"
- AC_DEFINE(GL_GLES, 1, [GLSL runtime shader GLES2 support])
- gles_variety_sgx="yes"
+ ])
+ if test "x${have_egl}" = "xyes" ; then
+ AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib)
+ if test "x${have_glesv2}" = "xyes" ; then
+ evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs -lGLESv2 -lEGL -lm $gl_pt_lib"
+ evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm $gl_pt_lib"
+ have_dep="yes"
+ AC_DEFINE(GL_GLES, 1, [GLSL runtime shader GLES2 support])
+ gles_variety_sgx="yes"
+ fi
fi
- fi
-fi
+ fi
-if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
- requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
-fi
+ CPPFLAGS="$CPPFLAGS_save"
+ CFLAGS="$CFLAGS_save"
-AC_SUBST([evas_engine_$1_cflags])
-AC_SUBST([evas_engine_$1_libs])
-
-AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
+ if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
+ requirements_libs_evas="$evas_engine_[]$1[]_libs $requirements_libs_evas"
+ fi
+ AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
+ ],[
+ ifelse([$5], , :, [$5])
+ ])
])
dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_XCB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
@@ -208,133 +164,120 @@ AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_XCB],
[
requirement=""
-have_dep="no"
-evas_engine_[]$1[]_cflags=""
-evas_engine_[]$1[]_libs=""
-AC_PATH_X
-AC_PATH_XTRA
-
-AC_CHECK_HEADER([GL/gl.h],
- [have_dep="yes"],
- [have_dep="no"],
- [
+EFL_FIND_X(evas_engine_[]$1, [GL/gl.h],
+ [X11 XCreateColormap Xrender XRenderCreatePicture],
+ [
+ CFLAGS_save="$CFLAGS"
+ CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags"
+ CPPFLAGS_save="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags"
+ AC_CHECK_HEADER([GL/glext.h],
+ [have_dep="yes"],
+ [have_dep="no"],
+ [
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glx.h>
- ])
-
-gl_pt_lib="";
-have_gl_pt="no"
-
-AC_MSG_CHECKING([whether pthread_create() is supported])
-CFLAGS_save="${CFLAGS}"
-CFLAGS="${CFLAGS} -pthread"
-LIBS_save="${LIBS}"
-LIBS="${LIBS} -pthread"
-AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[
+ ])
+ CPPFLAGS=$CPPFLAGS_save
+ CFLAGS=$CFLAGS_save
+
+ gl_pt_lib="";
+ have_gl_pt="no"
+
+ AC_MSG_CHECKING([whether pthread_create() is supported])
+ CFLAGS_save="${CFLAGS}"
+ CFLAGS="${CFLAGS} -pthread"
+ LIBS_save="${LIBS}"
+ LIBS="${LIBS} -pthread"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[
#include <pthread.h>
- ]],
- [[
+ ]],
+ [[
pthread_create(NULL, NULL, NULL, NULL);
- ]])],
- [have_gl_pt="yes"],
- [have_gl_pt="no"])
-CFLAGS=${CFLAGS_save}
-LIBS=${LIBS_save}
-AC_MSG_RESULT([${have_gl_pt}])
-
-if test "x$have_gl_pt" = "xyes" ; then
- gl_pt_lib=" -pthread"
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([X11], [XCreateColormap], [have_dep="yes"], [have_dep="no"])
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([Xrender], [XRenderCreatePicture], [have_dep="yes"], [have_dep="no"])
-fi
-
-if test "x${have_dep}" = "xyes" ; then
- AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], -lX11 -lXext -lXrender -lm $gl_pt_lib)
-fi
+ ]])],
+ [have_gl_pt="yes"],
+ [have_gl_pt="no"])
+ CFLAGS=${CFLAGS_save}
+ LIBS=${LIBS_save}
+ AC_MSG_RESULT([${have_gl_pt}])
+
+ if test "x$have_gl_pt" = "xyes" ; then
+ gl_pt_lib=" -pthread"
+ fi
+
+ if test "x$have_dep" = "xyes" ; then
+ LIBS_save="$LIBS"
+ LIBS="$LIBS $evas_engine_[]$1[]_libs"
+ AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lm $gl_pt_lib])
+ LIBS="$LIBS_save"
+ fi
+ ],[
+ have_dep=no
+ ])
PKG_CHECK_EXISTS([x11-xcb xcb xcb-glx xcb-render xcb-renderutil],
- [
+ [
have_dep="yes"
requirement="x11-xcb xcb xcb-glx xcb-render xcb-renderutil"
- ],
- [have_dep="no"])
+ ],
+ [have_dep="no"])
if test "x${have_dep}" = "xyes" ; then
- if test "x$3" = "xstatic" ; then
- requirements_pc_evas="${requirement} ${requirements_pc_evas}"
- requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
- else
- PKG_CHECK_MODULES([XCB_GL], [${requirement}])
- evas_engine_[]$1[]_cflags="${XCB_CFLAGS}"
- evas_engine_[]$1[]_libs="${XCB_LIBS}"
- fi
+ if test "x$3" = "xstatic" ; then
+ requirements_pc_evas="${requirement} ${requirements_pc_evas}"
+ requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
+ else
+ PKG_CHECK_MODULES([XCB_GL], [${requirement}])
+ fi
fi
-evas_engine_[]$1[]_cflags="${XCB_GL_CFLAGS}"
-evas_engine_[]$1[]_libs="${XCB_GL_LIBS}"
-
if test "x$gl_flavor_gles" = "xyes" ; then
have_dep=no
fi
if test "x${have_dep}" = "xyes" ; then
- if test "x$2" = "xyes" ; then
- x_libs="${x_libs} -lX11 -lXext -lXrender"
- else
- x_dir=${x_dir:-/usr/X11R6}
- x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
- x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
- fi
- evas_engine_[]$1[]_cflags="-I/usr/include ${XCB_GL_CFLAGS} ${x_cflags}"
- evas_engine_[]$1[]_libs="${XCB_GL_LIBS} ${x_libs} -lGL $gl_pt_lib"
- evas_engine_gl_common_libs="-lGL $gl_pt_lib"
+ evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS"
+ evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGL $gl_pt_lib"
+ evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGL $gl_pt_lib"
else
- if test "x$2" = "xyes" ; then
- x_libs="${x_libs} -lX11 -lXext -lXrender"
- else
- x_dir=${x_dir:-/usr/X11R6}
- x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
- x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
- fi
- AC_CHECK_HEADER([GLES2/gl2.h],
- [have_egl="yes"],
- [have_egl="no"],
- [
+ CFLAGS_save="$CFLAGS"
+ CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags"
+ CPPFLAGS_save="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags"
+ AC_CHECK_HEADER([GLES2/gl2.h],
+ [have_egl="yes"],
+ [have_egl="no"],
+ [
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <EGL/egl.h>
- ])
- if test "x${have_egl}" = "xyes" ; then
- AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL ${x_libs} -lm $gl_pt_lib)
- if test "x${have_glesv2}" = "xyes" ; then
- evas_engine_[]$1[]_cflags="${XCB_GL_CFLAGS} ${x_cflags}"
- evas_engine_[]$1[]_libs="${XCB_GL_LIBS} ${x_libs} -lGLESv2 -lEGL -lm $gl_pt_lib"
- evas_engine_gl_common_libs="-lGLESv2 -lm $gl_pt_lib"
- have_dep="yes"
- AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support])
- gles_variety_sgx="yes"
- fi
- fi
+ ])
+ CPPFLAGS=$CPPFLAGS_save
+ CFLAGS=$CFLAGS_save
+ if test "x${have_egl}" = "xyes" ; then
+ LIBS_save="$LIBS"
+ LIBS="$LIBS $evas_engine_[]$1[]_libs"
+ AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib)
+ if test "x${have_glesv2}" = "xyes" ; then
+ evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS"
+ evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGLESv2 -lEGL -lm $gl_pt_lib"
+ evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm $gl_pt_lib"
+ have_dep="yes"
+ AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support])
+ gles_variety_sgx="yes"
+ fi
+ fi
fi
if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
- requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
- requirements_pc_evas="${requirement} ${requirements_pc_evas}"
- requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
+ requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
+ requirements_pc_evas="${requirement} ${requirements_pc_evas}"
+ requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
fi
-AC_SUBST([evas_engine_$1_cflags])
-AC_SUBST([evas_engine_$1_libs])
-
AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
])