Subversion Repositories Kolibri OS

Rev

Rev 4358 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4358 Serge 1
dnl Process this file with autoconf to create configure.
2
 
3
AC_PREREQ([2.60])
4
 
5
dnl Tell the user about autoconf.html in the --help output
6
m4_divert_once([HELP_END], [
7
See docs/autoconf.html for more details on the options for Mesa.])
8
 
4401 Serge 9
AC_INIT([Mesa], [9.2.5],
4358 Serge 10
    [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
11
AC_CONFIG_AUX_DIR([bin])
12
AC_CONFIG_MACRO_DIR([m4])
13
AC_CANONICAL_SYSTEM
14
AM_INIT_AUTOMAKE([foreign])
15
 
16
dnl http://people.gnome.org/~walters/docs/build-api.txt
17
dnl We don't support srcdir != builddir.
18
echo \#buildapi-variable-no-builddir >/dev/null
19
 
20
# Support silent build rules, requires at least automake-1.11. Disable
21
# by either passing --disable-silent-rules to configure or passing V=1
22
# to make
23
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
24
    [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
25
 
26
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
27
 
28
dnl Set internal versions
29
OSMESA_VERSION=8
30
AC_SUBST([OSMESA_VERSION])
31
 
32
dnl Versions for external dependencies
33
LIBDRM_REQUIRED=2.4.24
34
LIBDRM_RADEON_REQUIRED=2.4.46
35
LIBDRM_INTEL_REQUIRED=2.4.38
36
LIBDRM_NVVIEUX_REQUIRED=2.4.33
37
LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
38
LIBDRM_FREEDRENO_REQUIRED=2.4.39
39
DRI2PROTO_REQUIRED=2.6
40
GLPROTO_REQUIRED=1.4.14
41
LIBDRM_XORG_REQUIRED=2.4.24
42
LIBKMS_XORG_REQUIRED=1.0.0
43
 
44
dnl Check for progs
45
AC_PROG_CPP
46
AC_PROG_CC
47
AX_PROG_CC_FOR_BUILD
48
AC_PROG_CXX
49
AX_PROG_CXX_FOR_BUILD
50
AM_PROG_CC_C_O
51
AM_PROG_AS
52
AC_CHECK_PROGS([MAKE], [gmake make])
53
AC_CHECK_PROGS([PYTHON2], [python2 python])
54
AX_PYTHON_MODULE([libxml2], [needed])
55
AC_PROG_SED
56
AC_PROG_MKDIR_P
57
 
58
LT_PREREQ([2.2])
59
LT_INIT([disable-static])
60
 
61
AX_PROG_BISON([],
62
              AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"],
63
                    [AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
64
AX_PROG_FLEX([],
65
             AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"],
66
                   [AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
67
 
68
AC_PATH_PROG([PERL], [perl])
69
 
70
AC_CHECK_PROG(INDENT, indent, indent, cat)
71
if test "x$INDENT" != "xcat"; then
72
    AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
73
fi
74
 
75
AC_PROG_INSTALL
76
 
77
dnl We need a POSIX shell for parts of the build. Assume we have one
78
dnl in most cases.
79
case "$host_os" in
80
solaris*)
81
    # Solaris /bin/sh is too old/non-POSIX compliant
82
    AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh])
83
    SHELL="$POSIX_SHELL"
84
    ;;
85
esac
86
 
87
dnl clang is mostly GCC-compatible, but its version is much lower,
88
dnl so we have to check for it.
89
AC_MSG_CHECKING([if compiling with clang])
90
 
91
AC_COMPILE_IFELSE(
92
[AC_LANG_PROGRAM([], [[
93
#ifndef __clang__
94
       not clang
95
#endif
96
]])],
97
[acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
98
 
99
AC_MSG_RESULT([$acv_mesa_CLANG])
100
 
101
dnl If we're using GCC, make sure that it is at least version 3.3.0.  Older
102
dnl versions are explictly not supported.
103
GEN_ASM_OFFSETS=no
104
if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
105
    AC_MSG_CHECKING([whether gcc version is sufficient])
106
    major=0
107
    minor=0
108
 
109
    GCC_VERSION=`$CC -dumpversion`
110
    if test $? -eq 0; then
111
        GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
112
        GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
113
    fi
114
 
115
    if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a $GCC_VERSION_MINOR -lt 3 ; then
116
        AC_MSG_RESULT([no])
117
        AC_MSG_ERROR([If using GCC, version 3.3.0 or later is required.])
118
    else
119
        AC_MSG_RESULT([yes])
120
    fi
121
 
122
    if test "x$cross_compiling" = xyes; then
123
        GEN_ASM_OFFSETS=yes
124
    fi
125
fi
126
AM_CONDITIONAL([GEN_ASM_OFFSETS], test "x$GEN_ASM_OFFSETS" = xyes)
127
 
128
dnl Make sure the pkg-config macros are defined
129
m4_ifndef([PKG_PROG_PKG_CONFIG],
130
    [m4_fatal([Could not locate the pkg-config autoconf macros.
131
  These are usually located in /usr/share/aclocal/pkg.m4. If your macros
132
  are in a different location, try setting the environment variable
133
  ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])])
134
PKG_PROG_PKG_CONFIG()
135
 
136
dnl LIB_DIR - library basename
137
LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
138
AC_SUBST([LIB_DIR])
139
 
140
dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
141
_SAVE_LDFLAGS="$LDFLAGS"
142
_SAVE_CPPFLAGS="$CPPFLAGS"
143
 
144
dnl build host compiler macros
145
DEFINES_FOR_BUILD=""
146
AC_SUBST([DEFINES_FOR_BUILD])
147
case "$build_os" in
148
linux*|*-gnu*|gnu*)
149
    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -D_GNU_SOURCE"
150
    ;;
151
solaris*)
152
    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DSVR4"
153
    ;;
154
cygwin*)
155
    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD"
156
    ;;
157
esac
158
 
159
dnl Compiler macros
160
DEFINES=""
161
AC_SUBST([DEFINES])
162
case "$host_os" in
163
linux*|*-gnu*|gnu*)
164
    DEFINES="$DEFINES -D_GNU_SOURCE -DHAVE_PTHREAD"
165
    ;;
166
solaris*)
167
    DEFINES="$DEFINES -DHAVE_PTHREAD -DSVR4"
168
    ;;
169
cygwin*)
170
    DEFINES="$DEFINES -DHAVE_PTHREAD"
171
    ;;
172
esac
173
 
174
dnl Add flags for gcc and g++
175
if test "x$GCC" = xyes; then
176
    case "$host_os" in
177
    cygwin*)
178
        CFLAGS="$CFLAGS -Wall -std=gnu99"
179
        ;;
180
    *)
181
        CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -Wall -std=c99"
182
        CFLAGS="$CFLAGS -Wall -std=c99"
183
        ;;
184
    esac
185
 
186
    # Enable -Werror=implicit-function-declaration and
187
    # -Werror=missing-prototypes, if available, or otherwise, just
188
    # -Wmissing-prototypes.  This is particularly useful to avoid
189
    # generating a loadable driver module that has undefined symbols.
190
    save_CFLAGS="$CFLAGS"
191
    AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
192
    CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
193
    CFLAGS="$CFLAGS -Werror=missing-prototypes"
194
    AC_LINK_IFELSE([AC_LANG_PROGRAM()],
195
		   AC_MSG_RESULT([yes]),
196
		   [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
197
		    AC_MSG_RESULT([no])]);
198
 
199
    # Enable -fvisibility=hidden if using a gcc that supports it
200
    save_CFLAGS="$CFLAGS"
201
    AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
202
    VISIBILITY_CFLAGS="-fvisibility=hidden"
203
    CFLAGS="$CFLAGS $VISIBILITY_CFLAGS"
204
    AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
205
		   [VISIBILITY_CFLAGS=""; AC_MSG_RESULT([no])]);
206
 
207
    # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
208
    CFLAGS=$save_CFLAGS
209
 
210
    # Work around aliasing bugs - developers should comment this out
211
    CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-strict-aliasing"
212
    CFLAGS="$CFLAGS -fno-strict-aliasing"
213
 
214
    # gcc's builtin memcmp is slower than glibc's
215
    # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
216
    CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-builtin-memcmp"
217
    CFLAGS="$CFLAGS -fno-builtin-memcmp"
218
fi
219
if test "x$GXX" = xyes; then
220
    CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -Wall"
221
    CXXFLAGS="$CXXFLAGS -Wall"
222
 
223
    # Enable -fvisibility=hidden if using a gcc that supports it
224
    save_CXXFLAGS="$CXXFLAGS"
225
    AC_MSG_CHECKING([whether $CXX supports -fvisibility=hidden])
226
    VISIBILITY_CXXFLAGS="-fvisibility=hidden"
227
    CXXFLAGS="$CXXFLAGS $VISIBILITY_CXXFLAGS"
228
    AC_LANG_PUSH([C++])
229
    AC_LINK_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
230
		   [VISIBILITY_CXXFLAGS="" ; AC_MSG_RESULT([no])]);
231
    AC_LANG_POP([C++])
232
 
233
    # Restore CXXFLAGS; VISIBILITY_CXXFLAGS are added to it where needed.
234
    CXXFLAGS=$save_CXXFLAGS
235
 
236
    # Work around aliasing bugs - developers should comment this out
237
    CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-strict-aliasing"
238
    CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
239
 
240
    # gcc's builtin memcmp is slower than glibc's
241
    # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
242
    CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-builtin-memcmp"
243
    CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
244
fi
245
 
246
dnl even if the compiler appears to support it, using visibility attributes isn't
247
dnl going to do anything useful currently on cygwin apart from emit lots of warnings
248
case "$host_os" in
249
cygwin*)
250
    VISIBILITY_CFLAGS=""
251
    VISIBILITY_CXXFLAGS=""
252
    ;;
253
esac
254
 
255
AC_SUBST([VISIBILITY_CFLAGS])
256
AC_SUBST([VISIBILITY_CXXFLAGS])
257
 
258
dnl
259
dnl Hacks to enable 32 or 64 bit build
260
dnl
261
AC_ARG_ENABLE([32-bit],
262
    [AS_HELP_STRING([--enable-32-bit],
263
        [build 32-bit libraries @<:@default=auto@:>@])],
264
    [enable_32bit="$enableval"],
265
    [enable_32bit=auto]
266
)
267
if test "x$enable_32bit" = xyes; then
268
    if test "x$GCC" = xyes; then
269
        CFLAGS="$CFLAGS -m32"
270
        CCASFLAGS="$CCASFLAGS -m32"
271
    fi
272
    if test "x$GXX" = xyes; then
273
        CXXFLAGS="$CXXFLAGS -m32"
274
    fi
275
fi
276
AC_ARG_ENABLE([64-bit],
277
    [AS_HELP_STRING([--enable-64-bit],
278
        [build 64-bit libraries @<:@default=auto@:>@])],
279
    [enable_64bit="$enableval"],
280
    [enable_64bit=auto]
281
)
282
if test "x$enable_64bit" = xyes; then
283
    if test "x$GCC" = xyes; then
284
        CFLAGS="$CFLAGS -m64"
285
    fi
286
    if test "x$GXX" = xyes; then
287
        CXXFLAGS="$CXXFLAGS -m64"
288
    fi
289
fi
290
 
291
dnl Can't have static and shared libraries, default to static if user
292
dnl explicitly requested. If both disabled, set to static since shared
293
dnl was explicitly requested.
294
case "x$enable_static$enable_shared" in
295
xyesyes )
296
    AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
297
    enable_shared=no
298
    ;;
299
xnono )
300
    AC_MSG_WARN([Cannot disable both static and shared libraries, enabling static])
301
    enable_static=yes
302
    ;;
303
esac
304
 
305
AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
306
 
