1version_split = meson.project_version().split('.') 2major = version_split[0].to_int() 3minor = version_split[1].to_int() 4patch = version_split[2].to_int() 5if version_split.length() == 4 6 subpatch = version_split[3].to_int() 7else 8 subpatch = 0 9endif 10 11release = major * 10000000 + minor * 100000 + patch * 1000 + subpatch 12 13dri_dep = dependency('dri', required: build_dri2 or build_dri3) 14 15conf_data = configuration_data() 16conf_data.set('_DIX_CONFIG_H_', '1') 17 18conf_data.set('HAVE_TYPEOF', cc.compiles(''' 19 int foo(int bar) { typeof(bar) baz = 1; return baz; } 20''', 21 name: 'typeof()')) 22 23conf_data.set('MONOTONIC_CLOCK', cc.compiles(''' 24 #define _POSIX_C_SOURCE 200112L 25 #include <time.h> 26 #include <unistd.h> 27 #ifndef CLOCK_MONOTONIC 28 #error CLOCK_MONOTONIC not defined 29 #endif 30''', 31 name: 'CLOCK_MONOTONIC')) 32 33#conf_data.set('XSERVER_DTRACE', '1') # XXX 34 35if host_machine.endian() == 'little' 36 conf_data.set('X_BYTE_ORDER', 'X_LITTLE_ENDIAN') 37else 38 conf_data.set('X_BYTE_ORDER', 'X_BIG_ENDIAN') 39endif 40 41glx_align64 = [] 42if cc.sizeof('unsigned long') == 8 43 conf_data.set('_XSERVER64', '1') 44 glx_align64 = '-D__GLX_ALIGN64' 45endif 46 47conf_data.set('_GNU_SOURCE', '1') 48# XXX: NO_LOCAL_CLIENT_CRED 49 50# autoconf checks for /dev/xf86 here, but the test should be based on 51# the target, not the build system. Could we get rid of this and just 52# ifdef for openbsd? 53conf_data.set('HAS_APERTURE_DRV', host_machine.system() == 'openbsd') 54 55# XXX: USE_ALPHA_PIO and other bsd bits 56# XXX: FALLBACK_INPUT_DRIVER 57# XXX: BUNDLE_ID_PREFIX 58# XXX: HAVE_LIBDISPATCH 59conf_data.set_quoted('OSNAME', 'Linux') # XXX 60conf_data.set('HAVE_INPUTTHREAD', '1') # XXX 61conf_data.set('HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID', '1') # XXX 62conf_data.set('HAVE_LIBBSD', libbsd_dep.found()) 63# XXX: HAVE_SYSTEMD_DAEMON 64# XXX: HAVE_LIBUDEV 65conf_data.set('CONFIG_UDEV', build_udev) 66conf_data.set('CONFIG_UDEV_KMS', build_udev) 67conf_data.set('HAVE_DBUS', build_dbus) 68conf_data.set('CONFIG_HAL', build_hal) 69conf_data.set('SYSTEMD_LOGIND', build_systemd_logind) 70conf_data.set('NEED_DBUS', build_systemd_logind or build_hal) 71conf_data.set('CONFIG_WSCONS', host_machine.system() == 'openbsd') 72 73conf_data.set('HAVE_XSHMFENCE', xshmfence_dep.found()) 74conf_data.set('WITH_LIBDRM', libdrm_dep.found()) 75conf_data.set('GLAMOR_HAS_EGL_QUERY_DMABUF', 76 epoxy_dep.found() and epoxy_dep.version().version_compare('>= 1.4.4')) 77conf_data.set('GLAMOR_HAS_EGL_QUERY_DRIVER', 78 epoxy_dep.found() and epoxy_dep.version().version_compare('>= 1.5.4')) 79conf_data.set('GLXEXT', build_glx) 80conf_data.set('GLAMOR', build_glamor) 81conf_data.set('GLAMOR_HAS_GBM', gbm_dep.found()) 82conf_data.set('GLAMOR_HAS_GBM_LINEAR', 83 build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 10.6')) 84conf_data.set('GBM_BO_WITH_MODIFIERS', 85 build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 17.1')) 86conf_data.set('GLAMOR_HAS_GBM_MAP', 87 build_glamor and cc.has_function('gbm_bo_map', dependencies : gbm_dep) ? '1' : false) 88conf_data.set('GLAMOR_HAS_GL_FENCE', 89 build_glamor and cc.has_function('glFenceSync', dependencies : dependency('glesv2', required : false)) ? '1' : false) 90 91conf_data.set('GLES_USE_HIGHP', get_option('gles-highp') ? '1' : false) 92 93conf_data.set('MODESETTING_WITH_RGA', build_modesetting and rga_dep.found() ? '1' : false) 94 95conf_data.set_quoted('SERVER_MISC_CONFIG_PATH', serverconfigdir) 96conf_data.set_quoted('PROJECTROOT', get_option('prefix')) 97conf_data.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) 98conf_data.set_quoted('SUID_WRAPPER_DIR', join_paths(get_option('prefix'), get_option('libexecdir'))) 99conf_data.set_quoted('COMPILEDDEFAULTFONTPATH', default_font_path) 100 101conf_data.set('XORG_VERSION_CURRENT', release) 102 103conf_data.set('HASXDMAUTH', has_xdm_auth) 104conf_data.set('SECURE_RPC', get_option('secure-rpc')) 105 106conf_data.set('HAVE_DLFCN_H', cc.has_header('dlfcn.h')) 107conf_data.set('HAVE_EXECINFO_H', cc.has_header('execinfo.h')) 108conf_data.set('HAVE_FCNTL_H', cc.has_header('fcntl.h')) 109conf_data.set('HAVE_FNMATCH_H', cc.has_header('fnmatch.h')) 110conf_data.set('HAVE_LINUX_AGPGART_H', cc.has_header('linux/agpgart.h')) 111conf_data.set('HAVE_STDLIB_H', cc.has_header('stdlib.h')) 112conf_data.set('HAVE_STRING_H', cc.has_header('string.h')) 113conf_data.set('HAVE_STRINGS_H', cc.has_header('strings.h')) 114conf_data.set('HAVE_STROPTS_H', cc.has_header('stropts.h')) 115conf_data.set('HAVE_SYS_AGPGART_H', cc.has_header('sys/agpgart.h')) 116conf_data.set('HAVE_SYS_AGPIO_H', cc.has_header('sys/agpio.h')) 117conf_data.set('HAVE_SYS_UTSNAME_H', cc.has_header('sys/utsname.h')) 118conf_data.set('HAVE_SYS_SYSMACROS_H', cc.has_header('sys/sysmacros.h')) 119conf_data.set('HAVE_UNISTD_H', cc.has_header('unistd.h')) 120 121conf_data.set('HAVE_ARC4RANDOM_BUF', cc.has_function('arc4random_buf', dependencies: libbsd_dep)) 122conf_data.set('HAVE_BACKTRACE', cc.has_function('backtrace')) 123conf_data.set('HAVE_CBRT', cc.has_function('cbrt')) 124conf_data.set('HAVE_EPOLL_CREATE1', cc.has_function('epoll_create1')) 125conf_data.set('HAVE_GETUID', cc.has_function('getuid')) 126conf_data.set('HAVE_GETEUID', cc.has_function('geteuid')) 127conf_data.set('HAVE_ISASTREAM', cc.has_function('isastream')) 128conf_data.set('HAVE_ISSETUGID', cc.has_function('issetugid')) 129conf_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs')) 130conf_data.set('HAVE_GETPEEREID', cc.has_function('getpeereid')) 131conf_data.set('HAVE_GETPEERUCRED', cc.has_function('getpeerucred')) 132conf_data.set('HAVE_GETPROGNAME', cc.has_function('getprogname')) 133conf_data.set('HAVE_GETZONEID', cc.has_function('getzoneid')) 134conf_data.set('HAVE_MEMFD_CREATE', cc.has_function('memfd_create')) 135conf_data.set('HAVE_MKOSTEMP', cc.has_function('mkostemp')) 136conf_data.set('HAVE_MMAP', cc.has_function('mmap')) 137conf_data.set('HAVE_POLL', cc.has_function('poll')) 138conf_data.set('HAVE_POLLSET_CREATE', cc.has_function('pollset_create')) 139conf_data.set('HAVE_POSIX_FALLOCATE', cc.has_function('posix_fallocate')) 140conf_data.set('HAVE_PORT_CREATE', cc.has_function('port_create')) 141conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', dependencies: libbsd_dep)) 142conf_data.set('HAVE_SETEUID', cc.has_function('seteuid')) 143conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer')) 144conf_data.set('HAVE_SHMCTL64', cc.has_function('shmctl64')) 145conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction')) 146conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp')) 147conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr')) 148conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: libbsd_dep)) 149conf_data.set('HAVE_STRLCPY', cc.has_function('strlcpy', dependencies: libbsd_dep)) 150conf_data.set('HAVE_STRNCASECMP', cc.has_function('strncasecmp')) 151conf_data.set('HAVE_STRNDUP', cc.has_function('strndup')) 152conf_data.set('HAVE_TIMINGSAFE_MEMCMP', cc.has_function('timingsafe_memcmp')) 153conf_data.set('HAVE_VASPRINTF', cc.has_function('vasprintf')) 154conf_data.set('HAVE_VSNPRINTF', cc.has_function('vsnprintf')) 155conf_data.set('HAVE_WALKCONTEXT', cc.has_function('walkcontext')) 156 157conf_data.set('BUSFAULT', conf_data.get('HAVE_SIGACTION')) 158 159# Don't let X dependencies typedef 'pointer' 160conf_data.set('_XTYPEDEF_POINTER', '1') 161conf_data.set('_XITYPEDEF_POINTER', '1') 162 163conf_data.set('LISTEN_TCP', get_option('listen_tcp')) 164conf_data.set('LISTEN_UNIX', get_option('listen_unix')) 165conf_data.set('LISTEN_LOCAL', get_option('listen_local')) 166# XXX: Configurable? 167conf_data.set('XTRANS_SEND_FDS', '1') 168 169conf_data.set('TCPCONN', '1') 170conf_data.set('UNIXCONN', '1') 171conf_data.set('IPv6', build_ipv6) 172 173conf_data.set('CLIENTIDS', '1') # XXX 174 175conf_data.set('BIGREQS', '1') 176conf_data.set('COMPOSITE', '1') 177conf_data.set('DAMAGE', '1') 178conf_data.set('DBE', '1') 179conf_data.set('DGA', build_dga) 180conf_data.set('DPMSExtension', build_dpms) 181conf_data.set('DRI2', build_dri2) 182conf_data.set('DRI3', build_dri3) 183conf_data.set_quoted('DRI_DRIVER_PATH', dri_dep.get_pkgconfig_variable('dridriverdir')) 184conf_data.set('HAS_SHM', build_mitshm) 185conf_data.set('MITSHM', build_mitshm) 186conf_data.set('PANORAMIX', build_xinerama) 187conf_data.set('PRESENT', '1') 188conf_data.set('RANDR', '1') 189conf_data.set('RES', build_res) 190conf_data.set('RENDER', '1') 191conf_data.set('SCREENSAVER', build_screensaver) 192conf_data.set('SHAPE', '1') 193conf_data.set('XACE', build_xace) 194conf_data.set('XCMISC', '1') 195conf_data.set('XCSECURITY', build_xsecurity) 196conf_data.set('XDMCP', xdmcp_dep.found()) 197conf_data.set('XF86BIGFONT', build_xf86bigfont) 198conf_data.set('XF86DRI', build_dri1) 199conf_data.set('XF86VIDMODE', build_xf86vidmode) 200conf_data.set('XFIXES', '1') 201conf_data.set('XFreeXDGA', build_dga) 202conf_data.set('XINERAMA', build_xinerama) 203conf_data.set('XINPUT', '1') 204conf_data.set('XRECORD', '1') 205conf_data.set('XSELINUX', build_xselinux) 206conf_data.set('XSYNC', '1') 207conf_data.set('XTEST', '1') 208conf_data.set('XV', build_xv) 209conf_data.set('XvExtension', build_xv) 210conf_data.set('XvMCExtension', build_xvmc) 211 212conf_data.set('HAVE_SHA1_IN_LIBNETTLE', '1') # XXX 213 214conf_data.set('HAVE_APM', build_apm or build_acpi) 215conf_data.set('HAVE_ACPI', build_acpi) 216 217enable_debugging = get_option('buildtype') == 'debug' 218conf_data.set('DEBUG', enable_debugging) 219 220conf_data.set_quoted('XVENDORNAME', get_option('vendor_name')) 221conf_data.set_quoted('XVENDORNAMESHORT', get_option('vendor_name_short')) 222conf_data.set_quoted('__VENDORDWEBSUPPORT__', get_option('vendor_web')) 223conf_data.set_quoted('OSVENDOR', get_option('os_vendor')) 224conf_data.set_quoted('BUILDERADDR', get_option('builder_addr')) 225conf_data.set_quoted('BUILDERSTRING', get_option('builder_string')) 226 227# 228# for xorg-server.h only 229# 230defines_svr4 = '''#if !defined(SVR4) && !defined(__svr4__) && !defined(__SVR4) 231#error "I am not SVR4" 232#endif 233''' 234 235# BSD specifics 236supports_pccons = false 237supports_pcvt = false 238supports_syscons = false 239supports_wscons = false 240csrg_based = false 241 242if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonflybsd' 243 supports_pccons = true 244 supports_pcvt = true 245 supports_syscons = true 246 csrg_based = true 247endif 248 249if host_machine.system() == 'kfreebsd' 250 supports_pccons = true 251 supports_pcvt = true 252 supports_syscons = true 253endif 254 255if host_machine.system() == 'netbsd' 256 supports_pccons = true 257 supports_pcvt = true 258 supports_wscons = true 259 csrg_based = true 260endif 261 262if host_machine.system() == 'openbsd' 263 supports_pcvt = true 264 supports_wscons = true 265 csrg_based = true 266endif 267 268conf_data.set('SVR4', cc.compiles(defines_svr4)) 269conf_data.set_quoted('XKB_DFLT_RULES', get_option('xkb_default_rules')) 270conf_data.set('XORGSERVER', build_xorg) 271conf_data.set_quoted('XCONFIGFILE', 'xorg.conf') 272conf_data.set_quoted('__XSERVERNAME__', 'Xorg') 273conf_data.set('WITH_VGAHW', build_vgahw) 274conf_data.set('CSRG_BASED', csrg_based) 275conf_data.set('PCCONS_SUPPORT', supports_pccons) 276conf_data.set('PCVT_SUPPORT', supports_pcvt) 277conf_data.set('SYSCONS_SUPPORT', supports_syscons) 278conf_data.set('WSCONS_SUPPORT', supports_wscons) 279conf_data.set('XSERVER_LIBPCIACCESS', get_option('pciaccess')) 280conf_data.set('XSERVER_PLATFORM_BUS', build_udev) 281 282configure_file(output : 'dix-config.h', 283 configuration : conf_data) 284 285configure_file(output : 'xorg-server.h', 286 input : 'xorg-server.h.meson.in', 287 configuration : conf_data, 288 install_dir: xorgsdkdir) 289 290version_data = configuration_data() 291version_data.set('VENDOR_RELEASE', '@0@'.format(release)) 292version_data.set_quoted('VENDOR_NAME', get_option('vendor_name')) 293version_data.set_quoted('VENDOR_NAME_SHORT', get_option('vendor_name_short')) 294version_data.set_quoted('VENDOR_WEB', get_option('vendor_web')) 295version_data.set_quoted('VENDOR_MAN_VERSION', 'Version @0@.@1@.@2@'.format(major, minor, patch)) 296configure_file(output : 'version-config.h', 297 configuration : version_data) 298 299xkb_data = configuration_data() 300 301xkb_data.set_quoted('XKB_BIN_DIRECTORY', xkb_bin_dir) 302xkb_data.set_quoted('XKB_BASE_DIRECTORY', xkb_dir) 303xkb_data.set_quoted('XKB_DFLT_RULES', get_option('xkb_default_rules')) 304xkb_data.set_quoted('XKB_DFLT_MODEL', get_option('xkb_default_model')) 305xkb_data.set_quoted('XKB_DFLT_LAYOUT', get_option('xkb_default_layout')) 306xkb_data.set_quoted('XKB_DFLT_VARIANT', get_option('xkb_default_variant')) 307xkb_data.set_quoted('XKB_DFLT_OPTIONS', get_option('xkb_default_options')) 308xkb_data.set_quoted('XKM_OUTPUT_DIR', xkb_output_dir) 309 310configure_file(output : 'xkb-config.h', 311 configuration : xkb_data) 312 313xorg_data = configuration_data() 314 315xorg_data.set_quoted('XORG_BIN_DIRECTORY', get_option('bindir')) 316xorg_data.set('XORG_VERSION_CURRENT', release) 317xorg_data.set_quoted('XF86CONFIGFILE', 'xorg.conf') 318xorg_data.set_quoted('XCONFIGFILE', 'xorg.conf') 319xorg_data.set_quoted('XCONFIGDIR', 'xorg.conf.d') 320xorg_data.set_quoted('DEFAULT_XDG_DATA_HOME', '.local/share') 321xorg_data.set_quoted('DEFAULT_XDG_DATA_HOME_LOGDIR', 'xorg') 322xorg_data.set_quoted('DEFAULT_LOGDIR', log_dir) 323xorg_data.set_quoted('DEFAULT_LOGPREFIX', 'Xorg.') 324xorg_data.set_quoted('FALLBACK_INPUT_DRIVER', 'libinput') 325xorg_data.set_quoted('DEFAULT_MODULE_PATH', join_paths(get_option('prefix'), module_dir)) 326xorg_data.set_quoted('DEFAULT_LIBRARY_PATH', join_paths(get_option('prefix'), get_option('libdir'))) 327xorg_data.set_quoted('__XSERVERNAME__', 'Xorg') 328xorg_data.set('XSERVER_LIBPCIACCESS', get_option('pciaccess')) 329xorg_data.set_quoted('PCI_TXT_IDS_PATH', '') 330xorg_data.set('XSERVER_PLATFORM_BUS', build_udev) 331xorg_data.set('WSCONS_SUPPORT', host_machine.system() == 'netbsd' or host_machine.system() == 'openbsd') 332xorg_data.set('XF86PM', build_apm or build_acpi) 333 334if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonflybsd' 335 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64' 336 xorg_data.set('USE_DEV_IO', true) 337 endif 338 # XXX: Add link to libio on alpha 339elif host_machine.system() == 'netbsd' 340 # XXX: USE_ALPHA_PIO 341 # XXX: Add link to libi386 342 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64' 343 xorg_data.set('USE_I386_IOPL', true) 344 endif 345elif host_machine.system() == 'openbsd' 346 # XXX: Add link to libi386, libamd64 347 if host_machine.cpu_family() == 'x86' 348 xorg_data.set('USE_I386_IOPL', true) 349 endif 350 if host_machine.cpu_family() == 'x86_64' 351 xorg_data.set('USE_AMD64_IOPL', true) 352 endif 353endif 354 355configure_file(output : 'xorg-config.h', 356 input : 'xorg-config.h.meson.in', 357 configuration : xorg_data) 358 359xwin_data = configuration_data() 360xwin_data.set_quoted('DEFAULT_LOGDIR', log_dir) 361xwin_data.set('HAS_WINSOCK', host_machine.system() == 'windows', description: 'Use Windows sockets') 362xwin_data.set('HAS_DEVWINDOWS', host_machine.system() == 'cygwin', description: 'Has /dev/windows for signaling new win32 messages') 363xwin_data.set('RELOCATE_PROJECTROOT', host_machine.system() == 'windows', description: 'Make paths relative to the xserver installation location') 364# XXX: these three are all the same as DEBUG so we should just change to that 365xwin_data.set10('CYGDEBUG', enable_debugging) 366xwin_data.set10('CYGWINDOWING_DEBUG',enable_debugging) 367xwin_data.set10('CYGMULTIWINDOW_DEBUG', enable_debugging) 368 369configure_file(output : 'xwin-config.h', 370 input : 'xwin-config.h.meson.in', 371 configuration : xwin_data) 372 373xwayland_data = configuration_data() 374xwayland_data.set('XWL_HAS_GLAMOR', build_glamor and (gbm_dep.found() or build_eglstream)) 375xwayland_data.set('XWL_HAS_EGLSTREAM', build_eglstream) 376 377configure_file(output : 'xwayland-config.h', 378 input : 'xwayland-config.h.meson.in', 379 configuration : xwayland_data) 380 381if build_xorg 382 install_data( 383 [ 384 'XIstubs.h', 385 'Xprintf.h', 386 'callback.h', 387 'client.h', 388 'closestr.h', 389 'closure.h', 390 'colormap.h', 391 'colormapst.h', 392 'hotplug.h', 393 'cursor.h', 394 'cursorstr.h', 395 'dix.h', 396 'dixaccess.h', 397 'dixevents.h', 398 'dixfont.h', 399 'dixfontstr.h', 400 'dixgrabs.h', 401 'dixstruct.h', 402 'events.h', 403 'exevents.h', 404 'extension.h', 405 'extinit.h', 406 'extnsionst.h', 407 'gc.h', 408 'gcstruct.h', 409 'globals.h', 410 'glx_extinit.h', 411 'glxvndabi.h', 412 'input.h', 413 'inputstr.h', 414 'list.h', 415 'misc.h', 416 'miscstruct.h', 417 'opaque.h', 418 'nonsdk_extinit.h', 419 'optionstr.h', 420 'os.h', 421 'pixmap.h', 422 'pixmapstr.h', 423 'privates.h', 424 'property.h', 425 'propertyst.h', 426 'ptrveloc.h', 427 'region.h', 428 'regionstr.h', 429 'registry.h', 430 'resource.h', 431 'rgb.h', 432 'screenint.h', 433 'scrnintstr.h', 434 'selection.h', 435 'servermd.h', 436 'site.h', 437 'validate.h', 438 'displaymode.h', 439 'window.h', 440 'windowstr.h', 441 'xkbfile.h', 442 'xkbsrv.h', 443 'xkbstr.h', 444 'xkbrules.h', 445 'Xprintf.h', 446 'xserver_poll.h', 447 'xserver-properties.h', 448 ], 449 install_dir: xorgsdkdir, 450 ) 451endif 452