aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac19
-rw-r--r--src/Makefile.am2
2 files changed, 19 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 70033fd..3b5978e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,9 +55,26 @@ AC_CHECK_FUNCS([ \
strerror strndup strrchr strspn strstr \
])
+dnl Some libc's like those on bsd have dlopen() in libc, and not libdl
+AC_CHECK_LIB([dl], [dlopen],
+ [have_libdl="yes"],
+ [have_libdl="no"]
+)
+if test x"$have_libdl" = xyes ; then
+ LIBDL="-ldl"
+ AC_SUBST([LIBDL])
+ DL_LIB="dl"
+else
+ DL_LIB="c"
+ AC_CHECK_LIB([c], [dlopen],
+ [],
+ [AC_MSG_ERROR([Unable to determine library providing dlopen])]
+ )
+fi
+
dnl uClibc doesn't currently provide dlvsym() so lets
dnl verify the toolchain supports it
-AC_CHECK_LIB([dl], [dlvsym],
+AC_CHECK_LIB([$DL_LIB], [dlvsym],
[AC_DEFINE([HAVE_DLVSYM], [1], [libdl supports dlvsym])],
[AC_DEFINE([HAVE_DLVSYM], [0], [libdl does not support dlvsym])]
)
diff --git a/src/Makefile.am b/src/Makefile.am
index 6b84b96..b5c60a5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,7 @@ LOCAL_INCLUDES = $(top_srcdir)/localdecls.h
libsandbox_la_CFLAGS = -fexceptions
# Do not add -nostdlib or -nostartfiles, as then our constructor
# and destructor will not be executed ...
-libsandbox_la_LIBADD = -lc -ldl
+libsandbox_la_LIBADD = -lc $(LIBDL)
libsandbox_la_LDFLAGS = \
-nodefaultlibs \
-Wl,--version-script,libsandbox.map