307
dnl
308
dnl other compiler options
309
dnl
310
AC_ARG_ENABLE([debug],
311
    [AS_HELP_STRING([--enable-debug],
312
        [use debug compiler flags and macros @<:@default=disabled@:>@])],
313
    [enable_debug="$enableval"],
314
    [enable_debug=no]
315
)
316
if test "x$enable_debug" = xyes; then
317
    DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DDEBUG"
318
    if test "x$GCC_FOR_BUILD" = xyes; then
319
        CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -g -O0"
320
    fi
321
    if test "x$GXX_FOR_BUILD" = xyes; then
322
        CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -g -O0"
323
    fi
324
 
325
    DEFINES="$DEFINES -DDEBUG"
326
    if test "x$GCC" = xyes; then
327
        CFLAGS="$CFLAGS -g -O0"
328
    fi
329
    if test "x$GXX" = xyes; then
330
        CXXFLAGS="$CXXFLAGS -g -O0"
331
    fi
332
fi
333
 
334
dnl
335
dnl library names
336
dnl
337
LIB_PREFIX_GLOB='lib'
338
LIB_VERSION_SEPARATOR='.'
339
if test "$enable_static" = yes; then
340
    LIB_EXTENSION='a'
341
else
342
    case "$host_os" in
343
    darwin* )
344
        LIB_EXTENSION='dylib' ;;
345
    cygwin* )
346
        dnl prefix can be 'cyg' or 'lib'
347
        LIB_PREFIX_GLOB='???'
348
        LIB_VERSION_SEPARATOR='-'
349
        LIB_EXTENSION='dll' ;;
350
    aix* )
351
        LIB_EXTENSION='a' ;;
352
    * )
353
        LIB_EXTENSION='so' ;;
354
    esac
355
fi
356
AC_ARG_WITH([gl-lib-name],
357
  [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@],
358
    [specify GL library name @<:@default=GL@:>@])],
359
  [GL_LIB=$withval],
360
  [GL_LIB=GL])
361
AC_ARG_WITH([osmesa-lib-name],
362
  [AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
363
    [specify OSMesa library name @<:@default=OSMesa@:>@])],
364
  [OSMESA_LIB=$withval],
365
  [OSMESA_LIB=OSMesa])
366
AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
367
AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
368
 
369
dnl
370
dnl Mangled Mesa support
371
dnl
372
AC_ARG_ENABLE([mangling],
373
  [AS_HELP_STRING([--enable-mangling],
374
    [enable mangled symbols and library name @<:@default=disabled@:>@])],
375
  [enable_mangling="${enableval}"],
376
  [enable_mangling=no]
377
)
378
if test "x${enable_mangling}" = "xyes" ; then
379
  DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
380
  GL_LIB="Mangled${GL_LIB}"
381
  OSMESA_LIB="Mangled${OSMESA_LIB}"
382
fi
383
AC_SUBST([GL_LIB])
384
AC_SUBST([OSMESA_LIB])
385
 
386
dnl
387
dnl potentially-infringing-but-nobody-knows-for-sure stuff
388
dnl
389
AC_ARG_ENABLE([texture-float],
390
    [AS_HELP_STRING([--enable-texture-float],
391
        [enable floating-point textures and renderbuffers @<:@default=disabled@:>@])],
392
    [enable_texture_float="$enableval"],
393
    [enable_texture_float=no]
394
)
395
if test "x$enable_texture_float" = xyes; then
396
    AC_MSG_WARN([Floating-point textures enabled.])
397
    AC_MSG_WARN([Please consult docs/patents.txt with your lawyer before building Mesa.])
398
    DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED"
399
fi
400
 
401
GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
402
OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
403
EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
404
GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
405
GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
406
VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
407
GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
408
 
409
GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
410
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
411
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
412
GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
413
GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
414
VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
415
GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
416
 
417
AC_SUBST([GL_LIB_NAME])
418
AC_SUBST([OSMESA_LIB_NAME])
419
AC_SUBST([EGL_LIB_NAME])
420
AC_SUBST([GLESv1_CM_LIB_NAME])
421
AC_SUBST([GLESv2_LIB_NAME])
422
AC_SUBST([VG_LIB_NAME])
423
AC_SUBST([GLAPI_LIB_NAME])
424
 
425
AC_SUBST([GL_LIB_GLOB])
426
AC_SUBST([EGL_LIB_GLOB])
427
AC_SUBST([GLESv1_CM_LIB_GLOB])
428
AC_SUBST([GLESv2_LIB_GLOB])
429
AC_SUBST([VG_LIB_GLOB])
430
AC_SUBST([GLAPI_LIB_GLOB])
431
 
432
dnl
433
dnl Arch/platform-specific settings
434
dnl
435
AC_ARG_ENABLE([asm],
436
    [AS_HELP_STRING([--disable-asm],
437
        [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
438
    [enable_asm="$enableval"],
439
    [enable_asm=yes]
440
)
441
asm_arch=""
442
AC_MSG_CHECKING([whether to enable assembly])
443
test "x$enable_asm" = xno && AC_MSG_RESULT([no])
444
# disable if cross compiling on x86/x86_64 since we must run gen_matypes
445
if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
446
    case "$host_cpu" in
447
    i?86 | x86_64 | amd64)
448
        enable_asm=no
449
        AC_MSG_RESULT([no, cross compiling])
450
        ;;
451
    esac
452
fi
453
# check for supported arches
454
if test "x$enable_asm" = xyes; then
455
    case "$host_cpu" in
456
    i?86)
457
        case "$host_os" in
458
        linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
459
            test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
460
            ;;
461
        gnu*)
462
            asm_arch=x86
463
            ;;
464
        esac
465
        ;;
466
    x86_64|amd64)
467
        case "$host_os" in
468
        linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
469
            test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
470
            ;;
471
        esac
472
        ;;
473
    sparc*)
474
        case "$host_os" in
475
        linux*)
476
            asm_arch=sparc
477
            ;;
478
        esac
479
        ;;
480
    esac
481
 
482
    case "$asm_arch" in
483
    x86)
484
        DEFINES="$DEFINES -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
485
        AC_MSG_RESULT([yes, x86])
486
        ;;
487
    x86_64|amd64)
488
        DEFINES="$DEFINES -DUSE_X86_64_ASM"
489
        AC_MSG_RESULT([yes, x86_64])
490
        ;;
491
    sparc)
492
        DEFINES="$DEFINES -DUSE_SPARC_ASM"
493
        AC_MSG_RESULT([yes, sparc])
494
        ;;
495
    *)
496
        AC_MSG_RESULT([no, platform not supported])
497
        ;;
498
    esac
499
fi
500
 
501
dnl Check to see if dlopen is in default libraries (like Solaris, which
502
dnl has it in libc), or if libdl is needed to get it.
503
AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
504
    [AC_CHECK_LIB([dl], [dlopen],
505
       [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
506
AC_SUBST([DLOPEN_LIBS])
507
 
508
case "$host_os" in
509
darwin*|mingw*)
510
    ;;
511
*)
512
    AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=],
