Hi/2.

Paul Smith wrote:
> On Wed, 2022-11-09 at 22:45 +0900, KO Myung-Hun wrote:
>> OS/2 kLIBC has __strchrnul(). But HAVE___STRCHRNUL is undefined.
>> 'static' declarion of __strchrnul() causes an error with gcc4 because
>> OS/2 kLIBC declares __strchrnul() as public.
> 
> I assume kLIBC is a libc implementation for OS/2?
> 

Yes. kLIBC is a successor of EMX.

> I'm not sure I like this solution, mainly because fnmatch.c and glob.c
> are "inherited" from gnulib and I don't like to change them (although
> they are very far divorced from upstream at this point).
> 
> My understanding of the problem is that we are missing a
> HAVE__STRCHRNUL.  Wouldn't it make more sense to add that to the
> config.h?
> 

Ok, I've attached a new patch.

> But, I don't quite understand how the configure works on OS/2.  Can you
> clarify whether the steps in the README.OS2 document are still correct?
> Do you indeed run the configure script etc. and is there enough support
> on OS/2 for that to work?
> 
> Maybe the first thing that needs to be done is to review the contents
> of the README.OS2 and verify that it still is all valid, and if not
> submit changes to make it correct.
> 

I've updated README.OS2 in according to the latest environment.

Ah, the patches are based on 4.4 tar ball release.

-- 
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 370d6bad0131d05f97377cbbace590d2d8d90355 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Tue, 8 Nov 2022 21:16:39 +0900
Subject: [PATCH] Define a HAVE___STRCHRNUL macro properly

lib/fnmatch.c tests a HAVE___STRCHRNUL macro to implement an alternative
__strchrnul().

Without this, compilation fails on OS/2 kLIBC due to duplicated
declarations of __strchrnul() like this:

-----
gcc -DHAVE_CONFIG_H -I. -I../src   -D__ST_MT_ERRNO__  -Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef -Wno-unused-function -Wno-unused-parameter -Wno-float-conversion -Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion -Wno-type-limits -Wno-unsuffixed-float-constants -O2 -Zomf -Zmt -MT libgnu_a-fnmatch.o -MD -MP -MF .deps/libgnu_a-fnmatch.Tpo -c -o libgnu_a-fnmatch.o `test -f 'fnmatch.c' || echo './'`fnmatch.c
fnmatch.c:135:1: error: static declaration of '__strchrnul' follows non-static declaration
  135 | __strchrnul (s, c)
      | ^~~~~~~~~~~
In file included from fnmatch.c:34:
f:/lang/gcc/usr/include/string.h:198:10: note: previous declaration of '__strchrnul' was here
  198 | char    *__strchrnul(const char *, int);
      |          ^~~~~~~~~~~
-----

* configure.ac: Check __strchrnul().
---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index 9f68897..17291d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,9 @@ AC_FUNC_CLOSEDIR_VOID
 # dir.c and our glob.c use dirent.d_type if available
 AC_STRUCT_DIRENT_D_TYPE
 
+# fnmatch.c uses __strchrnul()
+AC_CHECK_FUNCS([__strchrnul])
+
 # See if the user wants to add (or not) GNU Guile support
 AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
             [Support GNU Guile for embedded scripting])])
-- 
2.30.0

From 8acca57b1b28d866f4c13bbf390b9fecb87e5c05 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <komh@chollian.net>
Date: Mon, 14 Nov 2022 13:11:11 +0900
Subject: [PATCH] Update README.OS2

* README.OS2: Apply the latest environment.
---
 README.OS2 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/README.OS2 b/README.OS2
index 82f496e..8f1105e 100644
--- a/README.OS2
+++ b/README.OS2
@@ -73,7 +73,7 @@ III. ***** COMPILATION AND INSTALLATION *****
     To recreate the configuration files use:
 
       export EMXSHELL=ksh
-      aclocal -I config
+      aclocal -I m4
       automake
       autoconf
       autoheader
@@ -93,7 +93,7 @@ Recommended environment variables and installation options:
     export CFLAGS="-O2 -Zomf -Zmt"
     export LDFLAGS="-Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000"
     export RANLIB="echo"
-    ./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man --without-included-gettext
+    ./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man
     make AR=emxomfar
     make install
 
@@ -102,6 +102,8 @@ Note: If you use gcc 2.9.x I recommend to set also LIBS="-lgcc"
 Note: You can add -DNO_CMD_DEFAULT and -DNO_CHDIR2 to CPPFLAGS.
       See section I. for details.
 
+Note: If you use a Open Watcom Linker instead of a IBM Linker, remove
+      '-Zlinker /exepack:2 -Zlinker /pm:vio' from LDFLAGS.
 
 IV. ***** NLS support *****
 
-- 
2.30.0

Reply via email to