diff options
-rw-r--r-- | Config/defs.mk.in | 9 | ||||
-rw-r--r-- | Src/Makefile.in | 93 | ||||
-rw-r--r-- | Src/Makemod.in.in | 17 | ||||
-rw-r--r-- | Src/ansi2knr.c | 413 | ||||
-rw-r--r-- | zshconfig.ac | 13 |
5 files changed, 58 insertions, 487 deletions
diff --git a/Config/defs.mk.in b/Config/defs.mk.in index ea2115484..06038b83f 100644 --- a/Config/defs.mk.in +++ b/Config/defs.mk.in @@ -27,6 +27,7 @@ # fundamentals SHELL = /bin/sh @SET_MAKE@ +EXEEXT = @EXEEXT@ # install basename tzsh = @tzsh@ @@ -62,11 +63,9 @@ DLLD = @DLLD@ EXPOPT = @EXPOPT@ IMPOPT = @IMPOPT@ -# choose modules not to compile and install -OMIT_MODULES = @OMIT_MODULES@ - # utilities AWK = @AWK@ +ANSI2KNR = @ANSI2KNR@ YODL = @YODL@ YODL2TXT = $(YODL)2txt YODL2HTML = $(YODL)2html @@ -76,7 +75,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ # variables used in determining what to install -FUNCTIONS_INSTALL = @FUNCTIONS_INSTALL@ FUNCTIONS_SUBDIRS = @FUNCTIONS_SUBDIRS@ # flags passed to recursive makes in subdirectories @@ -89,7 +87,8 @@ LDFLAGS='$(LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' \ DLCFLAGS='$(DLCFLAGS)' DLLDFLAGS='$(DLLDFLAGS)' \ LIBLDFLAGS='$(LIBLDFLAGS)' EXELDFLAGS='$(EXELDFLAGS)' \ LIBS='$(LIBS)' DL_EXT='$(DL_EXT)' DLLD='$(DLLD)' \ -AWK='$(AWK)' YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)' \ +AWK='$(AWK)' ANSI2KNR='$(ANSI2KNR)' \ +YODL='$(YODL)' YODL2TXT='$(YODL2TXT)' YODL2HTML='$(YODL2HTML)' \ FUNCTIONS_INSTALL='$(FUNCTIONS_INSTALL)' tzsh='$(tzsh)' # override built-in suffix list diff --git a/Src/Makefile.in b/Src/Makefile.in index 37b988acb..48574fa45 100644 --- a/Src/Makefile.in +++ b/Src/Makefile.in @@ -50,7 +50,7 @@ DLLINK = $(DLLD) $(LDFLAGS) $(LIBLDFLAGS) $(DLLDFLAGS) -o $@ all: bin modules .PHONY: all -bin: zsh +bin: zsh$(EXEEXT) .PHONY: bin modules: headers @@ -58,6 +58,8 @@ modules: headers MAIN_OBJS = main.o +L = @L@ + LSTMP = LLIST = NSTMP = stamp-modobjs @@ -65,6 +67,8 @@ NLIST = `cat stamp-modobjs` LIBZSH = libzsh-$(VERSION).$(DL_EXT) NIBZSH = +INSTLIB = @INSTLIB@ +UNINSTLIB = @UNINSTLIB@ ZSH_EXPORT = $(EXPOPT)zsh.export ZSH_NXPORT = @@ -74,13 +78,18 @@ NNTRYOBJ = LDRUNPATH = LD_RUN_PATH=$(libdir)/$(tzsh) NDRUNPATH = -zsh: $(@L@IBZSH) $(@L@STMP) $(MAIN_OBJS) zsh.export +EXTRAZSHOBJS = @EXTRAZSHOBJS@ + +zsh$(EXEEXT): $(@L@IBZSH) $(@L@STMP) $(MAIN_OBJS) zsh.export $(EXTRAZSHOBJS) rm -f $@ - $(@L@DRUNPATH) $(LINK) $(MAIN_OBJS) $(@L@LIST) $(ZSH_@E@XPORT) $(@L@IBZSH) $(LIBS) + $(@L@DRUNPATH) $(LINK) $(MAIN_OBJS) $(EXTRAZSHOBJS) $(@L@LIST) $(ZSH_@E@XPORT) $(@L@IBZSH) $(LIBS) $(LIBZSH): $(LIBOBJS) $(NSTMP) rm -f $@ - $(DLLINK) $(LIBOBJS) $(NLIST) + $(DLLINK) $(LIBOBJS) $(NLIST) $(LIBS) + +zsh.res.o: $(sdir)/zsh.rc $(sdir)/zsh.ico + windres -O coff --include-dir $(sdir) -i $(sdir)/zsh.rc -o zsh.res.o stamp-modobjs: modobjs @if cmp -s stamp-modobjs.tmp stamp-modobjs; then \ @@ -100,17 +109,7 @@ rm-modobjs-tmp: @CONFIG_MK@ -Makemod modules.index prep: modules-bltin $(CONFIG_INCS) - ( cd $(sdir_top) && OMIT_MODULES="$(OMIT_MODULES)" \ - $(SHELL) $(subdir)/mkmodindex.sh $(subdir) ) \ - > modules.index.tmp - @if cmp -s modules.index.tmp modules.index; then \ - rm -f modules.index.tmp; \ - echo "\`modules.index' is up to date."; \ - else \ - mv -f modules.index.tmp modules.index; \ - echo "Updated \`modules.index'."; \ - fi +Makemod prep: $(CONFIG_INCS) $(dir_top)/config.modules @case $(sdir_top) in \ /*) top_srcdir=$(sdir_top) ;; \ *) top_srcdir=$(subdir)/$(sdir_top) ;; \ @@ -131,40 +130,11 @@ FORCE: mymods.conf: @echo Linking with the standard modules. -modules-bltin:: mymods.conf - @if test -f mymods.conf; then \ - echo cat mymods.conf \> $@; \ - cat mymods.conf > $@; \ - fi - -modules-bltin:: Makefile $(sdir)/xmods.conf - if test -f mymods.conf; then \ - cat mymods.conf > $@; \ - elif test @D@ = N; then \ - sed -n '/L.* /{s/^.* //;p;}' < $(sdir)/xmods.conf > $@; \ - else \ - echo > $@; \ - fi - modules: $(@E@NTRYOBJ) $(ENTRYOBJ): FORCE @$(MAKE) -f Makemod $(MAKEDEFS) $@ -# ========== ANSI TO K&R CONVERSION ========== - -ANSI_KNR = ansi2knr -ANSIKNR = - -Makemod: $(ANSI@U@KNR) - -ansi2knr.o: ansi2knr.c - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(sdir)/ansi2knr.c - -ansi2knr: ansi2knr.o - rm -f $@ - $(CC) $(LDFLAGS) $(EXELDFLAGS) -o $@ ansi2knr.o - # ========== DEPENDENCIES FOR INSTALLING ========== install: install.bin install.modules @@ -176,33 +146,37 @@ uninstall.bin: uninstall.bin-here .PHONY: install.bin uninstall.bin # install binary, creating install directory if necessary -install.bin-here: zsh install.bin-@L@ - $(sdir_top)/mkinstalldirs $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) $(STRIPFLAGS) zsh $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) - if test -f $(DESTDIR)$(bindir)/$(tzsh); then \ +install.bin-here: zsh$(EXEEXT) $(INSTLIB) + ${SHELL} $(sdir_top)/mkinstalldirs $(DESTDIR)$(bindir) + $(INSTALL_PROGRAM) $(STRIPFLAGS) zsh$(EXEEXT) $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION)$(EXEEXT) + if test -f $(DESTDIR)$(bindir)/$(tzsh)$(EXEEXT); then \ rm -f $(DESTDIR)$(bindir)/$(tzsh).old; \ - $(LN) $(DESTDIR)$(bindir)/$(tzsh) $(DESTDIR)$(bindir)/$(tzsh).old; \ + $(LN) $(DESTDIR)$(bindir)/$(tzsh)$(EXEEXT) $(DESTDIR)$(bindir)/$(tzsh).old; \ else :; fi rm -f $(DESTDIR)$(bindir)/$(tzsh).new - $(LN) $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) $(DESTDIR)$(bindir)/$(tzsh).new - mv $(DESTDIR)$(bindir)/$(tzsh).new $(DESTDIR)$(bindir)/$(tzsh) + $(LN) $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION)$(EXEEXT) $(DESTDIR)$(bindir)/$(tzsh).new + mv $(DESTDIR)$(bindir)/$(tzsh).new $(DESTDIR)$(bindir)/$(tzsh)$(EXEEXT) .PHONY: install.bin-here install.bin-N: install.bin-L: $(LIBZSH) - $(sdir_top)/mkinstalldirs $(DESTDIR)$(libdir)/$(tzsh) + ${SHELL} $(sdir_top)/mkinstalldirs $(DESTDIR)$(libdir)/$(tzsh) $(INSTALL_PROGRAM) $(LIBZSH) $(DESTDIR)$(libdir)/$(tzsh)/$(LIBZSH) -.PHONY: install.bin-N install.bin-L +install.cygwin-lib: $(LIBZSH) + $(INSTALL_PROGRAM) $(LIBZSH) $(DESTDIR)$(bindir)/$(LIBZSH) +.PHONY: install.bin-N install.bin-L install.cygwin-lib # uninstall binary -uninstall.bin-here: uninstall.bin-@L@ - rm -f $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) $(DESTDIR)$(bindir)/$(tzsh) +uninstall.bin-here: $(UNINSTLIB) + rm -f $(DESTDIR)$(bindir)/$(tzsh)-$(VERSION) $(DESTDIR)$(bindir)/$(tzsh)$(EXEEXT) .PHONY: uninstall.bin-here uninstall.bin-@L@ uninstall.bin-N: uninstall.bin-L: rm -f $(DESTDIR)$(libdir)/$(tzsh)/$(LIBZSH) -.PHONY: uninstall.bin-N uninstall.bin-L +uninstall.cygwin-lib: + rm -f $(DESTDIR)$(bindir)/$(LIBZSH) +.PHONY: uninstall.bin-N uninstall.bin-L uninstall.cygwin-lib # ========== DEPENDENCIES FOR CLEANUP ========== @@ -215,14 +189,13 @@ mostlyclean-here: .PHONY: mostlyclean-here clean-here: - rm -f modules.index.tmp modules.stamp zsh ansi2knr.o ansi2knr - rm -f modules.index modules-bltin + rm -f modules.stamp zsh$(EXEEXT) rm -f libzsh-*.$(DL_EXT) .PHONY: clean-here distclean-here: rm -f TAGS tags - rm -f Makefile mymods.conf + rm -f Makefile .PHONY: distclean-here mostlyclean: mostlyclean-modules @@ -232,7 +205,7 @@ realclean: realclean-modules .PHONY: mostlyclean clean distclean realclean # Don't remake Makemod just to delete things, even if it doesn't exist. -mostlyclean-modules clean-modules distclean-modules realclean-modules: modules.index +mostlyclean-modules clean-modules distclean-modules realclean-modules: if test -f Makemod; then \ $(MAKE) -f Makemod $(MAKEDEFS) `echo $@ | sed 's/-modules//'`; \ fi; \ diff --git a/Src/Makemod.in.in b/Src/Makemod.in.in index 0eb9e17ef..3ba9f9b04 100644 --- a/Src/Makemod.in.in +++ b/Src/Makemod.in.in @@ -39,7 +39,7 @@ sdir_top = @top_srcdir@ INSTALL = @INSTALL@ @DEFS_MK@ - + sdir_src = $(sdir_top)/Src dir_src = $(dir_top)/Src @@ -65,7 +65,7 @@ ANSI_OBJ=._foo_ @rm -f $(dir_src)/stamp-modobjs .c$(KNR@U@OBJ): - $(dir_src)/ansi2knr $< > $@.c + @ANSI2KNR@ $< > $@.c $(COMPILE) -o $@ $@.c rm -f $@.c @rm -f $(dir_src)/stamp-modobjs @@ -74,7 +74,7 @@ ANSI_OBJ=._foo_ $(DLCOMPILE) -o $@ $< .c.$(KNR@U@OBJ): - $(dir_src)/ansi2knr $< > $@.c + @ANSI2KNR@ $< > $@.c $(DLCOMPILE) -o $@ $@.c rm -f $@.c @@ -82,8 +82,10 @@ ANSI_OBJ=._foo_ $(AWK) -f $(sdir_src)/makepro.awk $< $(subdir) > $@ .syms.epro: - sed -n '/^E/{s/^E//;p;}' < $< > $@ - sed -n '/^L/{s/^L//;p;}' < $< > `echo $@ | sed 's/\.epro$$/.pro/'` + (echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < $<) \ + > $@ + (echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < $<) \ + > `echo $@ | sed 's/\.epro$$/.pro/'` PROTODEPS = $(sdir_src)/makepro.awk @@ -175,7 +177,8 @@ $(makefile): $(makefile).in $(dir_top)/config.status cd $(dir_top) && \ $(SHELL) $$top_srcdir/Src/mkmakemod.sh -m $(subdir) $(makefile) -$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) $(dir_src)/modules-bltin +$(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) \ + $(dir_top)/config.modules @case $(sdir_top) in \ /*) top_srcdir=$(sdir_top) ;; \ *) top_srcdir=$(subdir)/$(sdir_top) ;; \ @@ -186,5 +189,3 @@ $(makefile).in: $(sdir_src)/mkmakemod.sh $(sdir_src)/Makemod.in.in $(MDDS) $(dir cd $(dir_top) && \ $(SHELL) $$top_srcdir/Src/mkmakemod.sh -i $(subdir) $(makefile) -$(dir_src)/modules-bltin: - @cd $(dir_src) && $(MAKE) $(MAKEDEFS) modules-bltin diff --git a/Src/ansi2knr.c b/Src/ansi2knr.c deleted file mode 100644 index e5502a7e6..000000000 --- a/Src/ansi2knr.c +++ /dev/null @@ -1,413 +0,0 @@ -/* Copyright (C) 1989, 1991, 1993, 1994 Aladdin Enterprises. All rights reserved. */ - -/* ansi2knr.c */ -/* Convert ANSI function declarations to K&R syntax */ - -/* -ansi2knr is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY. No author or distributor accepts responsibility -to anyone for the consequences of using it or for whether it serves any -particular purpose or works at all, unless he says so in writing. Refer -to the GNU General Public License for full details. - -Everyone is granted permission to copy, modify and redistribute -ansi2knr, but only under the conditions described in the GNU -General Public License. A copy of this license is supposed to have been -given to you along with ansi2knr so you can know your rights and -responsibilities. It should be in a file named COPYING. Among other -things, the copyright notice and this notice must be preserved on all -copies. -*/ - -/* - * Usage: - ansi2knr input_file [output_file] - * If no output_file is supplied, output goes to stdout. - * There are no error messages. - * - * ansi2knr recognizes function definitions by seeing a non-keyword - * identifier at the left margin, followed by a left parenthesis, - * with a right parenthesis as the last character on the line. - * It will recognize a multi-line header provided that the last character - * of the last line of the header is a right parenthesis, - * and no intervening line ends with a left brace or a semicolon. - * These algorithms ignore whitespace and comments, except that - * the function name must be the first thing on the line. - * The following constructs will confuse it: - * - Any other construct that starts at the left margin and - * follows the above syntax (such as a macro or function call). - * - Macros that tinker with the syntax of the function header. - */ - -/* - * Change history: - lpd 89-xx-xx original version - lpd 94-07-16 added some conditionals to help GNU `configure', - suggested by Francois Pinard <pinard@iro.umontreal.ca>; - properly erase prototype args in function parameters, - contributed by Jim Avera <jima@netcom.com>; - correct error in writeblanks (it shouldn't erase EOLs) - */ - -/* Most of the conditionals here are to make ansi2knr work with */ -/* the GNU configure machinery. */ - -#ifdef HAVE_CONFIG_H -# ifdef CONFIG_BROKETS -/* - We use <config.h> instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). - */ -# include <config.h> -# else -# include "config.h" -# endif -#endif - -#include <stdio.h> -#include <ctype.h> - -#ifdef HAVE_CONFIG_H - -/* - For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h). - This will define HAVE_CONFIG_H and so, activate the following lines. - */ - -# if STDC_HEADERS || HAVE_STRING_H -# include <string.h> -# else -# include <strings.h> -# endif - -#else /* not HAVE_CONFIG_H */ - -/* - Without AC_CONFIG_HEADER, merely use <string.h> as in the original - Ghostscript distribution. This loses on older BSD systems. - */ - -# include <string.h> - -#endif /* not HAVE_CONFIG_H */ - -#ifdef STDC_HEADERS -# include <stdlib.h> -#else -/* - malloc and free should be declared in stdlib.h, - but if you've got a K&R compiler, they probably aren't. - */ -char *malloc(); -void free(); -#endif - -/* Scanning macros */ -#define isidchar(ch) (isalnum(ch) || (ch) == '_') -#define isidfirstchar(ch) (isalpha(ch) || (ch) == '_') - -/* Forward references */ -char *skipspace(); -void writeblanks(); -int test1(); -int convert1(); - -/* The main program */ -int -main(argc, argv) - int argc; - char *argv[]; -{ FILE *in, *out; -#define bufsize 5000 /* arbitrary size */ - char *buf; - char *line; - switch ( argc ) - { - default: - printf("Usage: ansi2knr input_file [output_file]\n"); - exit(0); - case 2: - out = stdout; break; - case 3: - out = fopen(argv[2], "w"); - if ( out == NULL ) - { fprintf(stderr, "Cannot open %s\n", argv[2]); - exit(1); - } - } - in = fopen(argv[1], "r"); - if ( in == NULL ) - { fprintf(stderr, "Cannot open %s\n", argv[1]); - exit(1); - } - fprintf(out, "#line 1 \"%s\"\n", argv[1]); - buf = malloc(bufsize); - line = buf; - while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL ) - { switch ( test1(buf) ) - { - case 2: /* a function header */ - convert1(buf, out, 1); - break; - case 1: /* a function */ - convert1(buf, out, 0); - break; - case -1: /* maybe the start of a function */ - line = buf + strlen(buf); - if ( line != buf + (bufsize - 1) ) /* overflow check */ - continue; - /* falls through */ - default: /* not a function */ - fputs(buf, out); - break; - } - line = buf; - } - if ( line != buf ) fputs(buf, out); - free(buf); - fclose(out); - fclose(in); - return 0; -} - -/* Skip over space and comments, in either direction. */ -char * -skipspace(p, dir) - register char *p; - register int dir; /* 1 for forward, -1 for backward */ -{ for ( ; ; ) - { while ( isspace(*p) ) p += dir; - if ( !(*p == '/' && p[dir] == '*') ) break; - p += dir; p += dir; - while ( !(*p == '*' && p[dir] == '/') ) - { if ( *p == 0 ) return p; /* multi-line comment?? */ - p += dir; - } - p += dir; p += dir; - } - return p; -} - -/* - * Write blanks over part of a string. - * Don't overwrite end-of-line characters. - */ -void -writeblanks(start, end) - char *start; - char *end; -{ char *p; - for ( p = start; p < end; p++ ) - if ( *p != '\r' && *p != '\n' ) *p = ' '; -} - -/* - * Test whether the string in buf is a function definition. - * The string may contain and/or end with a newline. - * Return as follows: - * 0 - definitely not a function definition; - * 1 - definitely a function definition; - * 2 - definitely a function prototype (NOT USED); - * -1 - may be the beginning of a function definition, - * append another line and look again. - * The reason we don't attempt to convert function prototypes is that - * Ghostscript's declaration-generating macros look too much like - * prototypes, and confuse the algorithms. - */ -int -test1(buf) - char *buf; -{ register char *p = buf; - char *bend; - char *endfn; - int contin; - if ( !isidfirstchar(*p) ) - return 0; /* no name at left margin */ - bend = skipspace(buf + strlen(buf) - 1, -1); - switch ( *bend ) - { - case ';': contin = 0 /*2*/; break; - case ')': contin = 1; break; - case '{': return 0; /* not a function */ - default: contin = -1; - } - while ( isidchar(*p) ) p++; - endfn = p; - p = skipspace(p, 1); - if ( *p++ != '(' ) - return 0; /* not a function */ - p = skipspace(p, 1); - if ( *p == ')' ) - return 0; /* no parameters */ - /* Check that the apparent function name isn't a keyword. */ - /* We only need to check for keywords that could be followed */ - /* by a left parenthesis (which, unfortunately, is most of them). */ - { static char *words[] = - { "asm", "auto", "case", "char", "const", "double", - "extern", "float", "for", "if", "int", "long", - "register", "return", "short", "signed", "sizeof", - "static", "switch", "typedef", "unsigned", - "void", "volatile", "while", 0 - }; - char **key = words; - char *kp; - int len = endfn - buf; - while ( (kp = *key) != 0 ) - { if ( strlen(kp) == len && !strncmp(kp, buf, len) ) - return 0; /* name is a keyword */ - key++; - } - } - return contin; -} - -/* Convert a recognized function definition or header to K&R syntax. */ -int -convert1(buf, out, header) - char *buf; - FILE *out; - int header; /* Boolean */ -{ char *endfn; - register char *p; - char **breaks; - unsigned num_breaks = 2; /* for testing */ - char **btop; - char **bp; - char **ap; - /* Pre-ANSI implementations don't agree on whether strchr */ - /* is called strchr or index, so we open-code it here. */ - for ( endfn = buf; *(endfn++) != '('; ) ; -top: p = endfn; - breaks = (char **)malloc(sizeof(char *) * num_breaks * 2); - if ( breaks == 0 ) - { /* Couldn't allocate break table, give up */ - fprintf(stderr, "Unable to allocate break table!\n"); - fputs(buf, out); - return -1; - } - btop = breaks + num_breaks * 2 - 2; - bp = breaks; - /* Parse the argument list */ - do - { int level = 0; - char *lp = NULL; - char *rp; - char *end = NULL; - if ( bp >= btop ) - { /* Filled up break table. */ - /* Allocate a bigger one and start over. */ - free((char *)breaks); - num_breaks <<= 1; - goto top; - } - *bp++ = p; - /* Find the end of the argument */ - for ( ; end == NULL; p++ ) - { switch(*p) - { - case ',': - if ( !level ) end = p; - break; - case '(': - if ( !level ) lp = p; - level++; - break; - case ')': - if ( --level < 0 ) end = p; - else rp = p; - break; - case '/': - p = skipspace(p, 1) - 1; - break; - default: - ; - } - } - /* Erase any embedded prototype parameters. */ - if ( lp ) - writeblanks(lp + 1, rp); - p--; /* back up over terminator */ - /* Find the name being declared. */ - /* This is complicated because of procedure and */ - /* array modifiers. */ - for ( ; ; ) - { p = skipspace(p - 1, -1); - switch ( *p ) - { - case ']': /* skip array dimension(s) */ - case ')': /* skip procedure args OR name */ - { int level = 1; - while ( level ) - switch ( *--p ) - { - case ']': case ')': level++; break; - case '[': case '(': level--; break; - case '/': p = skipspace(p, -1) + 1; break; - default: ; - } - } - if ( *p == '(' && *skipspace(p + 1, 1) == '*' ) - { /* We found the name being declared */ - while ( !isidfirstchar(*p) ) - p = skipspace(p, 1) + 1; - goto found; - } - break; - default: goto found; - } - } -found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' ) - { p++; - if ( bp == breaks + 1 ) /* sole argument */ - writeblanks(breaks[0], p); - else - writeblanks(bp[-1] - 1, p); - bp--; - } - else - { while ( isidchar(*p) ) p--; - *bp++ = p+1; - } - p = end; - } - while ( *p++ == ',' ); - *bp = p; - /* Make a special check for 'void' arglist */ - if ( bp == breaks+2 ) - { p = skipspace(breaks[0], 1); - if ( !strncmp(p, "void", 4) ) - { p = skipspace(p+4, 1); - if ( p == breaks[2] - 1 ) - { bp = breaks; /* yup, pretend arglist is empty */ - writeblanks(breaks[0], p + 1); - } - } - } - /* Put out the function name */ - p = buf; - while ( p != endfn ) putc(*p, out), p++; - /* Put out the declaration */ - if ( header ) - { fputs(");", out); - for ( p = breaks[0]; *p; p++ ) - if ( *p == '\n' ) - putc('\n', out); - } - else - { for ( ap = breaks+1; ap < bp; ap += 2 ) - { p = *ap; - while ( isidchar(*p) ) - putc(*p, out), p++; - if ( ap < bp - 1 ) - fputs(", ", out); - } - fputs(") ", out); - /* Put out the argument declarations */ - for ( ap = breaks+2; ap <= bp; ap += 2 ) - (*ap)[-1] = ';'; - fputs(breaks[0], out); - } - free((char *)breaks); - return 0; -} diff --git a/zshconfig.ac b/zshconfig.ac index 4dc5c823f..27df2695f 100644 --- a/zshconfig.ac +++ b/zshconfig.ac @@ -289,7 +289,7 @@ fi dnl if the user hasn't specified CFLAGS, then dnl if compiler is gcc, then use -O2 and some warning flags dnl else use -O -if test -n "$auto_cflags"; then +if test -n "$auto_cflags" && test ."$ansi2knr" != .yes; then if test "${enable_zsh_debug}" = yes; then if test -n "$GCC"; then CFLAGS="$CFLAGS -Wall -Wno-implicit -Wmissing-prototypes -ggdb" @@ -462,6 +462,17 @@ AC_PROG_INSTALL dnl Check for BSD compatible `install' AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk. AC_PROG_LN dnl Check for working ln, for "make install" AC_CHECK_PROGS([YODL], [yodl], [: yodl]) +AC_CHECK_PROGS([ANSI2KNR], [ansi2knr], [: ansi2knr]) + +if test x"$ansi2knr" = xyes && test x"$ANSI2KNR" = x": ansi2knr"; then + echo "----------" + echo "configure fatal error:" + echo "ansi2knr was specified (--enable-ansi2knr) but the program could not be found." + echo "Either remove the configure option if it is not required or build the ansi2knr" + echo "program before reconfiguring Zsh. The source code for ansi2knr is also" + echo "available in the GPL directory on Zsh distribution sites." + exit 1 +fi dnl ------------------ dnl CHECK HEADER FILES |