[Icecast-dev] [PATCH] autotools: Add -no-undefined in LDFLAGS for shared library in mingw

Biswapriyo Nath nathbappai at gmail.com
Wed May 4 16:14:30 UTC 2022


-------------- next part --------------
From c2bf7e32b9f6f1b28f356da82207224b08a9aefc Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai at gmail.com>
Date: Wed, 4 May 2022 21:43:53 +0530
Subject: [PATCH] autotools: Add -no-undefined in LDFLAGS for shared library in mingw

This fixes the following warning while building shared library in mingw:
libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only

Signed-off-by: Biswapriyo Nath <nathbappai at gmail.com>
---
 configure.ac    | 11 +++++++++++
 src/Makefile.am |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/configure.ac b/configure.ac
index f323e96..47c6b0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,17 @@ else
         PROFILE="-pg -g"
 fi
 
+dnl Check if shared library requires -no-undefined option
+
+AC_CANONICAL_HOST
+use_no_undefined="no"
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc* | os2* | aix*)
+    use_no_undefined="yes"
+    ;;
+esac
+AM_CONDITIONAL([USE_NO_UNDEFINED],[test "x${use_no_undefined}" = "xyes"])
+
 dnl Checks for programs.
 
 dnl Checks for header files.
diff --git a/src/Makefile.am b/src/Makefile.am
index bb0e475..e70941e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -28,6 +28,10 @@ SUBDIRS = common/avl common/net common/timing common/httpp $(MAYBE_THREAD)
 lib_LTLIBRARIES = libshout.la
 libshout_la_LDFLAGS = -version-info 5:0:2
 
+if USE_NO_UNDEFINED
+libshout_la_LDFLAGS += -no-undefined
+endif
+
 EXTRA_DIST = codec_theora.c codec_speex.c tls.c
 noinst_HEADERS = format_ogg.h shout_private.h util.h
 PROTOCOLS=proto_http.c proto_xaudiocast.c proto_icy.c proto_roaraudio.c
-- 
2.36.0



More information about the Icecast-dev mailing list