blob: 9d318b3fc20062e79ac6aceaf2a6fda5c2db0631 [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
Brian44557bf2009-01-10 16:32:32 -070021LIBDRM_REQUIRED=2.4.3
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"
129 fi
130 if test "x$GXX" = xyes; then
131 CXXFLAGS="$CXXFLAGS -m32"
132 fi
133fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700134AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600135 [AS_HELP_STRING([--enable-64-bit],
136 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700137 [enable_64bit="$enableval"],
138 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600139)
140if test "x$enable_64bit" = xyes; then
141 if test "x$GCC" = xyes; then
142 CFLAGS="$CFLAGS -m64"
143 fi
144 if test "x$GXX" = xyes; then
145 CXXFLAGS="$CXXFLAGS -m64"
146 fi
147fi
148
149dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800150dnl shared/static libraries, mimic libtool options
151dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700152AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800153 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800154 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700155 [enable_static="$enableval"],
156 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800157)
158case "x$enable_static" in
159xyes|xno ) ;;
160x ) enable_static=no ;;
161* )
162 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
163 ;;
164esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700165AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800166 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800167 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700168 [enable_shared="$enableval"],
169 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800170)
171case "x$enable_shared" in
172xyes|xno ) ;;
173x ) enable_shared=yes ;;
174* )
175 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
176 ;;
177esac
178
179dnl Can't have static and shared libraries, default to static if user
180dnl explicitly requested. If both disabled, set to static since shared
181dnl was explicitly requirested.
182case "x$enable_static$enable_shared" in
183xyesyes )
184 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
185 enable_shared=no
186 ;;
187xnono )
188 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
189 enable_static=yes
190 ;;
191esac
192
193dnl
194dnl mklib options
195dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700196AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800197if test "$enable_static" = yes; then
198 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
199fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700200AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800201
Dan Nicholson23656c42007-12-12 09:02:31 -0800202dnl
203dnl other compiler options
204dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700205AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800206 [AS_HELP_STRING([--enable-debug],
207 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700208 [enable_debug="$enableval"],
209 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800210)
211if test "x$enable_debug" = xyes; then
212 DEFINES="$DEFINES -DDEBUG"
213 if test "x$GCC" = xyes; then
214 CFLAGS="$CFLAGS -g"
215 fi
216 if test "x$GXX" = xyes; then
217 CXXFLAGS="$CXXFLAGS -g"
218 fi
219fi
Dan Nicholson88586332007-11-15 08:59:57 -0800220
221dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700222dnl library names
223dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800224if test "$enable_static" = yes; then
Dan Nicholson8217f242009-02-11 15:16:00 -0800225 LIB_EXTENSION='a'
Dan Nicholson88586332007-11-15 08:59:57 -0800226else
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700227 case "$host_os" in
228 darwin* )
229 LIB_EXTENSION='dylib' ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +0100230 cygwin* )
231 LIB_EXTENSION='dll' ;;
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700232 * )
233 LIB_EXTENSION='so' ;;
234 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800235fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800236
237GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
238GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
239GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
240GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
241OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
242
243GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
244GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
245GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
246GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
247OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
248
Dan Nicholson297e16c2008-05-05 15:42:53 -0700249AC_SUBST([GL_LIB_NAME])
250AC_SUBST([GLU_LIB_NAME])
251AC_SUBST([GLUT_LIB_NAME])
252AC_SUBST([GLW_LIB_NAME])
253AC_SUBST([OSMESA_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700254
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700255AC_SUBST([GL_LIB_GLOB])
256AC_SUBST([GLU_LIB_GLOB])
257AC_SUBST([GLUT_LIB_GLOB])
258AC_SUBST([GLW_LIB_GLOB])
259AC_SUBST([OSMESA_LIB_GLOB])
260
Dan Nicholsondca1b792007-10-23 09:25:58 -0700261dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700262dnl Arch/platform-specific settings
263dnl
264AC_ARG_ENABLE([asm],
265 [AS_HELP_STRING([--disable-asm],
266 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
267 [enable_asm="$enableval"],
268 [enable_asm=yes]
269)
270asm_arch=""
271ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800272MESA_ASM_SOURCES=""
273GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700274AC_MSG_CHECKING([whether to enable assembly])
275test "x$enable_asm" = xno && AC_MSG_RESULT([no])
276# disable if cross compiling on x86/x86_64 since we must run gen_matypes
277if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
278 case "$host_cpu" in
279 i?86 | x86_64)
280 enable_asm=no
281 AC_MSG_RESULT([no, cross compiling])
282 ;;
283 esac
284fi
285# check for supported arches
286if test "x$enable_asm" = xyes; then
287 case "$host_cpu" in
288 i?86)
289 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100290 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700291 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
292 ;;
293 esac
294 ;;
295 x86_64)
296 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100297 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700298 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
299 ;;
300 esac
301 ;;
302 powerpc)
303 case "$host_os" in
304 linux*)
305 asm_arch=ppc
306 ;;
307 esac
308 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800309 sparc*)
310 case "$host_os" in
311 linux*)
312 asm_arch=sparc
313 ;;
314 esac
315 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700316 esac
317
318 case "$asm_arch" in
319 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800320 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800321 MESA_ASM_SOURCES='$(X86_SOURCES)'
322 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700323 AC_MSG_RESULT([yes, x86])
324 ;;
325 x86_64)
326 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800327 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
328 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700329 AC_MSG_RESULT([yes, x86_64])
330 ;;
331 ppc)
332 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800333 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700334 AC_MSG_RESULT([yes, ppc])
335 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800336 sparc)
337 ASM_FLAGS="-DUSE_SPARC_ASM"
338 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
339 GLAPI_ASM_SOURCES='$(SPARC_API)'
340 AC_MSG_RESULT([yes, sparc])
341 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700342 *)
343 AC_MSG_RESULT([no, platform not supported])
344 ;;
345 esac
346fi
347AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800348AC_SUBST([MESA_ASM_SOURCES])
349AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700350
351dnl PIC code macro
352MESA_PIC_FLAGS
353
354dnl Check to see if dlopen is in default libraries (like Solaris, which
355dnl has it in libc), or if libdl is needed to get it.
356AC_CHECK_FUNC([dlopen], [],
357 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
358
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700359dnl See if posix_memalign is available
360AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
361
Dan Nicholson871125a2008-06-04 13:00:35 -0700362dnl SELinux awareness.
363AC_ARG_ENABLE([selinux],
364 [AS_HELP_STRING([--enable-selinux],
365 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
366 [MESA_SELINUX="$enableval"],
367 [MESA_SELINUX=no])
368if test "x$enable_selinux" = "xyes"; then
369 AC_CHECK_HEADER([selinux/selinux.h],[],
370 [AC_MSG_ERROR([SELinux headers not found])])
371 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
372 [AC_MSG_ERROR([SELinux library not found])])
373 SELINUX_LIBS="-lselinux"
374 DEFINES="$DEFINES -DMESA_SELINUX"
375fi
376
Dan Nicholson871125a2008-06-04 13:00:35 -0700377dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800378dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800379dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800380dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700381default_driver="xlib"
382
383case "$host_os" in
384linux*)
385 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700386 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700387 esac
388 ;;
Julien Cristau98fcdf32008-10-28 18:56:05 +0100389*freebsd* | dragonfly*)
Eric Anholt711222b2008-04-18 15:03:01 -0700390 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500391 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700392 esac
393 ;;
394esac
395
Dan Nicholson297e16c2008-05-05 15:42:53 -0700396AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800397 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700398 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700399 [mesa_driver="$withval"],
400 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800401dnl Check for valid option
402case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800403xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800404 ;;
405*)
406 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
407 ;;
408esac
409
410dnl
411dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700412dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700413SRC_DIRS="mesa glew"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700414GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800415WINDOW_SYSTEM=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100416GALLIUM_DIRS="auxiliary drivers state_trackers"
Jerome Glisse14f79d42008-12-18 13:36:07 +0100417GALLIUM_WINSYS_DIRS=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100418GALLIUM_WINSYS_DRM_DIRS=""
Jakob Bornecrantzdfa4ebc2009-05-15 01:07:05 +0200419GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
Jakob Bornecrantzd60b2c62009-06-24 02:42:41 +0200420GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100421GALLIUM_STATE_TRACKERS_DIRS=""
422
Dan Nicholson44d99142007-12-05 18:47:01 -0800423case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800424xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800425 DRIVER_DIRS="x11"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100426 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800427 ;;
428dri)
429 SRC_DIRS="glx/x11 $SRC_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100430 DRIVER_DIRS="dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800431 WINDOW_SYSTEM="dri"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100432 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
Dan Nicholson44d99142007-12-05 18:47:01 -0800433 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800434osmesa)
435 DRIVER_DIRS="osmesa"
436 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800437esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700438AC_SUBST([SRC_DIRS])
439AC_SUBST([GLU_DIRS])
440AC_SUBST([DRIVER_DIRS])
441AC_SUBST([WINDOW_SYSTEM])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100442AC_SUBST([GALLIUM_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100443AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100444AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000445AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100446AC_SUBST([GALLIUM_AUXILIARY_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100447AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dave Airlieb0e8ac82009-02-15 17:03:47 +1000448AC_SUBST([RADEON_CFLAGS])
449AC_SUBST([RADEON_LDFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700450
451dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800452dnl User supplied program configuration
453dnl
454if test -d "$srcdir/progs/demos"; then
455 default_demos=yes
456else
457 default_demos=no
458fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700459AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800460 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
461 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800462 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700463 [with_demos="$withval"],
464 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800465if test "x$with_demos" = x; then
466 with_demos=no
467fi
468
469dnl If $with_demos is yes, directories will be added as libs available
470PROGRAM_DIRS=""
471case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700472no) ;;
473yes)
474 # If the driver isn't osmesa, we have libGL and can build xdemos
475 if test "$mesa_driver" != osmesa; then
476 PROGRAM_DIRS="xdemos"
477 fi
478 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800479*)
480 # verify the requested demos directories exist
481 demos=`IFS=,; echo $with_demos`
482 for demo in $demos; do
483 test -d "$srcdir/progs/$demo" || \
484 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
485 done
486 PROGRAM_DIRS="$demos"
487 ;;
488esac
489
490dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700491dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700492dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700493dnl
494if test -n "$PKG_CONFIG"; then
495 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700496 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700497 x11_pkgconfig=yes
498 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700499 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700500 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700501 ])
502 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700503else
504 x11_pkgconfig=no
505fi
506dnl Use the autoconf macro if no pkg-config files
507if test "$x11_pkgconfig" = no; then
508 AC_PATH_XTRA
509fi
510
Dan Nicholson99803a42008-07-01 09:03:15 -0700511dnl Try to tell the user that the --x-* options are only used when
512dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
513m4_divert_once([HELP_BEGIN],
514[These options are only used when the X libraries cannot be found by the
515pkg-config utility.])
516
Dan Nicholson44d99142007-12-05 18:47:01 -0800517dnl We need X for xlib and dri, so bomb now if it's not found
518case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800519xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800520 if test "$no_x" = yes; then
521 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
522 fi
523 ;;
524esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700525
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700526dnl XCB - this is only used for GLX right now
527AC_ARG_ENABLE([xcb],
528 [AS_HELP_STRING([--enable-xcb],
529 [use XCB for GLX @<:@default=disabled@:>@])],
530 [enable_xcb="$enableval"],
531 [enable_xcb=no])
532if test "x$enable_xcb" = xyes; then
533 DEFINES="$DEFINES -DUSE_XCB"
534else
535 enable_xcb=no
536fi
537
Dan Nicholson44d99142007-12-05 18:47:01 -0800538dnl
539dnl libGL configuration per driver
540dnl
541case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800542xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800543 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700544 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800545 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800546 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
547 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800548 else
549 # should check these...
550 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
551 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800552 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
553 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800554 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700555 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
556 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800557
558 # if static, move the external libraries to the programs
559 # and empty the libraries for libGL
560 if test "$enable_static" = yes; then
561 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
562 GL_LIB_DEPS=""
563 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800564 ;;
565dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800566 # DRI must be shared, I think
567 if test "$enable_static" = yes; then
568 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
569 fi
570
Dan Nicholson44d99142007-12-05 18:47:01 -0800571 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700572 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
573 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800574 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
575 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800576
Dave Airlieb0e8ac82009-02-15 17:03:47 +1000577 PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no)
578
579 if test "$HAVE_LIBDRM_RADEON" = yes; then
580 RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS"
581 RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS
582 fi
583
Dan Nicholson44d99142007-12-05 18:47:01 -0800584 # find the DRI deps for libGL
585 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700586 # add xcb modules if necessary
587 dri_modules="x11 xext xxf86vm xdamage xfixes"
588 if test "$enable_xcb" = yes; then
589 dri_modules="$dri_modules x11-xcb xcb-glx"
590 fi
591
592 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800593 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800594 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
595 GL_LIB_DEPS="$DRIGL_LIBS"
596 else
597 # should check these...
598 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
599 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800600 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
601 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700602
603 # XCB can only be used from pkg-config
604 if test "$enable_xcb" = yes; then
605 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800606 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700607 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
608 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
609 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800610 fi
611
612 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700613 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
614 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800615 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800616osmesa)
617 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700618 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800619 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800620esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700621AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800622AC_SUBST([GL_PC_REQ_PRIV])
623AC_SUBST([GL_PC_LIB_PRIV])
624AC_SUBST([GL_PC_CFLAGS])
625AC_SUBST([DRI_PC_REQ_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700626
627dnl
628dnl More X11 setup
629dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800630if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700631 DEFINES="$DEFINES -DUSE_XSHM"
632fi
633
634dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800635dnl More DRI setup
636dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700637AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800638 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800639 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700640 [GLX_USE_TLS="$enableval"],
641 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800642dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700643AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800644 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700645 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700646 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700647 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700648AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800649dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700650AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800651 [AS_HELP_STRING([--disable-driglx-direct],
652 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700653 [driglx_direct="$enableval"],
654 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800655dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700656AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800657 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700658 [comma delimited DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +0200659 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700660 [with_dri_drivers="$withval"],
661 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800662if test "x$with_dri_drivers" = x; then
663 with_dri_drivers=no
664fi
665
666dnl If $with_dri_drivers is yes, directories will be added through
667dnl platform checks
668DRI_DIRS=""
669case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100670no) ;;
671yes)
672 DRI_DIRS="yes"
673 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800674*)
675 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700676 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800677 for driver in $dri_drivers; do
678 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
679 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
680 done
681 DRI_DIRS="$dri_drivers"
682 ;;
683esac
684
Dan Nicholson44d99142007-12-05 18:47:01 -0800685dnl Just default to no EGL for now
686USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700687AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800688
689dnl Set DRI_DIRS, DEFINES and LIB_DEPS
690if test "$mesa_driver" = dri; then
691 # Use TLS in GLX?
692 if test "x$GLX_USE_TLS" = xyes; then
693 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
694 fi
695
696 if test "x$USING_EGL" = x1; then
697 PROGRAM_DIRS="egl"
698 fi
699
700 # Platform specific settings and drivers to build
701 case "$host_os" in
702 linux*)
703 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800704 if test "x$driglx_direct" = xyes; then
705 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
706 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100707 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800708
709 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800710 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800711 # ffb, gamma, and sis are missing because they have not be
712 # converted to use the new interface. i810 are missing
713 # because there is no x86-64 system where they could *ever*
714 # be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100715 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400716 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300717 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800718 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800719 ;;
720 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800721 # Build only the drivers for cards that exist on PowerPC.
722 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100723 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400724 DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800725 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800726 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000727 sparc*)
728 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100729 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400730 DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000731 fi
732 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800733 esac
734 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700735 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800736 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
737 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
738 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
739 if test "x$driglx_direct" = xyes; then
740 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
741 fi
742 if test "x$GXX" = xyes; then
743 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
744 fi
745
Dan Nicholsona76e2452007-12-07 11:25:08 -0800746 # ffb and gamma are missing because they have not been converted
747 # to use the new interface.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100748 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400749 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300750 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800751 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800752 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700753 gnu*)
754 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
755 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
756 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700757 solaris*)
758 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
759 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
760 if test "x$driglx_direct" = xyes; then
761 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
762 fi
763 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800764 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800765
766 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100767 if test "x$DRI_DIRS" = "xyes"; then
Alex Deucher4138bdb2009-04-08 15:16:35 -0400768 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon s3v \
George Sapountzis280bf892008-05-11 14:43:40 +0300769 savage sis tdfx trident unichrome ffb swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800770 fi
771
Dan Nicholson44d99142007-12-05 18:47:01 -0800772 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
773
774 # Check for expat
775 EXPAT_INCLUDES=""
776 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700777 AC_ARG_WITH([expat],
778 [AS_HELP_STRING([--with-expat=DIR],
779 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800780 EXPAT_INCLUDES="-I$withval/include"
781 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
782 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
783 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
784 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700785 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
786 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
787 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800788
789 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700790 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800791fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700792AC_SUBST([DRI_DIRS])
793AC_SUBST([EXPAT_INCLUDES])
794AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800795
796dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700797dnl OSMesa configuration
798dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800799if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800800 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800801else
Dan Nicholson544ab202007-12-30 08:41:53 -0800802 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800803fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700804AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800805 [AS_HELP_STRING([--enable-gl-osmesa],
806 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700807 [gl_osmesa="$enableval"],
808 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800809if test "x$gl_osmesa" = xyes; then
810 if test "$mesa_driver" = osmesa; then
811 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800812 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800813 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800814 fi
815fi
816
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800817dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700818AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800819 [AS_HELP_STRING([--with-osmesa-bits=BITS],
820 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700821 [osmesa_bits="$withval"],
822 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800823if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
824 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
825 osmesa_bits=8
826fi
827case "x$osmesa_bits" in
828x8)
829 OSMESA_LIB=OSMesa
830 ;;
831x16|x32)
832 OSMESA_LIB="OSMesa$osmesa_bits"
833 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
834 ;;
835*)
836 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
837 ;;
838esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700839AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800840
Dan Nicholson979ff512007-12-05 18:47:01 -0800841case "$mesa_driver" in
842osmesa)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700843 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800844 if test "$enable_static" = no; then
Dan Nicholson4795dd52009-06-04 19:42:08 -0700845 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800846 else
847 OSMESA_LIB_DEPS=""
848 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800849 OSMESA_MESA_DEPS=""
Dan Nicholson4795dd52009-06-04 19:42:08 -0700850 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800851 ;;
852*)
853 # Link OSMesa to libGL otherwise
854 OSMESA_LIB_DEPS=""
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700855 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800856 if test "$enable_static" = no; then
857 OSMESA_MESA_DEPS='-l$(GL_LIB)'
858 else
859 OSMESA_MESA_DEPS=""
860 fi
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800861 OSMESA_PC_REQ="gl"
Dan Nicholson979ff512007-12-05 18:47:01 -0800862 ;;
863esac
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700864OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700865AC_SUBST([OSMESA_LIB_DEPS])
866AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800867AC_SUBST([OSMESA_PC_REQ])
868AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700869
870dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800871dnl EGL configuration
872dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700873AC_ARG_ENABLE([egl],
874 [AS_HELP_STRING([--disable-egl],
875 [disable EGL library @<:@default=enabled@:>@])],
876 [enable_egl="$enableval"],
877 [enable_egl=yes])
878if test "x$enable_egl" = xyes; then
879 SRC_DIRS="$SRC_DIRS egl"
880
881 if test "$x11_pkgconfig" = yes; then
882 PKG_CHECK_MODULES([EGL], [x11])
883 EGL_LIB_DEPS="$EGL_LIBS"
884 else
885 # should check these...
886 EGL_LIB_DEPS="$X_LIBS -lX11"
887 fi
888 EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
Dan Nicholson53b37342009-02-25 17:45:34 -0800889fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800890AC_SUBST([EGL_LIB_DEPS])
891
892dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700893dnl GLU configuration
894dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700895AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800896 [AS_HELP_STRING([--disable-glu],
897 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700898 [enable_glu="$enableval"],
899 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700900if test "x$enable_glu" = xyes; then
901 SRC_DIRS="$SRC_DIRS glu"
902
Dan Nicholson979ff512007-12-05 18:47:01 -0800903 case "$mesa_driver" in
904 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800905 # If GLU is available and we have libOSMesa (not 16 or 32),
906 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800907 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800908 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
909 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700910
Dan Nicholson979ff512007-12-05 18:47:01 -0800911 # Link libGLU to libOSMesa instead of libGL
912 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800913 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -0800914 if test "$enable_static" = no; then
915 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
916 else
917 GLU_MESA_DEPS=""
918 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800919 ;;
920 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800921 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -0800922 GLU_PC_REQ="gl"
923 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -0800924 if test "$enable_static" = no; then
925 GLU_LIB_DEPS="-lm"
926 GLU_MESA_DEPS='-l$(GL_LIB)'
927 else
928 GLU_LIB_DEPS=""
929 GLU_MESA_DEPS=""
930 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
931 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800932 ;;
933 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700934fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700935if test "$enable_static" = no; then
936 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
937fi
Dan Nicholson71e208b2008-11-24 11:01:57 -0800938GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700939AC_SUBST([GLU_LIB_DEPS])
940AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800941AC_SUBST([GLU_PC_REQ])
942AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800943AC_SUBST([GLU_PC_LIB_PRIV])
944AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700945
946dnl
947dnl GLw configuration
948dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700949AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800950 [AS_HELP_STRING([--disable-glw],
951 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700952 [enable_glw="$enableval"],
953 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800954dnl Don't build GLw on osmesa
955if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
956 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
957 enable_glw=no
958fi
Dan Nicholson776c60d2008-07-18 07:40:41 -0700959AC_ARG_ENABLE([motif],
960 [AS_HELP_STRING([--enable-motif],
961 [use Motif widgets in GLw @<:@default=disabled@:>@])],
962 [enable_motif="$enableval"],
963 [enable_motif=no])
964
Dan Nicholsondca1b792007-10-23 09:25:58 -0700965if test "x$enable_glw" = xyes; then
966 SRC_DIRS="$SRC_DIRS glw"
967 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700968 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800969 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700970 GLW_LIB_DEPS="$GLW_LIBS"
971 else
972 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -0700973 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800974 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
975 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -0700976 fi
977
978 GLW_SOURCES="GLwDrawA.c"
979 MOTIF_CFLAGS=
980 if test "x$enable_motif" = xyes; then
981 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
982 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
983 if test "x$MOTIF_CONFIG" != xno; then
984 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
985 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
986 else
987 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
988 [AC_MSG_ERROR([Can't locate Motif headers])])
989 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
990 [AC_MSG_ERROR([Can't locate Motif Xm library])])
991 fi
992 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
993 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800994 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
995 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700996 fi
997
Dan Nicholson88586332007-11-15 08:59:57 -0800998 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700999 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -08001000 if test "$enable_static" = no; then
1001 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001002 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -08001003 else
1004 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
1005 GLW_LIB_DEPS=""
1006 GLW_MESA_DEPS=""
1007 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001008fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001009AC_SUBST([GLW_LIB_DEPS])
1010AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001011AC_SUBST([GLW_SOURCES])
1012AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001013AC_SUBST([GLW_PC_REQ_PRIV])
1014AC_SUBST([GLW_PC_LIB_PRIV])
1015AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001016
1017dnl
1018dnl GLUT configuration
1019dnl
1020if test -f "$srcdir/include/GL/glut.h"; then
1021 default_glut=yes
1022else
1023 default_glut=no
1024fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001025AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001026 [AS_HELP_STRING([--disable-glut],
1027 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001028 [enable_glut="$enableval"],
1029 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001030
1031dnl Can't build glut if GLU not available
1032if test "x$enable_glu$enable_glut" = xnoyes; then
1033 AC_MSG_WARN([Disabling glut since GLU is disabled])
1034 enable_glut=no
1035fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001036dnl Don't build glut on osmesa
1037if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1038 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1039 enable_glut=no
1040fi
1041
Dan Nicholsondca1b792007-10-23 09:25:58 -07001042if test "x$enable_glut" = xyes; then
1043 SRC_DIRS="$SRC_DIRS glut/glx"
1044 GLUT_CFLAGS=""
1045 if test "x$GCC" = xyes; then
1046 GLUT_CFLAGS="-fexceptions"
1047 fi
1048 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001049 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001050 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001051 GLUT_LIB_DEPS="$GLUT_LIBS"
1052 else
1053 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001054 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001055 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1056 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001057 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001058 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1059 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001060
1061 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -08001062 if test "$with_demos" = yes; then
1063 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1064 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001065
Dan Nicholson88586332007-11-15 08:59:57 -08001066 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1067 if test "$enable_static" = no; then
1068 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1069 else
1070 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1071 GLUT_LIB_DEPS=""
1072 GLUT_MESA_DEPS=""
1073 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001074fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001075AC_SUBST([GLUT_LIB_DEPS])
1076AC_SUBST([GLUT_MESA_DEPS])
1077AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001078AC_SUBST([GLUT_PC_REQ_PRIV])
1079AC_SUBST([GLUT_PC_LIB_PRIV])
1080AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001081
1082dnl
1083dnl Program library dependencies
1084dnl Only libm is added here if necessary as the libraries should
1085dnl be pulled in by the linker
1086dnl
1087if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001088 case "$host_os" in
1089 solaris*)
1090 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1091 ;;
Jon TURNEY7eed6ab2009-06-08 16:02:18 +01001092 cygwin*)
1093 APP_LIB_DEPS="-lX11"
1094 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001095 *)
1096 APP_LIB_DEPS="-lm"
1097 ;;
1098 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001099fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001100AC_SUBST([APP_LIB_DEPS])
1101AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001102
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001103dnl
1104dnl Gallium configuration
1105dnl
1106AC_ARG_ENABLE([gallium],
1107 [AS_HELP_STRING([--disable-gallium],
1108 [build gallium @<:@default=enabled@:>@])],
1109 [enable_gallium="$enableval"],
1110 [enable_gallium=yes])
1111if test "x$enable_gallium" = xyes; then
1112 SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
1113fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001114
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001115dnl
1116dnl Gallium state trackers configuration
1117dnl
1118AC_ARG_WITH([state-trackers],
1119 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1120 [comma delimited state_trackers list, e.g.
1121 "egl,glx" @<:@default=auto@:>@])],
1122 [with_state_trackers="$withval"],
1123 [with_state_trackers=yes])
1124
1125case "$with_state_trackers" in
1126no)
1127 GALLIUM_STATE_TRACKERS_DIRS=""
1128 ;;
1129yes)
1130 # look at what else is built
1131 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001132 xlib)
1133 GALLIUM_STATE_TRACKERS_DIRS=glx
1134 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001135 dri)
Dan Nicholson66f97862009-04-29 12:11:43 -07001136 test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001137 ;;
1138 esac
1139 ;;
1140*)
1141 # verify the requested state tracker exist
1142 state_trackers=`IFS=', '; echo $with_state_trackers`
1143 for tracker in $state_trackers; do
1144 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1145 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
Dan Nicholson66f97862009-04-29 12:11:43 -07001146
1147 if test "$tracker" = egl && test "x$enable_egl" != xyes; then
1148 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1149 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001150 done
1151 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1152 ;;
1153esac
1154
Joel Bosveld8acca482009-03-06 08:46:08 +09001155AC_ARG_WITH([xorg-driver-dir],
1156 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1157 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1158 [XORG_DRIVER_INSTALL_DIR="$withval"],
1159 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1160AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1161
Tom Fogal7085dce2009-08-13 19:40:30 -06001162AC_ARG_WITH([max-width],
1163 [AS_HELP_STRING([--with-max-width=N],
1164 [Maximum framebuffer width (4096)])],
1165 [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1166 AS_IF([test "${withval}" -gt "4096"],
1167 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1168)
1169AC_ARG_WITH([max-height],
1170 [AS_HELP_STRING([--with-max-height=N],
1171 [Maximum framebuffer height (4096)])],
1172 [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1173 AS_IF([test "${withval}" -gt "4096"],
1174 [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1175)
1176
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001177dnl
1178dnl Gallium Intel configuration
1179dnl
1180AC_ARG_ENABLE([gallium-intel],
1181 [AS_HELP_STRING([--disable-gallium-intel],
1182 [build gallium intel @<:@default=enabled@:>@])],
1183 [enable_gallium_intel="$enableval"],
1184 [enable_gallium_intel=yes])
1185if test "x$enable_gallium_intel" = xyes; then
1186 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001187 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001188fi
1189
1190dnl
1191dnl Gallium Radeon configuration
1192dnl
1193AC_ARG_ENABLE([gallium-radeon],
1194 [AS_HELP_STRING([--enable-gallium-radeon],
1195 [build gallium radeon @<:@default=disabled@:>@])],
1196 [enable_gallium_radeon="$enableval"],
1197 [enable_gallium_radeon=no])
1198if test "x$enable_gallium_radeon" = xyes; then
1199 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001200 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001201fi
1202
1203dnl
1204dnl Gallium Radeon configuration
1205dnl
1206AC_ARG_ENABLE([gallium-nouveau],
1207 [AS_HELP_STRING([--enable-gallium-nouveau],
1208 [build gallium nouveau @<:@default=disabled@:>@])],
1209 [enable_gallium_nouveau="$enableval"],
1210 [enable_gallium_nouveau=no])
1211if test "x$enable_gallium_nouveau" = xyes; then
1212 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
Ben Skeggsbc466be2009-06-04 10:19:04 +10001213 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001214fi
1215
1216
Dan Nicholsondca1b792007-10-23 09:25:58 -07001217dnl Restore LDFLAGS and CPPFLAGS
1218LDFLAGS="$_SAVE_LDFLAGS"
1219CPPFLAGS="$_SAVE_CPPFLAGS"
1220
1221dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001222AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001223
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001224dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001225AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001226if test -f configs/current || test -L configs/current; then
1227 rm -f configs/current
1228fi
1229ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001230])
1231
1232AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001233
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001234dnl
1235dnl Output some configuration info for the user
1236dnl
1237echo ""
1238echo " prefix: $prefix"
1239echo " exec_prefix: $exec_prefix"
1240echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001241echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001242
1243dnl Driver info
1244echo ""
1245echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001246if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1247 echo " OSMesa: lib$OSMESA_LIB"
1248else
1249 echo " OSMesa: no"
1250fi
1251if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001252 # cleanup the drivers var
1253 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001254if test "x$DRI_DIRS" = x; then
1255 echo " DRI drivers: no"
1256else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001257 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001258fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001259 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001260fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001261echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001262
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001263echo ""
1264if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1265 echo " Gallium: yes"
1266 echo " Gallium dirs: $GALLIUM_DIRS"
1267 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001268 echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001269 echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001270 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001271 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1272else
1273 echo " Gallium: no"
1274fi
1275
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001276dnl Libraries
1277echo ""
1278echo " Shared libs: $enable_shared"
1279echo " Static libs: $enable_static"
Dan Nicholson66f97862009-04-29 12:11:43 -07001280echo " EGL: $enable_egl"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001281echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001282echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001283echo " glut: $enable_glut"
1284
1285dnl Programs
1286# cleanup the programs var for display
1287program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1288if test "x$program_dirs" = x; then
1289 echo " Demos: no"
1290else
1291 echo " Demos: $program_dirs"
1292fi
1293
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001294dnl Compiler options
1295# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1296cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1297 $SED 's/^ *//;s/ */ /;s/ *$//'`
1298cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1299 $SED 's/^ *//;s/ */ /;s/ *$//'`
1300defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1301echo ""
1302echo " CFLAGS: $cflags"
1303echo " CXXFLAGS: $cxxflags"
1304echo " Macros: $defines"
1305
Dan Nicholsondca1b792007-10-23 09:25:58 -07001306echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001307echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001308echo ""