Skip to content

Commit

Permalink
meta: prevent linux_kernel_headers being set to system include paths
Browse files Browse the repository at this point in the history
  • Loading branch information
no92 committed Aug 7, 2024
1 parent 195b55d commit 49e4235
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,28 @@ if not disable_linux_option
if not import('fs').is_dir(get_option('linux_kernel_headers'))
error('linux_kernel_headers is not set to a valid path')
endif

cc_search_path = run_command(meson.get_compiler('cpp', native: true), '-E', '-Wp,-v', '-xc', '/dev/null', check: true).stderr()
search_paths = []

search_started = false
foreach line : cc_search_path.strip().splitlines()
if not search_started and line == '#include <...> search starts here:'
search_started = true
continue
elif search_started and line == 'End of search list.'
search_started = false
elif search_started
search_paths += line.strip()
endif
endforeach

foreach path : search_paths
if fs.is_samepath(get_option('linux_kernel_headers'), path)
warning('Please install Linux kernel headers to a directory using \'make headers_install\'.')
error('Using system include paths for \'linux_kernel_headers\' is unsupported!')
endif
endforeach
endif

rtld_include_dirs += include_directories('options/linux/include')
Expand Down

0 comments on commit 49e4235

Please sign in to comment.