Re: GNU Make 4.4.0.90 on AIX 7.2

2023-01-17 Thread Bruno Haible
On AIX 7.2, in 64-bit mode, with the environment variables settings

  CC="xlc -q64 -qthreaded -qtls";
  CXX="xlC -q64 -qthreaded -qtls";
  AR="ar -X 64";
  NM="nm -X 64 -B";
  export CC CXX AR NM

(with which I build many GNU packages successfully), I get 20 test failures:

* 16 failures in category 'features/archives'.
  Error message:
/home/haible/make-4.4.0.90/build-64-xlc/tests/../make: invalid option -- X
Usage: make [options] [target] ...
Options:
...
  Apparently the value of ${AR} or the value of ${NM} is being decomposed, and
  the -X option, meant for the 'ar' or the 'nm' program, is being passed to
  'make'.

* 1 failure in category 'features/include'.
  The command 'touch -a test.foo' is being printed twice, not just once.
  This could be a bug in the AIX exec* functions, which don't properly
  separate the stdout and stderr of the parent process and child process
  in some situations. (I had seen this many years ago, in AIX 4 or AIX 5.)

* 3 failures in category 'features/output-sync'.
  Error message is "timeout after 10 seconds".

Find attached the logs.



makeerror-4.4.0.90-powerpc-ibm-aix7.2.4.0-8cot.tar.gz
Description: application/compressed-tar


Re: GNU Make 4.4.0.90 on Cygwin

2023-01-17 Thread Bruno Haible
On Cygwin 2.9.0 (running in Windows 10), I see these test failures:

* Same failures as seen in GNU/Hurd:

  - 5 failures in category 'features/jobserver'
  - 2 failures in category 'features/parallelism'
  - 1 failure in category 'features/recursion'
  - 1 failure in category 'functions/shell'

  In all these failures, where we see an error message "Leftover temporary 
files" in GNU/Hurd,
  we see "Device or resource busy" in Cygwin.

* Other failures:

  - 1 failure in category 'misc/general4'.
Maybe because after deleting PATH, no 'echo' command is found any more.

Find attached the logs.


makeerror-4.4.0.90-x86_64-pc-cygwin-26a2.tar.gz
Description: application/compressed-tar


Re: GNU Make 4.4.0.90 on AIX 7.2

2023-01-17 Thread Bruno Haible
> * 1 failure in category 'features/include'.
>   The command 'touch -a test.foo' is being printed twice, not just once.
>   This could be a bug in the AIX exec* functions, which don't properly
>   separate the stdout and stderr of the parent process and child process
>   in some situations. (I had seen this many years ago, in AIX 4 or AIX 5.)

config.h contains:
/* #undef USE_POSIX_SPAWN */

Replacing 'vfork ()' with 'fork ()' in src/job.c does not help.

Bruno






Re: [PATCH] Check .exe as well when a target does not exist on OS/2

2023-01-17 Thread KO Myung-Hun



Paul Smith wrote:
> On Tue, 2023-01-17 at 01:38 +0900, KO Myung-Hun wrote:
>> What I meant is checking the existence of a rule for a target not a
>> real file built for a target.
> 
> But how do you check for a "rule for a target"?
> 
> What if the pattern rule is "%e" not "%.exe"?  That will still match of
> course.  Or "%xe" or whatever?  Or even "%o.exe"?  Are we going to
> check to find any possible pattern rule that might match a ".exe" and
> behave differently if we find one, even if it has nothing to do with
> actually creating a .exe file?

GNU Make stops if it cannot find a target like:

make: *** No rule to make target 'foo.exe'.  Stop.

I think, it's possible to use this logic in order to find a `foo.exe'
target. And if it fails, check a `foo.exe' file in `foo' target.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v6.1.40 on Intel Core i7-3615QM 2.30GHz with 12GB RAM

Korean OS/2 User Community : http://www.os2.kr/




[PATCH] Implement ttyname() for OS/2

2023-01-17 Thread KO Myung-Hun
OS/2 kLIBC has a declaration, but has not implemented.

* Makefile.am [OS/2]: define OS2ENV.
* configure.ac [OS/2]: define os2_SRCS.
* src/os2_ttyname.c: Implement ttyname() for OS/2.
---
 Makefile.am   |  6 ++
 configure.ac  |  9 
 src/os2_ttyname.c | 53 +++
 3 files changed, 68 insertions(+)
 create mode 100644 src/os2_ttyname.c

diff --git a/Makefile.am b/Makefile.am
index 686851ff..e8570985 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,8 @@ vms_SRCS =src/vms_exit.c src/vms_export_symbol.c 
src/vms_progname.c \
 
 amiga_SRCS =   src/amiga.c src/amiga.h
 
+os2_SRCS = src/os2_ttyname.c
+
 glob_SRCS =lib/fnmatch.c lib/fnmatch.h lib/glob.c lib/glob.h
 
 alloca_SRCS =  lib/alloca.c
@@ -90,6 +92,10 @@ else
   make_SOURCES += src/posixos.c
 endif
 
+if OS2ENV
+  make_SOURCES += $(os2_SRCS)
+endif
+
 if USE_CUSTOMS
   make_SOURCES += src/remote-cstms.c
 else
diff --git a/configure.ac b/configure.ac
index f5781853..e0eca7e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,6 +449,15 @@ AS_CASE([$host],
 AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
   ])
 
+os2_target_env=no
+AM_CONDITIONAL([OS2ENV], [false])
+
+AS_CASE([$host],
+  [*-*-os2*],
+   [AM_CONDITIONAL([OS2ENV], [true])
+os2_target_env=yes
+  ])
+
 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
 [Define to the character that separates directories in PATH.])
 
