Port: built-in plugins support for the macOS linker
[babeltrace.git] / configure.ac
index c94b720e1e0197f7793e0dcc0acb3d181ca8e6c2..1fba17f4ccd84b21bfa0ad644572c49899c7f294 100644 (file)
@@ -159,6 +159,24 @@ AC_CHECK_HEADERS([ \
 AX_APPEND_LINK_FLAGS([-Wl,--no-as-needed], [LD_NO_AS_NEEDED])
 AC_SUBST([LD_NO_AS_NEEDED])
 
+# Check if the linker supports whole-archive
+AX_CHECK_LINK_FLAG([-Wl,--whole-archive,--no-whole-archive],
+  [
+    AC_SUBST([LD_WHOLE_ARCHIVE], [-Wl,--whole-archive,])
+    AC_SUBST([LD_NO_WHOLE_ARCHIVE], [,--no-whole-archive])
+  ],[
+    # Fallback to force_load for the macOS linker
+    AX_CHECK_LINK_FLAG([-Wl,-force_load],
+      [
+        AC_SUBST([LD_WHOLE_ARCHIVE], [-Wl,-force_load,])
+        AC_SUBST([LD_NO_WHOLE_ARCHIVE], [])
+      ],[
+        AC_MSG_WARN([Can't find a linker option to force the inclusion of the static plugin archive objects.])
+      ]
+    )
+  ]
+)
+
 # Initialize and configure libtool
 LT_INIT([win32-dll])
 
@@ -604,7 +622,7 @@ AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config
 AC_SUBST(AM_CPPFLAGS)
 
 # Add glib to global link libs
-LIBS="$GLIB_LIBS"
+LIBS="$LIBS $GLIB_LIBS"
 
 # Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name'
 # to rename babeltrace.bin to babeltrace at install time.
This page took 0.023017 seconds and 4 git commands to generate.