diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-03-24 21:00:44 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-06 13:01:28 -0400 |
commit | 3ac80a8609418f9f1e9aa025b182fb3445f14428 (patch) | |
tree | 207223dc28b689120628585b3fa0fd3554d1ae5c /m4/fp_prog_ar_supports_dash_l.m4 | |
parent | 41fcb5cd756f52cd313d90a73f556fa5f3890818 (diff) | |
download | haskell-3ac80a8609418f9f1e9aa025b182fb3445f14428.tar.gz |
hadrian: Produce ar archives with L modifier on Windows
Since object files may in fact be archive files, we must ensure that
their contents are merged rather than constructing an
archive-of-an-archive.
See #21068.
Diffstat (limited to 'm4/fp_prog_ar_supports_dash_l.m4')
-rw-r--r-- | m4/fp_prog_ar_supports_dash_l.m4 | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/m4/fp_prog_ar_supports_dash_l.m4 b/m4/fp_prog_ar_supports_dash_l.m4 new file mode 100644 index 0000000000..3ec26db548 --- /dev/null +++ b/m4/fp_prog_ar_supports_dash_l.m4 @@ -0,0 +1,30 @@ +# FP_PROG_AR_SUPPORTS_DASH_L +# ----------------- +# Sets fp_prog_ar_supports_dash_l to yes or no, depending on whether +# or not it supports the llvm-ar's -L flag to merge archives. +AC_DEFUN([FP_PROG_AR_SUPPORTS_DASH_L], +[ + AC_REQUIRE([FP_PROG_AR]) + AC_REQUIRE([FP_PROG_AR_ARGS]) + AC_CACHE_CHECK([whether $fp_prog_ar supports -L], [fp_cv_prog_ar_supports_dash_l], + [ + rm -f conftest* + touch conftest.file + touch conftest.a0 conftest.a1 conftest.b0 conftest.b1 + dnl Build two archives, merge them, and check that the result contains the + dnl original files not the two archives. + "$fp_prog_ar" qc conftest-a.a conftest.a0 conftest.a1 + "$fp_prog_ar" qc conftest-b.a conftest.b0 conftest.b1 + "$fp_prog_ar" qcL conftest.a conftest-a.a conftest-b.a 2>/dev/null + if "$fp_prog_ar" t conftest.a | grep -s "conftest.a1" > /dev/null + then + fp_cv_prog_ar_supports_dash_l=yes + else + fp_cv_prog_ar_supports_dash_l=no + fi + rm -f conftest* + ]) + fp_prog_ar_supports_dash_l=$fp_cv_prog_ar_supports_dash_l + AC_SUBST([ArSupportsDashL], [`echo $fp_prog_ar_supports_dash_l | tr 'a-z' 'A-Z'`]) +])# FP_PROG_AR_SUPPORTS_DASH_L + |