513
                   [AC_CHECK_LIB([rt], [clock_gettime], [CLOCK_LIB=-lrt],
514
                                 [AC_MSG_ERROR([Couldn't find clock_gettime])])])
515
    AC_SUBST([CLOCK_LIB])
516
    ;;
517
esac
518
 
519
dnl See if posix_memalign is available
520
AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
521
 
522
dnl Check for pthreads
523
AX_PTHREAD
524
dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
525
dnl to -pthread, which causes problems if we need -lpthread to appear in
526
dnl pkgconfig files.
527
test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
528
 
529
dnl SELinux awareness.
530
AC_ARG_ENABLE([selinux],
531
    [AS_HELP_STRING([--enable-selinux],
532
        [Build SELinux-aware Mesa @<:@default=disabled@:>@])],
533
    [MESA_SELINUX="$enableval"],
534
    [MESA_SELINUX=no])
535
if test "x$enable_selinux" = "xyes"; then
536
    AC_CHECK_HEADER([selinux/selinux.h],[],
537
                    [AC_MSG_ERROR([SELinux headers not found])])
538
    AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
539
                 [AC_MSG_ERROR([SELinux library not found])])
540
    SELINUX_LIBS="-lselinux"
541
    DEFINES="$DEFINES -DMESA_SELINUX"
542
fi
543
AC_SUBST([SELINUX_LIBS])
544
 
545
dnl Options for APIs
546
AC_ARG_ENABLE([opengl],
547
    [AS_HELP_STRING([--disable-opengl],
548
        [disable support for standard OpenGL API @<:@default=no@:>@])],
549
    [enable_opengl="$enableval"],
550
    [enable_opengl=yes])
551
AC_ARG_ENABLE([gles1],
552
    [AS_HELP_STRING([--enable-gles1],
553
        [enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
554
    [enable_gles1="$enableval"],
555
    [enable_gles1=no])
556
AC_ARG_ENABLE([gles2],
557
    [AS_HELP_STRING([--enable-gles2],
558
        [enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
559
    [enable_gles2="$enableval"],
560
    [enable_gles2=no])
561
AC_ARG_ENABLE([openvg],
562
    [AS_HELP_STRING([--enable-openvg],
563
        [enable support for OpenVG API @<:@default=no@:>@])],
564
    [enable_openvg="$enableval"],
565
    [enable_openvg=no])
566
 
567
AC_ARG_ENABLE([dri],
568
    [AS_HELP_STRING([--enable-dri],
569
        [enable DRI modules @<:@default=enabled@:>@])],
570
    [enable_dri="$enableval"],
571
    [enable_dri=yes])
572
AC_ARG_ENABLE([glx],
573
    [AS_HELP_STRING([--enable-glx],
574
        [enable GLX library @<:@default=enabled@:>@])],
575
    [enable_glx="$enableval"],
576
    [enable_glx=yes])
577
AC_ARG_ENABLE([osmesa],
578
    [AS_HELP_STRING([--enable-osmesa],
579
        [enable OSMesa library @<:@default=disabled@:>@])],
580
    [enable_osmesa="$enableval"],
581
    [enable_osmesa=no])
582
AC_ARG_ENABLE([gallium-osmesa],
583
    [AS_HELP_STRING([--enable-gallium-osmesa],
584
        [enable Gallium implementation of the OSMesa library @<:@default=disabled@:>@])],
585
    [enable_gallium_osmesa="$enableval"],
586
    [enable_gallium_osmesa=no])
587
AC_ARG_ENABLE([egl],
588
    [AS_HELP_STRING([--disable-egl],
589
        [disable EGL library @<:@default=enabled@:>@])],
590
    [enable_egl="$enableval"],
591
    [enable_egl=yes])
592
 
593
AC_ARG_ENABLE([xorg],
594
    [AS_HELP_STRING([--enable-xorg],
595
        [enable support for X.Org DDX API @<:@default=no@:>@])],
596
    [enable_xorg="$enableval"],
597
    [enable_xorg=no])
598
AC_ARG_ENABLE([xa],
599
    [AS_HELP_STRING([--enable-xa],
600
        [enable build of the XA X Acceleration API @<:@default=no@:>@])],
601
    [enable_xa="$enableval"],
602
    [enable_xa=no])
603
AC_ARG_ENABLE([gbm],
604
   [AS_HELP_STRING([--enable-gbm],
605
         [enable gbm library @<:@default=auto@:>@])],
606
   [enable_gbm="$enableval"],
607
   [enable_gbm=auto])
608
 
609
AC_ARG_ENABLE([xvmc],
610
   [AS_HELP_STRING([--enable-xvmc],
611
         [enable xvmc library @<:@default=auto@:>@])],
612
   [enable_xvmc="$enableval"],
613
   [enable_xvmc=auto])
614
AC_ARG_ENABLE([vdpau],
615
   [AS_HELP_STRING([--enable-vdpau],
616
         [enable vdpau library @<:@default=auto@:>@])],
617
   [enable_vdpau="$enableval"],
618
   [enable_vdpau=auto])
619
AC_ARG_ENABLE([opencl],
620
   [AS_HELP_STRING([--enable-opencl],
621
         [enable OpenCL library NOTE: Enabling this option will also enable
622
          --with-llvm-shared-libs
623
          @<:@default=no@:>@])],
624
   [],
625
   [enable_opencl=no])
626
AC_ARG_ENABLE([xlib_glx],
627
    [AS_HELP_STRING([--enable-xlib-glx],
628
        [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
629
    [enable_xlib_glx="$enableval"],
630
    [enable_xlib_glx=no])
631
AC_ARG_ENABLE([gallium_egl],
632
    [AS_HELP_STRING([--enable-gallium-egl],
633
        [enable optional EGL state tracker (not required
634
         for EGL support in Gallium with OpenGL and OpenGL ES)
635
         @<:@default=disable@:>@])],
636
    [enable_gallium_egl="$enableval"],
637
    [enable_gallium_egl=no])
638
AC_ARG_ENABLE([gallium_gbm],
639
    [AS_HELP_STRING([--enable-gallium-gbm],
640
        [enable optional gbm state tracker (not required for
641
         gbm support in Gallium)
642
         @<:@default=auto@:>@])],
643
    [enable_gallium_gbm="$enableval"],
644
    [enable_gallium_gbm=auto])
645
 
646
AC_ARG_ENABLE([r600-llvm-compiler],
647
    [AS_HELP_STRING([--enable-r600-llvm-compiler],
648
        [Enable experimental LLVM backend for graphics shaders @<:@default=disable@:>@])],
649
    [enable_r600_llvm="$enableval"],
650
    [enable_r600_llvm=no])
651
 
652
AC_ARG_ENABLE([gallium_tests],
653
    [AS_HELP_STRING([--enable-gallium-tests],
654
        [Enable optional Gallium tests) @<:@default=disable@:>@])],
655
    [enable_gallium_tests="$enableval"],
656
    [enable_gallium_tests=no])
657
 
658
# Option for Gallium drivers
659
 
660
# Keep this in sync with the --with-gallium-drivers help string default value
661
GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
662
 
663
AC_ARG_WITH([gallium-drivers],
664
    [AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
665
        [comma delimited Gallium drivers list, e.g.
666
        "i915,ilo,nouveau,r300,r600,radeonsi,freedreno,svga,swrast"
667
        @<:@default=r300,r600,svga,swrast@:>@])],
668
    [with_gallium_drivers="$withval"],
669
    [with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
670
 
671
# Doing '--without-gallium-drivers' will set this variable to 'no'.  Clear it
672
# here so that the script doesn't choke on an unknown driver name later.
673
case "$with_gallium_drivers" in
674
    yes) with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT" ;;
675
    no) with_gallium_drivers='' ;;
676
esac
677
 
678
if test "x$enable_opengl" = xno -a \
679
        "x$enable_gles1" = xno -a \
680
        "x$enable_gles2" = xno -a \
681
        "x$enable_openvg" = xno -a \
682
        "x$enable_xorg" = xno -a \
683
        "x$enable_xa" = xno -a \
684
        "x$enable_xvmc" = xno -a \
685
        "x$enable_vdpau" = xno -a \
686
        "x$enable_opencl" = xno; then
687
    AC_MSG_ERROR([at least one API should be enabled])
688
fi
689
 
690
# Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
691
if test "x$enable_opengl" = xno -a \
692
        "x$enable_gles1" = xyes; then
693
    AC_MSG_ERROR([Building OpenGL ES1 without OpenGL is not supported])
694
fi
695
 
696
if test "x$enable_opengl" = xno -a \
697
        "x$enable_gles2" = xyes; then
698
    AC_MSG_ERROR([Building OpenGL ES2 without OpenGL is not supported])
699
fi
700
 
701
AM_CONDITIONAL(HAVE_OPENGL, test "x$enable_opengl" = xyes)
702
AM_CONDITIONAL(HAVE_OPENGL_ES1, test "x$enable_gles1" = xyes)
703
AM_CONDITIONAL(HAVE_OPENGL_ES2, test "x$enable_gles2" = xyes)
704
AM_CONDITIONAL(NEED_OPENGL_COMMON, test "x$enable_opengl" = xyes -o \
705
                                        "x$enable_gles1" = xyes -o \
706
                                        "x$enable_gles2" = xyes)
707
 
708
if test "x$enable_glx" = xno; then
709
    AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
710
    enable_xlib_glx=no
711
fi
712
 
713
if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
714
    AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
715
fi
716
 
717
if test "x$enable_opengl$enable_xlib_glx" = xnoyes; then
718
    AC_MSG_ERROR([Xlib-GLX cannot be built without OpenGL])
719
fi
720
 
721
# Disable GLX if OpenGL is not enabled
722
if test "x$enable_glx$enable_opengl" = xyesno; then
723
    AC_MSG_WARN([OpenGL not enabled, disabling GLX])
724
    enable_glx=no
725
fi
726
 
727
# Disable GLX if DRI and Xlib-GLX are not enabled
728
if test "x$enable_glx" = xyes -a \
729
        "x$enable_dri" = xno -a \
730
        "x$enable_xlib_glx" = xno; then
731
    AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
732
    enable_glx=no
733
fi
734
 
735
AM_CONDITIONAL(HAVE_DRI_GLX, test "x$enable_glx" = xyes -a \
736
                                  "x$enable_dri" = xyes)
737
AM_CONDITIONAL(HAVE_DRI, test "x$enable_dri" = xyes)
738
AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
739
                                  "x$enable_osmesa" = xyes)
740
 
741
AC_ARG_ENABLE([shared-glapi],
742
    [AS_HELP_STRING([--enable-shared-glapi],
743
        [Enable shared glapi for OpenGL @<:@default=yes@:>@])],
744
    [enable_shared_glapi="$enableval"],
745
    [enable_shared_glapi="$enable_dri"])
746
 
747
# Shared GLAPI is only useful for DRI
748
if test "x$enable_dri" = xno; then
749
    AC_MSG_NOTICE([Shared GLAPI is only useful for DRI, disabling])
750
    enable_shared_glapi=no
751
fi
752
 
753
AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
754
 
755
dnl
756
dnl Driver specific build directories
757
dnl
758
GALLIUM_TARGET_DIRS=""
759
GALLIUM_WINSYS_DIRS="sw"
760
GALLIUM_DRIVERS_DIRS="galahad trace rbug noop identity"
761
GALLIUM_STATE_TRACKERS_DIRS=""
762
 
763
case "x$enable_glx$enable_xlib_glx" in
764
xyesyes)
765
    GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
766
    GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
767
    GALLIUM_STATE_TRACKERS_DIRS="glx $GALLIUM_STATE_TRACKERS_DIRS"
768
    NEED_WINSYS_XLIB="yes"
769
    ;;
770
esac
771
 
772
if test "x$enable_dri" = xyes; then
773
    GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/dri"
774
    GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS"
775
fi
776
 
777
if test "x$enable_gallium_osmesa" = xyes; then
778
    if test -z "$with_gallium_drivers"; then
779
        AC_MSG_ERROR([Cannot enable gallium_osmesa without Gallium])
780
    fi
781
    if test "x$enable_osmesa" = xyes; then
782
        AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
783
    fi
784
    GALLIUM_STATE_TRACKERS_DIRS="osmesa $GALLIUM_STATE_TRACKERS_DIRS"
785
    GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS osmesa"
786
fi
787
 
788
AC_SUBST([MESA_LLVM])
789
 
790
# Check for libdrm
791
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
792
                  [have_libdrm=yes], [have_libdrm=no])
793
 
794
if test "x$enable_dri" = xyes; then
795
    # DRI must be shared, I think
796
    if test "$enable_static" = yes; then
797
        AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
798
    fi
799
 
800
    # not a hard requirement as swrast does not depend on it
801
    if test "x$have_libdrm" = xyes; then
802
        DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
803
    fi
804
fi
805
 
806
dnl Direct rendering or just indirect rendering
807
case "$host_os" in
808
gnu*)
809
    dnl Disable by default on GNU/Hurd
810
    driglx_direct_default="no"
811
    ;;
812
cygwin*)
813
    dnl Disable by default on cygwin
814
    driglx_direct_default="no"
815
    ;;
816
*)
817
    driglx_direct_default="yes"
818
    ;;
819
esac
820
AC_ARG_ENABLE([driglx-direct],
821
    [AS_HELP_STRING([--disable-driglx-direct],
822
        [disable direct rendering in GLX and EGL for DRI \
823
            @<:@default=auto@:>@])],
824
    [driglx_direct="$enableval"],
825
    [driglx_direct="$driglx_direct_default"])
826
 
827
dnl
828
dnl libGL configuration per driver
829
dnl
830
case "x$enable_glx$enable_xlib_glx" in
831
xyesyes)
832
    # Xlib-based GLX
833
    PKG_CHECK_MODULES([XLIBGL], [x11 xext])
834
    GL_PC_REQ_PRIV="x11 xext"
835
    X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
836
    GL_LIB_DEPS="$XLIBGL_LIBS"
837
    GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
838
    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
839
    ;;
840
xyesno)
841
    # DRI-based GLX
842
    PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
843
    if test x"$driglx_direct" = xyes; then
844
        if test "x$have_libdrm" != xyes; then
845
            AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
846
        fi
847
        PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
848
        GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
849
    fi
850
 
851
    # find the DRI deps for libGL
852
    dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8"
853
 
854
    # add xf86vidmode if available
855
    PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
856
    if test "$HAVE_XF86VIDMODE" = yes ; then
857
        dri_modules="$dri_modules xxf86vm"
858
    fi
859
 
860
    PKG_CHECK_MODULES([DRIGL], [$dri_modules])
861
    GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
862
    X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
863
    GL_LIB_DEPS="$DRIGL_LIBS"
864
 
865
    # need DRM libs, $PTHREAD_LIBS, etc.
866
    GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
867
    GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
868
    ;;
869
esac
870
 
871
# This is outside the case (above) so that it is invoked even for non-GLX
872
# builds.
873
AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
874
 
875
GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
876
GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
877
GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
878
GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
879
 
880
AC_SUBST([X11_INCLUDES])
881
AC_SUBST([GL_LIB_DEPS])
882
AC_SUBST([GL_PC_REQ_PRIV])
883
AC_SUBST([GL_PC_LIB_PRIV])
884
AC_SUBST([GL_PC_CFLAGS])
885
AC_SUBST([DRI_PC_REQ_PRIV])
886
AC_SUBST([GLESv1_CM_LIB_DEPS])
887
AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
888
AC_SUBST([GLESv2_LIB_DEPS])
889
AC_SUBST([GLESv2_PC_LIB_PRIV])
890
 
891
DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la"
892
 
893
AC_SUBST([HAVE_XF86VIDMODE])
894
 
895
dnl
896
dnl More GLX setup
897
dnl
898
case "x$enable_glx$enable_xlib_glx" in
899
xyesyes)
900
    DEFINES="$DEFINES -DUSE_XSHM"
901
    ;;
902
xyesno)
903
    DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
904
    if test "x$driglx_direct" = xyes; then
905
        DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
906
    fi
907
    ;;
908
esac
909
 
910
dnl
911
dnl TLS detection
912
dnl
913
 
914
AC_ARG_ENABLE([glx-tls],
915
    [AS_HELP_STRING([--enable-glx-tls],
916
        [enable TLS support in GLX @<:@default=disabled@:>@])],
917
    [GLX_USE_TLS="$enableval"],
918
    [GLX_USE_TLS=no])
919
AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
920
 
921
AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
922
      [DEFINES="${DEFINES} -DGLX_USE_TLS -DHAVE_PTHREAD"])
923
 
