eglinfo: Note when an EGLConfig is streams-compatible
[mesa-demos.git] / configure.ac
blobddc68b5887711db5a840eb21e2bc12d61e422c98
1 # Copyright © 2009 Intel Corporation
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the "Software"),
5 # to deal in the Software without restriction, including without limitation
6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 # and/or sell copies of the Software, and to permit persons to whom the
8 # Software is furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice (including the next
11 # paragraph) shall be included in all copies or substantial portions of the
12 # Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 # IN THE SOFTWARE.
22 # Authors:
23 #    Eric Anholt <eric@anholt.net>
25 dnl Process this file with autoconf to create configure.
27 AC_PREREQ([2.59])
28 AC_INIT([mesa-demos], [8.3.0],
29     [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa&component=Demos])
30 AC_CANONICAL_HOST
32 AM_INIT_AUTOMAKE([dist-bzip2])
34 dnl Check for progs
35 AC_PROG_CPP
36 AC_PROG_CC
37 AC_PROG_CXX
38 AC_PROG_LIBTOOL
39 AM_PROG_CC_C_O
41 AC_CONFIG_MACRO_DIR([m4])
43 # Enable quiet compiles on automake 1.11.
44 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
46 dnl Make sure the pkg-config macros are defined
47 m4_ifndef([PKG_PROG_PKG_CONFIG],
48     [m4_fatal([Could not locate the pkg-config autoconf macros.
49   These are usually located in /usr/share/aclocal/pkg.m4. If your macros
50   are in a different location, try setting the environment variable
51   ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
52 PKG_PROG_PKG_CONFIG()
54 dnl Get the pkg-config definitions for libGL.  We include a fallback
55 dnl path for GL implementation that don't provide a .pc file
56 PKG_CHECK_MODULES(GL, [gl], [], [
57                   AC_CHECK_HEADER([GL/gl.h],
58                                   [],
59                                   AC_MSG_ERROR([GL not found]))
60                   AC_CHECK_LIB([GL],
61                                [glBegin],
62                                [GL_LIBS=-lGL],
63                                AC_MSG_ERROR([GL required]))
64                   ])
66 DEMO_CFLAGS="$DEMO_CFLAGS $GL_CFLAGS"
67 DEMO_LIBS="$DEMO_LIBS $GL_LIBS"
69 dnl Check for GLUT
70 glut_enabled=yes
71 AC_ARG_WITH([glut],
72         [AS_HELP_STRING([--with-glut=DIR],
73                         [glut install directory])],
74         [GLUT_CFLAGS="-I$withval/include"
75          GLUT_LIBS="-L$withval/lib -lglut"],
76         [GLUT_CFLAGS=""
77          GLUT_LIBS="-lglut"]
78         )
79 AS_IF([test "x$with_glut" != xno],
80       [AC_CHECK_HEADER([GL/glut.h],
81                        [],
82                        [glut_enabled=no])
83        AC_CHECK_LIB([glut],
84                     [glutInit],
85                     [],
86                     [glut_enabled=no])],
87       [glut_enabled=no])
89 dnl Check for FreeGLUT 2.6 or later
90 AC_EGREP_HEADER([glutInitContextProfile],
91                 [GL/freeglut.h],
92                 [AC_DEFINE(HAVE_FREEGLUT)],
93                 [])
95 dnl Check for GLEW
96 PKG_CHECK_MODULES(GLEW, [glew >= 1.5.4])
97 DEMO_CFLAGS="$DEMO_CFLAGS $GLEW_CFLAGS"
98 DEMO_LIBS="$DEMO_LIBS $GLEW_LIBS"
100 # LIBS was set by AC_CHECK_LIB above
101 LIBS=""
103 PKG_CHECK_MODULES(GLU, [glu], [],
104                   [AC_CHECK_HEADER([GL/glu.h],
105                                    [],
106                                    AC_MSG_ERROR([GLU not found]))
107                    AC_CHECK_LIB([GLU],
108                                 [gluBeginCurve],
109                                 [GLU_LIBS=-lGLU],
110                                 AC_MSG_ERROR([GLU required])) ])
112 DEMO_CFLAGS="$DEMO_CFLAGS $GLU_CFLAGS"
113 DEMO_LIBS="$DEMO_LIBS $GLU_LIBS"
115 AC_ARG_ENABLE([egl],
116     [AS_HELP_STRING([--enable-egl],
117         [enable EGL library @<:@default=auto@:>@])],
118     [egl_enabled="$enableval"],
119     [egl_enabled=auto])
120 if test "x$egl_enabled" != "xno"; then
121     PKG_CHECK_MODULES(EGL, [egl], [egl_enabled=yes], [egl_enabled=no])
123 AC_ARG_ENABLE([gles1],
124     [AS_HELP_STRING([--enable-gles1],
125         [enable support for OpenGL ES 1.x API @<:@default=auto@:>@])],
126     [glesv1_enabled="$enableval"],
127     [glesv1_enabled=auto])
128 if test "x$glesv1_enabled" != "xno"; then
129     PKG_CHECK_MODULES(GLESV1, [glesv1_cm], [glesv1_enabled=yes], [glesv1_enabled=no])
131 AC_ARG_ENABLE([gles2],
132     [AS_HELP_STRING([--enable-gles2],
133         [enable support for OpenGL ES 2.x API @<:@default=auto@:>@])],
134     [glesv2_enabled="$enableval"],
135     [glesv2_enabled=auto])
136 if test "x$glesv2_enabled" != "xno"; then
137     PKG_CHECK_MODULES(GLESV2, [glesv2], [glesv2_enabled=yes], [glesv2_enabled=no])
139 AC_ARG_ENABLE([vg],
140     [AS_HELP_STRING([--enable-vg],
141         [enable support for OpenVG API @<:@default=auto@:>@])],
142     [vg_enabled="$enableval"],
143     [vg_enabled=auto])
144 if test "x$vg_enabled" != "xno"; then
145     PKG_CHECK_MODULES(VG, [vg], [vg_enabled=yes], [vg_enabled=no])
147 AC_ARG_ENABLE([osmesa],
148     [AS_HELP_STRING([--enable-osmesa],
149         [enable OSMesa library @<:@default=auto@:>@])],
150     [osmesa_enabled="$enableval"],
151     [osmesa_enabled=auto])
152 if test "x$osmesa_enabled" != "xno"; then
153     PKG_CHECK_MODULES(OSMESA, [osmesa], [osmesa_enabled=yes], [osmesa_enabled=no])
155 AC_ARG_ENABLE([libdrm],
156     [AS_HELP_STRING([--enable-libdrm],
157         [enable support for libdrm @<:@default=auto@:>@])],
158     [drm_enabled="$enableval"],
159     [drm_enabled=auto])
160 if test "x$drm_enabled" != "xno"; then
161     PKG_CHECK_MODULES(DRM, [libdrm], [drm_enabled=yes], [drm_enabled=no])
163 dnl The OSMesa .pc uses OSMesa32, while we want to build with other versions
164 dnl too.
165 OSMESA32_LIBS=$OSMESA_LIBS
166 OSMESA16_LIBS=`echo $OSMESA_LIBS | sed 's|32|16|g'`
167 OSMESA_LIBS=`echo $OSMESA_LIBS | sed 's|32||g'`
169 dnl Compiler macros
170 case "$host_os" in
171 linux*|*-gnu*|gnu*)
172     DEMO_CFLAGS="$DEMO_CFLAGS -D_GNU_SOURCE -DPTHREADS"
173     ;;
174 solaris*)
175     DEMO_CFLAGS="$DEFINES -DPTHREADS -DSVR4"
176     ;;
177 cygwin*)
178     DEMO_CFLAGS="$DEFINES -DPTHREADS"
179     ;;
180 esac
182 dnl Set up C warning flags.  Copy of XORG_CWARNFLAGS.
183 if  test "x$GCC" = xyes ; then
184     CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
185 -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
186 -Wbad-function-cast"
187     case `$CC -dumpversion` in
188     3.4.* | 4.*)
189         CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
190         ;;
191     esac
192 else
193     AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
194     if test "x$SUNCC" = "xyes"; then
195         CWARNFLAGS="-v"
196     fi
198 DEMO_CFLAGS="$DEMO_CFLAGS $CWARNFLAGS"
200 AC_ARG_ENABLE([x11],
201     [AS_HELP_STRING([--enable-x11],
202         [enable support for X11 @<:@default=auto@:>@])],
203     [x11_enabled="$enableval"],
204     [x11_enabled=auto])
205 if test "x$x11_enabled" != "xno"; then
206     PKG_CHECK_MODULES(X11, [x11 xext], [x11_enabled=yes], [x11_enabled=no])
209 AC_ARG_ENABLE([wayland],
210     [AS_HELP_STRING([--enable-wayland],
211         [enable support for wayland @<:@default=no@:>@])],
212     [wayland_enabled="$enableval"],
213     [wayland_enabled=no])
215 if test "x$wayland_enabled" != "xno"; then
216     PKG_CHECK_MODULES(WAYLAND, [wayland-client wayland-egl], [wayland_enabled=yes], [wayland_enabled=no])
219 dnl GBM is needed for EGL on KMS
220 AC_ARG_ENABLE([gbm],
221     [AS_HELP_STRING([--enable-gbm],
222         [enable support for GBM @<:@default=auto@:>@])],
223     [gbm_enabled="$enableval"],
224     [gbm_enabled=auto])
225 if test "x$gbm_enabled" != "xno"; then
226     PKG_CHECK_MODULES(GBM, [gbm], [gbm_enabled=yes], [gbm_enabled=no])
229 dnl FreeType2 is needed by an OpenVG demo
230 AC_ARG_ENABLE([freetype2],
231     [AS_HELP_STRING([--enable-freetype2],
232         [enable support for FreeType2 @<:@default=auto@:>@])],
233     [freetype2_enabled="$enableval"],
234     [freetype2_enabled=auto])
235 if test "x$freetype2_enabled" != "xno"; then
236     PKG_CHECK_MODULES(FREETYPE2, [freetype2], [freetype2_enabled=yes], [freetype2_enabled=no])
239 mesa_source_enabled=no
240 AC_ARG_WITH([mesa-source],
241         [AS_HELP_STRING([--with-mesa-source=DIR],
242                         [Mesa source directory for finding gl_API.xml])],
243         [mesa_source_enabled="yes"
244          mesa_source_dir="$withval"],
245         [mesa_source_enabled="no"])
246 MESA_GLAPI="$mesa_source_dir/src/mapi/glapi/gen"
248 AC_ARG_ENABLE([rbug],
249     [AS_HELP_STRING([--enable-rbug],
250         [enable support for rbug @<:@default=no@:>@])],
251     [rbug_enabled="yes"],
252     [rbug_enabled="no"])
254 use_system_data=no
255 AC_ARG_WITH([system-data-files],
256             [AS_HELP_STRING([--with-system-data-files],
257                             [Use system data files for demos (default: no)])],
258             [use_system_data=yes], [])
259 if test "x$use_system_data" = xyes; then
260     demos_data_dir="${datadir}/${PACKAGE}/"
261 else
262     demos_data_dir="../data/"
264 AC_DEFINE_DIR(DEMOS_DATA_DIR, demos_data_dir, [Data dir for demos])
265 AC_DEFINE_UNQUOTED([DEMOS_DATA_DIR], "$DEMOS_DATA_DIR",
266                    [Directory for demos data files])
269 dnl Program library dependencies
270 dnl    Only libm is added here if necessary as the libraries should
271 dnl    be pulled in by the linker
273 case "$host_os" in
274 solaris*)
275     DEMO_LIBS="$DEMO_LIBS -lX11 -lsocket -lnsl -lm"
276     ;;
277 cygwin*)
278     DEMO_LIBS="$DEMO_LIBS -lX11"
279     ;;
281     DEMO_LIBS="$DEMO_LIBS -lm"
282     ;;
283 esac
285 AC_SUBST([DEMO_CFLAGS])
286 AC_SUBST([DEMO_LIBS])
287 AC_SUBST([EGL_CFLAGS])
288 AC_SUBST([EGL_LIBS])
289 AC_SUBST([GLESV1_CFLAGS])
290 AC_SUBST([GLESV1_LIBS])
291 AC_SUBST([GLESV2_CFLAGS])
292 AC_SUBST([GLESV2_LIBS])
293 AC_SUBST([GLUT_CFLAGS])
294 AC_SUBST([GLUT_LIBS])
295 AC_SUBST([X11_CFLAGS])
296 AC_SUBST([X11_LIBS])
297 AC_SUBST([OSMESA_CFLAGS])
298 AC_SUBST([OSMESA_LIBS])
299 AC_SUBST([OSMESA16_LIBS])
300 AC_SUBST([OSMESA32_LIBS])
301 AC_SUBST([MESA_GLAPI])
302 AC_SUBST([WAYLAND_CFLAGS])
303 AC_SUBST([WAYLAND_LIBS])
306 AM_CONDITIONAL(HAVE_EGL, test "x$egl_enabled" = "xyes")
307 AM_CONDITIONAL(HAVE_GLESV1, test "x$glesv1_enabled" = "xyes")
308 AM_CONDITIONAL(HAVE_GLESV2, test "x$glesv2_enabled" = "xyes")
309 AM_CONDITIONAL(HAVE_VG, test "x$vg_enabled" = "xyes")
310 AM_CONDITIONAL(HAVE_GLUT, test "x$glut_enabled" = "xyes")
311 AM_CONDITIONAL(HAVE_X11, test "x$x11_enabled" = "xyes")
312 AM_CONDITIONAL(HAVE_GBM, test "x$gbm_enabled" = "xyes")
313 AM_CONDITIONAL(HAVE_FREETYPE2, test "x$freetype2_enabled" = "xyes")
314 AM_CONDITIONAL(HAVE_OSMESA, test "x$osmesa_enabled" = "xyes")
315 AM_CONDITIONAL(HAVE_DRM, test "x$drm_enabled" = "xyes")
316 AM_CONDITIONAL(HAVE_MESA_SOURCE, test "x$mesa_source_enabled" = "xyes")
317 AM_CONDITIONAL(HAVE_WAYLAND, test "x$wayland_enabled" = "xyes")
318 AM_CONDITIONAL(HAVE_RBUG, test "x$rbug_enabled" = "xyes")
320 AC_OUTPUT([
321         Makefile
322         src/Makefile
323         src/demos/Makefile
324         src/egl/Makefile
325         src/egl/eglut/Makefile
326         src/egl/opengl/Makefile
327         src/egl/opengles1/Makefile
328         src/egl/opengles2/Makefile
329         src/egl/openvg/Makefile
330         src/egl/openvg/trivial/Makefile
331         src/egl/oes_vg/Makefile
332         src/fp/Makefile
333         src/fpglsl/Makefile
334         src/glsl/Makefile
335         src/gs/Makefile
336         src/data/Makefile
337         src/objviewer/Makefile
338         src/osdemos/Makefile
339         src/perf/Makefile
340         src/rbug/Makefile
341         src/redbook/Makefile
342         src/samples/Makefile
343         src/slang/Makefile
344         src/tests/Makefile
345         src/tools/Makefile
346         src/trivial/Makefile
347         src/util/Makefile
348         src/vp/Makefile
349         src/vpglsl/Makefile
350         src/wgl/Makefile
351         src/xdemos/Makefile