Allowed dlopen API to be either in libc or libdl

On Linux, the functions in the dlopen API are in libdl.  However, on
FreeBSD, libdl doesn't exist and the functions are instead in libc.

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
pull/2/head
Jean-Pierre André 2016-07-19 11:53:28 +02:00
parent 0babe3c0db
commit 54b78660d7
2 changed files with 12 additions and 2 deletions

View File

@ -543,6 +543,16 @@ AC_CHECK_FUNCS([ \
])
AC_SYS_LARGEFILE
# The dlopen API might be in libc or in libdl. Check libc first, then
# fall back to libdl.
LIBDL=""
if test "x${disable_plugins}" = "xno"; then
AC_CHECK_LIB(c, dlopen, ,
[AC_CHECK_LIB(dl, dlopen, [LIBDL="-ldl"],
[AC_MSG_ERROR(["Unable to find libdl (required for external plugin support)"])])])
fi
AC_SUBST([LIBDL])
if test "$GCC" = "yes" ; then
# We add -Wall to enable some compiler warnings.
CFLAGS="${CFLAGS} -Wall"

View File

@ -23,7 +23,7 @@ rootbin_PROGRAMS = ntfs-3g lowntfs-3g
rootsbin_DATA = #Create directory
man_MANS = ntfs-3g.8 ntfs-3g.probe.8
ntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
ntfs_3g_LDADD = $(LIBDL) $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
if REALLYSTATIC
ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
endif
@ -35,7 +35,7 @@ ntfs_3g_CFLAGS = \
$(PLUGIN_CFLAGS)
ntfs_3g_SOURCES = ntfs-3g.c ntfs-3g_common.c
lowntfs_3g_LDADD = -ldl $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
lowntfs_3g_LDADD = $(LIBDL) $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
if REALLYSTATIC
lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
endif