bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #66292] msgfmt for Windows compiled in cygwin: can't locate GNU.Get


From: Michele Locati
Subject: [bug #66292] msgfmt for Windows compiled in cygwin: can't locate GNU.Gettext.dll
Date: Mon, 7 Oct 2024 02:55:33 -0400 (EDT)

Follow-up Comment #4, bug #66292 (group gettext):

I've been able to make some progress:

From bc23be9e11e4c4426e942c2ca5c6a195cce7cd5d Mon Sep 17 00:00:00 2001
From: Michele Locati <michele@locati.it>
Date: Sun, 6 Oct 2024 01:01:52 +0200
Subject: [PATCH 1/1] Let C# work when building with Cygwin

---
 build-aux/csharpexec.sh.in |  8 ++++++--
 lib/csharpexec.c           | 36 ++++++++++++++++++++++++++++++++++++
 m4/csharpexec.m4           | 17 +++++++++++++++--
 3 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/build-aux/csharpexec.sh.in b/build-aux/csharpexec.sh.in
index 2ef677c..936fc08 100644
--- a/build-aux/csharpexec.sh.in
+++ b/build-aux/csharpexec.sh.in
@@ -82,7 +82,11 @@ else
     test -z "$CSHARP_VERBOSE" || echo clix "$@"
     exec clix "$@"
   else
-    echo 'C# virtual machine not found, try installing mono, then
reconfigure' 1>&2
-    exit 1
+    if test -n "@HAVE_NATIVECSHARP@"; then
+      exec "$@"
+    else
+      echo 'C# virtual machine not found, try installing mono, then
reconfigure' 1>&2
+      exit 1
+    fi
   fi
 fi
diff --git a/lib/csharpexec.c b/lib/csharpexec.c
index 88f9441..6ce0a69 100644
--- a/lib/csharpexec.c
+++ b/lib/csharpexec.c
@@ -212,6 +212,37 @@ execute_csharp_using_sscli (const char *assembly_path,
     return -1;
 }
 
+static int
+execute_csharp_natively (const char *assembly_path,
+                           const char * const *libdirs,
+                           unsigned int libdirs_count,
+                           const char * const *args, unsigned int nargs,
+                           bool verbose, bool quiet,
+                           execute_fn *executer, void *private_data)
+{
+    const char **argv =
+      (const char **) xmalloca ((1 + nargs + 1) * sizeof (const char *));
+    unsigned int i;
+    bool err;
+
+    argv[0] = assembly_path;
+    for (i = 0; i <= nargs; i++)
+      argv[i + 1] = args[i];
+
+    if (verbose)
+      {
+        char *command = shell_quote_argv (argv);
+        printf ("%s %s\n", assembly_path, command);
+        free (command);
+      }
+
+    err = executer (assembly_path, assembly_path, argv, private_data);
+
+    freea (argv);
+
+    return err;
+}
+
 bool
 execute_csharp_program (const char *assembly_path,
                         const char * const *libdirs,
@@ -255,6 +286,11 @@ execute_csharp_program (const char *assembly_path,
   if (result >= 0)
     return (bool) result;
 
+  result = execute_csharp_natively (assembly_path, args, nargs, verbose,
+                                      quiet, executer, private_data);
+  if (result >= 0)
+    return (bool) result;
+
   if (!quiet)
     error (0, 0, _("C# virtual machine not found, try installing mono"));
   return true;
diff --git a/m4/csharpexec.m4 b/m4/csharpexec.m4
index 8191579..d45b8b3 100644
--- a/m4/csharpexec.m4
+++ b/m4/csharpexec.m4
@@ -8,7 +8,7 @@ dnl with or without modifications, as long as this notice is
preserved.
 # Prerequisites of csharpexec.sh.
 # Checks for a C# execution engine.
 # gt_CSHARPEXEC or gt_CSHARPEXEC(testexecutable, its-directory)
-# Sets at most one of HAVE_MONO, HAVE_CLIX.
+# Sets at most one of HAVE_MONO, HAVE_CLIX, HAVE_NATIVECSHARP.
 # Sets HAVE_CSHARPEXEC to nonempty if csharpexec.sh will work.
 AC_DEFUN([gt_CSHARPEXEC],
 [
@@ -29,7 +29,7 @@ AC_DEFUN([gt_CSHARPEXEC],
   popdef([AC_MSG_RESULT])dnl
   popdef([AC_CHECKING])dnl
   popdef([AC_MSG_CHECKING])dnl
-  for impl in "$CSHARP_CHOICE" mono no; do
+  for impl in "$CSHARP_CHOICE" mono microsoft no; do
     case "$impl" in
       mono)
         if test -n "$HAVE_MONO_IN_PATH" \
@@ -60,6 +60,18 @@ AC_DEFUN([gt_CSHARPEXEC],
           break
         fi
         ;;
+      microsoft)
+        case $host_os in
+          cygwin* | mingw* | windows* | pw32*)
+            if false \
+               m4_if([$1], , , [|| $2/$1 >/dev/null 2>/dev/null]); then
+              HAVE_NATIVECSHARP=1
+              ac_result="native"
+              break 2
+            fi
+            ;;
+        esac
+        ;;
       no)
         HAVE_CSHARPEXEC=
         ac_result="no"
@@ -74,4 +86,5 @@ AC_DEFUN([gt_CSHARPEXEC],
   AC_SUBST([CLIX_PATH])
   AC_SUBST([HAVE_MONO])
   AC_SUBST([HAVE_CLIX])
+  AC_SUBST([HAVE_NATIVECSHARP])
 ])
+verbatim+

This is still not perfect and not working (I still have to find a way to use
libdirs in csharpexec.c and libdirs_mono in csharpexec.sh.in), but at least
the "native" way of running .net executables and building with csc work.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66292>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]