blob: ffd51db31b7654d0c1526a086e98bcff89275da4 [file] [log] [blame]
Carl Worth670826b2014-12-11 14:33:44 -08001dnl Copyright © 2011-2014 Intel Corporation
2dnl Copyright © 2011-2014 Emil Velikov <emil.l.velikov@gmail.com>
3dnl Copyright © 2007-2010 Dan Nicholson
4dnl Copyright © 2010-2014 Marek Olšák <maraeo@gmail.com>
5dnl Copyright © 2010-2014 Christian König
6dnl Copyright © 2012-2014 Tom Stellard <tstellar@gmail.com>
7dnl Copyright © 2009-2012 Jakob Bornecrantz
8dnl Copyright © 2009-2014 Jon TURNEY
9dnl Copyright © 2011-2012 Benjamin Franzke
10dnl Copyright © 2008-2014 David Airlie
11dnl Copyright © 2009-2013 Brian Paul
Carl Wortha24bdce2014-12-12 13:55:30 -080012dnl Copyright © 2003-2007 Keith Packard, Daniel Stone
Carl Worth670826b2014-12-11 14:33:44 -080013dnl
14dnl Permission is hereby granted, free of charge, to any person obtaining a
15dnl copy of this software and associated documentation files (the "Software"),
16dnl to deal in the Software without restriction, including without limitation
17dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
18dnl and/or sell copies of the Software, and to permit persons to whom the
19dnl Software is furnished to do so, subject to the following conditions:
20dnl
21dnl The above copyright notice and this permission notice (including the next
22dnl paragraph) shall be included in all copies or substantial portions of the
23dnl Software.
24dnl
25dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
28dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31dnl DEALINGS IN THE SOFTWARE.
32dnl
Matt Turner2f1ab632012-01-03 21:58:37 -050033dnl Process this file with autoconf to create configure.
Dan Nicholsondca1b792007-10-23 09:25:58 -070034
Matt Turner51723832011-12-23 19:21:04 -050035AC_PREREQ([2.60])
Dan Nicholsondca1b792007-10-23 09:25:58 -070036
Dan Nicholsone97ab722008-07-01 08:55:42 -070037dnl Tell the user about autoconf.html in the --help output
38m4_divert_once([HELP_END], [
39See docs/autoconf.html for more details on the options for Mesa.])
40
Emil Velikov488b3ed2013-07-25 23:45:45 +010041m4_define(MESA_VERSION, m4_normalize(m4_include(VERSION)))
42AC_INIT([Mesa], [MESA_VERSION],
Dan Nicholsonf64d6fe2007-12-12 17:57:45 -080043 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
Dan Nicholson297e16c2008-05-05 15:42:53 -070044AC_CONFIG_AUX_DIR([bin])
Matt Turner7da12422012-09-18 20:21:47 -070045AC_CONFIG_MACRO_DIR([m4])
Thierry Reding9948a332012-10-19 14:03:01 +020046AC_CANONICAL_SYSTEM
Matt Turner404a90b2015-06-10 16:30:56 -070047AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz subdir-objects])
Dan Nicholsondca1b792007-10-23 09:25:58 -070048
Jose Fonseca8f0274c2015-03-19 13:38:52 +000049dnl We only support native Windows builds (MinGW/MSVC) through SCons.
50case "$host_os" in
51mingw*)
52 AC_MSG_ERROR([MinGW build not supported through autoconf/automake, use SCons instead])
53 ;;
54esac
55
Eric Anholt7fa5c912012-01-12 14:56:56 -080056# Support silent build rules, requires at least automake-1.11. Disable
57# by either passing --disable-silent-rules to configure or passing V=1
58# to make
Lauri Kasanen0a828282013-02-22 22:25:58 +020059m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
60 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
Eric Anholt7fa5c912012-01-12 14:56:56 -080061
Kenneth Graunke4a5d0202012-05-30 21:54:21 -070062m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
63
Johannes Obermayr10a96f42012-09-02 01:35:47 +020064dnl Set internal versions
65OSMESA_VERSION=8
66AC_SUBST([OSMESA_VERSION])
Igor Gnatenko4d7e0fa2015-07-07 13:05:04 +030067OPENCL_VERSION=1
68AC_SUBST([OPENCL_VERSION])
Johannes Obermayr10a96f42012-09-02 01:35:47 +020069
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070070dnl Versions for external dependencies
Marek Olšák7a2333e2016-03-14 16:41:54 +010071LIBDRM_REQUIRED=2.4.66
Marek Olšák49e22752014-07-29 23:25:42 +020072LIBDRM_RADEON_REQUIRED=2.4.56
Marek Olšák2eb067d2015-04-16 22:43:23 +020073LIBDRM_AMDGPU_REQUIRED=2.4.63
Emil Velikova025e532015-07-06 09:42:01 +010074LIBDRM_INTEL_REQUIRED=2.4.61
Ben Skeggsa8abdf22015-11-03 15:55:55 +100075LIBDRM_NVVIEUX_REQUIRED=2.4.66
76LIBDRM_NOUVEAU_REQUIRED=2.4.66
Rob Clark45ab5b12016-02-10 13:25:32 -050077LIBDRM_FREEDRENO_REQUIRED=2.4.67
Jesse Barnes1e39fc72011-05-05 13:09:16 -070078DRI2PROTO_REQUIRED=2.6
Keith Packard2d946012013-11-04 18:15:51 -080079DRI3PROTO_REQUIRED=1.0
80PRESENTPROTO_REQUIRED=1.0
81LIBUDEV_REQUIRED=151
Jesse Barnes1e39fc72011-05-05 13:09:16 -070082GLPROTO_REQUIRED=1.4.14
Fabio Pedretti8a8dd862014-03-01 10:11:12 +010083LIBOMXIL_BELLAGIO_REQUIRED=0.0
Boyuan Zhangad2752e2015-10-23 13:37:48 -040084LIBVA_REQUIRED=0.38.0
Christian König5609a692015-04-29 15:35:02 +020085VDPAU_REQUIRED=1.1
Fabio Pedretti8a8dd862014-03-01 10:11:12 +010086WAYLAND_REQUIRED=1.2.0
Emil Velikovda029f82014-07-11 23:17:48 +010087XCB_REQUIRED=1.9.3
Fabio Pedretti8a8dd862014-03-01 10:11:12 +010088XCBDRI2_REQUIRED=1.8
89XCBGLX_REQUIRED=1.8.1
90XSHMFENCE_REQUIRED=1.1
91XVMC_REQUIRED=1.0.6
Samuel Iglesias Gonsalvezced94252015-03-02 10:49:31 +010092PYTHON_MAKO_REQUIRED=0.3.4
Dan Nicholsoncc77e8f2008-05-05 14:38:22 -070093
Dan Nicholsondca1b792007-10-23 09:25:58 -070094dnl Check for progs
95AC_PROG_CPP
96AC_PROG_CC
97AC_PROG_CXX
Dylan Noblesmitha3d56732012-04-02 15:35:38 +000098AM_PROG_CC_C_O
Eric Anholtf9d15622012-05-24 13:59:21 -070099AM_PROG_AS
Matt Turner691bd9b2014-09-21 13:32:35 -0700100AX_CHECK_GNU_MAKE
Jonathan Gray4ef44bb2015-12-06 16:11:05 +1100101AC_CHECK_PROGS([PYTHON2], [python2.7 python2 python])
Matt Turner3a343ef2012-01-11 01:05:56 -0500102AC_PROG_SED
Matt Turnerfd827a82012-01-21 22:43:02 -0500103AC_PROG_MKDIR_P
Dan Nicholson41b00702007-12-12 08:48:30 -0800104
Michel Dänzer76b906c2014-08-29 10:27:43 +0900105AC_SYS_LARGEFILE
106
Emil Velikov957a28e2014-08-13 17:55:39 +0100107LT_PREREQ([2.2])
108LT_INIT([disable-static])
109
Jonathan Gray99c40792015-10-10 17:42:40 +1100110AC_CHECK_PROG(RM, rm, [rm -f])
111
Matt Turnerb68b8522012-10-01 13:11:30 -0700112AX_PROG_BISON([],
Matt Turner02b6da12013-01-29 11:22:06 -0800113 AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"],
Matt Turnerb68b8522012-10-01 13:11:30 -0700114 [AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
Matt Turner2a710542012-10-01 13:28:51 -0700115AX_PROG_FLEX([],
Matt Turner02b6da12013-01-29 11:22:06 -0800116 AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"],
Matt Turner2a710542012-10-01 13:28:51 -0700117 [AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
Brian Paulde1df262011-05-18 07:50:21 -0600118
Kenneth Graunke2224fb62012-05-29 16:03:05 -0700119AC_CHECK_PROG(INDENT, indent, indent, cat)
120if test "x$INDENT" != "xcat"; then
Samuel Iglesias Gonsalvezefef6c82015-01-13 11:02:27 +0100121 # Only GNU indent is supported
122 INDENT_VERSION=`indent --version | grep GNU`
123 if test $? -eq 0; then
124 AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
125 else
126 INDENT="cat"
127 fi
Kenneth Graunke2224fb62012-05-29 16:03:05 -0700128fi
129
Samuel Iglesias Gonsalvezced94252015-03-02 10:49:31 +0100130AX_CHECK_PYTHON_MAKO_MODULE($PYTHON_MAKO_REQUIRED)
Emil Velikov40089752015-03-23 17:49:24 +0000131
132if test -z "$PYTHON2"; then
133 if test ! -f "$srcdir/src/util/format_srgb.c"; then
134 AC_MSG_ERROR([Python not found - unable to generate sources])
135 fi
136else
137 if test "x$acv_mako_found" = xno; then
138 if test ! -f "$srcdir/src/mesa/main/format_unpack.c"; then
139 AC_MSG_ERROR([Python mako module v$PYTHON_MAKO_REQUIRED or higher not found])
140 fi
141 fi
Samuel Iglesias Gonsalvezced94252015-03-02 10:49:31 +0100142fi
Samuel Iglesias Gonsalvez2b37bea2014-11-21 08:53:21 +0100143
Dan Nicholsonbc302b22009-05-22 09:39:02 -0700144AC_PROG_INSTALL
Dan Nicholsonbc302b22009-05-22 09:39:02 -0700145
Dan Nicholsonbfb27b52008-06-30 09:40:30 -0700146dnl We need a POSIX shell for parts of the build. Assume we have one
147dnl in most cases.
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700148case "$host_os" in
149solaris*)
150 # Solaris /bin/sh is too old/non-POSIX compliant
151 AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
Dan Nicholsonbfb27b52008-06-30 09:40:30 -0700152 SHELL="$POSIX_SHELL"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700153 ;;
154esac
155
nobled2a501872010-08-29 20:03:37 -0400156dnl clang is mostly GCC-compatible, but its version is much lower,
157dnl so we have to check for it.
158AC_MSG_CHECKING([if compiling with clang])
159
160AC_COMPILE_IFELSE(
161[AC_LANG_PROGRAM([], [[
162#ifndef __clang__
163 not clang
164#endif
165]])],
Jeremy Huddlestonb728eef2011-05-05 14:08:57 -0700166[acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
nobled2a501872010-08-29 20:03:37 -0400167
Jeremy Huddlestonb728eef2011-05-05 14:08:57 -0700168AC_MSG_RESULT([$acv_mesa_CLANG])
nobled2a501872010-08-29 20:03:37 -0400169
Timothy Arceri6852dce2014-12-18 07:29:47 +1100170dnl If we're using GCC, make sure that it is at least version 4.2.0. Older
Ian Romanick9aa3aa72010-03-03 15:59:37 -0800171dnl versions are explictly not supported.
Mike Frysinger73c9b4b2013-02-04 21:27:40 -0500172GEN_ASM_OFFSETS=no
Dave Airlieea9ae5d2015-01-21 16:40:26 +1000173USE_GNU99=no
Jeremy Huddlestonb728eef2011-05-05 14:08:57 -0700174if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
Ian Romanick9aa3aa72010-03-03 15:59:37 -0800175 AC_MSG_CHECKING([whether gcc version is sufficient])
176 major=0
177 minor=0
178
179 GCC_VERSION=`$CC -dumpversion`
180 if test $? -eq 0; then
Tom Stellard79d77b32012-04-20 16:56:46 +0200181 GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
182 GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
Ian Romanick9aa3aa72010-03-03 15:59:37 -0800183 fi
184
Timothy Arceri6852dce2014-12-18 07:29:47 +1100185 if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 2 ; then
Ian Romanick9aa3aa72010-03-03 15:59:37 -0800186 AC_MSG_RESULT([no])
Timothy Arceri6852dce2014-12-18 07:29:47 +1100187 AC_MSG_ERROR([If using GCC, version 4.2.0 or later is required.])
Ian Romanick9aa3aa72010-03-03 15:59:37 -0800188 else
189 AC_MSG_RESULT([yes])
190 fi
Mike Frysinger73c9b4b2013-02-04 21:27:40 -0500191
Dave Airlieea9ae5d2015-01-21 16:40:26 +1000192 if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6 ; then
193 USE_GNU99=yes
194 fi
Mike Frysinger73c9b4b2013-02-04 21:27:40 -0500195 if test "x$cross_compiling" = xyes; then
196 GEN_ASM_OFFSETS=yes
197 fi
Ian Romanick9aa3aa72010-03-03 15:59:37 -0800198fi
Tom Stellardf8ba0f52014-02-20 07:31:16 -0800199
Jose Fonseca51564f02015-12-01 22:43:46 +0000200dnl We don't support building Mesa with Sun C compiler
201dnl https://bugs.freedesktop.org/show_bug.cgi?id=93189
202AC_CHECK_DECL([__SUNPRO_C], [SUNCC=yes], [SUNCC=no])
203if test "x$SUNCC" = xyes; then
204 AC_MSG_ERROR([Building with Sun C compiler is not supported, use GCC instead.])
205fi
206
Tom Stellardf8ba0f52014-02-20 07:31:16 -0800207dnl Check for compiler builtins
208AX_GCC_BUILTIN([__builtin_bswap32])
Tom Stellarda9f88e22014-02-19 14:17:33 -0800209AX_GCC_BUILTIN([__builtin_bswap64])
Matt Turner4a96df72014-09-21 17:25:49 -0700210AX_GCC_BUILTIN([__builtin_clz])
211AX_GCC_BUILTIN([__builtin_clzll])
212AX_GCC_BUILTIN([__builtin_ctz])
213AX_GCC_BUILTIN([__builtin_expect])
214AX_GCC_BUILTIN([__builtin_ffs])
215AX_GCC_BUILTIN([__builtin_ffsll])
216AX_GCC_BUILTIN([__builtin_popcount])
217AX_GCC_BUILTIN([__builtin_popcountll])
218AX_GCC_BUILTIN([__builtin_unreachable])
Tom Stellardf8ba0f52014-02-20 07:31:16 -0800219
Eric Anholtbe1f49b2015-07-10 16:25:26 -0700220AX_GCC_FUNC_ATTRIBUTE([const])
Matt Turner976464c2014-09-21 18:14:01 -0700221AX_GCC_FUNC_ATTRIBUTE([flatten])
222AX_GCC_FUNC_ATTRIBUTE([format])
Matt Turnere4be17f2014-09-21 14:31:05 -0700223AX_GCC_FUNC_ATTRIBUTE([malloc])
Matt Turner976464c2014-09-21 18:14:01 -0700224AX_GCC_FUNC_ATTRIBUTE([packed])
Eric Anholtbe1f49b2015-07-10 16:25:26 -0700225AX_GCC_FUNC_ATTRIBUTE([pure])
Vinson Lee5f759832015-03-07 14:07:10 -0800226AX_GCC_FUNC_ATTRIBUTE([unused])
Kenneth Graunke128de6f2015-07-06 11:04:19 -0700227AX_GCC_FUNC_ATTRIBUTE([warn_unused_result])
Matt Turner976464c2014-09-21 18:14:01 -0700228
Mike Frysinger73c9b4b2013-02-04 21:27:40 -0500229AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
Ian Romanick9aa3aa72010-03-03 15:59:37 -0800230
Dan Nicholson41b00702007-12-12 08:48:30 -0800231dnl Make sure the pkg-config macros are defined
Dan Nicholson356f3112009-04-29 06:49:27 -0700232m4_ifndef([PKG_PROG_PKG_CONFIG],
233 [m4_fatal([Could not locate the pkg-config autoconf macros.
234 These are usually located in /usr/share/aclocal/pkg.m4. If your macros
235 are in a different location, try setting the environment variable
236 ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700237PKG_PROG_PKG_CONFIG()
238
239dnl LIB_DIR - library basename
240LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
Dan Nicholson297e16c2008-05-05 15:42:53 -0700241AC_SUBST([LIB_DIR])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700242
Matt Turnerd12b07e2012-08-14 12:33:32 -0700243dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
Dan Nicholsondca1b792007-10-23 09:25:58 -0700244_SAVE_LDFLAGS="$LDFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700245_SAVE_CPPFLAGS="$CPPFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700246
247dnl Compiler macros
Oded Gabbay647d8e92016-01-11 21:55:15 +0200248DEFINES="-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
Dan Nicholson297e16c2008-05-05 15:42:53 -0700249AC_SUBST([DEFINES])
Dan Nicholsondca1b792007-10-23 09:25:58 -0700250case "$host_os" in
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -0700251linux*|*-gnu*|gnu*)
Matt Turnerb133b842014-09-21 17:33:21 -0700252 DEFINES="$DEFINES -D_GNU_SOURCE"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700253 ;;
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700254solaris*)
Matt Turnerb133b842014-09-21 17:33:21 -0700255 DEFINES="$DEFINES -DSVR4"
Alan Coopersmithe1f9adc2008-06-20 17:58:53 -0700256 ;;
Brian Paul97988902010-02-18 12:46:12 -0700257cygwin*)
Matt Turnerb133b842014-09-21 17:33:21 -0700258 DEFINES="$DEFINES -D_XOPEN_SOURCE=700"
Brian Paul97988902010-02-18 12:46:12 -0700259 ;;
Dan Nicholsondca1b792007-10-23 09:25:58 -0700260esac
261
262dnl Add flags for gcc and g++
263if test "x$GCC" = xyes; then
Dave Airlieea9ae5d2015-01-21 16:40:26 +1000264 CFLAGS="$CFLAGS -Wall"
265
266 if test "x$USE_GNU99" = xyes; then
267 CFLAGS="$CFLAGS -std=gnu99"
268 else
269 CFLAGS="$CFLAGS -std=c99"
270 fi
Eric Anholtb9aab8b2012-01-26 18:48:20 -0800271
272 # Enable -Werror=implicit-function-declaration and
273 # -Werror=missing-prototypes, if available, or otherwise, just
274 # -Wmissing-prototypes. This is particularly useful to avoid
275 # generating a loadable driver module that has undefined symbols.
276 save_CFLAGS="$CFLAGS"
277 AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
278 CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
279 CFLAGS="$CFLAGS -Werror=missing-prototypes"
280 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
281 AC_MSG_RESULT([yes]),
282 [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
283 AC_MSG_RESULT([no])]);
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800284
285 # Enable -fvisibility=hidden if using a gcc that supports it
286 save_CFLAGS="$CFLAGS"
Alan Coopersmithf8107a42010-01-21 16:42:58 -0800287 AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100288 VISIBILITY_CFLAGS="-fvisibility=hidden"
289 CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
Alan Coopersmithadda7f32010-01-16 18:34:23 -0800290 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100291 [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
292
293 # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
294 CFLAGS=$save_CFLAGS
Dan Nicholson0c275b62008-01-15 22:52:25 -0800295
296 # Work around aliasing bugs - developers should comment this out
297 CFLAGS="$CFLAGS -fno-strict-aliasing"
José Fonseca1448bdf2011-10-14 18:28:55 +0100298
Matt Turnerf55c4082015-07-31 12:19:46 -0700299 # We don't want floating-point math functions to set errno or trap
300 CFLAGS="$CFLAGS -fno-math-errno -fno-trapping-math"
Matt Turner875458b2015-07-31 12:18:37 -0700301
José Fonseca1448bdf2011-10-14 18:28:55 +0100302 # gcc's builtin memcmp is slower than glibc's
303 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
304 CFLAGS="$CFLAGS -fno-builtin-memcmp"
Jose Fonseca80c5bd72015-02-26 16:46:48 +0000305
306 # Flags to help ensure that certain portions of the code -- and only those
307 # portions -- can be built with MSVC:
Jose Fonseca1cadfe02016-02-11 11:07:33 +0000308 # - src/util, src/gallium/auxiliary, rc/gallium/drivers/llvmpipe, and
Jose Fonseca80c5bd72015-02-26 16:46:48 +0000309 # - non-Linux/Posix OpenGL portions needs to build on MSVC 2013 (which
310 # supports most of C99)
311 # - the rest has no compiler compiler restrictions
Jonathan Gray84755262015-03-17 13:16:05 +1100312 MSVC2013_COMPAT_CFLAGS="-Werror=pointer-arith"
313 MSVC2013_COMPAT_CXXFLAGS="-Werror=pointer-arith"
314
315 # Enable -Werror=vla if compiler supports it
316 save_CFLAGS="$CFLAGS"
317 AC_MSG_CHECKING([whether $CC supports -Werror=vla])
318 CFLAGS="$CFLAGS -Werror=vla"
319 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
320 [MSVC2013_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS -Werror=vla";
321 MSVC2013_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS -Werror=vla";
322 AC_MSG_RESULT([yes])],
323 AC_MSG_RESULT([no]));
324 CFLAGS="$save_CFLAGS"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700325fi
326if test "x$GXX" = xyes; then
327 CXXFLAGS="$CXXFLAGS -Wall"
Dan Nicholson0c275b62008-01-15 22:52:25 -0800328
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400329 # Enable -fvisibility=hidden if using a gcc that supports it
330 save_CXXFLAGS="$CXXFLAGS"
331 AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100332 VISIBILITY_CXXFLAGS="-fvisibility=hidden"
333 CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
Jon TURNEY560f7622011-04-26 11:49:01 +0100334 AC_LANG_PUSH([C++])
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400335 AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100336 [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
Jon TURNEY560f7622011-04-26 11:49:01 +0100337 AC_LANG_POP([C++])
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100338
339 # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
340 CXXFLAGS=$save_CXXFLAGS
Kristian Høgsberg7b34fcc2010-09-08 20:34:07 -0400341
Dan Nicholson0c275b62008-01-15 22:52:25 -0800342 # Work around aliasing bugs - developers should comment this out
343 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
José Fonseca1448bdf2011-10-14 18:28:55 +0100344
345 # gcc's builtin memcmp is slower than glibc's
346 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
347 CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
Dan Nicholsondca1b792007-10-23 09:25:58 -0700348fi
349
Jose Fonseca80c5bd72015-02-26 16:46:48 +0000350AC_SUBST([MSVC2013_COMPAT_CFLAGS])
351AC_SUBST([MSVC2013_COMPAT_CXXFLAGS])
Jose Fonseca80c5bd72015-02-26 16:46:48 +0000352
Jon TURNEYdb786432011-04-26 11:56:02 +0100353dnl even if the compiler appears to support it, using visibility attributes isn't
354dnl going to do anything useful currently on cygwin apart from emit lots of warnings
355case "$host_os" in
356cygwin*)
357 VISIBILITY_CFLAGS=""
358 VISIBILITY_CXXFLAGS=""
359 ;;
360esac
361
Christopher James Halse Rogersd1e28b22011-02-03 11:19:32 +1100362AC_SUBST([VISIBILITY_CFLAGS])
363AC_SUBST([VISIBILITY_CXXFLAGS])
364
Dan Nicholsondca1b792007-10-23 09:25:58 -0700365dnl
Lauri Kasanenfcefdc92013-12-19 21:43:25 +0200366dnl Optional flags, check for compiler support
367dnl
Timothy Arcerif1b5f2b2014-12-07 00:09:40 +1100368SSE41_CFLAGS="-msse4.1"
369dnl Code compiled by GCC with -msse* assumes a 16 byte aligned
370dnl stack, but on x86-32 such alignment is not guaranteed.
371case "$target_cpu" in
372i?86)
373 SSE41_CFLAGS="$SSE41_CFLAGS -mstackrealign"
374 ;;
375esac
Emil Velikov1a6ae842014-11-15 18:37:22 +0000376save_CFLAGS="$CFLAGS"
Timothy Arcerif1b5f2b2014-12-07 00:09:40 +1100377CFLAGS="$SSE41_CFLAGS $CFLAGS"
Emil Velikov1a6ae842014-11-15 18:37:22 +0000378AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
379#include <smmintrin.h>
Oded Gabbay6e44bbe2015-12-15 12:05:22 +0200380int param;
Emil Velikov1a6ae842014-11-15 18:37:22 +0000381int main () {
Oded Gabbay6e44bbe2015-12-15 12:05:22 +0200382 __m128i a = _mm_set1_epi32 (param), b = _mm_set1_epi32 (param + 1), c;
Emil Velikov1a6ae842014-11-15 18:37:22 +0000383 c = _mm_max_epu32(a, b);
Oded Gabbay6e44bbe2015-12-15 12:05:22 +0200384 return _mm_cvtsi128_si32(c);
Emil Velikov1a6ae842014-11-15 18:37:22 +0000385}]])], SSE41_SUPPORTED=1)
386CFLAGS="$save_CFLAGS"
Emil Velikovb3121bf2014-08-01 17:06:10 +0100387if test "x$SSE41_SUPPORTED" = x1; then
388 DEFINES="$DEFINES -DUSE_SSE41"
389fi
Lauri Kasanenfcefdc92013-12-19 21:43:25 +0200390AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
Timothy Arcerif1b5f2b2014-12-07 00:09:40 +1100391AC_SUBST([SSE41_CFLAGS], $SSE41_CFLAGS)
Lauri Kasanenfcefdc92013-12-19 21:43:25 +0200392
Oded Gabbayafe88f62015-12-03 09:11:04 +0200393dnl Check for Endianness
394AC_C_BIGENDIAN(
395 little_endian=no,
396 little_endian=yes,
397 little_endian=no,
398 little_endian=no
399)
400
401dnl Check for POWER8 Architecture
402PWR8_CFLAGS="-mpower8-vector"
403have_pwr8_intrinsics=no
404AC_MSG_CHECKING(whether gcc supports -mpower8-vector)
405save_CFLAGS=$CFLAGS
406CFLAGS="$PWR8_CFLAGS $CFLAGS"
407AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
408#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8))
409#error "Need GCC >= 4.8 for sane POWER8 support"
410#endif
411#include <altivec.h>
412int main () {
413 vector unsigned char r;
414 vector unsigned int v = vec_splat_u32 (1);
415 r = __builtin_vec_vgbbd ((vector unsigned char) v);
416 return 0;
417}]])], have_pwr8_intrinsics=yes)
418CFLAGS=$save_CFLAGS
419
420AC_ARG_ENABLE(pwr8,
421 [AC_HELP_STRING([--disable-pwr8-inst],
422 [disable POWER8-specific instructions])],
423 [enable_pwr8=$enableval], [enable_pwr8=auto])
424
425if test "x$enable_pwr8" = xno ; then
426 have_pwr8_intrinsics=disabled
427fi
428
429if test $have_pwr8_intrinsics = yes && test $little_endian = yes ; then
430 DEFINES="$DEFINES -D_ARCH_PWR8"
431 CXXFLAGS="$CXXFLAGS $PWR8_CFLAGS"
432 CFLAGS="$CFLAGS $PWR8_CFLAGS"
433else
434 PWR8_CFLAGS=
435fi
436
437AC_MSG_RESULT($have_pwr8_intrinsics)
438if test "x$enable_pwr8" = xyes && test $have_pwr8_intrinsics = no ; then
439 AC_MSG_ERROR([POWER8 compiler support not detected])
440fi
441
442if test $have_pwr8_intrinsics = yes && test $little_endian = no ; then
443 AC_MSG_WARN([POWER8 optimization is enabled only on POWER8 Little-Endian])
444fi
445
446AC_SUBST([PWR8_CFLAGS], $PWR8_CFLAGS)
447
Dan Nicholson88586332007-11-15 08:59:57 -0800448dnl Can't have static and shared libraries, default to static if user
449dnl explicitly requested. If both disabled, set to static since shared
Matt Turner0c178232012-01-14 11:10:06 -0500450dnl was explicitly requested.
Dan Nicholson88586332007-11-15 08:59:57 -0800451case "x$enable_static$enable_shared" in
Emil Velikov4d8267e2014-03-12 18:13:02 +0000452xyesyes)
453 AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
454 enable_shared=no
Dan Nicholson88586332007-11-15 08:59:57 -0800455 ;;
Emil Velikov4d8267e2014-03-12 18:13:02 +0000456xnono)
457 AC_MSG_WARN([Cannot disable both static and shared libraries, enabling shared])
Emil Velikova6efbac2014-03-11 11:50:37 +0000458 enable_shared=yes
Dan Nicholson88586332007-11-15 08:59:57 -0800459 ;;
460esac
461
Emil Velikov4d8267e2014-03-12 18:13:02 +0000462AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
463
Dan Nicholson88586332007-11-15 08:59:57 -0800464dnl
Dan Nicholson23656c42007-12-12 09:02:31 -0800465dnl other compiler options
466dnl
Dan Nicholson297e16c2008-05-05 15:42:53 -0700467AC_ARG_ENABLE([debug],
Dan Nicholson23656c42007-12-12 09:02:31 -0800468 [AS_HELP_STRING([--enable-debug],
469 [use debug compiler flags and macros @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -0700470 [enable_debug="$enableval"],
471 [enable_debug=no]
Dan Nicholson23656c42007-12-12 09:02:31 -0800472)
Oded Gabbay66130422016-01-07 17:20:47 +0200473
474AC_ARG_ENABLE([profile],
475 [AS_HELP_STRING([--enable-profile],
476 [enable profiling of code @<:@default=disabled@:>@])],
477 [enable_profile="$enableval"],
478 [enable_profile=no]
479)
480
481if test "x$enable_profile" = xyes; then
482 DEFINES="$DEFINES -DPROFILE"
483 if test "x$GCC" = xyes; then
484 CFLAGS="$CFLAGS -fno-omit-frame-pointer"
485 fi
486 if test "x$GXX" = xyes; then
487 CXXFLAGS="$CXXFLAGS -fno-omit-frame-pointer"
488 fi
489fi
490
Dan Nicholson23656c42007-12-12 09:02:31 -0800491if test "x$enable_debug" = xyes; then
492 DEFINES="$DEFINES -DDEBUG"
Oded Gabbay66130422016-01-07 17:20:47 +0200493 if test "x$enable_profile" = xyes; then
494 AC_MSG_WARN([Debug and Profile are enabled at the same time])
495 fi
Dan Nicholson23656c42007-12-12 09:02:31 -0800496 if test "x$GCC" = xyes; then
Ian Romanick66decc72014-07-14 11:22:20 -0700497 if ! echo "$CFLAGS" | grep -q -e '-g'; then
498 CFLAGS="$CFLAGS -g"
499 fi
500 if ! echo "$CFLAGS" | grep -q -e '-O'; then
501 CFLAGS="$CFLAGS -O0"
502 fi
Dan Nicholson23656c42007-12-12 09:02:31 -0800503 fi
504 if test "x$GXX" = xyes; then
Ian Romanick66decc72014-07-14 11:22:20 -0700505 if ! echo "$CXXFLAGS" | grep -q -e '-g'; then
506 CXXFLAGS="$CXXFLAGS -g"
507 fi
508 if ! echo "$CXXFLAGS" | grep -q -e '-O'; then
509 CXXFLAGS="$CXXFLAGS -O0"
510 fi
Dan Nicholson23656c42007-12-12 09:02:31 -0800511 fi
Matt Turnerb21ad122015-02-20 12:41:46 -0800512else
513 DEFINES="$DEFINES -DNDEBUG"
Dan Nicholson23656c42007-12-12 09:02:31 -0800514fi
Dan Nicholson88586332007-11-15 08:59:57 -0800515
516dnl
Jon TURNEYff90a872014-05-11 14:38:52 +0100517dnl Check if linker supports -Bsymbolic
518dnl
519save_LDFLAGS=$LDFLAGS
520LDFLAGS="$LDFLAGS -Wl,-Bsymbolic"
521AC_MSG_CHECKING([if ld supports -Bsymbolic])
522AC_LINK_IFELSE(
523 [AC_LANG_SOURCE([int main() { return 0;}])],
524 [AC_MSG_RESULT([yes])
525 BSYMBOLIC="-Wl,-Bsymbolic";],
526 [AC_MSG_RESULT([no])
527 BSYMBOLIC="";])
528LDFLAGS=$save_LDFLAGS
529
530AC_SUBST([BSYMBOLIC])
531
532dnl
Emil Velikovd681b222014-03-11 17:58:08 +0000533dnl Check if linker supports garbage collection
534dnl
535save_LDFLAGS=$LDFLAGS
536LDFLAGS="$LDFLAGS -Wl,--gc-sections"
537AC_MSG_CHECKING([whether ld supports --gc-sections])
538AC_LINK_IFELSE(
539 [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])],
540 [AC_MSG_RESULT([yes])
541 GC_SECTIONS="-Wl,--gc-sections";],
542 [AC_MSG_RESULT([no])
543 GC_SECTIONS="";])
544LDFLAGS=$save_LDFLAGS
545
546AC_SUBST([GC_SECTIONS])
547
548dnl
Emil Velikovf57d0922014-05-13 01:33:48 +0100549dnl OpenBSD does not have DT_NEEDED entries for libc by design
550dnl so when these flags are passed to ld via libtool the checks will fail
551dnl
552case "$host_os" in
Vinson Lee5dd927b2014-05-21 22:13:13 -0700553openbsd* | darwin* )
Emil Velikovf57d0922014-05-13 01:33:48 +0100554 LD_NO_UNDEFINED="" ;;
555*)
556 LD_NO_UNDEFINED="-Wl,--no-undefined" ;;
557esac
558
559AC_SUBST([LD_NO_UNDEFINED])
560
561dnl
Jon TURNEYff90a872014-05-11 14:38:52 +0100562dnl Check if linker supports version scripts
563dnl
564AC_MSG_CHECKING([if the linker supports version-scripts])
565save_LDFLAGS=$LDFLAGS
566LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
567cat > conftest.map <<EOF
568VERSION_1 {
569 global:
570 main;
571
572 local:
573 *;
574};
575EOF
576AC_LINK_IFELSE(
577 [AC_LANG_SOURCE([int main() { return 0;}])],
578 [have_ld_version_script=yes;AC_MSG_RESULT(yes)],
579 [have_ld_version_script=no; AC_MSG_RESULT(no)])
580LDFLAGS=$save_LDFLAGS
581AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
582
583dnl
Jonathan Gray635477d2014-09-02 02:08:00 +1000584dnl Check if linker supports dynamic list files
585dnl
586AC_MSG_CHECKING([if the linker supports --dynamic-list])
587save_LDFLAGS=$LDFLAGS
588LDFLAGS="$LDFLAGS -Wl,--dynamic-list=conftest.dyn"
589cat > conftest.dyn <<EOF
590{
591 radeon_drm_winsys_create;
592};
593EOF
594AC_LINK_IFELSE(
595 [AC_LANG_SOURCE([int main() { return 0;}])],
596 [have_ld_dynamic_list=yes;AC_MSG_RESULT(yes)],
597 [have_ld_dynamic_list=no; AC_MSG_RESULT(no)])
598LDFLAGS=$save_LDFLAGS
599AM_CONDITIONAL(HAVE_LD_DYNAMIC_LIST, test "$have_ld_dynamic_list" = "yes")
600
601dnl
Emil Velikov22c13352014-03-09 11:50:44 +0000602dnl compatibility symlinks
603dnl
604case "$host_os" in
605linux* )
606 HAVE_COMPAT_SYMLINKS=yes ;;
607* )
608 HAVE_COMPAT_SYMLINKS=no ;;
609esac
610
611AM_CONDITIONAL(HAVE_COMPAT_SYMLINKS, test "x$HAVE_COMPAT_SYMLINKS" = xyes)
612
613dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -0700614dnl library names
615dnl
Jon TURNEYadeba942015-09-04 14:00:19 +0100616dnl Unfortunately we need to do a few things that libtool can't help us with,
617dnl so we need some knowledge of shared library filenames:
618dnl
619dnl LIB_EXT is the extension used when creating symlinks for alternate
620dnl filenames for a shared library which will be dynamically loaded
621dnl
622dnl IMP_LIB_EXT is the extension used when checking for the presence of a
623dnl the file for a shared library we wish to link with
624dnl
Emil Velikova6efbac2014-03-11 11:50:37 +0000625case "$host_os" in
626darwin* )
Jon TURNEYadeba942015-09-04 14:00:19 +0100627 LIB_EXT='dylib'
628 IMP_LIB_EXT=$LIB_EXT
629 ;;
Emil Velikova6efbac2014-03-11 11:50:37 +0000630cygwin* )
Jon TURNEYadeba942015-09-04 14:00:19 +0100631 LIB_EXT='dll'
632 IMP_LIB_EXT='dll.a'
633 ;;
Emil Velikova6efbac2014-03-11 11:50:37 +0000634aix* )
Jon TURNEYadeba942015-09-04 14:00:19 +0100635 LIB_EXT='a'
636 IMP_LIB_EXT=$LIB_EXT
637 ;;
Emil Velikova6efbac2014-03-11 11:50:37 +0000638* )
Jon TURNEYadeba942015-09-04 14:00:19 +0100639 LIB_EXT='so'
640 IMP_LIB_EXT=$LIB_EXT
641 ;;
Emil Velikova6efbac2014-03-11 11:50:37 +0000642esac
Emil Velikovbba9c282014-03-08 19:48:04 +0000643
644AC_SUBST([LIB_EXT])
645
Brad Kingf3cdcb82012-06-05 13:59:58 -0400646AC_ARG_WITH([gl-lib-name],
647 [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
648 [specify GL library name @<:@default=GL@:>@])],
649 [GL_LIB=$withval],
650 [GL_LIB=GL])
Brad Kingf3cdcb82012-06-05 13:59:58 -0400651AC_ARG_WITH([osmesa-lib-name],
652 [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
653 [specify OSMesa library name @<:@default=OSMesa@:>@])],
654 [OSMESA_LIB=$withval],
655 [OSMESA_LIB=OSMesa])
656AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
Brad Kingf3cdcb82012-06-05 13:59:58 -0400657AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
Dan Nicholson8217f242009-02-11 15:16:00 -0800658
Marek Olšák848f7d32011-04-01 01:12:41 +0200659dnl
Tom Fogalc0573fb2011-10-10 10:33:18 -0600660dnl Mangled Mesa support
661dnl
662AC_ARG_ENABLE([mangling],
663 [AS_HELP_STRING([--enable-mangling],
664 [enable mangled symbols and library name @<:@default=disabled@:>@])],
665 [enable_mangling="${enableval}"],
666 [enable_mangling=no]
667)
Tom Fogalc0573fb2011-10-10 10:33:18 -0600668if test "x${enable_mangling}" = "xyes" ; then
669 DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
Brad Kingf3cdcb82012-06-05 13:59:58 -0400670 GL_LIB="Mangled${GL_LIB}"
Brad Kingf3cdcb82012-06-05 13:59:58 -0400671 OSMESA_LIB="Mangled${OSMESA_LIB}"
Tom Fogalc0573fb2011-10-10 10:33:18 -0600672fi
673AC_SUBST([GL_LIB])
Tom Fogalc0573fb2011-10-10 10:33:18 -0600674AC_SUBST([OSMESA_LIB])
675
676dnl
Marek Olšák848f7d32011-04-01 01:12:41 +0200677dnl potentially-infringing-but-nobody-knows-for-sure stuff
678dnl
679AC_ARG_ENABLE([texture-float],
680 [AS_HELP_STRING([--enable-texture-float],
681 [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
682 [enable_texture_float="$enableval"],
683 [enable_texture_float=no]
684)
685if test "x$enable_texture_float" = xyes; then
686 AC_MSG_WARN([Floating-point textures enabled.])
687 AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
688 DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
689fi
690
Dan Nicholsondca1b792007-10-23 09:25:58 -0700691dnl
Dan Nicholson871125a2008-06-04 13:00:35 -0700692dnl Arch/platform-specific settings
693dnl
694AC_ARG_ENABLE([asm],
695 [AS_HELP_STRING([--disable-asm],
696 [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
697 [enable_asm="$enableval"],
698 [enable_asm=yes]
699)
700asm_arch=""
Dan Nicholson871125a2008-06-04 13:00:35 -0700701AC_MSG_CHECKING([whether to enable assembly])
702test "x$enable_asm" = xno && AC_MSG_RESULT([no])
703# disable if cross compiling on x86/x86_64 since we must run gen_matypes
Matt Turner585e2502014-09-21 13:22:28 -0700704if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then
Dan Nicholson871125a2008-06-04 13:00:35 -0700705 case "$host_cpu" in
Jean-Sébastien Pédron148f0de2013-06-05 13:27:37 +0200706 i?86 | x86_64 | amd64)
Dongwon Kim49eb5e72016-02-16 10:05:24 -0800707 if test "x$host_cpu" != "x$target_cpu"; then
708 enable_asm=no
709 AC_MSG_RESULT([no, cross compiling])
710 fi
Dan Nicholson871125a2008-06-04 13:00:35 -0700711 ;;
712 esac
713fi
714# check for supported arches
715if test "x$enable_asm" = xyes; then
716 case "$host_cpu" in
717 i?86)
718 case "$host_os" in
Emil Velikov395ce0b2014-08-13 18:05:56 +0100719 linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | gnu*)
Andreas Boll06fff292013-03-16 13:50:19 +0100720 asm_arch=x86
721 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700722 esac
723 ;;
Jean-Sébastien Pédron148f0de2013-06-05 13:27:37 +0200724 x86_64|amd64)
Dan Nicholson871125a2008-06-04 13:00:35 -0700725 case "$host_os" in
Jonathan Gray78fbb412013-06-26 17:11:57 +1000726 linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
Emil Velikov395ce0b2014-08-13 18:05:56 +0100727 asm_arch=x86_64
Dan Nicholson871125a2008-06-04 13:00:35 -0700728 ;;
729 esac
730 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800731 sparc*)
732 case "$host_os" in
733 linux*)
734 asm_arch=sparc
735 ;;
736 esac
737 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700738 esac
739
740 case "$asm_arch" in
741 x86)
Eric Anholte4269492012-06-11 10:25:05 -0700742 DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
Dan Nicholson871125a2008-06-04 13:00:35 -0700743 AC_MSG_RESULT([yes, x86])
744 ;;
Jean-Sébastien Pédron148f0de2013-06-05 13:27:37 +0200745 x86_64|amd64)
Eric Anholte4269492012-06-11 10:25:05 -0700746 DEFINES="$DEFINES -DUSE_X86_64_ASM"
Dan Nicholson871125a2008-06-04 13:00:35 -0700747 AC_MSG_RESULT([yes, x86_64])
748 ;;
David S. Miller857ac1e2009-02-26 05:35:15 -0800749 sparc)
Eric Anholte4269492012-06-11 10:25:05 -0700750 DEFINES="$DEFINES -DUSE_SPARC_ASM"
David S. Miller857ac1e2009-02-26 05:35:15 -0800751 AC_MSG_RESULT([yes, sparc])
752 ;;
Dan Nicholson871125a2008-06-04 13:00:35 -0700753 *)
754 AC_MSG_RESULT([no, platform not supported])
755 ;;
756 esac
757fi
Dan Nicholson871125a2008-06-04 13:00:35 -0700758
Chia-I Wub039dbf2014-08-20 14:40:23 +0800759AC_CHECK_HEADER([xlocale.h], [DEFINES="$DEFINES -DHAVE_XLOCALE_H"])
Alan Coopersmith31cd2d72015-05-15 19:05:45 -0700760AC_CHECK_HEADER([sys/sysctl.h], [DEFINES="$DEFINES -DHAVE_SYS_SYSCTL_H"])
Chia-I Wub039dbf2014-08-20 14:40:23 +0800761AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"])
Emil Velikoveb3e2562015-07-10 12:28:23 +0100762AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"])
Chia-I Wub039dbf2014-08-20 14:40:23 +0800763
Dan Nicholson871125a2008-06-04 13:00:35 -0700764dnl Check to see if dlopen is in default libraries (like Solaris, which
765dnl has it in libc), or if libdl is needed to get it.
Tapani Pälli57c57df2012-08-16 13:59:12 +0300766AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
767 [AC_CHECK_LIB([dl], [dlopen],
768 [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
Chia-I Wu08f4bc02010-07-16 20:09:29 +0800769AC_SUBST([DLOPEN_LIBS])
Dan Nicholson871125a2008-06-04 13:00:35 -0700770
Jon TURNEYec8ebff2014-04-05 17:11:45 +0100771dnl Check if that library also has dladdr
Jon TURNEYa2e1dc02014-08-08 20:13:18 +0100772save_LIBS="$LIBS"
773LIBS="$LIBS $DLOPEN_LIBS"
774AC_CHECK_FUNCS([dladdr])
775LIBS="$save_LIBS"
Jon TURNEYec8ebff2014-04-05 17:11:45 +0100776
Vinson Lee990bd492013-01-26 22:50:05 -0800777case "$host_os" in
Jose Fonseca8f0274c2015-03-19 13:38:52 +0000778darwin*)
Vinson Lee990bd492013-01-26 22:50:05 -0800779 ;;
780*)
781 AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
782 [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
Matt Turner180e60d2014-06-10 18:08:10 -0700783 [AC_MSG_ERROR([Could not find clock_gettime])])])
Vinson Lee990bd492013-01-26 22:50:05 -0800784 AC_SUBST([CLOCK_LIB])
785 ;;
786esac
Dave Airlieec835352012-12-04 09:25:13 +1000787
Dan Nicholson985e1cd2008-06-04 13:17:06 -0700788dnl See if posix_memalign is available
789AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
790
Matt Turner7da12422012-09-18 20:21:47 -0700791dnl Check for pthreads
Jose Fonseca8f0274c2015-03-19 13:38:52 +0000792AX_PTHREAD
793if test "x$ax_pthread_ok" = xno; then
794 AC_MSG_ERROR([Building mesa on this platform requires pthreads])
795fi
Matt Turnerdd4fde82012-09-27 15:49:52 -0700796dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
797dnl to -pthread, which causes problems if we need -lpthread to appear in
798dnl pkgconfig files.
799test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
Matt Turner7da12422012-09-18 20:21:47 -0700800
Dan Nicholson871125a2008-06-04 13:00:35 -0700801dnl SELinux awareness.
802AC_ARG_ENABLE([selinux],
803 [AS_HELP_STRING([--enable-selinux],
804 [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
805 [MESA_SELINUX="$enableval"],
806 [MESA_SELINUX=no])
807if test "x$enable_selinux" = "xyes"; then
Kusanagi Kouichi6ba43922014-02-15 11:53:00 +0900808 PKG_CHECK_MODULES([SELINUX], [libselinux], [],
809 [AC_CHECK_HEADER([selinux/selinux.h],[],
810 [AC_MSG_ERROR([SELinux headers not found])])
811 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
812 [AC_MSG_ERROR([SELinux library not found])])
813 SELINUX_LIBS="-lselinux"])
Dan Nicholson871125a2008-06-04 13:00:35 -0700814 DEFINES="$DEFINES -DMESA_SELINUX"
815fi
Kusanagi Kouichi6ba43922014-02-15 11:53:00 +0900816AC_SUBST([SELINUX_CFLAGS])
Matt Turner9ed00072012-09-18 20:22:37 -0700817AC_SUBST([SELINUX_LIBS])
Dan Nicholson871125a2008-06-04 13:00:35 -0700818
Marek Olšák440d71d2011-06-14 05:38:58 +0200819dnl Options for APIs
Chia-I Wube5f34a2010-10-27 16:14:27 +0800820AC_ARG_ENABLE([opengl],
821 [AS_HELP_STRING([--disable-opengl],
Emil Velikova662fa92014-09-22 18:58:19 +0100822 [disable support for standard OpenGL API @<:@default=enabled@:>@])],
Chia-I Wube5f34a2010-10-27 16:14:27 +0800823 [enable_opengl="$enableval"],
824 [enable_opengl=yes])
825AC_ARG_ENABLE([gles1],
Marek Olšákdd048542015-05-26 12:47:03 +0200826 [AS_HELP_STRING([--disable-gles1],
827 [disable support for OpenGL ES 1.x API @<:@default=enabled@:>@])],
Chia-I Wube5f34a2010-10-27 16:14:27 +0800828 [enable_gles1="$enableval"],
Marek Olšákdd048542015-05-26 12:47:03 +0200829 [enable_gles1=yes])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800830AC_ARG_ENABLE([gles2],
Marek Olšákdd048542015-05-26 12:47:03 +0200831 [AS_HELP_STRING([--disable-gles2],
832 [disable support for OpenGL ES 2.x API @<:@default=enabled@:>@])],
Chia-I Wube5f34a2010-10-27 16:14:27 +0800833 [enable_gles2="$enableval"],
Marek Olšákdd048542015-05-26 12:47:03 +0200834 [enable_gles2=yes])
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900835
836AC_ARG_ENABLE([dri],
837 [AS_HELP_STRING([--enable-dri],
Matt Turner32e8ce62012-08-17 14:05:56 -0700838 [enable DRI modules @<:@default=enabled@:>@])],
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900839 [enable_dri="$enableval"],
Matt Turner32e8ce62012-08-17 14:05:56 -0700840 [enable_dri=yes])
Emil Velikov23740ed2014-03-21 18:09:36 +0000841
842case "$host_os" in
843linux*)
844 dri3_default=yes
845 ;;
846*)
847 dri3_default=no
848 ;;
849esac
Emil Velikovb89d1b22015-11-22 22:05:01 +0000850
851if test "x$enable_dri" = xno; then
852 dri3_default=no
853fi
854
Armin Kf0f202e2013-11-09 00:06:45 +0100855AC_ARG_ENABLE([dri3],
856 [AS_HELP_STRING([--enable-dri3],
Emil Velikov23740ed2014-03-21 18:09:36 +0000857 [enable DRI3 @<:@default=auto@:>@])],
Armin Kf0f202e2013-11-09 00:06:45 +0100858 [enable_dri3="$enableval"],
Emil Velikov23740ed2014-03-21 18:09:36 +0000859 [enable_dri3="$dri3_default"])
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900860AC_ARG_ENABLE([glx],
861 [AS_HELP_STRING([--enable-glx],
Matt Turner32e8ce62012-08-17 14:05:56 -0700862 [enable GLX library @<:@default=enabled@:>@])],
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900863 [enable_glx="$enableval"],
Matt Turner32e8ce62012-08-17 14:05:56 -0700864 [enable_glx=yes])
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900865AC_ARG_ENABLE([osmesa],
866 [AS_HELP_STRING([--enable-osmesa],
Matt Turner32e8ce62012-08-17 14:05:56 -0700867 [enable OSMesa library @<:@default=disabled@:>@])],
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900868 [enable_osmesa="$enableval"],
Matt Turner32e8ce62012-08-17 14:05:56 -0700869 [enable_osmesa=no])
Matt Turner2f142d52013-08-20 14:16:17 -0700870AC_ARG_ENABLE([gallium-osmesa],
871 [AS_HELP_STRING([--enable-gallium-osmesa],
872 [enable Gallium implementation of the OSMesa library @<:@default=disabled@:>@])],
873 [enable_gallium_osmesa="$enableval"],
874 [enable_gallium_osmesa=no])
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900875AC_ARG_ENABLE([egl],
876 [AS_HELP_STRING([--disable-egl],
877 [disable EGL library @<:@default=enabled@:>@])],
878 [enable_egl="$enableval"],
879 [enable_egl=yes])
880
Thomas Hellstrom424b1212011-07-04 10:21:35 +0200881AC_ARG_ENABLE([xa],
882 [AS_HELP_STRING([--enable-xa],
Emil Velikova662fa92014-09-22 18:58:19 +0100883 [enable build of the XA X Acceleration API @<:@default=disabled@:>@])],
Thomas Hellstrom424b1212011-07-04 10:21:35 +0200884 [enable_xa="$enableval"],
885 [enable_xa=no])
Benjamin Franzkeeddcecb2011-05-26 15:09:39 +0200886AC_ARG_ENABLE([gbm],
887 [AS_HELP_STRING([--enable-gbm],
888 [enable gbm library @<:@default=auto@:>@])],
889 [enable_gbm="$enableval"],
890 [enable_gbm=auto])
Joakim Sindholtfdd96572011-08-04 15:14:06 +0200891AC_ARG_ENABLE([nine],
892 [AS_HELP_STRING([--enable-nine],
893 [enable build of the nine Direct3D9 API @<:@default=no@:>@])],
894 [enable_nine="$enableval"],
895 [enable_nine=no])
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900896
Christian Königc3b22302011-07-04 15:04:41 +0200897AC_ARG_ENABLE([xvmc],
898 [AS_HELP_STRING([--enable-xvmc],
899 [enable xvmc library @<:@default=auto@:>@])],
900 [enable_xvmc="$enableval"],
Emil Velikovc6e58012014-08-17 23:56:19 +0100901 [enable_xvmc=auto])
Christian Königc3b22302011-07-04 15:04:41 +0200902AC_ARG_ENABLE([vdpau],
903 [AS_HELP_STRING([--enable-vdpau],
904 [enable vdpau library @<:@default=auto@:>@])],
905 [enable_vdpau="$enableval"],
906 [enable_vdpau=auto])
Christian König15e39ca2013-08-05 11:41:27 -0600907AC_ARG_ENABLE([omx],
908 [AS_HELP_STRING([--enable-omx],
Emil Velikova662fa92014-09-22 18:58:19 +0100909 [enable OpenMAX library @<:@default=disabled@:>@])],
Christian König15e39ca2013-08-05 11:41:27 -0600910 [enable_omx="$enableval"],
911 [enable_omx=no])
Christian König38679332014-07-02 16:35:28 -0400912AC_ARG_ENABLE([va],
913 [AS_HELP_STRING([--enable-va],
914 [enable va library @<:@default=auto@:>@])],
915 [enable_va="$enableval"],
916 [enable_va=auto])
Francisco Jerezc6db1b32012-04-20 16:56:19 +0200917AC_ARG_ENABLE([opencl],
918 [AS_HELP_STRING([--enable-opencl],
Emil Velikova662fa92014-09-22 18:58:19 +0100919 [enable OpenCL library @<:@default=disabled@:>@])],
Emil Velikov065b6ca2014-03-04 20:02:35 +0000920 [enable_opencl="$enableval"],
Francisco Jerezc6db1b32012-04-20 16:56:19 +0200921 [enable_opencl=no])
Tom Stellard07567c12013-09-18 00:36:55 -0700922AC_ARG_ENABLE([opencl_icd],
923 [AS_HELP_STRING([--enable-opencl-icd],
924 [Build an OpenCL ICD library to be loaded by an ICD implementation
Emil Velikova662fa92014-09-22 18:58:19 +0100925 @<:@default=disabled@:>@])],
Tom Stellard07567c12013-09-18 00:36:55 -0700926 [enable_opencl_icd="$enableval"],
927 [enable_opencl_icd=no])
Matt Turnerc09a4cb2013-03-09 17:35:12 -0800928AC_ARG_ENABLE([xlib-glx],
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900929 [AS_HELP_STRING([--enable-xlib-glx],
Matt Turner32e8ce62012-08-17 14:05:56 -0700930 [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900931 [enable_xlib_glx="$enableval"],
Matt Turner32e8ce62012-08-17 14:05:56 -0700932 [enable_xlib_glx=no])
Chia-I Wube5f34a2010-10-27 16:14:27 +0800933
Matt Turnerc09a4cb2013-03-09 17:35:12 -0800934AC_ARG_ENABLE([gallium-tests],
Francisco Jerez66f7fd92012-04-25 22:16:26 +0200935 [AS_HELP_STRING([--enable-gallium-tests],
Emil Velikova662fa92014-09-22 18:58:19 +0100936 [Enable optional Gallium tests) @<:@default=disabled@:>@])],
Francisco Jerez66f7fd92012-04-25 22:16:26 +0200937 [enable_gallium_tests="$enableval"],
938 [enable_gallium_tests=no])
939
Marek Olšák58b6a192011-06-14 07:46:59 +0200940# Option for Gallium drivers
Damien Lespiau164a04e2013-01-14 13:54:57 +0000941
942# Keep this in sync with the --with-gallium-drivers help string default value
Thomas Hellstrom87118d82012-01-12 12:10:53 +0100943GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
Marek Olšák58b6a192011-06-14 07:46:59 +0200944
945AC_ARG_WITH([gallium-drivers],
946 [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
947 [comma delimited Gallium drivers list, e.g.
Dave Airliea8987b82015-01-22 15:11:47 +1000948 "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast,vc4,virgl"
Damien Lespiau164a04e2013-01-14 13:54:57 +0000949 @<:@default=r300,r600,svga,swrast@:>@])],
Marek Olšák58b6a192011-06-14 07:46:59 +0200950 [with_gallium_drivers="$withval"],
951 [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
Chia-I Wu156e9552010-10-30 14:26:01 +0800952
Ian Romanickdb311b42011-06-22 11:35:27 -0700953# Doing '--without-gallium-drivers' will set this variable to 'no'. Clear it
954# here so that the script doesn't choke on an unknown driver name later.
955case "$with_gallium_drivers" in
956 yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
957 no) with_gallium_drivers='' ;;
958esac
959
Chia-I Wube5f34a2010-10-27 16:14:27 +0800960if test "x$enable_opengl" = xno -a \
961 "x$enable_gles1" = xno -a \
962 "x$enable_gles2" = xno -a \
Joakim Sindholtfdd96572011-08-04 15:14:06 +0200963 "x$enable_nine" = xno -a \
Thomas Hellstrom424b1212011-07-04 10:21:35 +0200964 "x$enable_xa" = xno -a \
Christian Königc3b22302011-07-04 15:04:41 +0200965 "x$enable_xvmc" = xno -a \
966 "x$enable_vdpau" = xno -a \
Christian König15e39ca2013-08-05 11:41:27 -0600967 "x$enable_omx" = xno -a \
Christian König38679332014-07-02 16:35:28 -0400968 "x$enable_va" = xno -a \
Francisco Jerezc6db1b32012-04-20 16:56:19 +0200969 "x$enable_opencl" = xno; then
Chia-I Wube5f34a2010-10-27 16:14:27 +0800970 AC_MSG_ERROR([at least one API should be enabled])
971fi
972
Andreas Boll723b7832013-02-01 13:39:42 +0100973# Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
974if test "x$enable_opengl" = xno -a \
975 "x$enable_gles1" = xyes; then
976 AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
977fi
978
979if test "x$enable_opengl" = xno -a \
980 "x$enable_gles2" = xyes; then
981 AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
982fi
983
Matt Turner691c3042013-01-18 23:43:05 -0800984AM_CONDITIONAL(HAVE_OPENGL, test "x$enable_opengl" = xyes)
985AM_CONDITIONAL(HAVE_OPENGL_ES1, test "x$enable_gles1" = xyes)
986AM_CONDITIONAL(HAVE_OPENGL_ES2, test "x$enable_gles2" = xyes)
987AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \
988 "x$enable_gles1" = xyes -o \
989 "x$enable_gles2" = xyes)
990
Kenneth Graunke9d21b5d2012-01-04 23:49:18 -0800991if test "x$enable_glx" = xno; then
Matt Turner32e8ce62012-08-17 14:05:56 -0700992 AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
Kenneth Graunke9d21b5d2012-01-04 23:49:18 -0800993 enable_xlib_glx=no
994fi
Chia-I Wu9e7a4142011-06-26 13:24:32 +0900995
Emil Velikov1a568e02014-03-04 02:13:48 +0000996if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
997 AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
Matt Turner32e8ce62012-08-17 14:05:56 -0700998fi
999
Michel Dänzer3b888f52013-01-31 11:47:55 +01001000if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
1001 AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
1002fi
1003
1004# Disable GLX if OpenGL is not enabled
1005if test "x$enable_glx$enable_opengl" = xyesno; then
1006 AC_MSG_WARN([OpenGL not enabled, disabling GLX])
1007 enable_glx=no
1008fi
1009
Emil Velikov1a568e02014-03-04 02:13:48 +00001010# Disable GLX if DRI and Xlib-GLX are not enabled
Matt Turner32e8ce62012-08-17 14:05:56 -07001011if test "x$enable_glx" = xyes -a \
Emil Velikov1a568e02014-03-04 02:13:48 +00001012 "x$enable_dri" = xno -a \
Matt Turner32e8ce62012-08-17 14:05:56 -07001013 "x$enable_xlib_glx" = xno; then
Emil Velikov1a568e02014-03-04 02:13:48 +00001014 AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
Matt Turner32e8ce62012-08-17 14:05:56 -07001015 enable_glx=no
1016fi
1017
Matt Turnera9676ae2013-01-18 23:59:49 -08001018AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
Emil Velikov1a568e02014-03-04 02:13:48 +00001019 "x$enable_dri" = xyes)
Jon TURNEY45f9aae2014-05-12 10:17:06 +01001020
Emil Velikov16f6d432015-07-09 21:19:15 +01001021# Check for libdrm
1022PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
1023 [have_libdrm=yes], [have_libdrm=no])
1024if test "x$have_libdrm" = xyes; then
1025 DEFINES="$DEFINES -DHAVE_LIBDRM"
1026fi
1027
Jon TURNEY45f9aae2014-05-12 10:17:06 +01001028# Select which platform-dependent DRI code gets built
1029case "$host_os" in
1030darwin*)
1031 dri_platform='apple' ;;
Jose Fonseca8f0274c2015-03-19 13:38:52 +00001032gnu*|cygwin*)
Jon TURNEY45f9aae2014-05-12 10:17:06 +01001033 dri_platform='none' ;;
1034*)
1035 dri_platform='drm' ;;
1036esac
1037
Emil Velikovbe430722015-10-11 11:53:45 +01001038if test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes; then
1039 have_drisw_kms='yes'
1040fi
1041
Jon TURNEY45f9aae2014-05-12 10:17:06 +01001042AM_CONDITIONAL(HAVE_DRICOMMON, test "x$enable_dri" = xyes )
1043AM_CONDITIONAL(HAVE_DRISW, test "x$enable_dri" = xyes )
Emil Velikovbe430722015-10-11 11:53:45 +01001044AM_CONDITIONAL(HAVE_DRISW_KMS, test "x$have_drisw_kms" = xyes )
Emil Velikov16f6d432015-07-09 21:19:15 +01001045AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
1046AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes -a "x$dri_platform" = xdrm -a "x$have_libdrm" = xyes )
Matt Turner585e2502014-09-21 13:22:28 -07001047AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = xapple )
Matt Turner06ad64a2012-01-15 21:30:26 -05001048
Matt Turner8c9b78a2012-08-17 14:22:47 -07001049AC_ARG_ENABLE([shared-glapi],
1050 [AS_HELP_STRING([--enable-shared-glapi],
Emil Velikova662fa92014-09-22 18:58:19 +01001051 [Enable shared glapi for OpenGL @<:@default=enabled@:>@])],
Matt Turner8c9b78a2012-08-17 14:22:47 -07001052 [enable_shared_glapi="$enableval"],
Emil Velikov0432aa02014-02-19 00:54:04 +00001053 [enable_shared_glapi=yes])
Matt Turner8c9b78a2012-08-17 14:22:47 -07001054
Emil Velikov0432aa02014-02-19 00:54:04 +00001055case "x$enable_opengl$enable_gles1$enable_gles2" in
1056x*yes*yes*)
1057 if test "x$enable_shared_glapi" = xno; then
1058 AC_MSG_ERROR([shared GLAPI required when building two or more of
1059 the following APIs - opengl, gles1 gles2])
1060 fi
1061 ;;
1062esac
Matt Turner8c9b78a2012-08-17 14:22:47 -07001063
Matt Turner8c9b78a2012-08-17 14:22:47 -07001064AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
1065
Emil Velikov44ec4682014-09-08 23:52:46 +01001066# Build the pipe-drivers as separate libraries/modules.
1067# Do not touch this unless you know what you are doing.
1068# XXX: Expose via configure option ?
1069enable_shared_pipe_drivers=no
1070
Dan Nicholson44d99142007-12-05 18:47:01 -08001071dnl
1072dnl Driver specific build directories
Dan Nicholsondca1b792007-10-23 09:25:58 -07001073dnl
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001074
Emil Velikov132031b2015-06-29 13:28:33 +01001075if test -n "$with_gallium_drivers" -a "x$enable_glx$enable_xlib_glx" = xyesyes; then
Matt Turnerb3f1f662013-01-20 15:32:08 -08001076 NEED_WINSYS_XLIB="yes"
Emil Velikov132031b2015-06-29 13:28:33 +01001077fi
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001078
Matt Turner2f142d52013-08-20 14:16:17 -07001079if test "x$enable_gallium_osmesa" = xyes; then
Emil Velikove8e11582014-03-12 00:36:21 +00001080 if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
1081 AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver])
Matt Turner2f142d52013-08-20 14:16:17 -07001082 fi
1083 if test "x$enable_osmesa" = xyes; then
1084 AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
1085 fi
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001086fi
1087
Dave Airlie81fe1982010-04-22 14:59:29 +10001088AC_SUBST([MESA_LLVM])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001089
Carl Wortha24bdce2014-12-12 13:55:30 -08001090# SHA1 hashing
1091AC_ARG_WITH([sha1],
1092 [AS_HELP_STRING([--with-sha1=libc|libmd|libnettle|libgcrypt|libcrypto|libsha1|CommonCrypto|CryptoAPI],
1093 [choose SHA1 implementation])])
1094case "x$with_sha1" in
1095x | xlibc | xlibmd | xlibnettle | xlibgcrypt | xlibcrypto | xlibsha1 | xCommonCrypto | xCryptoAPI)
1096 ;;
1097*)
1098 AC_MSG_ERROR([Illegal value for --with-sha1: $with_sha1])
1099esac
1100
1101AC_CHECK_FUNC([SHA1Init], [HAVE_SHA1_IN_LIBC=yes])
1102if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_LIBC" = xyes; then
1103 with_sha1=libc
1104fi
1105if test "x$with_sha1" = xlibc && test "x$HAVE_SHA1_IN_LIBC" != xyes; then
1106 AC_MSG_ERROR([sha1 in libc requested but not found])
1107fi
1108if test "x$with_sha1" = xlibc; then
1109 AC_DEFINE([HAVE_SHA1_IN_LIBC], [1],
1110 [Use libc SHA1 functions])
1111 SHA1_LIBS=""
1112fi
1113AC_CHECK_FUNC([CC_SHA1_Init], [HAVE_SHA1_IN_COMMONCRYPTO=yes])
1114if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_COMMONCRYPTO" = xyes; then
1115 with_sha1=CommonCrypto
1116fi
1117if test "x$with_sha1" = xCommonCrypto && test "x$HAVE_SHA1_IN_COMMONCRYPTO" != xyes; then
1118 AC_MSG_ERROR([CommonCrypto requested but not found])
1119fi
1120if test "x$with_sha1" = xCommonCrypto; then
1121 AC_DEFINE([HAVE_SHA1_IN_COMMONCRYPTO], [1],
1122 [Use CommonCrypto SHA1 functions])
1123 SHA1_LIBS=""
1124fi
1125dnl stdcall functions cannot be tested with AC_CHECK_LIB
1126AC_CHECK_HEADER([wincrypt.h], [HAVE_SHA1_IN_CRYPTOAPI=yes], [], [#include <windows.h>])
1127if test "x$with_sha1" = x && test "x$HAVE_SHA1_IN_CRYPTOAPI" = xyes; then
1128 with_sha1=CryptoAPI
1129fi
1130if test "x$with_sha1" = xCryptoAPI && test "x$HAVE_SHA1_IN_CRYPTOAPI" != xyes; then
1131 AC_MSG_ERROR([CryptoAPI requested but not found])
1132fi
1133if test "x$with_sha1" = xCryptoAPI; then
1134 AC_DEFINE([HAVE_SHA1_IN_CRYPTOAPI], [1],
1135 [Use CryptoAPI SHA1 functions])
1136 SHA1_LIBS=""
1137fi
1138AC_CHECK_LIB([md], [SHA1Init], [HAVE_LIBMD=yes])
1139if test "x$with_sha1" = x && test "x$HAVE_LIBMD" = xyes; then
1140 with_sha1=libmd
1141fi
1142if test "x$with_sha1" = xlibmd && test "x$HAVE_LIBMD" != xyes; then
1143 AC_MSG_ERROR([libmd requested but not found])
1144fi
1145if test "x$with_sha1" = xlibmd; then
1146 AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
1147 [Use libmd SHA1 functions])
1148 SHA1_LIBS=-lmd
1149fi
1150PKG_CHECK_MODULES([LIBSHA1], [libsha1], [HAVE_LIBSHA1=yes], [HAVE_LIBSHA1=no])
1151if test "x$with_sha1" = x && test "x$HAVE_LIBSHA1" = xyes; then
1152 with_sha1=libsha1
1153fi
1154if test "x$with_sha1" = xlibsha1 && test "x$HAVE_LIBSHA1" != xyes; then
1155 AC_MSG_ERROR([libsha1 requested but not found])
1156fi
1157if test "x$with_sha1" = xlibsha1; then
1158 AC_DEFINE([HAVE_SHA1_IN_LIBSHA1], [1],
1159 [Use libsha1 for SHA1])
1160 SHA1_LIBS=-lsha1
1161fi
1162AC_CHECK_LIB([nettle], [nettle_sha1_init], [HAVE_LIBNETTLE=yes])
1163if test "x$with_sha1" = x && test "x$HAVE_LIBNETTLE" = xyes; then
1164 with_sha1=libnettle
1165fi
1166if test "x$with_sha1" = xlibnettle && test "x$HAVE_LIBNETTLE" != xyes; then
1167 AC_MSG_ERROR([libnettle requested but not found])
1168fi
1169if test "x$with_sha1" = xlibnettle; then
1170 AC_DEFINE([HAVE_SHA1_IN_LIBNETTLE], [1],
1171 [Use libnettle SHA1 functions])
1172 SHA1_LIBS=-lnettle
1173fi
1174AC_CHECK_LIB([gcrypt], [gcry_md_open], [HAVE_LIBGCRYPT=yes])
1175if test "x$with_sha1" = x && test "x$HAVE_LIBGCRYPT" = xyes; then
1176 with_sha1=libgcrypt
1177fi
1178if test "x$with_sha1" = xlibgcrypt && test "x$HAVE_LIBGCRYPT" != xyes; then
1179 AC_MSG_ERROR([libgcrypt requested but not found])
1180fi
1181if test "x$with_sha1" = xlibgcrypt; then
1182 AC_DEFINE([HAVE_SHA1_IN_LIBGCRYPT], [1],
1183 [Use libgcrypt SHA1 functions])
1184 SHA1_LIBS=-lgcrypt
1185fi
1186# We don't need all of the OpenSSL libraries, just libcrypto
1187AC_CHECK_LIB([crypto], [SHA1_Init], [HAVE_LIBCRYPTO=yes])
1188PKG_CHECK_MODULES([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
1189 [HAVE_OPENSSL_PKC=no])
1190if test "x$HAVE_LIBCRYPTO" = xyes || test "x$HAVE_OPENSSL_PKC" = xyes; then
1191 if test "x$with_sha1" = x; then
1192 with_sha1=libcrypto
1193 fi
1194else
1195 if test "x$with_sha1" = xlibcrypto; then
1196 AC_MSG_ERROR([OpenSSL libcrypto requested but not found])
1197 fi
1198fi
1199if test "x$with_sha1" = xlibcrypto; then
1200 if test "x$HAVE_LIBCRYPTO" = xyes; then
1201 SHA1_LIBS=-lcrypto
1202 else
1203 SHA1_LIBS="$OPENSSL_LIBS"
1204 SHA1_CFLAGS="$OPENSSL_CFLAGS"
1205 fi
1206fi
1207AC_MSG_CHECKING([for SHA1 implementation])
Carl Wortha24bdce2014-12-12 13:55:30 -08001208AC_MSG_RESULT([$with_sha1])
1209AC_SUBST(SHA1_LIBS)
1210AC_SUBST(SHA1_CFLAGS)
1211
Tapani Pälli0db323a2015-09-03 08:34:42 +03001212# Enable a define for SHA1
1213if test "x$with_sha1" != "x"; then
1214 DEFINES="$DEFINES -DHAVE_SHA1"
1215fi
1216
Carl Worth59216f52015-01-14 15:53:00 -08001217# Allow user to configure out the shader-cache feature
1218AC_ARG_ENABLE([shader-cache],
1219 AS_HELP_STRING([--disable-shader-cache], [Disable binary shader cache]),
1220 [enable_shader_cache="$enableval"],
1221 [if test "x$with_sha1" != "x"; then
1222 enable_shader_cache=yes
1223 else
1224 enable_shader_cache=no
1225 fi])
1226if test "x$with_sha1" = "x"; then
1227 if test "x$enable_shader_cache" = "xyes"; then
1228 AC_MSG_ERROR([Cannot enable shader cache (no SHA-1 implementation found)])
1229 fi
1230fi
1231AM_CONDITIONAL([ENABLE_SHADER_CACHE], [test x$enable_shader_cache = xyes])
1232
Jonathan Gray81799c82014-03-23 15:53:08 +11001233case "$host_os" in
1234linux*)
Gary Wong85b6f362014-05-21 21:07:42 -06001235 need_pci_id=yes ;;
Jonathan Gray81799c82014-03-23 15:53:08 +11001236*)
Gary Wong85b6f362014-05-21 21:07:42 -06001237 need_pci_id=no ;;
Jonathan Gray81799c82014-03-23 15:53:08 +11001238esac
1239
Armin Kf0f202e2013-11-09 00:06:45 +01001240PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED],
1241 have_libudev=yes, have_libudev=no)
1242
Gary Wong85b6f362014-05-21 21:07:42 -06001243AC_ARG_ENABLE([sysfs],
1244 [AS_HELP_STRING([--enable-sysfs],
1245 [enable /sys PCI identification @<:@default=disabled@:>@])],
1246 [have_sysfs="$enableval"],
1247 [have_sysfs=no]
1248)
1249
Chia-I Wu94ec5fd2011-06-27 09:19:02 +09001250if test "x$enable_dri" = xyes; then
Emil Velikov4d8267e2014-03-12 18:13:02 +00001251 if test "$enable_static" = yes; then
1252 AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
1253 fi
1254
Chia-I Wu81239342011-07-02 09:49:17 +09001255 # not a hard requirement as swrast does not depend on it
1256 if test "x$have_libdrm" = xyes; then
1257 DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
Chia-I Wu94ec5fd2011-06-27 09:19:02 +09001258 fi
Chia-I Wu94ec5fd2011-06-27 09:19:02 +09001259fi
1260
Samuel Thibault75856172011-03-14 22:08:21 +00001261AC_ARG_ENABLE([driglx-direct],
1262 [AS_HELP_STRING([--disable-driglx-direct],
Andreas Boll5ecbc3a2012-11-10 17:58:49 +01001263 [disable direct rendering in GLX and EGL for DRI \
noblede7d18ed2011-03-14 22:08:22 +00001264 @<:@default=auto@:>@])],
Samuel Thibault75856172011-03-14 22:08:21 +00001265 [driglx_direct="$enableval"],
Jon TURNEYbd526ec2014-05-09 13:54:09 +01001266 [driglx_direct="yes"])
Samuel Thibault75856172011-03-14 22:08:21 +00001267
Dan Nicholson44d99142007-12-05 18:47:01 -08001268dnl
1269dnl libGL configuration per driver
1270dnl
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001271case "x$enable_glx$enable_xlib_glx" in
1272xyesyes)
1273 # Xlib-based GLX
Emil Velikovda029f82014-07-11 23:17:48 +01001274 dri_modules="x11 xext xcb"
1275 PKG_CHECK_MODULES([XLIBGL], [$dri_modules])
1276 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Matt Turnere273ed32012-08-14 12:24:31 -07001277 X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
1278 GL_LIB_DEPS="$XLIBGL_LIBS"
Matt Turnerb6651ae2012-09-18 21:51:25 -07001279 GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
1280 GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -08001281 ;;
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001282xyesno)
1283 # DRI-based GLX
Jesse Barnesf2f83d92010-01-11 17:28:10 -05001284 PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
Dan Nicholson44d99142007-12-05 18:47:01 -08001285
1286 # find the DRI deps for libGL
Emil Velikovda029f82014-07-11 23:17:48 +01001287 dri_modules="x11 xext xdamage xfixes x11-xcb xcb xcb-glx >= $XCBGLX_REQUIRED"
Armin Kf0f202e2013-11-09 00:06:45 +01001288
Jon TURNEY45f9aae2014-05-12 10:17:06 +01001289 if test x"$driglx_direct" = xyes; then
1290 if test x"$dri_platform" = xdrm ; then
Jon TURNEYf647a722014-06-02 18:52:15 +01001291 DEFINES="$DEFINES -DGLX_USE_DRM"
Jon TURNEY45f9aae2014-05-12 10:17:06 +01001292 if test "x$have_libdrm" != xyes; then
1293 AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
1294 fi
1295
1296 PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
1297 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
1298 if test x"$enable_dri3" = xyes; then
1299 PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED])
1300 PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED])
1301 fi
1302
1303 if test x"$enable_dri" = xyes; then
1304 dri_modules="$dri_modules xcb-dri2 >= $XCBDRI2_REQUIRED"
1305 fi
1306
1307 if test x"$enable_dri3" = xyes; then
Emil Velikovda029f82014-07-11 23:17:48 +01001308 PKG_CHECK_EXISTS([xcb >= $XCB_REQUIRED], [], AC_MSG_ERROR([DRI3 requires xcb >= $XCB_REQUIRED]))
Boyan Ding6bd9ba72015-07-21 23:43:54 +08001309 dri3_modules="xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED"
1310 PKG_CHECK_MODULES([XCB_DRI3], [$dri3_modules])
Jon TURNEY45f9aae2014-05-12 10:17:06 +01001311 fi
Jon TURNEY5a459a02014-05-12 10:47:07 +01001312 fi
1313 if test x"$dri_platform" = xapple ; then
1314 DEFINES="$DEFINES -DGLX_USE_APPLEGL"
1315 fi
Armin Kf0f202e2013-11-09 00:06:45 +01001316 fi
Jon TURNEY2b9dac32010-04-21 12:58:54 +01001317
Matt Turnere273ed32012-08-14 12:24:31 -07001318 # add xf86vidmode if available
1319 PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
1320 if test "$HAVE_XF86VIDMODE" = yes ; then
1321 dri_modules="$dri_modules xxf86vm"
Dan Nicholson44d99142007-12-05 18:47:01 -08001322 fi
1323
Matt Turnere273ed32012-08-14 12:24:31 -07001324 PKG_CHECK_MODULES([DRIGL], [$dri_modules])
1325 GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
Armin Kf0f202e2013-11-09 00:06:45 +01001326 X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
1327 GL_LIB_DEPS="$DRIGL_LIBS"
1328
Matt Turnerb6651ae2012-09-18 21:51:25 -07001329 # need DRM libs, $PTHREAD_LIBS, etc.
1330 GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
1331 GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
Dan Nicholson979ff512007-12-05 18:47:01 -08001332 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -08001333esac
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001334
Gary Wong85b6f362014-05-21 21:07:42 -06001335have_pci_id=no
Dave Airliefaee3762014-01-28 15:52:13 +10001336if test "$have_libudev" = yes; then
1337 DEFINES="$DEFINES -DHAVE_LIBUDEV"
Gary Wong85b6f362014-05-21 21:07:42 -06001338 have_pci_id=yes
1339fi
1340
1341if test "$have_sysfs" = yes; then
1342 DEFINES="$DEFINES -DHAVE_SYSFS"
1343 have_pci_id=yes
Dave Airliefaee3762014-01-28 15:52:13 +10001344fi
1345
Ian Romanick4becf672012-01-03 11:35:59 -08001346# This is outside the case (above) so that it is invoked even for non-GLX
1347# builds.
Eric Anholt8ffb0982012-02-05 06:10:56 +01001348AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
Ian Romanick4becf672012-01-03 11:35:59 -08001349
Matt Turnerb6651ae2012-09-18 21:51:25 -07001350GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
1351GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
1352GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
1353GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001354
Robert Braggdda49c32012-09-19 16:12:08 +01001355AC_SUBST([X11_INCLUDES])
Dan Nicholson297e16c2008-05-05 15:42:53 -07001356AC_SUBST([GL_LIB_DEPS])
Dan Nicholson71e208b2008-11-24 11:01:57 -08001357AC_SUBST([GL_PC_REQ_PRIV])
1358AC_SUBST([GL_PC_LIB_PRIV])
1359AC_SUBST([GL_PC_CFLAGS])
1360AC_SUBST([DRI_PC_REQ_PRIV])
Li Pengc33c1912010-07-30 12:26:15 +08001361AC_SUBST([GLESv1_CM_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -04001362AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
Kristian Høgsberg9339c122010-03-05 19:01:43 -05001363AC_SUBST([GLESv2_LIB_DEPS])
Kristian Høgsberg9e4f2da2010-05-04 14:13:11 -04001364AC_SUBST([GLESv2_PC_LIB_PRIV])
1365
Jon TURNEY2b9dac32010-04-21 12:58:54 +01001366AC_SUBST([HAVE_XF86VIDMODE])
1367
Dan Nicholsondca1b792007-10-23 09:25:58 -07001368dnl
Chia-I Wu5029ea42011-06-27 13:06:39 +09001369dnl More GLX setup
Dan Nicholsondca1b792007-10-23 09:25:58 -07001370dnl
Chia-I Wu5029ea42011-06-27 13:06:39 +09001371case "x$enable_glx$enable_xlib_glx" in
1372xyesyes)
Dan Nicholsondca1b792007-10-23 09:25:58 -07001373 DEFINES="$DEFINES -DUSE_XSHM"
Chia-I Wu5029ea42011-06-27 13:06:39 +09001374 ;;
1375xyesno)
1376 DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
1377 if test "x$driglx_direct" = xyes; then
1378 DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
1379 fi
1380 ;;
1381esac
Dan Nicholsondca1b792007-10-23 09:25:58 -07001382
1383dnl
Tom Fogal31351dc2010-12-05 17:58:32 -07001384dnl TLS detection
Dan Nicholson44d99142007-12-05 18:47:01 -08001385dnl
Tom Fogal31351dc2010-12-05 17:58:32 -07001386
Dan Nicholson297e16c2008-05-05 15:42:53 -07001387AC_ARG_ENABLE([glx-tls],
Dan Nicholson44d99142007-12-05 18:47:01 -08001388 [AS_HELP_STRING([--enable-glx-tls],
Dan Nicholson79ad4582007-12-07 19:11:01 -08001389 [enable TLS support in GLX @<:@default=disabled@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001390 [GLX_USE_TLS="$enableval"],
1391 [GLX_USE_TLS=no])
Tom Fogal31351dc2010-12-05 17:58:32 -07001392AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
1393
Matt Turner814345f2012-09-18 22:09:26 -07001394AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
Matt Turnerb133b842014-09-21 17:33:21 -07001395 [DEFINES="${DEFINES} -DGLX_USE_TLS"])
Tom Fogal44842972011-02-21 22:32:18 -07001396
Jeremy Huddleston6dfc5e22015-08-29 14:51:45 -07001397dnl Read-only text section on x86 hardened platforms
1398AC_ARG_ENABLE([glx-read-only-text],
1399 [AS_HELP_STRING([--enable-glx-read-only-text],
1400 [Disable writable .text section on x86 (decreases performance) @<:@default=disabled@:>@])],
1401 [enable_glx_read_only_text="$enableval"],
1402 [enable_glx_read_only_text=no])
1403if test "x$enable_glx_read_only_text" = xyes; then
1404 DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
1405fi
1406
Tom Fogal31351dc2010-12-05 17:58:32 -07001407dnl
1408dnl More DRI setup
1409dnl
Dan Nicholson44d99142007-12-05 18:47:01 -08001410dnl Directory for DRI drivers
Dan Nicholson297e16c2008-05-05 15:42:53 -07001411AC_ARG_WITH([dri-driverdir],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001412 [AS_HELP_STRING([--with-dri-driverdir=DIR],
Dan Nicholson5dbbde52008-05-06 06:21:41 -07001413 [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001414 [DRI_DRIVER_INSTALL_DIR="$withval"],
Dan Nicholson5dbbde52008-05-06 06:21:41 -07001415 [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
Dan Nicholson297e16c2008-05-05 15:42:53 -07001416AC_SUBST([DRI_DRIVER_INSTALL_DIR])
Chow Loong Jin35506de2009-10-28 14:34:14 +08001417dnl Extra search path for DRI drivers
1418AC_ARG_WITH([dri-searchpath],
1419 [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
1420 [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
1421 [DRI_DRIVER_SEARCH_DIR="$withval"],
1422 [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
1423AC_SUBST([DRI_DRIVER_SEARCH_DIR])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001424dnl Which drivers to build - default is chosen by platform
Dan Nicholson297e16c2008-05-05 15:42:53 -07001425AC_ARG_WITH([dri-drivers],
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001426 [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
Emil Velikov65e67b92014-02-03 20:54:08 +00001427 [comma delimited classic DRI drivers list, e.g.
Michel Dänzercade0712009-07-10 14:49:46 +02001428 "swrast,i965,radeon" @<:@default=auto@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001429 [with_dri_drivers="$withval"],
Emil Velikovee555002014-02-04 17:26:38 +00001430 [with_dri_drivers=auto])
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001431
Emil Velikov9eae7502014-02-18 00:57:24 +00001432if test "x$with_dri_drivers" = xauto; then
1433 if test "x$enable_opengl" = xyes -a "x$enable_dri" = xyes; then
Emil Velikovee555002014-02-04 17:26:38 +00001434 with_dri_drivers="yes"
Emil Velikov9eae7502014-02-18 00:57:24 +00001435 else
1436 with_dri_drivers="no"
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001437 fi
Emil Velikov9eae7502014-02-18 00:57:24 +00001438fi
Emil Velikovf42333b2014-02-24 22:57:59 +00001439if test "x$with_dri_drivers" = xno; then
1440 with_dri_drivers=''
1441fi
Dan Nicholsonaf3d2f22007-11-15 08:59:57 -08001442
Emil Velikovee555002014-02-04 17:26:38 +00001443dnl If $with_dri_drivers is yes, drivers will be added through
1444dnl platform checks. Set DEFINES and LIB_DEPS
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001445if test "x$enable_dri" = xyes; then
Dan Nicholson44d99142007-12-05 18:47:01 -08001446 # Platform specific settings and drivers to build
1447 case "$host_os" in
1448 linux*)
Chia-I Wu5029ea42011-06-27 13:06:39 +09001449 DEFINES="$DEFINES -DHAVE_ALIAS"
Armin Kf0f202e2013-11-09 00:06:45 +01001450 if test "x$enable_dri3" = xyes; then
1451 DEFINES="$DEFINES -DHAVE_DRI3"
1452 fi
Dan Nicholson44d99142007-12-05 18:47:01 -08001453
Gary Wong85b6f362014-05-21 21:07:42 -06001454 if test "x$have_pci_id" != xyes; then
1455 AC_MSG_ERROR([libudev-dev or sysfs required for building DRI])
Eric Anholtb959fd92014-01-30 10:19:44 -08001456 fi
1457
Dan Nicholson44d99142007-12-05 18:47:01 -08001458 case "$host_cpu" in
Emil Velikov35f6eed2014-02-03 21:05:19 +00001459 powerpc* | sparc*)
1460 # Build only the drivers for cards that exist on PowerPC/sparc
Emil Velikovee555002014-02-04 17:26:38 +00001461 if test "x$with_dri_drivers" = "xyes"; then
1462 with_dri_drivers="r200 radeon swrast"
Dave Airlie2b0e75e2008-06-12 12:06:50 +10001463 fi
1464 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -08001465 esac
1466 ;;
Fabio Pedretti4f4da812013-11-06 10:55:27 +01001467 *freebsd* | dragonfly* | *netbsd* | openbsd*)
Brian Paul7f8434b2013-02-26 08:49:34 -07001468 DEFINES="$DEFINES -DHAVE_ALIAS"
Dan Nicholson44d99142007-12-05 18:47:01 -08001469 ;;
Samuel Thibaultd18dd6a2009-04-23 05:43:22 -07001470 gnu*)
Chia-I Wu5029ea42011-06-27 13:06:39 +09001471 DEFINES="$DEFINES -DHAVE_ALIAS"
Emil Velikov23740ed2014-03-21 18:09:36 +00001472 ;;
Jon TURNEYc6e33ca2011-03-14 22:08:23 +00001473 cygwin*)
Emil Velikovee555002014-02-04 17:26:38 +00001474 if test "x$with_dri_drivers" = "xyes"; then
1475 with_dri_drivers="swrast"
Jon TURNEYc6e33ca2011-03-14 22:08:23 +00001476 fi
1477 ;;
Jon TURNEYff90a872014-05-11 14:38:52 +01001478 darwin*)
Julien Isorcec7f36572015-07-01 00:33:14 +01001479 DEFINES="$DEFINES -DGLX_ALIAS_UNSUPPORTED -DBUILDING_MESA"
Jon TURNEYff90a872014-05-11 14:38:52 +01001480 if test "x$with_dri_drivers" = "xyes"; then
1481 with_dri_drivers="swrast"
1482 fi
1483 ;;
Dan Nicholson44d99142007-12-05 18:47:01 -08001484 esac
Dan Nicholson112a40e2008-02-21 10:17:19 -08001485
1486 # default drivers
Emil Velikovee555002014-02-04 17:26:38 +00001487 if test "x$with_dri_drivers" = "xyes"; then
1488 with_dri_drivers="i915 i965 nouveau r200 radeon swrast"
Dan Nicholson112a40e2008-02-21 10:17:19 -08001489 fi
1490
Dan Nicholson44d99142007-12-05 18:47:01 -08001491 # Check for expat
Andres Gomez657764c2014-10-07 17:32:17 +03001492 PKG_CHECK_MODULES([EXPAT], [expat], [],
1493 # expat version 2.0 and earlier do not provide expat.pc
1494 [AC_CHECK_HEADER([expat.h],[],
1495 [AC_MSG_ERROR([Expat headers required for DRI not found])])
1496 AC_CHECK_LIB([expat],[XML_ParserCreate],[],
1497 [AC_MSG_ERROR([Expat library required for DRI not found])])
1498 EXPAT_LIBS="-lexpat"])
Dan Nicholson44d99142007-12-05 18:47:01 -08001499
Matt Turner2b3a8cb2012-01-13 14:30:36 -05001500 # put all the necessary libs together
Emil Velikovaec20d62013-10-29 21:14:41 +00001501 DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
Dan Nicholson44d99142007-12-05 18:47:01 -08001502fi
Eric Anholt1925a9a2013-06-26 13:04:51 -07001503
Emil Velikovee555002014-02-04 17:26:38 +00001504AC_SUBST([DRI_LIB_DEPS])
Emil Velikovee555002014-02-04 17:26:38 +00001505
Emil Velikovf42333b2014-02-24 22:57:59 +00001506DRI_DIRS=''
1507dnl Duplicates in DRI_DIRS are removed by sorting it at the end of this block
1508if test -n "$with_dri_drivers"; then
Emil Velikovee555002014-02-04 17:26:38 +00001509 if test "x$enable_opengl" != xyes; then
1510 AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
1511 fi
1512
1513 dri_drivers=`IFS=', '; echo $with_dri_drivers`
1514 for driver in $dri_drivers; do
Eric Anholt9856d652014-03-04 14:43:16 -08001515 DRI_DIRS="$DRI_DIRS $driver"
Emil Velikovee555002014-02-04 17:26:38 +00001516 case "x$driver" in
1517 xi915)
1518 HAVE_I915_DRI=yes;
1519 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1520 ;;
1521 xi965)
1522 HAVE_I965_DRI=yes;
1523 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1524 ;;
1525 xnouveau)
1526 HAVE_NOUVEAU_DRI=yes;
Ilia Mirkin8276ba22015-07-01 03:47:41 -04001527 PKG_CHECK_MODULES([NVVIEUX], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
Emil Velikovee555002014-02-04 17:26:38 +00001528 ;;
1529 xradeon)
1530 HAVE_RADEON_DRI=yes;
1531 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1532 ;;
1533 xr200)
1534 HAVE_R200_DRI=yes;
1535 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1536 ;;
1537 xswrast)
1538 HAVE_SWRAST_DRI=yes;
1539 ;;
1540 *)
1541 AC_MSG_ERROR([classic DRI driver '$driver' does not exist])
1542 ;;
1543 esac
1544 done
Emil Velikovf42333b2014-02-24 22:57:59 +00001545 DRI_DIRS=`echo $DRI_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
Emil Velikovee555002014-02-04 17:26:38 +00001546fi
Emil Velikovee555002014-02-04 17:26:38 +00001547
Eric Anholtbdcee132013-09-27 16:57:11 -07001548AM_CONDITIONAL(NEED_MEGADRIVER, test -n "$DRI_DIRS")
Eric Anholt1925a9a2013-06-26 13:04:51 -07001549AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
1550 "x$enable_osmesa" = xyes -o \
Eric Anholtbdcee132013-09-27 16:57:11 -07001551 -n "$DRI_DIRS")
Matt Turner349845f2012-01-15 11:39:48 -05001552
Dan Nicholson44d99142007-12-05 18:47:01 -08001553dnl
Dan Nicholsondca1b792007-10-23 09:25:58 -07001554dnl OSMesa configuration
1555dnl
Dan Nicholson979ff512007-12-05 18:47:01 -08001556
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001557dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
Dan Nicholson297e16c2008-05-05 15:42:53 -07001558AC_ARG_WITH([osmesa-bits],
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001559 [AS_HELP_STRING([--with-osmesa-bits=BITS],
1560 [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
Dan Nicholson297e16c2008-05-05 15:42:53 -07001561 [osmesa_bits="$withval"],
1562 [osmesa_bits=8])
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001563if test "x$osmesa_bits" != x8; then
1564 if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
1565 AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
1566 osmesa_bits=8
1567 fi
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001568fi
1569case "x$osmesa_bits" in
1570x8)
Tom Fogalc0573fb2011-10-10 10:33:18 -06001571 OSMESA_LIB="${OSMESA_LIB}"
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001572 ;;
1573x16|x32)
Tom Fogalc0573fb2011-10-10 10:33:18 -06001574 OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001575 DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1576 ;;
1577*)
1578 AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1579 ;;
1580esac
Dan Nicholson6689f9e2007-12-05 21:04:15 -08001581
Matt Turner2f142d52013-08-20 14:16:17 -07001582if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
Emil Velikov4d8267e2014-03-12 18:13:02 +00001583 # only link libraries with osmesa if shared
1584 if test "$enable_static" = no; then
1585 OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
1586 else
1587 OSMESA_LIB_DEPS=""
1588 fi
Matt Turnerb6651ae2012-09-18 21:51:25 -07001589 OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
Chia-I Wu9e7a4142011-06-26 13:24:32 +09001590fi
Laurent Carlier284325d2012-06-24 09:51:27 +02001591
Dan Nicholson297e16c2008-05-05 15:42:53 -07001592AC_SUBST([OSMESA_LIB_DEPS])
Matt Turner7ef94c62012-01-31 21:34:42 -05001593AC_SUBST([OSMESA_PC_REQ])
Dan Nicholson8be02fc2008-12-14 09:35:29 -08001594AC_SUBST([OSMESA_PC_LIB_PRIV])
Dan Nicholsondca1b792007-10-23 09:25:58 -07001595
1596dnl
Benjamin Franzke42cdf402011-07-25 09:37:02 +02001597dnl gbm configuration
1598dnl
1599if test "x$enable_gbm" = xauto; then
1600 case "$with_egl_platforms" in
1601 *drm*)
1602 enable_gbm=yes ;;
1603 *)
1604 enable_gbm=no ;;
1605 esac
1606fi
1607if test "x$enable_gbm" = xyes; then
Gary Wong85b6f362014-05-21 21:07:42 -06001608 if test "x$need_pci_id$have_pci_id" = xyesno; then
1609 AC_MSG_ERROR([gbm requires udev >= $LIBUDEV_REQUIRED or sysfs])
Armin Kf0f202e2013-11-09 00:06:45 +01001610 fi
Matt Turner027ce0c2012-01-24 11:34:42 -05001611
1612 if test "x$enable_dri" = xyes; then
Matt Turner8c9b78a2012-08-17 14:22:47 -07001613 if test "x$enable_shared_glapi" = xno; then
Matt Turner027ce0c2012-01-24 11:34:42 -05001614 AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
1615 fi
Emil Velikove477d122014-05-05 22:09:22 +01001616 else
1617 # Strictly speaking libgbm does not require --enable-dri, although
1618 # both of its backends do. Thus one can build libgbm without any
1619 # backends if --disable-dri is set.
1620 # To avoid unnecessary complexity of checking if at least one backend
1621 # is available when building, just mandate --enable-dri.
1622 AC_MSG_ERROR([gbm requires --enable-dri])
Matt Turner027ce0c2012-01-24 11:34:42 -05001623 fi
Benjamin Franzke42cdf402011-07-25 09:37:02 +02001624fi
Matt Turnera9676ae2013-01-18 23:59:49 -08001625AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
Gary Wong85b6f362014-05-21 21:07:42 -06001626if test "x$need_pci_id$have_libudev" = xyesyes; then
Jonathan Gray81799c82014-03-23 15:53:08 +11001627 GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
1628else
1629 GBM_PC_REQ_PRIV=""
1630fi
Benjamin Franzke42cdf402011-07-25 09:37:02 +02001631GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
Benjamin Franzke42cdf402011-07-25 09:37:02 +02001632AC_SUBST([GBM_PC_REQ_PRIV])
1633AC_SUBST([GBM_PC_LIB_PRIV])
Benjamin Franzke42cdf402011-07-25 09:37:02 +02001634
1635dnl
Dan Nicholson53b37342009-02-25 17:45:34 -08001636dnl EGL configuration
1637dnl
Marek Olšák440d71d2011-06-14 05:38:58 +02001638EGL_CLIENT_APIS=""
1639
Dan Nicholson66f97862009-04-29 12:11:43 -07001640if test "x$enable_egl" = xyes; then
Matt Turnerb6651ae2012-09-18 21:51:25 -07001641 EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
Marek Olšákad50abba2011-06-14 05:14:27 +02001642
Benjamin Franzke85fe9482011-08-09 14:23:18 +02001643 AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
1644
Emil Velikov4d8267e2014-03-12 18:13:02 +00001645 if test "$enable_static" != yes; then
1646 if test "x$enable_dri" = xyes; then
Emil Velikovddc886b2015-06-19 17:44:02 +01001647 HAVE_EGL_DRIVER_DRI2=1
Emil Velikov994be512015-06-19 17:46:41 +01001648 if test "x$enable_shared_glapi" = xno; then
1649 AC_MSG_ERROR([egl_dri2 requires --enable-shared-glapi])
1650 fi
Boyan Dingf35198b2015-07-21 23:44:00 +08001651 if test "x$enable_dri3" = xyes; then
1652 HAVE_EGL_DRIVER_DRI3=1
1653 if test "x$enable_shared_glapi" = xno; then
1654 AC_MSG_ERROR([egl_dri3 requires --enable-shared-glapi])
1655 fi
1656 fi
Emil Velikovddc886b2015-06-19 17:44:02 +01001657 else
1658 # Avoid building an "empty" libEGL. Drop/update this
1659 # when other backends (haiku?) come along.
1660 AC_MSG_ERROR([egl requires --enable-dri])
1661 fi
Emil Velikov4d8267e2014-03-12 18:13:02 +00001662
Kristian Høgsberg42fa0092010-02-03 10:18:28 -05001663 fi
Dan Nicholson53b37342009-02-25 17:45:34 -08001664fi
Matt Turnera9676ae2013-01-18 23:59:49 -08001665AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
Dan Nicholson53b37342009-02-25 17:45:34 -08001666AC_SUBST([EGL_LIB_DEPS])
1667
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001668gallium_st="mesa"
1669
Dan Nicholson53b37342009-02-25 17:45:34 -08001670dnl
Thomas Hellstrom424b1212011-07-04 10:21:35 +02001671dnl XA configuration
1672dnl
1673if test "x$enable_xa" = xyes; then
Emil Velikove283e962014-02-24 22:58:10 +00001674 if test "x$with_gallium_drivers" = xswrast; then
1675 AC_MSG_ERROR([
1676 Building xa requires at least one non swrast gallium driver.
Matt Turner180e60d2014-06-10 18:08:10 -07001677 If you are looking to use libxatracker.so with the VMware driver,
Emil Velikove283e962014-02-24 22:58:10 +00001678 make sure to include svga in the gallium drivers list, apart from
1679 enabling XA.
1680 Example: ./configure --enable-xa --with-gallium-drivers=svga...])
1681 fi
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001682 gallium_st="$gallium_st xa"
Thomas Hellstrom424b1212011-07-04 10:21:35 +02001683fi
Matt Turner69b69b12013-01-19 11:23:51 -08001684AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
Thomas Hellstrom424b1212011-07-04 10:21:35 +02001685
1686dnl
Christian Königc3b22302011-07-04 15:04:41 +02001687dnl Gallium G3DVL configuration
1688dnl
Emil Velikov816d3922014-06-11 22:15:58 +01001689if test -n "$with_gallium_drivers" -a "x$with_gallium_drivers" != xswrast; then
Christian Königc3b22302011-07-04 15:04:41 +02001690 if test "x$enable_xvmc" = xauto; then
Emil Velikov303bc362014-11-09 04:44:13 +00001691 PKG_CHECK_EXISTS([xvmc >= $XVMC_REQUIRED], [enable_xvmc=yes], [enable_xvmc=no])
Christian Königc3b22302011-07-04 15:04:41 +02001692 fi
1693
1694 if test "x$enable_vdpau" = xauto; then
Emil Velikov303bc362014-11-09 04:44:13 +00001695 PKG_CHECK_EXISTS([vdpau >= $VDPAU_REQUIRED], [enable_vdpau=yes], [enable_vdpau=no])
Christian Königc3b22302011-07-04 15:04:41 +02001696 fi
Christian König15e39ca2013-08-05 11:41:27 -06001697
1698 if test "x$enable_omx" = xauto; then
Emil Velikov303bc362014-11-09 04:44:13 +00001699 PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], [enable_omx=yes], [enable_omx=no])
Christian König15e39ca2013-08-05 11:41:27 -06001700 fi
Christian König38679332014-07-02 16:35:28 -04001701
1702 if test "x$enable_va" = xauto; then
Emil Velikov303bc362014-11-09 04:44:13 +00001703 PKG_CHECK_EXISTS([libva >= $LIBVA_REQUIRED], [enable_va=yes], [enable_va=no])
Christian König38679332014-07-02 16:35:28 -04001704 fi
Christian Königc3b22302011-07-04 15:04:41 +02001705fi
1706
Emil Velikovc39dbfd2015-02-10 15:11:09 +00001707if test "x$enable_dri" = xyes -o \
1708 "x$enable_xvmc" = xyes -o \
Emil Velikov2dbaeda2014-11-09 04:44:14 +00001709 "x$enable_vdpau" = xyes -o \
1710 "x$enable_omx" = xyes -o \
1711 "x$enable_va" = xyes; then
Emil Velikov2dbaeda2014-11-09 04:44:14 +00001712 need_gallium_vl=yes
1713fi
1714AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" = xyes)
1715
Emil Velikovdd7b6672015-02-16 18:22:16 +00001716if test "x$enable_xvmc" = xyes -o \
1717 "x$enable_vdpau" = xyes -o \
1718 "x$enable_omx" = xyes -o \
1719 "x$enable_va" = xyes; then
1720 PKG_CHECK_MODULES([VL], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
1721 need_gallium_vl_winsys=yes
1722fi
1723AM_CONDITIONAL(NEED_GALLIUM_VL_WINSYS, test "x$need_gallium_vl_winsys" = xyes)
1724
Christian Königc3b22302011-07-04 15:04:41 +02001725if test "x$enable_xvmc" = xyes; then
Emil Velikov2dbaeda2014-11-09 04:44:14 +00001726 PKG_CHECK_MODULES([XVMC], [xvmc >= $XVMC_REQUIRED])
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001727 gallium_st="$gallium_st xvmc"
Christian Königc3b22302011-07-04 15:04:41 +02001728fi
Matt Turner69b69b12013-01-19 11:23:51 -08001729AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
Christian Königc3b22302011-07-04 15:04:41 +02001730
Christian Königc3b22302011-07-04 15:04:41 +02001731if test "x$enable_vdpau" = xyes; then
Emil Velikov2dbaeda2014-11-09 04:44:14 +00001732 PKG_CHECK_MODULES([VDPAU], [vdpau >= $VDPAU_REQUIRED])
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001733 gallium_st="$gallium_st vdpau"
Christian König37402aa2016-01-20 16:19:08 +01001734 DEFINES="$DEFINES -DHAVE_ST_VDPAU"
Christian Königc3b22302011-07-04 15:04:41 +02001735fi
Matt Turner69b69b12013-01-19 11:23:51 -08001736AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
Christian Königc3b22302011-07-04 15:04:41 +02001737
Christian König15e39ca2013-08-05 11:41:27 -06001738if test "x$enable_omx" = xyes; then
Emil Velikov2dbaeda2014-11-09 04:44:14 +00001739 PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED])
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001740 gallium_st="$gallium_st omx"
Christian König15e39ca2013-08-05 11:41:27 -06001741fi
1742AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes)
1743
Christian König38679332014-07-02 16:35:28 -04001744if test "x$enable_va" = xyes; then
Emil Velikov2dbaeda2014-11-09 04:44:14 +00001745 PKG_CHECK_MODULES([VA], [libva >= $LIBVA_REQUIRED])
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001746 gallium_st="$gallium_st va"
Christian König38679332014-07-02 16:35:28 -04001747fi
1748AM_CONDITIONAL(HAVE_ST_VA, test "x$enable_va" = xyes)
1749
Christian Königc3b22302011-07-04 15:04:41 +02001750dnl
Joakim Sindholtfdd96572011-08-04 15:14:06 +02001751dnl Nine Direct3D9 configuration
1752dnl
1753if test "x$enable_nine" = xyes; then
1754 if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
1755 AC_MSG_ERROR([nine requires the gallium swrast driver])
1756 fi
Tobias Nygren52e4e472015-04-17 20:18:48 +02001757 if test "x$with_gallium_drivers" = xswrast; then
Joakim Sindholtfdd96572011-08-04 15:14:06 +02001758 AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
1759 fi
David Heidelberg56717c02015-04-11 00:13:53 +02001760 if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6; then
1761 AC_MSG_ERROR([gcc >= 4.6 is required to build nine])
1762 fi
1763
Joakim Sindholtfdd96572011-08-04 15:14:06 +02001764 if test "x$enable_dri3" = xno; then
1765 AC_MSG_WARN([using nine together with wine requires DRI3 enabled system])
1766 fi
1767
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001768 gallium_st="$gallium_st nine"
Joakim Sindholtfdd96572011-08-04 15:14:06 +02001769fi
1770AM_CONDITIONAL(HAVE_ST_NINE, test "x$enable_nine" = xyes)
1771
1772dnl
Francisco Jerezc6db1b32012-04-20 16:56:19 +02001773dnl OpenCL configuration
1774dnl
1775
Tom Stellardea76f032012-06-15 16:52:16 -04001776AC_ARG_WITH([clang-libdir],
1777 [AS_HELP_STRING([--with-clang-libdir],
1778 [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
1779 [CLANG_LIBDIR="$withval"],
Emil Velikov2e830bb2014-02-24 22:58:07 +00001780 [CLANG_LIBDIR=''])
Tom Stellardea76f032012-06-15 16:52:16 -04001781
Tom Stellarda64d3dd2013-09-05 16:26:17 -07001782PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no])
Jonathan Gray7f585a62015-12-09 16:55:01 +11001783PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=no])
1784
1785if test "x$have_libelf" = xno; then
1786 LIBELF_LIBS=''
1787 LIBELF_CFLAGS=''
1788 AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;LIBELF_LIBS=-lelf], [have_libelf=no])
1789 AC_SUBST([LIBELF_LIBS])
1790 AC_SUBST([LIBELF_CFLAGS])
1791fi
Tom Stellardc79e7662012-03-12 13:53:20 -04001792
Francisco Jerezc6db1b32012-04-20 16:56:19 +02001793if test "x$enable_opencl" = xyes; then
Emil Velikov8015ffe2014-02-11 14:47:37 +00001794 if test -z "$with_gallium_drivers"; then
Francisco Jerezc6db1b32012-04-20 16:56:19 +02001795 AC_MSG_ERROR([cannot enable OpenCL without Gallium])
1796 fi
Tom Stellard79d77b32012-04-20 16:56:46 +02001797
Francisco Jerez7baad4b2013-09-28 17:26:50 -07001798 if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then
1799 AC_MSG_ERROR([gcc >= 4.7 is required to build clover])
Tom Stellard79d77b32012-04-20 16:56:46 +02001800 fi
1801
Tom Stellarda64d3dd2013-09-05 16:26:17 -07001802 if test "x$have_libclc" = xno; then
1803 AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover.
1804 Make sure the directory containing libclc.pc is specified in your
1805 PKG_CONFIG_PATH environment variable.
1806 By default libclc.pc is installed to /usr/local/share/pkgconfig/])
1807 else
Emil Velikov0828ad42013-09-28 03:20:14 +01001808 LIBCLC_INCLUDEDIR=`$PKG_CONFIG --variable=includedir libclc`
1809 LIBCLC_LIBEXECDIR=`$PKG_CONFIG --variable=libexecdir libclc`
Tom Stellarda64d3dd2013-09-05 16:26:17 -07001810 AC_SUBST([LIBCLC_INCLUDEDIR])
1811 AC_SUBST([LIBCLC_LIBEXECDIR])
Johannes Obermayr959e83d2012-11-30 01:44:56 +01001812 fi
1813
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04001814 gallium_st="$gallium_st clover"
Tom Stellard07567c12013-09-18 00:36:55 -07001815
1816 if test "x$enable_opencl_icd" = xyes; then
1817 OPENCL_LIBNAME="MesaOpenCL"
1818 else
1819 OPENCL_LIBNAME="OpenCL"
1820 fi
Jan Veselyab538302014-10-21 11:59:34 -04001821
1822 if test "x$have_libelf" != xyes; then
1823 AC_MSG_ERROR([Clover requires libelf])
1824 fi
Francisco Jerezc6db1b32012-04-20 16:56:19 +02001825fi
Matt Turner69b69b12013-01-19 11:23:51 -08001826AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
Tom Stellard07567c12013-09-18 00:36:55 -07001827AM_CONDITIONAL(HAVE_CLOVER_ICD, test "x$enable_opencl_icd" = xyes)
1828AC_SUBST([OPENCL_LIBNAME])
Francisco Jerezc6db1b32012-04-20 16:56:19 +02001829
1830dnl
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01001831dnl Gallium configuration
1832dnl
Matt Turnera9676ae2013-01-18 23:59:49 -08001833AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
Dan Nicholsondca1b792007-10-23 09:25:58 -07001834
Tom Stellarda75c6162012-01-06 17:38:37 -05001835AC_SUBST([LLVM_BINDIR])
Dave Airlie81fe1982010-04-22 14:59:29 +10001836AC_SUBST([LLVM_CFLAGS])
Tom Stellardd4167802012-04-24 10:34:57 -04001837AC_SUBST([LLVM_CPPFLAGS])
Tom Stellarda75c6162012-01-06 17:38:37 -05001838AC_SUBST([LLVM_CXXFLAGS])
Tom Stellardd4167802012-04-24 10:34:57 -04001839AC_SUBST([LLVM_LIBDIR])
Dave Airlie81fe1982010-04-22 14:59:29 +10001840AC_SUBST([LLVM_LIBS])
1841AC_SUBST([LLVM_LDFLAGS])
Tom Stellarda75c6162012-01-06 17:38:37 -05001842AC_SUBST([LLVM_INCLUDEDIR])
Dave Airlie81fe1982010-04-22 14:59:29 +10001843AC_SUBST([LLVM_VERSION])
Tom Stellardea76f032012-06-15 16:52:16 -04001844AC_SUBST([CLANG_RESOURCE_DIR])
Dave Airlie81fe1982010-04-22 14:59:29 +10001845
Chia-I Wube5f34a2010-10-27 16:14:27 +08001846case "x$enable_opengl$enable_gles1$enable_gles2" in
1847x*yes*)
1848 EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1849 ;;
1850esac
Chia-I Wube5f34a2010-10-27 16:14:27 +08001851
Chia-I Wu874ccd52010-05-04 22:43:05 +08001852AC_SUBST([VG_LIB_DEPS])
Chia-I Wu63ab2502010-05-05 15:38:02 +08001853AC_SUBST([EGL_CLIENT_APIS])
1854
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001855dnl
1856dnl EGL Platforms configuration
1857dnl
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001858AC_ARG_WITH([egl-platforms],
1859 [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1860 [comma delimited native platforms libEGL supports, e.g.
Chia-I Wue7424d72010-09-19 16:54:39 +08001861 "x11,drm" @<:@default=auto@:>@])],
Chia-I Wuda39d5d2010-06-17 16:07:46 +08001862 [with_egl_platforms="$withval"],
Eric Anholt28d92ef2012-02-05 07:54:38 +01001863 [if test "x$enable_egl" = xyes; then
1864 with_egl_platforms="x11"
1865 else
1866 with_egl_platforms=""
1867 fi])
Chia-I Wu49381d62010-01-11 01:23:01 +08001868
Eric Anholt28d92ef2012-02-05 07:54:38 +01001869if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
1870 AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1871fi
1872
Emil Velikov153539b2015-02-10 14:14:16 +00001873PKG_CHECK_MODULES([WAYLAND_SCANNER], [wayland_scanner],
1874 WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland_scanner`,
1875 WAYLAND_SCANNER='')
1876if test "x$WAYLAND_SCANNER" = x; then
1877 AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner])
1878fi
1879
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001880# Do per-EGL platform setups and checks
Eric Anholt28d92ef2012-02-05 07:54:38 +01001881egl_platforms=`IFS=', '; echo $with_egl_platforms`
1882for plat in $egl_platforms; do
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001883 case "$plat" in
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001884 wayland)
Emil Velikovfa109d02015-07-10 11:01:55 +01001885 test "x$have_libdrm" != xyes &&
1886 AC_MSG_ERROR([EGL platform wayland requires libdrm >= $LIBDRM_REQUIRED])
1887
Fabio Pedretti8a8dd862014-03-01 10:11:12 +01001888 PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED])
Benjamin Franzke8b902052012-01-24 20:38:01 +01001889
Emil Velikov153539b2015-02-10 14:14:16 +00001890 if test "x$WAYLAND_SCANNER" = x; then
1891 AC_MSG_ERROR([wayland-scanner is needed to compile the wayland egl platform])
1892 fi
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001893 ;;
1894
1895 x11)
Emil Velikov17798bf2014-07-12 00:05:56 +01001896 PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb xcb-dri2 >= $XCBDRI2_REQUIRED xcb-xfixes])
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001897 ;;
1898
1899 drm)
1900 test "x$enable_gbm" = "xno" &&
1901 AC_MSG_ERROR([EGL platform drm needs gbm])
Tapani Pällia057b832013-12-01 11:53:55 +02001902 test "x$have_libdrm" != xyes &&
1903 AC_MSG_ERROR([EGL platform drm requires libdrm >= $LIBDRM_REQUIRED])
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001904 ;;
1905
Haixia Shi6b8accb2015-06-12 10:10:58 -07001906 surfaceless)
1907 test "x$have_libdrm" != xyes &&
1908 AC_MSG_ERROR([EGL platform surfaceless requires libdrm >= $LIBDRM_REQUIRED])
1909 ;;
1910
Kristian Høgsberg2c4f6ce2012-06-01 14:14:20 -04001911 *)
1912 AC_MSG_ERROR([EGL platform '$plat' does not exist])
1913 ;;
1914 esac
1915
Gary Wong85b6f362014-05-21 21:07:42 -06001916 case "$plat$need_pci_id$have_pci_id" in
Jonathan Gray81799c82014-03-23 15:53:08 +11001917 waylandyesno|drmyesno)
Gary Wong85b6f362014-05-21 21:07:42 -06001918 AC_MSG_ERROR([cannot build $plat platform without udev >= $LIBUDEV_REQUIRED or sysfs]) ;;
Benjamin Franzke7ed18262011-07-02 13:46:42 +02001919 esac
Eric Anholt28d92ef2012-02-05 07:54:38 +01001920done
1921
Eric Anholt88612022012-02-05 10:46:13 +01001922# libEGL wants to default to the first platform specified in
1923# ./configure. parse that here.
1924if test "x$egl_platforms" != "x"; then
Alan Coopersmith60ad5102015-01-01 12:55:27 -08001925 FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr '[[a-z]]' '[[A-Z]]'`
Eric Anholt88612022012-02-05 10:46:13 +01001926 EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
1927else
1928 EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
1929fi
1930
Emil Velikov3dc174e2014-03-12 02:37:55 +00001931AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
1932AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland')
1933AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
Haixia Shi6b8accb2015-06-12 10:10:58 -07001934AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless')
Emil Velikov3dc174e2014-03-12 02:37:55 +00001935AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
Eric Anholt88612022012-02-05 10:46:13 +01001936
1937AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
Eric Anholt88612022012-02-05 10:46:13 +01001938
1939AC_SUBST([EGL_NATIVE_PLATFORM])
Eric Anholt88612022012-02-05 10:46:13 +01001940AC_SUBST([EGL_CFLAGS])
Chia-I Wu49381d62010-01-11 01:23:01 +08001941
Ross Burton1a7275d2013-06-27 12:35:07 +01001942# If we don't have the X11 platform, set this define so we don't try to include
1943# the X11 headers.
1944if ! echo "$egl_platforms" | grep -q 'x11'; then
1945 DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
1946 GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
1947fi
1948
Jakob Bornecrantz3ede3772009-02-13 00:57:47 +01001949dnl
Dave Airlie81fe1982010-04-22 14:59:29 +10001950dnl Gallium LLVM
1951dnl
1952AC_ARG_ENABLE([gallium-llvm],
1953 [AS_HELP_STRING([--enable-gallium-llvm],
Marek Olšáka86fc712011-04-21 13:27:55 +02001954 [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
Dave Airlie81fe1982010-04-22 14:59:29 +10001955 [enable_gallium_llvm="$enableval"],
1956 [enable_gallium_llvm=auto])
Tom Stellard7d87c712012-03-27 22:24:39 -04001957
Tom Stellarda4c73422014-02-04 11:54:38 -05001958AC_ARG_ENABLE([llvm-shared-libs],
1959 [AS_HELP_STRING([--enable-llvm-shared-libs],
1960 [link with LLVM shared libraries @<:@default=enabled@:>@])],
Emil Velikov065b6ca2014-03-04 20:02:35 +00001961 [enable_llvm_shared_libs="$enableval"],
1962 [enable_llvm_shared_libs=yes])
Tom Stellard7d87c712012-03-27 22:24:39 -04001963
Tom Stellard17f6c912012-07-17 18:32:56 +00001964AC_ARG_WITH([llvm-prefix],
1965 [AS_HELP_STRING([--with-llvm-prefix],
1966 [Prefix for LLVM installations in non-standard locations])],
1967 [llvm_prefix="$withval"],
Emil Velikov2e830bb2014-02-24 22:58:07 +00001968 [llvm_prefix=''])
Tom Stellard17f6c912012-07-17 18:32:56 +00001969
1970
Marek Olšák9b67a342012-11-27 23:38:01 +01001971# Call this inside ` ` to get the return value.
1972# $1 is the llvm-config command with arguments.
1973strip_unwanted_llvm_flags() {
Marek Olšák3d59cde2012-11-27 23:56:04 +01001974 # Use \> (marks the end of the word)
Marek Olšák9b67a342012-11-27 23:38:01 +01001975 echo `$1` | sed \
1976 -e 's/-DNDEBUG\>//g' \
Jonathan Grayc68073e2014-09-06 01:44:41 +10001977 -e 's/-D_GNU_SOURCE\>//g' \
Marek Olšák3d59cde2012-11-27 23:56:04 +01001978 -e 's/-pedantic\>//g' \
1979 -e 's/-Wcovered-switch-default\>//g' \
1980 -e 's/-O.\>//g' \
1981 -e 's/-g\>//g' \
Marek Olšákf9429e32012-11-28 00:28:18 +01001982 -e 's/-Wall\>//g' \
Bruno Jiménez089d0662014-03-02 22:39:01 +01001983 -e 's/-Wcast-qual\>//g' \
1984 -e 's/-Woverloaded-virtual\>//g' \
Markus Trippelsdorf78fcc312013-12-13 10:59:42 +01001985 -e 's/-fcolor-diagnostics\>//g' \
Bruno Jiménez089d0662014-03-02 22:39:01 +01001986 -e 's/-fdata-sections\>//g' \
1987 -e 's/-ffunction-sections\>//g' \
1988 -e 's/-fno-exceptions\>//g' \
1989 -e 's/-fomit-frame-pointer\>//g' \
1990 -e 's/-fvisibility-inlines-hidden\>//g' \
Vinson Lee8479edf2014-05-09 18:21:59 -07001991 -e 's/-fPIC\>//g' \
1992 -e 's/-fstack-protector-strong\>//g'
Marek Olšák9b67a342012-11-27 23:38:01 +01001993}
1994
EdBf39cd712015-04-20 20:28:09 +02001995llvm_check_version_for() {
1996 if test "${LLVM_VERSION_INT}${LLVM_VERSION_PATCH}" -lt "${1}0${2}${3}"; then
1997 AC_MSG_ERROR([LLVM $1.$2.$3 or newer is required for $4])
1998 fi
1999}
2000
2001
Marek Olšák9b67a342012-11-27 23:38:01 +01002002
Emil Velikov8015ffe2014-02-11 14:47:37 +00002003if test -z "$with_gallium_drivers"; then
Marek Olšák58b6a192011-06-14 07:46:59 +02002004 enable_gallium_llvm=no
2005fi
Marek Olšáka86fc712011-04-21 13:27:55 +02002006if test "x$enable_gallium_llvm" = xauto; then
2007 case "$host_cpu" in
Jean-Sébastien Pédron148f0de2013-06-05 13:27:37 +02002008 i*86|x86_64|amd64) enable_gallium_llvm=yes;;
Marek Olšáka86fc712011-04-21 13:27:55 +02002009 esac
2010fi
Dave Airlie81fe1982010-04-22 14:59:29 +10002011if test "x$enable_gallium_llvm" = xyes; then
Emil Velikovf41102b2014-02-04 17:32:03 +00002012 if test -n "$llvm_prefix"; then
Michał Górny5ea23762013-12-28 15:22:09 +01002013 AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
Tom Stellard17f6c912012-07-17 18:32:56 +00002014 else
Michał Górny5ea23762013-12-28 15:22:09 +01002015 AC_PATH_TOOL([LLVM_CONFIG], [llvm-config], [no])
Tom Stellard17f6c912012-07-17 18:32:56 +00002016 fi
Marek Olšák99fba502011-07-23 15:57:51 +02002017
Dave Airlie22e8ddc2010-04-25 07:48:48 +10002018 if test "x$LLVM_CONFIG" != xno; then
Jonathan Graycdb35352014-09-10 16:11:25 +10002019 LLVM_VERSION=`$LLVM_CONFIG --version | egrep -o '^[[0-9.]]+'`
Klemens Baum45574ab2013-06-27 23:13:37 +02002020 LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
2021 LLVM_BINDIR=`$LLVM_CONFIG --bindir`
2022 LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
2023 LLVM_CFLAGS=$LLVM_CPPFLAGS # CPPFLAGS seem to be sufficient
2024 LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
2025 LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
2026 LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
2027
2028 AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
2029 [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
2030 AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
2031 [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
2032
Tom Stellardec566e02014-09-25 12:55:40 -07002033 LLVM_VERSION_PATCH=`echo $LLVM_VERSION | cut -d. -f3 | egrep -o '^[[0-9]]+'`
2034 if test -z "$LLVM_VERSION_PATCH"; then
2035 LLVM_VERSION_PATCH=0
2036 fi
Tom Stellardc5d00082014-05-09 04:23:50 -04002037
Emil Velikovf41102b2014-02-04 17:32:03 +00002038 if test -n "${LLVM_VERSION_MAJOR}"; then
Klemens Baum45574ab2013-06-27 23:13:37 +02002039 LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
2040 else
2041 LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
2042 fi
2043
José Fonsecaecef2da2014-05-12 16:30:51 +01002044 LLVM_REQUIRED_VERSION_MAJOR="3"
José Fonseca013ff2f2014-10-22 13:09:59 +01002045 LLVM_REQUIRED_VERSION_MINOR="3"
José Fonsecaecef2da2014-05-12 16:30:51 +01002046 if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
2047 AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required])
2048 fi
2049
Jose Fonseca0ad15e52015-05-29 12:13:36 +01002050 LLVM_COMPONENTS="engine bitwriter mcjit mcdisassembler"
Johannes Obermayrc2958742013-04-09 17:38:42 +01002051
Tom Stellard08980472013-01-25 16:43:11 +01002052 if test "x$enable_opencl" = xyes; then
EdBf39cd712015-04-20 20:28:09 +02002053 llvm_check_version_for "3" "5" "0" "opencl"
2054
Niels Ole Salscheider4b94c3f2015-01-24 22:49:44 +01002055 LLVM_COMPONENTS="${LLVM_COMPONENTS} all-targets ipo linker instrumentation"
EdBf39cd712015-04-20 20:28:09 +02002056 LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader option objcarcopts profiledata"
Tom Stellard08980472013-01-25 16:43:11 +01002057 fi
Marek Olšák797f4ea2015-06-06 13:24:11 +02002058 DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT -DMESA_LLVM_VERSION_PATCH=$LLVM_VERSION_PATCH"
Klemens Baum45574ab2013-06-27 23:13:37 +02002059 MESA_LLVM=1
Tom Stellardea76f032012-06-15 16:52:16 -04002060
Klemens Baum45574ab2013-06-27 23:13:37 +02002061 dnl Check for Clang internal headers
Tom Stellardea76f032012-06-15 16:52:16 -04002062 if test "x$enable_opencl" = xyes; then
Emil Velikov8015ffe2014-02-11 14:47:37 +00002063 if test -z "$CLANG_LIBDIR"; then
Tom Stellardea76f032012-06-15 16:52:16 -04002064 CLANG_LIBDIR=${LLVM_LIBDIR}
2065 fi
2066 CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
Jonathan Liuaf16f732013-06-04 23:04:44 +10002067 AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
2068 [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])])
Tom Stellardea76f032012-06-15 16:52:16 -04002069 fi
Dave Airlie22e8ddc2010-04-25 07:48:48 +10002070 else
Klemens Baum45574ab2013-06-27 23:13:37 +02002071 MESA_LLVM=0
2072 LLVM_VERSION_INT=0
Dave Airlie22e8ddc2010-04-25 07:48:48 +10002073 fi
2074else
2075 MESA_LLVM=0
Tom Stellard80d290d2012-08-24 11:48:32 -07002076 LLVM_VERSION_INT=0
Michel Dänzer2d399bb2014-06-10 11:25:04 +09002077
2078 if test "x$enable_opencl" = xyes; then
2079 AC_MSG_ERROR([cannot enable OpenCL without LLVM])
2080 fi
Dave Airlie81fe1982010-04-22 14:59:29 +10002081fi
2082
Alexandre Demers3ea36952012-04-04 10:54:56 +02002083dnl Directory for XVMC libs
2084AC_ARG_WITH([xvmc-libdir],
2085 [AS_HELP_STRING([--with-xvmc-libdir=DIR],
2086 [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
2087 [XVMC_LIB_INSTALL_DIR="$withval"],
2088 [XVMC_LIB_INSTALL_DIR='${libdir}'])
2089AC_SUBST([XVMC_LIB_INSTALL_DIR])
2090
Tom Stellard79d77b32012-04-20 16:56:46 +02002091dnl
2092dnl Gallium Tests
2093dnl
Matt Turnera9676ae2013-01-18 23:59:49 -08002094AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
Tom Stellard79d77b32012-04-20 16:56:46 +02002095
Thomas Balling Sørensen32999972010-07-14 00:34:56 +02002096dnl Directory for VDPAU libs
2097AC_ARG_WITH([vdpau-libdir],
2098 [AS_HELP_STRING([--with-vdpau-libdir=DIR],
Christian König5ce06d12014-10-09 18:01:19 +02002099 [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
Thomas Balling Sørensen32999972010-07-14 00:34:56 +02002100 [VDPAU_LIB_INSTALL_DIR="$withval"],
Christian König5ce06d12014-10-09 18:01:19 +02002101 [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
Thomas Balling Sørensen32999972010-07-14 00:34:56 +02002102AC_SUBST([VDPAU_LIB_INSTALL_DIR])
Younes Manton40cd0822010-03-05 23:11:05 -05002103
Christian Königd3004a22014-10-09 18:42:58 +02002104dnl Directory for OMX libs
Emil Velikov254aafb2014-03-03 02:21:53 +00002105
Christian König15e39ca2013-08-05 11:41:27 -06002106AC_ARG_WITH([omx-libdir],
2107 [AS_HELP_STRING([--with-omx-libdir=DIR],
Christian König5ce06d12014-10-09 18:01:19 +02002108 [directory for the OMX libraries])],
Christian König15e39ca2013-08-05 11:41:27 -06002109 [OMX_LIB_INSTALL_DIR="$withval"],
Christian Königd3004a22014-10-09 18:42:58 +02002110 [OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir --variable=pluginsdir libomxil-bellagio`])
Christian König15e39ca2013-08-05 11:41:27 -06002111AC_SUBST([OMX_LIB_INSTALL_DIR])
2112
Christian König38679332014-07-02 16:35:28 -04002113dnl Directory for VA libs
2114
2115AC_ARG_WITH([va-libdir],
2116 [AS_HELP_STRING([--with-va-libdir=DIR],
Christian Königd561a422014-10-09 19:51:48 +02002117 [directory for the VA libraries @<:@${libdir}/dri@:>@])],
Christian König38679332014-07-02 16:35:28 -04002118 [VA_LIB_INSTALL_DIR="$withval"],
Christian Königd561a422014-10-09 19:51:48 +02002119 [VA_LIB_INSTALL_DIR="${libdir}/dri"])
Christian König38679332014-07-02 16:35:28 -04002120AC_SUBST([VA_LIB_INSTALL_DIR])
2121
Joakim Sindholtfdd96572011-08-04 15:14:06 +02002122AC_ARG_WITH([d3d-libdir],
2123 [AS_HELP_STRING([--with-d3d-libdir=DIR],
2124 [directory for the D3D modules @<:@${libdir}/d3d@:>@])],
2125 [D3D_DRIVER_INSTALL_DIR="$withval"],
2126 [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
2127AC_SUBST([D3D_DRIVER_INSTALL_DIR])
2128
Dave Airlie81fe1982010-04-22 14:59:29 +10002129dnl
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01002130dnl Gallium helper functions
2131dnl
Matt Turnerb66791d2014-09-21 14:58:07 -07002132gallium_require_drm() {
Emil Velikov0d0313c2014-09-05 14:06:21 +01002133 if test "x$have_libdrm" != xyes; then
2134 AC_MSG_ERROR([$1 requires libdrm >= $LIBDRM_REQUIRED])
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01002135 fi
Jakob Bornecrantza82e37b2010-03-25 22:21:39 +01002136}
2137
Marek Olšákc17fb852011-06-14 04:03:17 +02002138gallium_require_llvm() {
2139 if test "x$MESA_LLVM" = x0; then
Maarten Lankhorst4c16e6a2014-08-11 13:16:05 +02002140 case "$host" in *gnux32) return;; esac
Marek Olšákc17fb852011-06-14 04:03:17 +02002141 case "$host_cpu" in
Jean-Sébastien Pédron148f0de2013-06-05 13:27:37 +02002142 i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
Marek Olšákc17fb852011-06-14 04:03:17 +02002143 esac
2144 fi
2145}
2146
Tom Stellard79d77b32012-04-20 16:56:46 +02002147gallium_require_drm_loader() {
Emil Velikov950e06a2015-10-17 21:14:09 +01002148 if test "x$need_pci_id$have_pci_id" = xyesno; then
2149 AC_MSG_ERROR([Gallium drm loader requires libudev >= $LIBUDEV_REQUIRED or sysfs])
Christian König38679332014-07-02 16:35:28 -04002150 fi
Tom Stellard79d77b32012-04-20 16:56:46 +02002151}
2152
Marek Olšák98cebc92016-01-12 20:08:46 +01002153dnl This is for Glamor. Skip this if OpenGL is disabled.
Marek Olšákcc71df52014-04-24 13:40:56 +02002154require_egl_drm() {
Marek Olšák98cebc92016-01-12 20:08:46 +01002155 if test "x$enable_opengl" = xno; then
2156 return 0
2157 fi
2158
Marek Olšákcc71df52014-04-24 13:40:56 +02002159 case "$with_egl_platforms" in
2160 *drm*)
2161 ;;
2162 *)
2163 AC_MSG_ERROR([--with-egl-platforms=drm is required to build the $1 driver.])
2164 ;;
2165 esac
2166 if test "x$enable_gbm" != xyes; then
2167 AC_MSG_ERROR([--enable-gbm is required to build the $1 driver.])
2168 fi
2169}
2170
Tom Stellard8d977852012-05-10 10:21:54 -04002171radeon_llvm_check() {
Tom Stellard4d35eef2015-06-11 15:42:25 +00002172 if test ${LLVM_VERSION_INT} -lt 307; then
2173 amdgpu_llvm_target_name='r600'
2174 else
2175 amdgpu_llvm_target_name='amdgpu'
2176 fi
Emil Velikov929f8332014-02-07 22:13:44 +00002177 if test "x$enable_gallium_llvm" != "xyes"; then
2178 AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
2179 fi
Marek Olšák100796c2016-02-10 21:48:59 +01002180 llvm_check_version_for "3" "6" "0" $1
Tom Stellard4d35eef2015-06-11 15:42:25 +00002181 if test true && $LLVM_CONFIG --targets-built | grep -iqvw $amdgpu_llvm_target_name ; then
2182 AC_MSG_ERROR([LLVM $amdgpu_llvm_target_name not enabled in your LLVM build.])
Tom Stellard8d977852012-05-10 10:21:54 -04002183 fi
Tom Stellard4d35eef2015-06-11 15:42:25 +00002184 LLVM_COMPONENTS="${LLVM_COMPONENTS} $amdgpu_llvm_target_name bitreader ipo"
Christian König5b2855b2013-04-03 10:18:35 +02002185 NEED_RADEON_LLVM=yes
Jan Veselyab538302014-10-21 11:59:34 -04002186 if test "x$have_libelf" != xyes; then
2187 AC_MSG_ERROR([$1 requires libelf when using llvm])
2188 fi
Tom Stellard8d977852012-05-10 10:21:54 -04002189}
2190
Tim Rowley7bb193d2016-02-24 20:56:38 -06002191swr_llvm_check() {
2192 gallium_require_llvm $1
2193 if test ${LLVM_VERSION_INT} -lt 306; then
2194 AC_MSG_ERROR([LLVM version 3.6 or later required when building $1])
2195 fi
2196 if test "x$enable_gallium_llvm" != "xyes"; then
2197 AC_MSG_ERROR([--enable-gallium-llvm is required when building $1])
2198 fi
2199}
2200
Marek Olšák02c8ee22011-06-27 08:02:31 +02002201dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
Emil Velikovf41102b2014-02-04 17:32:03 +00002202if test -n "$with_gallium_drivers"; then
Marek Olšák58b6a192011-06-14 07:46:59 +02002203 gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
2204 for driver in $gallium_drivers; do
2205 case "x$driver" in
2206 xsvga)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002207 HAVE_GALLIUM_SVGA=yes
Matt Turnerb66791d2014-09-21 14:58:07 -07002208 gallium_require_drm "svga"
Emil Velikov4687b0a2014-02-24 22:58:13 +00002209 gallium_require_drm_loader
Marek Olšák58b6a192011-06-14 07:46:59 +02002210 ;;
2211 xi915)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002212 HAVE_GALLIUM_I915=yes
Emil Velikovc2426bb2011-07-14 23:07:19 +01002213 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
Matt Turnerb66791d2014-09-21 14:58:07 -07002214 gallium_require_drm "Gallium i915"
Emil Velikov4687b0a2014-02-24 22:58:13 +00002215 gallium_require_drm_loader
Marek Olšák58b6a192011-06-14 07:46:59 +02002216 ;;
Chia-I Wu5816a472012-12-13 06:01:23 +08002217 xilo)
2218 HAVE_GALLIUM_ILO=yes
2219 PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
Matt Turnerb66791d2014-09-21 14:58:07 -07002220 gallium_require_drm "Gallium i965/ilo"
Chia-I Wu5816a472012-12-13 06:01:23 +08002221 gallium_require_drm_loader
Chia-I Wu5816a472012-12-13 06:01:23 +08002222 ;;
Marek Olšák58b6a192011-06-14 07:46:59 +02002223 xr300)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002224 HAVE_GALLIUM_R300=yes
Jerome Glissec0c979e2012-01-30 17:22:13 -05002225 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
Matt Turnerb66791d2014-09-21 14:58:07 -07002226 gallium_require_drm "Gallium R300"
Emil Velikov4687b0a2014-02-24 22:58:13 +00002227 gallium_require_drm_loader
Marek Olšák58b6a192011-06-14 07:46:59 +02002228 gallium_require_llvm "Gallium R300"
Marek Olšák58b6a192011-06-14 07:46:59 +02002229 ;;
2230 xr600)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002231 HAVE_GALLIUM_R600=yes
Jerome Glissec0c979e2012-01-30 17:22:13 -05002232 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
Matt Turnerb66791d2014-09-21 14:58:07 -07002233 gallium_require_drm "Gallium R600"
Tom Stellard79d77b32012-04-20 16:56:46 +02002234 gallium_require_drm_loader
Tom Stellard08980472013-01-25 16:43:11 +01002235 if test "x$enable_opencl" = xyes; then
Marek Olšák20a09892016-03-11 15:49:21 +01002236 radeon_llvm_check "r600g"
Tom Stellard08980472013-01-25 16:43:11 +01002237 LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
2238 fi
Marek Olšák58b6a192011-06-14 07:46:59 +02002239 ;;
Tom Stellarda75c6162012-01-06 17:38:37 -05002240 xradeonsi)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002241 HAVE_GALLIUM_RADEONSI=yes
Michel Dänzer24bc3822012-05-12 12:12:21 +02002242 PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
Marek Olšák2eb067d2015-04-16 22:43:23 +02002243 PKG_CHECK_MODULES([AMDGPU], [libdrm_amdgpu >= $LIBDRM_AMDGPU_REQUIRED])
Matt Turnerb66791d2014-09-21 14:58:07 -07002244 gallium_require_drm "radeonsi"
Michel Dänzer24bc3822012-05-12 12:12:21 +02002245 gallium_require_drm_loader
Emil Velikov929f8332014-02-07 22:13:44 +00002246 radeon_llvm_check "radeonsi"
Marek Olšákcc71df52014-04-24 13:40:56 +02002247 require_egl_drm "radeonsi"
Tom Stellarda75c6162012-01-06 17:38:37 -05002248 ;;
Marek Olšák58b6a192011-06-14 07:46:59 +02002249 xnouveau)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002250 HAVE_GALLIUM_NOUVEAU=yes
Emil Velikovc2426bb2011-07-14 23:07:19 +01002251 PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
Matt Turnerb66791d2014-09-21 14:58:07 -07002252 gallium_require_drm "nouveau"
Tom Stellard79d77b32012-04-20 16:56:46 +02002253 gallium_require_drm_loader
Marek Olšák58b6a192011-06-14 07:46:59 +02002254 ;;
Rob Clark6173cc12012-10-27 11:07:34 -05002255 xfreedreno)
2256 HAVE_GALLIUM_FREEDRENO=yes
2257 PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
Matt Turnerb66791d2014-09-21 14:58:07 -07002258 gallium_require_drm "freedreno"
Rob Clark6173cc12012-10-27 11:07:34 -05002259 gallium_require_drm_loader
Rob Clark6173cc12012-10-27 11:07:34 -05002260 ;;
Marek Olšák58b6a192011-06-14 07:46:59 +02002261 xswrast)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002262 HAVE_GALLIUM_SOFTPIPE=yes
Marek Olšákc6f59fc2011-07-26 01:05:13 +02002263 if test "x$MESA_LLVM" = x1; then
Matt Turner2cbb94b2012-09-07 21:04:44 -07002264 HAVE_GALLIUM_LLVMPIPE=yes
Giovanni Campagna3b176c42014-07-23 19:37:31 +01002265 fi
Marek Olšák58b6a192011-06-14 07:46:59 +02002266 ;;
Tim Rowley7bb193d2016-02-24 20:56:38 -06002267 xswr)
2268 AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
2269 swr_llvm_check "swr"
2270
2271 AC_MSG_CHECKING([whether $CXX supports AVX/AVX2])
2272 AVX_CXXFLAGS="-march=core-avx-i"
2273 AVX2_CXXFLAGS="-march=core-avx2"
2274
2275 AC_LANG_PUSH([C++])
2276 save_CXXFLAGS="$CXXFLAGS"
2277 CXXFLAGS="$AVX_CXXFLAGS $CXXFLAGS"
2278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],[],
2279 [AC_MSG_ERROR([AVX compiler support not detected])])
2280 CXXFLAGS="$save_CXXFLAGS"
2281
2282 save_CFLAGS="$CXXFLAGS"
2283 CXXFLAGS="$AVX2_CXXFLAGS $CXXFLAGS"
2284 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],[],
2285 [AC_MSG_ERROR([AVX2 compiler support not detected])])
2286 CXXFLAGS="$save_CXXFLAGS"
2287 AC_LANG_POP([C++])
2288
2289 HAVE_GALLIUM_SWR=yes
2290 ;;
Eric Anholt1850d0a2014-06-19 08:19:38 +01002291 xvc4)
2292 HAVE_GALLIUM_VC4=yes
Matt Turnerb66791d2014-09-21 14:58:07 -07002293 gallium_require_drm "vc4"
Eric Anholt1850d0a2014-06-19 08:19:38 +01002294 gallium_require_drm_loader
Eric Anholt1850d0a2014-06-19 08:19:38 +01002295
Eric Anholtf5b26b42015-09-16 15:51:00 -04002296 PKG_CHECK_MODULES([SIMPENROSE], [simpenrose],
Eric Anholta39eac82015-11-21 13:07:42 -08002297 [USE_VC4_SIMULATOR=yes;
2298 DEFINES="$DEFINES -DUSE_VC4_SIMULATOR"],
2299 [USE_VC4_SIMULATOR=no])
Eric Anholt1850d0a2014-06-19 08:19:38 +01002300 ;;
Dave Airliea8987b82015-01-22 15:11:47 +10002301 xvirgl)
2302 HAVE_GALLIUM_VIRGL=yes
2303 gallium_require_drm "virgl"
2304 gallium_require_drm_loader
2305 require_egl_drm "virgl"
2306 ;;
Marek Olšák58b6a192011-06-14 07:46:59 +02002307 *)
2308 AC_MSG_ERROR([Unknown Gallium driver: $driver])
2309 ;;
2310 esac
2311 done
Chia-I Wua1306f42010-01-22 15:51:51 +08002312fi
Tom Stellard69d639b2013-01-18 15:08:28 +00002313
2314dnl Set LLVM_LIBS - This is done after the driver configuration so
Jan Vesely993e2922014-10-21 12:19:13 -04002315dnl that drivers can add additional components to LLVM_COMPONENTS.
Tom Stellard69d639b2013-01-18 15:08:28 +00002316dnl Previously, gallium drivers were updating LLVM_LIBS directly
2317dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
2318dnl this was causing the same libraries to be appear multiple times
2319dnl in LLVM_LIBS.
2320
Tom Stellard7a850c52013-01-25 12:46:55 -05002321if test "x$MESA_LLVM" != x0; then
Tom Stellardcf69a592013-01-18 16:26:12 +00002322
Jan Vesely04085af2016-02-12 18:58:55 -05002323 if ! $LLVM_CONFIG --libs ${LLVM_COMPONENTS} >/dev/null; then
2324 AC_MSG_ERROR([Calling ${LLVM_CONFIG} failed])
2325 fi
Tom Stellard7a850c52013-01-25 12:46:55 -05002326 LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
Tom Stellardcf69a592013-01-18 16:26:12 +00002327
Jon TURNEYadeba942015-09-04 14:00:19 +01002328 dnl llvm-config may not give the right answer when llvm is a built as a
2329 dnl single shared library, so we must work the library name out for
2330 dnl ourselves.
2331 dnl (See https://llvm.org/bugs/show_bug.cgi?id=6823)
Emil Velikov065b6ca2014-03-04 20:02:35 +00002332 if test "x$enable_llvm_shared_libs" = xyes; then
Tom Stellard7a850c52013-01-25 12:46:55 -05002333 dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
2334 LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
Jon TURNEYadeba942015-09-04 14:00:19 +01002335 AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"], [llvm_have_one_so=yes])
Tom Stellard7a850c52013-01-25 12:46:55 -05002336
2337 if test "x$llvm_have_one_so" = xyes; then
2338 dnl LLVM was built using auto*, so there is only one shared object.
2339 LLVM_LIBS="-l$LLVM_SO_NAME"
2340 else
2341 dnl If LLVM was built with CMake, there will be one shared object per
2342 dnl component.
Jon TURNEYadeba942015-09-04 14:00:19 +01002343 AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.$IMP_LIB_EXT"],
Jonathan Liuaf16f732013-06-04 23:04:44 +10002344 [AC_MSG_ERROR([Could not find llvm shared libraries:
Tom Stellardcf69a592013-01-18 16:26:12 +00002345 Please make sure you have built llvm with the --enable-shared option
2346 and that your llvm libraries are installed in $LLVM_LIBDIR
2347 If you have installed your llvm libraries to a different directory you
2348 can use the --with-llvm-prefix= configure flag to specify this directory.
Emil Velikov065b6ca2014-03-04 20:02:35 +00002349 NOTE: Mesa is attempting to use llvm shared libraries by default.
Tom Stellardcf69a592013-01-18 16:26:12 +00002350 If you do not want to build with llvm shared libraries and instead want to
Emil Velikov065b6ca2014-03-04 20:02:35 +00002351 use llvm static libraries then add --disable-llvm-shared-libs to your configure
2352 invocation and rebuild.])])
Tom Stellardcf69a592013-01-18 16:26:12 +00002353
Tom Stellard7a850c52013-01-25 12:46:55 -05002354 dnl We don't need to update LLVM_LIBS in this case because the LLVM
Jan Vesely993e2922014-10-21 12:19:13 -04002355 dnl install uses a shared object for each component and we have
Tom Stellard7a850c52013-01-25 12:46:55 -05002356 dnl already added all of these objects to LLVM_LIBS.
2357 fi
Emil Velikov065b6ca2014-03-04 20:02:35 +00002358 else
Jan Veselyaf9551e2014-10-23 17:17:07 -04002359 AC_MSG_WARN([Building mesa with statically linked LLVM may cause compilation issues])
2360 dnl We need to link to llvm system libs when using static libs
2361 dnl However, only llvm 3.5+ provides --system-libs
2362 if test $LLVM_VERSION_MAJOR -eq 3 -a $LLVM_VERSION_MINOR -ge 5; then
2363 LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --system-libs`"
2364 fi
Tom Stellardcf69a592013-01-18 16:26:12 +00002365 fi
Tom Stellard69d639b2013-01-18 15:08:28 +00002366fi
2367
Matt Turner2cbb94b2012-09-07 21:04:44 -07002368AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
2369AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
Chia-I Wu5816a472012-12-13 06:01:23 +08002370AM_CONDITIONAL(HAVE_GALLIUM_ILO, test "x$HAVE_GALLIUM_ILO" = xyes)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002371AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
2372AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
2373AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
Emil Velikovd812c742014-05-10 14:35:08 +01002374AM_CONDITIONAL(HAVE_GALLIUM_RADEON_COMMON, test "x$HAVE_GALLIUM_R600" = xyes -o \
2375 "x$HAVE_GALLIUM_RADEONSI" = xyes)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002376AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
Rob Clark6173cc12012-10-27 11:07:34 -05002377AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
Matt Turner2cbb94b2012-09-07 21:04:44 -07002378AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
2379AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
Tim Rowley7bb193d2016-02-24 20:56:38 -06002380AM_CONDITIONAL(HAVE_GALLIUM_SWR, test "x$HAVE_GALLIUM_SWR" = xyes)
Eric Anholt1850d0a2014-06-19 08:19:38 +01002381AM_CONDITIONAL(HAVE_GALLIUM_VC4, test "x$HAVE_GALLIUM_VC4" = xyes)
Dave Airliea8987b82015-01-22 15:11:47 +10002382AM_CONDITIONAL(HAVE_GALLIUM_VIRGL, test "x$HAVE_GALLIUM_VIRGL" = xyes)
Chia-I Wua1306f42010-01-22 15:51:51 +08002383
Emil Velikov44ec4682014-09-08 23:52:46 +01002384AM_CONDITIONAL(HAVE_GALLIUM_STATIC_TARGETS, test "x$enable_shared_pipe_drivers" = xno)
Emil Velikov949beb02014-05-16 15:09:26 +01002385
Emil Velikov950e06a2015-10-17 21:14:09 +01002386if test "x$enable_dri" = xyes; then
2387 GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRI"
Francisco Jereze1364532012-04-25 22:16:00 +02002388fi
2389
Emil Velikov950e06a2015-10-17 21:14:09 +01002390if test "x$have_drisw_kms" = xyes; then
2391 GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_KMS"
2392fi
2393AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
2394
Matt Turner07f2dee2013-03-05 10:25:55 -08002395AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
2396AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
2397AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
2398AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
2399AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
2400AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
Matt Turner07f2dee2013-03-05 10:25:55 -08002401
Emil Velikov0d0313c2014-09-05 14:06:21 +01002402AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$HAVE_GALLIUM_R300" = xyes -o \
Matt Turnerb3f1f662013-01-20 15:32:08 -08002403 "x$HAVE_GALLIUM_R600" = xyes -o \
2404 "x$HAVE_GALLIUM_RADEONSI" = xyes)
Matt Turnerb3f1f662013-01-20 15:32:08 -08002405AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
Christian König5b2855b2013-04-03 10:18:35 +02002406AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
Tom Stellardd85e5122012-04-20 14:46:45 -04002407AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
Tom Stellard80d290d2012-08-24 11:48:32 -07002408AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
Eric Anholt1850d0a2014-06-19 08:19:38 +01002409AM_CONDITIONAL(USE_VC4_SIMULATOR, test x$USE_VC4_SIMULATOR = xyes)
2410if test "x$USE_VC4_SIMULATOR" = xyes -a "x$HAVE_GALLIUM_ILO" = xyes; then
2411 AC_MSG_ERROR([VC4 simulator on x86 replaces i965 driver build, so ilo must be disabled.])
2412fi
Tom Stellard80d290d2012-08-24 11:48:32 -07002413
Emil Velikov26d380d2014-01-19 03:09:03 +00002414AM_CONDITIONAL(HAVE_LIBDRM, test "x$have_libdrm" = xyes)
Matt Turner13a70102013-01-19 00:35:43 -08002415AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
2416AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
Matt Turner2f142d52013-08-20 14:16:17 -07002417AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
Eric Anholtf9d15622012-05-24 13:59:21 -07002418
Matt Turnerd8abd672013-11-05 13:53:45 -08002419AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o "x$asm_arch" = xx86_64)
Matt Turner957c7572013-11-05 11:20:12 -08002420AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
2421AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
Eric Anholtf9d15622012-05-24 13:59:21 -07002422
Joakim Sindholtfdd96572011-08-04 15:14:06 +02002423AC_SUBST([NINE_MAJOR], 1)
2424AC_SUBST([NINE_MINOR], 0)
Emil Velikov9b7037a2014-11-22 04:23:05 +00002425AC_SUBST([NINE_TINY], 0)
2426AC_SUBST([NINE_VERSION], "$NINE_MAJOR.$NINE_MINOR.$NINE_TINY")
Joakim Sindholtfdd96572011-08-04 15:14:06 +02002427
Matt Turner184b2f02012-09-05 17:06:16 -07002428AC_SUBST([VDPAU_MAJOR], 1)
2429AC_SUBST([VDPAU_MINOR], 0)
2430
Christian König38679332014-07-02 16:35:28 -04002431VA_MAJOR=`$PKG_CONFIG --modversion libva | $SED -n 's/\([[^\.]]*\)\..*$/\1/p'`
2432VA_MINOR=`$PKG_CONFIG --modversion libva | $SED -n 's/.*\.\(.*\)\..*$/\1/p'`
2433AC_SUBST([VA_MAJOR], $VA_MAJOR)
2434AC_SUBST([VA_MINOR], $VA_MINOR)
2435
Matt Turner0b132df2012-09-07 20:47:04 -07002436AC_SUBST([XVMC_MAJOR], 1)
2437AC_SUBST([XVMC_MINOR], 0)
2438
Emil Velikov56f53162014-04-07 13:17:01 +01002439XA_HEADER="$srcdir/src/gallium/state_trackers/xa/xa_tracker.h"
2440XA_MAJOR=`grep "#define XA_TRACKER_VERSION_MAJOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MAJOR //'`
2441XA_MINOR=`grep "#define XA_TRACKER_VERSION_MINOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MINOR //'`
2442XA_TINY=`grep "#define XA_TRACKER_VERSION_PATCH" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_PATCH //'`
2443
2444AC_SUBST([XA_MAJOR], $XA_MAJOR)
2445AC_SUBST([XA_MINOR], $XA_MINOR)
2446AC_SUBST([XA_TINY], $XA_TINY)
Matt Turnerd53901c2012-09-07 15:24:24 -07002447AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
2448
Dan Nicholsondca1b792007-10-23 09:25:58 -07002449dnl Restore LDFLAGS and CPPFLAGS
2450LDFLAGS="$_SAVE_LDFLAGS"
2451CPPFLAGS="$_SAVE_CPPFLAGS"
2452
Johannes Obermayr6016dab2013-09-12 00:32:40 +02002453dnl Suppress clang's warnings about unused CFLAGS and CXXFLAGS
2454if test "x$acv_mesa_CLANG" = xyes; then
2455 CFLAGS="$CFLAGS -Qunused-arguments"
2456 CXXFLAGS="$CXXFLAGS -Qunused-arguments"
2457fi
2458
Marcin Baczyńskiff2efdf2011-07-13 21:26:49 +02002459dnl Add user CFLAGS and CXXFLAGS
2460CFLAGS="$CFLAGS $USER_CFLAGS"
2461CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
2462
Dan Nicholsondca1b792007-10-23 09:25:58 -07002463dnl Substitute the config
Matt Turnerc8747402012-09-05 20:29:20 -07002464AC_CONFIG_FILES([Makefile
Matt Turner63c3a052012-09-24 14:30:21 -07002465 src/Makefile
Emil Velikov2f863832015-11-23 17:03:04 +00002466 src/compiler/Makefile
Emil Velikove3420392015-07-14 01:58:33 +01002467 src/egl/Makefile
Eric Anholt88612022012-02-05 10:46:13 +01002468 src/egl/main/egl.pc
Matt Turner383a70b2012-08-22 10:01:42 -07002469 src/egl/wayland/wayland-drm/Makefile
Benjamin Franzke8b902052012-01-24 20:38:01 +01002470 src/egl/wayland/wayland-egl/Makefile
2471 src/egl/wayland/wayland-egl/wayland-egl.pc
Emil Velikovfd7da272014-08-13 00:00:50 +01002472 src/gallium/Makefile
Tom Stellard80d290d2012-08-24 11:48:32 -07002473 src/gallium/auxiliary/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002474 src/gallium/auxiliary/pipe-loader/Makefile
Matt Turner5c6e1e92013-03-12 17:09:55 -07002475 src/gallium/drivers/freedreno/Makefile
Marek Olšák525921e2015-07-04 14:10:21 +02002476 src/gallium/drivers/ddebug/Makefile
Matt Turner7d5496a2012-08-29 10:31:29 -07002477 src/gallium/drivers/i915/Makefile
Chia-I Wu5816a472012-12-13 06:01:23 +08002478 src/gallium/drivers/ilo/Makefile
Matt Turner960cbd82012-08-29 12:04:45 -07002479 src/gallium/drivers/llvmpipe/Makefile
Emil Velikov38d80c02013-06-05 23:33:38 +01002480 src/gallium/drivers/noop/Makefile
Matt Turner1cf66322012-08-29 12:33:57 -07002481 src/gallium/drivers/nouveau/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002482 src/gallium/drivers/r300/Makefile
2483 src/gallium/drivers/r600/Makefile
Tom Stellard0dcb9ae2012-08-30 12:55:29 -04002484 src/gallium/drivers/radeon/Makefile
Matt Turnerda2d98f2012-08-29 14:29:08 -07002485 src/gallium/drivers/radeonsi/Makefile
Matt Turnerb51cdfa2012-08-29 11:42:45 -07002486 src/gallium/drivers/rbug/Makefile
Matt Turnerf781d4c2012-08-29 12:17:57 -07002487 src/gallium/drivers/softpipe/Makefile
Matt Turner0a421312012-08-29 12:29:47 -07002488 src/gallium/drivers/svga/Makefile
Tim Rowley7bb193d2016-02-24 20:56:38 -06002489 src/gallium/drivers/swr/Makefile
2490 src/gallium/drivers/swr/avx/Makefile
2491 src/gallium/drivers/swr/avx2/Makefile
Tom Stellard047fe042012-08-24 11:46:32 -07002492 src/gallium/drivers/trace/Makefile
Eric Anholt1850d0a2014-06-19 08:19:38 +01002493 src/gallium/drivers/vc4/Makefile
Dave Airliea8987b82015-01-22 15:11:47 +10002494 src/gallium/drivers/virgl/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002495 src/gallium/state_trackers/clover/Makefile
Matt Turner2ff51cd2012-08-29 20:30:22 -07002496 src/gallium/state_trackers/dri/Makefile
Emil Velikov921fdf12013-09-22 16:14:06 +01002497 src/gallium/state_trackers/glx/xlib/Makefile
Joakim Sindholtfdd96572011-08-04 15:14:06 +02002498 src/gallium/state_trackers/nine/Makefile
Christian König15e39ca2013-08-05 11:41:27 -06002499 src/gallium/state_trackers/omx/Makefile
Christian König79aa29d2014-02-11 16:55:30 +01002500 src/gallium/state_trackers/osmesa/Makefile
Christian König38679332014-07-02 16:35:28 -04002501 src/gallium/state_trackers/va/Makefile
Matt Turnerd2ca32e2012-09-04 13:13:51 -07002502 src/gallium/state_trackers/vdpau/Makefile
Matt Turner2ad26032012-09-04 15:17:11 -07002503 src/gallium/state_trackers/xa/Makefile
Matt Turner984562d2012-09-04 21:08:19 -07002504 src/gallium/state_trackers/xvmc/Makefile
Joakim Sindholtfdd96572011-08-04 15:14:06 +02002505 src/gallium/targets/d3dadapter9/Makefile
2506 src/gallium/targets/d3dadapter9/d3d.pc
Emil Velikov6eabddd2014-06-16 14:23:50 +01002507 src/gallium/targets/dri/Makefile
Matt Turner026d1fe2014-06-10 18:11:56 -07002508 src/gallium/targets/libgl-xlib/Makefile
Emil Velikovb1f4a962014-06-12 16:33:58 +01002509 src/gallium/targets/omx/Makefile
Matt Turner026d1fe2014-06-10 18:11:56 -07002510 src/gallium/targets/opencl/Makefile
Igor Gnatenko4d7e0fa2015-07-07 13:05:04 +03002511 src/gallium/targets/opencl/mesa.icd
Brian Paul79eac7d2013-03-11 18:31:21 -06002512 src/gallium/targets/osmesa/Makefile
Jon Severinssonc8111902013-08-23 11:18:59 +02002513 src/gallium/targets/osmesa/osmesa.pc
Matt Turner45270fb2012-09-13 10:45:01 -07002514 src/gallium/targets/pipe-loader/Makefile
Christian König38679332014-07-02 16:35:28 -04002515 src/gallium/targets/va/Makefile
Emil Velikov9df2c492014-06-12 15:41:29 +01002516 src/gallium/targets/vdpau/Makefile
Matt Turner026d1fe2014-06-10 18:11:56 -07002517 src/gallium/targets/xa/Makefile
2518 src/gallium/targets/xa/xatracker.pc
Emil Velikovdc01ca42014-06-12 15:54:15 +01002519 src/gallium/targets/xvmc/Makefile
Andreas Boll59088a22012-11-26 19:58:12 +01002520 src/gallium/tests/trivial/Makefile
Andreas Bollcb4d5022012-11-27 19:18:25 +01002521 src/gallium/tests/unit/Makefile
Matt Turner5c6e1e92013-03-12 17:09:55 -07002522 src/gallium/winsys/freedreno/drm/Makefile
Matt Turner266d6392012-08-29 10:37:07 -07002523 src/gallium/winsys/i915/drm/Makefile
Chia-I Wu5816a472012-12-13 06:01:23 +08002524 src/gallium/winsys/intel/drm/Makefile
Matt Turner77fc30b2012-08-29 14:39:48 -07002525 src/gallium/winsys/nouveau/drm/Makefile
Tom Stellard34a61502012-08-24 11:44:57 -07002526 src/gallium/winsys/radeon/drm/Makefile
Marek Olšák2eb067d2015-04-16 22:43:23 +02002527 src/gallium/winsys/amdgpu/drm/Makefile
Matt Turner2b5a1c02012-08-29 14:48:25 -07002528 src/gallium/winsys/svga/drm/Makefile
Matt Turnera6b3cd12012-08-29 15:24:40 -07002529 src/gallium/winsys/sw/dri/Makefile
Giovanni Campagna3b176c42014-07-23 19:37:31 +01002530 src/gallium/winsys/sw/kms-dri/Makefile
Matt Turner1c9fb3c2012-08-29 15:32:43 -07002531 src/gallium/winsys/sw/null/Makefile
Matt Turner24c2fe92012-08-29 15:46:57 -07002532 src/gallium/winsys/sw/wrapper/Makefile
Matt Turner44653c02012-08-29 15:51:40 -07002533 src/gallium/winsys/sw/xlib/Makefile
Eric Anholt1850d0a2014-06-19 08:19:38 +01002534 src/gallium/winsys/vc4/drm/Makefile
Dave Airliea8987b82015-01-22 15:11:47 +10002535 src/gallium/winsys/virgl/drm/Makefile
Dave Airlieb3b82fe2015-03-13 14:15:47 +10002536 src/gallium/winsys/virgl/vtest/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002537 src/gbm/Makefile
2538 src/gbm/main/gbm.pc
Eric Anholt8ffb0982012-02-05 06:10:56 +01002539 src/glx/Makefile
Jon TURNEY5a459a02014-05-12 10:47:07 +01002540 src/glx/apple/Makefile
Ian Romanick2e8c8662012-05-23 15:23:22 -07002541 src/glx/tests/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002542 src/gtest/Makefile
Emil Velikov8c2e7fd2014-01-10 23:36:16 +00002543 src/loader/Makefile
Matt Turner691c3042013-01-18 23:43:05 -08002544 src/mapi/Makefile
Matt Turnera6b8b702012-08-21 14:36:44 -07002545 src/mapi/es1api/glesv1_cm.pc
Matt Turner0f8110c2012-08-21 14:52:59 -07002546 src/mapi/es2api/glesv2.pc
Eric Anholt3a70f752012-06-11 12:59:21 -07002547 src/mapi/glapi/gen/Makefile
Eric Anholt417c1a62012-06-12 12:10:58 -07002548 src/mesa/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002549 src/mesa/gl.pc
Matt Turner129213e2012-01-15 11:50:20 -05002550 src/mesa/drivers/dri/dri.pc
Matt Turner80aa7812012-01-26 19:31:12 -05002551 src/mesa/drivers/dri/common/Makefile
Carl Worthb587a752012-12-03 15:43:19 -08002552 src/mesa/drivers/dri/common/xmlpool/Makefile
Matt Turner3c87dfc2012-01-14 21:57:32 -05002553 src/mesa/drivers/dri/i915/Makefile
Eric Anholte3264802012-01-12 14:28:37 -08002554 src/mesa/drivers/dri/i965/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002555 src/mesa/drivers/dri/Makefile
Matt Turner3f964342012-01-15 10:20:30 -05002556 src/mesa/drivers/dri/nouveau/Makefile
Matt Turnerb38d7a02012-01-15 10:04:58 -05002557 src/mesa/drivers/dri/r200/Makefile
Matt Turnere0ee8182012-01-14 22:21:30 -05002558 src/mesa/drivers/dri/radeon/Makefile
Eric Anholt2d4b77c2012-06-12 11:38:19 -07002559 src/mesa/drivers/dri/swrast/Makefile
Laurent Carlier284325d2012-06-24 09:51:27 +02002560 src/mesa/drivers/osmesa/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002561 src/mesa/drivers/osmesa/osmesa.pc
Eric Anholtfa4cf4d2012-05-15 12:23:00 -07002562 src/mesa/drivers/x11/Makefile
Matt Turner383a70b2012-08-22 10:01:42 -07002563 src/mesa/main/tests/Makefile
Kenneth Graunke1e0da622014-02-24 23:39:14 -08002564 src/util/Makefile
Kenneth Graunke72e55bb2014-02-25 01:08:45 -08002565 src/util/tests/hash_table/Makefile])
Dan Nicholsondca1b792007-10-23 09:25:58 -07002566
Dan Nicholsone14ebbc2008-05-06 11:28:43 -07002567AC_OUTPUT
Dan Nicholsonaab38cf2007-12-11 08:21:51 -08002568
Dan Nicholson9cad8e32007-11-30 08:49:57 -08002569dnl
2570dnl Output some configuration info for the user
2571dnl
2572echo ""
2573echo " prefix: $prefix"
2574echo " exec_prefix: $exec_prefix"
2575echo " libdir: $libdir"
Dan Nicholson11ac5b22008-07-03 09:17:44 -07002576echo " includedir: $includedir"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08002577
Chia-I Wu815faa42010-10-29 12:34:44 +08002578dnl API info
2579echo ""
2580echo " OpenGL: $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
Chia-I Wu815faa42010-10-29 12:34:44 +08002581
Dan Nicholson9cad8e32007-11-30 08:49:57 -08002582dnl Driver info
2583echo ""
Matt Turner2f142d52013-08-20 14:16:17 -07002584case "x$enable_osmesa$enable_gallium_osmesa" in
2585xnoyes)
2586 echo " OSMesa: lib$OSMESA_LIB (Gallium)"
2587 ;;
2588xyesno)
Chia-I Wu815faa42010-10-29 12:34:44 +08002589 echo " OSMesa: lib$OSMESA_LIB"
Matt Turner2f142d52013-08-20 14:16:17 -07002590 ;;
2591xnono)
Chia-I Wu815faa42010-10-29 12:34:44 +08002592 echo " OSMesa: no"
Matt Turner2f142d52013-08-20 14:16:17 -07002593 ;;
2594esac
Chia-I Wu9e7a4142011-06-26 13:24:32 +09002595
Jon TURNEY45f9aae2014-05-12 10:17:06 +01002596echo ""
Chia-I Wu9e7a4142011-06-26 13:24:32 +09002597if test "x$enable_dri" != xno; then
Jon TURNEY45f9aae2014-05-12 10:17:06 +01002598 echo " DRI platform: $dri_platform"
Emil Velikov8015ffe2014-02-11 14:47:37 +00002599 if test -z "$DRI_DIRS"; then
Chia-I Wu815faa42010-10-29 12:34:44 +08002600 echo " DRI drivers: no"
2601 else
Emil Velikovee555002014-02-04 17:26:38 +00002602 echo " DRI drivers: $DRI_DIRS"
Chia-I Wu815faa42010-10-29 12:34:44 +08002603 fi
2604 echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
Dan Nicholson544ab202007-12-30 08:41:53 -08002605fi
Chia-I Wu9e7a4142011-06-26 13:24:32 +09002606
2607case "x$enable_glx$enable_xlib_glx" in
2608xyesyes)
2609 echo " GLX: Xlib-based"
2610 ;;
2611xyesno)
2612 echo " GLX: DRI-based"
Chia-I Wu9e7a4142011-06-26 13:24:32 +09002613 ;;
2614*)
2615 echo " GLX: $enable_glx"
2616 ;;
2617esac
2618
Chia-I Wu815faa42010-10-29 12:34:44 +08002619dnl EGL
2620echo ""
2621echo " EGL: $enable_egl"
2622if test "$enable_egl" = yes; then
Matt Turner3647efa2013-03-09 17:26:43 -08002623 echo " EGL platforms: $egl_platforms"
Chia-I Wu12300502010-10-31 21:01:54 +08002624
2625 egl_drivers=""
Eric Anholt88612022012-02-05 10:46:13 +01002626 if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
2627 egl_drivers="$egl_drivers builtin:egl_dri2"
2628 fi
Boyan Dingf35198b2015-07-21 23:44:00 +08002629 if test "x$HAVE_EGL_DRIVER_DRI3" != "x"; then
2630 egl_drivers="$egl_drivers builtin:egl_dri3"
2631 fi
Chia-I Wu12300502010-10-31 21:01:54 +08002632
Marek Olšákc46c5512014-11-01 14:05:16 +01002633 echo " EGL drivers: $egl_drivers"
Florent Thoumieb5095ab2008-07-28 14:44:43 +01002634fi
Dan Nicholson9cad8e32007-11-30 08:49:57 -08002635
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01002636echo ""
Eric Anholt1a8b1272010-05-21 12:17:24 -07002637if test "x$MESA_LLVM" = x1; then
Jakob Bornecrantzfe0fe672010-04-28 13:38:58 +01002638 echo " llvm: yes"
2639 echo " llvm-config: $LLVM_CONFIG"
2640 echo " llvm-version: $LLVM_VERSION"
2641else
2642 echo " llvm: no"
2643fi
2644
2645echo ""
Matt Turnera9676ae2013-01-18 23:59:49 -08002646if test -n "$with_gallium_drivers"; then
Ilia Mirkinfd5e0582015-10-14 15:49:58 -04002647 echo " Gallium drivers: $gallium_drivers"
2648 echo " Gallium st: $gallium_st"
Jakob Bornecrantz7e54d7d2009-02-11 02:38:21 +01002649else
2650 echo " Gallium: no"
2651fi
2652
Carl Worth59216f52015-01-14 15:53:00 -08002653dnl Shader cache
2654echo ""
2655echo " Shader cache: $enable_shader_cache"
2656if test "x$enable_shader_cache" = "xyes"; then
2657 echo " With SHA1 from: $with_sha1"
2658fi
Daniel Vetter8f15c312011-11-28 22:24:26 +01002659
Dan Nicholson9cad8e32007-11-30 08:49:57 -08002660dnl Libraries
2661echo ""
2662echo " Shared libs: $enable_shared"
2663echo " Static libs: $enable_static"
Matt Turner53248e52012-08-17 11:25:14 -07002664echo " Shared-glapi: $enable_shared_glapi"
Dan Nicholson9cad8e32007-11-30 08:49:57 -08002665
Dan Nicholson16a07fb2007-12-12 09:12:15 -08002666dnl Compiler options
2667# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
Matt Turner3ed95dc2012-09-05 20:41:08 -07002668cflags=`echo $CFLAGS | \
Dan Nicholson16a07fb2007-12-12 09:12:15 -08002669 $SED 's/^ *//;s/ */ /;s/ *$//'`
Matt Turner3ed95dc2012-09-05 20:41:08 -07002670cxxflags=`echo $CXXFLAGS | \
Dan Nicholson16a07fb2007-12-12 09:12:15 -08002671 $SED 's/^ *//;s/ */ /;s/ *$//'`
Eric Anholte4269492012-06-11 10:25:05 -07002672defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
Dan Nicholson16a07fb2007-12-12 09:12:15 -08002673echo ""
2674echo " CFLAGS: $cflags"
2675echo " CXXFLAGS: $cxxflags"
2676echo " Macros: $defines"
Kenneth Graunke3acc8262010-10-25 13:52:58 -07002677echo ""
Marek Olšáka84a8da2012-11-27 22:32:50 +01002678if test "x$MESA_LLVM" = x1; then
2679 echo " LLVM_CFLAGS: $LLVM_CFLAGS"
2680 echo " LLVM_CXXFLAGS: $LLVM_CXXFLAGS"
2681 echo " LLVM_CPPFLAGS: $LLVM_CPPFLAGS"
Marek Olšák61293bf2015-04-13 21:44:02 +02002682 echo " LLVM_LDFLAGS: $LLVM_LDFLAGS"
Marek Olšáka84a8da2012-11-27 22:32:50 +01002683 echo ""
2684fi
Kenneth Graunke3acc8262010-10-25 13:52:58 -07002685echo " PYTHON2: $PYTHON2"
Dan Nicholson16a07fb2007-12-12 09:12:15 -08002686
Dan Nicholsondca1b792007-10-23 09:25:58 -07002687echo ""
Dan Nicholsonb6459422008-03-24 10:01:50 -07002688echo " Run '${MAKE-make}' to build Mesa"
Dan Nicholsondca1b792007-10-23 09:25:58 -07002689echo ""