@@ -2,6 +2,7 @@
STAGE2_CFLAGS += -fsanitize=undefined
STAGE3_CFLAGS += -fsanitize=undefined
-POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread -ldl \
+POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread \
+ $(LIBDL) \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs
@@ -340,12 +340,15 @@ CLOOGINC = @CLOOGINC@
# Set to 'yes' if the LTO front end is enabled.
enable_lto = @enable_lto@
+# Library for dlopen
+LIBDL=@libdl@
+
# Compiler and flags needed for plugin support
PLUGINCC = @CXX@
PLUGINCFLAGS = @CXXFLAGS@
# Libs and linker options needed for plugin support
-PLUGINLIBS = @pluginlibs@
+PLUGINLIBS = @pluginlibs@ $(LIBDL)
enable_plugin = @enable_plugin@
@@ -5404,14 +5404,6 @@ if test x"$enable_plugin" = x"yes"; then
AC_MSG_RESULT([unable to check])
fi
- # Check -ldl
- saved_LIBS="$LIBS"
- AC_SEARCH_LIBS([dlopen], [dl])
- if test x"$ac_cv_search_dlopen" = x"-ldl"; then
- pluginlibs="$pluginlibs -ldl"
- fi
- LIBS="$saved_LIBS"
-
# Check that we can build shared objects with -fPIC -shared
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
@@ -5454,6 +5446,16 @@ if test x"$enable_plugin" = x"yes"; then
AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin support.])
fi
+# Check -ldl
+libdl=
+saved_LIBS="$LIBS"
+AC_SEARCH_LIBS([dlopen], [dl])
+if test x"$ac_cv_search_dlopen" = x"-ldl"; then
+ libdl="-ldl"
+fi
+LIBS="$saved_LIBS"
+AC_SUBST(libdl)
+
# Enable --enable-host-shared
AC_ARG_ENABLE(host-shared,