diff options
Diffstat (limited to 'pc')
-rw-r--r-- | pc/ChangeLog | 92 | ||||
-rw-r--r-- | pc/Makefile | 103 | ||||
-rw-r--r-- | pc/Makefile.tst | 56 | ||||
-rw-r--r-- | pc/config.h | 9 | ||||
-rw-r--r-- | pc/config.sed | 4 | ||||
-rw-r--r-- | pc/dlfcn.h | 12 | ||||
-rw-r--r-- | pc/gawkmisc.pc | 113 |
7 files changed, 315 insertions, 74 deletions
diff --git a/pc/ChangeLog b/pc/ChangeLog index 8ea6af04..e7378b5f 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,25 @@ +2013-02-09 Eli Zaretskii <eliz@gnu.org> + + * gawkmisc.pc (dlopen, dlerror, dlclose, dlsym) [DYNAMIC]: New + functions for _WIN32 build. + + * dlfcn.h: New file. + + * Makefile (pkgextensiondir, DEFLIBPATH, SHLIBEXT): New variables. + (AWKOBJS4): New sub-list of object files; add gawkapi$O. + (ALLOBJS): Include AWKOBJS4. + (CFLAGS): Add -DDEFLIBPATH=$(DEFLIBPATH) -DSHLIBEXT=$(SHLIBEXT). + + * config.sed (DYNAMIC): Define for _WIN32 build. + +2013-02-07 Scott Deifik <scottd.mail@sbcglobal.net> + + * Makefile.tst: Sync with mainline. + +2013-01-25 Arnold D. Robbins <arnold@skeeve.com> + + * config.h: Version bumped. + 2012-12-28 Eli Zaretskii <eliz@gnu.org> * Makefile (install1): Don't require a Unixy shell and Sed. Don't @@ -22,6 +44,10 @@ * Makefile.tst (jarebug): Update. (GREP_OPTIONS): Add. +2012-11-12 Arnold D. Robbins <arnold@skeeve.com> + + * gawkmisc.pc (os_isreadable): Use correct type for first parameter. + 2012-11-04 Scott Deifik <scottd.mail@sbcglobal.net> * Makefile.tst (jarebug, charasbytes): Update. @@ -30,14 +56,76 @@ * Makefile.tst: Sync with mainline version. +2012-10-28 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.pc (messages): Adjust to use standard failure test for + make diffout. + +2012-08-08 Arnold D. Robbins <arnold@skeeve.com> + + * gawkmisc.pc (os_isreadable): Take IOBUF_PUBLIC instead of fd and + use passed in info. + +2012-07-29 Arnold D. Robbins <arnold@skeeve.com> + + * gawkmisc.pc (os_isreadable): Add isdir pointer parameter to be + set to true if fd is for a directory. + +2012-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * gawkmisc.pc (os_isreadable): New function. + +2012-05-14 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile: Remove second mingw32-readline target. Bad + result from branch merging. + 2012-05-06 Eli Zaretskii <eliz@gnu.org> * config.sed: Update DJGPP -> __DJGPP__. +2012-04-16 Eli Zaretskii <eliz@gnu.org> + + * Makefile.tst (PGAWK): Redefine as "../gawk.exe -p". + (MPFR_TESTS): New variable, a list of MPFR-related tests. + (mpfr-tests): A new target. + (badargs): Reset GREP_OPTIONS to empty, to avoid gratuitous + failures when the user has something like -nH there. + (mpfrieee, mpfrexprange, mpfrrnd, mpfrnr, mpfrsort, mpfrbigint): + New tests. + + * Makefile (default): Add descriptions of mingw32-mpfr and + mingw32-libreadline-mpfr targets. + (PRSPFILE, DRSPFILE, PRSP, DRSP, PLDRSP, DLDRSP, DO_PLNK) + (DO_PBIND, DO_DLNK, DO_DBIND, PLDJG, DLDJG, PLMINGW32) + (DLMINGW32, PAWKOBJS1, PAWKOBJS2, DAWKOBJS2, PGAWKOBJS) + (DGAWKOBJS): Remove unused variables. + (djgpp, djgpp-debug, mingw32): Don't use them. + (mingw32): Add -D__USE_MINGW_ANSI_STDIO to compilation flags. + (mingw32-readline, mingw32-mpfr, mingw32-readline-mpfr): New targets. + (CFLAGS, AWKOBJS2): Don't reference obsolete DYN_FLAGS and DYN_OBJ + variables. + (AWKOBJS2): Add symbol$O. + (AWKOBJS3): New variable, lists MPFR-related object files. + (AWKOBJS): Add $(AWKOBJS3). + (all): Remove pgawk.exe and dgawk.exe. + (pgawk.exe, dgawk.exe, $(PRSPFILE) $(DRSPFILE), eval_p$O) + (profile_p$O): Remove targets. + (random$O, debug$O): Don't depend on floatmagic.h + (eval$O): Depend on interpret.h. + (clean): Prepend '-' to command line, to ignore errors due to + non-existent files. + + * config.h: Comment out "#undef HAVE_LIBREADLINE" (again). + 2012-03-29 Arnold D. Robbins <arnold@skeeve.com> * config.h: Add definition for _Noreturn. +2012-03-20 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkmisc.pc (deflibpath): New global variable. + 2012-03-28 Arnold D. Robbins <arnold@skeeve.com> * 4.0.1: Release tar ball made. @@ -92,6 +180,10 @@ * Makefile.tst: Sync with mainline version. +2011-12-12 Scott Deifik <scottd.mail@sbcglobal.net> + + * Makefile.tst: Sync with mainline version. + 2011-12-06 Scott Deifik <scottd.mail@sbcglobal.net> * Makefile.tst: Sync with mainline version. diff --git a/pc/Makefile b/pc/Makefile index 11ecc881..71197c53 100644 --- a/pc/Makefile +++ b/pc/Makefile @@ -16,6 +16,9 @@ default: @echo " mingw32 . Windows32 exe [Mingw32 GNU C] " @echo " mingw32-readline . Like mingw32, but with readline " @echo " [You will need to have GNU readline library installed.] " + @echo " mingw32-mpfr . Like mingw32, but with MPFR " + @echo " [You will need to have GNU MPFR library installed.] " + @echo " mingw32-readline-mpfr . mingw32 with readline and MPFR " @echo " ----------------------------------------------------- " @echo " test .... Perform tests (see README_d/README.pc) " @echo " install . Install gawk under $(prefix)/ " @@ -39,8 +42,6 @@ default: #======================= Configuration ================================== RSPFILE = gawk.rsp -PRSPFILE = pgawk.rsp -DRSPFILE = dgawk.rsp # # Choose method for passing arguments to the linker. # @@ -50,11 +51,7 @@ DRSPFILE = dgawk.rsp # # else use brain-dead approach (emxbnd will need 'tr'). RSP = $(RSPFILE) -PRSP = $(PRSPFILE) -DRSP = $(DRSPFILE) LDRSP = @$(RSP) -PLDRSP = @$(PRSP) -DLDRSP = @$(DRSP) LNKRSP = $(LDRSP) #------------------------------------------------------------------------ # Some makes do not define MAKE (and ndmake does not allow a define). @@ -71,6 +68,9 @@ MAK = $(MAKE) $(MAKEFILE) #prefix = prefix = c:/gnu pkgdatadir = $(prefix)/lib/awk +pkgextensiondir = $(prefix)/lib/gawk +DEFLIBPATH = "\"$(pkgextensiondir)\"" +SHLIBEXT = "\"dll\"" # # Define the install method. Method 1 is Unix-like (and requires cat # and cp); method 2 uses gawk and batch files. @@ -80,10 +80,6 @@ install = 1 # that $($X) can be expanded. DO_LNK = $($(LNK)) DO_BIND= $($(BIND)) -DO_PLNK = $($(PLNK)) -DO_PBIND= $($(PBIND)) -DO_DLNK = $($(DLNK)) -DO_DBIND= $($(DBIND)) #======================================================================== # End of general configuration. Some platform-specific configuration # notes appear below. @@ -97,21 +93,19 @@ prefix = $(DJDIR) pkgdatadir = $(prefix)/share/awk endif LDJG = $(CC) $(LF) -o gawk.exe $(LDRSP) $(LF2) -PLDJG = $(CC) $(LF) -o pgawk.exe $(PLDRSP) $(LF2) -DLDJG = $(CC) $(LF) -o dgawk.exe $(DLDRSP) $(LF2) BDJG = stubify -g awk.exe | stubedit awk.exe runfile=gawk djgpp: $(MAK) all \ CC=gcc O=.o CF=-O2 \ - LNK=LDJG PLNK=PLDJG DLNK=DLDJG LF=-s LF2=-lm \ - BIND=BDJG PBIND='' DBIND='' + LNK=LDJG LF=-s LF2=-lm \ + BIND=BDJG djgpp-debug: $(MAK) all \ CC=gcc O=.o CF='-O2 -g' \ - LNK=LDJG PLNK=PLDJG DLNK=DLDJG LF2=-lm \ - BIND=BDJG PBIND='' DBIND='' + LNK=LDJG LF2=-lm \ + BIND=BDJG #======================================================================== #========================== EMX ========================================= @@ -158,41 +152,48 @@ emxbnd-debug: #======================================================================== LMINGW32 = $(CC) $(LF) -o $@ $(GAWKOBJS) $(LF2) -PLMINGW32 = $(CC) $(LF) -o $@ $(PGAWKOBJS) $(LF2) -DLMINGW32 = $(CC) $(LF) -o $@ $(DGAWKOBJS) $(LF2) # The following might work around command-line length limitations: #LMINGW32 = $(CC) $(LF) -o $@ *.o $(LF2) mingw32: $(MAK) all \ - CC=gcc O=.o CF="-O2 -gdwarf-2 -g3" OBJ=popen.o \ - LNK=LMINGW32 PLNK=PLMINGW32 DLNK=DLMINGW32 \ - LF="-gdwarf-2 -g3" LF2=-lmsvcp60 RSP= + CC=gcc O=.o CF="-D__USE_MINGW_ANSI_STDIO -O2 -gdwarf-2 -g3" \ + OBJ=popen.o LNK=LMINGW32 LF="-gdwarf-2 -g3" LF2=-lmsvcp60 RSP= mingw32-readline: $(MAK) all \ - CC=gcc O=.o CF="-DHAVE_LIBREADLINE -O2 -gdwarf-2 -g3" OBJ=popen.o \ - LNK=LMINGW32 PLNK=PLMINGW32 DLNK=DLMINGW32 \ - LF="-gdwarf-2 -g3" \ + CC=gcc O=.o \ + CF="-D__USE_MINGW_ANSI_STDIO -DHAVE_LIBREADLINE -O2 -gdwarf-2 -g3" \ + OBJ=popen.o LNK=LMINGW32 LF="-gdwarf-2 -g3" \ LF2="-lreadline -lmsvcp60 -Wl,--enable-auto-import" RSP= +mingw32-mpfr: + $(MAK) all \ + CC=gcc O=.o \ + CF="-D__USE_MINGW_ANSI_STDIO -DHAVE_MPFR -O2 -gdwarf-2 -g3" \ + OBJ=popen.o LNK=LMINGW32 LF="-gdwarf-2 -g3" \ + LF2="-lmpfr -lgmp -lmsvcp60 -Wl,--enable-auto-import" RSP= + +mingw32-readline-mpfr: + $(MAK) all \ + CC=gcc O=.o \ + CF="-D__USE_MINGW_ANSI_STDIO -DHAVE_LIBREADLINE -DHAVE_MPFR -O2 -gdwarf-2 -g3" \ + OBJ=popen.o LNK=LMINGW32 LF="-gdwarf-2 -g3" \ + LF2="-lmpfr -lgmp -lreadline -lmsvcp60 -Wl,--enable-auto-import" RSP= + # Define BIND for BINDless compiles, otherwise $($(BIND)) may break. BIND = EMPTY PBIND = EMPTY EMPTY= -# bitwise operations (-DBITOPS) and non-decimal input data (-DNONDECDATA) are -# undocumented in 3.0.3. They may be enabled in config.h, or added to CFLAGS. -CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H $(DYN_FLAGS) +CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H -DDEFLIBPATH=$(DEFLIBPATH) -DSHLIBEXT=$(SHLIBEXT) # 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 $(DYN_OBJ) -PAWKOBJS1 = array$O builtin$O eval_p$O field$O floatcomp$O gawkmisc$O io$O main$O -PAWKOBJS2 = ext$O msg$O node$O profile_p$O re$O replace$O version$O $(DYN_OBJ) -DAWKOBJS1 = array$O builtin$O debug$O eval_d$O field$O floatcomp$O gawkmisc$O io$O main$O -DAWKOBJS2 = ext$O msg$O node$O profile$O re$O replace$O version$O command$O $(DYN_OBJ) -AWKOBJS = $(AWKOBJS1) $(AWKOBJS2) +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 +AWKOBJS4 = gawkapi$O +AWKOBJS = $(AWKOBJS1) $(AWKOBJS2) $(AWKOBJS3) $(AWKOBJS4) ALLOBJS = $(AWKOBJS) awkgram$O getid$O $(OBJ) @@ -201,8 +202,6 @@ ALLOBJS = $(AWKOBJS) awkgram$O getid$O $(OBJ) LIBOBJS= getopt$O getopt1$O dfa$O regex$O random$O GAWKOBJS = $(ALLOBJS) $(LIBOBJS) -PGAWKOBJS = $(PAWKOBJS1) $(PAWKOBJS2) $(LIBOBJS) awkgram$O getid$O $(OBJ) -DGAWKOBJS = $(DAWKOBJS1) $(DAWKOBJS2) $(LIBOBJS) awkgram$O getid$O $(OBJ) # clear out suffixes list # .SUFFIXES: @@ -212,52 +211,34 @@ DGAWKOBJS = $(DAWKOBJS1) $(DAWKOBJS2) $(LIBOBJS) awkgram$O getid$O $(OBJ) $(CC) -c $(CFLAGS) $< # rules to build gawk -all : gawk.exe pgawk.exe dgawk.exe +all : gawk.exe gawk.exe:: $(GAWKOBJS) $(RSP) $(DO_LNK) $(DO_BIND) -pgawk.exe:: $(PGAWKOBJS) $(PRSP) - $(DO_PLNK) - $(DO_PBIND) - -dgawk.exe:: $(DGAWKOBJS) $(DRSP) - $(DO_DLNK) - $(DO_DBIND) - $(RSPFILE) : $(GAWKOBJS) echo $(AWKOBJS1)$P > $@ echo $(AWKOBJS2)$P >> $@ echo awkgram$O getid$O $(OBJ) $(LIBOBJS)$P >> $@ -$(PRSPFILE) : $(PGAWKOBJS) - echo $(PAWKOBJS1)$P > $@ - echo $(PAWKOBJS2)$P >> $@ - echo awkgram$O getid$O $(OBJ) $(LIBOBJS)$P >> $@ - -$(DRSPFILE) : $(DGAWKOBJS) - echo $(DAWKOBJS1)$P > $@ - echo $(DAWKOBJS2)$P >> $@ - echo awkgram$O getid$O $(OBJ) $(LIBOBJS)$P >> $@ - # Notes to dependencies: # 1. The dependency on getopt.h is because unistd.h includes it, # and we have -I. on the compiler command line. unistd.h is # included by awk.h. # 2. custom.h is not mentioned because pc ports don't use it. -$(ALLOBJS) $(LIBOBJS) eval_p$O profile_p$O eval_d$O debug$O command$O: \ +$(ALLOBJS) $(LIBOBJS): \ awk.h regex.h config.h gettext.h mbsupport.h protos.h dfa.h getopt.h builtin$O: floatmagic.h random.h popen.h -random$O: floatmagic.h random.h +random$O: random.h -debug$O: floatmagic.h +node$O: floatmagic.h command$O debug$O: cmd.h -dfa$O: xalloc.h +dfa$O: xalloc.h gawkmisc$O: pc/gawkmisc.pc @@ -267,9 +248,7 @@ io$O: popen.h regex$O: regcomp.c regexec.c regex_internal.h -eval_p$O: eval.c - -profile_p$O: profile.c +eval$O: interpret.h # A bug in ndmake requires the following rule awkgram$O: awk.h awkgram.c @@ -307,7 +286,7 @@ install-strip: install$(install) strip "$(prefix)/bin"/*.exe clean: - rm -rf gawk pgawk dgawk *.exe gawk.map *.o *.obj core a.out $(RSPFILE) $(PRSPFILE) $(DRSPFILE) $(DYN_EXP) + -rm -rf gawk *.exe gawk.map *.o *.obj core a.out $(RSPFILE) $(PRSPFILE) $(DRSPFILE) $(DYN_EXP) # cd doc && $(MAKE) clean # cd test && $(MAKE) clean # cd awklib && $(MAKE) clean diff --git a/pc/Makefile.tst b/pc/Makefile.tst index cbeb9186..564cddfe 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -1,6 +1,6 @@ # Makefile for GNU Awk test suite. # -# Copyright (C) 1988-2012 the Free Software Foundation, Inc. +# Copyright (C) 1988-2013 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -67,7 +67,7 @@ AWK2 = '..\gawk.exe' AWKPROG = ../gawk.exe # Define PGAWK -PGAWK = ../pgawk.exe +PGAWK = ../gawk.exe -p # Set your cmp command here (you can use most versions of diff instead of cmp # if you don't want to convert the .ok files to the DOS CR/LF format). @@ -152,8 +152,8 @@ BASIC_TESTS = \ nlinstr nlstrina noeffect nofile nofmtch noloop1 noloop2 nonl \ noparms nors nulrsend numindex numsubstr \ octsub ofmt ofmta ofmtbig ofmtfidl ofmts ofs1 onlynl opasnidx opasnslf \ - paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme pcntplus \ - posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ + paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \ + pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \ prt1eval prtoeval \ rand range1 rebt8b1 redfilnm regeq regexprange regrange \ reindops reparse \ @@ -183,13 +183,14 @@ GAWK_EXT_TESTS = \ nastyparm next nondec nondec2 \ patsplit posix printfbad1 printfbad2 printfbad3 procinfs \ profile1 profile2 profile3 pty1 \ - rebuf regx8bit reint reint2 rsstart1 \ + rebuf regx8bit reginttrad reint reint2 rsstart1 \ rsstart2 rsstart3 rstest6 shadow sortfor sortu splitarg4 strftime \ strtonum switch2 EXTRA_TESTS = inftest regtest INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat +MPFR_TESTS = mpfrnr mpfrrnd mpfrieee mpfrexprange mpfrsort mpfrbigint LOCALE_CHARSET_TESTS = \ asort asorti fmttest fnarydel fnparydl jarebug lc_num1 mbfw1 \ mbprintf1 mbprintf2 mbprintf3 rebt8b2 rtlenmb sort1 sprintfc @@ -237,6 +238,8 @@ inet: inetmesg $(INET_TESTS) machine-tests: $(MACHINE_TESTS) +mpfr-tests: $(MPFR_TESTS) + msg:: @echo "" @echo "Any output from $(CMP) is bad news, although some differences" @@ -303,8 +306,8 @@ poundbang:: messages:: @echo $@ - @$(AWK) -f $(srcdir)/messages.awk >out2 2>out3 - @-$(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3 + @$(AWK) -f $(srcdir)/messages.awk >_out2 2>_out3 + @-$(CMP) $(srcdir)/out1.ok _out1 && $(CMP) $(srcdir)/out2.ok _out2 && $(CMP) $(srcdir)/out3.ok _out3 && rm -f _out1 _out2 _out3 argarray:: @echo $@ @@ -364,7 +367,7 @@ argtest:: badargs:: @echo $@ - @-$(AWK) -f 2>&1 | grep -v patchlevel >_$@ + @-$(AWK) -f 2>&1 | GREP_OPTIONS='' grep -v patchlevel >_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ nonl:: @@ -804,6 +807,36 @@ exit: @-AWK="$(AWKPROG)" $(srcdir)/$@.sh > _$@ 2>&1 @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ +mpfrieee: + @echo mpfrieee + @$(AWK) -M -vPREC=double -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrexprange: + @echo mpfrexprange + @$(AWK) -M -vPREC=53 -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrrnd: + @echo mpfrrnd + @$(AWK) -M -vPREC=53 -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrnr: + @echo mpfrnr + @$(AWK) -M -vPREC=113 -f $(srcdir)/$@.awk $(srcdir)/$@.in > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrsort: + @echo mpfrsort + @$(AWK) -M -vPREC=53 -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +mpfrbigint: + @echo mpfrbigint + @$(AWK) -M -f $(srcdir)/$@.awk > _$@ 2>&1 + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + rri1:: @echo $@ @[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \ @@ -825,6 +858,11 @@ charasbytes: AWKPATH=$(srcdir) $(AWK) -b -v BINMODE=2 -f $@.awk $(srcdir)/$@.in | \ od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$$//' >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ + +reginttrad: + @echo $@ + @$(AWK) --traditional -r -f $@.awk > _$@ + @-$(CMP) $(srcdir)/$@.ok _$@ && rm -f _$@ Gt-dummy: # file Maketests, generated from Makefile.am by the Gentests program addcomma: @@ -2064,7 +2102,7 @@ $(srcdir)/Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests $(AWK) -f $(srcdir)/Gentests "$(srcdir)/Makefile.am" $$files > $(srcdir)/Maketests clean: - rm -fr _* core core.* fmtspcl.ok junk out1 out2 out3 strftime.ok test1 test2 seq *~ + rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 seq *~ # An attempt to print something that can be grepped for in build logs pass-fail: diff --git a/pc/config.h b/pc/config.h index b654d740..8adbef0b 100644 --- a/pc/config.h +++ b/pc/config.h @@ -177,6 +177,9 @@ /* we have the mktime function */ #define HAVE_MKTIME 1 +/* Define to 1 if you have fully functional mpfr and gmp libraries. */ +#undef HAVE_MPFR + /* Define to 1 if you have the <netdb.h> header file. */ #undef HAVE_NETDB_H @@ -416,7 +419,7 @@ #define PACKAGE_NAME "GNU Awk" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "GNU Awk 4.0.2" +#define PACKAGE_STRING "GNU Awk 4.0.73" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "gawk" @@ -425,7 +428,7 @@ #define PACKAGE_URL "http://www.gnu.org/software/gawk/" /* Define to the version of this package. */ -#define PACKAGE_VERSION "4.0.2" +#define PACKAGE_VERSION "4.0.73" /* Define to 1 if *printf supports %F format */ #undef PRINTF_HAS_F_FORMAT @@ -487,7 +490,7 @@ /* Version number of package */ -#define VERSION "4.0.2" +#define VERSION "4.0.73" /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE diff --git a/pc/config.sed b/pc/config.sed index 5e57e82b..6f76f43e 100644 --- a/pc/config.sed +++ b/pc/config.sed @@ -26,6 +26,10 @@ /configh\.in/a\ /* pc/config.h. Generated automatically by pc/config.sed. */ +/^#undef DYNAMIC$\c +#ifdef _WIN32\ +#define DYNAMIC 1\ +#endif s/^#undef GETPGRP_VOID *$/#define GETPGRP_VOID 1/ s/^#undef GETGROUPS_T *$/#define GETGROUPS_T gid_t/ /^#undef GETPGRP_VOID$/c\ diff --git a/pc/dlfcn.h b/pc/dlfcn.h new file mode 100644 index 00000000..64ef4bc5 --- /dev/null +++ b/pc/dlfcn.h @@ -0,0 +1,12 @@ +/* dlfcn.h replacement for MS-Windows build. */ +#ifndef DLFCN_H +#define DLFCN_H + +#define RTLD_LAZY 1 + +extern void *dlopen (const char *, int); +extern int dlclose (void *); +extern void *dlsym (void *, const char *); +extern char *dlerror (void); + +#endif /* DLFCN_H */ diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc index b2a67a50..5e412d71 100644 --- a/pc/gawkmisc.pc +++ b/pc/gawkmisc.pc @@ -31,6 +31,8 @@ char *defpath = DEFPATH; # else char *defpath = ".;c:\\lib\\awk;c:\\gnu\\lib\\awk"; # endif +/* the Makefile should define DEFLIBPATH */ +char *deflibpath = DEFLIBPATH; #ifdef __EMX__ #include<io.h> @@ -230,6 +232,31 @@ int fd; return (fstat(fd, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)); } +/* os_isreadable --- fd can be read from */ + +int +os_isreadable(const awk_input_buf_t *iobuf, bool *isdir) +{ + *isdir = false; + + switch (iobuf->sbuf.st_mode & S_IFMT) { + case S_IFREG: + case S_IFCHR: /* ttys, /dev/null, .. */ +#ifdef S_IFSOCK + case S_IFSOCK: +#endif +#ifdef S_IFIFO + case S_IFIFO: +#endif + return true; + case S_IFDIR: + *isdir = true; + /* fall through */ + default: + return false; + } +} + /* os_is_setuid --- true if running setuid root */ int @@ -582,6 +609,92 @@ int execvp(const char *file, const char *const *argv) return -1; } + +#ifdef DYNAMIC + +#include <dlfcn.h> + +static DWORD last_err; + +void * +dlopen (const char *file, int mode) +{ + char dllfn[MAX_PATH], *p; + HANDLE dllhandle; + + if (mode != RTLD_LAZY) + { + errno = EINVAL; + last_err = ERROR_INVALID_PARAMETER; + return NULL; + } + + /* MSDN says to be sure to use backslashes in the DLL file name. */ + strcpy (dllfn, file); + for (p = dllfn; *p; p++) + if (*p == '/') + *p = '\\'; + + dllhandle = LoadLibrary (dllfn); + if (!dllhandle) + last_err = GetLastError (); + + return dllhandle; +} + +char * +dlerror (void) +{ + static char errbuf[1024]; + DWORD ret; + + if (!last_err) + return NULL; + + ret = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, last_err, 0, errbuf, sizeof (errbuf), NULL); + while (ret > 0 && (errbuf[ret - 1] == '\n' || errbuf[ret - 1] == '\r')) + --ret; + + errbuf[ret] = '\0'; + if (!ret) + sprintf (errbuf, "Error code %lu", last_err); + + last_err = 0; + return errbuf; +} + +int +dlclose (void *handle) +{ + if (!handle || handle == INVALID_HANDLE_VALUE) + return -1; + if (!FreeLibrary (handle)) + return -1; + + return 0; +} + +void * +dlsym (void *handle, const char *name) +{ + FARPROC addr = NULL; + + if (!handle || handle == INVALID_HANDLE_VALUE) + { + last_err = ERROR_INVALID_PARAMETER; + return NULL; + } + + addr = GetProcAddress (handle, name); + if (!addr) + last_err = GetLastError (); + + return (void *)addr; +} +#endif + #endif /* __MINGW32__ */ #ifdef __DJGPP__ |