924
dnl
925
dnl More DRI setup
926
dnl
927
dnl Directory for DRI drivers
928
AC_ARG_WITH([dri-driverdir],
929
    [AS_HELP_STRING([--with-dri-driverdir=DIR],
930
        [directory for the DRI drivers @<:@${libdir}/dri@:>@])],
931
    [DRI_DRIVER_INSTALL_DIR="$withval"],
932
    [DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
933
AC_SUBST([DRI_DRIVER_INSTALL_DIR])
934
dnl Extra search path for DRI drivers
935
AC_ARG_WITH([dri-searchpath],
936
    [AS_HELP_STRING([--with-dri-searchpath=DIRS...],
937
        [semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
938
    [DRI_DRIVER_SEARCH_DIR="$withval"],
939
    [DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
940
AC_SUBST([DRI_DRIVER_SEARCH_DIR])
941
dnl Which drivers to build - default is chosen by platform
942
AC_ARG_WITH([dri-drivers],
943
    [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
944
        [comma delimited DRI drivers list, e.g.
945
        "swrast,i965,radeon" @<:@default=auto@:>@])],
946
    [with_dri_drivers="$withval"],
947
    [with_dri_drivers=yes])
948
if test "x$with_dri_drivers" = x; then
949
    with_dri_drivers=no
950
fi
951
 
952
dnl If $with_dri_drivers is yes, directories will be added through
953
dnl platform checks
954
DRI_DIRS=""
955
case "$with_dri_drivers" in
956
no) ;;
957
yes)
958
    # classic DRI drivers
959
    if test "x$enable_opengl" = xyes; then
960
        DRI_DIRS="yes"
961
    fi
962
    ;;
963
*)
964
    # verify the requested driver directories exist
965
    dri_drivers=`IFS=', '; echo $with_dri_drivers`
966
    for driver in $dri_drivers; do
967
        test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
968
            AC_MSG_ERROR([DRI driver directory '$driver' does not exist])
969
    done
970
    DRI_DIRS="$dri_drivers"
971
    if test -n "$DRI_DIRS" -a "x$enable_opengl" != xyes; then
972
        AC_MSG_ERROR([--with-dri-drivers requires OpenGL])
973
    fi
974
    ;;
975
esac
976
 
977
dnl Set DRI_DIRS, DEFINES and LIB_DEPS
978
if test "x$enable_dri" = xyes; then
979
    # Platform specific settings and drivers to build
980
    case "$host_os" in
981
    linux*)
982
        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
983
        DEFINES="$DEFINES -DHAVE_ALIAS"
984
 
985
        case "$host_cpu" in
986
        x86_64|amd64)
987
            if test "x$DRI_DIRS" = "xyes"; then
988
                DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
989
            fi
990
            ;;
991
        powerpc*)
992
            # Build only the drivers for cards that exist on PowerPC.
993
            if test "x$DRI_DIRS" = "xyes"; then
994
                DRI_DIRS="r200 radeon swrast"
995
            fi
996
            ;;
997
        sparc*)
998
            # Build only the drivers for cards that exist on sparc
999
            if test "x$DRI_DIRS" = "xyes"; then
1000
                DRI_DIRS="r200 radeon swrast"
1001
            fi
1002
            ;;
1003
        esac
1004
        ;;
1005
    freebsd* | dragonfly* | *netbsd* | openbsd*)
1006
        DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
1007
        DEFINES="$DEFINES -DHAVE_ALIAS"
1008
 
1009
        if test "x$DRI_DIRS" = "xyes"; then
1010
            DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
1011
        fi
1012
        ;;
1013
    gnu*)
1014
        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
1015
        DEFINES="$DEFINES -DHAVE_ALIAS"
1016
	;;
1017
    solaris*)
1018
        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
1019
        ;;
1020
    cygwin*)
1021
        DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
1022
        if test "x$DRI_DIRS" = "xyes"; then
1023
            DRI_DIRS="swrast"
1024
        fi
1025
        ;;
1026
    esac
1027
 
1028
    # default drivers
1029
    if test "x$DRI_DIRS" = "xyes"; then
1030
        DRI_DIRS="i915 i965 nouveau r200 radeon swrast"
1031
    fi
1032
 
1033
    DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/  */ /g'`
1034
 
1035
    # Check for expat
1036
    EXPAT_INCLUDES=""
1037
    EXPAT_LIB=-lexpat
1038
    AC_ARG_WITH([expat],
1039
        [AS_HELP_STRING([--with-expat=DIR],
1040
            [expat install directory])],[
1041
        EXPAT_INCLUDES="-I$withval/include"
1042
        CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
1043
        LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
1044
        EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
1045
        ])
1046
    AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
1047
    save_LIBS="$LIBS"
1048
    AC_CHECK_LIB([expat],[XML_ParserCreate],[],
1049
        [AC_MSG_ERROR([Expat required for DRI.])])
1050
    LIBS="$save_LIBS"
1051
 
1052
    # If we are building any DRI driver other than swrast.
1053
    if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
1054
        # ... libdrm is required
1055
        if test "x$have_libdrm" != xyes; then
1056
            AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
1057
        fi
1058
        # ... and build dricommon
1059
        HAVE_COMMON_DRI=yes
1060
    fi
1061
 
1062
    # put all the necessary libs together
1063
    DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
1064
    GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
1065
fi
1066
AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
1067
AC_SUBST([EXPAT_INCLUDES])
1068
AC_SUBST([DRI_LIB_DEPS])
1069
AC_SUBST([GALLIUM_DRI_LIB_DEPS])
1070
 
1071
case $DRI_DIRS in
1072
*i915*|*i965*)
1073
    PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1074
 
1075
    for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
1076
        case $d in
1077
        i915)
1078
            HAVE_I915_DRI=yes;
1079
            ;;
1080
        i965)
1081
            HAVE_I965_DRI=yes;
1082
            ;;
1083
        esac
1084
    done
1085
 
1086
    ;;
1087
esac
1088
 
1089
case $DRI_DIRS in
1090
*nouveau*)
1091
    PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NVVIEUX_REQUIRED])
1092
    HAVE_NOUVEAU_DRI=yes;
1093
    ;;
1094
esac
1095
 
1096
case $DRI_DIRS in
1097
*radeon*|*r200*)
1098
    PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1099
 
1100
    for d in $(echo $DRI_DIRS | sed 's/,/ /g'); do
1101
        case $d in
1102
        radeon)
1103
            HAVE_RADEON_DRI=yes;
1104
            ;;
1105
        r200)
1106
            HAVE_R200_DRI=yes;
1107
            ;;
1108
        esac
1109
    done
1110
 
1111
    ;;
1112
esac
1113
 
1114
case $DRI_DIRS in
1115
*swrast*)
1116
    HAVE_SWRAST_DRI=yes;
1117
    ;;
1118
esac
1119
 
1120
dnl
1121
dnl OSMesa configuration
1122
dnl
1123
 
1124
dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
1125
AC_ARG_WITH([osmesa-bits],
1126
    [AS_HELP_STRING([--with-osmesa-bits=BITS],
1127
        [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
1128
    [osmesa_bits="$withval"],
1129
    [osmesa_bits=8])
1130
if test "x$osmesa_bits" != x8; then
1131
    if test "x$enable_dri" = xyes -o "x$enable_glx" = xyes; then
1132
        AC_MSG_WARN([Ignoring OSMesa channel bits because of non-OSMesa driver])
1133
        osmesa_bits=8
1134
    fi
1135
fi
1136
case "x$osmesa_bits" in
1137
x8)
1138
    OSMESA_LIB="${OSMESA_LIB}"
1139
    ;;
1140
x16|x32)
1141
    OSMESA_LIB="${OSMESA_LIB}$osmesa_bits"
1142
    DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
1143
    ;;
1144
*)
1145
    AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
1146
    ;;
1147
esac
1148
 
1149
if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
1150
    # only link libraries with osmesa if shared
1151
    if test "$enable_static" = no; then
1152
        OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
1153
    else
1154
        OSMESA_LIB_DEPS=""
1155
    fi
1156
    OSMESA_MESA_DEPS=""
1157
    OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
1158
fi
1159
 
1160
AC_SUBST([OSMESA_LIB_DEPS])
1161
AC_SUBST([OSMESA_MESA_DEPS])
1162
AC_SUBST([OSMESA_PC_REQ])
1163
AC_SUBST([OSMESA_PC_LIB_PRIV])
1164
 
1165
dnl
1166
dnl gbm configuration
1167
dnl
1168
if test "x$enable_gbm" = xauto; then
1169
    case "$with_egl_platforms" in
1170
        *drm*)
1171
            enable_gbm=yes ;;
1172
         *)
1173
            enable_gbm=no ;;
1174
    esac
1175
fi
1176
if test "x$enable_gbm" = xyes; then
1177
    PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
1178
                      AC_MSG_ERROR([gbm needs udev]))
1179
 
1180
    if test "x$enable_dri" = xyes; then
1181
        GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
1182
        if test "x$enable_shared_glapi" = xno; then
1183
            AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
1184
        fi
1185
    fi
1186
fi
1187
AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
1188
GBM_PC_REQ_PRIV="libudev"
1189
GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
1190
AC_SUBST([GBM_PC_REQ_PRIV])
1191
AC_SUBST([GBM_PC_LIB_PRIV])
1192
 
1193
dnl
1194
dnl EGL configuration
1195
dnl
1196
EGL_CLIENT_APIS=""
1197
 
1198
if test "x$enable_egl" = xyes; then
1199
    EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
1200
 
1201
    AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
1202
 
1203
    if test "$enable_static" != yes; then
1204
        # build egl_glx when libGL is built
1205
        PKG_CHECK_MODULES([LIBUDEV], [libudev > 150],
1206
                          [have_libudev=yes],[have_libudev=no])
1207
        if test "$have_libudev" = yes; then
1208
            DEFINES="$DEFINES -DHAVE_LIBUDEV"
1209
        fi
1210
 
1211
        if test "x$enable_dri" = xyes; then
1212
	    HAVE_EGL_DRIVER_DRI2=1
1213
	fi
1214
 
1215
    fi
1216
fi
1217
AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
1218
AC_SUBST([EGL_LIB_DEPS])
1219
 
1220
dnl
1221
dnl EGL Gallium configuration
1222
dnl
1223
if test "x$enable_gallium_egl" = xyes; then
1224
    if test "x$with_gallium_drivers" = x; then
1225
        AC_MSG_ERROR([cannot enable egl_gallium without Gallium])
1226
    fi
1227
    if test "x$enable_egl" = xno; then
1228
        AC_MSG_ERROR([cannot enable egl_gallium without EGL])
1229
    fi
1230
    if test "x$have_libdrm" != xyes; then
1231
        AC_MSG_ERROR([egl_gallium requires libdrm >= $LIBDRM_REQUIRED])
1232
    fi
1233
 
1234
    GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
1235
    GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
1236
fi
1237
AM_CONDITIONAL(HAVE_GALLIUM_EGL, test "x$enable_gallium_egl" = xyes)
1238
 
1239
dnl
1240
dnl gbm Gallium configuration
1241
dnl
1242
if test "x$enable_gallium_gbm" = xauto; then
1243
    case "$enable_gbm$enable_gallium_egl$enable_dri$with_egl_platforms" in
1244
        yesyesyes*drm*)
1245
            enable_gallium_gbm=yes ;;
1246
         *)
1247
            enable_gallium_gbm=no ;;
1248
    esac
1249
fi
1250
if test "x$enable_gallium_gbm" = xyes; then
1251
    if test "x$with_gallium_drivers" = x; then
1252
        AC_MSG_ERROR([cannot enable gbm_gallium without Gallium])
1253
    fi
1254
    if test "x$enable_gbm" = xno; then
1255
        AC_MSG_ERROR([cannot enable gbm_gallium without gbm])
1256
    fi
1257
    # gbm_gallium abuses DRI_LIB_DEPS to link.  Make sure it is set.
1258
    if test "x$enable_dri" = xno; then
1259
        AC_MSG_ERROR([gbm_gallium requires --enable-dri to build])
1260
    fi
1261
 
1262
    GALLIUM_STATE_TRACKERS_DIRS="gbm $GALLIUM_STATE_TRACKERS_DIRS"
