Submitted By: Bruce Dubbs <bdubbs at linuxfromscratch dot org>
Date: 2022-04-15
Initial Package Version: 3.6.0
Upstream Status: Committed
Origin:  https://github.com/thom311/libnl/commit/fa7f97f8982544c4fcb403893bae6701230d5165.patch
Description: Updates building tests when static libraries are disabled.


From fa7f97f8982544c4fcb403893bae6701230d5165 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 15 Apr 2022 13:29:49 +0200
Subject: [PATCH] build: avoid building check-direct with --disable-static

"check-direct" needs to statically link with the libraries, because
it wants to test internal ABI, which is hidden in the share libraries.
When configuring with "--disable-static", static libs are not build
and the test tool cannot be build.

Just skip the test in that case.

https://github.com/thom311/libnl/issues/306
---
 Makefile.am  | 2 ++
 configure.ac | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index a6bcf553..2f5e0dfc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -984,8 +984,10 @@ tests_check_all_LDADD = \
 	$(NULL)
 
 if WITH_CHECK
+if ENABLE_STATIC
 check_programs += tests/check-direct
 endif
+endif
 
 tests_check_direct_SOURCES = \
 	tests/check-direct.c \
diff --git a/configure.ac b/configure.ac
index 1f9ad0eb..0fd1cc0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,8 @@ else
     AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))
 fi
 
+AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" != "no"])
+
 AC_ARG_ENABLE([debug],
 	AS_HELP_STRING([--disable-debug], [Do not include debugging statements]),
 	[enable_debug="$enableval"], [enable_debug="yes"])

