1xorg = dependency('xorg-server', required : true) 2libdrm = dependency('libdrm', required : true) 3pixman = dependency('pixman-1', required : true) 4 5with_dri1 = get_option('dri1') 6if with_dri1 7 dri1 = dependency('xf86driproto', required : true) 8 has_dri1 = (cc.has_header('dri.h', dependencies : xorg) and 9 cc.has_header('sarea.h', dependencies : xorg) and 10 cc.has_header('dristruct.h', dependencies : xorg)) 11 12 # Currently 'required' doesn't work for cc.has_header() & co. 13 if not has_dri1 14 error('DRI1 dependencies not met') 15 endif 16 17 config.set('HAVE_DRI1', 1) 18endif 19 20with_dri2 = get_option('dri2') 21if with_dri2 22 dri2 = dependency('dri2proto', version : '>= 2.6', required : true) 23 24 dri = dependency('dri', required : false) 25 if dri.found() 26 dridriverdir = dri.get_pkgconfig_variable('dridriverdir') 27 else 28 dridriverdir = join_paths(get_option('libdir'), 'dri') 29 endif 30 31 config.set('HAVE_DRI2', 1) 32 config.set_quoted('DRI_DRIVER_PATH', dridriverdir) 33endif 34 35with_dri3 = get_option('dri3') 36if with_dri3 37 dri3 = dependency('dri3proto', required : true) 38 has_dri3 = (cc.has_header_symbol('xorg-server.h', 'DRI3', 39 dependencies : xorg) and 40 cc.has_header('misyncstr.h', 41 dependencies : xorg) and 42 cc.has_header('misyncshm.h', 43 dependencies : xorg)) 44 45 # Currently 'required' doesn't work for cc.has_header() & co. 46 if not has_dri3 47 error('DRI3 dependencies not met') 48 endif 49 50 config.set('HAVE_DRI3', 1) 51endif 52 53default_dri = get_option('default-dri') 54config.set('DEFAULT_DRI_LEVEL', default_dri) 55 56present = dependency('presentproto', required : false) 57has_present = (present.found() and 58 cc.has_header('present.h', dependencies : xorg)) 59if has_present 60 config.set('HAVE_PRESENT', 1) 61endif 62 63if get_option('backlight') 64 config.set('USE_BACKLIGHT', 1) 65endif 66with_backlight_helper = get_option('backlight-helper') 67if with_backlight_helper 68 config.set('USE_BACKLIGHT_HELPER', 1) 69endif 70 71debug = get_option('internal-debug') 72if debug == 'sync' 73 config.set('DEBUG_SYNC', 1) 74endif 75if debug == 'memory' or debug == 'full' 76 config.set('DEBUG_MEMORY', 1) 77endif 78if debug == 'pixmap' or debug == 'full' 79 config.set('DEBUG_PIXMAP', 1) 80endif 81if debug == 'full' 82 config.set('HAS_DEBUG_FULL', 1) 83endif 84 85intel_drv_sources = [ 86 'backlight.c', 87 'fd.c', 88 'intel_device.c', 89 'intel_options.c', 90 'intel_module.c', 91] 92 93intel_drv_deps = [ 94 dependency('pciaccess', version : '>= 0.10', required : true), 95 libdrm, 96 xorg, 97] 98 99intel_drv_libs = [] 100 101if with_ums 102 subdir('legacy/i810') 103 intel_drv_libs += i810 104endif 105 106default_accel = get_option('default-accel') 107 108with_sna = get_option('sna') 109if with_sna 110 subdir('sna') 111 intel_drv_libs += sna 112elif default_accel == 'sna' 113 error('SNA not available, so can\'t selected as the default acceleration method') 114endif 115 116with_uxa = get_option('uxa') 117if with_uxa 118 subdir('uxa') 119 intel_drv_libs += uxa 120elif default_accel == 'uxa' 121 error('UXA not available, so can\'t selected as the default acceleration method') 122endif 123 124if default_accel == 'sna' 125 config.set('DEFAULT_ACCEL_METHOD', 'SNA') 126elif default_accel == 'uxa' 127 config.set('DEFAULT_ACCEL_METHOD', 'UXA') 128else 129 config.set('DEFAULT_ACCEL_METHOD', 'NOACCEL') 130endif 131 132if with_valgrind 133 intel_drv_deps += valgrind 134endif 135 136xorg_moduledir = get_option('xorg-module-dir') 137moduledir = '' 138foreach dir : xorg_moduledir.split('/') 139 if dir == '@libdir@' 140 dir = get_option('libdir') 141 endif 142 moduledir = join_paths(moduledir, dir) 143endforeach 144 145shared_module('intel_drv', 146 sources : intel_drv_sources, 147 dependencies : intel_drv_deps, 148 link_with : intel_drv_libs, 149 c_args : [ 150 '-DMAJOR_IN_SYSMACROS', 151 '-Wno-unused-parameter', 152 '-Wno-sign-compare', 153 ], 154 name_prefix : '', 155 install_dir : join_paths(moduledir, 'drivers'), 156 install : true) 157