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