1263
    GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS gbm"
1264
    enable_gallium_loader=yes
1265
fi
1266
AM_CONDITIONAL(HAVE_GALLIUM_GBM, test "x$enable_gallium_gbm" = xyes)
1267
 
1268
dnl
1269
dnl X.Org DDX configuration
1270
dnl
1271
if test "x$enable_xorg" = xyes; then
1272
    PKG_CHECK_MODULES([XORG], [xorg-server >= 1.6.0])
1273
    PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
1274
    PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
1275
    PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
1276
        HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
1277
        HAVE_XEXTPROTO_71="no")
1278
    GALLIUM_STATE_TRACKERS_DIRS="xorg $GALLIUM_STATE_TRACKERS_DIRS"
1279
fi
1280
AM_CONDITIONAL(HAVE_ST_XORG, test "x$enable_xorg" = xyes)
1281
 
1282
dnl
1283
dnl XA configuration
1284
dnl
1285
if test "x$enable_xa" = xyes; then
1286
AC_PROG_AWK
1287
AC_PROG_GREP
1288
AC_CHECK_PROG(NM, nm, "nm")
1289
if test "x$AWK" = x || test "x$GREP" = x || test "x$NM" = x; then
1290
AC_MSG_WARN([Missing one of nm, grep or awk. Disabling xa.])
1291
enable_xa=no
1292
fi
1293
fi
1294
if test "x$enable_xa" = xyes; then
1295
    GALLIUM_STATE_TRACKERS_DIRS="xa $GALLIUM_STATE_TRACKERS_DIRS"
1296
    AC_SUBST(AWK)
1297
    AC_SUBST(GREP)
1298
    AC_SUBST(NM)
1299
fi
1300
AM_CONDITIONAL(HAVE_ST_XA, test "x$enable_xa" = xyes)
1301
 
1302
dnl
1303
dnl OpenVG configuration
1304
dnl
1305
VG_LIB_DEPS=""
1306
 
1307
if test "x$enable_openvg" = xyes; then
1308
    if test "x$enable_egl" = xno; then
1309
        AC_MSG_ERROR([cannot enable OpenVG without EGL])
1310
    fi
1311
    if test "x$with_gallium_drivers" = x; then
1312
        AC_MSG_ERROR([cannot enable OpenVG without Gallium])
1313
    fi
1314
    if test "x$enable_gallium_egl" = xno; then
1315
        AC_MSG_ERROR([cannot enable OpenVG without egl_gallium])
1316
    fi
1317
 
1318
    EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
1319
    VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS"
1320
    GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
1321
    VG_PC_LIB_PRIV="-lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
1322
    AC_SUBST([VG_PC_LIB_PRIV])
1323
fi
1324
AM_CONDITIONAL(HAVE_OPENVG, test "x$enable_openvg" = xyes)
1325
 
1326
dnl
1327
dnl Gallium G3DVL configuration
1328
dnl
1329
if test -n "$with_gallium_drivers"; then
1330
    if test "x$enable_xvmc" = xauto; then
1331
	PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
1332
    fi
1333
 
1334
    if test "x$enable_vdpau" = xauto; then
1335
	PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
1336
    fi
1337
fi
1338
 
1339
if test "x$enable_xvmc" = xyes; then
1340
    PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 x11-xcb xcb-dri2 >= 1.8])
1341
    GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xvmc"
1342
fi
1343
AM_CONDITIONAL(HAVE_ST_XVMC, test "x$enable_xvmc" = xyes)
1344
 
1345
if test "x$enable_vdpau" = xyes; then
1346
    PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.4.1 x11-xcb xcb-dri2 >= 1.8])
1347
    GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
1348
fi
1349
AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
1350
 
1351
dnl
1352
dnl OpenCL configuration
1353
dnl
1354
 
1355
AC_ARG_WITH([libclc-path],
1356
   [AS_HELP_STRING([--with-libclc-path],
1357
         [DEPRECATED: See http://dri.freedesktop.org/wiki/GalliumCompute#How_to_Install])],
1358
   [LIBCLC_PATH="$withval"],
1359
   [LIBCLC_PATH=""])
1360
 
1361
if test "x$LIBCLC_PATH" != x; then
1362
   AC_MSG_ERROR([The --with-libclc-path option has been deprecated.
1363
                  Please review the updated build instructions for clover:
1364
		  http://dri.freedesktop.org/wiki/GalliumCompute])
1365
fi
1366
 
1367
 
1368
AC_ARG_WITH([clang-libdir],
1369
   [AS_HELP_STRING([--with-clang-libdir],
1370
         [Path to Clang libraries @<:@default=llvm-config --libdir@:>@])],
1371
   [CLANG_LIBDIR="$withval"],
1372
   [CLANG_LIBDIR=""])
1373
 
1374
LIBCLC_INCLUDEDIR=`pkg-config --variable=includedir libclc`
1375
LIBCLC_LIBEXECDIR=`pkg-config --variable=libexecdir libclc`
1376
AC_SUBST([LIBCLC_INCLUDEDIR])
1377
AC_SUBST([LIBCLC_LIBEXECDIR])
1378
 
1379
if test "x$enable_opencl" = xyes; then
1380
    if test "x$with_gallium_drivers" = x; then
1381
        AC_MSG_ERROR([cannot enable OpenCL without Gallium])
1382
    fi
1383
 
1384
    if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 6; then
1385
        AC_MSG_ERROR([gcc >= 4.6 is required to build clover])
1386
    fi
1387
 
1388
    if test "x$LIBCLC_INCLUDEDIR" == x || test "x$LIBCLC_LIBEXECDIR" == x; then
1389
        AC_MSG_ERROR([pkg-config cannot use libclc.pc which is required to build clover])
1390
    fi
1391
 
1392
    GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS clover"
1393
    GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS opencl"
1394
    enable_gallium_loader=yes
1395
fi
1396
AM_CONDITIONAL(HAVE_CLOVER, test "x$enable_opencl" = xyes)
1397
 
1398
dnl
1399
dnl Gallium configuration
1400
dnl
1401
AM_CONDITIONAL(HAVE_GALLIUM, test -n "$with_gallium_drivers")
1402
 
1403
AC_SUBST([LLVM_BINDIR])
1404
AC_SUBST([LLVM_CFLAGS])
1405
AC_SUBST([LLVM_CPPFLAGS])
1406
AC_SUBST([LLVM_CXXFLAGS])
1407
AC_SUBST([LLVM_LIBDIR])
1408
AC_SUBST([LLVM_LIBS])
1409
AC_SUBST([LLVM_LDFLAGS])
1410
AC_SUBST([LLVM_INCLUDEDIR])
1411
AC_SUBST([LLVM_VERSION])
1412
AC_SUBST([CLANG_RESOURCE_DIR])
1413
 
1414
case "x$enable_opengl$enable_gles1$enable_gles2" in
1415
x*yes*)
1416
    EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(GL_LIB)'
1417
    ;;
1418
esac
1419
 
1420
AC_SUBST([VG_LIB_DEPS])
1421
AC_SUBST([EGL_CLIENT_APIS])
1422
 
1423
dnl
1424
dnl EGL Platforms configuration
1425
dnl
1426
AC_ARG_WITH([egl-platforms],
1427
    [AS_HELP_STRING([--with-egl-platforms@<:@=DIRS...@:>@],
1428
        [comma delimited native platforms libEGL supports, e.g.
1429
        "x11,drm" @<:@default=auto@:>@])],
1430
    [with_egl_platforms="$withval"],
1431
    [if test "x$enable_egl" = xyes; then
1432
	with_egl_platforms="x11"
1433
    else
1434
	with_egl_platforms=""
1435
    fi])
1436
 
1437
EGL_PLATFORMS=""
1438
 
1439
if test "x$with_egl_platforms" != "x" -a "x$enable_egl" != xyes; then
1440
    AC_MSG_ERROR([cannot build egl state tracker without EGL library])
1441
fi
1442
 
1443
# Do per-EGL platform setups and checks
1444
egl_platforms=`IFS=', '; echo $with_egl_platforms`
1445
for plat in $egl_platforms; do
1446
	case "$plat" in
1447
	wayland)
1448
		PKG_CHECK_MODULES([WAYLAND], [wayland-client >= 1.0.2 wayland-server >= 1.0.2])
1449
		GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
1450
 
1451
                WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
1452
                AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],,
1453
                             [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
1454
		;;
1455
 
1456
	x11)
1457
		PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb-dri2 >= 1.8 xcb-xfixes])
1458
 
1459
                if test "x$enable_glx" = xyes; then
1460
                        HAVE_EGL_DRIVER_GLX=1
1461
                fi
1462
		;;
1463
 
1464
	drm)
1465
		test "x$enable_gbm" = "xno" &&
1466
			AC_MSG_ERROR([EGL platform drm needs gbm])
1467
		;;
1468
 
1469
	android|fbdev|gdi|null)
1470
		;;
1471
 
1472
	*)
1473
		AC_MSG_ERROR([EGL platform '$plat' does not exist])
1474
		;;
1475
	esac
1476
 
1477
        case "$plat$have_libudev" in
1478
                waylandno|drmno)
1479
                    AC_MSG_ERROR([cannot build $plat platfrom without udev]) ;;
1480
        esac
1481
done
1482
 
1483
# libEGL wants to default to the first platform specified in
1484
# ./configure.  parse that here.
1485
if test "x$egl_platforms" != "x"; then
1486
    FIRST_PLATFORM_CAPS=`echo $egl_platforms | sed 's| .*||' | tr 'a-z' 'A-Z'`
1487
    EGL_NATIVE_PLATFORM="_EGL_PLATFORM_$FIRST_PLATFORM_CAPS"
1488
else
1489
    EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
1490
fi
1491
 
1492
EGL_PLATFORMS="$egl_platforms"
1493
 
1494
if echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1; then
1495
    NEED_WINSYS_XLIB=yes
1496
fi
1497
AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1)
1498
AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep 'wayland' >/dev/null 2>&1)
1499
AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' >/dev/null 2>&1)
1500
AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' >/dev/null 2>&1)
1501
AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' >/dev/null 2>&1)
1502
 
1503
AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
1504
AM_CONDITIONAL(HAVE_EGL_DRIVER_GLX, test "x$HAVE_EGL_DRIVER_GLX" != "x")
1505
 
1506
AC_SUBST([EGL_NATIVE_PLATFORM])
1507
AC_SUBST([EGL_PLATFORMS])
1508
AC_SUBST([EGL_CFLAGS])
1509
 
1510
# If we don't have the X11 platform, set this define so we don't try to include
1511
# the X11 headers.
1512
if ! echo "$egl_platforms" | grep -q 'x11'; then
1513
    DEFINES="$DEFINES -DMESA_EGL_NO_X11_HEADERS"
1514
    GL_PC_CFLAGS="$GL_PC_CFLAGS -DMESA_EGL_NO_X11_HEADERS"
1515
fi
1516
 
