From 06f4f72e28088fe4cc915c0c2b258f1bbfef2c05 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 29 Nov 2016 16:25:37 -0800 Subject: [PATCH 1/2] Add -ldl to libcommon link flags if it's needed for dlopen() --- common/Makefile.am | 3 ++- configure.ac | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/Makefile.am b/common/Makefile.am index 8305ede4..049e8af9 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -52,4 +52,5 @@ libcommon_la_SOURCES = \ libcommon_la_LIBADD = \ -lcrypto \ -lssl \ - -lpthread + -lpthread \ + $(DLOPEN_LIBS) diff --git a/configure.ac b/configure.ac index 94ba2e16..10f73617 100644 --- a/configure.ac +++ b/configure.ac @@ -118,6 +118,12 @@ AC_ARG_ENABLE(pixman, AS_HELP_STRING([--enable-pixman], [], [enable_pixman=no]) AM_CONDITIONAL(XRDP_PIXMAN, [test x$enable_pixman = xyes]) +# Check if -ldl is needed to use dlopen() +DLOPEN_LIBS= +AC_CHECK_FUNC(dlopen, [], + [AC_CHECK_LIB(dl, dlopen, [DLOPEN_LIBS=-ldl])]) +AC_SUBST(DLOPEN_LIBS) + # checking for openssl AC_CHECK_HEADER([openssl/rc4.h], [], [AC_MSG_ERROR([please install libssl-dev or openssl-devel])], From c6307aa2b037359c75659758f4c4e3af666de6ae Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 29 Nov 2016 17:00:09 -0800 Subject: [PATCH 2/2] Use pkg-config to discover OpenSSL All supported versions of OpenSSL have pkg-config files. --- common/Makefile.am | 5 +++-- configure.ac | 5 ++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/Makefile.am b/common/Makefile.am index 049e8af9..1bc5851f 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -18,6 +18,8 @@ AM_CPPFLAGS = \ -DXRDP_PID_PATH=\"${localstatedir}/run\" \ -DXRDP_LOG_PATH=\"${localstatedir}/log\" +AM_CFLAGS = $(OPENSSL_CFLAGS) + module_LTLIBRARIES = \ libcommon.la @@ -50,7 +52,6 @@ libcommon_la_SOURCES = \ $(PIXMAN_SOURCES) libcommon_la_LIBADD = \ - -lcrypto \ - -lssl \ -lpthread \ + $(OPENSSL_LIBS) \ $(DLOPEN_LIBS) diff --git a/configure.ac b/configure.ac index 10f73617..3b58f2de 100644 --- a/configure.ac +++ b/configure.ac @@ -125,9 +125,8 @@ AC_CHECK_FUNC(dlopen, [], AC_SUBST(DLOPEN_LIBS) # checking for openssl -AC_CHECK_HEADER([openssl/rc4.h], [], - [AC_MSG_ERROR([please install libssl-dev or openssl-devel])], - [#include ]) +PKG_CHECK_MODULES([OPENSSL], [openssl >= 0], [], + [AC_MSG_ERROR([please install libssl-dev or openssl-devel])]) # checking for pam variation # Linux-PAM is used in Linux systems