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