1517
AC_ARG_WITH([egl-driver-dir],
1518
    [AS_HELP_STRING([--with-egl-driver-dir=DIR],
1519
                    [directory for EGL drivers [[default=${libdir}/egl]]])],
1520
    [EGL_DRIVER_INSTALL_DIR="$withval"],
1521
    [EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
1522
AC_SUBST([EGL_DRIVER_INSTALL_DIR])
1523
 
1524
AC_ARG_WITH([xorg-driver-dir],
1525
    [AS_HELP_STRING([--with-xorg-driver-dir=DIR],
1526
                    [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])],
1527
    [XORG_DRIVER_INSTALL_DIR="$withval"],
1528
    [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"])
1529
AC_SUBST([XORG_DRIVER_INSTALL_DIR])
1530
 
1531
AC_ARG_WITH([max-width],
1532
    [AS_HELP_STRING([--with-max-width=N],
1533
                    [Maximum framebuffer width (4096)])],
1534
    [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}";
1535
     AS_IF([test "${withval}" -gt "4096"],
1536
           [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1537
)
1538
AC_ARG_WITH([max-height],
1539
    [AS_HELP_STRING([--with-max-height=N],
1540
                    [Maximum framebuffer height (4096)])],
1541
    [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}";
1542
     AS_IF([test "${withval}" -gt "4096"],
1543
           [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
1544
)
1545
 
1546
dnl
1547
dnl Gallium LLVM
1548
dnl
1549
AC_ARG_ENABLE([gallium-llvm],
1550
    [AS_HELP_STRING([--enable-gallium-llvm],
1551
        [build gallium LLVM support @<:@default=enabled on x86/x86_64@:>@])],
1552
    [enable_gallium_llvm="$enableval"],
1553
    [enable_gallium_llvm=auto])
1554
 
1555
AC_ARG_WITH([llvm-shared-libs],
1556
    [AS_HELP_STRING([--with-llvm-shared-libs],
1557
        [link with LLVM shared libraries @<:@default=disabled@:>@])],
1558
    [],
1559
    [with_llvm_shared_libs=no])
1560
AS_IF([test x$enable_opencl = xyes],
1561
    [
1562
        AC_MSG_WARN([OpenCL required, forcing LLVM shared libraries])
1563
        with_llvm_shared_libs=yes
1564
    ])
1565
 
1566
AC_ARG_WITH([llvm-prefix],
1567
    [AS_HELP_STRING([--with-llvm-prefix],
1568
        [Prefix for LLVM installations in non-standard locations])],
1569
    [llvm_prefix="$withval"],
1570
    [llvm_prefix=""])
1571
 
1572
 
1573
# Call this inside ` ` to get the return value.
1574
# $1 is the llvm-config command with arguments.
1575
strip_unwanted_llvm_flags() {
1576
    # Use \> (marks the end of the word)
1577
    echo `$1` | sed \
1578
	-e 's/-DNDEBUG\>//g' \
1579
	-e 's/-pedantic\>//g' \
1580
	-e 's/-Wcovered-switch-default\>//g' \
1581
	-e 's/-O.\>//g' \
1582
	-e 's/-g\>//g' \
1583
	-e 's/-Wall\>//g' \
1584
	-e 's/-fomit-frame-pointer\>//g'
1585
}
1586
 
1587
 
1588
if test "x$with_gallium_drivers" = x; then
1589
    enable_gallium_llvm=no
1590
fi
1591
if test "x$enable_gallium_llvm" = xauto; then
1592
    case "$host_cpu" in
1593
    i*86|x86_64|amd64) enable_gallium_llvm=yes;;
1594
    esac
1595
fi
1596
if test "x$enable_gallium_llvm" = xyes; then
1597
    if test "x$llvm_prefix" != x; then
1598
        AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no], ["$llvm_prefix/bin"])
1599
    else
1600
        AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
1601
    fi
1602
 
1603
    if test "x$LLVM_CONFIG" != xno; then
1604
        LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
1605
        LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
1606
        LLVM_BINDIR=`$LLVM_CONFIG --bindir`
1607
        LLVM_CPPFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cppflags"`
1608
        LLVM_CFLAGS=$LLVM_CPPFLAGS   # CPPFLAGS seem to be sufficient
1609
        LLVM_CXXFLAGS=`strip_unwanted_llvm_flags "$LLVM_CONFIG --cxxflags"`
1610
        LLVM_INCLUDEDIR=`$LLVM_CONFIG --includedir`
1611
        LLVM_LIBDIR=`$LLVM_CONFIG --libdir`
1612
 
1613
        AC_COMPUTE_INT([LLVM_VERSION_MAJOR], [LLVM_VERSION_MAJOR],
1614
            [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
1615
        AC_COMPUTE_INT([LLVM_VERSION_MINOR], [LLVM_VERSION_MINOR],
1616
            [#include "${LLVM_INCLUDEDIR}/llvm/Config/llvm-config.h"])
1617
 
1618
        if test "x${LLVM_VERSION_MAJOR}" != x; then
1619
            LLVM_VERSION_INT="${LLVM_VERSION_MAJOR}0${LLVM_VERSION_MINOR}"
1620
        else
1621
            LLVM_VERSION_INT=`echo $LLVM_VERSION | sed -e 's/\([[0-9]]\)\.\([[0-9]]\)/\10\2/g'`
1622
        fi
1623
 
1624
        LLVM_COMPONENTS="engine bitwriter"
1625
        if $LLVM_CONFIG --components | grep -qw 'mcjit'; then
1626
            LLVM_COMPONENTS="${LLVM_COMPONENTS} mcjit"
1627
        fi
1628
 
1629
        if test "x$enable_opencl" = xyes; then
1630
            LLVM_COMPONENTS="${LLVM_COMPONENTS} ipo linker instrumentation"
1631
            # LLVM 3.3 >= 177971 requires IRReader
1632
            if $LLVM_CONFIG --components | grep -qw 'irreader'; then
1633
                LLVM_COMPONENTS="${LLVM_COMPONENTS} irreader"
1634
            fi
1635
        fi
1636
        DEFINES="${DEFINES} -DHAVE_LLVM=0x0$LLVM_VERSION_INT"
1637
        MESA_LLVM=1
1638
 
1639
        dnl Check for Clang internal headers
1640
        if test "x$enable_opencl" = xyes; then
1641
            if test "x$CLANG_LIBDIR" = x; then
1642
                CLANG_LIBDIR=${LLVM_LIBDIR}
1643
            fi
1644
            CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
1645
            AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"],
1646
                [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.])])
1647
        fi
1648
    else
1649
        MESA_LLVM=0
1650
        LLVM_VERSION_INT=0
1651
    fi
1652
else
1653
    MESA_LLVM=0
1654
    LLVM_VERSION_INT=0
1655
fi
1656
 
1657
dnl Directory for XVMC libs
1658
AC_ARG_WITH([xvmc-libdir],
1659
    [AS_HELP_STRING([--with-xvmc-libdir=DIR],
1660
        [directory for the XVMC libraries @<:@default=${libdir}@:>@])],
1661
    [XVMC_LIB_INSTALL_DIR="$withval"],
1662
    [XVMC_LIB_INSTALL_DIR='${libdir}'])
1663
AC_SUBST([XVMC_LIB_INSTALL_DIR])
1664
 
1665
dnl
1666
dnl Gallium Tests
1667
dnl
1668
if test "x$enable_gallium_tests" = xyes; then
1669
    enable_gallium_loader=yes
1670
fi
1671
AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
1672
 
1673
if test "x$enable_gallium_loader" = xyes; then
1674
    GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS pipe-loader"
1675
fi
1676
AM_CONDITIONAL(NEED_GALLIUM_LOADER, test "x$enable_gallium_loader" = xyes)
1677
 
1678
dnl Directory for VDPAU libs
1679
AC_ARG_WITH([vdpau-libdir],
1680
    [AS_HELP_STRING([--with-vdpau-libdir=DIR],
1681
        [directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
1682
    [VDPAU_LIB_INSTALL_DIR="$withval"],
1683
    [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
1684
AC_SUBST([VDPAU_LIB_INSTALL_DIR])
1685
 
1686
dnl Directory for OpenCL libs
1687
AC_ARG_WITH([opencl-libdir],
1688
    [AS_HELP_STRING([--with-opencl-libdir=DIR],
1689
        [directory for auxiliary libraries used by the OpenCL implementation @<:@default=${libdir}/opencl@:>@])],
1690
    [OPENCL_LIB_INSTALL_DIR="$withval"],
1691
    [OPENCL_LIB_INSTALL_DIR='${libdir}/opencl'])
1692
AC_SUBST([OPENCL_LIB_INSTALL_DIR])
1693
 
1694
dnl
1695
dnl Gallium helper functions
1696
dnl
1697
gallium_check_st() {
1698
    if test "x$NEED_NONNULL_WINSYS" = xyes; then
1699
         if test "x$have_libdrm" != xyes; then
1700
            AC_MSG_ERROR([DRI or Xorg DDX requires libdrm >= $LIBDRM_REQUIRED])
1701
         fi
1702
         GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
1703
    fi
1704
    if test "x$enable_dri" = xyes && test "x$2" != x; then
1705
         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
1706
         HAVE_COMMON_DRI=yes
1707
    fi
1708
    if test "x$enable_xorg" = xyes && test "x$3" != x; then
1709
         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
1710
    fi
1711
    if test "x$enable_xa" = xyes && test "x$4" != x; then
1712
         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
1713
    fi
1714
    if test "x$enable_xvmc" = xyes && test "x$5" != x; then
1715
         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
1716
    fi
1717
    if test "x$enable_vdpau" = xyes && test "x$6" != x; then
1718
         GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
1719
    fi
1720
}
1721
 
1722
gallium_require_llvm() {
1723
    if test "x$MESA_LLVM" = x0; then
1724
        case "$host_cpu" in
1725
        i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 and x86_64]);;
1726
        esac
1727
    fi
1728
}
1729
 
1730
gallium_require_drm_loader() {
1731
    if test "x$enable_gallium_loader" = xyes; then
1732
        PKG_CHECK_MODULES([LIBUDEV], [libudev], [],
1733
                          AC_MSG_ERROR([Gallium drm loader requires libudev]))
1734
        if test "x$have_libdrm" != xyes; then
1735
            AC_MSG_ERROR([Gallium drm loader requires libdrm >= $LIBDRM_REQUIRED])
1736
        fi
1737
        enable_gallium_drm_loader=yes
1738
    fi
1739
}
1740
 
1741
radeon_llvm_check() {
1742
    LLVM_REQUIRED_VERSION_MAJOR="3"
1743
    LLVM_REQUIRED_VERSION_MINOR="3"
1744
    if test "$LLVM_VERSION_INT" -lt "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
1745
        AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required for r600g and radeonsi.])
1746
    fi
1747
    if test true && $LLVM_CONFIG --targets-built | grep -qvw 'R600' ; then
1748
        AC_MSG_ERROR([LLVM R600 Target not enabled.  You can enable it when building the LLVM
1749
                      sources with the --enable-experimental-targets=R600
1750
                      configure flag])
1751
    fi
1752
    LLVM_COMPONENTS="${LLVM_COMPONENTS} r600 bitreader ipo"
1753
    NEED_RADEON_LLVM=yes
1754
    AC_CHECK_LIB([elf], [elf_memory], [ELF_LIB=-lelf],
1755
                                 [AC_MSG_ERROR([radeonsi and r600g require libelf when using LLVM])])
1756
}
1757
 
1758
dnl Gallium drivers
1759
if test "x$enable_dri" = xyes -o "x$enable_xorg" = xyes -o \
1760
        "x$enable_xa" = xyes -o "x$enable_xvmc" = xyes -o \
1761
        "x$enable_vdpau" = xyes; then
1762
    NEED_NONNULL_WINSYS=yes
1763
fi
1764
AM_CONDITIONAL(NEED_NONNULL_WINSYS, test "x$NEED_NONNULL_WINSYS" = xyes)
1765
 
1766
dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block
1767
if test "x$with_gallium_drivers" != x; then
1768
    gallium_drivers=`IFS=', '; echo $with_gallium_drivers`
1769
    for driver in $gallium_drivers; do
1770
        case "x$driver" in
1771
        xsvga)
1772
            HAVE_GALLIUM_SVGA=yes
1773
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
1774
            gallium_check_st "svga/drm" "dri-vmwgfx" "" "xa-vmwgfx"
1775
            ;;
1776
        xi915)
1777
            HAVE_GALLIUM_I915=yes
1778
            PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1779
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 softpipe"
1780
            if test "x$MESA_LLVM" = x1; then
1781
                GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1782
            fi
1783
            GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
1784
            gallium_check_st "i915/drm" "dri-i915" "xorg-i915"
1785
            ;;
1786
        xilo)
1787
            HAVE_GALLIUM_ILO=yes
1788
            PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
1789
            gallium_require_drm_loader
1790
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS ilo"
1791
            gallium_check_st "intel/drm" "dri-ilo"
1792
            ;;
1793
        xr300)
1794
            HAVE_GALLIUM_R300=yes
1795
            PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1796
            gallium_require_llvm "Gallium R300"
1797
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
1798
            gallium_check_st "radeon/drm" "dri-r300" "" "" "xvmc-r300" "vdpau-r300"
1799
            ;;
1800
        xr600)
1801
            HAVE_GALLIUM_R600=yes
1802
            PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1803
            gallium_require_drm_loader
1804
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
1805
            if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
1806
                radeon_llvm_check
1807
                R600_NEED_RADEON_GALLIUM=yes;
1808
                LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
1809
            fi
1810
            if test "x$enable_r600_llvm" = xyes; then
1811
                USE_R600_LLVM_COMPILER=yes;
1812
            fi
1813
            if test "x$enable_opencl" = xyes; then
1814
                LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
1815
            fi
1816
            gallium_check_st "radeon/drm" "dri-r600" "xorg-r600" "" "xvmc-r600" "vdpau-r600"
1817
            ;;
1818
        xradeonsi)
1819
            HAVE_GALLIUM_RADEONSI=yes
1820
            PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
1821
            gallium_require_drm_loader
1822
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
1823
            radeon_llvm_check
1824
            gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" "" "" "vdpau-radeonsi" ""
1825
            ;;
1826
        xnouveau)
