From 7b8d250bd5366872707b2936a1513ac2bdec6808 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 10 Jun 2017 14:39:03 -0700 Subject: [PATCH] GUACAMOLE-325: Explicitly check for libdl, using it if provided and warning if both libdl and dlopen() are absent. --- configure.ac | 9 ++++++++- src/libguac/Makefile.am | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 62c5335d..49ac65fa 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,13 @@ AC_CHECK_LIB([pthread], [pthread_create], [PTHREAD_LIBS=-lpthread AC_DEFINE([HAVE_LIBPTHREAD],, [Whether libpthread was found])]) +# Include libdl for dlopen() if necessary +AC_CHECK_LIB([dl], [dlopen], + [DL_LIBS=-ldl], + [AC_CHECK_DECL([dlopen],, + AC_MSG_ERROR("libdl is required on systems which do not otherwise provide dlopen()"), + [#include ])]) + # OSSP UUID AC_CHECK_LIB([ossp-uuid], [uuid_make], [UUID_LIBS=-lossp-uuid], AC_CHECK_LIB([uuid], [uuid_make], [UUID_LIBS=-luuid], @@ -85,7 +92,7 @@ AC_CHECK_LIB([cunit], [CU_run_test], [CUNIT_LIBS=-lcunit]) # WinSock AC_CHECK_LIB([wsock32], [main]) -AC_SUBST(LIBADD_DLOPEN) +AC_SUBST(DL_LIBS) AC_SUBST(MATH_LIBS) AC_SUBST(PNG_LIBS) AC_SUBST(JPEG_LIBS) diff --git a/src/libguac/Makefile.am b/src/libguac/Makefile.am index 35e8e6e5..567f0faf 100644 --- a/src/libguac/Makefile.am +++ b/src/libguac/Makefile.am @@ -114,6 +114,7 @@ libguac_la_CFLAGS = \ libguac_la_LDFLAGS = \ -version-info 14:0:2 \ @CAIRO_LIBS@ \ + @DL_LIBS@ \ @JPEG_LIBS@ \ @PNG_LIBS@ \ @PTHREAD_LIBS@ \ @@ -122,5 +123,3 @@ libguac_la_LDFLAGS = \ @VORBIS_LIBS@ \ @WEBP_LIBS@ -libguac_la_LIBADD = \ - @LIBADD_DLOPEN@