diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-08-02 21:41:40 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-08-02 21:41:40 +0300 |
commit | edc2856a2ae2dc46037f85652440bd329b1a2c8a (patch) | |
tree | c7dc2821a1cea7d65cf8b6ed48d3494e98b98d09 | |
parent | 4b00462246822209b642a4dd63491e59a4fab759 (diff) | |
download | egawk-edc2856a2ae2dc46037f85652440bd329b1a2c8a.tar.gz egawk-edc2856a2ae2dc46037f85652440bd329b1a2c8a.tar.bz2 egawk-edc2856a2ae2dc46037f85652440bd329b1a2c8a.zip |
Rework zOS patches; keep separate from autotools.
-rw-r--r-- | Makefile.am | 5 | ||||
-rw-r--r-- | Makefile.in | 12 | ||||
-rw-r--r-- | awk.h | 34 | ||||
-rw-r--r-- | awkgram.c | 43 | ||||
-rw-r--r-- | awkgram.y | 43 | ||||
-rw-r--r-- | awklib/Makefile.am | 20 | ||||
-rw-r--r-- | awklib/Makefile.in | 28 | ||||
-rw-r--r-- | awklib/eg/lib/grcat.c | 6 | ||||
-rw-r--r-- | awklib/eg/lib/pwcat.c | 10 | ||||
-rw-r--r-- | command.c | 37 | ||||
-rw-r--r-- | command.y | 37 | ||||
-rw-r--r-- | configh.in | 15 | ||||
-rwxr-xr-x | configure | 113 | ||||
-rw-r--r-- | configure.ac | 29 | ||||
-rw-r--r-- | custom.h | 12 | ||||
-rw-r--r-- | doc/Makefile.am | 2 | ||||
-rw-r--r-- | doc/Makefile.in | 10 | ||||
-rw-r--r-- | doc/gawk.texi | 16 | ||||
-rw-r--r-- | doc/gawktexi.in | 16 | ||||
-rw-r--r-- | eval.c | 4 | ||||
-rw-r--r-- | extension/Makefile.am | 2 | ||||
-rw-r--r-- | extension/Makefile.in | 11 | ||||
-rw-r--r-- | extension/aclocal.m4 | 1 | ||||
-rwxr-xr-x | extension/configure | 30 | ||||
-rw-r--r-- | extension/configure.ac | 1 | ||||
-rw-r--r-- | extension/gawkfts.h | 8 | ||||
-rw-r--r-- | extension/readdir.c | 12 | ||||
-rw-r--r-- | extension/rwarray.c | 11 | ||||
-rw-r--r-- | helpers/testdfa.c | 2 | ||||
-rw-r--r-- | io.c | 4 | ||||
-rw-r--r-- | m4/arch.m4 | 26 | ||||
-rw-r--r-- | test/Makefile.am | 6 | ||||
-rw-r--r-- | test/Makefile.in | 26 |
33 files changed, 454 insertions, 178 deletions
diff --git a/Makefile.am b/Makefile.am index c646fc34..342df292 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,9 +68,12 @@ SUBDIRS = \ doc \ awklib \ po \ - extension \ test +if ENABLE_EXTENSIONS +SUBDIRS += extension +endif + # what to make and install bin_PROGRAMS = gawk include_HEADERS = gawkapi.h diff --git a/Makefile.in b/Makefile.in index 183d71cd..08f434c1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -111,6 +111,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@ENABLE_EXTENSIONS_TRUE@am__append_1 = extension bin_PROGRAMS = gawk$(EXEEXT) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -261,7 +262,7 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags CSCOPE = cscope -DIST_SUBDIRS = $(SUBDIRS) +DIST_SUBDIRS = . doc awklib po test extension am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/configh.in ABOUT-NLS \ AUTHORS COPYING ChangeLog INSTALL NEWS README awkgram.c \ command.c compile config.guess config.rpath config.sub depcomp \ @@ -480,14 +481,7 @@ EXTRA_DIST = \ # that `make check' without a prior `make' works. # Build in awklib after in doc, since we want to extract # sample files if doc/gawk.texi changed. -SUBDIRS = \ - . \ - doc \ - awklib \ - po \ - extension \ - test - +SUBDIRS = . doc awklib po test $(am__append_1) include_HEADERS = gawkapi.h # sources for both gawk and dgawk @@ -108,24 +108,12 @@ extern int errno; #undef CHARBITS #undef INTBITS -#if !defined(ZOS_USS) #if HAVE_INTTYPES_H # include <inttypes.h> #endif #if HAVE_STDINT_H # include <stdint.h> #endif -#else /* ZOS_USS */ -#include <limits.h> -#include <sys/time.h> -#define INT32_MAX INT_MAX -#define INT32_MIN INT_MIN -#ifndef __uint32_t -#define __uint32_t 1 -typedef unsigned long uint32_t; -#endif -typedef long int32_t; -#endif /* !ZOS_USS */ /* ----------------- System dependencies (with more includes) -----------*/ @@ -159,11 +147,14 @@ typedef int off_t; #ifdef NEED_MEMORY_H #include <memory.h> #endif /* NEED_MEMORY_H */ -#else /* not HAVE_STRING_H */ +#endif /* HAVE_STRING_H */ #ifdef HAVE_STRINGS_H #include <strings.h> #endif /* HAVE_STRINGS_H */ -#endif /* not HAVE_STRING_H */ + +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif /* HAVE_SYS_SELECT_H */ #if HAVE_UNISTD_H #include <unistd.h> @@ -1633,6 +1624,11 @@ extern uintmax_t adjust_uint(uintmax_t n); #endif /* ! defined(VMS)) */ #endif /* WEXITSTATUS */ +/* For z/OS, from Dave Pitts. EXIT_FAILURE is normally 8, make it 1. */ +#if defined(EXIT_FAILURE) && EXIT_FAILURE == 8 +# undef EXIT_FAILURE +#endif + /* EXIT_SUCCESS and EXIT_FAILURE normally come from <stdlib.h> */ #ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -1645,16 +1641,6 @@ extern uintmax_t adjust_uint(uintmax_t n); # define EXIT_FATAL 2 #endif -/* For z/OS, from Dave Pitts. EXIT_FAILURE is normally 8, make it 1. */ -#ifdef ZOS_USS - -#ifdef EXIT_FAILURE -#undef EXIT_FAILURE -#endif - -#define EXIT_FAILURE 1 -#endif - /* ------------------ Inline Functions ------------------ */ /* @@ -4162,7 +4162,7 @@ struct token { NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ }; -#if 'a' == 0x81 /* it's EBCDIC */ +#ifdef USE_EBCDIC /* tokcompare --- lexicographically compare token names for sorting */ static int @@ -5312,7 +5312,11 @@ static int newline_eof() /* yylex --- Read the input and turn it into tokens. */ static int +#ifdef USE_EBCDIC +yylex_ebcdic(void) +#else yylex(void) +#endif { int c; bool seen_e = false; /* These are for numbers */ @@ -6138,6 +6142,41 @@ out: #undef NEWLINE_EOF } +/* It's EBCDIC in a Bison grammar, run for the hills! + + Or, convert single-character tokens coming out of yylex() from EBCDIC to + ASCII values on-the-fly so that the parse tables need not be regenerated + for EBCDIC systems. */ +#ifdef USE_EBCDIC +static int +yylex(void) +{ + static char etoa_xlate[256]; + static int do_etoa_init = 1; + int tok; + + if (do_etoa_init) + { + for (tok = 0; tok < 256; tok++) + etoa_xlate[tok] = (char) tok; +#ifdef HAVE___ETOA_L + /* IBM helpfully provides this function. */ + __etoa_l(etoa_xlate, sizeof(etoa_xlate)); +#else +# error "An EBCDIC-to-ASCII translation function is needed for this system" +#endif + do_etoa_init = 0; + } + + tok = yylex_ebcdic(); + + if (tok >= 0 && tok <= 0xFF) + tok = etoa_xlate[tok]; + + return tok; +} +#endif /* USE_EBCDIC */ + /* snode --- instructions for builtin functions. Checks for arg. count and supplies defaults where possible. */ @@ -7895,7 +7934,7 @@ check_special(const char *name) int low, high, mid; int i; int non_standard_flags = 0; -#if 'a' == 0x81 /* it's EBCDIC */ +#ifdef USE_EBCDIC static bool did_sort = false; if (! did_sort) { @@ -1823,7 +1823,7 @@ struct token { NODE *(*ptr2)(int); /* alternate arbitrary-precision function */ }; -#if 'a' == 0x81 /* it's EBCDIC */ +#ifdef USE_EBCDIC /* tokcompare --- lexicographically compare token names for sorting */ static int @@ -2973,7 +2973,11 @@ static int newline_eof() /* yylex --- Read the input and turn it into tokens. */ static int +#ifdef USE_EBCDIC +yylex_ebcdic(void) +#else yylex(void) +#endif { int c; bool seen_e = false; /* These are for numbers */ @@ -3799,6 +3803,41 @@ out: #undef NEWLINE_EOF } +/* It's EBCDIC in a Bison grammar, run for the hills! + + Or, convert single-character tokens coming out of yylex() from EBCDIC to + ASCII values on-the-fly so that the parse tables need not be regenerated + for EBCDIC systems. */ +#ifdef USE_EBCDIC +static int +yylex(void) +{ + static char etoa_xlate[256]; + static int do_etoa_init = 1; + int tok; + + if (do_etoa_init) + { + for (tok = 0; tok < 256; tok++) + etoa_xlate[tok] = (char) tok; +#ifdef HAVE___ETOA_L + /* IBM helpfully provides this function. */ + __etoa_l(etoa_xlate, sizeof(etoa_xlate)); +#else +# error "An EBCDIC-to-ASCII translation function is needed for this system" +#endif + do_etoa_init = 0; + } + + tok = yylex_ebcdic(); + + if (tok >= 0 && tok <= 0xFF) + tok = etoa_xlate[tok]; + + return tok; +} +#endif /* USE_EBCDIC */ + /* snode --- instructions for builtin functions. Checks for arg. count and supplies defaults where possible. */ @@ -5556,7 +5595,7 @@ check_special(const char *name) int low, high, mid; int i; int non_standard_flags = 0; -#if 'a' == 0x81 /* it's EBCDIC */ +#ifdef USE_EBCDIC static bool did_sort = false; if (! did_sort) { diff --git a/awklib/Makefile.am b/awklib/Makefile.am index 2e1adaf1..73f91f05 100644 --- a/awklib/Makefile.am +++ b/awklib/Makefile.am @@ -45,6 +45,8 @@ AUXAWK = passwd.awk group.awk nodist_grcat_SOURCES = grcat.c nodist_pwcat_SOURCES = pwcat.c +CLEANFILES = $(nodist_grcat_SOURCES) $(nodist_pwcat_SOURCES) + all: $(srcdir)/stamp-eg $(AUXPROGS) igawk $(AUXAWK) install-exec-hook: $(AUXAWK) @@ -64,22 +66,24 @@ clean-local: rm -fr eg.old rm -fr grcat.dSYM pwcat.dSYM -$(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi +$(srcdir)/stamp-eg: $(srcdir)/../doc/gawktexi.in $(srcdir)/../doc/gawkinet.texi cd $(srcdir) && \ rm -fr eg && \ rm -fr stamp-eg && \ - $(AWKPROG) -f ./extract.awk ../doc/gawk.texi ../doc/gawkinet.texi + $(AWKPROG) -f ./extract.awk ../doc/gawktexi.in ../doc/gawkinet.texi @echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg @echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg -$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \ -$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @: +pwcat.c: $(srcdir)/eg/lib/pwcat.c + rm -f $@ + $(LN_S) $(srcdir)/eg/lib/pwcat.c . -pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c - $(COMPILE) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@ +grcat.c: $(srcdir)/eg/lib/grcat.c + rm -f $@ + $(LN_S) $(srcdir)/eg/lib/grcat.c . -grcat$(EXEEXT): $(srcdir)/eg/lib/grcat.c - $(COMPILE) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@ +$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \ +$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @: igawk: $(srcdir)/eg/prog/igawk.sh cp $(srcdir)/eg/prog/igawk.sh $@ ; chmod 755 $@ diff --git a/awklib/Makefile.in b/awklib/Makefile.in index 610b6ee1..b96dbe1b 100644 --- a/awklib/Makefile.in +++ b/awklib/Makefile.in @@ -365,6 +365,7 @@ bin_SCRIPTS = igawk AUXAWK = passwd.awk group.awk nodist_grcat_SOURCES = grcat.c nodist_pwcat_SOURCES = pwcat.c +CLEANFILES = $(nodist_grcat_SOURCES) $(nodist_pwcat_SOURCES) all: all-am .SUFFIXES: @@ -440,6 +441,14 @@ uninstall-pkglibexecPROGRAMS: clean-pkglibexecPROGRAMS: -test -z "$(pkglibexec_PROGRAMS)" || rm -f $(pkglibexec_PROGRAMS) + +grcat$(EXEEXT): $(grcat_OBJECTS) $(grcat_DEPENDENCIES) $(EXTRA_grcat_DEPENDENCIES) + @rm -f grcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(grcat_OBJECTS) $(grcat_LDADD) $(LIBS) + +pwcat$(EXEEXT): $(pwcat_OBJECTS) $(pwcat_DEPENDENCIES) $(EXTRA_pwcat_DEPENDENCIES) + @rm -f pwcat$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pwcat_OBJECTS) $(pwcat_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ @@ -610,6 +619,7 @@ install-strip: mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -730,22 +740,24 @@ clean-local: rm -fr eg.old rm -fr grcat.dSYM pwcat.dSYM -$(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi +$(srcdir)/stamp-eg: $(srcdir)/../doc/gawktexi.in $(srcdir)/../doc/gawkinet.texi cd $(srcdir) && \ rm -fr eg && \ rm -fr stamp-eg && \ - $(AWKPROG) -f ./extract.awk ../doc/gawk.texi ../doc/gawkinet.texi + $(AWKPROG) -f ./extract.awk ../doc/gawktexi.in ../doc/gawkinet.texi @echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg @echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg -$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \ -$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @: +pwcat.c: $(srcdir)/eg/lib/pwcat.c + rm -f $@ + $(LN_S) $(srcdir)/eg/lib/pwcat.c . -pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c - $(COMPILE) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@ +grcat.c: $(srcdir)/eg/lib/grcat.c + rm -f $@ + $(LN_S) $(srcdir)/eg/lib/grcat.c . -grcat$(EXEEXT): $(srcdir)/eg/lib/grcat.c - $(COMPILE) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@ +$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \ +$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @: igawk: $(srcdir)/eg/prog/igawk.sh cp $(srcdir)/eg/prog/igawk.sh $@ ; chmod 755 $@ diff --git a/awklib/eg/lib/grcat.c b/awklib/eg/lib/grcat.c index 7d6b6a74..cf39083c 100644 --- a/awklib/eg/lib/grcat.c +++ b/awklib/eg/lib/grcat.c @@ -31,11 +31,11 @@ main(int argc, char **argv) int i; while ((g = getgrent()) != NULL) { -#ifdef ZOS_USS - printf("%s:%ld:", g->gr_name, (long) g->gr_gid); -#else +#ifdef HAVE_STRUCT_GROUP_GR_PASSWD printf("%s:%s:%ld:", g->gr_name, g->gr_passwd, (long) g->gr_gid); +#else + printf("%s:*:%ld:", g->gr_name, (long) g->gr_gid); #endif for (i = 0; g->gr_mem[i] != NULL; i++) { printf("%s", g->gr_mem[i]); diff --git a/awklib/eg/lib/pwcat.c b/awklib/eg/lib/pwcat.c index 934ef34e..cfe250c3 100644 --- a/awklib/eg/lib/pwcat.c +++ b/awklib/eg/lib/pwcat.c @@ -26,14 +26,14 @@ main(int argc, char **argv) struct passwd *p; while ((p = getpwent()) != NULL) -#ifdef ZOS_USS - printf("%s:%ld:%ld:%s:%s\n", - p->pw_name, (long) p->pw_uid, - (long) p->pw_gid, p->pw_dir, p->pw_shell); -#else +#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD printf("%s:%s:%ld:%ld:%s:%s:%s\n", p->pw_name, p->pw_passwd, (long) p->pw_uid, (long) p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell); +#else + printf("%s:*:%ld:%ld:%s:%s\n", + p->pw_name, (long) p->pw_uid, + (long) p->pw_gid, p->pw_dir, p->pw_shell); #endif endpwent(); @@ -2773,7 +2773,11 @@ yyerror(const char *mesg, ...) /* yylex --- read a command and turn it into tokens */ static int +#ifdef USE_EBCDIC +yylex_ebcdic(void) +#else yylex(void) +#endif { static char *lexptr = NULL; static char *lexend; @@ -3049,6 +3053,39 @@ err: return D_VARIABLE; } +/* Convert single-character tokens coming out of yylex() from EBCDIC to + ASCII values on-the-fly so that the parse tables need not be regenerated + for EBCDIC systems. */ +#ifdef USE_EBCDIC +static int +yylex(void) +{ + static char etoa_xlate[256]; + static int do_etoa_init = 1; + int tok; + + if (do_etoa_init) + { + for (tok = 0; tok < 256; tok++) + etoa_xlate[tok] = (char) tok; +#ifdef HAVE___ETOA_L + /* IBM helpfully provides this function. */ + __etoa_l(etoa_xlate, sizeof(etoa_xlate)); +#else +# error "An EBCDIC-to-ASCII translation function is needed for this system" +#endif + do_etoa_init = 0; + } + + tok = yylex_ebcdic(); + + if (tok >= 0 && tok <= 0xFF) + tok = etoa_xlate[tok]; + + return tok; +} +#endif /* USE_EBCDIC */ + /* find_argument --- find index in 'argtab' for a command option */ static int @@ -1022,7 +1022,11 @@ yyerror(const char *mesg, ...) /* yylex --- read a command and turn it into tokens */ static int +#ifdef USE_EBCDIC +yylex_ebcdic(void) +#else yylex(void) +#endif { static char *lexptr = NULL; static char *lexend; @@ -1298,6 +1302,39 @@ err: return D_VARIABLE; } +/* Convert single-character tokens coming out of yylex() from EBCDIC to + ASCII values on-the-fly so that the parse tables need not be regenerated + for EBCDIC systems. */ +#ifdef USE_EBCDIC +static int +yylex(void) +{ + static char etoa_xlate[256]; + static int do_etoa_init = 1; + int tok; + + if (do_etoa_init) + { + for (tok = 0; tok < 256; tok++) + etoa_xlate[tok] = (char) tok; +#ifdef HAVE___ETOA_L + /* IBM helpfully provides this function. */ + __etoa_l(etoa_xlate, sizeof(etoa_xlate)); +#else +# error "An EBCDIC-to-ASCII translation function is needed for this system" +#endif + do_etoa_init = 0; + } + + tok = yylex_ebcdic(); + + if (tok >= 0 && tok <= 0xFF) + tok = etoa_xlate[tok]; + + return tok; +} +#endif /* USE_EBCDIC */ + /* find_argument --- find index in 'argtab' for a command option */ static int @@ -228,6 +228,12 @@ /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL +/* Define to 1 if `gr_passwd' is a member of `struct group'. */ +#undef HAVE_STRUCT_GROUP_GR_PASSWD + +/* Define to 1 if `pw_passwd' is a member of `struct passwd'. */ +#undef HAVE_STRUCT_PASSWD_PW_PASSWD + /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE @@ -243,6 +249,9 @@ /* Define to 1 if you have the <sys/param.h> header file. */ #undef HAVE_SYS_PARAM_H +/* Define to 1 if you have the <sys/select.h> header file. */ +#undef HAVE_SYS_SELECT_H + /* Define to 1 if you have the <sys/socket.h> header file. */ #undef HAVE_SYS_SOCKET_H @@ -317,6 +326,9 @@ /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL +/* Define to 1 if you have the `__etoa_l' function. */ +#undef HAVE___ETOA_L + /* enable severe portability problems */ #undef I_DONT_KNOW_WHAT_IM_DOING @@ -371,6 +383,9 @@ /* Define to 1 if your <sys/time.h> declares `struct tm'. */ #undef TM_IN_SYS_TIME +/* Define to 1 if the character set is EBCDIC */ +#undef USE_EBCDIC + /* force use of our version of strftime */ #undef USE_INCLUDED_STRFTIME @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for GNU Awk 4.1.3. +# Generated by GNU Autoconf 2.69 for GNU Awk 4.1.3-zOS-2. # # Report bugs to <bug-gawk@gnu.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='GNU Awk' PACKAGE_TARNAME='gawk' -PACKAGE_VERSION='4.1.3' -PACKAGE_STRING='GNU Awk 4.1.3' +PACKAGE_VERSION='4.1.3-zOS-2' +PACKAGE_STRING='GNU Awk 4.1.3-zOS-2' PACKAGE_BUGREPORT='bug-gawk@gnu.org' PACKAGE_URL='http://www.gnu.org/software/gawk/' @@ -633,6 +633,8 @@ GAWKLIBEXT LIBMPFR LIBREADLINE SOCKET_LIBS +ENABLE_EXTENSIONS_FALSE +ENABLE_EXTENSIONS_TRUE LIBSIGSEGV_PREFIX LTLIBSIGSEGV LIBSIGSEGV @@ -1326,7 +1328,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNU Awk 4.1.3 to adapt to many kinds of systems. +\`configure' configures GNU Awk 4.1.3-zOS-2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1396,7 +1398,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU Awk 4.1.3:";; + short | recursive ) echo "Configuration of GNU Awk 4.1.3-zOS-2:";; esac cat <<\_ACEOF @@ -1515,7 +1517,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU Awk configure 4.1.3 +GNU Awk configure 4.1.3-zOS-2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2224,7 +2226,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNU Awk $as_me 4.1.3, which was +It was created by GNU Awk $as_me 4.1.3-zOS-2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3107,7 +3109,7 @@ fi # Define the identity of the package. PACKAGE='gawk' - VERSION='4.1.3' + VERSION='4.1.3-zOS-2' cat >>confdefs.h <<_ACEOF @@ -5863,15 +5865,30 @@ pkgextensiondir='${pkglibdir}' { $as_echo "$as_me:${as_lineno-$LINENO}: checking for z/OS USS compilation" >&5 $as_echo_n "checking for z/OS USS compilation... " >&6; } +if ${ac_cv_zos_uss+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "OS/390" = "`uname`" then - CFLAGS="$CFLAGS -D_ALL_SOURCE -DZOS_USS -DUSE_EBCDIC" - # Must rebuild awkgram.c and command.c from Bison for EBCDIC - rm -f awkgram.c command.c + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=600" + if test "x$GCC" != "xyes" + then + if echo " $CC " | $EGREP ' (/bin/)?(cc|c89) ' >/dev/null + then + as_fn_error $? "invalid-cc +GNU Awk does not support the \"cc\" nor \"c89\" compiler frontends on z/OS. +Please set CC to \"c99\" or one of the \"xlc\" frontends." "$LINENO" 5 + fi + : CFLAGS="$CFLAGS -qlanglvl=stdc99:libext" + : CPPFLAGS="$CPPFLAGS -qhaltonmsg=CCN3296" + fi ac_cv_zos_uss=yes else ac_cv_zos_uss=no fi + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_zos_uss}" >&5 $as_echo "${ac_cv_zos_uss}" >&6; } @@ -6164,6 +6181,28 @@ fi $as_echo "${gawk_cv_linux_alpha_hack}" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we are using EBCDIC" >&5 +$as_echo_n "checking if we are using EBCDIC... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if 'a' == 0x81 +gnu_gawk_in_ebcdic +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gnu_gawk_in_ebcdic" >/dev/null 2>&1; then : + +$as_echo "#define USE_EBCDIC 1" >>confdefs.h + + use_ebcdic=yes +else + use_ebcdic=no +fi +rm -f conftest* + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_ebcdic" >&5 +$as_echo "$use_ebcdic" >&6; } + if test "$ISC" = 1 # will be set by test for ISC then CFLAGS="$CFLAGS -D_SYSV3" @@ -8396,7 +8435,7 @@ $as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h for ac_header in arpa/inet.h fcntl.h limits.h locale.h libintl.h mcheck.h \ netdb.h netinet/in.h stdarg.h stddef.h string.h \ - sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h \ + sys/ioctl.h sys/param.h sys/select.h sys/socket.h sys/time.h unistd.h \ termios.h stropts.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -10335,7 +10374,7 @@ $as_echo "$LIBSIGSEGV" >&6; } esac # Need the check for mkstemp and tmpfile for missing_d/snprintf.c. -for ac_func in atexit btowc fmod getgrent getgroups grantpt \ +for ac_func in __etoa_l atexit btowc fmod getgrent getgroups grantpt \ isascii iswctype iswlower iswupper mbrlen \ memcmp memcpy memcpy_ulong memmove memset \ memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \ @@ -10401,10 +10440,6 @@ if test "x$enable_extensions" != "xno"; then case $host_os in mirbsd* | openedition*) # OS/390 z/OS POSIX layer - cat << \EOF > extension/Makefile -all dist check clean distclean install uninstall distcheck: - @exit 0 -EOF ;; *) ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" @@ -10499,6 +10534,14 @@ fi as_fn_error $? "extension support requested, but unavailable" "$LINENO" 5 fi enable_extensions=$extensions_supported + if test "x$enable_extensions" = "xyes"; then + ENABLE_EXTENSIONS_TRUE= + ENABLE_EXTENSIONS_FALSE='#' +else + ENABLE_EXTENSIONS_TRUE='#' + ENABLE_EXTENSIONS_FALSE= +fi + fi case $host_os in @@ -11019,6 +11062,34 @@ _ACEOF fi +ac_fn_c_check_member "$LINENO" "struct passwd" "pw_passwd" "ac_cv_member_struct_passwd_pw_passwd" " +#include <sys/types.h> +#include <pwd.h> + +" +if test "x$ac_cv_member_struct_passwd_pw_passwd" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_PASSWD_PW_PASSWD 1 +_ACEOF + + +fi + +ac_fn_c_check_member "$LINENO" "struct group" "gr_passwd" "ac_cv_member_struct_group_gr_passwd" " +#include <sys/types.h> +#include <grp.h> + +" +if test "x$ac_cv_member_struct_group_gr_passwd" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_GROUP_GR_PASSWD 1 +_ACEOF + + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : @@ -11512,6 +11583,10 @@ if test -z "${TEST_CROSS_COMPILE_TRUE}" && test -z "${TEST_CROSS_COMPILE_FALSE}" as_fn_error $? "conditional \"TEST_CROSS_COMPILE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_EXTENSIONS_TRUE}" && test -z "${ENABLE_EXTENSIONS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_EXTENSIONS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -11909,7 +11984,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GNU Awk $as_me 4.1.3, which was +This file was extended by GNU Awk $as_me 4.1.3-zOS-2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11977,7 +12052,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -GNU Awk config.status 4.1.3 +GNU Awk config.status 4.1.3-zOS-2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 72f78f03..42af5deb 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ dnl dnl Process this file with autoconf to produce a configure script. -AC_INIT([GNU Awk], 4.1.3, bug-gawk@gnu.org, gawk) +AC_INIT([GNU Awk], 4.1.3-zOS-2, bug-gawk@gnu.org, gawk) # This is a hack. Different versions of install on different systems # are just too different. Chuck it and use install-sh. @@ -115,6 +115,16 @@ AC_SYS_LARGEFILE GAWK_AC_AIX_TWEAK GAWK_AC_LINUX_ALPHA +AC_MSG_CHECKING([if we are using EBCDIC]) +AC_EGREP_CPP([gnu_gawk_in_ebcdic], +[#if 'a' == 0x81 +gnu_gawk_in_ebcdic +#endif], +[AC_DEFINE(USE_EBCDIC, 1, Define to 1 if the character set is EBCDIC) + use_ebcdic=yes], +[use_ebcdic=no]) +AC_MSG_RESULT([$use_ebcdic]) + if test "$ISC" = 1 # will be set by test for ISC then dnl need -D_SYSV3 for ISC @@ -141,7 +151,7 @@ gt_LC_MESSAGES dnl checks for header files AC_CHECK_HEADERS(arpa/inet.h fcntl.h limits.h locale.h libintl.h mcheck.h \ netdb.h netinet/in.h stdarg.h stddef.h string.h \ - sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h \ + sys/ioctl.h sys/param.h sys/select.h sys/socket.h sys/time.h unistd.h \ termios.h stropts.h wchar.h wctype.h) AC_HEADER_STDC AC_HEADER_STDBOOL @@ -273,7 +283,7 @@ osf1) : ;; esac # Need the check for mkstemp and tmpfile for missing_d/snprintf.c. -AC_CHECK_FUNCS(atexit btowc fmod getgrent getgroups grantpt \ +AC_CHECK_FUNCS(__etoa_l atexit btowc fmod getgrent getgroups grantpt \ isascii iswctype iswlower iswupper mbrlen \ memcmp memcpy memcpy_ulong memmove memset \ memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \ @@ -293,10 +303,6 @@ if test "x$enable_extensions" != "xno"; then dnl On MirBSD (and probably other systems), don't even try. case $host_os in mirbsd* | openedition*) # OS/390 z/OS POSIX layer - cat << \EOF > extension/Makefile -all dist check clean distclean install uninstall distcheck: - @exit 0 -EOF ;; *) AC_CHECK_HEADER(dlfcn.h, @@ -328,6 +334,7 @@ EOF AC_MSG_ERROR([extension support requested, but unavailable]) fi enable_extensions=$extensions_supported + AM_CONDITIONAL([ENABLE_EXTENSIONS], [test "x$enable_extensions" = "xyes"]) fi dnl check for how to use getpgrp @@ -380,6 +387,14 @@ GNUPG_CHECK_MPFR dnl checks for structure members AC_CHECK_MEMBERS([struct stat.st_blksize]) +AC_CHECK_MEMBERS([struct passwd.pw_passwd],,,[ +#include <sys/types.h> +#include <pwd.h> +]) +AC_CHECK_MEMBERS([struct group.gr_passwd],,,[ +#include <sys/types.h> +#include <grp.h> +]) AC_STRUCT_TM AC_STRUCT_TIMEZONE @@ -59,18 +59,6 @@ #define _TZSET 1 #endif -/* For z/OS, from Dave Pitts - VMS using some ZOS_USS code paths */ -#if defined(ZOS_USS) && !defined(__VMS) -#undef HAVE_DLFCN_H -#undef HAVE_SYS_PARAM_H -#undef HAVE_MCHECK_H -#undef HAVE_SETENV -#define setenv zos_setenv -#define unsetenv zos_unsetenv -extern int setenv(const char *name, const char *value, int rewrite); -extern int unsetenv(const char *name); -#endif - /* Junk for dfa.[ch] */ /* The __pure__ attribute was added in gcc 2.96. */ #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) diff --git a/doc/Makefile.am b/doc/Makefile.am index 86321bbc..e94e0d07 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -77,7 +77,7 @@ gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk postscript: gawk.ps gawkinet.ps gawk.1.ps igawk.1.ps $(AWKCARD) -pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf +pdf-local: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf gawk.ps: gawk.dvi TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi diff --git a/doc/Makefile.in b/doc/Makefile.in index 30a371d7..8515b9a3 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -838,7 +838,9 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-aminfo mostlyclean-generic -pdf-am: $(PDFS) +pdf: pdf-am + +pdf-am: $(PDFS) pdf-local ps: ps-am @@ -861,8 +863,8 @@ uninstall-man: uninstall-man1 install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-aminfo \ maintainer-clean-generic mostlyclean mostlyclean-aminfo \ - mostlyclean-generic pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-dvi-am uninstall-html-am \ + mostlyclean-generic pdf pdf-am pdf-local ps ps-am tags-am \ + uninstall uninstall-am uninstall-dvi-am uninstall-html-am \ uninstall-info-am uninstall-man uninstall-man1 \ uninstall-pdf-am uninstall-ps-am @@ -880,7 +882,7 @@ gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk postscript: gawk.ps gawkinet.ps gawk.1.ps igawk.1.ps $(AWKCARD) -pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf +pdf-local: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf gawk.ps: gawk.dvi TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi diff --git a/doc/gawk.texi b/doc/gawk.texi index 37695170..fde01a16 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -22305,11 +22305,7 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/pwcat.c -#ifdef ZOS_USS - printf("%s:%ld:%ld:%s:%s\n", - p->pw_name, (long) p->pw_uid, - (long) p->pw_gid, p->pw_dir, p->pw_shell); -#else +#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD @c endfile @end ignore @c file eg/lib/pwcat.c @@ -22319,6 +22315,10 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/pwcat.c +#else + printf("%s:*:%ld:%ld:%s:%s\n", + p->pw_name, (long) p->pw_uid, + (long) p->pw_gid, p->pw_dir, p->pw_shell); #endif @c endfile @end ignore @@ -22638,9 +22638,7 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/grcat.c -#ifdef ZOS_USS - printf("%s:%ld:", g->gr_name, (long) g->gr_gid); -#else +#ifdef HAVE_STRUCT_GROUP_GR_PASSWD @c endfile @end ignore @c file eg/lib/grcat.c @@ -22649,6 +22647,8 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/grcat.c +#else + printf("%s:*:%ld:", g->gr_name, (long) g->gr_gid); #endif @c endfile @end ignore diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 7695d979..89b95f1e 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -21396,11 +21396,7 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/pwcat.c -#ifdef ZOS_USS - printf("%s:%ld:%ld:%s:%s\n", - p->pw_name, (long) p->pw_uid, - (long) p->pw_gid, p->pw_dir, p->pw_shell); -#else +#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD @c endfile @end ignore @c file eg/lib/pwcat.c @@ -21410,6 +21406,10 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/pwcat.c +#else + printf("%s:*:%ld:%ld:%s:%s\n", + p->pw_name, (long) p->pw_uid, + (long) p->pw_gid, p->pw_dir, p->pw_shell); #endif @c endfile @end ignore @@ -21729,9 +21729,7 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/grcat.c -#ifdef ZOS_USS - printf("%s:%ld:", g->gr_name, (long) g->gr_gid); -#else +#ifdef HAVE_STRUCT_GROUP_GR_PASSWD @c endfile @end ignore @c file eg/lib/grcat.c @@ -21740,6 +21738,8 @@ main(int argc, char **argv) @c endfile @ignore @c file eg/lib/grcat.c +#else + printf("%s:*:%ld:", g->gr_name, (long) g->gr_gid); #endif @c endfile @end ignore @@ -122,7 +122,7 @@ char casetable[] = { C('\360'), C('\361'), C('\362'), C('\363'), C('\364'), C('\365'), C('\366'), C('\367'), C('\370'), C('\371'), C('\372'), C('\373'), C('\374'), C('\375'), C('\376'), C('\377'), }; -#elif 'a' == 0x81 /* it's EBCDIC */ +#elif defined(USE_EBCDIC) char casetable[] = { /*00 NU SH SX EX PF HT LC DL */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, @@ -215,7 +215,7 @@ load_casetable(void) if (cp == NULL || strcmp(cp, "C") == 0 || strcmp(cp, "POSIX") == 0) return; -#ifndef ZOS_USS +#ifndef USE_EBCDIC /* use of isalpha is ok here (see is_alpha in awkgram.y) */ for (i = 0200; i <= 0377; i++) { if (isalpha(i) && islower(i) && i != toupper(i)) diff --git a/extension/Makefile.am b/extension/Makefile.am index 92f5637b..ff9e9073 100644 --- a/extension/Makefile.am +++ b/extension/Makefile.am @@ -27,7 +27,7 @@ AM_CPPFLAGS = -I$(srcdir)/.. # This variable insures that aclocal runs # correctly after changing configure.ac -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -I ../m4 # For some make's, e.g. OpenBSD, that don't define this RM = rm -f diff --git a/extension/Makefile.in b/extension/Makefile.in index 4c148361..868781ca 100644 --- a/extension/Makefile.in +++ b/extension/Makefile.in @@ -113,10 +113,11 @@ build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/dirfd.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/../m4/arch.m4 \ + $(top_srcdir)/m4/dirfd.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ @@ -499,7 +500,7 @@ AM_CPPFLAGS = -I$(srcdir)/.. # This variable insures that aclocal runs # correctly after changing configure.ac -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 -I ../m4 # For some make's, e.g. OpenBSD, that don't define this RM = rm -f diff --git a/extension/aclocal.m4 b/extension/aclocal.m4 index d2e755e4..5665d48e 100644 --- a/extension/aclocal.m4 +++ b/extension/aclocal.m4 @@ -1210,6 +1210,7 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([../m4/arch.m4]) m4_include([m4/dirfd.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) diff --git a/extension/configure b/extension/configure index 6e280de9..ea3136c0 100755 --- a/extension/configure +++ b/extension/configure @@ -3660,6 +3660,36 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for z/OS USS compilation" >&5 +$as_echo_n "checking for z/OS USS compilation... " >&6; } +if ${ac_cv_zos_uss+:} false; then : + $as_echo_n "(cached) " >&6 +else + +if test "OS/390" = "`uname`" +then + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=600" + if test "x$GCC" != "xyes" + then + if echo " $CC " | $EGREP ' (/bin/)?(cc|c89) ' >/dev/null + then + as_fn_error $? "invalid-cc +GNU Awk does not support the \"cc\" nor \"c89\" compiler frontends on z/OS. +Please set CC to \"c99\" or one of the \"xlc\" frontends." "$LINENO" 5 + fi + : CFLAGS="$CFLAGS -qlanglvl=stdc99:libext" + : CPPFLAGS="$CPPFLAGS -qhaltonmsg=CCN3296" + fi + ac_cv_zos_uss=yes +else + ac_cv_zos_uss=no +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_zos_uss}" >&5 +$as_echo "${ac_cv_zos_uss}" >&6; } + + INSTALL="$ac_aux_dir/install-sh -c" export INSTALL diff --git a/extension/configure.ac b/extension/configure.ac index f99742b9..45e4fb6e 100644 --- a/extension/configure.ac +++ b/extension/configure.ac @@ -29,6 +29,7 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([build-aux]) AC_USE_SYSTEM_EXTENSIONS +AC_ZOS_USS INSTALL="$ac_aux_dir/install-sh -c" export INSTALL diff --git a/extension/gawkfts.h b/extension/gawkfts.h index f1ca26f5..447b1758 100644 --- a/extension/gawkfts.h +++ b/extension/gawkfts.h @@ -45,7 +45,7 @@ # endif #endif -#ifdef ZOS_USS +#ifdef __MVS__ #include <limits.h> #define MAXPATHLEN FILENAME_MAX #endif @@ -81,11 +81,7 @@ typedef struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ struct _ftsent *fts_link; /* next file in directory */ -#ifdef ZOS_USS - long fts_number; /* local numeric value */ -#else - long long fts_number; /* local numeric value */ -#endif + long long fts_number; /* local numeric value */ void *fts_pointer; /* local address value */ char *fts_accpath; /* access path */ char *fts_path; /* root path */ diff --git a/extension/readdir.c b/extension/readdir.c index 7bcabcb0..4578b864 100644 --- a/extension/readdir.c +++ b/extension/readdir.c @@ -137,11 +137,7 @@ ftype(struct dirent *entry, const char *dirname) } /* get_inode --- get the inode of a file */ -#ifdef ZOS_USS -static long -#else static long long -#endif get_inode(struct dirent *entry, const char *dirname) { #ifdef __MINGW32__ @@ -179,11 +175,7 @@ dir_get_record(char **out, awk_input_buf_t *iobuf, int *errcode, int len; open_directory_t *the_dir; const char *ftstr; -#ifdef ZOS_USS - unsigned long ino; -#else unsigned long long ino; -#endif /* * The caller sets *errcode to 0, so we should set it only if an @@ -208,9 +200,7 @@ dir_get_record(char **out, awk_input_buf_t *iobuf, int *errcode, ino = get_inode (dirent, iobuf->name); -#if defined(ZOS_USS) - len = sprintf(the_dir->buf, "%lu/%s", ino, dirent->d_name); -#elif __MINGW32__ +#if __MINGW32__ len = sprintf(the_dir->buf, "%I64u/%s", ino, dirent->d_name); #else len = sprintf(the_dir->buf, "%llu/%s", ino, dirent->d_name); diff --git a/extension/rwarray.c b/extension/rwarray.c index aa05a0d5..155cc47c 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -53,17 +53,6 @@ #define _(msgid) gettext(msgid) #define N_(msgid) msgid -#if defined(ZOS_USS) -#include <limits.h> -#define INT32_MAX INT_MAX -#define INT32_MIN INT_MIN -#ifndef __uint32_t -#define __uint32_t 1 -typedef unsigned long uint32_t; -#endif -typedef long int32_t; -#endif /* ZOS_USS */ - #define MAGIC "awkrulz\n" #define MAJOR 3 #define MINOR 0 diff --git a/helpers/testdfa.c b/helpers/testdfa.c index 25a229a2..1e144bd7 100644 --- a/helpers/testdfa.c +++ b/helpers/testdfa.c @@ -668,7 +668,7 @@ char casetable[] = { C('\360'), C('\361'), C('\362'), C('\363'), C('\364'), C('\365'), C('\366'), C('\367'), C('\370'), C('\371'), C('\372'), C('\373'), C('\374'), C('\375'), C('\376'), C('\377'), }; -#elif 'a' == 0x81 /* it's EBCDIC */ +#elif defined(USE_EBCDIC) char casetable[] = { /*00 NU SH SX EX PF HT LC DL */ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, @@ -1774,7 +1774,7 @@ two_way_open(const char *str, struct redirect *rp) if (find_two_way_processor(str, rp)) return true; -#if defined(HAVE_TERMIOS_H) && ! defined(ZOS_USS) +#if defined(HAVE_TERMIOS_H) /* case 3: use ptys for two-way communications to child */ if (! no_ptys && pty_vs_pipe(str)) { static bool initialized = false; @@ -2000,7 +2000,7 @@ two_way_open(const char *str, struct redirect *rp) first_pty_letter = '\0'; /* reset for next command */ return true; } -#endif /* defined(HAVE_TERMIOS_H) && ! defined(ZOS_USS) */ +#endif /* defined(HAVE_TERMIOS_H) */ use_pipes: #ifndef PIPES_SIMULATED /* real pipes */ @@ -61,14 +61,34 @@ AC_MSG_RESULT([${gawk_cv_linux_alpha_hack}]) dnl Check for z/OS Unix Systems Services AC_DEFUN([AC_ZOS_USS], [ AC_MSG_CHECKING([for z/OS USS compilation]) +AC_CACHE_VAL(ac_cv_zos_uss, [ if test "OS/390" = "`uname`" then - CFLAGS="$CFLAGS -D_ALL_SOURCE -DZOS_USS -DUSE_EBCDIC" - # Must rebuild awkgram.c and command.c from Bison for EBCDIC - rm -f awkgram.c command.c + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=600" + if test "x$GCC" != "xyes" + then + dnl If the user is using the "cc" or "c89" compiler frontends, then + dnl give up. These do not accept standard XL C -qfoobar options, and + dnl instead use a devil's-spawn option syntax involving parentheses. + dnl (For example, the below CFLAGS addendum becomes + dnl "-W c,langlvl(stdc99,libext)". Good luck quoting that.) + if echo " $CC " | $EGREP ' (/bin/)?(cc|c89) ' >/dev/null + then + AC_MSG_ERROR([invalid-cc +GNU Awk does not support the "cc" nor "c89" compiler frontends on z/OS. +Please set CC to "c99" or one of the "xlc" frontends.]) + fi + dnl This enables C99, and on z/OS 1.11, the setenv() prototype. +: CFLAGS="$CFLAGS -qlanglvl=stdc99:libext" + dnl This is needed so that xlc considers a missing header file to be an + dnl error and not a warning. (Yes, the latter is in fact the default + dnl behavior on z/OS.) +: CPPFLAGS="$CPPFLAGS -qhaltonmsg=CCN3296" + fi ac_cv_zos_uss=yes else ac_cv_zos_uss=no fi +])dnl AC_MSG_RESULT([${ac_cv_zos_uss}]) ])dnl diff --git a/test/Makefile.am b/test/Makefile.am index 5e72014b..c499996c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2079,11 +2079,11 @@ negtime:: # Targets generated for other tests: include Maketests -$(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests +Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests files=`cd "$(srcdir)" && echo *.awk *.in`; \ - $(AWK) -f "$(srcdir)"/Gentests "$(srcdir)"/Makefile.am $$files > "$(srcdir)"/Maketests + $(AWK) -f "$(srcdir)"/Gentests "$(srcdir)"/Makefile.am $$files > $@ -clean: +clean-local: rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \ seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \ mmap8k.ok profile1.ok diff --git a/test/Makefile.in b/test/Makefile.in index 0116f3a4..e8f0109c 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1489,7 +1489,9 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean-am: clean-generic mostlyclean-am +clean: clean-am + +clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -1555,14 +1557,14 @@ uninstall-am: .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic cscopelist-am \ - ctags-am distclean distclean-generic distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: all all-am check check-am clean clean-generic clean-local \ + cscopelist-am ctags-am distclean distclean-generic distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am @@ -3929,11 +3931,11 @@ time: # Targets generated for other tests: -$(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests +Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests files=`cd "$(srcdir)" && echo *.awk *.in`; \ - $(AWK) -f "$(srcdir)"/Gentests "$(srcdir)"/Makefile.am $$files > "$(srcdir)"/Maketests + $(AWK) -f "$(srcdir)"/Gentests "$(srcdir)"/Makefile.am $$files > $@ -clean: +clean-local: rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \ seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \ mmap8k.ok profile1.ok |