1827
            HAVE_GALLIUM_NOUVEAU=yes
1828
            PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
1829
            gallium_require_drm_loader
1830
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv50 nvc0"
1831
            gallium_check_st "nouveau/drm" "dri-nouveau" "xorg-nouveau" "" "xvmc-nouveau" "vdpau-nouveau"
1832
            ;;
1833
        xfreedreno)
1834
            HAVE_GALLIUM_FREEDRENO=yes
1835
            PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
1836
            gallium_require_drm_loader
1837
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS freedreno"
1838
            gallium_check_st "freedreno/drm" "dri-freedreno" "" "" "" ""
1839
            ;;
1840
        xswrast)
1841
            HAVE_GALLIUM_SOFTPIPE=yes
1842
            GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
1843
            if test "x$MESA_LLVM" = x1; then
1844
                HAVE_GALLIUM_LLVMPIPE=yes
1845
                GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
1846
            fi
1847
 
1848
            if test "x$enable_dri" = xyes; then
1849
                GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
1850
                HAVE_COMMON_DRI=yes
1851
            fi
1852
            if test "x$enable_vdpau" = xyes; then
1853
                GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS vdpau-softpipe"
1854
            fi
1855
            if test "x$enable_xvmc" = xyes; then
1856
                GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
1857
            fi
1858
            if test "x$enable_vdpau" = xyes -o "x$enable_xvmc" = xyes; then
1859
                NEED_WINSYS_XLIB=yes
1860
                GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
1861
            fi
1862
            ;;
1863
        *)
1864
            AC_MSG_ERROR([Unknown Gallium driver: $driver])
1865
            ;;
1866
        esac
1867
    done
1868
fi
1869
 
1870
dnl Set LLVM_LIBS - This is done after the driver configuration so
1871
dnl that drivers can add additonal components to LLVM_COMPONENTS.
1872
dnl Previously, gallium drivers were updating LLVM_LIBS directly
1873
dnl by calling llvm-config --libs ${DRIVER_LLVM_COMPONENTS}, but
1874
dnl this was causing the same libraries to be appear multiple times
1875
dnl in LLVM_LIBS.
1876
 
1877
if test "x$MESA_LLVM" != x0; then
1878
 
1879
    LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`"
1880
 
1881
    if test "x$with_llvm_shared_libs" = xyes; then
1882
        dnl We can't use $LLVM_VERSION because it has 'svn' stripped out,
1883
        LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
1884
        AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.so"], [llvm_have_one_so=yes])
1885
 
1886
        if test "x$llvm_have_one_so" = xyes; then
1887
            dnl LLVM was built using auto*, so there is only one shared object.
1888
            LLVM_LIBS="-l$LLVM_SO_NAME"
1889
        else
1890
            dnl If LLVM was built with CMake, there will be one shared object per
1891
            dnl component.
1892
            AS_IF([test ! -f "$LLVM_LIBDIR/libLLVMTarget.so"],
1893
                    [AC_MSG_ERROR([Could not find llvm shared libraries:
1894
	Please make sure you have built llvm with the --enable-shared option
1895
	and that your llvm libraries are installed in $LLVM_LIBDIR
1896
	If you have installed your llvm libraries to a different directory you
1897
	can use the --with-llvm-prefix= configure flag to specify this directory.
1898
	NOTE: Mesa is attempting to use llvm shared libraries because you have
1899
	passed one of the following options to configure:
1900
		--with-llvm-shared-libs
1901
		--enable-opencl
1902
	If you do not want to build with llvm shared libraries and instead want to
1903
	use llvm static libraries then remove these options from your configure
1904
	invocation and reconfigure.])])
1905
 
1906
           dnl We don't need to update LLVM_LIBS in this case because the LLVM
1907
           dnl install uses a shared object for each compoenent and we have
1908
           dnl already added all of these objects to LLVM_LIBS.
1909
        fi
1910
    fi
1911
fi
1912
 
1913
AM_CONDITIONAL(HAVE_GALLIUM_SVGA, test "x$HAVE_GALLIUM_SVGA" = xyes)
1914
AM_CONDITIONAL(HAVE_GALLIUM_I915, test "x$HAVE_GALLIUM_I915" = xyes)
1915
AM_CONDITIONAL(HAVE_GALLIUM_ILO, test "x$HAVE_GALLIUM_ILO" = xyes)
1916
AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
1917
AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
1918
AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
1919
AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
1920
AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
1921
AM_CONDITIONAL(HAVE_GALLIUM_SOFTPIPE, test "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
1922
AM_CONDITIONAL(HAVE_GALLIUM_LLVMPIPE, test "x$HAVE_GALLIUM_LLVMPIPE" = xyes)
1923
 
1924
AM_CONDITIONAL(NEED_GALLIUM_SOFTPIPE_DRIVER, test "x$HAVE_GALLIUM_SVGA" = xyes -o \
1925
                                                  "x$HAVE_GALLIUM_I915" = xyes -o \
1926
                                                  "x$HAVE_GALLIUM_SOFTPIPE" = xyes)
1927
AM_CONDITIONAL(NEED_GALLIUM_LLVMPIPE_DRIVER, test "x$HAVE_GALLIUM_I915" = xyes -o \
1928
                                                  "x$HAVE_GALLIUM_SOFTPIPE" = xyes \
1929
                                                  && test "x$MESA_LLVM" = x1)
1930
 
1931
if test "x$enable_gallium_loader" = xyes; then
1932
    GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/null"
1933
 
1934
    if test "x$enable_gallium_drm_loader" = xyes; then
1935
        GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_DRM"
1936
        PKG_CHECK_MODULES([GALLIUM_PIPE_LOADER_XCB], [xcb xcb-dri2],
1937
                          pipe_loader_have_xcb=yes, pipe_loader_have_xcb=no)
1938
        if test "x$pipe_loader_have_xcb" = xyes; then
1939
            GALLIUM_PIPE_LOADER_DEFINES="$GALLIUM_PIPE_LOADER_DEFINES -DHAVE_PIPE_LOADER_XCB"
1940
            GALLIUM_PIPE_LOADER_LIBS="$GALLIUM_PIPE_LOADER_LIBS $GALLIUM_PIPE_LOADER_XCB_LIBS $LIBDRM_LIBS"
1941
        fi
1942
    fi
1943
 
1944
    AC_SUBST([GALLIUM_PIPE_LOADER_DEFINES])
1945
    AC_SUBST([GALLIUM_PIPE_LOADER_LIBS])
1946
fi
1947
 
1948
AM_CONDITIONAL(HAVE_I915_DRI, test x$HAVE_I915_DRI = xyes)
1949
AM_CONDITIONAL(HAVE_I965_DRI, test x$HAVE_I965_DRI = xyes)
1950
AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI = xyes)
1951
AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
1952
AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
1953
AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
1954
AM_CONDITIONAL(HAVE_COMMON_DRI, test x$HAVE_COMMON_DRI = xyes)
1955
 
1956
AM_CONDITIONAL(NEED_RADEON_DRM_WINSYS, test "x$NEED_NONNULL_WINSYS" = xyes -a \
1957
                                            "x$HAVE_GALLIUM_R300" = xyes -o \
1958
                                            "x$HAVE_GALLIUM_R600" = xyes -o \
1959
                                            "x$HAVE_GALLIUM_RADEONSI" = xyes)
1960
AM_CONDITIONAL(NEED_WINSYS_WRAPPER, test "x$HAVE_GALLIUM_I915" = xyes -o \
1961
                                         "x$HAVE_GALLIUM_SVGA" = xyes)
1962
AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
1963
AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
1964
AM_CONDITIONAL(R600_NEED_RADEON_GALLIUM, test x$R600_NEED_RADEON_GALLIUM = xyes)
1965
AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
1966
AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
1967
AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
1968
AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
1969
AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
1970
AM_CONDITIONAL(LLVM_NEEDS_FNORTTI, test $LLVM_VERSION_INT -ge 302)
1971
 
1972
AC_SUBST([ELF_LIB])
1973
 
1974
AM_CONDITIONAL(NEED_LIBPROGRAM, test "x$with_gallium_drivers" != x -o \
1975
                                     "x$enable_xlib_glx" = xyes -o \
1976
                                     "x$enable_osmesa" = xyes -o \
1977
                                     "x$enable_gallium_osmesa" = xyes)
1978
AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" = xyes)
1979
AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
1980
AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
1981
 
1982
AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
1983
AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
1984
AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
1985
 
1986
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = xyes)
1987
 
1988
AC_SUBST([VDPAU_MAJOR], 1)
1989
AC_SUBST([VDPAU_MINOR], 0)
1990
 
1991
AC_SUBST([XVMC_MAJOR], 1)
1992
AC_SUBST([XVMC_MINOR], 0)
1993
 
1994
AC_SUBST([XA_MAJOR], 1)
1995
AC_SUBST([XA_MINOR], 0)
1996
AC_SUBST([XA_TINY], 0)
1997
AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
1998
 
1999
dnl Restore LDFLAGS and CPPFLAGS
2000
LDFLAGS="$_SAVE_LDFLAGS"
2001
CPPFLAGS="$_SAVE_CPPFLAGS"
2002
 
2003
dnl Add user CFLAGS and CXXFLAGS
2004
CFLAGS="$CFLAGS $USER_CFLAGS"
2005
CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
2006
 
2007
dnl Substitute the config
2008
AC_CONFIG_FILES([Makefile
2009
		src/Makefile
2010
		src/egl/Makefile
2011
		src/egl/drivers/Makefile
2012
		src/egl/drivers/dri2/Makefile
2013
		src/egl/drivers/glx/Makefile
2014
		src/egl/main/Makefile
2015
		src/egl/main/egl.pc
2016
		src/egl/wayland/Makefile
2017
		src/egl/wayland/wayland-drm/Makefile
2018
		src/egl/wayland/wayland-egl/Makefile
2019
		src/egl/wayland/wayland-egl/wayland-egl.pc
2020
		src/gallium/auxiliary/Makefile
2021
		src/gallium/auxiliary/pipe-loader/Makefile
2022
		src/gallium/drivers/Makefile
2023
		src/gallium/drivers/freedreno/Makefile
2024
		src/gallium/drivers/freedreno/a2xx/Makefile
2025
		src/gallium/drivers/freedreno/a3xx/Makefile
2026
		src/gallium/drivers/i915/Makefile
2027
		src/gallium/drivers/ilo/Makefile
2028
		src/gallium/drivers/llvmpipe/Makefile
2029
		src/gallium/drivers/nouveau/Makefile
2030
		src/gallium/drivers/nv30/Makefile
2031
		src/gallium/drivers/nv50/Makefile
2032
		src/gallium/drivers/nvc0/Makefile
2033
		src/gallium/drivers/r300/Makefile
2034
		src/gallium/drivers/r600/Makefile
2035
		src/gallium/drivers/radeon/Makefile
2036
		src/gallium/drivers/radeonsi/Makefile
2037
		src/gallium/drivers/rbug/Makefile
2038
		src/gallium/drivers/softpipe/Makefile
2039
		src/gallium/drivers/svga/Makefile
2040
		src/gallium/drivers/trace/Makefile
2041
		src/gallium/state_trackers/Makefile
2042
		src/gallium/state_trackers/clover/Makefile
2043
		src/gallium/state_trackers/dri/Makefile
2044
		src/gallium/state_trackers/dri/drm/Makefile
2045
		src/gallium/state_trackers/dri/sw/Makefile
2046
		src/gallium/state_trackers/egl/Makefile
2047
		src/gallium/state_trackers/gbm/Makefile
2048
		src/gallium/state_trackers/glx/Makefile
2049
		src/gallium/state_trackers/osmesa/Makefile
2050
		src/gallium/state_trackers/vdpau/Makefile
2051
		src/gallium/state_trackers/vega/Makefile
2052
		src/gallium/state_trackers/xa/Makefile
2053
		src/gallium/state_trackers/xorg/Makefile
2054
		src/gallium/state_trackers/xvmc/Makefile
2055
		src/gallium/targets/Makefile
2056
		src/gallium/targets/dri-freedreno/Makefile
2057
		src/gallium/targets/dri-i915/Makefile
2058
		src/gallium/targets/dri-ilo/Makefile
2059
		src/gallium/targets/dri-nouveau/Makefile
2060
		src/gallium/targets/dri-r300/Makefile
2061
		src/gallium/targets/dri-r600/Makefile
2062
		src/gallium/targets/dri-radeonsi/Makefile
2063
		src/gallium/targets/dri-swrast/Makefile
2064
		src/gallium/targets/dri-vmwgfx/Makefile
2065
		src/gallium/targets/egl-static/Makefile
2066
		src/gallium/targets/gbm/Makefile
2067
		src/gallium/targets/opencl/Makefile
2068
		src/gallium/targets/osmesa/Makefile
2069
		src/gallium/targets/osmesa/osmesa.pc
2070
		src/gallium/targets/pipe-loader/Makefile
2071
		src/gallium/targets/libgl-xlib/Makefile
2072
		src/gallium/targets/vdpau-nouveau/Makefile
2073
		src/gallium/targets/vdpau-r300/Makefile
2074
		src/gallium/targets/vdpau-r600/Makefile
2075
		src/gallium/targets/vdpau-radeonsi/Makefile
2076
		src/gallium/targets/vdpau-softpipe/Makefile
2077
		src/gallium/targets/xa-vmwgfx/Makefile
2078
		src/gallium/targets/xa-vmwgfx/xatracker.pc
2079
		src/gallium/targets/xorg-i915/Makefile
2080
		src/gallium/targets/xorg-nouveau/Makefile
2081
		src/gallium/targets/xorg-r600/Makefile
2082
		src/gallium/targets/xorg-radeonsi/Makefile
2083
		src/gallium/targets/xvmc-nouveau/Makefile
2084
		src/gallium/targets/xvmc-r300/Makefile
2085
		src/gallium/targets/xvmc-r600/Makefile
2086
		src/gallium/targets/xvmc-softpipe/Makefile
2087
		src/gallium/tests/trivial/Makefile
2088
		src/gallium/tests/unit/Makefile
2089
		src/gallium/winsys/Makefile
2090
		src/gallium/winsys/freedreno/drm/Makefile
2091
		src/gallium/winsys/i915/drm/Makefile
2092
		src/gallium/winsys/i915/sw/Makefile
2093
		src/gallium/winsys/intel/drm/Makefile
2094
		src/gallium/winsys/nouveau/drm/Makefile
2095
		src/gallium/winsys/radeon/drm/Makefile
2096
		src/gallium/winsys/svga/drm/Makefile
2097
		src/gallium/winsys/sw/dri/Makefile
2098
		src/gallium/winsys/sw/fbdev/Makefile
2099
		src/gallium/winsys/sw/null/Makefile
2100
		src/gallium/winsys/sw/wayland/Makefile
2101
		src/gallium/winsys/sw/wrapper/Makefile
2102
		src/gallium/winsys/sw/xlib/Makefile
2103
		src/gbm/Makefile
2104
		src/gbm/main/gbm.pc
2105
		src/glsl/Makefile
2106
		src/glsl/builtin_compiler/Makefile
2107
		src/glx/Makefile
2108
		src/glx/tests/Makefile
2109
		src/gtest/Makefile
2110
		src/mapi/Makefile
2111
		src/mapi/es1api/Makefile
2112
		src/mapi/es1api/glesv1_cm.pc
2113
		src/mapi/es2api/Makefile
2114
		src/mapi/es2api/glesv2.pc
2115
		src/mapi/glapi/Makefile
2116
		src/mapi/glapi/gen/Makefile
2117
		src/mapi/glapi/tests/Makefile
2118
		src/mapi/shared-glapi/Makefile
2119
		src/mapi/shared-glapi/tests/Makefile
2120
		src/mapi/vgapi/Makefile
2121
		src/mapi/vgapi/vg.pc
2122
		src/mesa/Makefile
2123
		src/mesa/gl.pc
2124
		src/mesa/drivers/dri/dri.pc
2125
		src/mesa/drivers/dri/common/Makefile
2126
		src/mesa/drivers/dri/common/xmlpool/Makefile
2127
		src/mesa/drivers/dri/i915/Makefile
2128
		src/mesa/drivers/dri/i965/Makefile
2129
		src/mesa/drivers/dri/Makefile
2130
		src/mesa/drivers/dri/nouveau/Makefile
2131
		src/mesa/drivers/dri/r200/Makefile
2132
		src/mesa/drivers/dri/radeon/Makefile
2133
		src/mesa/drivers/dri/swrast/Makefile
2134
		src/mesa/drivers/osmesa/Makefile
2135
		src/mesa/drivers/osmesa/osmesa.pc
2136
		src/mesa/drivers/x11/Makefile
2137
		src/mesa/libdricore/Makefile
2138
		src/mesa/main/tests/Makefile
2139
		src/mesa/main/tests/hash_table/Makefile
2140
		src/mesa/program/Makefile
2141
		src/mesa/x86-64/Makefile
2142
		src/mesa/x86/Makefile])
2143
 
2144
dnl Sort the dirs alphabetically
2145
GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2146
GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2147
GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2148
GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
2149
 
2150
AC_OUTPUT
2151
 
2152
dnl
2153
dnl Output some configuration info for the user
2154
dnl
2155
echo ""
2156
echo "        prefix:          $prefix"
2157
echo "        exec_prefix:     $exec_prefix"
2158
echo "        libdir:          $libdir"
2159
echo "        includedir:      $includedir"
2160
 
2161
dnl API info
2162
echo ""
2163
echo "        OpenGL:          $enable_opengl (ES1: $enable_gles1 ES2: $enable_gles2)"
2164
echo "        OpenVG:          $enable_openvg"
2165
 
2166
dnl Driver info
2167
echo ""
2168
case "x$enable_osmesa$enable_gallium_osmesa" in
2169
xnoyes)
2170
        echo "        OSMesa:          lib$OSMESA_LIB (Gallium)"
2171
        ;;
2172
xyesno)
2173
        echo "        OSMesa:          lib$OSMESA_LIB"
2174
        ;;
2175
xnono)
2176
        echo "        OSMesa:          no"
2177
        ;;
2178
esac
2179
 
2180
if test "x$enable_dri" != xno; then
2181
        # cleanup the drivers var
2182
        dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/  */ /;s/ *$//'`
