Skip to content

Commit 7678523

Browse files
committed
tools/build: Add a feature test for libopenssl
It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability. Signed-off-by: Namhyung Kim <namhyung@kernel.org>
1 parent 8f0b4cc commit 7678523

4 files changed

Lines changed: 22 additions & 4 deletions

File tree

tools/build/Makefile.feature

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ FEATURE_TESTS_BASIC := \
9999
libzstd \
100100
disassembler-four-args \
101101
disassembler-init-styled \
102-
file-handle
102+
file-handle \
103+
libopenssl
103104

104105
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
105106
# of all feature tests
@@ -147,7 +148,8 @@ FEATURE_DISPLAY ?= \
147148
lzma \
148149
bpf \
149150
libaio \
150-
libzstd
151+
libzstd \
152+
libopenssl
151153

152154
#
153155
# Declare group members of a feature to display the logical OR of the detection

tools/build/feature/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ FILES= \
6767
test-libopencsd.bin \
6868
test-clang.bin \
6969
test-llvm.bin \
70-
test-llvm-perf.bin \
70+
test-llvm-perf.bin \
7171
test-libaio.bin \
7272
test-libzstd.bin \
7373
test-clang-bpf-co-re.bin \
7474
test-file-handle.bin \
75-
test-libpfm4.bin
75+
test-libpfm4.bin \
76+
test-libopenssl.bin
7677

7778
FILES := $(addprefix $(OUTPUT),$(FILES))
7879

@@ -381,6 +382,9 @@ $(OUTPUT)test-file-handle.bin:
381382
$(OUTPUT)test-libpfm4.bin:
382383
$(BUILD) -lpfm
383384

385+
$(OUTPUT)test-libopenssl.bin:
386+
$(BUILD) -lssl
387+
384388
$(OUTPUT)test-bpftool-skeletons.bin:
385389
$(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
386390
> $(@:.bin=.make.output) 2>&1

tools/build/feature/test-all.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@
142142
# include "test-libtraceevent.c"
143143
#undef main
144144

145+
#define main main_test_libopenssl
146+
# include "test-libopenssl.c"
147+
#undef main
148+
145149
int main(int argc, char *argv[])
146150
{
147151
main_test_libpython();
@@ -173,6 +177,7 @@ int main(int argc, char *argv[])
173177
main_test_reallocarray();
174178
main_test_libzstd();
175179
main_test_libtraceevent();
180+
main_test_libopenssl();
176181

177182
return 0;
178183
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <openssl/ssl.h>
2+
#include <openssl/opensslv.h>
3+
4+
int main(void)
5+
{
6+
return SSL_library_init();
7+
}

0 commit comments

Comments
 (0)