[m-rev.] for review: add configuration option to enable internal file copying

Julien Fischer jfischer at opturion.com
Sun Jan 14 15:45:22 AEDT 2024


Add configuration option to enable internal file copying.

Add a new configuration option, --with-cp, that controls whether file
copying by the Mercury compiler is done by invoking the "cp" command or
by using the file copying predicates in the new copy_util module.

When using MSVC or when using MinGW, make using the new file copying predicates
the default. (These configurations are the most likely to be the ones where the
Mercury compiler is used from the Windows command prompt, where cp is not
available.)

configure.ac:
     Add the new option, --with-cp.

     Require the bootstrap compiler to support the --install-method configuration
     option that was added last November.

scripts/Mercury.config.in:
      Set the install method configuration option.

Julien.

diff --git a/configure.ac b/configure.ac
index c7be8f0..f908966 100644
--- a/configure.ac
+++ b/configure.ac
@@ -604,7 +604,7 @@ EOF
          $BOOTSTRAP_MC \
              --verbose \
              $link_static_opt conftest \
-            --gen-dep-ints-2023-10-15 \
+            --install-method "external" \
              --allow-ho-insts-as-modes \
              --no-ssdb \
              </dev/null >&AS_MESSAGE_LOG_FD 2>&1 &&
@@ -5174,6 +5174,45 @@ AC_SUBST(HWLOC_STATIC_LIBS)

  #-----------------------------------------------------------------------------#
  #
+# Check whether we should use "cp" for file copying by the compiler.
+#
+
+AC_ARG_WITH([cp],
+    AS_HELP_STRING([--with-cp],
+       [Use the cp command for file copying by the Mercury compiler.
+        The default is system dependent.]),
+       [with_cp="$withval"],
+       [with_cp="default"])
+
+INSTALL_METHOD=
+case "$with_cp" in
+    yes)
+        ;;
+    no)
+        INSTALL_METHOD="--install-method \"internal\""
+        ;;
+    default)
+        if test "$USING_MICROSOFT_CL_COMPILER" = "yes"
+        then
+            INSTALL_METHOD="--install-method \"internal\""
+        else
+            case "$host" in
+                *mingw*)
+                    INSTALL_METHOD="--install-method \"internal\""
+                    ;;
+            esac
+        fi
+        ;;
+    *)
+        AC_MSG_ERROR([unexpected argument to --with-cp])
+        ;;
+
+esac
+
+AC_SUBST(INSTALL_METHOD)
+
+#-----------------------------------------------------------------------------#
+#
  # Check for flex and bison.
  #

diff --git a/scripts/Mercury.config.in b/scripts/Mercury.config.in
index 004e0cd..1fcc617 100644
--- a/scripts/Mercury.config.in
+++ b/scripts/Mercury.config.in
@@ -5,7 +5,7 @@
  # @configure_input@
  #---------------------------------------------------------------------------#
  # Copyright (C) 2003-2007, 2010-2012 The University of Melbourne.
-# Copyright (C) 2013-2016, 2018-2021 The Mercury team.
+# Copyright (C) 2013-2016, 2018-2021, 2023-2024 The Mercury team.
  # This file may only be copied under the terms of the GNU General
  # Public License - see the file COPYING in the Mercury distribution.
  #---------------------------------------------------------------------------#
@@ -127,6 +127,7 @@ DEFAULT_MCFLAGS=\
  		--target-env-type "@TARGET_ENV_TYPE@" \
  		--default-opt-level "$(MERCURY_DEFAULT_OPT_LEVEL)" \
  		@RESTRICTED_COMMAND_LINE_OPT@ \
+		@INSTALL_METHOD@ \
  		@HAVE_DELAY_SLOT@ \
  		@HAVE_BOXED_FLOATS@ \
  		@HAVE_BOXED_INT64S@ \



More information about the reviews mailing list