blob: 772fb299737237ef2ddb67528d87b71bc611c561 [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' ;;
230 * )
231 LIB_EXTENSION='so' ;;
232 esac
Dan Nicholson88586332007-11-15 08:59:57 -0800233fi
Dan Nicholson8217f242009-02-11 15:16:00 -0800234
235GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
236GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
237GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
238GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
239OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
240
241GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
242GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
243GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
244GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
245OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
246
Dan Nicholson297e16c2008-05-05 15:42:53 -0700247AC_SUBST([GL_LIB_NAME])
248AC_SUBST([GLU_LIB_NAME])
249AC_SUBST([GLUT_LIB_NAME])
250AC_SUBST([GLW_LIB_NAME])
251AC_SUBST([OSMESA_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700252
Siddhartha Chaudhuri1a46c8a2009-02-09 07:58:38 -0700253AC_SUBST([GL_LIB_GLOB])
254AC_SUBST([GLU_LIB_GLOB])
255AC_SUBST([GLUT_LIB_GLOB])
256AC_SUBST([GLW_LIB_GLOB])
257AC_SUBST([OSMESA_LIB_GLOB])
258
Dan Nicholsondca1b792007-10-23 09:25:58 -0700259dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700260dnl Arch/platform-specific settings
261dnl
262AC_ARG_ENABLE([asm],
263 [AS_HELP_STRING([--disable-asm],
264 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
265 [enable_asm="$enableval"],
266 [enable_asm=yes]
267)
268asm_arch=""
269ASM_FLAGS=""
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800270MESA_ASM_SOURCES=""
271GLAPI_ASM_SOURCES=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700272AC_MSG_CHECKING([whether to enable assembly])
273test "x$enable_asm" = xno && AC_MSG_RESULT([no])
274# disable if cross compiling on x86/x86_64 since we must run gen_matypes
275if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
276 case "$host_cpu" in
277 i?86 | x86_64)
278 enable_asm=no
279 AC_MSG_RESULT([no, cross compiling])
280 ;;
281 esac
282fi
283# check for supported arches
284if test "x$enable_asm" = xyes; then
285 case "$host_cpu" in
286 i?86)
287 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100288 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700289 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
290 ;;
291 esac
292 ;;
293 x86_64)
294 case "$host_os" in
Julien Cristau98fcdf32008-10-28 18:56:05 +0100295 linux* | *freebsd* | dragonfly*)
Dan Nicholson871125a2008-06-04 13:00:35 -0700296 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
297 ;;
298 esac
299 ;;
300 powerpc)
301 case "$host_os" in
302 linux*)
303 asm_arch=ppc
304 ;;
305 esac
306 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800307 sparc*)
308 case "$host_os" in
309 linux*)
310 asm_arch=sparc
311 ;;
312 esac
313 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700314 esac
315
316 case "$asm_arch" in
317 x86)
Dan Nicholson61e925f2009-02-11 10:42:34 -0800318 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800319 MESA_ASM_SOURCES='$(X86_SOURCES)'
320 GLAPI_ASM_SOURCES='$(X86_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700321 AC_MSG_RESULT([yes, x86])
322 ;;
323 x86_64)
324 ASM_FLAGS="-DUSE_X86_64_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800325 MESA_ASM_SOURCES='$(X86-64_SOURCES)'
326 GLAPI_ASM_SOURCES='$(X86-64_API)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700327 AC_MSG_RESULT([yes, x86_64])
328 ;;
329 ppc)
330 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800331 MESA_ASM_SOURCES='$(PPC_SOURCES)'
Dan Nicholson871125a2008-06-04 13:00:35 -0700332 AC_MSG_RESULT([yes, ppc])
333 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800334 sparc)
335 ASM_FLAGS="-DUSE_SPARC_ASM"
336 MESA_ASM_SOURCES='$(SPARC_SOURCES)'
337 GLAPI_ASM_SOURCES='$(SPARC_API)'
338 AC_MSG_RESULT([yes, sparc])
339 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700340 *)
341 AC_MSG_RESULT([no, platform not supported])
342 ;;
343 esac
344fi
345AC_SUBST([ASM_FLAGS])
Dan Nicholsonc5bae142009-02-11 11:04:29 -0800346AC_SUBST([MESA_ASM_SOURCES])
347AC_SUBST([GLAPI_ASM_SOURCES])
Dan Nicholson871125a2008-06-04 13:00:35 -0700348
349dnl PIC code macro
350MESA_PIC_FLAGS
351
352dnl Check to see if dlopen is in default libraries (like Solaris, which
353dnl has it in libc), or if libdl is needed to get it.
354AC_CHECK_FUNC([dlopen], [],
355 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
356
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700357dnl See if posix_memalign is available
358AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
359
Dan Nicholson871125a2008-06-04 13:00:35 -0700360dnl SELinux awareness.
361AC_ARG_ENABLE([selinux],
362 [AS_HELP_STRING([--enable-selinux],
363 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
364 [MESA_SELINUX="$enableval"],
365 [MESA_SELINUX=no])
366if test "x$enable_selinux" = "xyes"; then
367 AC_CHECK_HEADER([selinux/selinux.h],[],
368 [AC_MSG_ERROR([SELinux headers not found])])
369 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
370 [AC_MSG_ERROR([SELinux library not found])])
371 SELINUX_LIBS="-lselinux"
372 DEFINES="$DEFINES -DMESA_SELINUX"
373fi
374
Dan Nicholson871125a2008-06-04 13:00:35 -0700375dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800376dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800377dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800378dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700379default_driver="xlib"
380
381case "$host_os" in
382linux*)
383 case "$host_cpu" in
David S. Miller32dc28a2009-02-24 20:06:05 -0700384 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700385 esac
386 ;;
Julien Cristau98fcdf32008-10-28 18:56:05 +0100387*freebsd* | dragonfly*)
Eric Anholt711222b2008-04-18 15:03:01 -0700388 case "$host_cpu" in
Robert Noland48f05432009-04-10 11:41:27 -0500389 i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
Eric Anholt711222b2008-04-18 15:03:01 -0700390 esac
391 ;;
392esac
393
Dan Nicholson297e16c2008-05-05 15:42:53 -0700394AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800395 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700396 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700397 [mesa_driver="$withval"],
398 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800399dnl Check for valid option
400case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800401xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800402 ;;
403*)
404 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
405 ;;
406esac
407
408dnl
409dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700410dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700411SRC_DIRS="mesa glew"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700412GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800413WINDOW_SYSTEM=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100414GALLIUM_DIRS="auxiliary drivers state_trackers"
Jerome Glisse14f79d42008-12-18 13:36:07 +0100415GALLIUM_WINSYS_DIRS=""
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100416GALLIUM_WINSYS_DRM_DIRS=""
Jakob Bornecrantzdfa4ebc2009-05-15 01:07:05 +0200417GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000418GALLIUM_DRIVERS_DIRS="softpipe failover trace"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100419GALLIUM_STATE_TRACKERS_DIRS=""
420
Dan Nicholson44d99142007-12-05 18:47:01 -0800421case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800422xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800423 DRIVER_DIRS="x11"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100424 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
Dan Nicholson44d99142007-12-05 18:47:01 -0800425 ;;
426dri)
427 SRC_DIRS="glx/x11 $SRC_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100428 DRIVER_DIRS="dri"
Dan Nicholson44d99142007-12-05 18:47:01 -0800429 WINDOW_SYSTEM="dri"
Jakob Bornecrantz373e6712009-04-18 23:13:56 +0100430 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
Dan Nicholson44d99142007-12-05 18:47:01 -0800431 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800432osmesa)
433 DRIVER_DIRS="osmesa"
434 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800435esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700436AC_SUBST([SRC_DIRS])
437AC_SUBST([GLU_DIRS])
438AC_SUBST([DRIVER_DIRS])
439AC_SUBST([WINDOW_SYSTEM])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100440AC_SUBST([GALLIUM_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100441AC_SUBST([GALLIUM_WINSYS_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100442AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +0000443AC_SUBST([GALLIUM_DRIVERS_DIRS])
Jerome Glisse14f79d42008-12-18 13:36:07 +0100444AC_SUBST([GALLIUM_AUXILIARY_DIRS])
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +0100445AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700446
447dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800448dnl User supplied program configuration
449dnl
450if test -d "$srcdir/progs/demos"; then
451 default_demos=yes
452else
453 default_demos=no
454fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700455AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800456 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
457 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800458 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700459 [with_demos="$withval"],
460 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800461if test "x$with_demos" = x; then
462 with_demos=no
463fi
464
465dnl If $with_demos is yes, directories will be added as libs available
466PROGRAM_DIRS=""
467case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700468no) ;;
469yes)
470 # If the driver isn't osmesa, we have libGL and can build xdemos
471 if test "$mesa_driver" != osmesa; then
472 PROGRAM_DIRS="xdemos"
473 fi
474 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800475*)
476 # verify the requested demos directories exist
477 demos=`IFS=,; echo $with_demos`
478 for demo in $demos; do
479 test -d "$srcdir/progs/$demo" || \
480 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
481 done
482 PROGRAM_DIRS="$demos"
483 ;;
484esac
485
486dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700487dnl Find out if X is available. The variable have_x is set if libX11 is
Dan Nicholson99803a42008-07-01 09:03:15 -0700488dnl found to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700489dnl
490if test -n "$PKG_CONFIG"; then
491 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700492 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700493 x11_pkgconfig=yes
494 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700495 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700496 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700497 ])
498 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700499else
500 x11_pkgconfig=no
501fi
502dnl Use the autoconf macro if no pkg-config files
503if test "$x11_pkgconfig" = no; then
504 AC_PATH_XTRA
505fi
506
Dan Nicholson99803a42008-07-01 09:03:15 -0700507dnl Try to tell the user that the --x-* options are only used when
508dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
509m4_divert_once([HELP_BEGIN],
510[These options are only used when the X libraries cannot be found by the
511pkg-config utility.])
512
Dan Nicholson44d99142007-12-05 18:47:01 -0800513dnl We need X for xlib and dri, so bomb now if it's not found
514case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800515xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800516 if test "$no_x" = yes; then
517 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
518 fi
519 ;;
520esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700521
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700522dnl XCB - this is only used for GLX right now
523AC_ARG_ENABLE([xcb],
524 [AS_HELP_STRING([--enable-xcb],
525 [use XCB for GLX @<:@default=disabled@:>@])],
526 [enable_xcb="$enableval"],
527 [enable_xcb=no])
528if test "x$enable_xcb" = xyes; then
529 DEFINES="$DEFINES -DUSE_XCB"
530else
531 enable_xcb=no
532fi
533
Dan Nicholson44d99142007-12-05 18:47:01 -0800534dnl
535dnl libGL configuration per driver
536dnl
537case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800538xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800539 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700540 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800541 GL_PC_REQ_PRIV="x11 xext"
Dan Nicholsona1307182007-12-12 17:49:49 -0800542 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
543 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800544 else
545 # should check these...
546 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
547 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800548 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
549 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson44d99142007-12-05 18:47:01 -0800550 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700551 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
552 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800553
554 # if static, move the external libraries to the programs
555 # and empty the libraries for libGL
556 if test "$enable_static" = yes; then
557 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
558 GL_LIB_DEPS=""
559 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800560 ;;
561dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800562 # DRI must be shared, I think
563 if test "$enable_static" = yes; then
564 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
565 fi
566
Dan Nicholson44d99142007-12-05 18:47:01 -0800567 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700568 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
569 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800570 GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
571 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Dan Nicholson44d99142007-12-05 18:47:01 -0800572
573 # find the DRI deps for libGL
574 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700575 # add xcb modules if necessary
576 dri_modules="x11 xext xxf86vm xdamage xfixes"
577 if test "$enable_xcb" = yes; then
578 dri_modules="$dri_modules x11-xcb xcb-glx"
579 fi
580
581 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800582 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Dan Nicholson44d99142007-12-05 18:47:01 -0800583 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
584 GL_LIB_DEPS="$DRIGL_LIBS"
585 else
586 # should check these...
587 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
588 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800589 GL_PC_LIB_PRIV="$GL_LIB_DEPS"
590 GL_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700591
592 # XCB can only be used from pkg-config
593 if test "$enable_xcb" = yes; then
594 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800595 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700596 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
597 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
598 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800599 fi
600
601 # need DRM libs, -lpthread, etc.
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700602 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
603 GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800604 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800605osmesa)
606 # No libGL for osmesa
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700607 GL_LIB_DEPS=""
Dan Nicholson979ff512007-12-05 18:47:01 -0800608 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800609esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700610AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800611AC_SUBST([GL_PC_REQ_PRIV])
612AC_SUBST([GL_PC_LIB_PRIV])
613AC_SUBST([GL_PC_CFLAGS])
614AC_SUBST([DRI_PC_REQ_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700615
616dnl
617dnl More X11 setup
618dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800619if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700620 DEFINES="$DEFINES -DUSE_XSHM"
621fi
622
623dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800624dnl More DRI setup
625dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700626AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800627 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800628 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700629 [GLX_USE_TLS="$enableval"],
630 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800631dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700632AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800633 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700634 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700635 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700636 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700637AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800638dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700639AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800640 [AS_HELP_STRING([--disable-driglx-direct],
641 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700642 [driglx_direct="$enableval"],
643 [driglx_direct="yes"])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800644dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700645AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800646 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholson5cae1b72008-06-30 10:28:02 -0700647 [comma delimited DRI drivers list, e.g.
648 "swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700649 [with_dri_drivers="$withval"],
650 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800651if test "x$with_dri_drivers" = x; then
652 with_dri_drivers=no
653fi
654
655dnl If $with_dri_drivers is yes, directories will be added through
656dnl platform checks
657DRI_DIRS=""
658case "$with_dri_drivers" in
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100659no) ;;
660yes)
661 DRI_DIRS="yes"
662 ;;
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800663*)
664 # verify the requested driver directories exist
Dan Nicholsone6e4f252008-07-06 14:17:39 -0700665 dri_drivers=`IFS=', '; echo $with_dri_drivers`
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800666 for driver in $dri_drivers; do
667 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
668 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
669 done
670 DRI_DIRS="$dri_drivers"
671 ;;
672esac
673
Dan Nicholson44d99142007-12-05 18:47:01 -0800674dnl Just default to no EGL for now
675USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700676AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800677
678dnl Set DRI_DIRS, DEFINES and LIB_DEPS
679if test "$mesa_driver" = dri; then
680 # Use TLS in GLX?
681 if test "x$GLX_USE_TLS" = xyes; then
682 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
683 fi
684
685 if test "x$USING_EGL" = x1; then
686 PROGRAM_DIRS="egl"
687 fi
688
689 # Platform specific settings and drivers to build
690 case "$host_os" in
691 linux*)
692 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
Dan Nicholson44d99142007-12-05 18:47:01 -0800693 if test "x$driglx_direct" = xyes; then
694 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
695 fi
Jerome Glisse14f79d42008-12-18 13:36:07 +0100696 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800697
698 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800699 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800700 # ffb, gamma, and sis are missing because they have not be
701 # converted to use the new interface. i810 are missing
702 # because there is no x86-64 system where they could *ever*
703 # be used.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100704 if test "x$DRI_DIRS" = "xyes"; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800705 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300706 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800707 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800708 ;;
709 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800710 # Build only the drivers for cards that exist on PowerPC.
711 # At some point MGA will be added, but not yet.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100712 if test "x$DRI_DIRS" = "xyes"; then
George Sapountzis280bf892008-05-11 14:43:40 +0300713 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800714 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800715 ;;
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000716 sparc*)
717 # Build only the drivers for cards that exist on sparc`
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100718 if test "x$DRI_DIRS" = "xyes"; then
Dave Airlie41bdb882008-06-12 16:26:46 +1000719 DRI_DIRS="mach64 r128 r200 r300 radeon ffb swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +1000720 fi
721 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800722 esac
723 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700724 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800725 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
726 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
727 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
728 if test "x$driglx_direct" = xyes; then
729 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
730 fi
731 if test "x$GXX" = xyes; then
732 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
733 fi
734
Dan Nicholsona76e2452007-12-07 11:25:08 -0800735 # ffb and gamma are missing because they have not been converted
736 # to use the new interface.
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100737 if test "x$DRI_DIRS" = "xyes"; then
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800738 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300739 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800740 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800741 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700742 gnu*)
743 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
744 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
745 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700746 solaris*)
747 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
748 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
749 if test "x$driglx_direct" = xyes; then
750 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
751 fi
752 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800753 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800754
755 # default drivers
Florent Thoumieb5095ab2008-07-28 14:44:43 +0100756 if test "x$DRI_DIRS" = "xyes"; then
Dan Nicholson112a40e2008-02-21 10:17:19 -0800757 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
George Sapountzis280bf892008-05-11 14:43:40 +0300758 savage sis tdfx trident unichrome ffb swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800759 fi
760
Dan Nicholson44d99142007-12-05 18:47:01 -0800761 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
762
763 # Check for expat
764 EXPAT_INCLUDES=""
765 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700766 AC_ARG_WITH([expat],
767 [AS_HELP_STRING([--with-expat=DIR],
768 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800769 EXPAT_INCLUDES="-I$withval/include"
770 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
771 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
772 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
773 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700774 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
775 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
776 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800777
778 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700779 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800780fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700781AC_SUBST([DRI_DIRS])
782AC_SUBST([EXPAT_INCLUDES])
783AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800784
785dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700786dnl OSMesa configuration
787dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800788if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800789 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800790else
Dan Nicholson544ab202007-12-30 08:41:53 -0800791 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800792fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700793AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800794 [AS_HELP_STRING([--enable-gl-osmesa],
795 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700796 [gl_osmesa="$enableval"],
797 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800798if test "x$gl_osmesa" = xyes; then
799 if test "$mesa_driver" = osmesa; then
800 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800801 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800802 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800803 fi
804fi
805
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800806dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700807AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800808 [AS_HELP_STRING([--with-osmesa-bits=BITS],
809 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700810 [osmesa_bits="$withval"],
811 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800812if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
813 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
814 osmesa_bits=8
815fi
816case "x$osmesa_bits" in
817x8)
818 OSMESA_LIB=OSMesa
819 ;;
820x16|x32)
821 OSMESA_LIB="OSMesa$osmesa_bits"
822 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
823 ;;
824*)
825 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
826 ;;
827esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700828AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800829
Dan Nicholson979ff512007-12-05 18:47:01 -0800830case "$mesa_driver" in
831osmesa)
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700832 # only link libraries with osmesa if shared
Dan Nicholson88586332007-11-15 08:59:57 -0800833 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500834 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800835 else
836 OSMESA_LIB_DEPS=""
837 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800838 OSMESA_MESA_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800839 OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -0800840 ;;
841*)
842 # Link OSMesa to libGL otherwise
843 OSMESA_LIB_DEPS=""
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
846 OSMESA_MESA_DEPS='-l$(GL_LIB)'
847 else
848 OSMESA_MESA_DEPS=""
849 fi
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800850 OSMESA_PC_REQ="gl"
Dan Nicholson979ff512007-12-05 18:47:01 -0800851 ;;
852esac
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700853if test "$enable_static" = no; then
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700854 OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700855fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700856OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700857AC_SUBST([OSMESA_LIB_DEPS])
858AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800859AC_SUBST([OSMESA_PC_REQ])
860AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700861
862dnl
Dan Nicholson53b37342009-02-25 17:45:34 -0800863dnl EGL configuration
864dnl
Dan Nicholson66f97862009-04-29 12:11:43 -0700865AC_ARG_ENABLE([egl],
866 [AS_HELP_STRING([--disable-egl],
867 [disable EGL library @<:@default=enabled@:>@])],
868 [enable_egl="$enableval"],
869 [enable_egl=yes])
870if test "x$enable_egl" = xyes; then
871 SRC_DIRS="$SRC_DIRS egl"
872
873 if test "$x11_pkgconfig" = yes; then
874 PKG_CHECK_MODULES([EGL], [x11])
875 EGL_LIB_DEPS="$EGL_LIBS"
876 else
877 # should check these...
878 EGL_LIB_DEPS="$X_LIBS -lX11"
879 fi
880 EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
Dan Nicholson53b37342009-02-25 17:45:34 -0800881fi
Dan Nicholson53b37342009-02-25 17:45:34 -0800882AC_SUBST([EGL_LIB_DEPS])
883
884dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700885dnl GLU configuration
886dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700887AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800888 [AS_HELP_STRING([--disable-glu],
889 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700890 [enable_glu="$enableval"],
891 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700892if test "x$enable_glu" = xyes; then
893 SRC_DIRS="$SRC_DIRS glu"
894
Dan Nicholson979ff512007-12-05 18:47:01 -0800895 case "$mesa_driver" in
896 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800897 # If GLU is available and we have libOSMesa (not 16 or 32),
898 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800899 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800900 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
901 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700902
Dan Nicholson979ff512007-12-05 18:47:01 -0800903 # Link libGLU to libOSMesa instead of libGL
904 GLU_LIB_DEPS=""
Dan Nicholson8be02fc2008-12-14 09:35:29 -0800905 GLU_PC_REQ="osmesa"
Dan Nicholson88586332007-11-15 08:59:57 -0800906 if test "$enable_static" = no; then
907 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
908 else
909 GLU_MESA_DEPS=""
910 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800911 ;;
912 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800913 # If static, empty GLU_LIB_DEPS and add libs for programs to link
Dan Nicholson71e208b2008-11-24 11:01:57 -0800914 GLU_PC_REQ="gl"
915 GLU_PC_LIB_PRIV="-lm"
Dan Nicholson88586332007-11-15 08:59:57 -0800916 if test "$enable_static" = no; then
917 GLU_LIB_DEPS="-lm"
918 GLU_MESA_DEPS='-l$(GL_LIB)'
919 else
920 GLU_LIB_DEPS=""
921 GLU_MESA_DEPS=""
922 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
923 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800924 ;;
925 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700926fi
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700927if test "$enable_static" = no; then
928 GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
929fi
Dan Nicholson71e208b2008-11-24 11:01:57 -0800930GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700931AC_SUBST([GLU_LIB_DEPS])
932AC_SUBST([GLU_MESA_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800933AC_SUBST([GLU_PC_REQ])
934AC_SUBST([GLU_PC_REQ_PRIV])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800935AC_SUBST([GLU_PC_LIB_PRIV])
936AC_SUBST([GLU_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700937
938dnl
939dnl GLw configuration
940dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700941AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800942 [AS_HELP_STRING([--disable-glw],
943 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700944 [enable_glw="$enableval"],
945 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800946dnl Don't build GLw on osmesa
947if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
948 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
949 enable_glw=no
950fi
Dan Nicholson776c60d2008-07-18 07:40:41 -0700951AC_ARG_ENABLE([motif],
952 [AS_HELP_STRING([--enable-motif],
953 [use Motif widgets in GLw @<:@default=disabled@:>@])],
954 [enable_motif="$enableval"],
955 [enable_motif=no])
956
Dan Nicholsondca1b792007-10-23 09:25:58 -0700957if test "x$enable_glw" = xyes; then
958 SRC_DIRS="$SRC_DIRS glw"
959 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700960 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholson71e208b2008-11-24 11:01:57 -0800961 GLW_PC_REQ_PRIV="x11 xt"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700962 GLW_LIB_DEPS="$GLW_LIBS"
963 else
964 # should check these...
Dan Nicholson776c60d2008-07-18 07:40:41 -0700965 GLW_LIB_DEPS="$X_LIBS -lXt -lX11"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800966 GLW_PC_LIB_PRIV="$GLW_LIB_DEPS"
967 GLW_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholson776c60d2008-07-18 07:40:41 -0700968 fi
969
970 GLW_SOURCES="GLwDrawA.c"
971 MOTIF_CFLAGS=
972 if test "x$enable_motif" = xyes; then
973 GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c"
974 AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no])
975 if test "x$MOTIF_CONFIG" != xno; then
976 MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags`
977 MOTIF_LIBS=`$MOTIF_CONFIG --libs`
978 else
979 AC_CHECK_HEADER([Xm/PrimitiveP.h], [],
980 [AC_MSG_ERROR([Can't locate Motif headers])])
981 AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"],
982 [AC_MSG_ERROR([Can't locate Motif Xm library])])
983 fi
984 # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11
985 GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS"
Dan Nicholson71e208b2008-11-24 11:01:57 -0800986 GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV"
987 GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700988 fi
989
Dan Nicholson88586332007-11-15 08:59:57 -0800990 # If static, empty GLW_LIB_DEPS and add libs for programs to link
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700991 GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
Dan Nicholson88586332007-11-15 08:59:57 -0800992 if test "$enable_static" = no; then
993 GLW_MESA_DEPS='-l$(GL_LIB)'
Alan Coopersmith3cf6e622009-03-23 16:51:54 -0700994 GLW_LIB_DEPS="$GLW_LIB_DEPS"
Dan Nicholson88586332007-11-15 08:59:57 -0800995 else
996 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
997 GLW_LIB_DEPS=""
998 GLW_MESA_DEPS=""
999 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001000fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001001AC_SUBST([GLW_LIB_DEPS])
1002AC_SUBST([GLW_MESA_DEPS])
Dan Nicholson776c60d2008-07-18 07:40:41 -07001003AC_SUBST([GLW_SOURCES])
1004AC_SUBST([MOTIF_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001005AC_SUBST([GLW_PC_REQ_PRIV])
1006AC_SUBST([GLW_PC_LIB_PRIV])
1007AC_SUBST([GLW_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001008
1009dnl
1010dnl GLUT configuration
1011dnl
1012if test -f "$srcdir/include/GL/glut.h"; then
1013 default_glut=yes
1014else
1015 default_glut=no
1016fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001017AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001018 [AS_HELP_STRING([--disable-glut],
1019 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001020 [enable_glut="$enableval"],
1021 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001022
1023dnl Can't build glut if GLU not available
1024if test "x$enable_glu$enable_glut" = xnoyes; then
1025 AC_MSG_WARN([Disabling glut since GLU is disabled])
1026 enable_glut=no
1027fi
Dan Nicholson979ff512007-12-05 18:47:01 -08001028dnl Don't build glut on osmesa
1029if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
1030 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
1031 enable_glut=no
1032fi
1033
Dan Nicholsondca1b792007-10-23 09:25:58 -07001034if test "x$enable_glut" = xyes; then
Dan Nicholson252671f2009-02-16 09:28:35 -08001035 SRC_DIRS="$SRC_DIRS glut/glx"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001036 GLUT_CFLAGS=""
1037 if test "x$GCC" = xyes; then
1038 GLUT_CFLAGS="-fexceptions"
1039 fi
1040 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -07001041 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001042 GLUT_PC_REQ_PRIV="x11 xmu xi"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001043 GLUT_LIB_DEPS="$GLUT_LIBS"
1044 else
1045 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -08001046 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholson71e208b2008-11-24 11:01:57 -08001047 GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
1048 GLUT_PC_CFLAGS="$X11_INCLUDES"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001049 fi
Alan Coopersmith3cf6e622009-03-23 16:51:54 -07001050 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
1051 GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001052
1053 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -08001054 if test "$with_demos" = yes; then
1055 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
1056 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001057
Dan Nicholson88586332007-11-15 08:59:57 -08001058 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
1059 if test "$enable_static" = no; then
1060 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
1061 else
1062 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
1063 GLUT_LIB_DEPS=""
1064 GLUT_MESA_DEPS=""
1065 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001066fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001067AC_SUBST([GLUT_LIB_DEPS])
1068AC_SUBST([GLUT_MESA_DEPS])
1069AC_SUBST([GLUT_CFLAGS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001070AC_SUBST([GLUT_PC_REQ_PRIV])
1071AC_SUBST([GLUT_PC_LIB_PRIV])
1072AC_SUBST([GLUT_PC_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001073
1074dnl
1075dnl Program library dependencies
1076dnl Only libm is added here if necessary as the libraries should
1077dnl be pulled in by the linker
1078dnl
1079if test "x$APP_LIB_DEPS" = x; then
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -07001080 case "$host_os" in
1081 solaris*)
1082 APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
1083 ;;
1084 *)
1085 APP_LIB_DEPS="-lm"
1086 ;;
1087 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001088fi
Dan Nicholson297e16c2008-05-05 15:42:53 -07001089AC_SUBST([APP_LIB_DEPS])
1090AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001091
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001092dnl
1093dnl Gallium configuration
1094dnl
1095AC_ARG_ENABLE([gallium],
1096 [AS_HELP_STRING([--disable-gallium],
1097 [build gallium @<:@default=enabled@:>@])],
1098 [enable_gallium="$enableval"],
1099 [enable_gallium=yes])
1100if test "x$enable_gallium" = xyes; then
1101 SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
1102fi
Dan Nicholsondca1b792007-10-23 09:25:58 -07001103
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001104dnl
1105dnl Gallium state trackers configuration
1106dnl
1107AC_ARG_WITH([state-trackers],
1108 [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@],
1109 [comma delimited state_trackers list, e.g.
1110 "egl,glx" @<:@default=auto@:>@])],
1111 [with_state_trackers="$withval"],
1112 [with_state_trackers=yes])
1113
1114case "$with_state_trackers" in
1115no)
1116 GALLIUM_STATE_TRACKERS_DIRS=""
1117 ;;
1118yes)
1119 # look at what else is built
1120 case "$mesa_driver" in
Jakob Bornecrantz373e6712009-04-18 23:13:56 +01001121 xlib)
1122 GALLIUM_STATE_TRACKERS_DIRS=glx
1123 ;;
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001124 dri)
Dan Nicholson66f97862009-04-29 12:11:43 -07001125 test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001126 ;;
1127 esac
1128 ;;
1129*)
1130 # verify the requested state tracker exist
1131 state_trackers=`IFS=', '; echo $with_state_trackers`
1132 for tracker in $state_trackers; do
1133 test -d "$srcdir/src/gallium/state_trackers/$tracker" || \
1134 AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
Dan Nicholson66f97862009-04-29 12:11:43 -07001135
1136 if test "$tracker" = egl && test "x$enable_egl" != xyes; then
1137 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1138 fi
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001139 done
1140 GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
1141 ;;
1142esac
1143
Joel Bosveld8acca482009-03-06 08:46:08 +09001144AC_ARG_WITH([xorg-driver-dir],
1145 [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1146 [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1147 [XORG_DRIVER_INSTALL_DIR="$withval"],
1148 [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1149AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1150
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001151dnl
1152dnl Gallium Intel configuration
1153dnl
1154AC_ARG_ENABLE([gallium-intel],
1155 [AS_HELP_STRING([--disable-gallium-intel],
1156 [build gallium intel @<:@default=enabled@:>@])],
1157 [enable_gallium_intel="$enableval"],
1158 [enable_gallium_intel=yes])
1159if test "x$enable_gallium_intel" = xyes; then
1160 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001161 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001162fi
1163
1164dnl
1165dnl Gallium Radeon configuration
1166dnl
1167AC_ARG_ENABLE([gallium-radeon],
1168 [AS_HELP_STRING([--enable-gallium-radeon],
1169 [build gallium radeon @<:@default=disabled@:>@])],
1170 [enable_gallium_radeon="$enableval"],
1171 [enable_gallium_radeon=no])
1172if test "x$enable_gallium_radeon" = xyes; then
1173 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001174 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001175fi
1176
1177dnl
1178dnl Gallium Radeon configuration
1179dnl
1180AC_ARG_ENABLE([gallium-nouveau],
1181 [AS_HELP_STRING([--enable-gallium-nouveau],
1182 [build gallium nouveau @<:@default=disabled@:>@])],
1183 [enable_gallium_nouveau="$enableval"],
1184 [enable_gallium_nouveau=no])
1185if test "x$enable_gallium_nouveau" = xyes; then
1186 GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001187 GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001188fi
1189
1190
Dan Nicholsondca1b792007-10-23 09:25:58 -07001191dnl Restore LDFLAGS and CPPFLAGS
1192LDFLAGS="$_SAVE_LDFLAGS"
1193CPPFLAGS="$_SAVE_CPPFLAGS"
1194
1195dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -08001196AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001197
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001198dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001199AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001200if test -f configs/current || test -L configs/current; then
1201 rm -f configs/current
1202fi
1203ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07001204])
1205
1206AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08001207
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001208dnl
1209dnl Output some configuration info for the user
1210dnl
1211echo ""
1212echo " prefix: $prefix"
1213echo " exec_prefix: $exec_prefix"
1214echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07001215echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001216
1217dnl Driver info
1218echo ""
1219echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -08001220if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
1221 echo " OSMesa: lib$OSMESA_LIB"
1222else
1223 echo " OSMesa: no"
1224fi
1225if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001226 # cleanup the drivers var
1227 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001228if test "x$DRI_DIRS" = x; then
1229 echo " DRI drivers: no"
1230else
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001231 echo " DRI drivers: $dri_dirs"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01001232fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001233 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08001234fi
RALOVICH, Kristóf5f19f5c2008-11-04 11:53:32 +01001235echo " Use XCB: $enable_xcb"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001236
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001237echo ""
1238if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
1239 echo " Gallium: yes"
1240 echo " Gallium dirs: $GALLIUM_DIRS"
1241 echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001242 echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001243 echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS"
Jakob Bornecrantzd67bd602009-02-20 11:03:18 +00001244 echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001245 echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
1246else
1247 echo " Gallium: no"
1248fi
1249
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001250dnl Libraries
1251echo ""
1252echo " Shared libs: $enable_shared"
1253echo " Static libs: $enable_static"
Dan Nicholson66f97862009-04-29 12:11:43 -07001254echo " EGL: $enable_egl"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001255echo " GLU: $enable_glu"
Dan Nicholson776c60d2008-07-18 07:40:41 -07001256echo " GLw: $enable_glw (Motif: $enable_motif)"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08001257echo " glut: $enable_glut"
1258
1259dnl Programs
1260# cleanup the programs var for display
1261program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1262if test "x$program_dirs" = x; then
1263 echo " Demos: no"
1264else
1265 echo " Demos: $program_dirs"
1266fi
1267
Dan Nicholson16a07fb2007-12-12 09:12:15 -08001268dnl Compiler options
1269# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
1270cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1271 $SED 's/^ *//;s/ */ /;s/ *$//'`
1272cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
1273 $SED 's/^ *//;s/ */ /;s/ *$//'`
1274defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
1275echo ""
1276echo " CFLAGS: $cflags"
1277echo " CXXFLAGS: $cxxflags"
1278echo " Macros: $defines"
1279
Dan Nicholsondca1b792007-10-23 09:25:58 -07001280echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07001281echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07001282echo ""