blob: ca63c7e20af0d386f1b3581895012a2727616f65 [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 Nicholsondca1b792007-10-23 09:25:58 -070020dnl Check for progs
21AC_PROG_CPP
22AC_PROG_CC
23AC_PROG_CXX
Dan Nicholson297e16c2008-05-05 15:42:53 -070024AC_CHECK_PROGS([MAKE], [gmake make])
25AC_PATH_PROG([MKDEP], [makedepend])
26AC_PATH_PROG([SED], [sed])
Dan Nicholson41b00702007-12-12 08:48:30 -080027
Dan Nicholsondb7fc632008-03-07 11:48:09 -080028MKDEP_OPTIONS=-fdepend
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050029dnl Ask gcc where it's keeping its secret headers
30if test "x$GCC" = xyes; then
Dan Nicholsondb7fc632008-03-07 11:48:09 -080031 GCC_INCLUDES=`$CC -print-file-name=include`
32 if test "x$GCC_INCLUDES" != x; then
33 MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
34 fi
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050035fi
Dan Nicholson297e16c2008-05-05 15:42:53 -070036AC_SUBST([MKDEP_OPTIONS])
Kristian Høgsbergbcecea62008-02-25 18:50:26 -050037
Eric Anholt050c5332008-03-20 17:28:58 -070038dnl Check to see if dlopen is in default libraries (like Solaris, which
39dnl has it in libc), or if libdl is needed to get it.
40AC_CHECK_FUNC([dlopen], [],
Dan Nicholson297e16c2008-05-05 15:42:53 -070041 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
Eric Anholt050c5332008-03-20 17:28:58 -070042
Dan Nicholson41b00702007-12-12 08:48:30 -080043dnl Make sure the pkg-config macros are defined
Dan Nicholson297e16c2008-05-05 15:42:53 -070044m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
Dan Nicholson7154d662008-04-30 13:53:37 -070045 m4_errprint([Error: Could not locate the pkg-config autoconf macros.
46 These are usually located in /usr/share/aclocal/pkg.m4. If your
47 macros are in a different location, try setting the environment
48 variable ACLOCAL="aclocal -I/other/macro/dir" before running
49 autoreconf.
50])
51 m4_exit([1])
52])
Dan Nicholsondca1b792007-10-23 09:25:58 -070053PKG_PROG_PKG_CONFIG()
54
55dnl LIB_DIR - library basename
56LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -070057AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -070058
59dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
60_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070061AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
62AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -070063
64dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
65_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070066AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
67AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070068
69dnl Compiler macros
70DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -070071AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070072case "$host_os" in
73linux*)
Eric Anholt5ad06152008-03-20 17:14:20 -070074if test "x$GCC" = xyes; then
75 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
76fi
Dan Nicholsondca1b792007-10-23 09:25:58 -070077 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
78 ;;
79esac
80
81dnl Add flags for gcc and g++
82if test "x$GCC" = xyes; then
83 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
Dan Nicholson0c275b62008-01-15 22:52:25 -080084
85 # Work around aliasing bugs - developers should comment this out
86 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070087fi
88if test "x$GXX" = xyes; then
89 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -080090
91 # Work around aliasing bugs - developers should comment this out
92 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070093fi
94
95dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -070096AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -070097 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -070098AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -070099 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700100AC_SUBST([OPT_FLAGS])
101AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700102
103dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600104dnl Hacks to enable 32 or 64 bit build
105dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700106AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600107 [AS_HELP_STRING([--enable-32-bit],
108 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700109 [enable_32bit="$enableval"],
110 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600111)
112if test "x$enable_32bit" = xyes; then
113 if test "x$GCC" = xyes; then
114 CFLAGS="$CFLAGS -m32"
115 fi
116 if test "x$GXX" = xyes; then
117 CXXFLAGS="$CXXFLAGS -m32"
118 fi
119fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700120AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600121 [AS_HELP_STRING([--enable-64-bit],
122 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700123 [enable_64bit="$enableval"],
124 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600125)
126if test "x$enable_64bit" = xyes; then
127 if test "x$GCC" = xyes; then
128 CFLAGS="$CFLAGS -m64"
129 fi
130 if test "x$GXX" = xyes; then
131 CXXFLAGS="$CXXFLAGS -m64"
132 fi
133fi
134
135dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800136dnl shared/static libraries, mimic libtool options
137dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700138AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800139 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800140 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700141 [enable_static="$enableval"],
142 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800143)
144case "x$enable_static" in
145xyes|xno ) ;;
146x ) enable_static=no ;;
147* )
148 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
149 ;;
150esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700151AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800152 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800153 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700154 [enable_shared="$enableval"],
155 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800156)
157case "x$enable_shared" in
158xyes|xno ) ;;
159x ) enable_shared=yes ;;
160* )
161 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
162 ;;
163esac
164
165dnl Can't have static and shared libraries, default to static if user
166dnl explicitly requested. If both disabled, set to static since shared
167dnl was explicitly requirested.
168case "x$enable_static$enable_shared" in
169xyesyes )
170 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
171 enable_shared=no
172 ;;
173xnono )
174 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
175 enable_static=yes
176 ;;
177esac
178
179dnl
180dnl mklib options
181dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700182AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800183if test "$enable_static" = yes; then
184 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
185fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700186AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800187
Dan Nicholson23656c42007-12-12 09:02:31 -0800188dnl
189dnl other compiler options
190dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700191AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800192 [AS_HELP_STRING([--enable-debug],
193 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700194 [enable_debug="$enableval"],
195 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800196)
197if test "x$enable_debug" = xyes; then
198 DEFINES="$DEFINES -DDEBUG"
199 if test "x$GCC" = xyes; then
200 CFLAGS="$CFLAGS -g"
201 fi
202 if test "x$GXX" = xyes; then
203 CXXFLAGS="$CXXFLAGS -g"
204 fi
205fi
Dan Nicholson3e288622007-12-12 09:02:31 -0800206dnl These will be used near the end in the arch specific options
Dan Nicholson297e16c2008-05-05 15:42:53 -0700207AC_ARG_ENABLE([asm],
Dan Nicholson3e288622007-12-12 09:02:31 -0800208 [AS_HELP_STRING([--disable-asm],
209 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700210 [enable_asm="$enableval"],
211 [enable_asm=yes]
Dan Nicholson3e288622007-12-12 09:02:31 -0800212)
Dan Nicholson88586332007-11-15 08:59:57 -0800213
214dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700215dnl library names
216dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800217if test "$enable_static" = yes; then
218 GL_LIB_NAME='lib$(GL_LIB).a'
219 GLU_LIB_NAME='lib$(GLU_LIB).a'
220 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
221 GLW_LIB_NAME='lib$(GLW_LIB).a'
222 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
223else
224 GL_LIB_NAME='lib$(GL_LIB).so'
225 GLU_LIB_NAME='lib$(GLU_LIB).so'
226 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
227 GLW_LIB_NAME='lib$(GLW_LIB).so'
228 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
229fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700230AC_SUBST([GL_LIB_NAME])
231AC_SUBST([GLU_LIB_NAME])
232AC_SUBST([GLUT_LIB_NAME])
233AC_SUBST([GLW_LIB_NAME])
234AC_SUBST([OSMESA_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700235
236dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800237dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800238dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800239dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700240default_driver="xlib"
241
242case "$host_os" in
243linux*)
244 case "$host_cpu" in
245 i*86|x86_64|powerpc*) default_driver="dri";;
246 esac
247 ;;
248freebsd* | dragonfly*)
249 case "$host_cpu" in
250 i*86|x86_64) default_driver="dri";;
251 esac
252 ;;
253esac
254
Dan Nicholson297e16c2008-05-05 15:42:53 -0700255AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800256 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700257 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700258 [mesa_driver="$withval"],
259 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800260dnl Check for valid option
261case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800262xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800263 ;;
264*)
265 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
266 ;;
267esac
268
269dnl
270dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700271dnl
272SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700273GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800274WINDOW_SYSTEM=""
275case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800276xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800277 DRIVER_DIRS="x11"
278 ;;
279dri)
280 SRC_DIRS="glx/x11 $SRC_DIRS"
281 DRIVER_DIRS="dri"
282 WINDOW_SYSTEM="dri"
283 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800284osmesa)
285 DRIVER_DIRS="osmesa"
286 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800287esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700288AC_SUBST([SRC_DIRS])
289AC_SUBST([GLU_DIRS])
290AC_SUBST([DRIVER_DIRS])
291AC_SUBST([WINDOW_SYSTEM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700292
293dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800294dnl User supplied program configuration
295dnl
296if test -d "$srcdir/progs/demos"; then
297 default_demos=yes
298else
299 default_demos=no
300fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700301AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800302 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
303 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800304 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700305 [with_demos="$withval"],
306 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800307if test "x$with_demos" = x; then
308 with_demos=no
309fi
310
311dnl If $with_demos is yes, directories will be added as libs available
312PROGRAM_DIRS=""
313case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700314no) ;;
315yes)
316 # If the driver isn't osmesa, we have libGL and can build xdemos
317 if test "$mesa_driver" != osmesa; then
318 PROGRAM_DIRS="xdemos"
319 fi
320 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800321*)
322 # verify the requested demos directories exist
323 demos=`IFS=,; echo $with_demos`
324 for demo in $demos; do
325 test -d "$srcdir/progs/$demo" || \
326 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
327 done
328 PROGRAM_DIRS="$demos"
329 ;;
330esac
331
332dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700333dnl Find out if X is available. The variable have_x is set if libX11 is
334dnl to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700335dnl
336if test -n "$PKG_CONFIG"; then
337 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700338 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700339 x11_pkgconfig=yes
340 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700341 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700342 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700343 ])
344 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700345else
346 x11_pkgconfig=no
347fi
348dnl Use the autoconf macro if no pkg-config files
349if test "$x11_pkgconfig" = no; then
350 AC_PATH_XTRA
351fi
352
Dan Nicholson44d99142007-12-05 18:47:01 -0800353dnl We need X for xlib and dri, so bomb now if it's not found
354case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800355xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800356 if test "$no_x" = yes; then
357 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
358 fi
359 ;;
360esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700361
Adam Jackson66611f22008-02-15 13:49:12 -0500362# SELinux awareness.
Dan Nicholson297e16c2008-05-05 15:42:53 -0700363AC_ARG_ENABLE([selinux],
364 [AS_HELP_STRING([--enable-selinux],
365 [Build SELinux-aware Mesa (default: disabled)])],
366 [MESA_SELINUX="$enableval"],
367 [MESA_SELINUX=no])
Adam Jackson66611f22008-02-15 13:49:12 -0500368if test "x$enable_selinux" = "xyes"; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700369 AC_CHECK_HEADER([selinux/selinux.h],[],
370 [AC_MSG_ERROR([SELinux headers not found])])
371 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
372 [AC_MSG_ERROR([SELinux library not found])])
Adam Jackson66611f22008-02-15 13:49:12 -0500373 SELINUX_LIBS="-lselinux"
374 DEFINES="$DEFINES -DMESA_SELINUX"
375fi
376
Dan Nicholson44d99142007-12-05 18:47:01 -0800377dnl
378dnl libGL configuration per driver
379dnl
380case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800381xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800382 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700383 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholsona1307182007-12-12 17:49:49 -0800384 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
385 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800386 else
387 # should check these...
388 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
389 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
390 fi
Adam Jackson66611f22008-02-15 13:49:12 -0500391 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800392
393 # if static, move the external libraries to the programs
394 # and empty the libraries for libGL
395 if test "$enable_static" = yes; then
396 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
397 GL_LIB_DEPS=""
398 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800399 ;;
400dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800401 # DRI must be shared, I think
402 if test "$enable_static" = yes; then
403 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
404 fi
405
Dan Nicholson44d99142007-12-05 18:47:01 -0800406 # Check for libdrm
Dan Nicholson297e16c2008-05-05 15:42:53 -0700407 PKG_CHECK_MODULES([LIBDRM], [libdrm])
408 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1])
Dan Nicholson44d99142007-12-05 18:47:01 -0800409
410 # find the DRI deps for libGL
411 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700412 PKG_CHECK_MODULES([DRIGL], [x11 xext xxf86vm xdamage xfixes])
Dan Nicholson44d99142007-12-05 18:47:01 -0800413 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
414 GL_LIB_DEPS="$DRIGL_LIBS"
415 else
416 # should check these...
417 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
418 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
419 fi
420
421 # need DRM libs, -lpthread, etc.
Eric Anholt050c5332008-03-20 17:28:58 -0700422 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800423 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800424osmesa)
425 # No libGL for osmesa
426 GL_LIB_DEPS=""
427 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800428esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700429AC_SUBST([GL_LIB_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700430
431dnl
432dnl More X11 setup
433dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800434if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700435 DEFINES="$DEFINES -DUSE_XSHM"
436fi
437
438dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800439dnl More DRI setup
440dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700441AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800442 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800443 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700444 [GLX_USE_TLS="$enableval"],
445 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800446dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700447AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800448 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800449 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700450 [DRI_DRIVER_INSTALL_DIR="$withval"],
451 [DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri'])
452AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800453dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700454AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800455 [AS_HELP_STRING([--disable-driglx-direct],
456 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700457 [driglx_direct="$enableval"],
458 [driglx_direct="yes"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800459
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800460dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700461AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800462 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800463 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700464 [with_dri_drivers="$withval"],
465 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800466if test "x$with_dri_drivers" = x; then
467 with_dri_drivers=no
468fi
469
470dnl If $with_dri_drivers is yes, directories will be added through
471dnl platform checks
472DRI_DIRS=""
473case "$with_dri_drivers" in
474no|yes) ;;
475*)
476 # verify the requested driver directories exist
477 dri_drivers=`IFS=,; echo $with_dri_drivers`
478 for driver in $dri_drivers; do
479 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
480 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
481 done
482 DRI_DIRS="$dri_drivers"
483 ;;
484esac
485
Dan Nicholson44d99142007-12-05 18:47:01 -0800486dnl Just default to no EGL for now
487USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700488AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800489
490dnl Set DRI_DIRS, DEFINES and LIB_DEPS
491if test "$mesa_driver" = dri; then
492 # Use TLS in GLX?
493 if test "x$GLX_USE_TLS" = xyes; then
494 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
495 fi
496
497 if test "x$USING_EGL" = x1; then
498 PROGRAM_DIRS="egl"
499 fi
500
501 # Platform specific settings and drivers to build
502 case "$host_os" in
503 linux*)
504 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
505 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
506 if test "x$driglx_direct" = xyes; then
507 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
508 fi
509
510 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800511 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800512 # ffb, gamma, and sis are missing because they have not be
513 # converted to use the new interface. i810 are missing
514 # because there is no x86-64 system where they could *ever*
515 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800516 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800517 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
518 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800519 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800520 ;;
521 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800522 # Build only the drivers for cards that exist on PowerPC.
523 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800524 if test "x$DRI_DIRS" = x; then
525 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
526 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800527 ;;
528 esac
529 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700530 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800531 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
532 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
533 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
534 if test "x$driglx_direct" = xyes; then
535 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
536 fi
537 if test "x$GXX" = xyes; then
538 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
539 fi
540
Dan Nicholsona76e2452007-12-07 11:25:08 -0800541 # ffb and gamma are missing because they have not been converted
542 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800543 if test "x$DRI_DIRS" = x; then
544 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
545 unichrome savage sis"
546 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800547 ;;
548 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800549
550 # default drivers
551 if test "x$DRI_DIRS" = x; then
552 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
553 savage sis tdfx trident unichrome ffb"
554 fi
555
Dan Nicholson44d99142007-12-05 18:47:01 -0800556 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
557
558 # Check for expat
559 EXPAT_INCLUDES=""
560 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700561 AC_ARG_WITH([expat],
562 [AS_HELP_STRING([--with-expat=DIR],
563 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800564 EXPAT_INCLUDES="-I$withval/include"
565 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
566 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
567 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
568 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700569 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
570 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
571 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800572
573 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700574 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800575fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700576AC_SUBST([DRI_DIRS])
577AC_SUBST([EXPAT_INCLUDES])
578AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800579
580dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700581dnl OSMesa configuration
582dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800583if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800584 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800585else
Dan Nicholson544ab202007-12-30 08:41:53 -0800586 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800587fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700588AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800589 [AS_HELP_STRING([--enable-gl-osmesa],
590 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700591 [gl_osmesa="$enableval"],
592 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800593if test "x$gl_osmesa" = xyes; then
594 if test "$mesa_driver" = osmesa; then
595 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800596 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800597 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800598 fi
599fi
600
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800601dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700602AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800603 [AS_HELP_STRING([--with-osmesa-bits=BITS],
604 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700605 [osmesa_bits="$withval"],
606 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800607if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
608 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
609 osmesa_bits=8
610fi
611case "x$osmesa_bits" in
612x8)
613 OSMESA_LIB=OSMesa
614 ;;
615x16|x32)
616 OSMESA_LIB="OSMesa$osmesa_bits"
617 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
618 ;;
619*)
620 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
621 ;;
622esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700623AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800624
Dan Nicholson979ff512007-12-05 18:47:01 -0800625case "$mesa_driver" in
626osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800627 # only link librararies with osmesa if shared
628 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500629 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800630 else
631 OSMESA_LIB_DEPS=""
632 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800633 OSMESA_MESA_DEPS=""
634 ;;
635*)
636 # Link OSMesa to libGL otherwise
637 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800638 # only link librararies with osmesa if shared
639 if test "$enable_static" = no; then
640 OSMESA_MESA_DEPS='-l$(GL_LIB)'
641 else
642 OSMESA_MESA_DEPS=""
643 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800644 ;;
645esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700646AC_SUBST([OSMESA_LIB_DEPS])
647AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700648
649dnl
George Sapountzis2ed0f722008-04-26 12:34:11 +0300650dnl GLcore configuration
651dnl
652# delay pkg-config checks until `make glcore' run
653XORG_CFLAGS='`pkg-config --cflags xorg-server`'
654GLCORE_LIB_DEPS='-lm -lpthread'
655if test "$mesa_driver" = dri; then
656 GLCORE_LIB_DEPS="$GLCORE_LIB_DEPS $DLOPEN_LIBS"
657fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700658AC_SUBST([XORG_CFLAGS])
659AC_SUBST([GLCORE_LIB_DEPS])
George Sapountzis2ed0f722008-04-26 12:34:11 +0300660
661dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700662dnl GLU configuration
663dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700664AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800665 [AS_HELP_STRING([--disable-glu],
666 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700667 [enable_glu="$enableval"],
668 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700669if test "x$enable_glu" = xyes; then
670 SRC_DIRS="$SRC_DIRS glu"
671
Dan Nicholson979ff512007-12-05 18:47:01 -0800672 case "$mesa_driver" in
673 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800674 # If GLU is available and we have libOSMesa (not 16 or 32),
675 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800676 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800677 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
678 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700679
Dan Nicholson979ff512007-12-05 18:47:01 -0800680 # Link libGLU to libOSMesa instead of libGL
681 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800682 if test "$enable_static" = no; then
683 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
684 else
685 GLU_MESA_DEPS=""
686 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800687 ;;
688 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800689 # If static, empty GLU_LIB_DEPS and add libs for programs to link
690 if test "$enable_static" = no; then
691 GLU_LIB_DEPS="-lm"
692 GLU_MESA_DEPS='-l$(GL_LIB)'
693 else
694 GLU_LIB_DEPS=""
695 GLU_MESA_DEPS=""
696 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
697 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800698 ;;
699 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700700fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700701AC_SUBST([GLU_LIB_DEPS])
702AC_SUBST([GLU_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700703
704dnl
705dnl GLw configuration
706dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700707AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800708 [AS_HELP_STRING([--disable-glw],
709 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700710 [enable_glw="$enableval"],
711 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800712dnl Don't build GLw on osmesa
713if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
714 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
715 enable_glw=no
716fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700717if test "x$enable_glw" = xyes; then
718 SRC_DIRS="$SRC_DIRS glw"
719 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700720 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700721 GLW_LIB_DEPS="$GLW_LIBS"
722 else
723 # should check these...
724 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
725 fi
726
Dan Nicholson88586332007-11-15 08:59:57 -0800727 # If static, empty GLW_LIB_DEPS and add libs for programs to link
728 if test "$enable_static" = no; then
729 GLW_MESA_DEPS='-l$(GL_LIB)'
730 else
731 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
732 GLW_LIB_DEPS=""
733 GLW_MESA_DEPS=""
734 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700735fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700736AC_SUBST([GLW_LIB_DEPS])
737AC_SUBST([GLW_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700738
739dnl
740dnl GLUT configuration
741dnl
742if test -f "$srcdir/include/GL/glut.h"; then
743 default_glut=yes
744else
745 default_glut=no
746fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700747AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800748 [AS_HELP_STRING([--disable-glut],
749 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700750 [enable_glut="$enableval"],
751 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700752
753dnl Can't build glut if GLU not available
754if test "x$enable_glu$enable_glut" = xnoyes; then
755 AC_MSG_WARN([Disabling glut since GLU is disabled])
756 enable_glut=no
757fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800758dnl Don't build glut on osmesa
759if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
760 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
761 enable_glut=no
762fi
763
Dan Nicholsondca1b792007-10-23 09:25:58 -0700764if test "x$enable_glut" = xyes; then
765 SRC_DIRS="$SRC_DIRS glut/glx"
766 GLUT_CFLAGS=""
767 if test "x$GCC" = xyes; then
768 GLUT_CFLAGS="-fexceptions"
769 fi
770 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700771 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700772 GLUT_LIB_DEPS="$GLUT_LIBS"
773 else
774 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800775 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700776 fi
777 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
778
779 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800780 if test "$with_demos" = yes; then
781 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
782 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700783
Dan Nicholson88586332007-11-15 08:59:57 -0800784 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
785 if test "$enable_static" = no; then
786 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
787 else
788 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
789 GLUT_LIB_DEPS=""
790 GLUT_MESA_DEPS=""
791 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700792fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700793AC_SUBST([GLUT_LIB_DEPS])
794AC_SUBST([GLUT_MESA_DEPS])
795AC_SUBST([GLUT_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700796
797dnl
798dnl Program library dependencies
799dnl Only libm is added here if necessary as the libraries should
800dnl be pulled in by the linker
801dnl
802if test "x$APP_LIB_DEPS" = x; then
803 APP_LIB_DEPS="-lm"
804fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700805AC_SUBST([APP_LIB_DEPS])
806AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700807
808dnl Arch/platform-specific settings
809PIC_FLAGS=""
810ASM_FLAGS=""
811ASM_SOURCES=""
812ASM_API=""
Dan Nicholson297e16c2008-05-05 15:42:53 -0700813AC_SUBST([PIC_FLAGS])
814AC_SUBST([ASM_FLAGS])
815AC_SUBST([ASM_SOURCES])
816AC_SUBST([ASM_API])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700817case "$host_os" in
818linux*)
819 PIC_FLAGS="-fPIC"
820 case "$host_cpu" in
821 i*86)
Dan Nicholson3e288622007-12-12 09:02:31 -0800822 if test "x$enable_asm" = xyes; then
823 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
824 ASM_SOURCES='$(X86_SOURCES)'
825 ASM_API='$(X86_API)'
826 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700827 ;;
828 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800829 if test "x$enable_asm" = xyes; then
830 ASM_FLAGS="-DUSE_X86_64_ASM"
831 ASM_SOURCES='$(X86-64_SOURCES)'
832 ASM_API='$(X86-64_API)'
833 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700834 ;;
835 powerpc)
Dan Nicholson3e288622007-12-12 09:02:31 -0800836 if test "x$enable_asm" = xyes; then
837 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
838 ASM_SOURCES='$(PPC_SOURCES)'
839 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700840 ;;
841 esac
842 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700843freebsd* | dragonfly*)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700844 PIC_FLAGS="-fPIC"
Dan Nicholson758b9982008-02-21 10:32:04 -0800845 case "$host_cpu" in
Dan Nicholsondca1b792007-10-23 09:25:58 -0700846 i*86)
847 PIC_FLAGS=""
Dan Nicholson3e288622007-12-12 09:02:31 -0800848 if test "x$enable_asm" = xyes; then
849 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
850 ASM_SOURCES='$(X86_SOURCES)'
851 ASM_API='$(X86_API)'
852 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700853 ;;
854 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800855 if test "x$enable_asm" = xyes; then
856 ASM_FLAGS="-DUSE_X86_64_ASM"
857 ASM_SOURCES='$(X86-64_SOURCES)'
858 ASM_API='$(X86-64_API)'
859 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700860 ;;
861 esac
862 ;;
863esac
864
865dnl Restore LDFLAGS and CPPFLAGS
866LDFLAGS="$_SAVE_LDFLAGS"
867CPPFLAGS="$_SAVE_CPPFLAGS"
868
869dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800870AC_CONFIG_FILES([configs/autoconf])
871AC_OUTPUT
Dan Nicholsondca1b792007-10-23 09:25:58 -0700872
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800873dnl Replace the configs/current symlink
874if test -f configs/current || test -L configs/current; then
875 rm -f configs/current
876fi
877ln -s autoconf configs/current
878
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800879dnl
880dnl Output some configuration info for the user
881dnl
882echo ""
883echo " prefix: $prefix"
884echo " exec_prefix: $exec_prefix"
885echo " libdir: $libdir"
886
887dnl Driver info
888echo ""
889echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800890if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
891 echo " OSMesa: lib$OSMESA_LIB"
892else
893 echo " OSMesa: no"
894fi
895if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800896 # cleanup the drivers var
897 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
898 echo " DRI drivers: $dri_dirs"
899 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -0800900fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800901
902dnl Libraries
903echo ""
904echo " Shared libs: $enable_shared"
905echo " Static libs: $enable_static"
906echo " GLU: $enable_glu"
907echo " GLw: $enable_glw"
908echo " glut: $enable_glut"
909
910dnl Programs
911# cleanup the programs var for display
912program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
913if test "x$program_dirs" = x; then
914 echo " Demos: no"
915else
916 echo " Demos: $program_dirs"
917fi
918
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800919dnl Compiler options
920# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
921cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
922 $SED 's/^ *//;s/ */ /;s/ *$//'`
923cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
924 $SED 's/^ *//;s/ */ /;s/ *$//'`
925defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
926echo ""
927echo " CFLAGS: $cflags"
928echo " CXXFLAGS: $cxxflags"
929echo " Macros: $defines"
930
Dan Nicholsondca1b792007-10-23 09:25:58 -0700931echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -0700932echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700933echo ""