bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] Proposition of a DJGPP specific patch.


From: Juan Manuel Guerrero
Subject: [bug-gawk] Proposition of a DJGPP specific patch.
Date: Tue, 27 Jun 2017 00:09:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7

Sadly I have read that the DJGPP port is deprecated now so I do not know
if this patch is still welcome at all but I send it anyway.  If no DJGPP
specific contribution is desired anymore please let me know.
Meanwhile DJGPP 2.05 is out thus the proposed changes are tailored for
2.05 and no longer for 2.03 as used to be.  It is not my intention to
intentionaly break 2.03 support but if I have to remove certain 2.03
features to easier implement 2.05 specific changes I have done it.

The file that need most adjustments is pc/config.sed to generate a config.h
that reflects the DJGPP 2.05 features.  A poor man putwc implementation has
been added to pc/gawkmisc.pc.  Also io.h is included to provide the required
setmode prototype.  nonposix.h will provide prototypes for btowc and putwc and
awk.h will include nonposix.h if compiled with DJGPP as it is already done if
compiled with EMX or MINGW.  The DJGPP specific section of pc/Makefile has
been adjusted to provide definitions for pkgextensiondir, infodir, mandir,
DEFLIBPATH and LOCALEDIR.  For all use of these variables $(prefix) is used to
define their path.  If prefix is not defined it will default to 
"/dev/env/DJDIR".

Of course, all proposed changes have no influence on other ports.
As usual suggestions, objections and comments are welcome.


Regards,
Juan M. Guerrero




2017-06-23  Juan Manuel Guerrero  <address@hidden>

        * pc/Makefile: Add definitions for pkgextensiondir, infodir, mandir,
        DEFLIBPATH and LOCALEDIR.  For all use $(prefix) to define their path.
        Use /dev/env/DJDIR as $(prefix) value for DJGPP.
        For DJGPP add "DXE" as definition for SHLIBEXT.
        Add LOCALEDIR to CFLAGS.

        * pc/gawkmisc.pc [__DJGPP__, __DJGPP_MINOR__]: Use unsetenv only if
        compiling with DJGPP 2.03 or less.
        [__DJGPP__]: Include io.h to provide setmode prototype.
        [__DJGPP__]: putwc implemented.

        * awk.h [__DJGPP__]: Include nonposix.h

        * nonposix.h [__DJGPP__]: Prototypes for btowc and putwc added.


2017-06-22  Juan Manuel Guerrero  <address@hidden>

        * pc/config.sed (HAVE_INTMAX_T, HAVE_INTTYPES_H, HAVE_ISASCII, 
HAVE_LOCALE_H,
        HAVE_MEMMOVE, HAVE_MEMORY_H, HAVE_SETLOCALE, HAVE_SNPRINTF, 
HAVE_STDBOOL_H,
        HAVE_STDINT_H, HAVE_STDLIB_H, HAVE_STRCASECMP, HAVE_STRCOLL, 
HAVE_STRINGS_H,
        HAVE_STRTOUL, HAVE_STRUCT_STAT_ST_BLKSIZE, HAVE_SYS_IOCTL_H, 
HAVE_SYS_PARAM_H
        HAVE_SYS_STAT_H, HAVE_TMPFILE, HAVE__BOOL and PRINTF_HAS_F_FORMAT): 
Define
        to 1 for DJGPP.
        (uintmax_t, intmax_t, restrict, uint32_t, int32_t, INT32_MAX, 
INT32_MIN):
        Defines and typdefs removed for DJGPP.






