summaryrefslogtreecommitdiff
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)
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 f6e88ac579..da4b44fe0c 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],
4pushdef([UP], translit([$1], [a-z], [A-Z]))dnl 4pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
5 5
6 SAVE_CFLAGS=$CFLAGS 6 SAVE_CFLAGS=$CFLAGS
7 CFLAGS="$x_cflags ${x_includes:+-I${x_includes}}" 7 CFLAGS="$CFLAGS $ECORE_X_XLIB_cflags"
8 AC_CHECK_HEADER(X11/extensions/$2, 8 AC_CHECK_HEADER(X11/extensions/$2,
9 [ 9 [
10 SAVE_LIBS=$LIBS
11 LIBS="$LIBS $ECORE_X_XLIB_libs"
10 AC_CHECK_LIB($3, $4, 12 AC_CHECK_LIB($3, $4,
11 [AC_DEFINE(ECORE_[]UP, 1, [Build support for $1])], 13 [AC_DEFINE(ECORE_[]UP, 1, [Build support for $1])],
12 [AC_MSG_ERROR([Missing support for X extension: $1])], 14 [AC_MSG_ERROR([Missing support for X extension: $1])])
13 [$x_libs]) 15 LIBS=$SAVE_LIBS
14 ], 16 ],
15 [AC_MSG_ERROR([Missing X11/extensions/$2])], 17 [AC_MSG_ERROR([Missing X11/extensions/$2])],
16 [ #include <X11/Xlib.h> ] 18 [ #include <X11/Xlib.h> ]
diff --git a/m4/efl_find_x.m4 b/m4/efl_find_x.m4
new file mode 100644
index 0000000000..dad401fcf8
--- /dev/null
+++ b/m4/efl_find_x.m4
@@ -0,0 +1,193 @@
1# efl_find.x.m4 - Macros to locate X11. -*- Autoconf -*-
2# EFL_FIND_X(VARIABLE-PREFIX, [headers = "X11/Xlib.h"],
3# [libs-and-functions = "X11 XOpenDisplay"],
4# [action-if-found], [action-if-not-found])
5# checks for X11 using, in order:
6# 1) Xorg pkg-config files (using enviroment variables EFL_X11_CFLAGS
7# and EFL_X11_LIBS if set, but only if x11.pc exists)
8# 2) command line options: --x-includes=dir, --x-libraries=dir
9# assume there is an X11 in the given directories
10# 3) XMKMF environment variable if set
11# 4) xmkmf executable if found
12# 5) list of "standard" directories
13#
14# 2-5 is handled by A_PATH_X
15#
16# If a X11 is found, [action-if-success] is run and VARIABLE_cflags and
17# VARIABLE_libs and VARIABLE_libdirs are defined and substituted.
18# VARIABLE_libs will contain all of the libs listed in libs-and-functions.
19# VARIABLE_libdirs will contain all -Lpath:s found in VARIABLE_libs
20#
21# headers is a list of headers to look for. libs-and-functions is a list of
22# library and function pairs to look for.
23# Each lib and function is checked in pairs, example:
24# EFL_FIND_X([EVAS_X11], [X11/X.h], [X11 XCreateImage Xext XShmCreateImage])
25# will look for XCreateImage in X11 and XShmCreateImage in Xext and include
26# both -lX11 and -lXext in VARIABLE_libs
27#
28# action-if-found is only called if X11, all headers, all libraries and
29# all functions are found.
30# You can call EFL_FIND_X multiple times with different lists of headers, libs
31# and functions.
32
33AC_DEFUN([EFL_FIND_X],
34[
35 # Must print something as AC_CACHE_VAL writes (cached) if the value is cached
36 AC_MSG_CHECKING([how to find X])
37 efl_x11_need_result=1
38 AC_CACHE_VAL(efl_cv_x11_cache,
39 [
40 # this is ugly and breaks that AC_CACHE_VAL may not have side effects
41 # but I can't think of a better way right now
42 efl_x11_need_result=0
43 PKG_CHECK_EXISTS([x11],
44 [
45 AC_MSG_RESULT([use pkg-config])
46 PKG_CHECK_MODULES([EFL_X11],[x11],
47 [
48 efl_cv_have_x11=yes
49 efl_cv_x11_pkgconf=yes
50 efl_cv_x11_cflags=$EFL_X11_CFLAGS
51 efl_cv_x11_libs_pre=$EFL_X11_LIBS
52 efl_cv_x11_libs_post=
53 ])
54 ],
55 [
56 AC_MSG_RESULT([use xmkmf])
57 # Fallback to old AC_PATH_XTRA
58 AC_PATH_X
59 AC_PATH_XTRA
60 if test "$no_x" = yes; then
61 efl_cv_have_x11=no
62 else
63 efl_cv_have_x11=yes
64 efl_cv_x11_pkgconf=no
65 efl_cv_x11_cflags=$X_CFLAGS
66 efl_cv_x11_libs_pre="$X_PRE_LIBS $X_LIBS"
67 efl_cv_x11_libs_post=$X_EXTRA_LIBS
68 fi
69 ])
70 # Record where we found X for the cache.
71 if test "x$efl_cv_have_x11" = "xno"; then
72 efl_cv_x11_cache="efl_cv_have_x11=no"
73 else
74 efl_cv_x11_cache="efl_cv_have_x11=yes\
75 efl_cv_x11_pkgconf='$efl_cv_x11_pkgconf'\
76 efl_cv_x11_cflags='$efl_cv_x11_cflags'\
77 efl_cv_x11_libs_pre='$efl_cv_x11_libs_pre'\
78 efl_cv_x11_libs_post='$efl_cv_x11_libs_post'"
79 fi
80 ])
81 if test "x$efl_x11_need_result" = "x1"; then
82 AC_MSG_RESULT([already found])
83 fi
84 eval "$efl_cv_x11_cache"
85
86 if test "x$efl_cv_have_x11" = "xyes"; then
87 ELF_X11_CFLAGS_save="$CFLAGS"
88 ELF_X11_CPPFLAGS_save="$CPPFLAGS"
89 CFLAGS="$CFLAGS $efl_cv_x11_cflags"
90 CPPFLAGS="$CPPFLAGS $efl_cv_x11_cflags"
91 efl_x11_found_all=1
92 for efl_x11_header in ifelse([$2], , "X11/Xlib.h", [$2]); do
93 AC_CHECK_HEADER([$efl_x11_header],,[
94 efl_x11_found_all=0
95 break])
96 done
97 CPPFLAGS="$ELF_X11_CPPFLAGS_save"
98 CFLAGS="$ELF_X11_CFLAGS_save"
99
100 if test "x$efl_x11_found_all" = "x1"; then
101 EFL_X11_LIBS_save="$LIBS"
102 if test "x$efl_cv_x11_pkgconf" = "xyes"; then
103 efl_x11_modules="x11"
104 efl_x11_lib=""
105 for efl_x11_lib_function in ifelse([$3], , "X11 XOpenDisplay", [$3]); do
106 if test -z "$efl_x11_lib"; then
107 efl_x11_lib="$efl_x11_lib_function"
108 case $efl_x11_lib in
109 X11)
110 ;;
111 Xss)
112 efl_x11_modules="$efl_x11_modules xscrnsaver"
113 ;;
114 *)
115 efl_x11_lib=`echo $efl_x11_lib | tr '[A-Z]' '[a-z]'`
116 efl_x11_modules="$efl_x11_modules $efl_x11_lib"
117 ;;
118 esac
119 else
120 efl_x11_lib=
121 fi
122 done
123
124 PKG_CHECK_EXISTS([$efl_x11_modules],
125 [
126 PKG_CHECK_MODULES([$1],[$efl_x11_modules],
127 [
128 efl_x11_cflags=$[]$1[]_CFLAGS
129 efl_x11_libs=$[]$1[]_LIBS
130
131 LIBS="$LIBS $[]$1[]_LIBS"
132 efl_x11_lib=""
133 for efl_x11_lib_function in ifelse([$3], , "X11 XOpenDisplay", [$3]); do
134 if test -z "$efl_x11_lib"; then
135 efl_x11_lib="$efl_x11_lib_function"
136 else
137 # This is a ugly way of using AC_CHECK_FUNC with different
138 # LIBS
139 eval "unset ac_cv_func_$efl_x11_lib_function"
140 AC_CHECK_FUNC([$efl_x11_lib_function],,
141 [
142 efl_x11_found_all=0
143 break])
144 efl_x11_lib=
145 fi
146 done
147 ])
148 ],[efl_x11_found_all=0])
149 else
150 LIBS="$LIBS $efl_cv_x11_libs_pre"
151 efl_x11_libs="$efl_cv_x11_libs_pre"
152 efl_x11_lib=""
153 for efl_x11_lib_function in ifelse([$3], , "X11 XOpenDisplay", [$3]); do
154 if test -z "$efl_x11_lib"; then
155 efl_x11_lib="$efl_x11_lib_function"
156 else
157 AC_CHECK_LIB([$efl_x11_lib], [$efl_x11_lib_function],,[
158 efl_x11_found_all=0
159 break],["$efl_cv_x11_libs_post"])
160 efl_x11_libs="$efl_x11_libs -l$efl_x11_lib"
161 efl_x11_lib=
162 fi
163 done
164 if test -n "$efl_cv_x11_libs_post"; then
165 efl_x11_libs="$efl_x11_libs $efl_cv_x11_libs_post"
166 fi
167 fi
168 LIBS="$EFL_X11_LIBS_save"
169 fi
170 fi
171
172 if test "x$efl_x11_found_all" = "x1"; then
173 efl_x11_libdirs=""
174 for efl_x11_option in "$efl_x11_libs"; do
175 case $efl_x11_option in
176 -L*)
177 efl_x11_libdirs="$efl_x11_libdirs $efl_x11_option"
178 ;;
179 *)
180 ;;
181 esac
182 done
183
184 AC_SUBST([$1][_cflags],[$efl_cv_x11_cflags])
185 AC_SUBST([$1][_libs],[$efl_x11_libs])
186 AC_SUBST([$1][_libdirs],[$efl_x11_libdirs])
187
188 ifelse([$4], , :, [$4])
189 else
190 ifelse([$5], , :, [$5])
191 fi
192])
193
diff --git a/m4/evas_check_engine.m4 b/m4/evas_check_engine.m4
index e63303349e..90d4b528c4 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
4AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_XLIB], 4AC_DEFUN([EVAS_CHECK_ENGINE_DEP_SOFTWARE_XLIB],
5[ 5[
6 6
7have_dep="no" 7EFL_FIND_X(evas_engine_[]$1,
8evas_engine_[]$1[]_cflags="" 8 [X11/X.h], [X11 XCreateImage Xext XShmCreateImage],
9evas_engine_[]$1[]_libs="" 9 [
10 10 if test "x$3" = "xstatic"; then
11AC_PATH_X 11 requirements_libs_evas="$evas_engine_[]$1[]_libs $requirements_libs_evas"
12AC_PATH_XTRA 12 fi
13 13 ifelse([$4], , :, [$4])
14AC_CHECK_HEADER([X11/X.h], [have_dep="yes"]) 14 ],[
15 15 ifelse([$5], , :, [$5])
16if test "x${have_dep}" = "xyes" ; then 16 ])
17 AC_CHECK_LIB([X11], [XCreateImage], [have_dep="yes"], [have_dep="no"])
18fi
19
20if test "x${have_dep}" = "xyes" ; then
21 AC_CHECK_LIB([Xext], [XShmCreateImage], [have_dep="yes"], [have_dep="no"])
22fi
23
24if test "x${have_dep}" = "xyes" ; then
25 if test "x$2" = "xyes" ; then
26 x_libs="${x_libs} -lX11 -lXext"
27 else
28 x_dir=${x_dir:-/usr/X11R6}
29 x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
30 x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
31 fi
32 evas_engine_[]$1[]_cflags="${x_cflags}"
33 evas_engine_[]$1[]_libs="${x_libs}"
34fi
35
36if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
37 requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
38fi
39
40AC_SUBST([evas_engine_$1_cflags])
41AC_SUBST([evas_engine_$1_libs])
42
43AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
44
45]) 17])
46 18
47dnl use: EVAS_CHECK_ENGINE_DEP_GL_XLIB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 19dnl 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
49AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_XLIB], 21AC_DEFUN([EVAS_CHECK_ENGINE_DEP_GL_XLIB],
50[ 22[
51 23
52evas_engine_[]$1[]_cflags="" 24EFL_FIND_X(evas_engine_[]$1,
53evas_engine_[]$1[]_libs="" 25 [X11/Xlib.h X11/Xatom.h X11/Xutil.h X11/extensions/Xrender.h X11/Xresource.h],
54 26 [X11 XCreateColormap Xrender XRenderCreatePicture],
55AC_PATH_X 27 [
56AC_PATH_XTRA 28 CFLAGS_save="$CFLAGS"
57 29 CFLAGS="$evas_engine_[]$1[]_cflags $CFLAGS"
58AC_CHECK_HEADER([GL/gl.h], 30 CPPFLAGS_save="$CPPFLAGS"
59 [have_dep="yes"], 31 CPPFLAGS="$evas_engine_[]$1[]_cflags $CPPFLAGS"
60 [have_dep="no"], 32
61 [ 33 AC_CHECK_HEADER([GL/gl.h],
34 [have_dep="yes"],
35 [have_dep="no"],
36 [
62#include <GL/gl.h> 37#include <GL/gl.h>
63#include <GL/glext.h> 38#include <GL/glext.h>
64#include <GL/glx.h> 39#include <GL/glx.h>
@@ -67,72 +42,52 @@ AC_CHECK_HEADER([GL/gl.h],
67#include <X11/Xutil.h> 42#include <X11/Xutil.h>
68#include <X11/extensions/Xrender.h> 43#include <X11/extensions/Xrender.h>
69#include <X11/Xresource.h> 44#include <X11/Xresource.h>
70 ]) 45 ])
71 46
72gl_pt_lib=""; 47 gl_pt_lib=""
73have_gl_pt="no" 48 have_gl_pt="no"
74 49
75AC_MSG_CHECKING([whether pthread_create() is supported]) 50 AC_MSG_CHECKING([whether pthread_create() is supported])
76CFLAGS_save="${CFLAGS}" 51 CFLAGS_pt_save="$CFLAGS"
77CFLAGS="${CFLAGS} -pthread" 52 CFLAGS="$CFLAGS -pthread"
78LIBS_save="${LIBS}" 53 LIBS_pt_save="$LIBS"
79LIBS="${LIBS} -pthread" 54 LIBS="$LIBS -pthread"
80AC_LINK_IFELSE( 55 AC_LINK_IFELSE(
81 [AC_LANG_PROGRAM([[ 56 [AC_LANG_PROGRAM([[
82#include <pthread.h> 57#include <pthread.h>
83 ]], 58 ]],
84 [[ 59 [[
85pthread_create(NULL, NULL, NULL, NULL); 60pthread_create(NULL, NULL, NULL, NULL);
86 ]])], 61 ]])],
87 [have_gl_pt="yes"], 62 [have_gl_pt="yes"],
88 [have_gl_pt="no"]) 63 [have_gl_pt="no"])
89CFLAGS=${CFLAGS_save} 64 CFLAGS=$CFLAGS_pt_save
90LIBS=${LIBS_save} 65 LIBS=$LIBS_pt_save
91AC_MSG_RESULT([${have_gl_pt}]) 66 AC_MSG_RESULT([$have_gl_pt])
92 67
93if test "x$have_gl_pt" = "xyes" ; then 68 if test "x$have_gl_pt" = "xyes" ; then
94 gl_pt_lib=" -pthread" 69 gl_pt_lib=" -pthread"
95fi 70 fi
96 71
97if test "x${have_dep}" = "xyes" ; then 72 if test "x$have_dep" = "xyes"; then
98 AC_CHECK_LIB([X11], [XCreateColormap], [have_dep="yes"], [have_dep="no"]) 73 LIBS_save="$LIBS"
99fi 74 LIBS="$LIBS $evas_engine_[]$1[]_libs"
100 75 AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lm $gl_pt_lib])
101if test "x${have_dep}" = "xyes" ; then 76 LIBS="$LIBS_save"
102 AC_CHECK_LIB([Xrender], [XRenderCreatePicture], [have_dep="yes"], [have_dep="no"]) 77 fi
103fi 78
104 79 if test "x${gl_flavor_gles}" = "xyes" ; then
105if test "x${have_dep}" = "xyes" ; then 80 have_dep=no
106 AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lX11 -lXext -lXrender -lm $gl_pt_lib]) 81 fi
107fi 82
108 83 if test "x$have_dep" = "xyes" ; then
109if test "x${gl_flavor_gles}" = "xyes" ; then 84 evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs -lGL $gl_pt_lib"
110 have_dep=no 85 evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGL $gl_pt_lib"
111fi 86 else
112 87 AC_CHECK_HEADER([GLES2/gl2.h],
113if test "x${have_dep}" = "xyes" ; then 88 [have_egl="yes"],
114 if test "x$2" = "xyes" ; then 89 [have_egl="no"],
115 x_libs="${x_libs} -lX11 -lXext -lXrender" 90 [
116 else
117 x_dir=${x_dir:-/usr/X11R6}
118 x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
119 x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
120 fi
121 evas_engine_[]$1[]_cflags="-I/usr/include ${x_cflags}"
122 evas_engine_[]$1[]_libs="${x_libs} -lGL $gl_pt_lib"
123 evas_engine_gl_common_libs="-lGL $gl_pt_lib"
124else
125 if test "x$2" = "xyes" ; then
126 x_libs="${x_libs} -lX11 -lXext -lXrender"
127 else
128 x_dir=${x_dir:-/usr/X11R6}
129 x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
130 x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
131 fi
132 AC_CHECK_HEADER([GLES2/gl2.h],
133 [have_egl="yes"],
134 [have_egl="no"],
135 [
136#include <GLES2/gl2.h> 91#include <GLES2/gl2.h>
137#include <GLES2/gl2ext.h> 92#include <GLES2/gl2ext.h>
138#include <EGL/egl.h> 93#include <EGL/egl.h>
@@ -141,29 +96,30 @@ else
141#include <X11/Xutil.h> 96#include <X11/Xutil.h>
142#include <X11/extensions/Xrender.h> 97#include <X11/extensions/Xrender.h>
143#include <X11/Xresource.h> 98#include <X11/Xresource.h>
144 ]) 99 ])
145 if test "x${have_egl}" = "xyes" ; then 100 if test "x${have_egl}" = "xyes" ; then
146 AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL ${x_libs} -lm $gl_pt_lib) 101 AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib)
147 if test "x${have_glesv2}" = "xyes" ; then 102 if test "x${have_glesv2}" = "xyes" ; then
148 evas_engine_[]$1[]_cflags="${x_cflags}" 103 evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs -lGLESv2 -lEGL -lm $gl_pt_lib"
149 evas_engine_[]$1[]_libs="${x_libs} -lGLESv2 -lEGL -lm $gl_pt_lib" 104 evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm $gl_pt_lib"
150 evas_engine_gl_common_libs="-lGLESv2 -lm $gl_pt_lib" 105 have_dep="yes"
151 have_dep="yes" 106 AC_DEFINE(GL_GLES, 1, [GLSL runtime shader GLES2 support])
152 AC_DEFINE(GL_GLES, 1, [GLSL runtime shader GLES2 support]) 107 gles_variety_sgx="yes"
153 gles_variety_sgx="yes" 108 fi
154 fi 109 fi
155 fi 110 fi
156fi
157 111
158if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then 112 CPPFLAGS="$CPPFLAGS_save"
159 requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}" 113 CFLAGS="$CFLAGS_save"
160fi
161 114
162AC_SUBST([evas_engine_$1_cflags]) 115 if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
163AC_SUBST([evas_engine_$1_libs]) 116 requirements_libs_evas="$evas_engine_[]$1[]_libs $requirements_libs_evas"
164 117 fi
165AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
166 118
119 AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
120 ],[
121 ifelse([$5], , :, [$5])
122 ])
167]) 123])
168 124
169dnl use: EVAS_CHECK_ENGINE_DEP_SOFTWARE_XCB(engine, simple, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 125dnl 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],
208[ 164[
209 165
210requirement="" 166requirement=""
211have_dep="no"
212evas_engine_[]$1[]_cflags=""
213evas_engine_[]$1[]_libs=""
214 167
215AC_PATH_X 168EFL_FIND_X(evas_engine_[]$1, [GL/gl.h],
216AC_PATH_XTRA 169 [X11 XCreateColormap Xrender XRenderCreatePicture],
217 170 [
218AC_CHECK_HEADER([GL/gl.h], 171 CFLAGS_save="$CFLAGS"
219 [have_dep="yes"], 172 CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags"
220 [have_dep="no"], 173 CPPFLAGS_save="$CPPFLAGS"
221 [ 174 CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags"
175 AC_CHECK_HEADER([GL/glext.h],
176 [have_dep="yes"],
177 [have_dep="no"],
178 [
222#include <GL/gl.h> 179#include <GL/gl.h>
223#include <GL/glext.h> 180#include <GL/glext.h>
224#include <GL/glx.h> 181#include <GL/glx.h>
225 ]) 182 ])
226 183 CPPFLAGS=$CPPFLAGS_save
227gl_pt_lib=""; 184 CFLAGS=$CFLAGS_save
228have_gl_pt="no" 185
229 186 gl_pt_lib="";
230AC_MSG_CHECKING([whether pthread_create() is supported]) 187 have_gl_pt="no"
231CFLAGS_save="${CFLAGS}" 188
232CFLAGS="${CFLAGS} -pthread" 189 AC_MSG_CHECKING([whether pthread_create() is supported])
233LIBS_save="${LIBS}" 190 CFLAGS_save="${CFLAGS}"
234LIBS="${LIBS} -pthread" 191 CFLAGS="${CFLAGS} -pthread"
235AC_LINK_IFELSE( 192 LIBS_save="${LIBS}"
236 [AC_LANG_PROGRAM([[ 193 LIBS="${LIBS} -pthread"
194 AC_LINK_IFELSE(
195 [AC_LANG_PROGRAM([[
237#include <pthread.h> 196#include <pthread.h>
238 ]], 197 ]],
239 [[ 198 [[
240pthread_create(NULL, NULL, NULL, NULL); 199pthread_create(NULL, NULL, NULL, NULL);
241 ]])], 200 ]])],
242 [have_gl_pt="yes"], 201 [have_gl_pt="yes"],
243 [have_gl_pt="no"]) 202 [have_gl_pt="no"])
244CFLAGS=${CFLAGS_save} 203 CFLAGS=${CFLAGS_save}
245LIBS=${LIBS_save} 204 LIBS=${LIBS_save}
246AC_MSG_RESULT([${have_gl_pt}]) 205 AC_MSG_RESULT([${have_gl_pt}])
247 206
248if test "x$have_gl_pt" = "xyes" ; then 207 if test "x$have_gl_pt" = "xyes" ; then
249 gl_pt_lib=" -pthread" 208 gl_pt_lib=" -pthread"
250fi 209 fi
251 210
252if test "x${have_dep}" = "xyes" ; then 211 if test "x$have_dep" = "xyes" ; then
253 AC_CHECK_LIB([X11], [XCreateColormap], [have_dep="yes"], [have_dep="no"]) 212 LIBS_save="$LIBS"
254fi 213 LIBS="$LIBS $evas_engine_[]$1[]_libs"
255 214 AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], [-lm $gl_pt_lib])
256if test "x${have_dep}" = "xyes" ; then 215 LIBS="$LIBS_save"
257 AC_CHECK_LIB([Xrender], [XRenderCreatePicture], [have_dep="yes"], [have_dep="no"]) 216 fi
258fi 217 ],[
259 218 have_dep=no
260if test "x${have_dep}" = "xyes" ; then 219 ])
261 AC_CHECK_LIB([GL], [glXCreateContext], [have_dep="yes"], [have_dep="no"], -lX11 -lXext -lXrender -lm $gl_pt_lib)
262fi
263 220
264PKG_CHECK_EXISTS([x11-xcb xcb xcb-glx xcb-render xcb-renderutil], 221PKG_CHECK_EXISTS([x11-xcb xcb xcb-glx xcb-render xcb-renderutil],
265 [ 222 [
266 have_dep="yes" 223 have_dep="yes"
267 requirement="x11-xcb xcb xcb-glx xcb-render xcb-renderutil" 224 requirement="x11-xcb xcb xcb-glx xcb-render xcb-renderutil"
268 ], 225 ],
269 [have_dep="no"]) 226 [have_dep="no"])
270 227
271if test "x${have_dep}" = "xyes" ; then 228if test "x${have_dep}" = "xyes" ; then
272 if test "x$3" = "xstatic" ; then 229 if test "x$3" = "xstatic" ; then
273 requirements_pc_evas="${requirement} ${requirements_pc_evas}" 230 requirements_pc_evas="${requirement} ${requirements_pc_evas}"
274 requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}" 231 requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
275 else 232 else
276 PKG_CHECK_MODULES([XCB_GL], [${requirement}]) 233 PKG_CHECK_MODULES([XCB_GL], [${requirement}])
277 evas_engine_[]$1[]_cflags="${XCB_CFLAGS}" 234 fi
278 evas_engine_[]$1[]_libs="${XCB_LIBS}"
279 fi
280fi 235fi
281 236
282evas_engine_[]$1[]_cflags="${XCB_GL_CFLAGS}"
283evas_engine_[]$1[]_libs="${XCB_GL_LIBS}"
284
285if test "x$gl_flavor_gles" = "xyes" ; then 237if test "x$gl_flavor_gles" = "xyes" ; then
286 have_dep=no 238 have_dep=no
287fi 239fi
288 240
289if test "x${have_dep}" = "xyes" ; then 241if test "x${have_dep}" = "xyes" ; then
290 if test "x$2" = "xyes" ; then 242 evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS"
291 x_libs="${x_libs} -lX11 -lXext -lXrender" 243 evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGL $gl_pt_lib"
292 else 244 evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGL $gl_pt_lib"
293 x_dir=${x_dir:-/usr/X11R6}
294 x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
295 x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender"
296 fi
297 evas_engine_[]$1[]_cflags="-I/usr/include ${XCB_GL_CFLAGS} ${x_cflags}"
298 evas_engine_[]$1[]_libs="${XCB_GL_LIBS} ${x_libs} -lGL $gl_pt_lib"
299 evas_engine_gl_common_libs="-lGL $gl_pt_lib"
300else 245else
301 if test "x$2" = "xyes" ; then 246 CFLAGS_save="$CFLAGS"
302 x_libs="${x_libs} -lX11 -lXext -lXrender" 247 CFLAGS="$CFLAGS $evas_engine_[]$1[]_cflags"
303 else 248 CPPFLAGS_save="$CPPFLAGS"
304 x_dir=${x_dir:-/usr/X11R6} 249 CPPFLAGS="$CPPFLAGS $evas_engine_[]$1[]_cflags"
305 x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}} 250 AC_CHECK_HEADER([GLES2/gl2.h],
306 x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext -lXrender" 251 [have_egl="yes"],
307 fi 252 [have_egl="no"],
308 AC_CHECK_HEADER([GLES2/gl2.h], 253 [
309 [have_egl="yes"],
310 [have_egl="no"],
311 [
312#include <GLES2/gl2.h> 254#include <GLES2/gl2.h>
313#include <GLES2/gl2ext.h> 255#include <GLES2/gl2ext.h>
314#include <EGL/egl.h> 256#include <EGL/egl.h>
315 ]) 257 ])
316 if test "x${have_egl}" = "xyes" ; then 258 CPPFLAGS=$CPPFLAGS_save
317 AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL ${x_libs} -lm $gl_pt_lib) 259 CFLAGS=$CFLAGS_save
318 if test "x${have_glesv2}" = "xyes" ; then 260 if test "x${have_egl}" = "xyes" ; then
319 evas_engine_[]$1[]_cflags="${XCB_GL_CFLAGS} ${x_cflags}" 261 LIBS_save="$LIBS"
320 evas_engine_[]$1[]_libs="${XCB_GL_LIBS} ${x_libs} -lGLESv2 -lEGL -lm $gl_pt_lib" 262 LIBS="$LIBS $evas_engine_[]$1[]_libs"
321 evas_engine_gl_common_libs="-lGLESv2 -lm $gl_pt_lib" 263 AC_CHECK_LIB(GLESv2, glTexImage2D, [have_glesv2="yes"], , -lEGL -lm $gl_pt_lib)
322 have_dep="yes" 264 if test "x${have_glesv2}" = "xyes" ; then
323 AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support]) 265 evas_engine_[]$1[]_cflags="$evas_engine_[]$1[]_cflags $XCB_GL_CFLAGS"
324 gles_variety_sgx="yes" 266 evas_engine_[]$1[]_libs="$evas_engine_[]$1[]_libs $XCB_GL_LIBS -lGLESv2 -lEGL -lm $gl_pt_lib"
325 fi 267 evas_engine_gl_common_libs="$evas_engine_[]$1[]_libdirs -lGLESv2 -lm $gl_pt_lib"
326 fi 268 have_dep="yes"
269 AC_DEFINE(GLES_VARIETY_SGX, 1, [Imagination SGX GLES2 support])
270 gles_variety_sgx="yes"
271 fi
272 fi
327fi 273fi
328 274
329if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then 275if test "x$3" = "xstatic" && test "x${have_dep}" = "xyes" ; then
330 requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}" 276 requirements_libs_evas="${evas_engine_[]$1[]_libs} ${requirements_libs_evas}"
331 requirements_pc_evas="${requirement} ${requirements_pc_evas}" 277 requirements_pc_evas="${requirement} ${requirements_pc_evas}"
332 requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}" 278 requirements_pc_deps_evas="${requirement} ${requirements_pc_deps_evas}"
333fi 279fi
334 280
335AC_SUBST([evas_engine_$1_cflags])
336AC_SUBST([evas_engine_$1_libs])
337
338AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5]) 281AS_IF([test "x${have_dep}" = "xyes"], [$4], [$5])
339 282
340]) 283])