]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Use static linking for libarchive by default on MacOS
authorTheodore Ts'o <tytso@mit.edu>
Sun, 15 Jun 2025 10:30:05 +0000 (06:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 15 Jun 2025 10:30:05 +0000 (06:30 -0400)
Apparently dlopen() path searching doesn't work or is unreliable on
MacOS; it appears to not search LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, or
DYLD_FALLBACK_LIBRARY_PATH as documented by the dlopen(3) man page.
Furthmore setting any of these variables to include /opt/local/lib,
which is where MacPort drops libarchive.13.dylib, can cause all manner
of warnings when running other dynamically linked programs, such as
"grep".  What a mess.  It appears dlopen(2) support in MacOS is a
disaster, and it's not really needed since we don't care about the
size of mke2fs on installation media on non-Linux systems.  So default
to using --with-libarchive=direct for MacOS.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
configure
configure.ac

index 859bc119e49f94345ea10c9b6428593886bad9ba..6518f36439c080f2763139e0b5f78e8c8aacdf5b 100755 (executable)
--- a/configure
+++ b/configure
@@ -13811,9 +13811,19 @@ printf "%s\n" "Testing for libarchive support (with dlopen)" >&6; }
 fi
 
 else $as_nop
-  try_libarchive="yes"
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Try testing for libarchive support (with dlopen) by default" >&5
+
+case "$host_os" in
+    darwin*)
+       try_libarchive="direct"
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Try testing for libarchive support (with static linking) by default" >&5
+printf "%s\n" "Try testing for libarchive support (with static linking) by default" >&6; }
+        ;;
+    *)
+        try_libarchive="yes"
+       { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Try testing for libarchive support (with dlopen) by default" >&5
 printf "%s\n" "Try testing for libarchive support (with dlopen) by default" >&6; }
+       ;;
+esac
 
 fi
 
index 694f07ebd2382e2e8bc322ec7cf2eea8a28b51c9..7c20035c0ec12eb8682ad41b78c2f24ff5c93af2 100644 (file)
@@ -1325,9 +1325,18 @@ else
        AC_MSG_RESULT([Testing for libarchive support (with dlopen)])
 fi]
 ,
-try_libarchive="yes"
-AC_MSG_RESULT([Try testing for libarchive support (with dlopen) by default])
-)
+[
+case "$host_os" in
+    darwin*)
+       try_libarchive="direct"
+       AC_MSG_RESULT([Try testing for libarchive support (with static linking) by default])
+        ;;
+    *)
+        try_libarchive="yes"
+       AC_MSG_RESULT([Try testing for libarchive support (with dlopen) by default])
+       ;;
+esac
+])
 ARCHIVE_LIBS=
 if test -n "$try_libarchive"
 then