set version for release
[mesa-demos.git] / configure.ac
blob55fe94185222a1d2c5425748a731d948066f21c2
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.0.0],
29     [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
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 # Enable quiet compiles on automake 1.11.
42 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
44 dnl Make sure the pkg-config macros are defined
45 m4_ifndef([PKG_PROG_PKG_CONFIG],
46     [m4_fatal([Could not locate the pkg-config autoconf macros.
47   These are usually located in /usr/share/aclocal/pkg.m4. If your macros
48   are in a different location, try setting the environment variable
49   ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
50 PKG_PROG_PKG_CONFIG()
52 dnl Get the pkg-config definitions for libGL.  We include a fallback
53 dnl path for GL implementation that don't provide a .pc file
54 PKG_CHECK_MODULES(GL, [gl], [], [
55                   AC_CHECK_HEADER([GL/gl.h],
56                                   [],
57                                   AC_MSG_ERROR([GL not found]))
58                   AC_CHECK_LIB([GL],
59                                [glBegin],
60                                [GL_LIBS=-lGL],
61                                AC_MSG_ERROR([GL required]))
62                   ])
64 DEMO_CFLAGS="$DEMO_CFLAGS $GL_CFLAGS"
65 DEMO_LIBS="$DEMO_LIBS $GL_LIBS"
67 dnl Check for GLUT
68 GLUT_CFLAGS=""
69 GLUT_LIBS=-lglut
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 AC_CHECK_HEADER([GL/glut.h],
77                 [],
78                 [glut_enabled=no])
79 AC_CHECK_LIB([glut],
80                 [glutInit],
81                 [],
82                 [glut_enabled=no])
84 GLEW_CFLAGS=""
85 GLEW_LIBS="-lGLEW"
86 dnl Include a fallback path for GLEW for the moment while not all distros
87 dnl have picked up the .pc file.
88 PKG_CHECK_MODULES(GLEW, [glew], [], [
89                   AC_CHECK_HEADER([GL/glew.h],
90                   [],
91                   AC_MSG_ERROR([GLEW required]))
92                   AC_CHECK_LIB([GLEW],
93                                [glewInit],
94                                [],
95                                AC_MSG_ERROR([GLEW required]))
96                   ])
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 PKG_CHECK_MODULES(EGL, [egl], [egl_enabled=yes], [egl_enabled=no])
116 PKG_CHECK_MODULES(GLESV1, [glesv1_cm], [glesv1_enabled=yes], [glesv1_enabled=no])
117 PKG_CHECK_MODULES(GLESV2, [glesv2], [glesv2_enabled=yes], [glesv2_enabled=no])
118 PKG_CHECK_MODULES(VG, [vg], [vg_enabled=yes], [vg_enabled=no])
119 PKG_CHECK_MODULES(OSMESA, [osmesa], [osmesa_enabled=yes], [osmesa_enabled=no])
120 dnl The OSMesa .pc uses OSMesa32, while we want to build with other versions
121 dnl too.
122 OSMESA32_LIBS=$OSMESA_LIBS
123 OSMESA16_LIBS=`echo $OSMESA_LIBS | sed 's|32|16|g'`
124 OSMESA_LIBS=`echo $OSMESA_LIBS | sed 's|32||g'`
126 dnl Compiler macros
127 case "$host_os" in
128 linux*|*-gnu*|gnu*)
129     DEMO_CFLAGS="$DEMO_CFLAGS -D_GNU_SOURCE -DPTHREADS"
130     ;;
131 solaris*)
132     DEMO_CFLAGS="$DEFINES -DPTHREADS -DSVR4"
133     ;;
134 cygwin*)
135     DEMO_CFLAGS="$DEFINES -DPTHREADS"
136     ;;
137 esac
139 dnl Set up C warning flags.  Copy of XORG_CWARNFLAGS.
140 if  test "x$GCC" = xyes ; then
141     CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
142 -Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
143 -Wbad-function-cast"
144     case `$CC -dumpversion` in
145     3.4.* | 4.*)
146         CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
147         ;;
148     esac
149 else
150     AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
151     if test "x$SUNCC" = "xyes"; then
152         CWARNFLAGS="-v"
153     fi
155 DEMO_CFLAGS="$DEMO_CFLAGS $CWARNFLAGS"
157 PKG_CHECK_MODULES(X11, [x11 xext], [x11_enabled=yes], [enable_x11=no])
159 mesa_source_enabled=no
160 AC_ARG_WITH([mesa-source],
161         [AS_HELP_STRING([--with-mesa-source=DIR],
162                         [Mesa source directory for finding gl_API.xml])],
163         [mesa_source_enabled="yes"
164          mesa_source_dir="$withval"],
165         [mesa_source_enabled="no"])
166 MESA_GLAPI="$mesa_source_dir/src/mesa/glapi"
169 dnl Program library dependencies
170 dnl    Only libm is added here if necessary as the libraries should
171 dnl    be pulled in by the linker
173 case "$host_os" in
174 solaris*)
175     DEMO_LIBS="$DEMO_LIBS -lX11 -lsocket -lnsl -lm"
176     ;;
177 cygwin*)
178     DEMO_LIBS="$DEMO_LIBS -lX11"
179     ;;
181     DEMO_LIBS="$DEMO_LIBS -lm"
182     ;;
183 esac
185 AC_SUBST([DEMO_CFLAGS])
186 AC_SUBST([DEMO_LIBS])
187 AC_SUBST([EGL_CFLAGS])
188 AC_SUBST([EGL_LIBS])
189 AC_SUBST([GLESV1_CFLAGS])
190 AC_SUBST([GLESV1_LIBS])
191 AC_SUBST([GLESV2_CFLAGS])
192 AC_SUBST([GLESV2_LIBS])
193 AC_SUBST([GLUT_CFLAGS])
194 AC_SUBST([GLUT_LIBS])
195 AC_SUBST([X11_CFLAGS])
196 AC_SUBST([X11_LIBS])
197 AC_SUBST([OSMESA_CFLAGS])
198 AC_SUBST([OSMESA_LIBS])
199 AC_SUBST([OSMESA16_LIBS])
200 AC_SUBST([OSMESA32_LIBS])
201 AC_SUBST([MESA_GLAPI])
203 AM_CONDITIONAL(HAVE_EGL, test "x$egl_enabled" = "xyes")
204 AM_CONDITIONAL(HAVE_GLESV1, test "x$glesv1_enabled" = "xyes")
205 AM_CONDITIONAL(HAVE_GLESV2, test "x$glesv2_enabled" = "xyes")
206 AM_CONDITIONAL(HAVE_VG, test "x$vg_enabled" = "xyes")
207 AM_CONDITIONAL(HAVE_GLUT, test "x$glut_enabled" = "xyes")
208 AM_CONDITIONAL(HAVE_X11, test "x$x11_enabled" = "xyes")
209 AM_CONDITIONAL(HAVE_OSMESA, test "x$osmesa_enabled" = "xyes")
210 AM_CONDITIONAL(BUILD_GLTRACE, false)
211 AM_CONDITIONAL(HAVE_MESA_SOURCE, test "x$mesa_source_enabled" = "xyes")
213 AC_OUTPUT([
214         Makefile
215         src/Makefile
216         src/demos/Makefile
217         src/egl/Makefile
218         src/egl/eglut/Makefile
219         src/egl/opengl/Makefile
220         src/egl/opengles1/Makefile
221         src/egl/opengles2/Makefile
222         src/egl/openvg/Makefile
223         src/egl/openvg/trivial/Makefile
224         src/fp/Makefile
225         src/fpglsl/Makefile
226         src/glsl/Makefile
227         src/images/Makefile
228         src/objviewer/Makefile
229         src/osdemos/Makefile
230         src/perf/Makefile
231         src/rbug/Makefile
232         src/redbook/Makefile
233         src/samples/Makefile
234         src/slang/Makefile
235         src/tests/Makefile
236         src/tools/Makefile
237         src/tools/trace/Makefile
238         src/trivial/Makefile
239         src/util/Makefile
240         src/vp/Makefile
241         src/vpglsl/Makefile
242         src/wgl/Makefile
243         src/xdemos/Makefile