c533419baa2951225954feb08f08470adc96df84
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / alsa-lib / 0004-conditional-enabling-of-libdl-in-m4.patch
1 alsa-lib: conditionally enable libdl in AM_PATH_ALSA m4 macro
2
3 The AM_PATH_ALSA macro in utils/alsa.m4 unconditionally uses -ldl. This
4 breaks compilation of alsa-utils (and probably other packages using this
5 macro) for targets that do not support dynamic loading, such as for
6 Blackfin FLAT binaries.
7
8 This patch updates the macro to check if dlopen is available, and use that
9 result to conditionally add -ldl to the list of libraries.
10
11 Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
12
13 ---
14
15 diff --git a/utils/alsa.m4 b/utils/alsa.m4
16 --- a/utils/alsa.m4
17 +++ b/utils/alsa.m4
18 @@ -44,6 +44,8 @@ if test "$alsa_inc_prefix" != "" ; then
19  fi
20  AC_MSG_RESULT($ALSA_CFLAGS)
21  
22 +AC_CHECK_LIB(c, dlopen, LIBDL="", [AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl")])
23 +
24  dnl add any special lib dirs
25  AC_MSG_CHECKING(for ALSA LDFLAGS)
26  if test "$alsa_prefix" != "" ; then
27 @@ -52,7 +54,7 @@ if test "$alsa_prefix" != "" ; then
28  fi
29  
30  dnl add the alsa library
31 -ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
32 +ALSA_LIBS="$ALSA_LIBS -lasound -lm $LIBDL -lpthread"
33  LIBS="$ALSA_LIBS $LIBS"
34  AC_MSG_RESULT($ALSA_LIBS)
35