[Mesa-dev] [PATCH] configure: check for dladdr via AC_CHECK_FUNC/AC_CHECK_LIB

Emil Velikov emil.l.velikov at gmail.com
Fri Aug 8 10:31:07 PDT 2014


From: Pali Rohár <pali.rohar at gmail.com>

Use both macros as in some cases using AC_CHECK_FUNCS alone may fail.
Thus HAVE_DLADDR will not be defined, and as a result most of the code 
in megadriver_stub.c will not be compiled. Breakind the backwards
compat with between older libGL/xserver(s) and DRI megadrivers.

Cc: Jon TURNEY <jon.turney at dronecode.org.uk>
Cc: "10.2" <mesa-stable at lists.freedesktop.org>
[Emil Velikov] Commit message.
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---

On the other hand we can replace _mesa_dl*, dl* and util_dl* with a 
single solution (based on the gallium one). Then we can drop the 
check altogether, and slim down the DEFINES that we're feeding to
everything that we build, and drop the DLOPEN_LIBS :)

Perhaps one day...

-Emil 


 configure.ac | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index a3b3abd..85f60ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -535,10 +535,9 @@ AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
 AC_SUBST([DLOPEN_LIBS])
 
 dnl Check if that library also has dladdr
-save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $DLOPEN_LIBS"
-AC_CHECK_FUNCS([dladdr])
-LDFLAGS="$save_LDFLAGS"
+AC_CHECK_FUNC([dladdr], [DEFINES="$DEFINES -DHAVE_DLADDR"],
+    [AC_CHECK_LIB([dl], [dladdr],
+       [DEFINES="$DEFINES -DHAVE_DLADDR"])])
 
 case "$host_os" in
 darwin*|mingw*)
-- 
2.0.2



More information about the mesa-dev mailing list