148becaf0Smrg# Copyright © 2018-2020 Intel Corporation 248becaf0Smrg 348becaf0Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy 448becaf0Smrg# of this software and associated documentation files (the "Software"), to deal 548becaf0Smrg# in the Software without restriction, including without limitation the rights 648becaf0Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 748becaf0Smrg# copies of the Software, and to permit persons to whom the Software is 848becaf0Smrg# furnished to do so, subject to the following conditions: 948becaf0Smrg 1048becaf0Smrg# The above copyright notice and this permission notice shall be included in 1148becaf0Smrg# all copies or substantial portions of the Software. 1248becaf0Smrg 1348becaf0Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1448becaf0Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1548becaf0Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1648becaf0Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1748becaf0Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1848becaf0Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 1948becaf0Smrg# SOFTWARE. 2048becaf0Smrg 2148becaf0Smrgproject( 2248becaf0Smrg 'libpciaccess', 2348becaf0Smrg ['c'], 245ad99bdfSmrg version : '0.18.1', 2548becaf0Smrg license : 'MIT', 2648becaf0Smrg meson_version : '>= 0.48.0', 2748becaf0Smrg default_options : ['buildtype=debugoptimized'], 2848becaf0Smrg) 2948becaf0Smrg 3048becaf0Smrgc = meson.get_compiler('c') 3148becaf0Smrg 3248becaf0Smrgadd_project_arguments( 3348becaf0Smrg c.get_supported_arguments( 3448becaf0Smrg '-Wpointer-arith', 3548becaf0Smrg '-Wmissing-declarations', 3648becaf0Smrg '-Wformat=2', 3748becaf0Smrg '-Wstrict-prototypes', 3848becaf0Smrg '-Wmissing-prototypes', 3948becaf0Smrg '-Wnested-externs', 4048becaf0Smrg '-Wbad-function-cast', 4148becaf0Smrg '-Wold-style-definition', 4248becaf0Smrg '-Wdeclaration-after-statement', 4348becaf0Smrg '-Wunused', 4448becaf0Smrg '-Wuninitialized', 4548becaf0Smrg '-Wshadow', 4648becaf0Smrg '-Wmissing-noreturn', 4748becaf0Smrg '-Wmissing-format-attribute', 4848becaf0Smrg '-Wredundant-decls', 4948becaf0Smrg '-Wlogical-op', 5048becaf0Smrg '-Werror=implicit', 5148becaf0Smrg '-Werror=nonnull', 5248becaf0Smrg '-Werror=init-self', 5348becaf0Smrg '-Werror=main', 5448becaf0Smrg '-Werror=missing-braces', 5548becaf0Smrg '-Werror=sequence-point', 5648becaf0Smrg '-Werror=return-type', 5748becaf0Smrg '-Werror=trigraphs', 5848becaf0Smrg '-Werror=array-bounds', 5948becaf0Smrg '-Werror=write-strings', 6048becaf0Smrg '-Werror=address', 6148becaf0Smrg '-Werror=int-to-pointer-cast', 6248becaf0Smrg ), 6348becaf0Smrg language : 'c' 6448becaf0Smrg) 6548becaf0Smrg 6648becaf0Smrgconfig = configuration_data() 6748becaf0Smrg 6848becaf0Smrgconfig.set_quoted( 6948becaf0Smrg 'PCIIDS_PATH', 7048becaf0Smrg join_paths(get_option('prefix'), get_option('datadir'), get_option('pci-ids')) 7148becaf0Smrg) 7248becaf0Smrgif get_option('linux-rom-fallback') 7348becaf0Smrg config.set('LINUX_ROM', 1) 7448becaf0Smrgendif 7548becaf0Smrg 7648becaf0Smrgdep_zlib = dependency('zlib', required : get_option('zlib')) 7748becaf0Smrgif dep_zlib.found() 7848becaf0Smrg config.set('HAVE_ZLIB', 1) 7948becaf0Smrgendif 8048becaf0Smrg 8148becaf0Smrgextra_libs = [] 8248becaf0Smrgif host_machine.system() == 'netbsd' 8348becaf0Smrg extra_libs += c.find_library('pci') 8448becaf0Smrg if host_machine.cpu_family() == 'x86' 8548becaf0Smrg extra_libs += c.find_library('i386') 8648becaf0Smrg elif host_machine.cpu_family() == 'x86_64' 8748becaf0Smrg extra_libs += c.find_library('x86_64') 8848becaf0Smrg elif host_machine.cpu_family() == 'alpha' # TODO 8948becaf0Smrg extra_libs += c.find_library('alpha') 9048becaf0Smrg endif 9148becaf0Smrgelif host_machine.system() == 'sunos' 9248becaf0Smrg extra_libs += c.find_library('devinfo') 9348becaf0Smrgendif 9448becaf0Smrg 9548becaf0Smrgif host_machine.system() == 'netbsd' 9648becaf0Smrg _prefix = '' 9748becaf0Smrg if c.check_header('machine/sysarch.h') 9848becaf0Smrg _prefix = ''' 9948becaf0Smrg #include <sys/types.h> 10048becaf0Smrg #include <machine/sysarch.h> 10148becaf0Smrg ''' 10248becaf0Smrg endif 10348becaf0Smrg 10448becaf0Smrg if c.check_header('machine/mtrr.h', prefix : _prefix) 10548becaf0Smrg config.set('HAVE_MTRR', 1) 10648becaf0Smrg endif 10748becaf0Smrgelif c.check_header('asm/mtrr.h') 10848becaf0Smrg config.set('HAVE_MTRR', 1) 10948becaf0Smrgendif 11048becaf0Smrg 11148becaf0Smrgforeach h : ['err.h', 'stdint.h', 'string.h', 'strings.h', 'inttypes.h'] 11248becaf0Smrg if c.check_header(h) 11348becaf0Smrg config.set('HAVE_' + h.to_upper().underscorify(), 1) 11448becaf0Smrg endif 11548becaf0Smrgendforeach 11648becaf0Smrg 11748becaf0Smrgconfig_h = configure_file( 11848becaf0Smrg configuration : config, 11948becaf0Smrg output : 'config.h', 12048becaf0Smrg) 12148becaf0Smrgadd_project_arguments('-DHAVE_CONFIG_H', language : ['c']) 12248becaf0Smrg 12348becaf0Smrginstall_headers('include/pciaccess.h') 12448becaf0Smrginc_include = include_directories('.', 'include') 12548becaf0Smrg 12648becaf0Smrgsubdir('src') 12748becaf0Smrgsubdir('scanpci') 12848becaf0Smrgsubdir('man') 12948becaf0Smrg 13048becaf0Smrgpkg = import('pkgconfig') 13148becaf0Smrgpkg.generate( 13248becaf0Smrg libpciaccess, 13348becaf0Smrg description : 'Library providing generic access to the PCI bus and devices', 13448becaf0Smrg) 135