diff --git a/src/os2_ttyname.c b/src/os2_ttyname.c
new file mode 100644
index ..36a79599
--- /dev/null
+++ b/src/os2_ttyname.c
@@ -0,0 +1,53 @@
+/* ttyname() implementation for OS/2
+
+Copyright (C) 2023 Free Software Foundation, Inc.
+This file is part of GNU Make.
+
+GNU Make is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3 of the License, or (at your option) any later
+version.
+
+GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program.  If not, see .  */
+
+#include "makeint.h"
+
+#define INCL_DOS
+#include 
+
+#include 
+
+/* OS/2 kLIBC has a declaration for ttyname(), but has not implemented.  */
+char *ttyname (int fd)
+{
+  ULONG type;
+  ULONG attr;
+  ULONG rc;
+
+  rc = DosQueryHType (fd, &type, &attr);
+  if (rc)
+{
+  errno = EBADF;
+  return NULL;
+}
+
+  if (type == HANDTYPE_DEVICE)
+{
+  if ((attr & 3) == 3)
+return (char *) "/dev/con";
+
+  if ((attr & 4) == 4)
+return (char *) "/dev/nul";
+
+  if ((attr & 8) == 8)
+return (char *) "/dev/clock$";
+}
+
+  errno = ENOTTY;
+  return NULL;
+}
-- 
2.30.0




Re: [PATCH] Implement ttyname() for OS/2

2023-01-17 Thread KO Myung-Hun
Hi/2.

KO Myung-Hun wrote:
> OS/2 kLIBC has a declaration, but has not implemented.
> 

...

> +  if (type == HANDTYPE_DEVICE)
> +{
> +  if ((attr & 3) == 3)
> +return (char *) "/dev/con";
> +
> +  if ((attr & 4) == 4)
> +return (char *) "/dev/nul";
> +
> +  if ((attr & 8) == 8)
> +return (char *) "/dev/clock$";
> +}

I'm sorry I've modified this.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v6.1.40 on Intel Core i7-3615QM 2.30GHz with 12GB RAM

Korean OS/2 User Community : http://www.os2.kr/

From 8d998c8f7cf1940635a61c1c50f93b8fd1b6f838 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun 
Date: Tue, 17 Jan 2023 20:47:15 +0900
Subject: [PATCH v2] Implement ttyname() for OS/2

OS/2 kLIBC has a declaration, but has not implemented.

* Makefile.am [OS/2]: define OS2ENV.
* configure.ac [OS/2]: define os2_SRCS.
* src/os2_ttyname.c: Implement ttyname() for OS/2.
---
 Makefile.am   |  6 ++
 configure.ac  |  9 
 src/os2_ttyname.c | 53 +++
 3 files changed, 68 insertions(+)
 create mode 100644 src/os2_ttyname.c

diff --git a/Makefile.am b/Makefile.am
index 686851ff..e8570985 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,6 +51,8 @@ vms_SRCS =	src/vms_exit.c src/vms_export_symbol.c src/vms_progname.c \
 
 amiga_SRCS =	src/amiga.c src/amiga.h
 
+os2_SRCS =	src/os2_ttyname.c
+
 glob_SRCS =	lib/fnmatch.c lib/fnmatch.h lib/glob.c lib/glob.h
 
 alloca_SRCS =	lib/alloca.c
@@ -90,6 +92,10 @@ else
   make_SOURCES += src/posixos.c
 endif
 
+if OS2ENV
+  make_SOURCES += $(os2_SRCS)
+endif
+
 if USE_CUSTOMS
   make_SOURCES += src/remote-cstms.c
 else
diff --git a/configure.ac b/configure.ac
index f5781853..e0eca7e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -449,6 +449,15 @@ AS_CASE([$host],
 AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
   ])
 
+os2_target_env=no
+AM_CONDITIONAL([OS2ENV], [false])
+
+AS_CASE([$host],
+  [*-*-os2*],
+   [AM_CONDITIONAL([OS2ENV], [true])
+os2_target_env=yes
+  ])
+
 AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
 [Define to the character that separates directories in PATH.])
 
diff --git a/src/os2_ttyname.c b/src/os2_ttyname.c
new file mode 100644
index ..6fde4af7
--- /dev/null
+++ b/src/os2_ttyname.c
@@ -0,0 +1,53 @@
+/* ttyname() implementation for OS/2
+
+Copyright (C) 2023 Free Software Foundation, Inc.
+This file is part of GNU Make.
+
+GNU Make is free software; you can redistribute it and/or modify it under the
+terms of the GNU General Public License as published by the Free Software
+Foundation; either version 3 of the License, or (at your option) any later
+version.
+
+GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program.  If not, see .  */
+
+#include "makeint.h"
+
+#define INCL_DOS
+#include 
+
+#include 
+
+/* OS/2 kLIBC has a declaration for ttyname(), but has not implemented.  */
+char *ttyname (int fd)
+{
+  ULONG type;
+  ULONG attr;
+  ULONG rc;
+
+  rc = DosQueryHType (fd, &type, &attr);
+  if (rc)
+{
+  errno = EBADF;
+  return NULL;
+}
+
+  if (type == HANDTYPE_DEVICE)
+{
+  if (attr & 3) /* 1 = KBD$, 2 = SCREEN$ */
+return (char *) "/dev/con";
+
+  if (attr & 4) /* 4 = NUL */
+return (char *) "/dev/nul";
+
+  if (attr & 8) /* 8 = CLOCK$ */
+return (char *) "/dev/clock$";
+}
+
+  errno = ENOTTY;
+  return NULL;
+}
-- 
2.30.0