blob: 2a67bd62b25078ea0ff94b497e41b1768ffa228f [file] [log] [blame]
Dan Nicholsondca1b792007-10-23 09:25:58 -07001dnl Process this file with autoconf to create configure.
2
Dan Nicholson297e16c2008-05-05 15:42:53 -07003AC_PREREQ([2.59])
Dan Nicholsondca1b792007-10-23 09:25:58 -07004
Dan Nicholson00994ac2008-04-30 15:06:00 -07005dnl Versioning - scrape the version from configs/default
6m4_define([mesa_version],
7 [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])])
Dan Nicholson356f3112009-04-29 06:49:27 -07008m4_ifval(mesa_version,,
9 [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])])
Dan Nicholsondca1b792007-10-23 09:25:58 -070010
Dan Nicholsone97ab722008-07-01 08:55:42 -070011dnl Tell the user about autoconf.html in the --help output
12m4_divert_once([HELP_END], [
13See docs/autoconf.html for more details on the options for Mesa.])
14
Dan Nicholson00994ac2008-04-30 15:06:00 -070015AC_INIT([Mesa],[mesa_version],
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -080016 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
Dan Nicholson297e16c2008-05-05 15:42:53 -070017AC_CONFIG_AUX_DIR([bin])
Dan Nicholsondca1b792007-10-23 09:25:58 -070018AC_CANONICAL_HOST
19
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070020dnl Versions for external dependencies
Eric Anholt859828c2009-10-08 17:18:12 -070021LIBDRM_REQUIRED=2.4.15
Kristian Høgsberg154a9e52008-12-01 21:44:03 -050022DRI2PROTO_REQUIRED=1.99.3
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070023
Dan Nicholsondca1b792007-10-23 09:25:58 -070024dnl Check for progs
25AC_PROG_CPP
26AC_PROG_CC
27AC_PROG_CXX
Dan Nicholson297e16c2008-05-05 15:42:53 -070028AC_CHECK_PROGS([MAKE], [gmake make])
29AC_PATH_PROG([MKDEP], [makedepend])
30AC_PATH_PROG([SED], [sed])
Dan Nicholson41b00702007-12-12 08:48:30 -080031
Dan Nicholsonbc302b22009-05-22 09:39:02 -070032dnl Our fallback install-sh is a symlink to minstall. Use the existing
33dnl configuration in that case.
34AC_PROG_INSTALL
35test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
36
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070037dnl We need a POSIX shell for parts of the build. Assume we have one
38dnl in most cases.
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070039case "$host_os" in
40solaris*)
41 # Solaris /bin/sh is too old/non-POSIX compliant
42 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
Dan Nicholsonbfb27b52008-06-30 09:40:30 -070043 SHELL="$POSIX_SHELL"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070044 ;;
45esac
46
Dan Nicholsondb7fc632008-03-07 11:48:09 -080047MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050048dnl Ask gcc where it's keeping its secret headers
49if test "x$GCC" = xyes; then
Dan Nicholsona3d223f2009-01-30 10:52:09 -080050 for dir in include include-fixed; do
51 GCC_INCLUDES=`$CC -print-file-name=$dir`
52 if test "x$GCC_INCLUDES" != x && \
53 test "$GCC_INCLUDES" != "$dir" && \
54 test -d "$GCC_INCLUDES"; then
55 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
56 fi
57 done
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050058fi
Dan Nicholson297e16c2008-05-05 15:42:53 -070059AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050060
Dan Nicholson41b00702007-12-12 08:48:30 -080061dnl Make sure the pkg-config macros are defined
Dan Nicholson356f3112009-04-29 06:49:27 -070062m4_ifndef([PKG_PROG_PKG_CONFIG],
63 [m4_fatal([Could not locate the pkg-config autoconf macros.
64 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
65 are in a different location, try setting the environment variable
66 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
Dan Nicholsondca1b792007-10-23 09:25:58 -070067PKG_PROG_PKG_CONFIG()
68
69dnl LIB_DIR - library basename
70LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -070071AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -070072
73dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
74_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070075AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
76AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -070077
78dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
79_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070080AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
81AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070082
83dnl Compiler macros
84DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -070085AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070086case "$host_os" in
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -070087linux*|*-gnu*|gnu*)
Dan Nicholson29f603a2009-01-12 11:10:31 -080088 DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
Dan Nicholsondca1b792007-10-23 09:25:58 -070089 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -070090solaris*)
91 DEFINES="$DEFINES -DPTHREADS -DSVR4"
92 ;;
Dan Nicholsondca1b792007-10-23 09:25:58 -070093esac
94
95dnl Add flags for gcc and g++
96if test "x$GCC" = xyes; then
97 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
Dan Nicholson0c275b62008-01-15 22:52:25 -080098
99 # Work around aliasing bugs - developers should comment this out
100 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700101fi
102if test "x$GXX" = xyes; then
103 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800104
105 # Work around aliasing bugs - developers should comment this out
106 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700107fi
108
109dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700110AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700111 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700112AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700113 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700114AC_SUBST([OPT_FLAGS])
115AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700116
117dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600118dnl Hacks to enable 32 or 64 bit build
119dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700120AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600121 [AS_HELP_STRING([--enable-32-bit],
122 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700123 [enable_32bit="$enableval"],
124 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600125)
126if test "x$enable_32bit" = xyes; then
127 if test "x$GCC" = xyes; then
128 CFLAGS="$CFLAGS -m32"
Marc Dietrichc705e722009-08-31 08:56:33 -0700129 ARCH_FLAGS="$ARCH_FLAGS -m32"
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600130 fi
131 if test "x$GXX" = xyes; then
132 CXXFLAGS="$CXXFLAGS -m32"
133 fi
134fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700135AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600136 [AS_HELP_STRING([--enable-64-bit],
137 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700138 [enable_64bit="$enableval"],
139 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600140)
141if test "x$enable_64bit" = xyes; then
142 if test "x$GCC" = xyes; then
143 CFLAGS="$CFLAGS -m64"
144 fi
145 if test "x$GXX" = xyes; then
146 CXXFLAGS="$CXXFLAGS -m64"
147 fi
148fi
149
150dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800151dnl shared/static libraries, mimic libtool options
152dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700153AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800154 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800155 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700156 [enable_static="$enableval"],
157 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800158)
159case "x$enable_static" in
160xyes|xno ) ;;
161x ) enable_static=no ;;
162* )
163 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
164 ;;
165esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700166AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800167 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800168 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700169 [enable_shared="$enableval"],
170 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800171)
172case "x$enable_shared" in
173xyes|xno ) ;;
174x ) enable_shared=yes ;;
175* )
176 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
177 ;;
178esac
179
180dnl Can't have static and shared libraries, default to static if user
181dnl explicitly requested. If both disabled, set to static since shared
182dnl was explicitly requirested.
183case "x$enable_static$enable_shared" in
184xyesyes )
185 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
186 enable_shared=no
187 ;;
188xnono )
189 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
190 enable_static=yes
191 ;;
192esac
193
194dnl
195dnl mklib options
196dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700197AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800198if test "$enable_static" = yes; then
199 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
200fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700201AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800202
Dan Nicholson23656c42007-12-12 09:02:31 -0800203dnl
204dnl other compiler options
205dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700206AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800207 [AS_HELP_STRING([--enable-debug],
208 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700209 [enable_debug="$enableval"],
210 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800211)
212if test "x$enable_debug" = xyes; then
213 DEFINES="$DEFINES -DDEBUG"
214 if test "x$GCC" = xyes; then
215 CFLAGS="$CFLAGS -g"
216 fi
217 if test "x$GXX" = xyes; then
218 CXXFLAGS="$CXXFLAGS -g"
219 fi
220fi
Dan Nicholson88586332007-11-15 08:59:57 -0800221
222dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700223dnl library names
224dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800225if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800226 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800227else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700228 case "$host_os" in
229 darwin* )
230 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100231 cygwin* )
232 LIB_EXTENSION='dll' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700233 * )
234 LIB_EXTENSION='so' ;;
235 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800236fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800237
238GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
239GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
240GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
241GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
242OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
243
244GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
245GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
246GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
247GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
248OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
249
Dan Nicholson297e16c2008-05-05 15:42:53 -0700250AC_SUBST([GL_LIB_NAME])
251AC_SUBST([GLU_LIB_NAME])
252AC_SUBST([GLUT_LIB_NAME])
253AC_SUBST([GLW_LIB_NAME])
254AC_SUBST([OSMESA_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700255
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700256AC_SUBST([GL_LIB_GLOB])
257AC_SUBST([GLU_LIB_GLOB])
258AC_SUBST([GLUT_LIB_GLOB])
259AC_SUBST([GLW_LIB_GLOB])
260AC_SUBST([OSMESA_LIB_GLOB])
261
Dan Nicholsondca1b792007-10-23 09:25:58 -0700262dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700263dnl Arch/platform-specific settings
264dnl
265AC_ARG_ENABLE([asm],
266 [AS_HELP_STRING([--disable-asm],
267 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
268 [enable_asm="$enableval"],
269 [enable_asm=yes]
270)
271asm_arch=""
272ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800273MESA_ASM_SOURCES=""
274GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700275AC_MSG_CHECKING([whether to enable assembly])
276test "x$enable_asm" = xno && AC_MSG_RESULT([no])
277# disable if cross compiling on x86/x86_64 since we must run gen_matypes
278if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
279 case "$host_cpu" in
280 i?86 | x86_64)
281 enable_asm=no
282 AC_MSG_RESULT([no, cross compiling])
283 ;;
284 esac
285fi
286# check for supported arches
287if test "x$enable_asm" = xyes; then
288 case "$host_cpu" in
289 i?86)
290 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100291 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700292 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
293 ;;
294 esac
295 ;;
296 x86_64)
297 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100298 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700299 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
300 ;;
301 esac
302 ;;
303 powerpc)
304 case "$host_os" in
305 linux*)
306 asm_arch=ppc
307 ;;
308 esac
309 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800310 sparc*)
311 case "$host_os" in
312 linux*)
313 asm_arch=sparc
314 ;;
315 esac
316 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700317 esac
318
319 case "$asm_arch" in
320 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800321 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800322 MESA_ASM_SOURCES='$(X86_SOURCES)'
323 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700324 AC_MSG_RESULT([yes, x86])
325 ;;
326 x86_64)
327 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800328 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
329 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700330 AC_MSG_RESULT([yes, x86_64])
331 ;;
332 ppc)
333 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800334 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700335 AC_MSG_RESULT([yes, ppc])
336 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800337 sparc)
338 ASM_FLAGS="-DUSE_SPARC_ASM"
339 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
340 GLAPI_ASM_SOURCES='$(SPARC_API)'
341 AC_MSG_RESULT([yes, sparc])
342 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700343 *)
344 AC_MSG_RESULT([no, platform not supported])
345 ;;
346 esac
347fi
348AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800349AC_SUBST([MESA_ASM_SOURCES])
350AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700351
352dnl PIC code macro
353MESA_PIC_FLAGS
354
355dnl Check to see if dlopen is in default libraries (like Solaris, which
356dnl has it in libc), or if libdl is needed to get it.
357AC_CHECK_FUNC([dlopen], [],
358 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
359
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700360dnl See if posix_memalign is available
361AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
362
Dan Nicholson871125a2008-06-04 13:00:35 -0700363dnl SELinux awareness.
364AC_ARG_ENABLE([selinux],
365 [AS_HELP_STRING([--enable-selinux],
366 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
367 [MESA_SELINUX="$enableval"],
368 [MESA_SELINUX=no])
369if test "x$enable_selinux" = "xyes"; then
370 AC_CHECK_HEADER([selinux/selinux.h],[],
371 [AC_MSG_ERROR([SELinux headers not found])])
372 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
373 [AC_MSG_ERROR([SELinux library not found])])
374 SELINUX_LIBS="-lselinux"
375 DEFINES="$DEFINES -DMESA_SELINUX"
376fi
377
Dan Nicholson871125a2008-06-04 13:00:35 -0700378dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800379dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800380dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800381dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700382default_driver="xlib"
383
384case "$host_os" in
385linux*)
386 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700387 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700388 esac
389 ;;
Julien Cristau98fcdf32008-10-28 18:56:05 +0100390*freebsd* | dragonfly*)
Eric Anholt711222b2008-04-18 15:03:01 -0700391 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500392 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700393 esac
394 ;;
395esac
396
Dan Nicholson297e16c2008-05-05 15:42:53 -0700397AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800398 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700399 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700400 [mesa_driver="$withval"],
401 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800402dnl Check for valid option
403case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800404xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800405 ;;
406*)
407 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
408 ;;
409esac
410
411dnl
412dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700413dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700414SRC_DIRS="mesa glew"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700415GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800416WINDOW_SYSTEM=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100417GALLIUM_DIRS="auxiliary drivers state_trackers"
Jerome Glisse14f79d42008-12-18 13:36:07 +0100418GALLIUM_WINSYS_DIRS=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100419GALLIUM_WINSYS_DRM_DIRS=""
Younes Mantonf5474722009-09-27 19:49:06 -0400420GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices vl"
Jakob Bornecrantzd60b2c62009-06-24 02:42:41 +0200421GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100422GALLIUM_STATE_TRACKERS_DIRS=""
423
Dan Nicholson44d99142007-12-05 18:47:01 -0800424case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800425xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800426 DRIVER_DIRS="x11"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100427 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800428 ;;
429dri)
430 SRC_DIRS="glx/x11 $SRC_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100431 DRIVER_DIRS="dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800432 WINDOW_SYSTEM="dri"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100433 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
Dan Nicholson44d99142007-12-05 18:47:01 -0800434 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800435osmesa)
436 DRIVER_DIRS="osmesa"
437 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800438esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700439AC_SUBST([SRC_DIRS])
440AC_SUBST([GLU_DIRS])
441AC_SUBST([DRIVER_DIRS])
442AC_SUBST([WINDOW_SYSTEM])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100443AC_SUBST([GALLIUM_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100444AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100445AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000446AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100447AC_SUBST([GALLIUM_AUXILIARY_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100448AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dave Airlieb0e8ac82009-02-15 17:03:47 +1000449AC_SUBST([RADEON_CFLAGS])
450AC_SUBST([RADEON_LDFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700451
452dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800453dnl User supplied program configuration
454dnl
455if test -d "$srcdir/progs/demos"; then
456 default_demos=yes
457else
458 default_demos=no
459fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700460AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800461 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
462 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800463 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700464 [with_demos="$withval"],
465 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800466if test "x$with_demos" = x; then
467 with_demos=no
468fi
469
470dnl If $with_demos is yes, directories will be added as libs available
471PROGRAM_DIRS=""
472case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700473no) ;;
474yes)
475 # If the driver isn't osmesa, we have libGL and can build xdemos
476 if test "$mesa_driver" != osmesa; then
477 PROGRAM_DIRS="xdemos"
478 fi
479 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800480*)
481 # verify the requested demos directories exist
482 demos=`IFS=,; echo $with_demos`
483 for demo in $demos; do
484 test -d "$srcdir/progs/$demo" || \
485 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
486 done
487 PROGRAM_DIRS="$demos"
488 ;;
489esac
490
491dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700492dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700493dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700494dnl
495if test -n "$PKG_CONFIG"; then
496 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700497 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700498 x11_pkgconfig=yes
499 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700500 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700501 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700502 ])
503 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700504else
505 x11_pkgconfig=no
506fi
507dnl Use the autoconf macro if no pkg-config files
508if test "$x11_pkgconfig" = no; then
509 AC_PATH_XTRA
510fi
511
Dan Nicholson99803a42008-07-01 09:03:15 -0700512dnl Try to tell the user that the --x-* options are only used when
513dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
514m4_divert_once([HELP_BEGIN],
515[These options are only used when the X libraries cannot be found by the
516pkg-config utility.])
517
Dan Nicholson44d99142007-12-05 18:47:01 -0800518dnl We need X for xlib and dri, so bomb now if it's not found
519case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800520xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800521 if test "$no_x" = yes; then
522 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
523 fi
524 ;;
525esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700526
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700527dnl XCB - this is only used for GLX right now
528AC_ARG_ENABLE([xcb],
529 [AS_HELP_STRING([--enable-xcb],
530 [use XCB for GLX @<:@default=disabled@:>@])],
531 [enable_xcb="$enableval"],
532 [enable_xcb=no])
533if test "x$enable_xcb" = xyes; then
534 DEFINES="$DEFINES -DUSE_XCB"
535else
536 enable_xcb=no
537fi
538
Dan Nicholson44d99142007-12-05 18:47:01 -0800539dnl
540dnl libGL configuration per driver
541dnl
542case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800543xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800544 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700545 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800546 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800547 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
548 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800549 else
550 # should check these...
551 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
552 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800553 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
554 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800555 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700556 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
557 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800558
559 # if static, move the external libraries to the programs
560 # and empty the libraries for libGL
561 if test "$enable_static" = yes; then
562 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
563 GL_LIB_DEPS=""
564 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800565 ;;
566dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800567 # DRI must be shared, I think
568 if test "$enable_static" = yes; then
569 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
570 fi
571
Dan Nicholson44d99142007-12-05 18:47:01 -0800572 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700573 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
574 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800575 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
576 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800577
Dave Airlieb0e8ac82009-02-15 17:03:47 +1000578 PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
579
580 if test "$HAVE_LIBDRM_RADEON" = yes; then
581 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
582 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
583 fi
584
Dan Nicholson44d99142007-12-05 18:47:01 -0800585 # find the DRI deps for libGL
586 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700587 # add xcb modules if necessary
588 dri_modules="x11 xext xxf86vm xdamage xfixes"
589 if test "$enable_xcb" = yes; then
590 dri_modules="$dri_modules x11-xcb xcb-glx"
591 fi
592
593 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800594 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800595 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
596 GL_LIB_DEPS="$DRIGL_LIBS"
597 else
598 # should check these...
599 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
600 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800601 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
602 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700603
604 # XCB can only be used from pkg-config
605 if test "$enable_xcb" = yes; then
606 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800607 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700608 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
609 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
610 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800611 fi
612
613 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700614 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
615 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800616 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800617osmesa)
618 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700619 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800620 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800621esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700622AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800623AC_SUBST([GL_PC_REQ_PRIV])
624AC_SUBST([GL_PC_LIB_PRIV])
625AC_SUBST([GL_PC_CFLAGS])
626AC_SUBST([DRI_PC_REQ_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700627
628dnl
629dnl More X11 setup
630dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800631if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700632 DEFINES="$DEFINES -DUSE_XSHM"
633fi
634
635dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800636dnl More DRI setup
637dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700638AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800639 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800640 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700641 [GLX_USE_TLS="$enableval"],
642 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800643dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700644AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800645 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700646 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700647 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700648 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700649AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800650dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700651AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800652 [AS_HELP_STRING([--disable-driglx-direct],
653 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700654 [driglx_direct="$enableval"],
655 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800656dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700657AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800658 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700659 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200660 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700661 [with_dri_drivers="$withval"],
662 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800663if test "x$with_dri_drivers" = x; then
664 with_dri_drivers=no
665fi
666
667dnl If $with_dri_drivers is yes, directories will be added through
668dnl platform checks
669DRI_DIRS=""
670case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100671no) ;;
672yes)
673 DRI_DIRS="yes"
674 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800675*)
676 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700677 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800678 for driver in $dri_drivers; do
679 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
680 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
681 done
682 DRI_DIRS="$dri_drivers"
683 ;;
684esac
685
Dan Nicholson44d99142007-12-05 18:47:01 -0800686dnl Just default to no EGL for now
687USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700688AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800689
690dnl Set DRI_DIRS, DEFINES and LIB_DEPS
691if test "$mesa_driver" = dri; then
692 # Use TLS in GLX?
693 if test "x$GLX_USE_TLS" = xyes; then
694 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
695 fi
696
697 if test "x$USING_EGL" = x1; then
698 PROGRAM_DIRS="egl"
699 fi
700
701 # Platform specific settings and drivers to build
702 case "$host_os" in
703 linux*)
704 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800705 if test "x$driglx_direct" = xyes; then
706 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
707 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100708 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800709
710 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800711 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800712 # ffb, gamma, and sis are missing because they have not be
713 # converted to use the new interface. i810 are missing
714 # because there is no x86-64 system where they could *ever*
715 # be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100716 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400717 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300718 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800719 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800720 ;;
721 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800722 # Build only the drivers for cards that exist on PowerPC.
723 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100724 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400725 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800726 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800727 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000728 sparc*)
729 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100730 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400731 DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000732 fi
733 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800734 esac
735 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700736 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800737 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
738 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
739 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
740 if test "x$driglx_direct" = xyes; then
741 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
742 fi
743 if test "x$GXX" = xyes; then
744 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
745 fi
746
Dan Nicholsona76e2452007-12-07 11:25:08 -0800747 # ffb and gamma are missing because they have not been converted
748 # to use the new interface.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100749 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400750 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300751 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800752 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800753 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700754 gnu*)
755 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
756 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
757 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700758 solaris*)
759 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
760 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
761 if test "x$driglx_direct" = xyes; then
762 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
763 fi
764 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800765 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800766
767 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100768 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400769 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon s3v \
George Sapountzis280bf892008-05-11 14:43:40 +0300770 savage sis tdfx trident unichrome ffb swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800771 fi
772
Dan Nicholson44d99142007-12-05 18:47:01 -0800773 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
774
775 # Check for expat
776 EXPAT_INCLUDES=""
777 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700778 AC_ARG_WITH([expat],
779 [AS_HELP_STRING([--with-expat=DIR],
780 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800781 EXPAT_INCLUDES="-I$withval/include"
782 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
783 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
784 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
785 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700786 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
787 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
788 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800789
790 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700791 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800792fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700793AC_SUBST([DRI_DIRS])
794AC_SUBST([EXPAT_INCLUDES])
795AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800796
797dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700798dnl OSMesa configuration
799dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800800if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800801 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800802else
Dan Nicholson544ab202007-12-30 08:41:53 -0800803 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800804fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700805AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800806 [AS_HELP_STRING([--enable-gl-osmesa],
807 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700808 [gl_osmesa="$enableval"],
809 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800810if test "x$gl_osmesa" = xyes; then
811 if test "$mesa_driver" = osmesa; then
812 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800813 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800814 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800815 fi
816fi
817
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800818dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700819AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800820 [AS_HELP_STRING([--with-osmesa-bits=BITS],
821 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700822 [osmesa_bits="$withval"],
823 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800824if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
825 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
826 osmesa_bits=8
827fi
828case "x$osmesa_bits" in
829x8)
830 OSMESA_LIB=OSMesa
831 ;;
832x16|x32)
833 OSMESA_LIB="OSMesa$osmesa_bits"
834 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
835 ;;
836*)
837 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
838 ;;
839esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700840AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800841
Dan Nicholson979ff512007-12-05 18:47:01 -0800842case "$mesa_driver" in
843osmesa)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700844 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800845 if test "$enable_static" = no; then
Dan Nicholson4795dd52009-06-04 19:42:08 -0700846 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800847 else
848 OSMESA_LIB_DEPS=""
849 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800850 OSMESA_MESA_DEPS=""
Dan Nicholson4795dd52009-06-04 19:42:08 -0700851 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800852 ;;
853*)
854 # Link OSMesa to libGL otherwise
855 OSMESA_LIB_DEPS=""
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700856 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800857 if test "$enable_static" = no; then
858 OSMESA_MESA_DEPS='-l$(GL_LIB)'
859 else
860 OSMESA_MESA_DEPS=""
861 fi
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800862 OSMESA_PC_REQ="gl"
Dan Nicholson979ff512007-12-05 18:47:01 -0800863 ;;
864esac
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700865OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700866AC_SUBST([OSMESA_LIB_DEPS])
867AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800868AC_SUBST([OSMESA_PC_REQ])
869AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700870
871dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800872dnl EGL configuration
873dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700874AC_ARG_ENABLE([egl],
875 [AS_HELP_STRING([--disable-egl],
876 [disable EGL library @<:@default=enabled@:>@])],
877 [enable_egl="$enableval"],
878 [enable_egl=yes])
879if test "x$enable_egl" = xyes; then
880 SRC_DIRS="$SRC_DIRS egl"
881
882 if test "$x11_pkgconfig" = yes; then
883 PKG_CHECK_MODULES([EGL], [x11])
884 EGL_LIB_DEPS="$EGL_LIBS"
885 else
886 # should check these...
887 EGL_LIB_DEPS="$X_LIBS -lX11"
888 fi
889 EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
Dan Nicholson53b37342009-02-25 17:45:34 -0800890fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800891AC_SUBST([EGL_LIB_DEPS])
892
893dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700894dnl GLU configuration
895dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700896AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800897 [AS_HELP_STRING([--disable-glu],
898 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700899 [enable_glu="$enableval"],
900 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700901if test "x$enable_glu" = xyes; then
902 SRC_DIRS="$SRC_DIRS glu"
903
Dan Nicholson979ff512007-12-05 18:47:01 -0800904 case "$mesa_driver" in
905 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800906 # If GLU is available and we have libOSMesa (not 16 or 32),
907 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800908 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800909 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
910 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700911
Dan Nicholson979ff512007-12-05 18:47:01 -0800912 # Link libGLU to libOSMesa instead of libGL
913 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800914 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -0800915 if test "$enable_static" = no; then
916 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
917 else
918 GLU_MESA_DEPS=""
919 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800920 ;;
921 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800922 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -0800923 GLU_PC_REQ="gl"
924 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -0800925 if test "$enable_static" = no; then
926 GLU_LIB_DEPS="-lm"
927 GLU_MESA_DEPS='-l$(GL_LIB)'
928 else
929 GLU_LIB_DEPS=""
930 GLU_MESA_DEPS=""
931 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
932 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800933 ;;
934 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700935fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700936if test "$enable_static" = no; then
937 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
938fi
Dan Nicholson71e208b2008-11-24 11:01:57 -0800939GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700940AC_SUBST([GLU_LIB_DEPS])
941AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800942AC_SUBST([GLU_PC_REQ])
943AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800944AC_SUBST([GLU_PC_LIB_PRIV])
945AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700946
947dnl
948dnl GLw configuration
949dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700950AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800951 [AS_HELP_STRING([--disable-glw],
952 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700953 [enable_glw="$enableval"],
954 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800955dnl Don't build GLw on osmesa
956if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
957 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
958 enable_glw=no
959fi
Dan Nicholson776c60d2008-07-18 07:40:41 -0700960AC_ARG_ENABLE([motif],
961 [AS_HELP_STRING([--enable-motif],
962 [use Motif widgets in GLw @<:@default=disabled@:>@])],
963 [enable_motif="$enableval"],
964 [enable_motif=no])
965
Dan Nicholsondca1b792007-10-23 09:25:58 -0700966if test "x$enable_glw" = xyes; then
967 SRC_DIRS="$SRC_DIRS glw"
968 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700969 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800970 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700971 GLW_LIB_DEPS="$GLW_LIBS"
972 else
973 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -0700974 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800975 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
976 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -0700977 fi
978
979 GLW_SOURCES="GLwDrawA.c"
980 MOTIF_CFLAGS=
981 if test "x$enable_motif" = xyes; then
982 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
983 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
984 if test "x$MOTIF_CONFIG" != xno; then
985 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
986 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
987 else
988 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
989 [AC_MSG_ERROR([Can't locate Motif headers])])
990 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
991 [AC_MSG_ERROR([Can't locate Motif Xm library])])
992 fi
993 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
994 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800995 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
996 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700997 fi
998
Dan Nicholson88586332007-11-15 08:59:57 -0800999 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001000 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001001 if test "$enable_static" = no; then
1002 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001003 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001004 else
1005 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1006 GLW_LIB_DEPS=""
1007 GLW_MESA_DEPS=""
1008 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001009fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001010AC_SUBST([GLW_LIB_DEPS])
1011AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001012AC_SUBST([GLW_SOURCES])
1013AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001014AC_SUBST([GLW_PC_REQ_PRIV])
1015AC_SUBST([GLW_PC_LIB_PRIV])
1016AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001017
1018dnl
1019dnl GLUT configuration
1020dnl
1021if test -f "$srcdir/include/GL/glut.h"; then
1022 default_glut=yes
1023else
1024 default_glut=no
1025fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001026AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001027 [AS_HELP_STRING([--disable-glut],
1028 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001029 [enable_glut="$enableval"],
1030 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001031
1032dnl Can't build glut if GLU not available
1033if test "x$enable_glu$enable_glut" = xnoyes; then
1034 AC_MSG_WARN([Disabling glut since GLU is disabled])
1035 enable_glut=no
1036fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001037dnl Don't build glut on osmesa
1038if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1039 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1040 enable_glut=no
1041fi
1042
Dan Nicholsondca1b792007-10-23 09:25:58 -07001043if test "x$enable_glut" = xyes; then
1044 SRC_DIRS="$SRC_DIRS glut/glx"
1045 GLUT_CFLAGS=""
1046 if test "x$GCC" = xyes; then
1047 GLUT_CFLAGS="-fexceptions"
1048 fi
1049 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001050 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001051 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001052 GLUT_LIB_DEPS="$GLUT_LIBS"
1053 else
1054 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001055 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001056 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1057 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001058 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001059 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1060 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001061
1062 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -08001063 if test "$with_demos" = yes; then
1064 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1065 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001066
Dan Nicholson88586332007-11-15 08:59:57 -08001067 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1068 if test "$enable_static" = no; then
1069 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1070 else
1071 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1072 GLUT_LIB_DEPS=""
1073 GLUT_MESA_DEPS=""
1074 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001075fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001076AC_SUBST([GLUT_LIB_DEPS])
1077AC_SUBST([GLUT_MESA_DEPS])
1078AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001079AC_SUBST([GLUT_PC_REQ_PRIV])
1080AC_SUBST([GLUT_PC_LIB_PRIV])
1081AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001082
1083dnl
1084dnl Program library dependencies
1085dnl Only libm is added here if necessary as the libraries should
1086dnl be pulled in by the linker
1087dnl
1088if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001089 case "$host_os" in
1090 solaris*)
1091 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1092 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001093 cygwin*)
1094 APP_LIB_DEPS="-lX11"
1095 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001096 *)
1097 APP_LIB_DEPS="-lm"
1098 ;;
1099 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001100fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001101AC_SUBST([APP_LIB_DEPS])
1102AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001103
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001104dnl
1105dnl Gallium configuration
1106dnl
1107AC_ARG_ENABLE([gallium],
1108 [AS_HELP_STRING([--disable-gallium],
1109 [build gallium @<:@default=enabled@:>@])],
1110 [enable_gallium="$enableval"],
1111 [enable_gallium=yes])
1112if test "x$enable_gallium" = xyes; then
1113 SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
1114fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001115
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001116dnl
1117dnl Gallium state trackers configuration
1118dnl
1119AC_ARG_WITH([state-trackers],
1120 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1121 [comma delimited state_trackers list, e.g.
1122 "egl,glx" @<:@default=auto@:>@])],
1123 [with_state_trackers="$withval"],
1124 [with_state_trackers=yes])
1125
1126case "$with_state_trackers" in
1127no)
1128 GALLIUM_STATE_TRACKERS_DIRS=""
1129 ;;
1130yes)
1131 # look at what else is built
1132 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001133 xlib)
1134 GALLIUM_STATE_TRACKERS_DIRS=glx
1135 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001136 dri)
Dan Nicholson66f97862009-04-29 12:11:43 -07001137 test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001138 ;;
1139 esac
1140 ;;
1141*)
1142 # verify the requested state tracker exist
1143 state_trackers=`IFS=', '; echo $with_state_trackers`
1144 for tracker in $state_trackers; do
1145 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1146 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
Dan Nicholson66f97862009-04-29 12:11:43 -07001147
1148 if test "$tracker" = egl && test "x$enable_egl" != xyes; then
1149 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1150 fi
Dave Airliee9d6ab72009-09-21 13:26:48 +10001151 if test "$tracker" = xorg; then
1152 PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1153 HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71"
1154 HAVE_XEXTPROTO_71="no")
1155 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001156 done
1157 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1158 ;;
1159esac
1160
Joel Bosveld8acca482009-03-06 08:46:08 +09001161AC_ARG_WITH([xorg-driver-dir],
1162 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1163 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1164 [XORG_DRIVER_INSTALL_DIR="$withval"],
1165 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1166AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1167
Tom Fogal7085dce2009-08-13 19:40:30 -06001168AC_ARG_WITH([max-width],
1169 [AS_HELP_STRING([--with-max-width=N],
1170 [Maximum framebuffer width (4096)])],
1171 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1172 AS_IF([test "${withval}" -gt "4096"],
1173 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1174)
1175AC_ARG_WITH([max-height],
1176 [AS_HELP_STRING([--with-max-height=N],
1177 [Maximum framebuffer height (4096)])],
1178 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1179 AS_IF([test "${withval}" -gt "4096"],
1180 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1181)
1182
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001183dnl
1184dnl Gallium Intel configuration
1185dnl
1186AC_ARG_ENABLE([gallium-intel],
1187 [AS_HELP_STRING([--disable-gallium-intel],
1188 [build gallium intel @<:@default=enabled@:>@])],
1189 [enable_gallium_intel="$enableval"],
1190 [enable_gallium_intel=yes])
1191if test "x$enable_gallium_intel" = xyes; then
1192 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
Jakob Bornecrantzf00da2a2009-09-29 16:07:11 -07001193 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001194fi
1195
1196dnl
1197dnl Gallium Radeon configuration
1198dnl
1199AC_ARG_ENABLE([gallium-radeon],
1200 [AS_HELP_STRING([--enable-gallium-radeon],
1201 [build gallium radeon @<:@default=disabled@:>@])],
1202 [enable_gallium_radeon="$enableval"],
1203 [enable_gallium_radeon=no])
1204if test "x$enable_gallium_radeon" = xyes; then
1205 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001206 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001207fi
1208
1209dnl
Thierry Vignaud1402ea82009-09-14 11:48:51 -06001210dnl Gallium Nouveau configuration
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001211dnl
1212AC_ARG_ENABLE([gallium-nouveau],
1213 [AS_HELP_STRING([--enable-gallium-nouveau],
1214 [build gallium nouveau @<:@default=disabled@:>@])],
1215 [enable_gallium_nouveau="$enableval"],
1216 [enable_gallium_nouveau=no])
1217if test "x$enable_gallium_nouveau" = xyes; then
1218 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
Ben Skeggsbc466be2009-06-04 10:19:04 +10001219 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001220fi
1221
1222
Dan Nicholsondca1b792007-10-23 09:25:58 -07001223dnl Restore LDFLAGS and CPPFLAGS
1224LDFLAGS="$_SAVE_LDFLAGS"
1225CPPFLAGS="$_SAVE_CPPFLAGS"
1226
1227dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001228AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001229
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001230dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001231AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001232if test -f configs/current || test -L configs/current; then
1233 rm -f configs/current
1234fi
1235ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001236])
1237
1238AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001239
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001240dnl
1241dnl Output some configuration info for the user
1242dnl
1243echo ""
1244echo " prefix: $prefix"
1245echo " exec_prefix: $exec_prefix"
1246echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001247echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001248
1249dnl Driver info
1250echo ""
1251echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001252if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1253 echo " OSMesa: lib$OSMESA_LIB"
1254else
1255 echo " OSMesa: no"
1256fi
1257if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001258 # cleanup the drivers var
1259 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001260if test "x$DRI_DIRS" = x; then
1261 echo " DRI drivers: no"
1262else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001263 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001264fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001265 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001266fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001267echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001268
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001269echo ""
1270if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1271 echo " Gallium: yes"
1272 echo " Gallium dirs: $GALLIUM_DIRS"
1273 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001274 echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001275 echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001276 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001277 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1278else
1279 echo " Gallium: no"
1280fi
1281
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001282dnl Libraries
1283echo ""
1284echo " Shared libs: $enable_shared"
1285echo " Static libs: $enable_static"
Dan Nicholson66f97862009-04-29 12:11:43 -07001286echo " EGL: $enable_egl"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001287echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001288echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001289echo " glut: $enable_glut"
1290
1291dnl Programs
1292# cleanup the programs var for display
1293program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1294if test "x$program_dirs" = x; then
1295 echo " Demos: no"
1296else
1297 echo " Demos: $program_dirs"
1298fi
1299
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001300dnl Compiler options
1301# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1302cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1303 $SED 's/^ *//;s/ */ /;s/ *$//'`
1304cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1305 $SED 's/^ *//;s/ */ /;s/ *$//'`
1306defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1307echo ""
1308echo " CFLAGS: $cflags"
1309echo " CXXFLAGS: $cxxflags"
1310echo " Macros: $defines"
1311
Dan Nicholsondca1b792007-10-23 09:25:58 -07001312echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001313echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001314echo ""