blob: f289501a9515e2e1739fe63bf7d873398adef5f7 [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'])])
8m4_ifval(mesa_version,[],[
9 m4_errprint([Error: Failed to get the Mesa version from the output of
10 running `make -f bin/version.mk version'
11])
12 m4_exit([1])
13])
Dan Nicholsondca1b792007-10-23 09:25:58 -070014
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
21LIBDRM_REQUIRED=2.3.1
22DRI2PROTO_REQUIRED=1.1
23
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 Nicholsondb7fc632008-03-07 11:48:09 -080032MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050033dnl Ask gcc where it's keeping its secret headers
34if test "x$GCC" = xyes; then
Dan Nicholsondb7fc632008-03-07 11:48:09 -080035 GCC_INCLUDES=`$CC -print-file-name=include`
36 if test "x$GCC_INCLUDES" != x; then
37 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
38 fi
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050039fi
Dan Nicholson297e16c2008-05-05 15:42:53 -070040AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050041
Dan Nicholson41b00702007-12-12 08:48:30 -080042dnl Make sure the pkg-config macros are defined
Dan Nicholson297e16c2008-05-05 15:42:53 -070043m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
Dan Nicholson7154d662008-04-30 13:53:37 -070044 m4_errprint([Error: Could not locate the pkg-config autoconf macros.
45 These are usually located in /usr/share/aclocal/pkg.m4. If your
46 macros are in a different location, try setting the environment
47 variable ACLOCAL="aclocal -I/other/macro/dir" before running
48 autoreconf.
49])
50 m4_exit([1])
51])
Dan Nicholsondca1b792007-10-23 09:25:58 -070052PKG_PROG_PKG_CONFIG()
53
54dnl LIB_DIR - library basename
55LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -070056AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -070057
58dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
59_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070060AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
61AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -070062
63dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
64_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070065AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
66AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070067
68dnl Compiler macros
69DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -070070AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070071case "$host_os" in
72linux*)
Eric Anholt5ad06152008-03-20 17:14:20 -070073if test "x$GCC" = xyes; then
74 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
75fi
Dan Nicholsondca1b792007-10-23 09:25:58 -070076 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
77 ;;
78esac
79
80dnl Add flags for gcc and g++
81if test "x$GCC" = xyes; then
82 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
Dan Nicholson0c275b62008-01-15 22:52:25 -080083
84 # Work around aliasing bugs - developers should comment this out
85 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070086fi
87if test "x$GXX" = xyes; then
88 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -080089
90 # Work around aliasing bugs - developers should comment this out
91 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070092fi
93
94dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -070095AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -070096 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -070097AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -070098 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -070099AC_SUBST([OPT_FLAGS])
100AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700101
102dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600103dnl Hacks to enable 32 or 64 bit build
104dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700105AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600106 [AS_HELP_STRING([--enable-32-bit],
107 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700108 [enable_32bit="$enableval"],
109 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600110)
111if test "x$enable_32bit" = xyes; then
112 if test "x$GCC" = xyes; then
113 CFLAGS="$CFLAGS -m32"
114 fi
115 if test "x$GXX" = xyes; then
116 CXXFLAGS="$CXXFLAGS -m32"
117 fi
118fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700119AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600120 [AS_HELP_STRING([--enable-64-bit],
121 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700122 [enable_64bit="$enableval"],
123 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600124)
125if test "x$enable_64bit" = xyes; then
126 if test "x$GCC" = xyes; then
127 CFLAGS="$CFLAGS -m64"
128 fi
129 if test "x$GXX" = xyes; then
130 CXXFLAGS="$CXXFLAGS -m64"
131 fi
132fi
133
134dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800135dnl shared/static libraries, mimic libtool options
136dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700137AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800138 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800139 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700140 [enable_static="$enableval"],
141 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800142)
143case "x$enable_static" in
144xyes|xno ) ;;
145x ) enable_static=no ;;
146* )
147 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
148 ;;
149esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700150AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800151 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800152 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700153 [enable_shared="$enableval"],
154 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800155)
156case "x$enable_shared" in
157xyes|xno ) ;;
158x ) enable_shared=yes ;;
159* )
160 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
161 ;;
162esac
163
164dnl Can't have static and shared libraries, default to static if user
165dnl explicitly requested. If both disabled, set to static since shared
166dnl was explicitly requirested.
167case "x$enable_static$enable_shared" in
168xyesyes )
169 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
170 enable_shared=no
171 ;;
172xnono )
173 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
174 enable_static=yes
175 ;;
176esac
177
178dnl
179dnl mklib options
180dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700181AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800182if test "$enable_static" = yes; then
183 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
184fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700185AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800186
Dan Nicholson23656c42007-12-12 09:02:31 -0800187dnl
188dnl other compiler options
189dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700190AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800191 [AS_HELP_STRING([--enable-debug],
192 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700193 [enable_debug="$enableval"],
194 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800195)
196if test "x$enable_debug" = xyes; then
197 DEFINES="$DEFINES -DDEBUG"
198 if test "x$GCC" = xyes; then
199 CFLAGS="$CFLAGS -g"
200 fi
201 if test "x$GXX" = xyes; then
202 CXXFLAGS="$CXXFLAGS -g"
203 fi
204fi
Dan Nicholson88586332007-11-15 08:59:57 -0800205
206dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700207dnl library names
208dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800209if test "$enable_static" = yes; then
210 GL_LIB_NAME='lib$(GL_LIB).a'
211 GLU_LIB_NAME='lib$(GLU_LIB).a'
212 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
213 GLW_LIB_NAME='lib$(GLW_LIB).a'
214 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
215else
216 GL_LIB_NAME='lib$(GL_LIB).so'
217 GLU_LIB_NAME='lib$(GLU_LIB).so'
218 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
219 GLW_LIB_NAME='lib$(GLW_LIB).so'
220 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
221fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700222AC_SUBST([GL_LIB_NAME])
223AC_SUBST([GLU_LIB_NAME])
224AC_SUBST([GLUT_LIB_NAME])
225AC_SUBST([GLW_LIB_NAME])
226AC_SUBST([OSMESA_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700227
228dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700229dnl Arch/platform-specific settings
230dnl
231AC_ARG_ENABLE([asm],
232 [AS_HELP_STRING([--disable-asm],
233 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
234 [enable_asm="$enableval"],
235 [enable_asm=yes]
236)
237asm_arch=""
238ASM_FLAGS=""
239ASM_SOURCES=""
240ASM_API=""
241AC_MSG_CHECKING([whether to enable assembly])
242test "x$enable_asm" = xno && AC_MSG_RESULT([no])
243# disable if cross compiling on x86/x86_64 since we must run gen_matypes
244if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
245 case "$host_cpu" in
246 i?86 | x86_64)
247 enable_asm=no
248 AC_MSG_RESULT([no, cross compiling])
249 ;;
250 esac
251fi
252# check for supported arches
253if test "x$enable_asm" = xyes; then
254 case "$host_cpu" in
255 i?86)
256 case "$host_os" in
257 linux* | freebsd* | dragonfly*)
258 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
259 ;;
260 esac
261 ;;
262 x86_64)
263 case "$host_os" in
264 linux* | freebsd* | dragonfly*)
265 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
266 ;;
267 esac
268 ;;
269 powerpc)
270 case "$host_os" in
271 linux*)
272 asm_arch=ppc
273 ;;
274 esac
275 ;;
276 esac
277
278 case "$asm_arch" in
279 x86)
280 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
281 ASM_SOURCES='$(X86_SOURCES)'
282 ASM_API='$(X86_API)'
283 AC_MSG_RESULT([yes, x86])
284 ;;
285 x86_64)
286 ASM_FLAGS="-DUSE_X86_64_ASM"
287 ASM_SOURCES='$(X86-64_SOURCES)'
288 ASM_API='$(X86-64_API)'
289 AC_MSG_RESULT([yes, x86_64])
290 ;;
291 ppc)
292 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
293 ASM_SOURCES='$(PPC_SOURCES)'
294 AC_MSG_RESULT([yes, ppc])
295 ;;
296 *)
297 AC_MSG_RESULT([no, platform not supported])
298 ;;
299 esac
300fi
301AC_SUBST([ASM_FLAGS])
302AC_SUBST([ASM_SOURCES])
303AC_SUBST([ASM_API])
304
305dnl PIC code macro
306MESA_PIC_FLAGS
307
308dnl Check to see if dlopen is in default libraries (like Solaris, which
309dnl has it in libc), or if libdl is needed to get it.
310AC_CHECK_FUNC([dlopen], [],
311 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
312
313dnl SELinux awareness.
314AC_ARG_ENABLE([selinux],
315 [AS_HELP_STRING([--enable-selinux],
316 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
317 [MESA_SELINUX="$enableval"],
318 [MESA_SELINUX=no])
319if test "x$enable_selinux" = "xyes"; then
320 AC_CHECK_HEADER([selinux/selinux.h],[],
321 [AC_MSG_ERROR([SELinux headers not found])])
322 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
323 [AC_MSG_ERROR([SELinux library not found])])
324 SELINUX_LIBS="-lselinux"
325 DEFINES="$DEFINES -DMESA_SELINUX"
326fi
327
328
329dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800330dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800331dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800332dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700333default_driver="xlib"
334
335case "$host_os" in
336linux*)
337 case "$host_cpu" in
338 i*86|x86_64|powerpc*) default_driver="dri";;
339 esac
340 ;;
341freebsd* | dragonfly*)
342 case "$host_cpu" in
343 i*86|x86_64) default_driver="dri";;
344 esac
345 ;;
346esac
347
Dan Nicholson297e16c2008-05-05 15:42:53 -0700348AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800349 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700350 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700351 [mesa_driver="$withval"],
352 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800353dnl Check for valid option
354case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800355xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800356 ;;
357*)
358 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
359 ;;
360esac
361
362dnl
363dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700364dnl
365SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700366GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800367WINDOW_SYSTEM=""
368case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800369xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800370 DRIVER_DIRS="x11"
371 ;;
372dri)
373 SRC_DIRS="glx/x11 $SRC_DIRS"
374 DRIVER_DIRS="dri"
375 WINDOW_SYSTEM="dri"
376 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800377osmesa)
378 DRIVER_DIRS="osmesa"
379 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800380esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700381AC_SUBST([SRC_DIRS])
382AC_SUBST([GLU_DIRS])
383AC_SUBST([DRIVER_DIRS])
384AC_SUBST([WINDOW_SYSTEM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700385
386dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800387dnl User supplied program configuration
388dnl
389if test -d "$srcdir/progs/demos"; then
390 default_demos=yes
391else
392 default_demos=no
393fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700394AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800395 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
396 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800397 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700398 [with_demos="$withval"],
399 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800400if test "x$with_demos" = x; then
401 with_demos=no
402fi
403
404dnl If $with_demos is yes, directories will be added as libs available
405PROGRAM_DIRS=""
406case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700407no) ;;
408yes)
409 # If the driver isn't osmesa, we have libGL and can build xdemos
410 if test "$mesa_driver" != osmesa; then
411 PROGRAM_DIRS="xdemos"
412 fi
413 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800414*)
415 # verify the requested demos directories exist
416 demos=`IFS=,; echo $with_demos`
417 for demo in $demos; do
418 test -d "$srcdir/progs/$demo" || \
419 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
420 done
421 PROGRAM_DIRS="$demos"
422 ;;
423esac
424
425dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700426dnl Find out if X is available. The variable have_x is set if libX11 is
427dnl to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700428dnl
429if test -n "$PKG_CONFIG"; then
430 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700431 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700432 x11_pkgconfig=yes
433 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700434 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700435 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700436 ])
437 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700438else
439 x11_pkgconfig=no
440fi
441dnl Use the autoconf macro if no pkg-config files
442if test "$x11_pkgconfig" = no; then
443 AC_PATH_XTRA
444fi
445
Dan Nicholson44d99142007-12-05 18:47:01 -0800446dnl We need X for xlib and dri, so bomb now if it's not found
447case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800448xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800449 if test "$no_x" = yes; then
450 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
451 fi
452 ;;
453esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700454
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700455dnl XCB - this is only used for GLX right now
456AC_ARG_ENABLE([xcb],
457 [AS_HELP_STRING([--enable-xcb],
458 [use XCB for GLX @<:@default=disabled@:>@])],
459 [enable_xcb="$enableval"],
460 [enable_xcb=no])
461if test "x$enable_xcb" = xyes; then
462 DEFINES="$DEFINES -DUSE_XCB"
463else
464 enable_xcb=no
465fi
466
Dan Nicholson44d99142007-12-05 18:47:01 -0800467dnl
468dnl libGL configuration per driver
469dnl
470case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800471xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800472 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700473 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholsona1307182007-12-12 17:49:49 -0800474 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
475 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800476 else
477 # should check these...
478 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
479 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
480 fi
Adam Jackson66611f22008-02-15 13:49:12 -0500481 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800482
483 # if static, move the external libraries to the programs
484 # and empty the libraries for libGL
485 if test "$enable_static" = yes; then
486 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
487 GL_LIB_DEPS=""
488 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800489 ;;
490dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800491 # DRI must be shared, I think
492 if test "$enable_static" = yes; then
493 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
494 fi
495
Dan Nicholson44d99142007-12-05 18:47:01 -0800496 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700497 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
498 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Dan Nicholson44d99142007-12-05 18:47:01 -0800499
500 # find the DRI deps for libGL
501 if test "$x11_pkgconfig" = yes; then
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700502 # add xcb modules if necessary
503 dri_modules="x11 xext xxf86vm xdamage xfixes"
504 if test "$enable_xcb" = yes; then
505 dri_modules="$dri_modules x11-xcb xcb-glx"
506 fi
507
508 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
Dan Nicholson44d99142007-12-05 18:47:01 -0800509 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
510 GL_LIB_DEPS="$DRIGL_LIBS"
511 else
512 # should check these...
513 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
514 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
Dan Nicholson2d709fe2008-05-06 10:51:49 -0700515
516 # XCB can only be used from pkg-config
517 if test "$enable_xcb" = yes; then
518 PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
519 X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
520 GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
521 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800522 fi
523
524 # need DRM libs, -lpthread, etc.
Eric Anholt050c5332008-03-20 17:28:58 -0700525 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800526 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800527osmesa)
528 # No libGL for osmesa
529 GL_LIB_DEPS=""
530 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800531esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700532AC_SUBST([GL_LIB_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700533
534dnl
535dnl More X11 setup
536dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800537if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700538 DEFINES="$DEFINES -DUSE_XSHM"
539fi
540
541dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800542dnl More DRI setup
543dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700544AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800545 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800546 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700547 [GLX_USE_TLS="$enableval"],
548 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800549dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700550AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800551 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700552 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700553 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700554 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700555AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800556dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700557AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800558 [AS_HELP_STRING([--disable-driglx-direct],
559 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700560 [driglx_direct="$enableval"],
561 [driglx_direct="yes"])
Dave Airlie0b734bd2008-05-28 15:55:44 +1000562dnl ttm support
563AC_ARG_ENABLE([ttm-api],
564 [AS_HELP_STRING([--enable-ttm-api],
Dan Nicholson871125a2008-06-04 13:00:35 -0700565 [enable TTM API users @<:@default=disabled@:>@])],
Dave Airlie0b734bd2008-05-28 15:55:44 +1000566 [ttmapi="$enableval"],
567 [ttmapi="no"])
568
569if test "x$ttmapi" = "xyes"; then
570 save_CFLAGS=$CFLAGS
571 CFLAGS=$LIBDRM_CFLAGS
572 AC_CHECK_HEADERS([xf86mm.h],[],[AC_MSG_ERROR([xf86mm.h required for TTM.])],[#include "stdint.h"\n#include "drm.h"])
573 CFLAGS=$save_CFLAGS
574fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800575
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800576dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700577AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800578 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800579 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700580 [with_dri_drivers="$withval"],
581 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800582if test "x$with_dri_drivers" = x; then
583 with_dri_drivers=no
584fi
585
586dnl If $with_dri_drivers is yes, directories will be added through
587dnl platform checks
588DRI_DIRS=""
589case "$with_dri_drivers" in
590no|yes) ;;
591*)
592 # verify the requested driver directories exist
593 dri_drivers=`IFS=,; echo $with_dri_drivers`
594 for driver in $dri_drivers; do
595 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
596 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
597 done
598 DRI_DIRS="$dri_drivers"
599 ;;
600esac
601
Dan Nicholson44d99142007-12-05 18:47:01 -0800602dnl Just default to no EGL for now
603USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700604AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800605
606dnl Set DRI_DIRS, DEFINES and LIB_DEPS
607if test "$mesa_driver" = dri; then
608 # Use TLS in GLX?
609 if test "x$GLX_USE_TLS" = xyes; then
610 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
611 fi
612
Dave Airlie0b734bd2008-05-28 15:55:44 +1000613 if test "x$ttmapi" = xyes; then
614 DEFINES="$DEFINES -DTTM_API"
615 fi
616
Dan Nicholson44d99142007-12-05 18:47:01 -0800617 if test "x$USING_EGL" = x1; then
618 PROGRAM_DIRS="egl"
619 fi
620
621 # Platform specific settings and drivers to build
622 case "$host_os" in
623 linux*)
624 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
625 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
626 if test "x$driglx_direct" = xyes; then
627 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
628 fi
629
630 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800631 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800632 # ffb, gamma, and sis are missing because they have not be
633 # converted to use the new interface. i810 are missing
634 # because there is no x86-64 system where they could *ever*
635 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800636 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800637 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
George Sapountzis280bf892008-05-11 14:43:40 +0300638 savage tdfx unichrome swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800639 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800640 ;;
641 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800642 # Build only the drivers for cards that exist on PowerPC.
643 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800644 if test "x$DRI_DIRS" = x; then
George Sapountzis280bf892008-05-11 14:43:40 +0300645 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800646 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800647 ;;
648 esac
649 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700650 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800651 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
652 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
653 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
654 if test "x$driglx_direct" = xyes; then
655 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
656 fi
657 if test "x$GXX" = xyes; then
658 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
659 fi
660
Dan Nicholsona76e2452007-12-07 11:25:08 -0800661 # ffb and gamma are missing because they have not been converted
662 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800663 if test "x$DRI_DIRS" = x; then
664 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
George Sapountzis280bf892008-05-11 14:43:40 +0300665 unichrome savage sis swrast"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800666 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800667 ;;
668 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800669
670 # default drivers
671 if test "x$DRI_DIRS" = x; then
672 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
George Sapountzis280bf892008-05-11 14:43:40 +0300673 savage sis tdfx trident unichrome ffb swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -0800674 fi
675
Dan Nicholson44d99142007-12-05 18:47:01 -0800676 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
677
678 # Check for expat
679 EXPAT_INCLUDES=""
680 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700681 AC_ARG_WITH([expat],
682 [AS_HELP_STRING([--with-expat=DIR],
683 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800684 EXPAT_INCLUDES="-I$withval/include"
685 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
686 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
687 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
688 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700689 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
690 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
691 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800692
693 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700694 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800695fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700696AC_SUBST([DRI_DIRS])
697AC_SUBST([EXPAT_INCLUDES])
698AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800699
700dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700701dnl OSMesa configuration
702dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800703if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800704 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800705else
Dan Nicholson544ab202007-12-30 08:41:53 -0800706 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800707fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700708AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800709 [AS_HELP_STRING([--enable-gl-osmesa],
710 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700711 [gl_osmesa="$enableval"],
712 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800713if test "x$gl_osmesa" = xyes; then
714 if test "$mesa_driver" = osmesa; then
715 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800716 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800717 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800718 fi
719fi
720
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800721dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700722AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800723 [AS_HELP_STRING([--with-osmesa-bits=BITS],
724 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700725 [osmesa_bits="$withval"],
726 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800727if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
728 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
729 osmesa_bits=8
730fi
731case "x$osmesa_bits" in
732x8)
733 OSMESA_LIB=OSMesa
734 ;;
735x16|x32)
736 OSMESA_LIB="OSMesa$osmesa_bits"
737 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
738 ;;
739*)
740 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
741 ;;
742esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700743AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800744
Dan Nicholson979ff512007-12-05 18:47:01 -0800745case "$mesa_driver" in
746osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800747 # only link librararies with osmesa if shared
748 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500749 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800750 else
751 OSMESA_LIB_DEPS=""
752 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800753 OSMESA_MESA_DEPS=""
754 ;;
755*)
756 # Link OSMesa to libGL otherwise
757 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800758 # only link librararies with osmesa if shared
759 if test "$enable_static" = no; then
760 OSMESA_MESA_DEPS='-l$(GL_LIB)'
761 else
762 OSMESA_MESA_DEPS=""
763 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800764 ;;
765esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700766AC_SUBST([OSMESA_LIB_DEPS])
767AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700768
769dnl
770dnl GLU configuration
771dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700772AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800773 [AS_HELP_STRING([--disable-glu],
774 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700775 [enable_glu="$enableval"],
776 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700777if test "x$enable_glu" = xyes; then
778 SRC_DIRS="$SRC_DIRS glu"
779
Dan Nicholson979ff512007-12-05 18:47:01 -0800780 case "$mesa_driver" in
781 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800782 # If GLU is available and we have libOSMesa (not 16 or 32),
783 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800784 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800785 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
786 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700787
Dan Nicholson979ff512007-12-05 18:47:01 -0800788 # Link libGLU to libOSMesa instead of libGL
789 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800790 if test "$enable_static" = no; then
791 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
792 else
793 GLU_MESA_DEPS=""
794 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800795 ;;
796 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800797 # If static, empty GLU_LIB_DEPS and add libs for programs to link
798 if test "$enable_static" = no; then
799 GLU_LIB_DEPS="-lm"
800 GLU_MESA_DEPS='-l$(GL_LIB)'
801 else
802 GLU_LIB_DEPS=""
803 GLU_MESA_DEPS=""
804 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
805 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800806 ;;
807 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700808fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700809AC_SUBST([GLU_LIB_DEPS])
810AC_SUBST([GLU_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700811
812dnl
813dnl GLw configuration
814dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700815AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800816 [AS_HELP_STRING([--disable-glw],
817 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700818 [enable_glw="$enableval"],
819 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800820dnl Don't build GLw on osmesa
821if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
822 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
823 enable_glw=no
824fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700825if test "x$enable_glw" = xyes; then
826 SRC_DIRS="$SRC_DIRS glw"
827 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700828 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700829 GLW_LIB_DEPS="$GLW_LIBS"
830 else
831 # should check these...
832 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
833 fi
834
Dan Nicholson88586332007-11-15 08:59:57 -0800835 # If static, empty GLW_LIB_DEPS and add libs for programs to link
836 if test "$enable_static" = no; then
837 GLW_MESA_DEPS='-l$(GL_LIB)'
838 else
839 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
840 GLW_LIB_DEPS=""
841 GLW_MESA_DEPS=""
842 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700843fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700844AC_SUBST([GLW_LIB_DEPS])
845AC_SUBST([GLW_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700846
847dnl
848dnl GLUT configuration
849dnl
850if test -f "$srcdir/include/GL/glut.h"; then
851 default_glut=yes
852else
853 default_glut=no
854fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700855AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800856 [AS_HELP_STRING([--disable-glut],
857 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700858 [enable_glut="$enableval"],
859 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700860
861dnl Can't build glut if GLU not available
862if test "x$enable_glu$enable_glut" = xnoyes; then
863 AC_MSG_WARN([Disabling glut since GLU is disabled])
864 enable_glut=no
865fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800866dnl Don't build glut on osmesa
867if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
868 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
869 enable_glut=no
870fi
871
Dan Nicholsondca1b792007-10-23 09:25:58 -0700872if test "x$enable_glut" = xyes; then
873 SRC_DIRS="$SRC_DIRS glut/glx"
874 GLUT_CFLAGS=""
875 if test "x$GCC" = xyes; then
876 GLUT_CFLAGS="-fexceptions"
877 fi
878 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700879 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700880 GLUT_LIB_DEPS="$GLUT_LIBS"
881 else
882 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800883 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700884 fi
885 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
886
887 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800888 if test "$with_demos" = yes; then
889 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
890 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700891
Dan Nicholson88586332007-11-15 08:59:57 -0800892 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
893 if test "$enable_static" = no; then
894 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
895 else
896 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
897 GLUT_LIB_DEPS=""
898 GLUT_MESA_DEPS=""
899 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700900fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700901AC_SUBST([GLUT_LIB_DEPS])
902AC_SUBST([GLUT_MESA_DEPS])
903AC_SUBST([GLUT_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700904
905dnl
906dnl Program library dependencies
907dnl Only libm is added here if necessary as the libraries should
908dnl be pulled in by the linker
909dnl
910if test "x$APP_LIB_DEPS" = x; then
911 APP_LIB_DEPS="-lm"
912fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700913AC_SUBST([APP_LIB_DEPS])
914AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700915
Dan Nicholsondca1b792007-10-23 09:25:58 -0700916
917dnl Restore LDFLAGS and CPPFLAGS
918LDFLAGS="$_SAVE_LDFLAGS"
919CPPFLAGS="$_SAVE_CPPFLAGS"
920
921dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800922AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700923
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800924dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -0700925AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800926if test -f configs/current || test -L configs/current; then
927 rm -f configs/current
928fi
929ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -0700930])
931
932AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800933
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800934dnl
935dnl Output some configuration info for the user
936dnl
937echo ""
938echo " prefix: $prefix"
939echo " exec_prefix: $exec_prefix"
940echo " libdir: $libdir"
941
942dnl Driver info
943echo ""
944echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800945if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
946 echo " OSMesa: lib$OSMESA_LIB"
947else
948 echo " OSMesa: no"
949fi
950if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800951 # cleanup the drivers var
952 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
953 echo " DRI drivers: $dri_dirs"
954 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dave Airlie0b734bd2008-05-28 15:55:44 +1000955 echo " TTM API support: $ttmapi"
Dan Nicholson544ab202007-12-30 08:41:53 -0800956fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800957
958dnl Libraries
959echo ""
960echo " Shared libs: $enable_shared"
961echo " Static libs: $enable_static"
962echo " GLU: $enable_glu"
963echo " GLw: $enable_glw"
964echo " glut: $enable_glut"
965
966dnl Programs
967# cleanup the programs var for display
968program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
969if test "x$program_dirs" = x; then
970 echo " Demos: no"
971else
972 echo " Demos: $program_dirs"
973fi
974
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800975dnl Compiler options
976# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
977cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
978 $SED 's/^ *//;s/ */ /;s/ *$//'`
979cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
980 $SED 's/^ *//;s/ */ /;s/ *$//'`
981defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
982echo ""
983echo " CFLAGS: $cflags"
984echo " CXXFLAGS: $cxxflags"
985echo " Macros: $defines"
986
Dan Nicholsondca1b792007-10-23 09:25:58 -0700987echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -0700988echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700989echo ""