blob: 869588436616bfdccf5b727d9cb88b342ef171cb [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
Eric Anholt050c5332008-03-20 17:28:58 -070042dnl Check to see if dlopen is in default libraries (like Solaris, which
43dnl has it in libc), or if libdl is needed to get it.
44AC_CHECK_FUNC([dlopen], [],
Dan Nicholson297e16c2008-05-05 15:42:53 -070045 [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
Eric Anholt050c5332008-03-20 17:28:58 -070046
Dan Nicholson41b00702007-12-12 08:48:30 -080047dnl Make sure the pkg-config macros are defined
Dan Nicholson297e16c2008-05-05 15:42:53 -070048m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
Dan Nicholson7154d662008-04-30 13:53:37 -070049 m4_errprint([Error: Could not locate the pkg-config autoconf macros.
50 These are usually located in /usr/share/aclocal/pkg.m4. If your
51 macros are in a different location, try setting the environment
52 variable ACLOCAL="aclocal -I/other/macro/dir" before running
53 autoreconf.
54])
55 m4_exit([1])
56])
Dan Nicholsondca1b792007-10-23 09:25:58 -070057PKG_PROG_PKG_CONFIG()
58
59dnl LIB_DIR - library basename
60LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -070061AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -070062
63dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
64_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070065AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
66AC_SUBST([EXTRA_LIB_PATH])
Dan Nicholsondca1b792007-10-23 09:25:58 -070067
68dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
69_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholson297e16c2008-05-05 15:42:53 -070070AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
71AC_SUBST([X11_INCLUDES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070072
73dnl Compiler macros
74DEFINES=""
Dan Nicholson297e16c2008-05-05 15:42:53 -070075AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -070076case "$host_os" in
77linux*)
Eric Anholt5ad06152008-03-20 17:14:20 -070078if test "x$GCC" = xyes; then
79 DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
80fi
Dan Nicholsondca1b792007-10-23 09:25:58 -070081 DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
82 ;;
83esac
84
85dnl Add flags for gcc and g++
86if test "x$GCC" = xyes; then
87 CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
Dan Nicholson0c275b62008-01-15 22:52:25 -080088
89 # Work around aliasing bugs - developers should comment this out
90 CFLAGS="$CFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070091fi
92if test "x$GXX" = xyes; then
93 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -080094
95 # Work around aliasing bugs - developers should comment this out
96 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
Dan Nicholsondca1b792007-10-23 09:25:58 -070097fi
98
99dnl These should be unnecessary, but let the user set them if they want
Dan Nicholson297e16c2008-05-05 15:42:53 -0700100AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700101 Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700102AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
Dan Nicholsondca1b792007-10-23 09:25:58 -0700103 compiler. Default is to use CFLAGS.])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700104AC_SUBST([OPT_FLAGS])
105AC_SUBST([ARCH_FLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700106
107dnl
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600108dnl Hacks to enable 32 or 64 bit build
109dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700110AC_ARG_ENABLE([32-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600111 [AS_HELP_STRING([--enable-32-bit],
112 [build 32-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700113 [enable_32bit="$enableval"],
114 [enable_32bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600115)
116if test "x$enable_32bit" = xyes; then
117 if test "x$GCC" = xyes; then
118 CFLAGS="$CFLAGS -m32"
119 fi
120 if test "x$GXX" = xyes; then
121 CXXFLAGS="$CXXFLAGS -m32"
122 fi
123fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700124AC_ARG_ENABLE([64-bit],
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600125 [AS_HELP_STRING([--enable-64-bit],
126 [build 64-bit libraries @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700127 [enable_64bit="$enableval"],
128 [enable_64bit=auto]
Dan Nicholsonab57cba2007-12-26 11:12:29 -0600129)
130if test "x$enable_64bit" = xyes; then
131 if test "x$GCC" = xyes; then
132 CFLAGS="$CFLAGS -m64"
133 fi
134 if test "x$GXX" = xyes; then
135 CXXFLAGS="$CXXFLAGS -m64"
136 fi
137fi
138
139dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800140dnl shared/static libraries, mimic libtool options
141dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700142AC_ARG_ENABLE([static],
Dan Nicholson88586332007-11-15 08:59:57 -0800143 [AS_HELP_STRING([--enable-static],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800144 [build static libraries @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700145 [enable_static="$enableval"],
146 [enable_static=no]
Dan Nicholson88586332007-11-15 08:59:57 -0800147)
148case "x$enable_static" in
149xyes|xno ) ;;
150x ) enable_static=no ;;
151* )
152 AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
153 ;;
154esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700155AC_ARG_ENABLE([shared],
Dan Nicholson88586332007-11-15 08:59:57 -0800156 [AS_HELP_STRING([--disable-shared],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800157 [build shared libraries @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700158 [enable_shared="$enableval"],
159 [enable_shared=yes]
Dan Nicholson88586332007-11-15 08:59:57 -0800160)
161case "x$enable_shared" in
162xyes|xno ) ;;
163x ) enable_shared=yes ;;
164* )
165 AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
166 ;;
167esac
168
169dnl Can't have static and shared libraries, default to static if user
170dnl explicitly requested. If both disabled, set to static since shared
171dnl was explicitly requirested.
172case "x$enable_static$enable_shared" in
173xyesyes )
174 AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
175 enable_shared=no
176 ;;
177xnono )
178 AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
179 enable_static=yes
180 ;;
181esac
182
183dnl
184dnl mklib options
185dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700186AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
Dan Nicholson88586332007-11-15 08:59:57 -0800187if test "$enable_static" = yes; then
188 MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
189fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700190AC_SUBST([MKLIB_OPTIONS])
Dan Nicholson88586332007-11-15 08:59:57 -0800191
Dan Nicholson23656c42007-12-12 09:02:31 -0800192dnl
193dnl other compiler options
194dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700195AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800196 [AS_HELP_STRING([--enable-debug],
197 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700198 [enable_debug="$enableval"],
199 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800200)
201if test "x$enable_debug" = xyes; then
202 DEFINES="$DEFINES -DDEBUG"
203 if test "x$GCC" = xyes; then
204 CFLAGS="$CFLAGS -g"
205 fi
206 if test "x$GXX" = xyes; then
207 CXXFLAGS="$CXXFLAGS -g"
208 fi
209fi
Dan Nicholson88586332007-11-15 08:59:57 -0800210
211dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700212dnl library names
213dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800214if test "$enable_static" = yes; then
215 GL_LIB_NAME='lib$(GL_LIB).a'
216 GLU_LIB_NAME='lib$(GLU_LIB).a'
217 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
218 GLW_LIB_NAME='lib$(GLW_LIB).a'
219 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
220else
221 GL_LIB_NAME='lib$(GL_LIB).so'
222 GLU_LIB_NAME='lib$(GLU_LIB).so'
223 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
224 GLW_LIB_NAME='lib$(GLW_LIB).so'
225 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
226fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700227AC_SUBST([GL_LIB_NAME])
228AC_SUBST([GLU_LIB_NAME])
229AC_SUBST([GLUT_LIB_NAME])
230AC_SUBST([GLW_LIB_NAME])
231AC_SUBST([OSMESA_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700232
233dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800234dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800235dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800236dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700237default_driver="xlib"
238
239case "$host_os" in
240linux*)
241 case "$host_cpu" in
242 i*86|x86_64|powerpc*) default_driver="dri";;
243 esac
244 ;;
245freebsd* | dragonfly*)
246 case "$host_cpu" in
247 i*86|x86_64) default_driver="dri";;
248 esac
249 ;;
250esac
251
Dan Nicholson297e16c2008-05-05 15:42:53 -0700252AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800253 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700254 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700255 [mesa_driver="$withval"],
256 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800257dnl Check for valid option
258case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800259xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800260 ;;
261*)
262 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
263 ;;
264esac
265
266dnl
267dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700268dnl
269SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700270GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800271WINDOW_SYSTEM=""
272case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800273xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800274 DRIVER_DIRS="x11"
275 ;;
276dri)
277 SRC_DIRS="glx/x11 $SRC_DIRS"
278 DRIVER_DIRS="dri"
279 WINDOW_SYSTEM="dri"
280 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800281osmesa)
282 DRIVER_DIRS="osmesa"
283 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800284esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700285AC_SUBST([SRC_DIRS])
286AC_SUBST([GLU_DIRS])
287AC_SUBST([DRIVER_DIRS])
288AC_SUBST([WINDOW_SYSTEM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700289
290dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800291dnl User supplied program configuration
292dnl
293if test -d "$srcdir/progs/demos"; then
294 default_demos=yes
295else
296 default_demos=no
297fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700298AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800299 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
300 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800301 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700302 [with_demos="$withval"],
303 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800304if test "x$with_demos" = x; then
305 with_demos=no
306fi
307
308dnl If $with_demos is yes, directories will be added as libs available
309PROGRAM_DIRS=""
310case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700311no) ;;
312yes)
313 # If the driver isn't osmesa, we have libGL and can build xdemos
314 if test "$mesa_driver" != osmesa; then
315 PROGRAM_DIRS="xdemos"
316 fi
317 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800318*)
319 # verify the requested demos directories exist
320 demos=`IFS=,; echo $with_demos`
321 for demo in $demos; do
322 test -d "$srcdir/progs/$demo" || \
323 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
324 done
325 PROGRAM_DIRS="$demos"
326 ;;
327esac
328
329dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700330dnl Find out if X is available. The variable have_x is set if libX11 is
331dnl to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700332dnl
333if test -n "$PKG_CONFIG"; then
334 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700335 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700336 x11_pkgconfig=yes
337 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700338 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700339 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700340 ])
341 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700342else
343 x11_pkgconfig=no
344fi
345dnl Use the autoconf macro if no pkg-config files
346if test "$x11_pkgconfig" = no; then
347 AC_PATH_XTRA
348fi
349
Dan Nicholson44d99142007-12-05 18:47:01 -0800350dnl We need X for xlib and dri, so bomb now if it's not found
351case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800352xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800353 if test "$no_x" = yes; then
354 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
355 fi
356 ;;
357esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700358
Adam Jackson66611f22008-02-15 13:49:12 -0500359# SELinux awareness.
Dan Nicholson297e16c2008-05-05 15:42:53 -0700360AC_ARG_ENABLE([selinux],
361 [AS_HELP_STRING([--enable-selinux],
362 [Build SELinux-aware Mesa (default: disabled)])],
363 [MESA_SELINUX="$enableval"],
364 [MESA_SELINUX=no])
Adam Jackson66611f22008-02-15 13:49:12 -0500365if test "x$enable_selinux" = "xyes"; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700366 AC_CHECK_HEADER([selinux/selinux.h],[],
367 [AC_MSG_ERROR([SELinux headers not found])])
368 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
369 [AC_MSG_ERROR([SELinux library not found])])
Adam Jackson66611f22008-02-15 13:49:12 -0500370 SELINUX_LIBS="-lselinux"
371 DEFINES="$DEFINES -DMESA_SELINUX"
372fi
373
Dan Nicholson44d99142007-12-05 18:47:01 -0800374dnl
375dnl libGL configuration per driver
376dnl
377case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800378xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800379 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700380 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholsona1307182007-12-12 17:49:49 -0800381 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
382 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800383 else
384 # should check these...
385 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
386 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
387 fi
Adam Jackson66611f22008-02-15 13:49:12 -0500388 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800389
390 # if static, move the external libraries to the programs
391 # and empty the libraries for libGL
392 if test "$enable_static" = yes; then
393 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
394 GL_LIB_DEPS=""
395 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800396 ;;
397dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800398 # DRI must be shared, I think
399 if test "$enable_static" = yes; then
400 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
401 fi
402
Dan Nicholson44d99142007-12-05 18:47:01 -0800403 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700404 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
405 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Dan Nicholson44d99142007-12-05 18:47:01 -0800406
407 # find the DRI deps for libGL
408 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700409 PKG_CHECK_MODULES([DRIGL], [x11 xext xxf86vm xdamage xfixes])
Dan Nicholson44d99142007-12-05 18:47:01 -0800410 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
411 GL_LIB_DEPS="$DRIGL_LIBS"
412 else
413 # should check these...
414 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
415 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
416 fi
417
418 # need DRM libs, -lpthread, etc.
Eric Anholt050c5332008-03-20 17:28:58 -0700419 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800420 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800421osmesa)
422 # No libGL for osmesa
423 GL_LIB_DEPS=""
424 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800425esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700426AC_SUBST([GL_LIB_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700427
428dnl
429dnl More X11 setup
430dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800431if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700432 DEFINES="$DEFINES -DUSE_XSHM"
433fi
434
435dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800436dnl More DRI setup
437dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700438AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800439 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800440 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700441 [GLX_USE_TLS="$enableval"],
442 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800443dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700444AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800445 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700446 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700447 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -0700448 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700449AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800450dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700451AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800452 [AS_HELP_STRING([--disable-driglx-direct],
453 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700454 [driglx_direct="$enableval"],
455 [driglx_direct="yes"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800456
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800457dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700458AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800459 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800460 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700461 [with_dri_drivers="$withval"],
462 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800463if test "x$with_dri_drivers" = x; then
464 with_dri_drivers=no
465fi
466
467dnl If $with_dri_drivers is yes, directories will be added through
468dnl platform checks
469DRI_DIRS=""
470case "$with_dri_drivers" in
471no|yes) ;;
472*)
473 # verify the requested driver directories exist
474 dri_drivers=`IFS=,; echo $with_dri_drivers`
475 for driver in $dri_drivers; do
476 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
477 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
478 done
479 DRI_DIRS="$dri_drivers"
480 ;;
481esac
482
Dan Nicholson44d99142007-12-05 18:47:01 -0800483dnl Just default to no EGL for now
484USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700485AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800486
487dnl Set DRI_DIRS, DEFINES and LIB_DEPS
488if test "$mesa_driver" = dri; then
489 # Use TLS in GLX?
490 if test "x$GLX_USE_TLS" = xyes; then
491 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
492 fi
493
494 if test "x$USING_EGL" = x1; then
495 PROGRAM_DIRS="egl"
496 fi
497
498 # Platform specific settings and drivers to build
499 case "$host_os" in
500 linux*)
501 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
502 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
503 if test "x$driglx_direct" = xyes; then
504 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
505 fi
506
507 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800508 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800509 # ffb, gamma, and sis are missing because they have not be
510 # converted to use the new interface. i810 are missing
511 # because there is no x86-64 system where they could *ever*
512 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800513 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800514 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
515 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800516 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800517 ;;
518 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800519 # Build only the drivers for cards that exist on PowerPC.
520 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800521 if test "x$DRI_DIRS" = x; then
522 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
523 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800524 ;;
525 esac
526 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700527 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800528 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
529 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
530 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
531 if test "x$driglx_direct" = xyes; then
532 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
533 fi
534 if test "x$GXX" = xyes; then
535 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
536 fi
537
Dan Nicholsona76e2452007-12-07 11:25:08 -0800538 # ffb and gamma are missing because they have not been converted
539 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800540 if test "x$DRI_DIRS" = x; then
541 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
542 unichrome savage sis"
543 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800544 ;;
545 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800546
547 # default drivers
548 if test "x$DRI_DIRS" = x; then
549 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
550 savage sis tdfx trident unichrome ffb"
551 fi
552
Dan Nicholson44d99142007-12-05 18:47:01 -0800553 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
554
555 # Check for expat
556 EXPAT_INCLUDES=""
557 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700558 AC_ARG_WITH([expat],
559 [AS_HELP_STRING([--with-expat=DIR],
560 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800561 EXPAT_INCLUDES="-I$withval/include"
562 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
563 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
564 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
565 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700566 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
567 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
568 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800569
570 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700571 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800572fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700573AC_SUBST([DRI_DIRS])
574AC_SUBST([EXPAT_INCLUDES])
575AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800576
577dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700578dnl OSMesa configuration
579dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800580if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800581 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800582else
Dan Nicholson544ab202007-12-30 08:41:53 -0800583 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800584fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700585AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800586 [AS_HELP_STRING([--enable-gl-osmesa],
587 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700588 [gl_osmesa="$enableval"],
589 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800590if test "x$gl_osmesa" = xyes; then
591 if test "$mesa_driver" = osmesa; then
592 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800593 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800594 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800595 fi
596fi
597
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800598dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700599AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800600 [AS_HELP_STRING([--with-osmesa-bits=BITS],
601 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700602 [osmesa_bits="$withval"],
603 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800604if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
605 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
606 osmesa_bits=8
607fi
608case "x$osmesa_bits" in
609x8)
610 OSMESA_LIB=OSMesa
611 ;;
612x16|x32)
613 OSMESA_LIB="OSMesa$osmesa_bits"
614 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
615 ;;
616*)
617 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
618 ;;
619esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700620AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800621
Dan Nicholson979ff512007-12-05 18:47:01 -0800622case "$mesa_driver" in
623osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800624 # only link librararies with osmesa if shared
625 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500626 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800627 else
628 OSMESA_LIB_DEPS=""
629 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800630 OSMESA_MESA_DEPS=""
631 ;;
632*)
633 # Link OSMesa to libGL otherwise
634 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800635 # only link librararies with osmesa if shared
636 if test "$enable_static" = no; then
637 OSMESA_MESA_DEPS='-l$(GL_LIB)'
638 else
639 OSMESA_MESA_DEPS=""
640 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800641 ;;
642esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700643AC_SUBST([OSMESA_LIB_DEPS])
644AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700645
646dnl
George Sapountzis2ed0f722008-04-26 12:34:11 +0300647dnl GLcore configuration
648dnl
649# delay pkg-config checks until `make glcore' run
650XORG_CFLAGS='`pkg-config --cflags xorg-server`'
651GLCORE_LIB_DEPS='-lm -lpthread'
652if test "$mesa_driver" = dri; then
653 GLCORE_LIB_DEPS="$GLCORE_LIB_DEPS $DLOPEN_LIBS"
654fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700655AC_SUBST([XORG_CFLAGS])
656AC_SUBST([GLCORE_LIB_DEPS])
George Sapountzis2ed0f722008-04-26 12:34:11 +0300657
658dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700659dnl GLU configuration
660dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700661AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800662 [AS_HELP_STRING([--disable-glu],
663 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700664 [enable_glu="$enableval"],
665 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700666if test "x$enable_glu" = xyes; then
667 SRC_DIRS="$SRC_DIRS glu"
668
Dan Nicholson979ff512007-12-05 18:47:01 -0800669 case "$mesa_driver" in
670 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800671 # If GLU is available and we have libOSMesa (not 16 or 32),
672 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800673 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800674 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
675 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700676
Dan Nicholson979ff512007-12-05 18:47:01 -0800677 # Link libGLU to libOSMesa instead of libGL
678 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800679 if test "$enable_static" = no; then
680 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
681 else
682 GLU_MESA_DEPS=""
683 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800684 ;;
685 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800686 # If static, empty GLU_LIB_DEPS and add libs for programs to link
687 if test "$enable_static" = no; then
688 GLU_LIB_DEPS="-lm"
689 GLU_MESA_DEPS='-l$(GL_LIB)'
690 else
691 GLU_LIB_DEPS=""
692 GLU_MESA_DEPS=""
693 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
694 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800695 ;;
696 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700697fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700698AC_SUBST([GLU_LIB_DEPS])
699AC_SUBST([GLU_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700700
701dnl
702dnl GLw configuration
703dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700704AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800705 [AS_HELP_STRING([--disable-glw],
706 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700707 [enable_glw="$enableval"],
708 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800709dnl Don't build GLw on osmesa
710if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
711 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
712 enable_glw=no
713fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700714if test "x$enable_glw" = xyes; then
715 SRC_DIRS="$SRC_DIRS glw"
716 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700717 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700718 GLW_LIB_DEPS="$GLW_LIBS"
719 else
720 # should check these...
721 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
722 fi
723
Dan Nicholson88586332007-11-15 08:59:57 -0800724 # If static, empty GLW_LIB_DEPS and add libs for programs to link
725 if test "$enable_static" = no; then
726 GLW_MESA_DEPS='-l$(GL_LIB)'
727 else
728 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
729 GLW_LIB_DEPS=""
730 GLW_MESA_DEPS=""
731 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700732fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700733AC_SUBST([GLW_LIB_DEPS])
734AC_SUBST([GLW_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700735
736dnl
737dnl GLUT configuration
738dnl
739if test -f "$srcdir/include/GL/glut.h"; then
740 default_glut=yes
741else
742 default_glut=no
743fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700744AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800745 [AS_HELP_STRING([--disable-glut],
746 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700747 [enable_glut="$enableval"],
748 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700749
750dnl Can't build glut if GLU not available
751if test "x$enable_glu$enable_glut" = xnoyes; then
752 AC_MSG_WARN([Disabling glut since GLU is disabled])
753 enable_glut=no
754fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800755dnl Don't build glut on osmesa
756if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
757 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
758 enable_glut=no
759fi
760
Dan Nicholsondca1b792007-10-23 09:25:58 -0700761if test "x$enable_glut" = xyes; then
762 SRC_DIRS="$SRC_DIRS glut/glx"
763 GLUT_CFLAGS=""
764 if test "x$GCC" = xyes; then
765 GLUT_CFLAGS="-fexceptions"
766 fi
767 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700768 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700769 GLUT_LIB_DEPS="$GLUT_LIBS"
770 else
771 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800772 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700773 fi
774 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
775
776 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800777 if test "$with_demos" = yes; then
778 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
779 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700780
Dan Nicholson88586332007-11-15 08:59:57 -0800781 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
782 if test "$enable_static" = no; then
783 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
784 else
785 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
786 GLUT_LIB_DEPS=""
787 GLUT_MESA_DEPS=""
788 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700789fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700790AC_SUBST([GLUT_LIB_DEPS])
791AC_SUBST([GLUT_MESA_DEPS])
792AC_SUBST([GLUT_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700793
794dnl
795dnl Program library dependencies
796dnl Only libm is added here if necessary as the libraries should
797dnl be pulled in by the linker
798dnl
799if test "x$APP_LIB_DEPS" = x; then
800 APP_LIB_DEPS="-lm"
801fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700802AC_SUBST([APP_LIB_DEPS])
803AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700804
Dan Nicholson7d016b72008-05-05 16:53:35 -0700805dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700806dnl Arch/platform-specific settings
Dan Nicholson7d016b72008-05-05 16:53:35 -0700807dnl
808AC_ARG_ENABLE([asm],
809 [AS_HELP_STRING([--disable-asm],
810 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
811 [enable_asm="$enableval"],
812 [enable_asm=yes]
813)
814asm_arch=""
Dan Nicholsondca1b792007-10-23 09:25:58 -0700815ASM_FLAGS=""
816ASM_SOURCES=""
817ASM_API=""
Dan Nicholson7d016b72008-05-05 16:53:35 -0700818AC_MSG_CHECKING([whether to enable assembly])
819test "x$enable_asm" = xno && AC_MSG_RESULT([no])
820# disable if cross compiling on x86/x86_64 since we must run gen_matypes
821if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
822 case "$host_cpu" in
823 i?86 | x86_64)
824 enable_asm=no
825 AC_MSG_RESULT([no, cross compiling])
826 ;;
827 esac
828fi
829# check for supported arches
830if test "x$enable_asm" = xyes; then
831 case "$host_cpu" in
832 i?86)
833 case "$host_os" in
834 linux* | freebsd* | dragonfly*)
835 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
836 ;;
837 esac
838 ;;
839 x86_64)
840 case "$host_os" in
841 linux* | freebsd* | dragonfly*)
842 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
843 ;;
844 esac
845 ;;
846 powerpc)
847 case "$host_os" in
848 linux*)
849 asm_arch=ppc
850 ;;
851 esac
852 ;;
853 esac
854
855 case "$asm_arch" in
856 x86)
857 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
858 ASM_SOURCES='$(X86_SOURCES)'
859 ASM_API='$(X86_API)'
860 AC_MSG_RESULT([yes, x86])
861 ;;
862 x86_64)
863 ASM_FLAGS="-DUSE_X86_64_ASM"
864 ASM_SOURCES='$(X86-64_SOURCES)'
865 ASM_API='$(X86-64_API)'
866 AC_MSG_RESULT([yes, x86_64])
867 ;;
868 ppc)
869 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
870 ASM_SOURCES='$(PPC_SOURCES)'
871 AC_MSG_RESULT([yes, ppc])
872 ;;
873 *)
874 AC_MSG_RESULT([no, platform not supported])
875 ;;
876 esac
877fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700878AC_SUBST([ASM_FLAGS])
879AC_SUBST([ASM_SOURCES])
880AC_SUBST([ASM_API])
Dan Nicholson7d016b72008-05-05 16:53:35 -0700881
Dan Nicholsond368eed2008-05-05 18:24:21 -0700882dnl PIC code macro
883MESA_PIC_FLAGS
884
Dan Nicholsondca1b792007-10-23 09:25:58 -0700885
886dnl Restore LDFLAGS and CPPFLAGS
887LDFLAGS="$_SAVE_LDFLAGS"
888CPPFLAGS="$_SAVE_CPPFLAGS"
889
890dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800891AC_CONFIG_FILES([configs/autoconf])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700892
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800893dnl Replace the configs/current symlink
Dan Nicholsone14ebbc2008-05-06 11:28:43 -0700894AC_CONFIG_COMMANDS([configs],[
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800895if test -f configs/current || test -L configs/current; then
896 rm -f configs/current
897fi
898ln -s autoconf configs/current
Dan Nicholsone14ebbc2008-05-06 11:28:43 -0700899])
900
901AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800902
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800903dnl
904dnl Output some configuration info for the user
905dnl
906echo ""
907echo " prefix: $prefix"
908echo " exec_prefix: $exec_prefix"
909echo " libdir: $libdir"
910
911dnl Driver info
912echo ""
913echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800914if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
915 echo " OSMesa: lib$OSMESA_LIB"
916else
917 echo " OSMesa: no"
918fi
919if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800920 # cleanup the drivers var
921 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
922 echo " DRI drivers: $dri_dirs"
923 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -0800924fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800925
926dnl Libraries
927echo ""
928echo " Shared libs: $enable_shared"
929echo " Static libs: $enable_static"
930echo " GLU: $enable_glu"
931echo " GLw: $enable_glw"
932echo " glut: $enable_glut"
933
934dnl Programs
935# cleanup the programs var for display
936program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
937if test "x$program_dirs" = x; then
938 echo " Demos: no"
939else
940 echo " Demos: $program_dirs"
941fi
942
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800943dnl Compiler options
944# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
945cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
946 $SED 's/^ *//;s/ */ /;s/ *$//'`
947cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
948 $SED 's/^ *//;s/ */ /;s/ *$//'`
949defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
950echo ""
951echo " CFLAGS: $cflags"
952echo " CXXFLAGS: $cxxflags"
953echo " Macros: $defines"
954
Dan Nicholsondca1b792007-10-23 09:25:58 -0700955echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -0700956echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700957echo ""