1*9e3b08aeSAndroid Build Coastguard Worker# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2*9e3b08aeSAndroid Build Coastguard Worker# 3*9e3b08aeSAndroid Build Coastguard Worker# Copyright 2024 Google LLC 4*9e3b08aeSAndroid Build Coastguard Worker# 5*9e3b08aeSAndroid Build Coastguard Worker# Licensed under the Apache License v2.0 with LLVM Exceptions (the "License"); 6*9e3b08aeSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. You may 7*9e3b08aeSAndroid Build Coastguard Worker# obtain a copy of the License at 8*9e3b08aeSAndroid Build Coastguard Worker# 9*9e3b08aeSAndroid Build Coastguard Worker# https://llvm.org/LICENSE.txt 10*9e3b08aeSAndroid Build Coastguard Worker# 11*9e3b08aeSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 12*9e3b08aeSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13*9e3b08aeSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14*9e3b08aeSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under 15*9e3b08aeSAndroid Build Coastguard Worker# the License. 16*9e3b08aeSAndroid Build Coastguard Worker# 17*9e3b08aeSAndroid Build Coastguard Worker# Author: Giuliano Procida 18*9e3b08aeSAndroid Build Coastguard Worker 19*9e3b08aeSAndroid Build Coastguard Worker#[=======================================================================[.rst: 20*9e3b08aeSAndroid Build Coastguard WorkerFindLinuxUAPI 21*9e3b08aeSAndroid Build Coastguard Worker------------- 22*9e3b08aeSAndroid Build Coastguard Worker 23*9e3b08aeSAndroid Build Coastguard WorkerFinds the Linux UAPI headers. 24*9e3b08aeSAndroid Build Coastguard Worker 25*9e3b08aeSAndroid Build Coastguard WorkerResult Variables 26*9e3b08aeSAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^ 27*9e3b08aeSAndroid Build Coastguard Worker 28*9e3b08aeSAndroid Build Coastguard WorkerThis will define the following variables: 29*9e3b08aeSAndroid Build Coastguard Worker 30*9e3b08aeSAndroid Build Coastguard Worker``LinuxUAPI_FOUND`` 31*9e3b08aeSAndroid Build Coastguard Worker True if the system has the Linux UAPI headers. 32*9e3b08aeSAndroid Build Coastguard Worker``LinuxUAPI_INCLUDE_DIR`` 33*9e3b08aeSAndroid Build Coastguard Worker The Linux UAPI include directory. 34*9e3b08aeSAndroid Build Coastguard Worker``LinuxUAPI_VERSION`` 35*9e3b08aeSAndroid Build Coastguard Worker The version of the Linux UAPI headers which were found. 36*9e3b08aeSAndroid Build Coastguard Worker 37*9e3b08aeSAndroid Build Coastguard Worker#]=======================================================================] 38*9e3b08aeSAndroid Build Coastguard Worker 39*9e3b08aeSAndroid Build Coastguard Workerfind_path( 40*9e3b08aeSAndroid Build Coastguard Worker LinuxUAPI_INCLUDE_DIR 41*9e3b08aeSAndroid Build Coastguard Worker linux/version.h 42*9e3b08aeSAndroid Build Coastguard Worker) 43*9e3b08aeSAndroid Build Coastguard Workermark_as_advanced(LinuxUAPI_INCLUDE_DIR) 44*9e3b08aeSAndroid Build Coastguard Worker 45*9e3b08aeSAndroid Build Coastguard Workerif(LinuxUAPI_INCLUDE_DIR) 46*9e3b08aeSAndroid Build Coastguard Worker file(READ "${LinuxUAPI_INCLUDE_DIR}/linux/version.h" _version_header) 47*9e3b08aeSAndroid Build Coastguard Worker string(REGEX REPLACE ".*#define LINUX_VERSION_MAJOR ([0-9]+).*#define LINUX_VERSION_PATCHLEVEL ([0-9]+).*#define LINUX_VERSION_SUBLEVEL ([0-9]+).*" "\\1.\\2.\\3" LinuxUAPI_VERSION "${_version_header}") 48*9e3b08aeSAndroid Build Coastguard Workerendif() 49*9e3b08aeSAndroid Build Coastguard Worker 50*9e3b08aeSAndroid Build Coastguard Workerinclude(FindPackageHandleStandardArgs) 51*9e3b08aeSAndroid Build Coastguard Workerfind_package_handle_standard_args( 52*9e3b08aeSAndroid Build Coastguard Worker LinuxUAPI 53*9e3b08aeSAndroid Build Coastguard Worker REQUIRED_VARS LinuxUAPI_INCLUDE_DIR 54*9e3b08aeSAndroid Build Coastguard Worker VERSION_VAR LinuxUAPI_VERSION 55*9e3b08aeSAndroid Build Coastguard Worker) 56