summaryrefslogtreecommitdiff
path: root/m4/fp_prog_ar_args.m4
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-04-02 11:52:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-05 05:42:38 -0400
commit7ffbdc3fa603c6411249ba9b758cf8f109c5fb30 (patch)
tree8a05d6e03ce2790e6e59651c824e569fee088d33 /m4/fp_prog_ar_args.m4
parent6acadb79afe685c635fd255f90551a0fbfcbe3dc (diff)
downloadhaskell-7ffbdc3fa603c6411249ba9b758cf8f109c5fb30.tar.gz
Break up aclocal.m4
Diffstat (limited to 'm4/fp_prog_ar_args.m4')
-rw-r--r--m4/fp_prog_ar_args.m436
1 files changed, 36 insertions, 0 deletions
diff --git a/m4/fp_prog_ar_args.m4 b/m4/fp_prog_ar_args.m4
new file mode 100644
index 0000000000..c76a67248d
--- /dev/null
+++ b/m4/fp_prog_ar_args.m4
@@ -0,0 +1,36 @@
+# FP_PROG_AR_ARGS
+# ---------------
+# Sets fp_prog_ar_args to the arguments for ar and the output variable ArCmd
+# to an invocation of ar including these arguments.
+AC_DEFUN([FP_PROG_AR_ARGS],
+[AC_REQUIRE([FP_PROG_AR_IS_GNU])
+AC_CACHE_CHECK([for ar arguments], [fp_cv_prog_ar_args],
+[
+# GNU ar needs special treatment: it appears to have problems with
+# object files with the same name if you use the 's' modifier, but
+# simple 'ar q' works fine, and doesn't need a separate ranlib.
+if test $fp_prog_ar_is_gnu = yes; then
+ fp_cv_prog_ar_args="q"
+else
+ touch conftest.dummy
+ for fp_var in qclsZ qcls qcs qcl qc ; do
+ rm -f conftest.a
+ if "$fp_prog_ar" $fp_var conftest.a conftest.dummy > /dev/null 2> /dev/null ; then
+ # Also check that a result was created; it seems some llvm-ar versions
+ # exit with code zero even if they fail to parse the command line.
+ if test -f conftest.a ; then
+ fp_cv_prog_ar_args=$fp_var
+ break
+ fi
+ fi
+ done
+ rm -f conftest*
+ if test -z "$fp_cv_prog_ar_args"; then
+ AC_MSG_ERROR([cannot figure out how to use your $fp_prog_ar])
+ fi
+fi])
+fp_prog_ar_args=$fp_cv_prog_ar_args
+AC_SUBST([ArCmd], ["$fp_prog_ar"])
+AC_SUBST([ArArgs], ["$fp_prog_ar_args"])
+
+])# FP_PROG_AR_ARGS