bug-gnulib
[Top][All Lists]
Advanced

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

csharpcomp: fix for QNX 6


From: Bruno Haible
Subject: csharpcomp: fix for QNX 6
Date: Sun, 2 Sep 2007 13:16:23 +0200
User-agent: KMail/1.5.4

Hi,

It was reported at <https://savannah.gnu.org/bugs/?18337> that the csharpcomp
module mis-recognizes an unrelated program called 'mcs' as being a C#
compiler. This should fix it.

2007-09-02  Bruno Haible  <address@hidden>

        Fix mis-recognition of 'mcs' on QNX 6.
        * m4/csharpcomp.m4 (gt_CSHARPCOMP): Test whether the "mcs --version"
        output contains the string "Mono".
        * lib/csharpcomp.c (compile_csharp_using_mono): Likewise.
        Reported by <address@hidden> at <https://savannah.gnu.org/bugs/?18337>.

*** m4/csharpcomp.m4    22 Jul 2006 14:24:37 -0000      1.2
--- m4/csharpcomp.m4    2 Sep 2007 11:08:43 -0000
***************
*** 1,5 ****
! # csharpcomp.m4 serial 6 (gettext-0.15)
! dnl Copyright (C) 2003-2005 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
--- 1,5 ----
! # csharpcomp.m4 serial 7 (gettext-0.16.2)
! dnl Copyright (C) 2003-2005, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
***************
*** 43,49 ****
          ;;
        mono)
          if test -n "$HAVE_MCS_IN_PATH" \
!            && mcs --version >/dev/null 2>/dev/null; then
            HAVE_MCS=1
            ac_result="mcs"
            break
--- 43,50 ----
          ;;
        mono)
          if test -n "$HAVE_MCS_IN_PATH" \
!            && mcs --version >/dev/null 2>/dev/null \
!            && mcs --version 2>/dev/null | grep Mono >/dev/null; then
            HAVE_MCS=1
            ac_result="mcs"
            break
*** lib/csharpcomp.c    22 Aug 2007 12:54:22 -0000      1.9
--- lib/csharpcomp.c    2 Sep 2007 11:08:43 -0000
***************
*** 182,197 ****
    if (!mcs_tested)
      {
        /* Test for presence of mcs:
!        "mcs --version >/dev/null 2>/dev/null"  */
        char *argv[3];
        int exitstatus;
  
        argv[0] = "mcs";
        argv[1] = "--version";
        argv[2] = NULL;
!       exitstatus = execute ("mcs", "mcs", argv, false, false, true, true, 
true,
!                           false);
!       mcs_present = (exitstatus == 0);
        mcs_tested = true;
      }
  
--- 182,229 ----
    if (!mcs_tested)
      {
        /* Test for presence of mcs:
!        "mcs --version >/dev/null 2>/dev/null"
!        and (to exclude an unrelated 'mcs' program on QNX 6)
!        "mcs --version 2>/dev/null | grep Mono >/dev/null"  */
        char *argv[3];
+       pid_t child;
+       int fd[1];
        int exitstatus;
  
        argv[0] = "mcs";
        argv[1] = "--version";
        argv[2] = NULL;
!       child = create_pipe_in ("mcs", "mcs", argv, DEV_NULL, true, true, false,
!                             fd);
!       mcs_present = false;
!       if (child != -1)
!       {
!         /* Read the subprocess output, and test whether it contains the
!            string "Mono".  */
!         char c[4];
!         size_t count = 0;
! 
!         while (safe_read (fd[0], &c[count], 1) > 0)
!           {
!             count++;
!             if (count == 4)
!               {
!                 if (memcmp (c, "Mono", 4) == 0)
!                   mcs_present = true;
!                 c[0] = c[1]; c[1] = c[2]; c[2] = c[3];
!                 count--;
!               }
!           }
! 
!         close (fd[0]);
! 
!         /* Remove zombie process from process list, and retrieve exit
!            status.  */
!         exitstatus =
!           wait_subprocess (child, "mcs", false, true, true, false);
!         if (exitstatus != 0)
!           mcs_present = false;
!       }
        mcs_tested = true;
      }
  





reply via email to

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