]> git.alsa-project.org Git - alsa-lib.git/commitdiff
utils/alsa.m4: conditionally enable libdl in AM_PATH_ALSA m4 macro
authorThomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Thu, 1 Nov 2018 14:40:07 +0000 (15:40 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 2 Nov 2018 13:57:50 +0000 (14:57 +0100)
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.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
utils/alsa.m4

index e12310df4dcc466882a0272b9c90ca12a2cc3427..a5c5a292b89a9ded675ee14453e78b631263e327 100644 (file)
@@ -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)