mesa-demos: NOTE! Default branch is now main
[mesa-demos.git] / configure.ac
blob6b4521c00488419cb65f2c1f059e95a939fd2ffb
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.4.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 # LIBS was set by AC_CHECK_LIB above
96 LIBS=""
98 PKG_CHECK_MODULES(GLU, [glu], [],
99                   [AC_CHECK_HEADER([GL/glu.h],
100                                    [],
101                                    AC_MSG_ERROR([GLU not found]))
102                    AC_CHECK_LIB([GLU],
103                                 [gluBeginCurve],
104                                 [GLU_LIBS=-lGLU],
105                                 AC_MSG_ERROR([GLU required])) ])
107 DEMO_CFLAGS="$DEMO_CFLAGS $GLU_CFLAGS"
108 DEMO_LIBS="$DEMO_LIBS $GLU_LIBS"
110 AC_ARG_ENABLE([egl],
111     [AS_HELP_STRING([--enable-egl],
112         [enable EGL library @<:@default=auto@:>@])],
113     [egl_enabled="$enableval"],
114     [egl_enabled=auto])
115 if test "x$egl_enabled" != "xno"; then
116     PKG_CHECK_MODULES(EGL, [egl], [egl_enabled=yes], [egl_enabled=no])
118 AC_ARG_ENABLE([gles1],
119     [AS_HELP_STRING([--enable-gles1],
120         [enable support for OpenGL ES 1.x API @<:@default=auto@:>@])],
121     [glesv1_enabled="$enableval"],
122     [glesv1_enabled=auto])
123 if test "x$glesv1_enabled" != "xno"; then
124     PKG_CHECK_MODULES(GLESV1, [glesv1_cm], [glesv1_enabled=yes], [glesv1_enabled=no])
126 AC_ARG_ENABLE([gles2],
127     [AS_HELP_STRING([--enable-gles2],
128         [enable support for OpenGL ES 2.x API @<:@default=auto@:>@])],
129     [glesv2_enabled="$enableval"],
130     [glesv2_enabled=auto])
131 if test "x$glesv2_enabled" != "xno"; then
132     PKG_CHECK_MODULES(GLESV2, [glesv2], [glesv2_enabled=yes], [glesv2_enabled=no])
134 AC_ARG_ENABLE([vg],
135     [AS_HELP_STRING([--enable-vg],
136         [enable support for OpenVG API @<:@default=auto@:>@])],
137     [vg_enabled="$enableval"],
138     [vg_enabled=auto])
139 if test "x$vg_enabled" != "xno"; then
140     PKG_CHECK_MODULES(VG, [vg], [vg_enabled=yes], [vg_enabled=no])
142 AC_ARG_ENABLE([osmesa],
143     [AS_HELP_STRING([--enable-osmesa],
144         [enable OSMesa library @<:@default=auto@:>@])],
145     [osmesa_enabled="$enableval"],
146     [osmesa_enabled=auto])
147 if test "x$osmesa_enabled" != "xno"; then
148     PKG_CHECK_MODULES(OSMESA, [osmesa], [osmesa_enabled=yes], [osmesa_enabled=no])
150 AC_ARG_ENABLE([libdrm],
151     [AS_HELP_STRING([--enable-libdrm],
152         [enable support for libdrm @<:@default=auto@:>@])],
153     [drm_enabled="$enableval"],
154     [drm_enabled=auto])
155 if test "x$drm_enabled" != "xno"; then
156     PKG_CHECK_MODULES(DRM, [libdrm], [drm_enabled=yes], [drm_enabled=no])
158 dnl The OSMesa .pc uses OSMesa32, while we want to build with other versions
159 dnl too.
160 OSMESA32_LIBS=$OSMESA_LIBS
161 OSMESA16_LIBS=`echo $OSMESA_LIBS | sed 's|32|16|g'`
162 OSMESA_LIBS=`echo $OSMESA_LIBS | sed 's|32||g'`
164 dnl Compiler macros
165 case "$host_os" in
166 linux*|*-gnu*|gnu*)
167     DEMO_CFLAGS="$DEMO_CFLAGS -D_GNU_SOURCE -DPTHREADS"
168     ;;
169 solaris*)
170     DEMO_CFLAGS="$DEFINES -DPTHREADS -DSVR4"
171     ;;
172 cygwin*)
173     DEMO_CFLAGS="$DEFINES -DPTHREADS"
174     ;;
175 esac
177 dnl Set up C warning flags.  Copy of XORG_CWARNFLAGS.
178 if  test "x$GCC" = xyes ; then
179     CWARNFLAGS="-Wall -Wpointer-arith -Wmissing-prototypes \
180 -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
181 -Wbad-function-cast"
182     case `$CC -dumpversion` in
183     3.4.* | 4.*)
184         CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
185         ;;
186     esac
187 else
188     AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
189     if test "x$SUNCC" = "xyes"; then
190         CWARNFLAGS="-v"
191     fi
193 DEMO_CFLAGS="$DEMO_CFLAGS $CWARNFLAGS"
195 AC_ARG_ENABLE([x11],
196     [AS_HELP_STRING([--enable-x11],
197         [enable support for X11 @<:@default=auto@:>@])],
198     [x11_enabled="$enableval"],
199     [x11_enabled=auto])
200 if test "x$x11_enabled" != "xno"; then
201     PKG_CHECK_MODULES(X11, [x11 xext], [x11_enabled=yes], [x11_enabled=no])
204 AC_ARG_ENABLE([wayland],
205     [AS_HELP_STRING([--enable-wayland],
206         [enable support for wayland @<:@default=auto@:>@])],
207     [wayland_enabled="$enableval"],
208     [wayland_enabled=auto])
210 if test "x$wayland_enabled" != "xno"; then
211     PKG_CHECK_MODULES(WAYLAND, [wayland-client wayland-egl], [wayland_enabled=yes], [wayland_enabled=no])
214 dnl GBM is needed for EGL on KMS
215 AC_ARG_ENABLE([gbm],
216     [AS_HELP_STRING([--enable-gbm],
217         [enable support for GBM @<:@default=auto@:>@])],
218     [gbm_enabled="$enableval"],
219     [gbm_enabled=auto])
220 if test "x$gbm_enabled" != "xno"; then
221     PKG_CHECK_MODULES(GBM, [gbm], [gbm_enabled=yes], [gbm_enabled=no])
224 dnl FreeType2 is needed by an OpenVG demo
225 AC_ARG_ENABLE([freetype2],
226     [AS_HELP_STRING([--enable-freetype2],
227         [enable support for FreeType2 @<:@default=auto@:>@])],
228     [freetype2_enabled="$enableval"],
229     [freetype2_enabled=auto])
230 if test "x$freetype2_enabled" != "xno"; then
231     PKG_CHECK_MODULES(FREETYPE2, [freetype2], [freetype2_enabled=yes], [freetype2_enabled=no])
234 mesa_source_enabled=no
235 AC_ARG_WITH([mesa-source],
236         [AS_HELP_STRING([--with-mesa-source=DIR],
237                         [Mesa source directory for finding gl_API.xml])],
238         [mesa_source_enabled="yes"
239          mesa_source_dir="$withval"],
240         [mesa_source_enabled="no"])
241 MESA_GLAPI="$mesa_source_dir/src/mapi/glapi/gen"
243 AC_ARG_ENABLE([rbug],
244     [AS_HELP_STRING([--enable-rbug],
245         [enable support for rbug @<:@default=no@:>@])],
246     [rbug_enabled="yes"],
247     [rbug_enabled="no"])
249 use_system_data=no
250 AC_ARG_WITH([system-data-files],
251             [AS_HELP_STRING([--with-system-data-files],
252                             [Use system data files for demos (default: no)])],
253             [use_system_data=yes], [])
254 if test "x$use_system_data" = xyes; then
255     demos_data_dir="${datadir}/${PACKAGE}/"
256 else
257     demos_data_dir="../data/"
259 AC_DEFINE_DIR(DEMOS_DATA_DIR, demos_data_dir, [Data dir for demos])
260 AC_DEFINE_UNQUOTED([DEMOS_DATA_DIR], "$DEMOS_DATA_DIR",
261                    [Directory for demos data files])
264 dnl Program library dependencies
265 dnl    Only libm is added here if necessary as the libraries should
266 dnl    be pulled in by the linker
268 case "$host_os" in
269 solaris*)
270     DEMO_LIBS="$DEMO_LIBS -lX11 -lsocket -lnsl -lm"
271     ;;
272 cygwin*)
273     DEMO_LIBS="$DEMO_LIBS -lX11"
274     ;;
276     DEMO_LIBS="$DEMO_LIBS -lm"
277     ;;
278 esac
280 AC_SUBST([DEMO_CFLAGS])
281 AC_SUBST([DEMO_LIBS])
282 AC_SUBST([EGL_CFLAGS])
283 AC_SUBST([EGL_LIBS])
284 AC_SUBST([GLESV1_CFLAGS])
285 AC_SUBST([GLESV1_LIBS])
286 AC_SUBST([GLESV2_CFLAGS])
287 AC_SUBST([GLESV2_LIBS])
288 AC_SUBST([GLUT_CFLAGS])
289 AC_SUBST([GLUT_LIBS])
290 AC_SUBST([X11_CFLAGS])
291 AC_SUBST([X11_LIBS])
292 AC_SUBST([OSMESA_CFLAGS])
293 AC_SUBST([OSMESA_LIBS])
294 AC_SUBST([OSMESA16_LIBS])
295 AC_SUBST([OSMESA32_LIBS])
296 AC_SUBST([MESA_GLAPI])
297 AC_SUBST([WAYLAND_CFLAGS])
298 AC_SUBST([WAYLAND_LIBS])
301 AM_CONDITIONAL(HAVE_EGL, test "x$egl_enabled" = "xyes")
302 AM_CONDITIONAL(HAVE_GLESV1, test "x$glesv1_enabled" = "xyes")
303 AM_CONDITIONAL(HAVE_GLESV2, test "x$glesv2_enabled" = "xyes")
304 AM_CONDITIONAL(HAVE_VG, test "x$vg_enabled" = "xyes")
305 AM_CONDITIONAL(HAVE_GLUT, test "x$glut_enabled" = "xyes")
306 AM_CONDITIONAL(HAVE_X11, test "x$x11_enabled" = "xyes")
307 AM_CONDITIONAL(HAVE_GBM, test "x$gbm_enabled" = "xyes")
308 AM_CONDITIONAL(HAVE_FREETYPE2, test "x$freetype2_enabled" = "xyes")
309 AM_CONDITIONAL(HAVE_OSMESA, test "x$osmesa_enabled" = "xyes")
310 AM_CONDITIONAL(HAVE_DRM, test "x$drm_enabled" = "xyes")
311 AM_CONDITIONAL(HAVE_MESA_SOURCE, test "x$mesa_source_enabled" = "xyes")
312 AM_CONDITIONAL(HAVE_WAYLAND, test "x$wayland_enabled" = "xyes")
313 AM_CONDITIONAL(HAVE_RBUG, test "x$rbug_enabled" = "xyes")
315 AC_OUTPUT([
316         Makefile
317         src/Makefile
318         src/demos/Makefile
319         src/egl/Makefile
320         src/egl/eglut/Makefile
321         src/egl/opengl/Makefile
322         src/egl/opengles1/Makefile
323         src/egl/opengles2/Makefile
324         src/egl/openvg/Makefile
325         src/egl/openvg/trivial/Makefile
326         src/egl/oes_vg/Makefile
327         src/fp/Makefile
328         src/fpglsl/Makefile
329         src/glad/Makefile
330         src/glsl/Makefile
331         src/gs/Makefile
332         src/data/Makefile
333         src/objviewer/Makefile
334         src/osdemos/Makefile
335         src/perf/Makefile
336         src/rbug/Makefile
337         src/redbook/Makefile
338         src/samples/Makefile
339         src/slang/Makefile
340         src/tests/Makefile
341         src/tools/Makefile
342         src/trivial/Makefile
343         src/util/Makefile
344         src/vp/Makefile
345         src/vpglsl/Makefile
346         src/wgl/Makefile
347         src/xdemos/Makefile