Skip to contentSkip to conversation

utils/alsa.m4: conditionally enable libdl in AM_PATH_ALSA m4 macro

PATCH Applied Thomas Petazzoni 2 participants 2 messages Nov 1, 2018 – Nov 2, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils/alsa.m4: conditionally enable libdl in AM_PATH_ALSA m4 macro

From: Thomas De Schampheleire <[email protected]>

The AM_PATH_ALSA macro in utils/alsa.m4 unconditionally uses -ldl. This breaks compilation of alsa-utils (and probably other packages using this macro) for targets that do not support dynamic loading.

This patch updates the macro to check if dlopen is available, and use that result to conditionally add -ldl to the list of libraries.

---
 utils/alsa.m4 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/alsa.m4 +3 -1
index e12310df..a5c5a292 100644
@@ -44,6 +44,8 @@ if test "$alsa_inc_prefix" != "" ; then
 fi
 AC_MSG_RESULT($ALSA_CFLAGS)
 
+AC_CHECK_LIB(c, dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")])
+
 dnl add any special lib dirs
 AC_MSG_CHECKING(for ALSA LDFLAGS)
 if test "$alsa_prefix" != "" ; then
@@ -52,7 +54,7 @@ if test "$alsa_prefix" != "" ; then
 fi
 
 dnl add the alsa library
-ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
+ALSA_LIBS="$ALSA_LIBS -lasound -lm $LIBDL -lpthread"
 LIBS="$ALSA_LIBS $LIBS"
 AC_MSG_RESULT($ALSA_LIBS)
 
Signature · 6 lines
2.14.4

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Applied
#1 lore raw
Quoted 8 lines · Thomas Petazzoni

From: Thomas De Schampheleire <[email protected]>

The AM_PATH_ALSA macro in utils/alsa.m4 unconditionally uses -ldl. This breaks compilation of alsa-utils (and probably other packages using this macro) for targets that do not support dynamic loading.

Quoted 6 lines

This patch updates the macro to check if dlopen is available, and use that result to conditionally add -ldl to the list of libraries.

Applied, thanks.

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel