diff options
author | Alon Bar-Lev <alon.barlev@gmail.com> | 2012-02-29 22:12:02 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2012-03-22 22:17:26 +0100 |
commit | bdae41107ddde61cae5ae2037c1420b539c52ff8 (patch) | |
tree | 6606526b4ad37eb3ca84d52237acf7998d713d57 /configure.ac | |
parent | c3fc703d31f47ceef66bc8006e2870e3c4d05ee6 (diff) | |
download | openvpn-bdae41107ddde61cae5ae2037c1420b539c52ff8.tar.gz openvpn-bdae41107ddde61cae5ae2037c1420b539c52ff8.tar.xz openvpn-bdae41107ddde61cae5ae2037c1420b539c52ff8.zip |
build: libdl usage
1. properly detect.
2. Link only required components.
3. No way we don't have LoadLibrary on Windows.
4. ENABLE_PLUGIN should be controlled in autoconf.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/configure.ac b/configure.ac index ed98464..a0dc462 100644 --- a/configure.ac +++ b/configure.ac @@ -395,7 +395,7 @@ AC_CHECK_HEADERS([ \ stdio.h stdarg.h \ time.h errno.h fcntl.h io.h direct.h \ ctype.h sys/types.h sys/socket.h \ - signal.h unistd.h \ + signal.h unistd.h dlfcn.h \ netinet/in.h netinet/in_systm.h \ netinet/tcp.h arpa/inet.h netdb.h \ windows.h winsock2.h ws2tcpip.h \ @@ -606,6 +606,13 @@ else AC_CHECK_FUNCS(SOCKET_OPT_FUNCS) fi +AC_CHECK_LIB( + [dl], + [dlopen], + [DL_LIBS="-ldl"] +) +AC_SUBST([DL_LIBS]) + case "${with_mem_check}" in valgrind) AC_CHECK_HEADER( @@ -658,38 +665,6 @@ case "${with_mem_check}" in esac dnl -dnl Check for dlopen -- first try libc then libdl. -dnl -if test "${WIN32}" != "yes" -a "${enable_plugins}" = "yes"; then - AC_CHECK_HEADER( - [dlfcn.h], - [AC_CHECK_FUNC( - [dlopen], - [AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading])], - [AC_CHECK_LIB( - [dl], - [dlopen], - [ - LIBS="${LIBS} -ldl" - AC_DEFINE(USE_LIBDL, 1, [Use libdl for dynamic library loading]) - ], - [AC_MSG_RESULT([libdl library not found.])] - )], - )], - ) - if test "${enable_eurephia}" = "yes"; then - AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in]) - fi -fi - -dnl -dnl Check if LoadLibrary exists on Windows -dnl -if test "${WIN32}" = "yes"; then - AC_DEFINE(USE_LOAD_LIBRARY, 1, [Use LoadLibrary to load DLLs on Windows]) -fi - -dnl dnl check for LZO library dnl if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then @@ -898,6 +873,13 @@ test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHEC test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file]) test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support]) +if test "${enable_plugins}" = "yes"; then + test "${WIN32}" != "yes" -a -z "${DL_LIBS}" && AC_MSG_ERROR([libdl is required for plugins]) + OPTIONAL_DL_LIBS="${DL_LIBS}" + AC_DEFINE([ENABLE_PLUGIN], [1], [Enable systemd support]) + test "${enable_eurephia}" = "yes" && AC_DEFINE([ENABLE_EUREPHIA], [1], [Enable support for the eurephia plug-in]) +fi + if test "${enable_iproute2}" = "yes"; then test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) @@ -933,6 +915,8 @@ AC_SUBST([TAP_WIN_COMPONENT_ID]) AC_SUBST([TAP_WIN_MIN_MAJOR]) AC_SUBST([TAP_WIN_MIN_MINOR]) +AC_SUBST([OPTIONAL_DL_LIBS]) + AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) AC_CONFIG_FILES([ |