diff -aprNU5 gawk-4.1.4.orig/awk.h gawk-4.1.4/awk.h
--- gawk-4.1.4.orig/awk.h       2016-08-24 19:31:50 +0000
+++ gawk-4.1.4/awk.h    2017-06-24 00:25:44 +0000
@@ -176,11 +176,11 @@ extern char *memcpy_ulong(char *dest, co
 #if HAVE_MEMSET_ULONG
 extern void *memset_ulong(void *dest, int val, unsigned long l);
 #define memset memset_ulong
 #endif

-#if defined(__EMX__) || defined(__MINGW32__)
+#if defined(__DJGPP__) || defined(__EMX__) || defined(__MINGW32__)
 #include "nonposix.h"
 #endif /* defined(__EMX__) || defined(__MINGW32__) */

 /* use this as lintwarn("...")
    this is a hack but it gives us the right semantics */
diff -aprNU5 gawk-4.1.4.orig/nonposix.h gawk-4.1.4/nonposix.h
--- gawk-4.1.4.orig/nonposix.h  2016-06-15 18:46:34 +0000
+++ gawk-4.1.4/nonposix.h       2017-06-24 00:21:08 +0000
@@ -62,5 +62,12 @@ int getpgrp(void);
 #endif

 #if defined(__DJGPP__) || defined(__MINGW32__)
 int getppid(void);
 #endif
+
+#ifdef __DJGPP__
+/* Prototypes of for Posix functions for which we define replacements
+   in pc/ files.  */
+wint_t btowc (int c);
+wint_t putwc (wchar_t wc, FILE *stream);
+#endif
diff -aprNU5 gawk-4.1.4.orig/pc/config.sed gawk-4.1.4/pc/config.sed
--- gawk-4.1.4.orig/pc/config.sed       2016-05-30 20:10:06 +0000
+++ gawk-4.1.4/pc/config.sed    2017-06-23 23:09:56 +0000
@@ -49,23 +49,23 @@ s/^#undef HAVE_FMOD *$/#define HAVE_FMOD
 /^#undef HAVE_GETADDRINFO *$/c\
 #ifdef __MINGW32__\
 #define HAVE_GETADDRINFO 1\
 #endif
 /^#undef HAVE_INTMAX_T *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_INTMAX_T 1\
 #endif
 /^#undef HAVE_INTTYPES_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_INTTYPES_H 1\
 #endif
 /^#undef HAVE_INTTYPES_H_WITH_UINTMAX *$/c\
 #ifdef __MINGW32__\
 #define HAVE_INTTYPES_H_WITH_UINTMAX address@hidden  Proposition of a DJGPP 
specific patch.

Sadly I have read that the DJGPP port is deprecated now so I do not know
if this patch is still welcome at all but I send it anyway.  If no DJGPP
specific contribution is desired anymore please let me know.
Meanwhile DJGPP 2.05 is out thus the proposed changes are tailored for
2.05 and no longer for 2.03 as used to be.  It is not my intention to
intentionaly break 2.03 support but if I have to remove certain 2.03
features to easier implement 2.05 specific changes I have done it.

The file that need most adjustments is pc/config.sed to generate a config.h
that reflects the DJGPP 2.05 features.  A poor man putwc implementation has
been added to pc/gawkmisc.pc.  Also io.h is included to provide the required
setmode prototype.  nonposix.h will provide prototypes for btowc and putwc and
awk.h will include nonposix.h if compiled with DJGPP as it is already done if
compiled with EMX or MINGW.  The DJGPP specific section of pc/Makefile has
been adjusted to provide definitions for pkgextensiondir, infodir, mandir,
DEFLIBPATH and LOCALEDIR.  For all use of these variables $(prefix) is used to
define their path.  If prefix is not defined it will default to 
"/dev/env/DJDIR".

Of course, all proposed changes have no influence on other ports.
As usual suggestions, objections and comments are welcome.


Regards,
Juan M. Guerrero




2017-06-23  Juan Manuel Guerrero  <address@hidden>

        * pc/Makefile: Add definitions for pkgextensiondir, infodir, mandir,
        DEFLIBPATH and LOCALEDIR.  For all use $(prefix) to define their path.
        Use /dev/env/DJDIR as $(prefix) value for DJGPP.
        For DJGPP add "DXE" as definition for SHLIBEXT.
        Add LOCALEDIR to CFLAGS.

        * pc/gawkmisc.pc [__DJGPP__, __DJGPP_MINOR__]: Use unsetenv only if
        compiling with DJGPP 2.03 or less.
        [__DJGPP__]: Include io.h to provide setmode prototype.
        [__DJGPP__]: putwc implemented.

        * awk.h [__DJGPP__]: Include nonposix.h

        * nonposix.h [__DJGPP__]: Prototypes for btowc and putwc added.


2017-06-22  Juan Manuel Guerrero  <address@hidden>

        * pc/config.sed (HAVE_INTMAX_T, HAVE_INTTYPES_H, HAVE_ISASCII, 
HAVE_LOCALE_H,
        HAVE_MEMMOVE, HAVE_MEMORY_H, HAVE_SETLOCALE, HAVE_SNPRINTF, 
HAVE_STDBOOL_H,
        HAVE_STDINT_H, HAVE_STDLIB_H, HAVE_STRCASECMP, HAVE_STRCOLL, 
HAVE_STRINGS_H,
        HAVE_STRTOUL, HAVE_STRUCT_STAT_ST_BLKSIZE, HAVE_SYS_IOCTL_H, 
HAVE_SYS_PARAM_H
        HAVE_SYS_STAT_H, HAVE_TMPFILE, HAVE__BOOL and PRINTF_HAS_F_FORMAT): 
Define
        to 1 for DJGPP.
        (uintmax_t, intmax_t, restrict, uint32_t, int32_t, INT32_MAX, 
INT32_MIN):
        Defines and typdefs removed for DJGPP.






diff -aprNU5 gawk-4.1.4.orig/awk.h gawk-4.1.4/awk.h
--- gawk-4.1.4.orig/awk.h       2016-08-24 19:31:50 +0000
+++ gawk-4.1.4/awk.h    2017-06-24 00:25:44 +0000
@@ -176,11 +176,11 @@ extern char *memcpy_ulong(char *dest, co
 #if HAVE_MEMSET_ULONG
 extern void *memset_ulong(void *dest, int val, unsigned long l);
 #define memset memset_ulong
 #endif

-#if defined(__EMX__) || defined(__MINGW32__)
+#if defined(__DJGPP__) || defined(__EMX__) || defined(__MINGW32__)
 #include "nonposix.h"
 #endif /* defined(__EMX__) || defined(__MINGW32__) */

 /* use this as lintwarn("...")
    this is a hack but it gives us the right semantics */
diff -aprNU5 gawk-4.1.4.orig/nonposix.h gawk-4.1.4/nonposix.h
--- gawk-4.1.4.orig/nonposix.h  2016-06-15 18:46:34 +0000
+++ gawk-4.1.4/nonposix.h       2017-06-24 00:21:08 +0000
@@ -62,5 +62,12 @@ int getpgrp(void);
 #endif

 #if defined(__DJGPP__) || defined(__MINGW32__)
 int getppid(void);
 #endif
+
+#ifdef __DJGPP__
+/* Prototypes of for Posix functions for which we define replacements
+   in pc/ files.  */
+wint_t btowc (int c);
+wint_t putwc (wchar_t wc, FILE *stream);
+#endif
diff -aprNU5 gawk-4.1.4.orig/pc/config.sed gawk-4.1.4/pc/config.sed
--- gawk-4.1.4.orig/pc/config.sed       2016-05-30 20:10:06 +0000
+++ gawk-4.1.4/pc/config.sed    2017-06-23 23:09:56 +0000
@@ -49,23 +49,23 @@ s/^#undef HAVE_FMOD *$/#define HAVE_FMOD
 /^#undef HAVE_GETADDRINFO *$/c\
 #ifdef __MINGW32__\
 #define HAVE_GETADDRINFO 1\
 #endif
 /^#undef HAVE_INTMAX_T *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_INTMAX_T 1\
 #endif
 /^#undef HAVE_INTTYPES_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_INTTYPES_H 1\
 #endif
 /^#undef HAVE_INTTYPES_H_WITH_UINTMAX *$/c\
 #ifdef __MINGW32__\
 #define HAVE_INTTYPES_H_WITH_UINTMAX 1\
 #endif
 /^#undef HAVE_ISASCII *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_ISASCII 1\
 #endif
 /^#undef HAVE_ISWCTYPE *$/c\
 #ifdef __MINGW32__\
 #define HAVE_ISWCTYPE 1\
@@ -81,11 +81,11 @@ s/^#undef HAVE_FMOD *$/#define HAVE_FMOD
 s/^#undef HAVE_LIBM *$/#define HAVE_LIBM 1/
 /^#undef HAVE_LIBREADLINE *$/c\
 /* #undef HAVE_LIBREADLINE */
 s/^#undef HAVE_LIMITS_H *$/#define HAVE_LIMITS_H 1/
 /^#undef HAVE_LOCALE_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_LOCALE_H 1\
 #endif
 /^#undef HAVE_LONG_LONG *$/c\
 #ifdef __MINGW32__\
 #define HAVE_LONG_LONG 1\
@@ -99,13 +99,17 @@ s/^#undef HAVE_LIMITS_H *$/#define HAVE_
 #define HAVE_MBRTOWC 1\
 #endif
 s/^#undef HAVE_MEMCMP *$/#define HAVE_MEMCMP 1/
 s/^#undef HAVE_MEMCPY *$/#define HAVE_MEMCPY 1/
 /^#undef HAVE_MEMMOVE *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_MEMMOVE 1\
 #endif
+/^#undef HAVE_MEMORY_H *$/c\
+#ifdef __DJGPP__\
+#define HAVE_MEMORY_H 1\
+#endif
 s/^#undef HAVE_MEMSET *$/#define HAVE_MEMSET 1/
 /^#undef HAVE_MKSTEMP *$/c\
 #ifdef __DJGPP__\
 #define HAVE_MKSTEMP 1\
 #endif
@@ -115,15 +119,15 @@ s/^#undef HAVE_MKTIME *$/#define HAVE_MK
 /^#undef HAVE_SETENV *$/c\
 #if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SETENV 1\
 #endif
 /^#undef HAVE_SETLOCALE *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SETLOCALE 1\
 #endif
 /^#undef HAVE_SNPRINTF *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SNPRINTF 1\
 #endif
 /^#undef HAVE_SOCKADDR_STORAGE *$/c\
 #ifdef __MINGW32__\
 #define HAVE_SOCKADDR_STORAGE 1\
@@ -131,50 +135,74 @@ s/^#undef HAVE_MKTIME *$/#define HAVE_MK
 /^#undef HAVE_SOCKETS *$/c\
 #ifdef __MINGW32__\
 #define HAVE_SOCKETS 1\
 #endif
 s/^#undef HAVE_STDARG_H *$/#define HAVE_STDARG_H 1/
+/^#undef HAVE_STDBOOL_H *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STDBOOL_H 1\
+#endif
 /^#undef HAVE_STDDEF_H *$/c\
 #ifdef __GNUC__\
 #define HAVE_STDDEF_H 1\
 #endif
 /^#undef HAVE_STDINT_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_STDINT_H 1\
 #endif
 /^#undef HAVE_STDLIB_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_STDLIB_H 1\
 #endif
+/^#undef HAVE_STRCASECMP *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STRCASECMP 1\
+#endif
+/^#undef HAVE_STRCOLL *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STRCOLL 1\
+#endif
 s/^#undef HAVE_STRCHR *$/#define HAVE_STRCHR 1/
 s/^#undef HAVE_STRERROR *$/#define HAVE_STRERROR 1/
 /^#undef HAVE_STRFTIME *$/c\
 #ifdef __MINGW32__\
 /* MinGW uses the replacement from missing_d, to support the %e specifier.  */\
 #define strftime rpl_strftime\
 #else\
 #define HAVE_STRFTIME 1\
 #endif
+/^#undef HAVE_STRINGS_H *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STRINGS_H 1\
+#endif
 s/^#undef HAVE_STRINGIZE *$/#define HAVE_STRINGIZE 1/
 s/^#undef HAVE_STRING_H *$/#define HAVE_STRING_H 1/
 /^#undef HAVE_STRNCASECMP *$/c\
 #define HAVE_STRNCASECMP 1\
 #ifdef __EMX__\
 #define strncasecmp strnicmp\
 #endif
 s/^#undef HAVE_STRTOD *$/#define HAVE_STRTOD 1/
 /^#undef HAVE_STRTOUL *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_STRTOUL 1\
 #endif
+/^#undef HAVE_STRUCT_STAT_ST_BLKSIZE *$/c\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1\
+#endif
+/^#undef HAVE_SYS_IOCTL_H *$/c\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
+#define HAVE_SYS_IOCTL_H 1\
+#endif
 s/^#undef HAVE_SYSTEM *$/#define HAVE_SYSTEM 1/
 /^#undef HAVE_SYS_PARAM_H *$/c\
-#ifndef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SYS_PARAM_H 1\
 #endif
 /^#undef HAVE_SYS_STAT_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SYS_STAT_H 1\
 #endif
 /^#undef HAVE_SYS_TIME_H *$/c\
 #if defined(__DJGPP__) || defined(__MINGW32__)\
 #define HAVE_SYS_TIME_H 1\
@@ -182,10 +210,14 @@ s/^#undef HAVE_SYSTEM *$/#define HAVE_SY
 s/^#undef HAVE_SYS_TYPES_H *$/#define HAVE_SYS_TYPES_H 1/
 /^#undef HAVE_SYS_WAIT_H *$/c\
 #ifdef __DJGPP__\
 #define HAVE_SYS_WAIT_H 1\
 #endif
+/^#undef HAVE_TMPFILE *$/c\
+#ifdef __DJGPP__\
+#define HAVE_TMPFILE 1\
+#endif
 /^#undef HAVE_TOWLOWER *$/c\
 #ifdef __MINGW32__\
 #define HAVE_TOWLOWER 1\
 #endif
 /^#undef HAVE_TOWUPPER *$/c\
@@ -195,13 +227,10 @@ s/^#undef HAVE_SYS_TYPES_H *$/#define HA
 s/^#undef HAVE_TZNAME *$/#define HAVE_TZNAME 1/
 s/^#undef HAVE_TZSET *$/#define HAVE_TZSET 1/
 /^#undef HAVE_UINTMAX_T *$/c\
 #if defined(__DJGPP__) || defined(__MINGW32__)\
 #define HAVE_UINTMAX_T 1\
-#ifdef __DJGPP__\
-#define uintmax_t unsigned long long\
-#endif\
 #endif
 /^#undef HAVE_UNISTD_H *$/c\
 #if defined(__DJGPP__) || defined(__MINGW32__)\
 #define HAVE_UNISTD_H 1\
 #endif
@@ -237,10 +266,18 @@ s/^#undef HAVE_VPRINTF *$/#define HAVE_V
 #endif
 /^#undef HAVE_WINT_T *$/c\
 #ifdef __MINGW32__\
 #define HAVE_WINT_T 1\
 #endif
+/^#undef HAVE__BOOL *$/c\
+#ifdef __DJGPP__\
+#define HAVE__BOOL 1\
+#endif
+/^#undef PRINTF_HAS_F_FORMAT *$/c\
+#ifdef __DJGPP__\
+#define PRINTF_HAS_F_FORMAT 1\
+#endif
 s/^#undef PROTOTYPES *$/#define PROTOTYPES 1/
 s/^#undef RETSIGTYPE *$/#define RETSIGTYPE void/
 /^#.*RETSIGTYPE /a\
 \
 #if defined(__DJGPP__) || defined(__MINGW32__)\
@@ -260,43 +297,29 @@ s/^#undef STDC_HEADERS *$/#define STDC_H
 s/^#undef TIME_WITH_SYS_TIME *$/#define TIME_WITH_SYS_TIME 1/
 /^#undef inline *$/c\
 #ifdef __GNUC__\
 #define inline __inline__\
 #endif
-/^#undef intmax_t *$/c\
-#ifdef __DJGPP__\
-#define intmax_t long long\
-#endif
-/^#undef restrict *$/c\
-#ifdef __DJGPP__\
-#define restrict\
-#endif
-/^#undef uintmax_t *$/c\
-#ifdef __DJGPP__\
-#define uintmax_t unsigned long long\
-#endif

 s|^#undef PACKAGE_URL *$|#define PACKAGE_URL 
"http://www.gnu.org/software/gawk/";|

 $a\
+#ifdef __DJGPP__\
+/* gcc no longer includes this by default */\
+# include <sys/version.h>\
+\
 /* Library search path */\
-#if defined(__DJGPP__) && (__DJGPP__ > 2 || __DJGPP_MINOR__ >= 3)\
-# define DEFPATH  ".;/dev/env/DJDIR/share/awk"\
-#else\
-# define DEFPATH  ".;c:/lib/awk;c:/gnu/lib/awk"\
+# if (__DJGPP__ > 2 || __DJGPP_MINOR__ >= 3)\
+#  define DEFPATH  ".;/dev/env/DJDIR/share/awk"\
+# else\
+#  define DEFPATH  ".;c:/lib/awk;c:/gnu/lib/awk"\
+# endif\
 #endif\
 \
 #ifndef __DJGPP__\
 #define HAVE_POPEN_H 1\
 #endif\
 \
-#if defined(__DJGPP__)\
-typedef unsigned int uint32_t;\
-typedef int int32_t;\
-#define INT32_MAX INT_MAX\
-#define INT32_MIN INT_MIN\
-#endif\
-\
 #if defined(__EMX__)\
 #define strcasecmp stricmp\
 #define strncasecmp strnicmp\
 #endif
diff -aprNU5 gawk-4.1.4.orig/pc/gawkmisc.pc gawk-4.1.4/pc/gawkmisc.pc
--- gawk-4.1.4.orig/pc/gawkmisc.pc      2016-05-30 20:10:06 +0000
+++ gawk-4.1.4/pc/gawkmisc.pc   2017-06-23 23:34:30 +0000
@@ -299,10 +299,11 @@ os_is_setuid()

 /* os_setbinmode --- set binary mode on file */

 #ifdef __DJGPP__
 #include <sys/exceptn.h>
+#include <io.h>
 #endif
 static int orig_tty_mode = -1;

 int
 os_setbinmode(fd, mode)
@@ -916,23 +917,32 @@ init_sockets(void)

 #endif /* __DJGPP__ || __MINGW32__ */

 #ifdef __DJGPP__

+# if __DJGPP__ == 2 && __DJGPP_MINOR__ < 4
 int
 unsetenv (const char *name)
 {
   if (!name || !*name || strchr (name, '=') != NULL)
     return -1;

   return putenv (name);
 }
+#endif

 /* This is needed to defeat too-clever GCC warnings in dfa.c about
    comparison being always false due to limited range of data type.  */
 wint_t
 btowc (int c)
 {
   return c;
 }

+wint_t
+putwc(wchar_t wc, FILE *stream)
+{
+  return MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX
+         && putc((unsigned char)wc, stream) != EOF ? (wint_t)wc : WEOF;
+}
+
 #endif /* __DJGPP__ */
diff -aprNU5 gawk-4.1.4.orig/pc/Makefile gawk-4.1.4/pc/Makefile
--- gawk-4.1.4.orig/pc/Makefile 2016-05-30 20:10:06 +0000
+++ gawk-4.1.4/pc/Makefile      2017-06-23 23:09:56 +0000
@@ -79,11 +79,14 @@ MAK = $(MAKE) $(MAKEFILE)
 #prefix =
 prefix = c:/gnu
 pkgdatadir = $(prefix)/lib/awk
 pkgextensiondir = $(prefix)/lib/gawk
 DEFLIBPATH = "\"$(pkgextensiondir)\""
+LOCALEDIR="\"$(prefix)/share/locale\""
 SHLIBEXT = "\"dll\""
+infodir = $(prefix)/info
+mandir = $(prefix)/share/man
 #
 # Define the install method. Method 1 is Unix-like (and requires cat
 # and cp); method 2 uses gawk and batch files.
 install = 1
 #------------------------------------------------------------------------
@@ -98,12 +101,18 @@ DO_BIND= $($(BIND))
 #========================================================================
 #========================== DJGPP =======================================
 #========================================================================

 ifneq ($(DJGPP),)
-prefix = $(DJDIR)
+prefix = /dev/env/DJDIR
 pkgdatadir = $(prefix)/share/awk
+pkgextensiondir = $(prefix)/lib/gawk
+DEFLIBPATH = "\"$(pkgextensiondir)\""
+LOCALEDIR="\"$(prefix)/share/locale\""
+SHLIBEXT = "\"dxe\""
+infodir = $(prefix)/share/info
+mandir = $(prefix)/share/man
 endif
 LDJG = $(CC) $(LF) -o gawk.exe $(LDRSP) $(LF2)
 BDJG = stubify -g awk.exe | stubedit awk.exe runfile=gawk

 djgpp:
@@ -196,11 +205,11 @@ mingw32-readline-mpfr:
 # Define BIND for BINDless compiles, otherwise $($(BIND)) may break.
 BIND = EMPTY
 PBIND = EMPTY
 EMPTY=

-CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H -DDEFLIBPATH=$(DEFLIBPATH) 
-DSHLIBEXT=$(SHLIBEXT)
+CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H -DDEFLIBPATH=$(DEFLIBPATH) 
-DSHLIBEXT=$(SHLIBEXT) -DLOCALEDIR=$(LOCALEDIR)

 # object files
 AWKOBJS1  = array$O builtin$O eval$O field$O floatcomp$O gawkmisc$O io$O main$O
 AWKOBJS2  = ext$O msg$O node$O profile$O re$O replace$O version$O symbol$O
 AWKOBJS3  = debug$O cint_array$O int_array$O mpfr$O str_array$O command$O
@@ -286,12 +295,12 @@ install1:
        -mkdir "$(prefix)"
        -mkdir "$(prefix)/bin"
        -mkdir "$(prefix)/share"
        -mkdir "$(prefix)/share/man"
        -mkdir "$(pkgdatadir)" "$(prefix)/share/man/man1" "$(prefix)/share/info"
-       cp *awk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin
        cp gawk.exe $(prefix)/bin/awk.exe
+       cp *awk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin
        cp awklib/eg/lib/* pc/awklib/igawk.awk $(pkgdatadir)
        cp doc/*.1 $(prefix)/share/man/man1
        cp doc/*.info $(prefix)/share/info

 # install2 is equivalent to install1, but doesn't require cp, sed, etc.

 #endif
 /^#undef HAVE_ISASCII *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_ISASCII 1\
 #endif
 /^#undef HAVE_ISWCTYPE *$/c\
 #ifdef __MINGW32__\
 #define HAVE_ISWCTYPE 1\
@@ -81,11 +81,11 @@ s/^#undef HAVE_FMOD *$/#define HAVE_FMOD
 s/^#undef HAVE_LIBM *$/#define HAVE_LIBM 1/
 /^#undef HAVE_LIBREADLINE *$/c\
 /* #undef HAVE_LIBREADLINE */
 s/^#undef HAVE_LIMITS_H *$/#define HAVE_LIMITS_H 1/
 /^#undef HAVE_LOCALE_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_LOCALE_H 1\
 #endif
 /^#undef HAVE_LONG_LONG *$/c\
 #ifdef __MINGW32__\
 #define HAVE_LONG_LONG 1\
@@ -99,13 +99,17 @@ s/^#undef HAVE_LIMITS_H *$/#define HAVE_
 #define HAVE_MBRTOWC 1\
 #endif
 s/^#undef HAVE_MEMCMP *$/#define HAVE_MEMCMP 1/
 s/^#undef HAVE_MEMCPY *$/#define HAVE_MEMCPY 1/
 /^#undef HAVE_MEMMOVE *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_MEMMOVE 1\
 #endif
+/^#undef HAVE_MEMORY_H *$/c\
+#ifdef __DJGPP__\
+#define HAVE_MEMORY_H 1\
+#endif
 s/^#undef HAVE_MEMSET *$/#define HAVE_MEMSET 1/
 /^#undef HAVE_MKSTEMP *$/c\
 #ifdef __DJGPP__\
 #define HAVE_MKSTEMP 1\
 #endif
@@ -115,15 +119,15 @@ s/^#undef HAVE_MKTIME *$/#define HAVE_MK
 /^#undef HAVE_SETENV *$/c\
 #if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SETENV 1\
 #endif
 /^#undef HAVE_SETLOCALE *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SETLOCALE 1\
 #endif
 /^#undef HAVE_SNPRINTF *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SNPRINTF 1\
 #endif
 /^#undef HAVE_SOCKADDR_STORAGE *$/c\
 #ifdef __MINGW32__\
 #define HAVE_SOCKADDR_STORAGE 1\
@@ -131,50 +135,74 @@ s/^#undef HAVE_MKTIME *$/#define HAVE_MK
 /^#undef HAVE_SOCKETS *$/c\
 #ifdef __MINGW32__\
 #define HAVE_SOCKETS 1\
 #endif
 s/^#undef HAVE_STDARG_H *$/#define HAVE_STDARG_H 1/
+/^#undef HAVE_STDBOOL_H *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STDBOOL_H 1\
+#endif
 /^#undef HAVE_STDDEF_H *$/c\
 #ifdef __GNUC__\
 #define HAVE_STDDEF_H 1\
 #endif
 /^#undef HAVE_STDINT_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_STDINT_H 1\
 #endif
 /^#undef HAVE_STDLIB_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_STDLIB_H 1\
 #endif
+/^#undef HAVE_STRCASECMP *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STRCASECMP 1\
+#endif
+/^#undef HAVE_STRCOLL *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STRCOLL 1\
+#endif
 s/^#undef HAVE_STRCHR *$/#define HAVE_STRCHR 1/
 s/^#undef HAVE_STRERROR *$/#define HAVE_STRERROR 1/
 /^#undef HAVE_STRFTIME *$/c\
 #ifdef __MINGW32__\
 /* MinGW uses the replacement from missing_d, to support the %e specifier.  */\
 #define strftime rpl_strftime\
 #else\
 #define HAVE_STRFTIME 1\
 #endif
+/^#undef HAVE_STRINGS_H *$/c\
+#ifdef __DJGPP__\
+#define HAVE_STRINGS_H 1\
+#endif
 s/^#undef HAVE_STRINGIZE *$/#define HAVE_STRINGIZE 1/
 s/^#undef HAVE_STRING_H *$/#define HAVE_STRING_H 1/
 /^#undef HAVE_STRNCASECMP *$/c\
 #define HAVE_STRNCASECMP 1\
 #ifdef __EMX__\
 #define strncasecmp strnicmp\
 #endif
 s/^#undef HAVE_STRTOD *$/#define HAVE_STRTOD 1/
 /^#undef HAVE_STRTOUL *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_STRTOUL 1\
 #endif
+/^#undef HAVE_STRUCT_STAT_ST_BLKSIZE *$/c\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1\
+#endif
+/^#undef HAVE_SYS_IOCTL_H *$/c\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
+#define HAVE_SYS_IOCTL_H 1\
+#endif
 s/^#undef HAVE_SYSTEM *$/#define HAVE_SYSTEM 1/
 /^#undef HAVE_SYS_PARAM_H *$/c\
-#ifndef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SYS_PARAM_H 1\
 #endif
 /^#undef HAVE_SYS_STAT_H *$/c\
-#ifdef __MINGW32__\
+#if defined(__MINGW32__) || defined(__DJGPP__)\
 #define HAVE_SYS_STAT_H 1\
 #endif
 /^#undef HAVE_SYS_TIME_H *$/c\
 #if defined(__DJGPP__) || defined(__MINGW32__)\
 #define HAVE_SYS_TIME_H 1\
@@ -182,10 +210,14 @@ s/^#undef HAVE_SYSTEM *$/#define HAVE_SY
 s/^#undef HAVE_SYS_TYPES_H *$/#define HAVE_SYS_TYPES_H 1/
 /^#undef HAVE_SYS_WAIT_H *$/c\
 #ifdef __DJGPP__\
 #define HAVE_SYS_WAIT_H 1\
 #endif
+/^#undef HAVE_TMPFILE *$/c\
+#ifdef __DJGPP__\
+#define HAVE_TMPFILE 1\
+#endif
 /^#undef HAVE_TOWLOWER *$/c\
 #ifdef __MINGW32__\
 #define HAVE_TOWLOWER 1\
 #endif
 /^#undef HAVE_TOWUPPER *$/c\
@@ -195,13 +227,10 @@ s/^#undef HAVE_SYS_TYPES_H *$/#define HA
 s/^#undef HAVE_TZNAME *$/#define HAVE_TZNAME 1/
 s/^#undef HAVE_TZSET *$/#define HAVE_TZSET 1/
 /^#undef HAVE_UINTMAX_T *$/c\
 #if defined(__DJGPP__) || defined(__MINGW32__)\
 #define HAVE_UINTMAX_T 1\
-#ifdef __DJGPP__\
-#define uintmax_t unsigned long long\
-#endif\
 #endif
 /^#undef HAVE_UNISTD_H *$/c\
 #if defined(__DJGPP__) || defined(__MINGW32__)\
 #define HAVE_UNISTD_H 1\
 #endif
@@ -237,10 +266,18 @@ s/^#undef HAVE_VPRINTF *$/#define HAVE_V
 #endif
 /^#undef HAVE_WINT_T *$/c\
 #ifdef __MINGW32__\
 #define HAVE_WINT_T 1\
 #endif
+/^#undef HAVE__BOOL *$/c\
+#ifdef __DJGPP__\
+#define HAVE__BOOL 1\
+#endif
+/^#undef PRINTF_HAS_F_FORMAT *$/c\
+#ifdef __DJGPP__\
+#define PRINTF_HAS_F_FORMAT 1\
+#endif
 s/^#undef PROTOTYPES *$/#define PROTOTYPES 1/
 s/^#undef RETSIGTYPE *$/#define RETSIGTYPE void/
 /^#.*RETSIGTYPE /a\
 \
 #if defined(__DJGPP__) || defined(__MINGW32__)\
@@ -260,43 +297,29 @@ s/^#undef STDC_HEADERS *$/#define STDC_H
 s/^#undef TIME_WITH_SYS_TIME *$/#define TIME_WITH_SYS_TIME 1/
 /^#undef inline *$/c\
 #ifdef __GNUC__\
 #define inline __inline__\
 #endif
-/^#undef intmax_t *$/c\
-#ifdef __DJGPP__\
-#define intmax_t long long\
-#endif
-/^#undef restrict *$/c\
-#ifdef __DJGPP__\
-#define restrict\
-#endif
-/^#undef uintmax_t *$/c\
-#ifdef __DJGPP__\
-#define uintmax_t unsigned long long\
-#endif

 s|^#undef PACKAGE_URL *$|#define PACKAGE_URL 
"http://www.gnu.org/software/gawk/";|

 $a\
+#ifdef __DJGPP__\
+/* gcc no longer includes this by default */\
+# include <sys/version.h>\
+\
 /* Library search path */\
-#if defined(__DJGPP__) && (__DJGPP__ > 2 || __DJGPP_MINOR__ >= 3)\
-# define DEFPATH  ".;/dev/env/DJDIR/share/awk"\
-#else\
-# define DEFPATH  ".;c:/lib/awk;c:/gnu/lib/awk"\
+# if (__DJGPP__ > 2 || __DJGPP_MINOR__ >= 3)\
+#  define DEFPATH  ".;/dev/env/DJDIR/share/awk"\
+# else\
+#  define DEFPATH  ".;c:/lib/awk;c:/gnu/lib/awk"\
+# endif\
 #endif\
 \
 #ifndef __DJGPP__\
 #define HAVE_POPEN_H 1\
 #endif\
 \
-#if defined(__DJGPP__)\
-typedef unsigned int uint32_t;\
-typedef int int32_t;\
-#define INT32_MAX INT_MAX\
-#define INT32_MIN INT_MIN\
-#endif\
-\
 #if defined(__EMX__)\
 #define strcasecmp stricmp\
 #define strncasecmp strnicmp\
 #endif
diff -aprNU5 gawk-4.1.4.orig/pc/gawkmisc.pc gawk-4.1.4/pc/gawkmisc.pc
--- gawk-4.1.4.orig/pc/gawkmisc.pc      2016-05-30 20:10:06 +0000
+++ gawk-4.1.4/pc/gawkmisc.pc   2017-06-23 23:34:30 +0000
@@ -299,10 +299,11 @@ os_is_setuid()

 /* os_setbinmode --- set binary mode on file */

 #ifdef __DJGPP__
 #include <sys/exceptn.h>
+#include <io.h>
 #endif
 static int orig_tty_mode = -1;

 int
 os_setbinmode(fd, mode)
@@ -916,23 +917,32 @@ init_sockets(void)

 #endif /* __DJGPP__ || __MINGW32__ */

 #ifdef __DJGPP__

+# if __DJGPP__ == 2 && __DJGPP_MINOR__ < 4
 int
 unsetenv (const char *name)
 {
   if (!name || !*name || strchr (name, '=') != NULL)
     return -1;

   return putenv (name);
 }
+#endif

 /* This is needed to defeat too-clever GCC warnings in dfa.c about
    comparison being always false due to limited range of data type.  */
 wint_t
 btowc (int c)
 {
   return c;
 }

+wint_t
+putwc(wchar_t wc, FILE *stream)
+{
+  return MB_CUR_MAX == 1 && wc > 0 && wc <= UCHAR_MAX
+         && putc((unsigned char)wc, stream) != EOF ? (wint_t)wc : WEOF;
+}
+
 #endif /* __DJGPP__ */
diff -aprNU5 gawk-4.1.4.orig/pc/Makefile gawk-4.1.4/pc/Makefile
--- gawk-4.1.4.orig/pc/Makefile 2016-05-30 20:10:06 +0000
+++ gawk-4.1.4/pc/Makefile      2017-06-23 23:09:56 +0000
@@ -79,11 +79,14 @@ MAK = $(MAKE) $(MAKEFILE)
 #prefix =
 prefix = c:/gnu
 pkgdatadir = $(prefix)/lib/awk
 pkgextensiondir = $(prefix)/lib/gawk
 DEFLIBPATH = "\"$(pkgextensiondir)\""
+LOCALEDIR="\"$(prefix)/share/locale\""
 SHLIBEXT = "\"dll\""
+infodir = $(prefix)/info
+mandir = $(prefix)/share/man
 #
 # Define the install method. Method 1 is Unix-like (and requires cat
 # and cp); method 2 uses gawk and batch files.
 install = 1
 #------------------------------------------------------------------------
@@ -98,12 +101,18 @@ DO_BIND= $($(BIND))
 #========================================================================
 #========================== DJGPP =======================================
 #========================================================================

 ifneq ($(DJGPP),)
-prefix = $(DJDIR)
+prefix = /dev/env/DJDIR
 pkgdatadir = $(prefix)/share/awk
+pkgextensiondir = $(prefix)/lib/gawk
+DEFLIBPATH = "\"$(pkgextensiondir)\""
+LOCALEDIR="\"$(prefix)/share/locale\""
+SHLIBEXT = "\"dxe\""
+infodir = $(prefix)/share/info
+mandir = $(prefix)/share/man
 endif
 LDJG = $(CC) $(LF) -o gawk.exe $(LDRSP) $(LF2)
 BDJG = stubify -g awk.exe | stubedit awk.exe runfile=gawk

 djgpp:
@@ -196,11 +205,11 @@ mingw32-readline-mpfr:
 # Define BIND for BINDless compiles, otherwise $($(BIND)) may break.
 BIND = EMPTY
 PBIND = EMPTY
 EMPTY=

-CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H -DDEFLIBPATH=$(DEFLIBPATH) 
-DSHLIBEXT=$(SHLIBEXT)
+CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H -DDEFLIBPATH=$(DEFLIBPATH) 
-DSHLIBEXT=$(SHLIBEXT) -DLOCALEDIR=$(LOCALEDIR)

 # object files
 AWKOBJS1  = array$O builtin$O eval$O field$O floatcomp$O gawkmisc$O io$O main$O
 AWKOBJS2  = ext$O msg$O node$O profile$O re$O replace$O version$O symbol$O
 AWKOBJS3  = debug$O cint_array$O int_array$O mpfr$O str_array$O command$O
@@ -286,12 +295,12 @@ install1:
        -mkdir "$(prefix)"
        -mkdir "$(prefix)/bin"
        -mkdir "$(prefix)/share"
        -mkdir "$(prefix)/share/man"
        -mkdir "$(pkgdatadir)" "$(prefix)/share/man/man1" "$(prefix)/share/info"
-       cp *awk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin
        cp gawk.exe $(prefix)/bin/awk.exe
+       cp *awk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin
        cp awklib/eg/lib/* pc/awklib/igawk.awk $(pkgdatadir)
        cp doc/*.1 $(prefix)/share/man/man1
        cp doc/*.info $(prefix)/share/info

 # install2 is equivalent to install1, but doesn't require cp, sed, etc.



reply via email to

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