+with_libunwind = get_option('libunwind')
+with_asm = get_option('asm')
+with_llvm = get_option('llvm')
+with_osmesa = get_option('osmesa')
+if get_option('texture-float')
+ pre_args += '-DTEXTURE_FLOAT_ENABLED'
+ message('WARNING: Floating-point texture enabled. Please consult docs/patents.txt and your lawyer before building mesa.')
+endif
+
+# XXX: yeah, do these
+with_appledri = false
+with_windowsdri = false
+
+dri_drivers_path = get_option('dri-drivers-path')
+if dri_drivers_path == ''
+ dri_drivers_path = join_paths(get_option('libdir'), 'dri')
+endif
+
+with_gles1 = get_option('gles1')
+with_gles2 = get_option('gles2')
+with_opengl = get_option('opengl')
+with_any_opengl = with_opengl or with_gles1 or with_gles2
+# Only build shared_glapi if at least one OpenGL API is enabled
+with_shared_glapi = get_option('shared-glapi') and with_any_opengl
+
+
+# shared-glapi is required if at least two OpenGL APIs are being built
+if not with_shared_glapi
+ if ((with_gles1 and with_gles2) or (with_gles1 and with_opengl)
+ or (with_gles2 and with_opengl))
+ error('shared-glapi required for building two or more of OpenGL, OpenGL ES 1.x, OpenGL ES 2.x')
+ endif
+endif
+
+# We require OpenGL for OpenGL ES
+if (with_gles1 or with_gles2) and not with_opengl
+ error('building OpenGL ES without OpenGL is not supported.')
+endif
+
+with_dri = false
+with_dri_i915 = false
+with_dri_i965 = false
+with_dri_r100 = false
+with_dri_r200 = false
+with_dri_nouveau = false
+with_dri_swrast = false
+_drivers = get_option('dri-drivers')
+if _drivers != ''
+ _split = _drivers.split(',')
+ with_dri_i915 = _split.contains('i915')
+ with_dri_i965 = _split.contains('i965')
+ with_dri_r100 = _split.contains('r100')
+ with_dri_r200 = _split.contains('r200')
+ with_dri_nouveau = _split.contains('nouveau')
+ with_dri_swrast = _split.contains('swrast')
+ with_dri = true
+endif
+
+with_gallium = false
+with_gallium_pl111 = false
+with_gallium_radeonsi = false
+with_gallium_nouveau = false
+with_gallium_freedreno = false
+with_gallium_softpipe = false
+with_gallium_vc4 = false
+with_gallium_vc5 = false
+with_gallium_etnaviv = false
+with_gallium_imx = false
+_drivers = get_option('gallium-drivers')
+if _drivers != ''
+ _split = _drivers.split(',')
+ with_gallium_pl111 = _split.contains('pl111')
+ with_gallium_radeonsi = _split.contains('radeonsi')
+ with_gallium_nouveau = _split.contains('nouveau')
+ with_gallium_freedreno = _split.contains('freedreno')
+ with_gallium_softpipe = _split.contains('swrast')
+ with_gallium_vc4 = _split.contains('vc4')
+ with_gallium_vc5 = _split.contains('vc5')
+ with_gallium_etnaviv = _split.contains('etnaviv')
+ with_gallium_imx = _split.contains('imx')
+ with_gallium = true
+ with_dri = true
+endif
+
+if not (with_dri or with_gallium)
+ with_gles1 = false
+ with_gles2 = false
+ with_opengl = false
+ with_any_opengl = false
+ with_shared_glapi = false
+endif
+
+if with_dri_swrast and with_gallium_softpipe
+ error('Only one swrast provider can be built')
+endif
+if with_gallium_imx and not with_gallium_etnaviv
+ error('IMX driver requires etnaviv driver')
+endif