summaryrefslogtreecommitdiffstats
path: root/Makefile.include
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.com>2022-01-31 23:49:44 +0100
committerNico Huber <nico.h@gmx.de>2022-02-15 00:02:01 +0000
commit274e146621a22f3de4790e685226e1a87bdca51b (patch)
treeaa1cd1913cdcf08fff41fbd715c9cbff2a0d3a60 /Makefile.include
parent9fb5812896859f5e195527d64554e44eb981eac3 (diff)
downloadflashrom-274e146621a22f3de4790e685226e1a87bdca51b.tar.gz
flashrom-274e146621a22f3de4790e685226e1a87bdca51b.tar.bz2
flashrom-274e146621a22f3de4790e685226e1a87bdca51b.zip
Makefile: check if librt is an external library
Some systems, e.g. OpenBSD, have clock_gettime / librt build into the libc and therefore fail to link against it with -lrt. Thus, detect this and link only if needed. Change-Id: I2c1668a350aa0806fccfb4e9cd8b04861f085ee9 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/61523 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'Makefile.include')
-rw-r--r--Makefile.include4
1 files changed, 4 insertions, 0 deletions
diff --git a/Makefile.include b/Makefile.include
index a3abcad81..2316b30c4 100644
--- a/Makefile.include
+++ b/Makefile.include
@@ -40,6 +40,10 @@ define c_compile_test # $1: files to compile, $2: cflags
$(call debug_shell, $(CC) -c -Wall -Werror $2 $1 -o /dev/null && echo yes || echo no)
endef
+define c_link_test # $1: file to compile and link, $2: cflags, $3: ldflags
+$(call debug_shell, $(CC) -Wall -Werror $2 $1 $3 -o /dev/null && echo yes || echo no)
+endef
+
define find_dependency
$(call debug_shell, $(if $(PKG_CONFIG_LIBDIR),PKG_CONFIG_LIBDIR=$(PKG_CONFIG_LIBDIR),) $(PKG_CONFIG) --exists $1 && echo yes || echo no)
endef