diff options
-rw-r--r-- | .cvsignore | 8 | ||||
-rw-r--r-- | ChangeLog | 61 | ||||
-rw-r--r-- | NMakefile.template | 12 | ||||
-rw-r--r-- | README.W32.template (renamed from README.W32) | 109 | ||||
-rw-r--r-- | acinclude.m4 | 253 | ||||
-rw-r--r-- | config.h.W32.template | 29 | ||||
-rw-r--r-- | configure.in | 13 | ||||
-rw-r--r-- | main.c | 29 | ||||
-rw-r--r-- | maintMakefile | 3 | ||||
-rw-r--r-- | make.h | 8 | ||||
-rw-r--r-- | w32/subproc/sub_proc.c | 27 |
11 files changed, 427 insertions, 125 deletions
@@ -11,9 +11,11 @@ makebook* *.dep *.dvi *.toc *.aux *.log *.cp *.cps *.fn *.fns *.vr *.vrs *.tp *.tps *.ky *.kys *.pg *.pgs -README aclocal.m4 config.h.in config.h configure Makefile.in -build.sh.in build.sh SMakefile config.ami README.DOS Makefile.DOS configh.dos -NMakefile config.h.W32 config.h-vms +README README.DOS README.W32 +aclocal.m4 config.h.in config.h configure Makefile.in +build.sh.in build.sh +SMakefile NMakefile Makefile.DOS +config.ami configh.dos config.h.W32 config.h-vms .deps .dep_segment @@ -1,3 +1,60 @@ +1999-08-30 Paul D. Smith <psmith@gnu.org> + + * README.W32.template: Renamed from README.W32 so it's + autogenerated during the dist. A few minor modifications. + + * configure.in: Check for kstat_open before AC_FUNC_GETLOADAVG + since the latter needs to know whether the former exists to give + an accurate result. + +1999-08-26 Rob Tulloh <rob_tulloh@dev.tivoli.com> + + * NMakefile [WINDOWS32]: Now more robust. If you change a file + under w32/subproc, the make.exe will be relinked. Also added some + tests to make sure erase commands won't fail when executed in a + pristine build environment. + + * w32/subproc/sub_proc.c [WINDOWS32]: Added support for + HAVE_CYGWIN_SHELL. If you are using the Cygwin B20.1 release, it + is now possible to have have native support for this shell without + having to rely on klutzy BATCH_MODE_ONLY_SHELL. + + * config.h.W32 [WINDOWS32]: Added HAVE_CYGWIN_SHELL macro which + users can define if they want to build make to use this shell. + + * README.W32 [WINDOWS32]: Added informaton about + HAVE_CYGWIN_SHELL. Cleaned up text a bit to make it more current. + +1999-08-26 Paul Eggert <eggert@twinsun.com> + + Support large files in AIX, HP-UX, and IRIX. + + * acinclude.m4 (AC_LFS): Remove. Superseded by AC_SYS_LARGEFILE. + (AC_SYS_LARGEFILE_FLAGS, AC_SYS_LARGEFILE_SPACE_APPEND, + AC_SYS_LARGEFILE_MACRO_VALUE, AC_SYS_LARGEFILE): New macros. + (jm_AC_TYPE_UINTMAX_T): Check for busted compilers that can't + shift or divide unsigned long long. + (AM_PROG_CC_STDC): New macro; a temporary workaround of a bug in + automake 1.4. + + * configure.in (AC_CANONICAL_HOST): Add; required by new + AC_SYS_LARGEFILE. + (AC_SYS_LARGEFILE): Renamed from AC_LFS. + (AM_PROG_CC_STDC): Add. + + * config.guess, config.sub: New files, needed for AC_CANONICAL_HOST. + +1999-08-25 Paul Eggert <eggert@twinsun.com> + + * make.h (CHAR_MAX): New macro. + * main.c (struct command_switch): c is now int, + so that it can store values greater than CHAR_MAX. + (switches): Replace small numbers N with CHAR_MAX+N-1, + to avoid problems with non-ASCII character sets. + (short_option): New macro. + (init_switches, print_usage, define_makeflags): Use it instead of + isalnum. + 1999-08-25 Paul D. Smith <psmith@gnu.org> * Version 3.77.94 released. @@ -723,7 +780,7 @@ * arscan.c: Modified to support AIX 4.3 big archives. The changes are based on information provided by Phil Adams - <padams@austin.ibm.com>; thanks! + <padams@austin.ibm.com>. 1999-02-19 Paul D. Smith <psmith@gnu.org> @@ -904,7 +961,7 @@ * configure.in (AC_FUNC_VPRINTF): Check for vprintf()/_doprnt(). - * misc.c(message, error, fatal): Add preprocessor stuff to enable + * misc.c (message, error, fatal): Add preprocessor stuff to enable creation of variable-argument functions with appropriate prototypes, that works with ANSI, pre-ANSI, varargs.h, stdarg.h, v*printf(), _doprnt(), or none of the above. Culled from GNU diff --git a/NMakefile.template b/NMakefile.template index dae24f5..fb799e0 100644 --- a/NMakefile.template +++ b/NMakefile.template @@ -50,8 +50,10 @@ all: config.h subproc Release Debug # subproc: w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib -w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib: +w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib: w32/subproc/misc.c w32/subproc/sub_proc.c w32/subproc/w32err.c subproc.bat $(SUBPROC_MAKEFILE) $(MAKE) + if exist WinDebug\make.exe erase WinDebug\make.exe + if exist WinRel\make.exe erase WinRel\make.exe config.h: config.h.W32 copy $? $@ @@ -62,9 +64,11 @@ Debug: $(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_debug)" CFLAGS="$(CFLAGS_debug)" OUTDIR=WinDebug WinDebug/make.exe clean: - rmdir /s /q WinDebug WinRel - rmdir /s /q w32\subproc\WinDebug w32\subproc\WinRel - erase config.h + if exist WinDebug\nul rmdir /s /q WinDebug + if exist WinRel\nul rmdir /s /q WinRel + if exist w32\subproc\WinDebug\nul rmdir /s /q w32\subproc\WinDebug + if exist w32\subproc\WinRel\nul rmdir /s /q w32\subproc\WinRel + if exist config.h erase config.h erase *.pdb $(OUTDIR): diff --git a/README.W32 b/README.W32.template index ca7f32c..2b15584 100644 --- a/README.W32 +++ b/README.W32.template @@ -1,7 +1,11 @@ Port of GNU make to Windows NT and Windows 95 Builds natively with MSVC 2.x or MSVC 4.x compilers. +Should also build fine with MSVC 5.x and 6.x (though not confirmed). -To build with nmake on Windows NT or Windows 95: +This Windows 32-bit port of GNU make is maintained primarily by Rob +Tulloh, who is also the author of this README. + +To build with nmake on Windows NT, Windows 95, or Windows 98: 1. Make sure cl.exe is in your %Path%. Example: @@ -18,6 +22,15 @@ To build with nmake on Windows NT or Windows 95: 4. nmake /f NMakefile + A short cut to steps 1, 2, and 3 is to run VCVARS32.bat before + invoking namke. For example: + + c: + cd \msdev\bin + VCVARS32.bat + cd \path\to\make-%VERSION% + nmake /f NMakefile + There is a bat file (build_w32.bat) for folks who have fear of nmake. Outputs: @@ -28,47 +41,58 @@ Outputs: -- Notes/Caveats -- +GNU make on Windows 32-bit platforms: + + This version of make is ported natively to Windows32 platforms + (Windows NT 3.51, Windows NT 4.0, Windows 95, and Windows 98). It + does not rely on any 3rd party software or add-on packages for + building. The only thing needed is a version of Visual C++, + which is the predominant compiler used on Windows32 platforms. + + Do not confuse this port of GNU make with other Windows32 projects + which provide a GNU make binary. These are separate projects + and are not connected to this port effort. + GNU make and sh.exe: This port prefers you have a working sh.exe somewhere on your - system. If you don't have sh.exe, port falls back to + system. If you don't have sh.exe, the port falls back to MSDOS mode for launching programs (via a batch file). - The MSDOS mode style execution has not been tested too - carefully though (I use GNU bash as sh.exe). + The MSDOS mode style execution has not been tested that + carefully though (The author uses GNU bash as sh.exe). There are very few true ports of Bourne shell for NT right now. - There is a version of GNU bash available from Cygnus gnu-win32 - porting effort. Other possibilities are to get the MKS version - of sh.exe or to build your own with a package like - NutCracker (DataFocus) or Portage (Consensys). + There is a version of GNU bash available from Cygnus "Cygwin" + porting effort (http://sourceware.cygnus.com/cygwin). + Other possibilities are the MKS version of sh.exe, or building + your own with a package like NutCracker (DataFocus) or Portage + (Consensys). - Tivoli uses a homegrown port of GNU bash which is not (yet) - freely available. It may be available someday, but I am not in control - of this decision nor do I influence it. Sorry! +GNU make and brain-dead shells (BATCH_MODE_ONLY_SHELL): -GNU make and Cygnus GNU WIN32 tools (BATCH_MODE_ONLY_SHELL) - - GNU make now has support for the Cygnus GNU WIN32 toolset. The - GNU WIN32 version of Bourne shell does not behave well when - invoked as 'sh -c' from CreateProcess(). The main problem is it - seems to have a hard time handling quoted strings correctly. This - problem goes away when invoking the Cygnus shell on a shell script. + Some versions of Bourne shell does not behave well when invoked + as 'sh -c' from CreateProcess(). The main problem is they seem + to have a hard time handling quoted strings correctly. This can + be circumvented by writing commands to be executed to a batch + file and then executing the command by calling 'sh file'. To work around this difficulty, this version of make supports - a new batch mode. When BATCH_MODE_ONLY_SHELL is defined at compile + a batch mode. When BATCH_MODE_ONLY_SHELL is defined at compile time, make forces all command lines to be executed via script files instead of by command line. - A native WIN32 system with no Bourne shell will also run + A native Windows32 system with no Bourne shell will also run in batch mode. All command lines will be put into batch files and executed via $(COMSPEC) (%COMSPEC%). - If you wish to use Cygnus' GNUWIN32 shell, be sure you define - BATCH_MODE_ONLY_SHELL in the config.h.W32 prior to building make. - The new feataure was tested with the b18 version of the Cygnus - user tools. +GNU make and Cygnus GNU Windows32 tools: + + Good news! Make now has native support for Cygwin sh. To enable, + define the HAVE_CYGWIN_SHELL in config.h and rebuild make + from scratch. This version of make tested with B20.1 of Cygwin. + Do not define BATCH_MODE_ONLY_SHELL if you use HAVE_CYGWIN_SHELL. -GNU make and MKS shell +GNU make and the MKS shell: There is now semi-official support for the MKS shell. To turn this support on, define HAVE_MKS_SHELL in the config.h.W32 before you @@ -101,9 +125,6 @@ GNU make handling of drive letters in pathnames (PATH, vpath, VPATH): /some/path/x:/some/path/y x:/some/path/x:x:/some/path/y - These caveats affect Windows systems only (Windows NT and - Windows 95) and can be ignored for other platforms. - Please note that you are free to mix colon and semi-colon in the specification of paths. Make is able to figure out the intended result and convert the paths internally to the format needed @@ -118,25 +139,27 @@ GNU make handling of drive letters in pathnames (PATH, vpath, VPATH): GNU make test suite: I verified all functionality with a slightly modified version - of make-test-0.4.5 (modifications to get test suite to run + of make-test-%VERSION% (modifications to get test suite to run on Windows NT). All tests pass in an environment that includes - sh.exe. Tested on both Windows NT and Windows 95. + sh.exe. Tests were performed on both Windows NT and Windows 95. -Building GNU make on Windows NT and Windows 95 with Microsoft Visual C +Building GNU make on Windows NT and Windows 95/98 with Microsoft Visual C: I did not provide a Visual C project file with this port as the project file would not be considered freely distributable - (or so I think). It is easy enough to create one though if + (or so I think). It is easy enough to create one, though, if you know how to use Visual C. I build the program statically to avoid problems locating DLL's on machines that may not have MSVC runtime installed. If you prefer, you can change make to build with shared libraries by - changing /MT to /MD in the NMakefile (or build_w32.bat). + changing /MT to /MD in the NMakefile (or in build_w32.bat). - Program has not been built under non-Intel architectures (yet). + The program has not been built for non-Intel architectures (yet). - I have not tried to build with any other compilers than MSVC. + I have not tried to build with any other compilers than MSVC. I + have heard that this is possible though so don't be afraid to + notify me of your successes! Pathnames and white space: @@ -206,17 +229,13 @@ SAMBA/NTFS/VFAT: under VFAT. VFAT users may wish to be aware that this port of make does respect case sensitivity. - Version 3.76 contains some preliminary support for FAT. Make - now tries to work around some difficulties with stat'ing of +FAT: + + Version 3.76 added support for FAT filesystems. Make + works around some difficulties with stat'ing of files and caching of filenames and directories internally. - There is still a known problem with filenames sometimes being - found to have modification dates in the future which cause make - to complain about the file and exit (remake.c). Bug reports: - Please submit bugs via the normal bug reporting mechanism - which is described in one of the Texinfo files. If you don't - have Texinfo for Windows NT or Windows 95, these files are simple - text files and can be read with a text editor. - + Please submit bugs via the normal bug reporting mechanism which + is described in the GNU make manual and the base README. diff --git a/acinclude.m4 b/acinclude.m4 index 8f4faff..574ea37 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -85,50 +85,123 @@ changequote([,])dnl ])dnl dnl --------------------------------------------------------------------------- -dnl Got this from the GNU fileutils 3.16r distribution +dnl Got this from the GNU tar 1.13.11 distribution dnl by Paul Eggert <eggert@twinsun.com> dnl --------------------------------------------------------------------------- -dnl The problem is that the default compilation flags in Solaris 2.6 won't -dnl let programs access large files; you need to tell the compiler that -dnl you actually want your programs to work on large files. For more -dnl details about this brain damage please see: +dnl By default, many hosts won't let programs access large files; +dnl one must use special compiler options to get large-file access to work. +dnl For more details about this brain damage please see: dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html -AC_DEFUN(AC_LFS, -[dnl - # If available, prefer support for large files unless the user specified - # one of the CPPFLAGS, LDFLAGS, or LIBS variables. - AC_MSG_CHECKING(whether large file support needs explicit enabling) - ac_getconfs='' - ac_result=yes - ac_set='' - ac_shellvars='CPPFLAGS LDFLAGS LIBS' - for ac_shellvar in $ac_shellvars; do - case $ac_shellvar in - CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;; - *) ac_lfsvar=LFS_$ac_shellvar ;; - esac - eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar - (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } - ac_getconf=`getconf $ac_lfsvar` - ac_getconfs=$ac_getconfs$ac_getconf - eval ac_test_$ac_shellvar=\$ac_getconf - done - case "$ac_result$ac_getconfs" in - yes) ac_result=no ;; - esac - case "$ac_result$ac_set" in - yes?*) ac_result="yes, but $ac_set is already set, so use its settings" - esac - AC_MSG_RESULT($ac_result) - case $ac_result in - yes) - for ac_shellvar in $ac_shellvars; do - eval $ac_shellvar=\$ac_test_$ac_shellvar - done ;; - esac -]) +dnl Written by Paul Eggert <eggert@twinsun.com>. + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME) +AC_DEFUN(AC_SYS_LARGEFILE_FLAGS, + [AC_CACHE_CHECK([for $1 value to request large file support], + ac_cv_sys_largefile_$1, + [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || { + ac_cv_sys_largefile_$1=no + ifelse($1, CFLAGS, + [case "$host_os" in + # IRIX 6.2 and later require cc -n32. +changequote(, )dnl + irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*) +changequote([, ])dnl + if test "$GCC" != yes; then + ac_cv_sys_largefile_CFLAGS=-n32 + fi + ac_save_CC="$CC" + CC="$CC $ac_cv_sys_largefile_CFLAGS" + AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no) + CC="$ac_save_CC" + esac]) + }])]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL) +AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND, + [case $2 in + no) ;; + ?*) + case "[$]$1" in + '') $1=$2 ;; + *) $1=[$]$1' '$2 ;; + esac ;; + esac]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT) +AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, + [AC_CACHE_CHECK([for $1], $2, + [$2=no +changequote(, )dnl + $4 + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + -D$1) + $2=1 ;; + -D$1=*) + $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; + esac + done +changequote([, ])dnl + ]) + if test "[$]$2" != no; then + AC_DEFINE_UNQUOTED([$1], [$]$2, [$3]) + fi]) + +AC_DEFUN(AC_SYS_LARGEFILE, + [AC_REQUIRE([AC_CANONICAL_HOST]) + AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) + if test "$enable_largefile" != no; then + AC_CHECK_TOOL(GETCONF, getconf) + AC_SYS_LARGEFILE_FLAGS(CFLAGS) + AC_SYS_LARGEFILE_FLAGS(LDFLAGS) + AC_SYS_LARGEFILE_FLAGS(LIBS) + + for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do + case "$ac_flag" in + no) ;; + -D_FILE_OFFSET_BITS=*) ;; + -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;; + -D_LARGE_FILES | -D_LARGE_FILES=*) ;; + -D?* | -I?*) + AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;; + *) + AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;; + esac + done + AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS") + AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS") + AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + [case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_file_offset_bits=64 ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, + ac_cv_sys_largefile_source, + [Define to make fseeko etc. visible, on some hosts.], + [case "$host_os" in + # HP-UX 10.20 and later + hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) + ac_cv_sys_largefile_source=1 ;; + esac]) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + [case "$host_os" in + # AIX 4.2 and later + aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) + ac_cv_sys_large_files=1 ;; + esac]) + fi + ]) dnl --------------------------------------------------------------------------- @@ -197,8 +270,9 @@ AC_DEFUN(jm_AC_TYPE_UINTMAX_T, AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) if test $jm_ac_cv_header_inttypes_h = no; then AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, - [AC_TRY_COMPILE([], - [unsigned long long i = (unsigned long long) -1;], + [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], + [unsigned long long ullmax = (unsigned long long) -1; + return ull << i | ull >> i | ullmax / ull | ullmax % ull;], ac_cv_type_unsigned_long_long=yes, ac_cv_type_unsigned_long_long=no)]) if test $ac_cv_type_unsigned_long_long = yes; then @@ -297,3 +371,100 @@ changequote([,]),dnl AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast) fi ]) + + +# The following is taken from automake 1.4, +# except that it prefers the compiler option -Ae to "-Aa -D_HPUX_SOURCE" +# because only the former supports 64-bit integral types on HP-UX 10.20. + +## ----------------------------------------- ## +## ANSIfy the C compiler whenever possible. ## +## From Franc,ois Pinard ## +## ----------------------------------------- ## + +# serial 2 + +# @defmac AC_PROG_CC_STDC +# @maindex PROG_CC_STDC +# @ovindex CC +# If the C compiler in not in ANSI C mode by default, try to add an option +# to output variable @code{CC} to make it so. This macro tries various +# options that select ANSI C on some system or another. It considers the +# compiler to be in ANSI C mode if it handles function prototypes correctly. +# +# If you use this macro, you should check after calling it whether the C +# compiler has been set to accept ANSI C; if not, the shell variable +# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +# code in ANSI C, you can make an un-ANSIfied copy of it by using the +# program @code{ansi2knr}, which comes with Ghostscript. +# @end defmac + +AC_DEFUN(AM_PROG_CC_STDC, +[AC_REQUIRE([AC_PROG_CC]) +AC_BEFORE([$0], [AC_C_INLINE]) +AC_BEFORE([$0], [AC_C_CONST]) +dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require +dnl a magic option to avoid problems with ANSI preprocessor commands +dnl like #elif. +dnl FIXME: can't do this because then AC_AIX won't work due to a +dnl circular dependency. +dnl AC_BEFORE([$0], [AC_PROG_CPP]) +AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) +AC_CACHE_VAL(am_cv_prog_cc_stdc, +[am_cv_prog_cc_stdc=no +ac_save_CC="$CC" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( +[#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT($am_cv_prog_cc_stdc) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) diff --git a/config.h.W32.template b/config.h.W32.template index 402db81..b980539 100644 --- a/config.h.W32.template +++ b/config.h.W32.template @@ -337,16 +337,35 @@ */ /* - Define if you have the Cygnus GNU WIN32 tool set or a shell - that does not grok 'sh -c quoted-command-line' correctly. + * If you have a shell that does not grok 'sh -c quoted-command-line' + * correctly, you need this setting. Please see below for specific + * shell support. */ #undef BATCH_MODE_ONLY_SHELL +#define BATCH_MODE_ONLY_SHELL 1 /* - Define if you have the MKS tool set or shell. Do NOT define - BATCH_MODE_ONLY_SHELL if you define HAVE_MKS_SHELL + * Define if you have the Cygnus "Cygwin" GNU Windows32 tool set. + * Do NOT define BATCH_MODE_ONLY_SHELL if you define HAVE_CYGWIN_SHELL + */ +#undef HAVE_CYGWIN_SHELL + +/* + * Define if you have the MKS tool set or shell. Do NOT define + * BATCH_MODE_ONLY_SHELL if you define HAVE_MKS_SHELL */ #undef HAVE_MKS_SHELL -/* Define if you prefer Case Insensitve behavior */ +/* + * Enforce the mutual exclusivity restriction. + */ +#ifdef HAVE_MKS_SHELL +#undef BATCH_MODE_ONLY_SHELL +#endif + +#ifdef HAVE_CYGWIN_SHELL +#undef BATCH_MODE_ONLY_SHELL +#endif + +/* Define if you prefer Case Insensitive behavior */ #undef HAVE_CASE_INSENSITIVE_FS diff --git a/configure.in b/configure.in index 9cc0b05..00958cd 100644 --- a/configure.in +++ b/configure.in @@ -3,11 +3,12 @@ AC_REVISION([$Id$]) AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required. AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir. -AM_INIT_AUTOMAKE(make, 3.77.94) +AM_INIT_AUTOMAKE(make, 3.77.95) AM_CONFIG_HEADER(config.h) dnl Regular configure stuff +AC_CANONICAL_HOST AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_INSTALL @@ -21,7 +22,7 @@ AC_MINIX dnl This test must come as early as possible after the compiler configuration dnl tests, because the choice of the file model can (in principle) affect dnl whether functions and headers are available, whether they work, etc. -AC_LFS +AC_SYS_LARGEFILE AC_HEADER_STDC AC_HEADER_DIRENT @@ -31,6 +32,7 @@ AC_TYPE_SIGNAL AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/param.h fcntl.h string.h \ memory.h sys/timeb.h) AC_PROG_CC_C_O +AM_PROG_CC_STDC AC_C_CONST dnl getopt needs this. AC_HEADER_STAT @@ -66,9 +68,10 @@ AC_FUNC_VPRINTF AC_FUNC_STRCOLL AC_FUNC_CLOSEDIR_VOID AC_FUNC_SETVBUF_REVERSED -AC_FUNC_GETLOADAVG AC_FUNC_SELECT -AC_CHECK_LIB(kstat, kstat_open) + +AC_CHECK_LIB(kstat, kstat_open) dnl _Must_ come before AC_FUNC_GETLOADAVG. +AC_FUNC_GETLOADAVG # Check out the wait reality. AC_CHECK_HEADERS(sys/wait.h) @@ -207,7 +210,7 @@ esac MAINT_MAKEFILE=/dev/null -if test -r $srcdir/maintMakefile; then +if test -r "$srcdir/maintMakefile"; then MAINT_MAKEFILE="$srcdir/maintMakefile" fi AC_SUBST_FILE(MAINT_MAKEFILE) @@ -79,7 +79,7 @@ static char *quote_as_word PARAMS ((char *out, char *in, int double_dollars)); struct command_switch { - unsigned char c; /* The switch character. */ + int c; /* The switch character. */ enum /* Type of the value. */ { @@ -106,6 +106,9 @@ struct command_switch /* 0 means internal; don't display help. */ }; +/* True if C is a switch value that corresponds to a short option. */ + +#define short_option(c) ((c) <= CHAR_MAX) /* The structure used to hold the list of strings given in command switches of a type that takes string arguments. */ @@ -281,7 +284,7 @@ static const struct command_switch switches[] = (char *) &inf_jobs, (char *) &default_job_slots, "jobs", "N", _("Allow N jobs at once; infinite jobs with no arg") }, - { 2, string, (char *) &jobserver_fds, 1, 1, 0, 0, 0, + { CHAR_MAX+1, string, (char *) &jobserver_fds, 1, 1, 0, 0, 0, "jobserver-fds", 0, 0 }, { 'k', flag, (char *) &keep_going_flag, 1, 1, 0, @@ -336,13 +339,13 @@ static const struct command_switch switches[] = { 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0, "print-directory", 0, _("Print the current directory") }, - { 3, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0, + { CHAR_MAX+2, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0, "no-print-directory", 0, _("Turn off -w, even if it was turned on implicitly") }, { 'W', string, (char *) &new_files, 0, 0, 0, 0, 0, "what-if", _("FILE"), _("Consider FILE to be infinitely new") }, - { 4, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0, + { CHAR_MAX+3, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0, "warn-undefined-variables", 0, _("Warn when an undefined variable is referenced") }, { '\0', } @@ -1790,7 +1793,7 @@ init_switches () switches[i].long_name); long_options[i].flag = 0; long_options[i].val = switches[i].c; - if (isalnum (switches[i].c)) + if (short_option (switches[i].c)) *p++ = switches[i].c; switch (switches[i].type) { @@ -1803,11 +1806,11 @@ init_switches () case string: case positive_int: case floating: - if (isalnum (switches[i].c)) + if (short_option (switches[i].c)) *p++ = ':'; if (switches[i].noarg_value != 0) { - if (isalnum (switches[i].c)) + if (short_option (switches[i].c)) *p++ = ':'; long_options[i].has_arg = optional_argument; } @@ -1932,7 +1935,7 @@ print_usage (bad) p = buf; - if (isalnum (cs->c)) + if (short_option (cs->c)) { sprintf (buf, " -%c%s", cs->c, shortarg); p += strlen (p); @@ -1941,7 +1944,7 @@ print_usage (bad) { unsigned int i; sprintf (p, "%s--%s%s", - !isalnum (cs->c) ? " " : ", ", + !short_option (cs->c) ? " " : ", ", cs->long_name, longarg); p += strlen (p); for (i = 0; i < (sizeof (long_option_aliases) / @@ -2282,7 +2285,7 @@ define_makeflags (all, makefile) ++flagslen; /* Just a single flag letter. */ \ else \ flagslen += 1 + 1 + 1 + 1 + 3 * (LEN); /* " -x foo" */ \ - if (!isalnum (cs->c)) \ + if (!short_option (cs->c)) \ /* This switch has no single-letter version, so we use the long. */ \ flagslen += 2 + strlen (cs->long_name); \ } while (0) @@ -2380,7 +2383,7 @@ define_makeflags (all, makefile) while (flags != 0) { /* Add the flag letter or name to the string. */ - if (!isalnum (flags->cs->c)) + if (!short_option (flags->cs->c)) { *p++ = '-'; strcpy (p, flags->cs->long_name); @@ -2397,7 +2400,7 @@ define_makeflags (all, makefile) if (flags->arg[0] != '\0') { /* Add its argument too. */ - *p++ = !isalnum (flags->cs->c) ? '=' : ' '; + *p++ = !short_option (flags->cs->c) ? '=' : ' '; p = quote_as_word (p, flags->arg, 1); } ++words; @@ -2405,7 +2408,7 @@ define_makeflags (all, makefile) *p++ = ' '; *p++ = '-'; } - else if (!isalnum (flags->cs->c)) + else if (!short_option (flags->cs->c)) { ++words; /* Long options must each go in their own word, diff --git a/maintMakefile b/maintMakefile index 108381b..659efa5 100644 --- a/maintMakefile +++ b/maintMakefile @@ -8,7 +8,8 @@ globsrc := $(wildcard glob/*.c) globhdr := $(wildcard glob/*.h) -TEMPLATES = README README.DOS config.ami configh.dos config.h.W32 config.h-vms +TEMPLATES = README README.DOS README.W32 \ + config.ami configh.dos config.h.W32 config.h-vms MTEMPLATES = Makefile.DOS SMakefile # We need this to ensure that README and build.sh.in are created on time to @@ -77,8 +77,8 @@ Boston, MA 02111-1307, USA. */ extern int errno; #endif -/* A shortcut for EINTR checking. Note you should never negate this! That - very likely doesn't mean what you want if EINTR is not available. */ +/* A shortcut for EINTR checking. Note you should be careful when negating + this! That might not mean what you want if EINTR is not available. */ #ifdef EINTR # define EINTR_SET (errno == EINTR) #else @@ -171,6 +171,10 @@ extern unsigned int get_path_max PARAMS ((void)); (! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)) #define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t)) +#ifndef CHAR_MAX +# define CHAR_MAX INTEGER_TYPE_MAXIMUM (char) +#endif + #ifdef STAT_MACROS_BROKEN # ifdef S_ISREG # undef S_ISREG diff --git a/w32/subproc/sub_proc.c b/w32/subproc/sub_proc.c index 300bb7b..1cf3bea 100644 --- a/w32/subproc/sub_proc.c +++ b/w32/subproc/sub_proc.c @@ -8,7 +8,9 @@ #include "w32err.h" #include "config.h" -static char *make_command_line( char *shell_name, char *exec_path, char **argv); +static char *make_command_line(char *shell_name, char *exec_path, char **argv); + +extern int debug_flag; /* from make */ typedef struct sub_process_t { int sv_stdin[2]; @@ -504,6 +506,10 @@ process_begin( if (envblk) free(envblk); return -1; } else { + if (debug_flag) + printf("CreateProcess(%s,%s,...)\n", + exec_path ? exec_path : "NULL", + command_line ? command_line : "NULL"); if (CreateProcess( exec_path, command_line, @@ -912,6 +918,13 @@ make_command_line( char *shell_name, char *full_exec_path, char **argv) unsigned int bytes_required = 0; char* command_line; char* command_line_i; + int cygwin_mode = 0; /* HAVE_CYGWIN_SHELL */ + int have_sh = 0; /* HAVE_CYGWIN_SHELL */ + +#ifdef HAVE_CYGWIN_SHELL + have_sh = (shell_name != NULL || strstr(full_exec_path, "sh.exe")); + cygwin_mode = 1; +#endif if (shell_name && full_exec_path) { bytes_required @@ -964,7 +977,7 @@ make_command_line( char *shell_name, char *full_exec_path, char **argv) backslash_count = 0; break; -#ifndef HAVE_MKS_SHELL +#if !defined(HAVE_MKS_SHELL) && !defined(HAVE_CYGWIN_SHELL) case '\\': backslash_count++; break; @@ -1058,6 +1071,11 @@ make_command_line( char *shell_name, char *full_exec_path, char **argv) while(*p) { if (*p == '\"') { + if (cygwin_mode && have_sh) { /* HAVE_CYGWIN_SHELL */ + /* instead of a \", cygwin likes "" */ + *(command_line_i++) = '\"'; + } else { + /* * We have to insert a backslash for the " * and each \ that precedes the ". @@ -1068,7 +1086,8 @@ make_command_line( char *shell_name, char *full_exec_path, char **argv) *(command_line_i++) = '\\'; backslash_count--; }; -#ifndef HAVE_MKS_SHELL + } +#if !defined(HAVE_MKS_SHELL) && !defined(HAVE_CYGWIN_SHELL) } else if (*p == '\\') { backslash_count++; } else { @@ -1083,7 +1102,7 @@ make_command_line( char *shell_name, char *full_exec_path, char **argv) } if (*enclose_in_quotes_i) { -#ifndef HAVE_MKS_SHELL +#if !defined(HAVE_MKS_SHELL) && !defined(HAVE_CYGWIN_SHELL) /* * Add one \ for each \ that precedes the * closing ". |