2183
        if test "x$DRI_DIRS" = x; then
2184
            echo "        DRI drivers:     no"
2185
        else
2186
            echo "        DRI drivers:     $dri_dirs"
2187
        fi
2188
        echo "        DRI driver dir:  $DRI_DRIVER_INSTALL_DIR"
2189
fi
2190
 
2191
case "x$enable_glx$enable_xlib_glx" in
2192
xyesyes)
2193
    echo "        GLX:             Xlib-based"
2194
    ;;
2195
xyesno)
2196
    echo "        GLX:             DRI-based"
2197
    ;;
2198
*)
2199
    echo "        GLX:             $enable_glx"
2200
    ;;
2201
esac
2202
 
2203
dnl EGL
2204
echo ""
2205
echo "        EGL:             $enable_egl"
2206
if test "$enable_egl" = yes; then
2207
    echo "        EGL platforms:   $EGL_PLATFORMS"
2208
 
2209
    egl_drivers=""
2210
    if test "x$HAVE_EGL_DRIVER_GLX" != "x"; then
2211
        egl_drivers="$egl_drivers builtin:egl_glx"
2212
    fi
2213
    if test "x$HAVE_EGL_DRIVER_DRI2" != "x"; then
2214
        egl_drivers="$egl_drivers builtin:egl_dri2"
2215
    fi
2216
 
2217
    if test "x$enable_gallium_egl" = xyes; then
2218
        echo "        EGL drivers:    ${egl_drivers} egl_gallium"
2219
        echo "        EGL Gallium STs:$EGL_CLIENT_APIS"
2220
    else
2221
        echo "        EGL drivers:    $egl_drivers"
2222
    fi
2223
fi
2224
 
2225
echo ""
2226
if test "x$MESA_LLVM" = x1; then
2227
    echo "        llvm:            yes"
2228
    echo "        llvm-config:     $LLVM_CONFIG"
2229
    echo "        llvm-version:    $LLVM_VERSION"
2230
else
2231
    echo "        llvm:            no"
2232
fi
2233
 
2234
echo ""
2235
if test -n "$with_gallium_drivers"; then
2236
    echo "        Gallium:         yes"
2237
    echo "        Target dirs:     $GALLIUM_TARGET_DIRS"
2238
    echo "        Winsys dirs:     $GALLIUM_WINSYS_DIRS"
2239
    echo "        Driver dirs:     $GALLIUM_DRIVERS_DIRS"
2240
    echo "        Trackers dirs:   $GALLIUM_STATE_TRACKERS_DIRS"
2241
else
2242
    echo "        Gallium:         no"
2243
fi
2244
 
2245
 
2246
dnl Libraries
2247
echo ""
2248
echo "        Shared libs:     $enable_shared"
2249
echo "        Static libs:     $enable_static"
2250
echo "        Shared-glapi:    $enable_shared_glapi"
2251
 
2252
dnl Compiler options
2253
# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
2254
cflags=`echo $CFLAGS | \
2255
    $SED 's/^ *//;s/  */ /;s/ *$//'`
2256
cxxflags=`echo $CXXFLAGS | \
2257
    $SED 's/^ *//;s/  */ /;s/ *$//'`
2258
defines=`echo $DEFINES | $SED 's/^ *//;s/  */ /;s/ *$//'`
2259
echo ""
2260
echo "        CFLAGS:          $cflags"
2261
echo "        CXXFLAGS:        $cxxflags"
2262
echo "        Macros:          $defines"
2263
echo ""
2264
if test "x$MESA_LLVM" = x1; then
2265
    echo "        LLVM_CFLAGS:     $LLVM_CFLAGS"
2266
    echo "        LLVM_CXXFLAGS:   $LLVM_CXXFLAGS"
2267
    echo "        LLVM_CPPFLAGS:   $LLVM_CPPFLAGS"
2268
    echo ""
2269
fi
2270
echo "        PYTHON2:         $PYTHON2"
2271
 
2272
echo ""
2273
echo "        Run '${MAKE-make}' to build Mesa"
2274
echo ""