summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m424
1 files changed, 24 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 7bf3b2df1d..c79ad310b0 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -509,3 +509,27 @@ int main (void) {
[AC_MSG_RESULT([cross-compiling; assume yes])
AC_DEFINE([HAS_WORKING_FMA])])])
])
+
+# Computes a suitable id to insert in quoted strings to ensure that all OCaml
+# quoted strings generated by configure cannot be "escaped". The ID takes the
+# form {o*|string|o*}.
+AC_DEFUN([OCAML_QUOTED_STRING_ID], [
+ # Go through ac_subst_vars and put all the values to be substituted in
+ # $all_values.
+ QS=''
+ all_values=''
+ for name in $ac_subst_vars; do
+ eval "value=\$${name}"
+ all_values="$all_values $value"
+ done
+
+ # Keep adding 'o' to $QS until |$QS} doesn't appear in any substitution.
+ test_string=''
+ while test "x${test_string}" != "x${all_values}"; do
+ test_string="$all_values"
+ eval "test_string=\"\${test_string##*\|${QS}\}}\""
+ if test "x${test_string}" != "x${all_values}"; then
+ QS="o${QS}"
+ fi
+ done
+])