mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
common.mak: Introduce user-defined function check_header_prereq()
The new user-defined function allows to check for C headers in make's conditional statements. Example: ifeq ($(call check_header_prereq,"systemd/sd-daemon.h"),yes) $(warning "systemd support enabled") else $(warning "systemd support disabled") endif Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com> Acked-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
317384b5c9
commit
49901079d4
14
common.mak
14
common.mak
@@ -111,6 +111,20 @@ ifeq ("${ASAN}","1")
|
||||
DEFAULT_LDFLAGS += -fsanitize=address
|
||||
endif
|
||||
|
||||
#
|
||||
# Check for header prerequisite
|
||||
#
|
||||
# $1: Name of include file to check
|
||||
# $2: Additional compiler & linker options (optional)
|
||||
#
|
||||
# Returns "yes" on success and nothing otherwise
|
||||
#
|
||||
define check_header_prereq
|
||||
$(shell printf "#include <%s>\n int main(void) {return 0;}" $1 | \
|
||||
( $(CC) $(filter-out --coverage, $(ALL_CFLAGS)) $(ALL_CPPFLAGS) \
|
||||
$2 -o /dev/null -xc - ) >/dev/null 2>&1 && echo -n yes)
|
||||
endef
|
||||
|
||||
#
|
||||
# Check for build dependency
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user