blob: bc2ebf6583f8c9a60be455981588bb1d50689583 [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 Nicholson3e288622007-12-12 09:02:31 -0800210dnl These will be used near the end in the arch specific options
Dan Nicholson297e16c2008-05-05 15:42:53 -0700211AC_ARG_ENABLE([asm],
Dan Nicholson3e288622007-12-12 09:02:31 -0800212 [AS_HELP_STRING([--disable-asm],
213 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700214 [enable_asm="$enableval"],
215 [enable_asm=yes]
Dan Nicholson3e288622007-12-12 09:02:31 -0800216)
Dan Nicholson88586332007-11-15 08:59:57 -0800217
218dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700219dnl library names
220dnl
Dan Nicholson88586332007-11-15 08:59:57 -0800221if test "$enable_static" = yes; then
222 GL_LIB_NAME='lib$(GL_LIB).a'
223 GLU_LIB_NAME='lib$(GLU_LIB).a'
224 GLUT_LIB_NAME='lib$(GLUT_LIB).a'
225 GLW_LIB_NAME='lib$(GLW_LIB).a'
226 OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
227else
228 GL_LIB_NAME='lib$(GL_LIB).so'
229 GLU_LIB_NAME='lib$(GLU_LIB).so'
230 GLUT_LIB_NAME='lib$(GLUT_LIB).so'
231 GLW_LIB_NAME='lib$(GLW_LIB).so'
232 OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
233fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700234AC_SUBST([GL_LIB_NAME])
235AC_SUBST([GLU_LIB_NAME])
236AC_SUBST([GLUT_LIB_NAME])
237AC_SUBST([GLW_LIB_NAME])
238AC_SUBST([OSMESA_LIB_NAME])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700239
240dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800241dnl Driver configuration. Options are xlib, dri and osmesa right now.
Dan Nicholson979ff512007-12-05 18:47:01 -0800242dnl More later: directfb, fbdev, ...
Dan Nicholson44d99142007-12-05 18:47:01 -0800243dnl
Eric Anholt711222b2008-04-18 15:03:01 -0700244default_driver="xlib"
245
246case "$host_os" in
247linux*)
248 case "$host_cpu" in
249 i*86|x86_64|powerpc*) default_driver="dri";;
250 esac
251 ;;
252freebsd* | dragonfly*)
253 case "$host_cpu" in
254 i*86|x86_64) default_driver="dri";;
255 esac
256 ;;
257esac
258
Dan Nicholson297e16c2008-05-05 15:42:53 -0700259AC_ARG_WITH([driver],
Dan Nicholson44d99142007-12-05 18:47:01 -0800260 [AS_HELP_STRING([--with-driver=DRIVER],
Eric Anholt711222b2008-04-18 15:03:01 -0700261 [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700262 [mesa_driver="$withval"],
263 [mesa_driver="$default_driver"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800264dnl Check for valid option
265case "x$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800266xxlib|xdri|xosmesa)
Dan Nicholson44d99142007-12-05 18:47:01 -0800267 ;;
268*)
269 AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
270 ;;
271esac
272
273dnl
274dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -0700275dnl
276SRC_DIRS="mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700277GLU_DIRS="sgi"
Dan Nicholson44d99142007-12-05 18:47:01 -0800278WINDOW_SYSTEM=""
279case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800280xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800281 DRIVER_DIRS="x11"
282 ;;
283dri)
284 SRC_DIRS="glx/x11 $SRC_DIRS"
285 DRIVER_DIRS="dri"
286 WINDOW_SYSTEM="dri"
287 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800288osmesa)
289 DRIVER_DIRS="osmesa"
290 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800291esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700292AC_SUBST([SRC_DIRS])
293AC_SUBST([GLU_DIRS])
294AC_SUBST([DRIVER_DIRS])
295AC_SUBST([WINDOW_SYSTEM])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700296
297dnl
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800298dnl User supplied program configuration
299dnl
300if test -d "$srcdir/progs/demos"; then
301 default_demos=yes
302else
303 default_demos=no
304fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700305AC_ARG_WITH([demos],
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800306 [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
307 [optional comma delimited demo directories to build
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800308 @<:@default=auto if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700309 [with_demos="$withval"],
310 [with_demos="$default_demos"])
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800311if test "x$with_demos" = x; then
312 with_demos=no
313fi
314
315dnl If $with_demos is yes, directories will be added as libs available
316PROGRAM_DIRS=""
317case "$with_demos" in
Dan Nicholsonb9576552008-03-10 14:05:46 -0700318no) ;;
319yes)
320 # If the driver isn't osmesa, we have libGL and can build xdemos
321 if test "$mesa_driver" != osmesa; then
322 PROGRAM_DIRS="xdemos"
323 fi
324 ;;
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800325*)
326 # verify the requested demos directories exist
327 demos=`IFS=,; echo $with_demos`
328 for demo in $demos; do
329 test -d "$srcdir/progs/$demo" || \
330 AC_MSG_ERROR([Program directory '$demo' doesn't exist])
331 done
332 PROGRAM_DIRS="$demos"
333 ;;
334esac
335
336dnl
Dan Nicholsone6a06092008-05-05 15:16:22 -0700337dnl Find out if X is available. The variable have_x is set if libX11 is
338dnl to mimic AC_PATH_XTRA.
Dan Nicholsondca1b792007-10-23 09:25:58 -0700339dnl
340if test -n "$PKG_CONFIG"; then
341 AC_MSG_CHECKING([pkg-config files for X11 are available])
Dan Nicholsone6a06092008-05-05 15:16:22 -0700342 PKG_CHECK_EXISTS([x11],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700343 x11_pkgconfig=yes
344 have_x=yes
Dan Nicholsone6a06092008-05-05 15:16:22 -0700345 ],[
Dan Nicholsondca1b792007-10-23 09:25:58 -0700346 x11_pkgconfig=no
Dan Nicholsone6a06092008-05-05 15:16:22 -0700347 ])
348 AC_MSG_RESULT([$x11_pkgconfig])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700349else
350 x11_pkgconfig=no
351fi
352dnl Use the autoconf macro if no pkg-config files
353if test "$x11_pkgconfig" = no; then
354 AC_PATH_XTRA
355fi
356
Dan Nicholson44d99142007-12-05 18:47:01 -0800357dnl We need X for xlib and dri, so bomb now if it's not found
358case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800359xlib|dri)
Dan Nicholson44d99142007-12-05 18:47:01 -0800360 if test "$no_x" = yes; then
361 AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
362 fi
363 ;;
364esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700365
Adam Jackson66611f22008-02-15 13:49:12 -0500366# SELinux awareness.
Dan Nicholson297e16c2008-05-05 15:42:53 -0700367AC_ARG_ENABLE([selinux],
368 [AS_HELP_STRING([--enable-selinux],
369 [Build SELinux-aware Mesa (default: disabled)])],
370 [MESA_SELINUX="$enableval"],
371 [MESA_SELINUX=no])
Adam Jackson66611f22008-02-15 13:49:12 -0500372if test "x$enable_selinux" = "xyes"; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700373 AC_CHECK_HEADER([selinux/selinux.h],[],
374 [AC_MSG_ERROR([SELinux headers not found])])
375 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
376 [AC_MSG_ERROR([SELinux library not found])])
Adam Jackson66611f22008-02-15 13:49:12 -0500377 SELINUX_LIBS="-lselinux"
378 DEFINES="$DEFINES -DMESA_SELINUX"
379fi
380
Dan Nicholson44d99142007-12-05 18:47:01 -0800381dnl
382dnl libGL configuration per driver
383dnl
384case "$mesa_driver" in
Dan Nicholsona1307182007-12-12 17:49:49 -0800385xlib)
Dan Nicholson44d99142007-12-05 18:47:01 -0800386 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700387 PKG_CHECK_MODULES([XLIBGL], [x11 xext])
Dan Nicholsona1307182007-12-12 17:49:49 -0800388 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
389 GL_LIB_DEPS="$XLIBGL_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800390 else
391 # should check these...
392 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
393 GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
394 fi
Adam Jackson66611f22008-02-15 13:49:12 -0500395 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
Dan Nicholson88586332007-11-15 08:59:57 -0800396
397 # if static, move the external libraries to the programs
398 # and empty the libraries for libGL
399 if test "$enable_static" = yes; then
400 APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
401 GL_LIB_DEPS=""
402 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800403 ;;
404dri)
Dan Nicholson88586332007-11-15 08:59:57 -0800405 # DRI must be shared, I think
406 if test "$enable_static" = yes; then
407 AC_MSG_ERROR([Can't use static libraries for DRI drivers])
408 fi
409
Dan Nicholson44d99142007-12-05 18:47:01 -0800410 # Check for libdrm
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -0700411 PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
412 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
Dan Nicholson44d99142007-12-05 18:47:01 -0800413
414 # find the DRI deps for libGL
415 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700416 PKG_CHECK_MODULES([DRIGL], [x11 xext xxf86vm xdamage xfixes])
Dan Nicholson44d99142007-12-05 18:47:01 -0800417 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
418 GL_LIB_DEPS="$DRIGL_LIBS"
419 else
420 # should check these...
421 X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
422 GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
423 fi
424
425 # need DRM libs, -lpthread, etc.
Eric Anholt050c5332008-03-20 17:28:58 -0700426 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800427 ;;
Dan Nicholson979ff512007-12-05 18:47:01 -0800428osmesa)
429 # No libGL for osmesa
430 GL_LIB_DEPS=""
431 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -0800432esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700433AC_SUBST([GL_LIB_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700434
435dnl
436dnl More X11 setup
437dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800438if test "$mesa_driver" = xlib; then
Dan Nicholsondca1b792007-10-23 09:25:58 -0700439 DEFINES="$DEFINES -DUSE_XSHM"
440fi
441
442dnl
Dan Nicholson44d99142007-12-05 18:47:01 -0800443dnl More DRI setup
444dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700445AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -0800446 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800447 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700448 [GLX_USE_TLS="$enableval"],
449 [GLX_USE_TLS=no])
Dan Nicholson44d99142007-12-05 18:47:01 -0800450dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -0700451AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800452 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson44d99142007-12-05 18:47:01 -0800453 [directory for the DRI drivers @<:@/usr/X11R6/lib/modules/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700454 [DRI_DRIVER_INSTALL_DIR="$withval"],
455 [DRI_DRIVER_INSTALL_DIR='/usr/X11R6/lib/modules/dri'])
456AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Dan Nicholson44d99142007-12-05 18:47:01 -0800457dnl Direct rendering or just indirect rendering
Dan Nicholson297e16c2008-05-05 15:42:53 -0700458AC_ARG_ENABLE([driglx-direct],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800459 [AS_HELP_STRING([--disable-driglx-direct],
460 [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700461 [driglx_direct="$enableval"],
462 [driglx_direct="yes"])
Dan Nicholson44d99142007-12-05 18:47:01 -0800463
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800464dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -0700465AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800466 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Dan Nicholsonc79c93c2007-12-12 18:13:04 -0800467 [comma delimited DRI drivers, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700468 [with_dri_drivers="$withval"],
469 [with_dri_drivers=yes])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800470if test "x$with_dri_drivers" = x; then
471 with_dri_drivers=no
472fi
473
474dnl If $with_dri_drivers is yes, directories will be added through
475dnl platform checks
476DRI_DIRS=""
477case "$with_dri_drivers" in
478no|yes) ;;
479*)
480 # verify the requested driver directories exist
481 dri_drivers=`IFS=,; echo $with_dri_drivers`
482 for driver in $dri_drivers; do
483 test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
484 AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
485 done
486 DRI_DIRS="$dri_drivers"
487 ;;
488esac
489
Dan Nicholson44d99142007-12-05 18:47:01 -0800490dnl Just default to no EGL for now
491USING_EGL=0
Dan Nicholson297e16c2008-05-05 15:42:53 -0700492AC_SUBST([USING_EGL])
Dan Nicholson44d99142007-12-05 18:47:01 -0800493
494dnl Set DRI_DIRS, DEFINES and LIB_DEPS
495if test "$mesa_driver" = dri; then
496 # Use TLS in GLX?
497 if test "x$GLX_USE_TLS" = xyes; then
498 DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
499 fi
500
501 if test "x$USING_EGL" = x1; then
502 PROGRAM_DIRS="egl"
503 fi
504
505 # Platform specific settings and drivers to build
506 case "$host_os" in
507 linux*)
508 DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
509 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
510 if test "x$driglx_direct" = xyes; then
511 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
512 fi
513
514 case "$host_cpu" in
Dan Nicholson44d99142007-12-05 18:47:01 -0800515 x86_64)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800516 # ffb, gamma, and sis are missing because they have not be
517 # converted to use the new interface. i810 are missing
518 # because there is no x86-64 system where they could *ever*
519 # be used.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800520 if test "x$DRI_DIRS" = x; then
Dan Nicholsona76e2452007-12-07 11:25:08 -0800521 DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
522 savage tdfx unichrome"
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800523 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800524 ;;
525 powerpc*)
Dan Nicholsona76e2452007-12-07 11:25:08 -0800526 # Build only the drivers for cards that exist on PowerPC.
527 # At some point MGA will be added, but not yet.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800528 if test "x$DRI_DIRS" = x; then
529 DRI_DIRS="mach64 r128 r200 r300 radeon tdfx"
530 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800531 ;;
532 esac
533 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700534 freebsd* | dragonfly*)
Dan Nicholson44d99142007-12-05 18:47:01 -0800535 DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
536 DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
537 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
538 if test "x$driglx_direct" = xyes; then
539 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
540 fi
541 if test "x$GXX" = xyes; then
542 CXXFLAGS="$CXXFLAGS -ansi -pedantic"
543 fi
544
Dan Nicholsona76e2452007-12-07 11:25:08 -0800545 # ffb and gamma are missing because they have not been converted
546 # to use the new interface.
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -0800547 if test "x$DRI_DIRS" = x; then
548 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
549 unichrome savage sis"
550 fi
Dan Nicholson44d99142007-12-05 18:47:01 -0800551 ;;
552 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -0800553
554 # default drivers
555 if test "x$DRI_DIRS" = x; then
556 DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
557 savage sis tdfx trident unichrome ffb"
558 fi
559
Dan Nicholson44d99142007-12-05 18:47:01 -0800560 DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
561
562 # Check for expat
563 EXPAT_INCLUDES=""
564 EXPAT_LIB=-lexpat
Dan Nicholson297e16c2008-05-05 15:42:53 -0700565 AC_ARG_WITH([expat],
566 [AS_HELP_STRING([--with-expat=DIR],
567 [expat install directory])],[
Dan Nicholson44d99142007-12-05 18:47:01 -0800568 EXPAT_INCLUDES="-I$withval/include"
569 CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
570 LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
571 EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
572 ])
Dan Nicholson297e16c2008-05-05 15:42:53 -0700573 AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
574 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
575 [AC_MSG_ERROR([Expat required for DRI.])])
Dan Nicholson44d99142007-12-05 18:47:01 -0800576
577 # put all the necessary libs together
Eric Anholt050c5332008-03-20 17:28:58 -0700578 DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -0800579fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700580AC_SUBST([DRI_DIRS])
581AC_SUBST([EXPAT_INCLUDES])
582AC_SUBST([DRI_LIB_DEPS])
Dan Nicholson44d99142007-12-05 18:47:01 -0800583
584dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700585dnl OSMesa configuration
586dnl
Dan Nicholsona1307182007-12-12 17:49:49 -0800587if test "$mesa_driver" = xlib; then
Dan Nicholson544ab202007-12-30 08:41:53 -0800588 default_gl_osmesa=yes
Dan Nicholson979ff512007-12-05 18:47:01 -0800589else
Dan Nicholson544ab202007-12-30 08:41:53 -0800590 default_gl_osmesa=no
Dan Nicholson44d99142007-12-05 18:47:01 -0800591fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700592AC_ARG_ENABLE([gl-osmesa],
Dan Nicholson544ab202007-12-30 08:41:53 -0800593 [AS_HELP_STRING([--enable-gl-osmesa],
594 [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700595 [gl_osmesa="$enableval"],
596 [gl_osmesa="$default_gl_osmesa"])
Dan Nicholson544ab202007-12-30 08:41:53 -0800597if test "x$gl_osmesa" = xyes; then
598 if test "$mesa_driver" = osmesa; then
599 AC_MSG_ERROR([libGL is not available for OSMesa driver])
Dan Nicholson979ff512007-12-05 18:47:01 -0800600 else
Dan Nicholson544ab202007-12-30 08:41:53 -0800601 DRIVER_DIRS="$DRIVER_DIRS osmesa"
Dan Nicholson979ff512007-12-05 18:47:01 -0800602 fi
603fi
604
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800605dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -0700606AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800607 [AS_HELP_STRING([--with-osmesa-bits=BITS],
608 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700609 [osmesa_bits="$withval"],
610 [osmesa_bits=8])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800611if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
612 AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
613 osmesa_bits=8
614fi
615case "x$osmesa_bits" in
616x8)
617 OSMESA_LIB=OSMesa
618 ;;
619x16|x32)
620 OSMESA_LIB="OSMesa$osmesa_bits"
621 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
622 ;;
623*)
624 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
625 ;;
626esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700627AC_SUBST([OSMESA_LIB])
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800628
Dan Nicholson979ff512007-12-05 18:47:01 -0800629case "$mesa_driver" in
630osmesa)
Dan Nicholson88586332007-11-15 08:59:57 -0800631 # only link librararies with osmesa if shared
632 if test "$enable_static" = no; then
Adam Jackson66611f22008-02-15 13:49:12 -0500633 OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
Dan Nicholson88586332007-11-15 08:59:57 -0800634 else
635 OSMESA_LIB_DEPS=""
636 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800637 OSMESA_MESA_DEPS=""
638 ;;
639*)
640 # Link OSMesa to libGL otherwise
641 OSMESA_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800642 # only link librararies with osmesa if shared
643 if test "$enable_static" = no; then
644 OSMESA_MESA_DEPS='-l$(GL_LIB)'
645 else
646 OSMESA_MESA_DEPS=""
647 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800648 ;;
649esac
Dan Nicholson297e16c2008-05-05 15:42:53 -0700650AC_SUBST([OSMESA_LIB_DEPS])
651AC_SUBST([OSMESA_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700652
653dnl
George Sapountzis2ed0f722008-04-26 12:34:11 +0300654dnl GLcore configuration
655dnl
656# delay pkg-config checks until `make glcore' run
657XORG_CFLAGS='`pkg-config --cflags xorg-server`'
658GLCORE_LIB_DEPS='-lm -lpthread'
659if test "$mesa_driver" = dri; then
660 GLCORE_LIB_DEPS="$GLCORE_LIB_DEPS $DLOPEN_LIBS"
661fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700662AC_SUBST([XORG_CFLAGS])
663AC_SUBST([GLCORE_LIB_DEPS])
George Sapountzis2ed0f722008-04-26 12:34:11 +0300664
665dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700666dnl GLU configuration
667dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700668AC_ARG_ENABLE([glu],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800669 [AS_HELP_STRING([--disable-glu],
670 [enable OpenGL Utility library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700671 [enable_glu="$enableval"],
672 [enable_glu=yes])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700673if test "x$enable_glu" = xyes; then
674 SRC_DIRS="$SRC_DIRS glu"
675
Dan Nicholson979ff512007-12-05 18:47:01 -0800676 case "$mesa_driver" in
677 osmesa)
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800678 # If GLU is available and we have libOSMesa (not 16 or 32),
679 # we can build the osdemos
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800680 if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
Dan Nicholson6689f9e2007-12-05 21:04:15 -0800681 PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
682 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700683
Dan Nicholson979ff512007-12-05 18:47:01 -0800684 # Link libGLU to libOSMesa instead of libGL
685 GLU_LIB_DEPS=""
Dan Nicholson88586332007-11-15 08:59:57 -0800686 if test "$enable_static" = no; then
687 GLU_MESA_DEPS='-l$(OSMESA_LIB)'
688 else
689 GLU_MESA_DEPS=""
690 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800691 ;;
692 *)
Dan Nicholson88586332007-11-15 08:59:57 -0800693 # If static, empty GLU_LIB_DEPS and add libs for programs to link
694 if test "$enable_static" = no; then
695 GLU_LIB_DEPS="-lm"
696 GLU_MESA_DEPS='-l$(GL_LIB)'
697 else
698 GLU_LIB_DEPS=""
699 GLU_MESA_DEPS=""
700 APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
701 fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800702 ;;
703 esac
Dan Nicholsondca1b792007-10-23 09:25:58 -0700704fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700705AC_SUBST([GLU_LIB_DEPS])
706AC_SUBST([GLU_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700707
708dnl
709dnl GLw configuration
710dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700711AC_ARG_ENABLE([glw],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800712 [AS_HELP_STRING([--disable-glw],
713 [enable Xt/Motif widget library @<:@default=enabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700714 [enable_glw="$enableval"],
715 [enable_glw=yes])
Dan Nicholson979ff512007-12-05 18:47:01 -0800716dnl Don't build GLw on osmesa
717if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
718 AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
719 enable_glw=no
720fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700721if test "x$enable_glw" = xyes; then
722 SRC_DIRS="$SRC_DIRS glw"
723 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700724 PKG_CHECK_MODULES([GLW],[x11 xt])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700725 GLW_LIB_DEPS="$GLW_LIBS"
726 else
727 # should check these...
728 GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
729 fi
730
Dan Nicholson88586332007-11-15 08:59:57 -0800731 # If static, empty GLW_LIB_DEPS and add libs for programs to link
732 if test "$enable_static" = no; then
733 GLW_MESA_DEPS='-l$(GL_LIB)'
734 else
735 APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
736 GLW_LIB_DEPS=""
737 GLW_MESA_DEPS=""
738 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700739fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700740AC_SUBST([GLW_LIB_DEPS])
741AC_SUBST([GLW_MESA_DEPS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700742
743dnl
744dnl GLUT configuration
745dnl
746if test -f "$srcdir/include/GL/glut.h"; then
747 default_glut=yes
748else
749 default_glut=no
750fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700751AC_ARG_ENABLE([glut],
Dan Nicholson79ad4582007-12-07 19:11:01 -0800752 [AS_HELP_STRING([--disable-glut],
753 [enable GLUT library @<:@default=enabled if source available@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700754 [enable_glut="$enableval"],
755 [enable_glut="$default_glut"])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700756
757dnl Can't build glut if GLU not available
758if test "x$enable_glu$enable_glut" = xnoyes; then
759 AC_MSG_WARN([Disabling glut since GLU is disabled])
760 enable_glut=no
761fi
Dan Nicholson979ff512007-12-05 18:47:01 -0800762dnl Don't build glut on osmesa
763if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
764 AC_MSG_WARN([Disabling glut since the driver is OSMesa])
765 enable_glut=no
766fi
767
Dan Nicholsondca1b792007-10-23 09:25:58 -0700768if test "x$enable_glut" = xyes; then
769 SRC_DIRS="$SRC_DIRS glut/glx"
770 GLUT_CFLAGS=""
771 if test "x$GCC" = xyes; then
772 GLUT_CFLAGS="-fexceptions"
773 fi
774 if test "$x11_pkgconfig" = yes; then
Dan Nicholson297e16c2008-05-05 15:42:53 -0700775 PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700776 GLUT_LIB_DEPS="$GLUT_LIBS"
777 else
778 # should check these...
Dan Nicholson70d0c832007-12-07 11:12:20 -0800779 GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700780 fi
781 GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
782
783 # If glut is available, we can build most programs
Dan Nicholson8e4d1472007-11-15 08:59:57 -0800784 if test "$with_demos" = yes; then
785 PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
786 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700787
Dan Nicholson88586332007-11-15 08:59:57 -0800788 # If static, empty GLUT_LIB_DEPS and add libs for programs to link
789 if test "$enable_static" = no; then
790 GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
791 else
792 APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
793 GLUT_LIB_DEPS=""
794 GLUT_MESA_DEPS=""
795 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700796fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700797AC_SUBST([GLUT_LIB_DEPS])
798AC_SUBST([GLUT_MESA_DEPS])
799AC_SUBST([GLUT_CFLAGS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700800
801dnl
802dnl Program library dependencies
803dnl Only libm is added here if necessary as the libraries should
804dnl be pulled in by the linker
805dnl
806if test "x$APP_LIB_DEPS" = x; then
807 APP_LIB_DEPS="-lm"
808fi
Dan Nicholson297e16c2008-05-05 15:42:53 -0700809AC_SUBST([APP_LIB_DEPS])
810AC_SUBST([PROGRAM_DIRS])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700811
812dnl Arch/platform-specific settings
813PIC_FLAGS=""
814ASM_FLAGS=""
815ASM_SOURCES=""
816ASM_API=""
Dan Nicholson297e16c2008-05-05 15:42:53 -0700817AC_SUBST([PIC_FLAGS])
818AC_SUBST([ASM_FLAGS])
819AC_SUBST([ASM_SOURCES])
820AC_SUBST([ASM_API])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700821case "$host_os" in
822linux*)
823 PIC_FLAGS="-fPIC"
824 case "$host_cpu" in
825 i*86)
Dan Nicholson3e288622007-12-12 09:02:31 -0800826 if test "x$enable_asm" = xyes; then
827 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
828 ASM_SOURCES='$(X86_SOURCES)'
829 ASM_API='$(X86_API)'
830 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700831 ;;
832 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800833 if test "x$enable_asm" = xyes; then
834 ASM_FLAGS="-DUSE_X86_64_ASM"
835 ASM_SOURCES='$(X86-64_SOURCES)'
836 ASM_API='$(X86-64_API)'
837 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700838 ;;
839 powerpc)
Dan Nicholson3e288622007-12-12 09:02:31 -0800840 if test "x$enable_asm" = xyes; then
841 ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
842 ASM_SOURCES='$(PPC_SOURCES)'
843 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700844 ;;
845 esac
846 ;;
Hasso Tepper9f8df2d2008-04-09 10:51:21 -0700847freebsd* | dragonfly*)
Dan Nicholsondca1b792007-10-23 09:25:58 -0700848 PIC_FLAGS="-fPIC"
Dan Nicholson758b9982008-02-21 10:32:04 -0800849 case "$host_cpu" in
Dan Nicholsondca1b792007-10-23 09:25:58 -0700850 i*86)
851 PIC_FLAGS=""
Dan Nicholson3e288622007-12-12 09:02:31 -0800852 if test "x$enable_asm" = xyes; then
853 ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
854 ASM_SOURCES='$(X86_SOURCES)'
855 ASM_API='$(X86_API)'
856 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700857 ;;
858 x86_64)
Dan Nicholson3e288622007-12-12 09:02:31 -0800859 if test "x$enable_asm" = xyes; then
860 ASM_FLAGS="-DUSE_X86_64_ASM"
861 ASM_SOURCES='$(X86-64_SOURCES)'
862 ASM_API='$(X86-64_API)'
863 fi
Dan Nicholsondca1b792007-10-23 09:25:58 -0700864 ;;
865 esac
866 ;;
867esac
868
869dnl Restore LDFLAGS and CPPFLAGS
870LDFLAGS="$_SAVE_LDFLAGS"
871CPPFLAGS="$_SAVE_CPPFLAGS"
872
873dnl Substitute the config
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -0800874AC_CONFIG_FILES([configs/autoconf])
875AC_OUTPUT
Dan Nicholsondca1b792007-10-23 09:25:58 -0700876
Dan Nicholsonaab38cf2007-12-11 08:21:51 -0800877dnl Replace the configs/current symlink
878if test -f configs/current || test -L configs/current; then
879 rm -f configs/current
880fi
881ln -s autoconf configs/current
882
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800883dnl
884dnl Output some configuration info for the user
885dnl
886echo ""
887echo " prefix: $prefix"
888echo " exec_prefix: $exec_prefix"
889echo " libdir: $libdir"
890
891dnl Driver info
892echo ""
893echo " Driver: $mesa_driver"
Dan Nicholson544ab202007-12-30 08:41:53 -0800894if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
895 echo " OSMesa: lib$OSMESA_LIB"
896else
897 echo " OSMesa: no"
898fi
899if test "$mesa_driver" = dri; then
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800900 # cleanup the drivers var
901 dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
902 echo " DRI drivers: $dri_dirs"
903 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -0800904fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -0800905
906dnl Libraries
907echo ""
908echo " Shared libs: $enable_shared"
909echo " Static libs: $enable_static"
910echo " GLU: $enable_glu"
911echo " GLw: $enable_glw"
912echo " glut: $enable_glut"
913
914dnl Programs
915# cleanup the programs var for display
916program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
917if test "x$program_dirs" = x; then
918 echo " Demos: no"
919else
920 echo " Demos: $program_dirs"
921fi
922
Dan Nicholson16a07fb2007-12-12 09:12:15 -0800923dnl Compiler options
924# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
925cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
926 $SED 's/^ *//;s/ */ /;s/ *$//'`
927cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
928 $SED 's/^ *//;s/ */ /;s/ *$//'`
929defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
930echo ""
931echo " CFLAGS: $cflags"
932echo " CXXFLAGS: $cxxflags"
933echo " Macros: $defines"
934
Dan Nicholsondca1b792007-10-23 09:25:58 -0700935echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -0700936echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700937echo ""