diff --git a/configure.ac b/configure.ac index 1f96263e..095d00b1 100644 --- a/configure.ac +++ b/configure.ac @@ -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" diff --git a/src/Makefile.am b/src/Makefile.am index d689527d..8d984083 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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