From 90466b2c9f34e336efc07ad720b99873d2a11cf3 Mon Sep 17 00:00:00 2001
From: Daniel Bevenius <daniel.bevenius@gmail.com>
Date: Fri, 8 Feb 2019 14:10:35 +0100
Subject: [PATCH] Fix build failure for --disable-shared

Currently, when configuring with --disable-shared the following error is
generated when running make check:
make[2]: *** No rule to make target `../lib/.libs/*.o',
needed by `main'.  Stop.
make[2]: *** Waiting for unfinished jobs....

This commit adds a conditional for this case.
---
 configure.ac      | 2 ++
 tests/Makefile.am | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/configure.ac b/configure.ac
index e8a8a678..998a7c2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,8 @@ fi
 
 AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
 
+AM_CONDITIONAL([ENABLE_SHARED], [ test "x${enable_shared}" = "xyes" ])
+
 # openssl (for examples)
 PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.1.1],
                   [have_openssl=yes], [have_openssl=no])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5049123a..5d52ae43 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -68,7 +68,11 @@ main_SOURCES = $(HFILES) $(OBJECTS)
 
 # With static lib disabled and symbol hiding enabled, we have to link object
 # files directly because the tests use symbols not included in public API.
+if ENABLE_SHARED
 main_LDADD = ${top_builddir}/lib/.libs/*.o
+else
+main_LDADD = ${top_builddir}/lib/.libs/libngtcp2.la
+endif
 main_LDADD += @CUNIT_LIBS@
 main_LDFLAGS = -static
 
-- 
GitLab