Re: Fixing broken djgpp support in make 3.81

2008-01-15 Thread Juan Manuel Guerrero
Hello Paul:

[snip]
 It seems like the amount of change you've made will require
 copyright assignment.  I see you've already done some of these,
 for Bison etc., but if you need paperwork let me know.

Please send the required paperwork to me or let me known
where I can get it and I will sign the copyright assignment.


 As for the above, I wonder whether it might be useful to add:

   # define HAVE_DRIVE(n)0

 for the non-HAVE_DOS_PATHS sections of the above ifdef.  That would
 allow us to use HAVE_DRIVE(foo) without enclosing it in ifdefs for DOS
 etc., and still have the compiler omit the code (via optimization of
 always-false values).

You are right and that is the way i would do it but an inspection of
the make code showed me that all code lines where the macro can be used
were enclosed by ifdefs for DOS, so I have assumed that this was the
prefered coding style and in such a case it made no much sense to me
to define macros that would never be used for other OSs.  If some day
someone decides to criticaly review the existing code, one of the goals
should be to get rid of all these #ifdef HAVE_DOS_PATHS and VMS (if
possible at all) and to replace that code with some generic path syntax
handling code that will make use of such macros to hide OS path syntax
peculiarities.  Then it will become responsability of the different
port maintainers to provide adecuate macros to handle the issue.


I resend the patch with included empty/false definitions of HAVE_DRIVE
for the other OSs in make.h and also fixed character set issues I have
noticed to late in the changelog text.


Regards,
Juan M. Guerrero



2008-01-15  Juan Manuel Guerrero  [EMAIL PROTECTED]

* implicit.c: Add const qualifier to *lastslash so it matches the
declaration of *filename.

* dir.c (file_exists_p) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.
(file_impossible) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.
(file_impossible_p) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.

* function.c [HAVE_DOS_PATHS, VMS]: Remove IS_PATHSEP definition.
Now it is defined in its canonical place in make.h.
(abspath) [HAVE_DOS_PATHS]: Use IS_PATHSEP instead of a literal '/'.
Support d:foo style absolute file names.
Add logic for the case that backslash are path separators too.
Include colon as separator char in the IS_PATHSEP definition and
use it to check for root char.
(func_notdir_suffix, func_basename_dir, abspath): Use HAVE_DRIVE.

* glob/glob.c (my_realloc): Don't define, and don't redefine realloc
to call it since the DJGPP realloc handles NULL pointers.

* hash.c (round_up_2): Use 4294967295U to avoid compiler warnings.

* implicit.c (pattern_search) [HAVE_DOS_PATHS]: Use HAVE_DRIVE.

* make.h: All OS specific macros to handle path syntax peculiarities
are defined here.
[HAVE_DOS_PATHS]: New macro HAVE_DRIVE to check for drive specifier
strings like 'a:'.  For all other supported OSs this macro is a no
operation.
[HAVE_DOS_PATHS, VMS]:  Define macro IS_PATHSEP.  Previous definition
in function.c removed accordingly.

* Makefile.DOS.template (INCLUDES): Use $(prefix) and the corresponding
variables to define LIBDIR, INCLUDEDIR and LOCALEDIR instead of using
the hardcoded ones.
(SUBDIRS): doc subdir added.
(INFO_DEPS, DVIS): Values changed to 'make.info' and 'make.dvi'.
(TEXI2HTML, TEXI2HTML_FLAGS): Removed.  Use makeinfo --html to
create html formated docs.  texi2html may not be ported to DOS.
(make.info, make.dvi, make.ps, make.html): Make targets depend on
'make.texi'.
(.texi.info, .texi, .texi.dvi): Now recursively invocate.  Change
-I switch to look in ./ instead of ./doc.
(html): Target depend on html-recursive instead of make_1.html.
(make_1.html): Removed.
(mostlyclean-aminfo): Use $(srcdir)/doc instead of ./ as prefix.
(all-recursive): Allow for more than one subdir in the build process.
(mostlyclean-recursive, clean-recursive, distclean-recursive,
maintainer-clean-recursive, check-recursive): Enter in doc/ too.
(tags-recursive): Allow for more than one subdir in the build process.
(info-recursive, dvi-recursive, ps-recursive, html-recursive): New
targets.  Enter into doc/ to produce the targets.
(all-am): $(INFO_DEPS) replaced by info.

* dosbuild.bat: Add -DLOCALEDIR to compiler command line to compile
main.c.
Remove make.new if build successfull.
Use /dev/env/DJDIR instead of c:/djgpp for -DINCLUDEDIR and
-DLOCALEDIR.

* tests/scripts/functions/abspath: Added new MSDOS specific tests.
They reproduce the complete test cases adding up to three new test
cases but using backslash instead of slash as dir separator and
prepending a DOS typical 

Re: Fixing broken djgpp support in make 3.81

2008-01-14 Thread Paul Smith
On Tue, 2008-01-15 at 01:32 +0100, Juan Manuel Guerrero wrote:
 /* Handle other OSs.  */
 #ifndef PATH_SEPARATOR_CHAR
 # if defined(HAVE_DOS_PATHS)
 #  define PATH_SEPARATOR_CHAR ';'
 #  define IS_PATHSEP(c)   ((c) == '/' || (c) == '\\')
 #  define HAVE_DRIVE(n)   ((n)[0]  (n)[1] == ':')
 # elif defined(VMS)
 #  define PATH_SEPARATOR_CHAR ','
 #  define IS_PATHSEP(c)   ((c) == ']')
 # else
 #  define PATH_SEPARATOR_CHAR ':'
 #  define IS_PATHSEP(c)   ((c) == '/')
 # endif
 #endif

Hi Juan; it's great to have someone paying some attention to this port
again.  It seems like the amount of change you've made will require
copyright assignment.  I see you've already done some of these, for
Bison etc., but if you need paperwork let me know.

As for the above, I wonder whether it might be useful to add:

  # define HAVE_DRIVE(n)0

for the non-HAVE_DOS_PATHS sections of the above ifdef.  That would
allow us to use HAVE_DRIVE(foo) without enclosing it in ifdefs for DOS
etc., and still have the compiler omit the code (via optimization of
always-false values).

-- 
---
 Paul D. Smith [EMAIL PROTECTED]  Find some GNU make tips at:
 http://www.gnu.org  http://make.mad-scientist.us
 Please remain calm...I may be mad, but I am a professional. --Mad Scientist


___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


Re: Fixing broken djgpp support in make 3.81

2007-12-22 Thread Eli Zaretskii
 From: Juan Manuel Guerrero [EMAIL PROTECTED]
 Date: Thu, 15 Nov 2007 05:39:46 +0100
 Cc: 
 
 I have appended a small patch that shows the things I had to change to get a
 working make binary.  That patch is not intended to be used.  It shall only
 show the code lines that may need to be adjusted to solve the problems.  There
 may be better ways to solve the issue, but I am not familiar enough with the
 make sources to provide a better patch.  There may be also much more MSDOS or
 DJGPp specific things that may be fixed.  The patch only fixes things that I 
 am
 aware.  Things that may cause trouble are drive letters, checks for absolute
 patch, etc, etc etc.  The usual DOS/WINDOWS things.

Thanks, Juan.  Your warnings notwithstanding, I did install your
patches.  I no longer have time to do any significant work on the
DJGPP port of Make, so installing your changes will at least give
DJGPP users a binary that works better than with the original sources.

 I have not waiste my time trying to fix the Makefile.DOS, but now that 
 make.texi
 has been moved into /doc it needs to be adjusted accordingly.  It would be 
 nice
 if rules for dvi, ps, pdf and html could be added.  It would also be usefull
 not to split the MSDOS version of make.info anymore.  The extensions 
 .info-[0-9]
 are changed to .i[0-9] to acomplish with the 8.3 file name rule but it is 
 always
 forgotten to adjust the file name strings in make.info accordingly.  All this
 difficulties can be avoided by no spliting the info formated docs anymore.

Please note that dvi and ps are already supported, and pdf is not
supported on any platform.  I made all the other changes you
suggested; please see the patches below.

Thanks again for your efforts supporting DJGPP ports in general, and
Make in particular.

2007-12-22  Eli Zaretskii  [EMAIL PROTECTED]

Suggested by Juan Manuel Guerrero [EMAIL PROTECTED]:

* Makefile.DOS.template (info_TEXINFOS): Remove unused variable.
(TEXINFOS): Value changed to `doc/make.texi'.
(.SUFFIXES): Use .texi instead of .texinfo.
(make.info, make.dvi): Depend on doc/make.texi.
(.texi.info): New target, instead of .texinfo.info.  Change -I
switch to $(MAKEINFO) to look in doc/.  Use --no-split.
(.texi): New target, instead of .texinfo.  Change -I switch to
$(MAKEINFO) to look in doc/.  Use --no-split.
(.texi.dvi): New target, instead of .texinfo.dvi.  Change -I
switch to $(MAKEINFO) to look in doc/.
(install-info-am, uninstall-info): Don't look for *.i[0-9] and
*.i[0-9][0-9] (due to --no-split above).
(noinst_TEXINFOS, TEXI2HTML, TEXI2HTML_FLAGS): New variables.
(html, make_1.html): New targets.
(.PHONY): Add html.
(.SUFFIXES): Add .html.


Index: Makefile.DOS.template
===
RCS file: /sources/make/make/Makefile.DOS.template,v
retrieving revision 2.15
diff -u -r2.15 Makefile.DOS.template
--- Makefile.DOS.template   4 Jul 2007 19:35:16 -   2.15
+++ Makefile.DOS.template   22 Dec 2007 12:04:40 -
@@ -83,7 +83,6 @@
 libglob_a_SOURCES =%GLOB_SOURCES%
 make_LDADD = glob/libglob.a
 
-info_TEXINFOS =make.texinfo
 man_MANS = make.1
 
 INCLUDES = -I$(srcdir)/glob -DLIBDIR=\c:/djgpp/lib\ 
-DINCLUDEDIR=\c:/djgpp/include\ -DLOCALEDIR=\$(localedir)\
@@ -118,10 +117,14 @@
 TEXINFO_TEX = $(srcdir)/config/texinfo.tex
 INFO_DEPS = make.info
 DVIS = make.dvi
-TEXINFOS = make.texinfo
+TEXINFOS = doc/make.texi
+noinst_TEXINFOS = doc/fdl.texi doc/make-stds.texi
 man1dir = $(mandir)/man1
 MANS = $(man_MANS)
 
+TEXI2HTML = texi2html
+TEXI2HTML_FLAGS = -split_chapter
+
 NROFF = nroff
 DIST_COMMON =  README ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL Makefile.am  
Makefile.in NEWS acconfig.h aclocal.m4 alloca.c build.sh-in config.h-in  
configure configure.in getloadavg.c
 
@@ -136,7 +139,7 @@
 default: all
 
 .SUFFIXES:
-.SUFFIXES: .c .dvi .info .o .obj .ps .texinfo .tex
+.SUFFIXES: .c .dvi .info .o .obj .ps .texi .tex .html
 
 mostlyclean-hdr:
 
@@ -186,33 +189,41 @@
@command.com /c if exist make.exe del make.exe
$(LINK) $(make_LDFLAGS) $(make_OBJECTS) $(make_LDADD) $(LIBS)
 
-make.info: make.texinfo
-make.dvi: make.texinfo
+# Documentation
+
+make.info: doc/make.texi
+make.dvi: doc/make.texi
 
 
 DVIPS = dvips
 
-.texinfo.info:
+.texi.info:
@command.com /c if exist make.info* del make.info*
@command.com /c if exist make.i* del make.i*
-   $(MAKEINFO) -I$(srcdir) $ -o ./$@
+   $(MAKEINFO) -I$(srcdir)/doc --no-split $ -o ./$@
 
-.texinfo:
+.texi:
@command.com /c if exist make.info* del make.info*
@command.com /c if exist make.i* del make.i*
-   $(MAKEINFO) -I$(srcdir) $ -o ./$@
-
-.texinfo.dvi:
-   TEXINPUTS=$(srcdir);$$TEXINPUTSMAKEINFO='$(MAKEINFO) -I 
$(srcdir)' $(TEXI2DVI) $
+   $(MAKEINFO) -I$(srcdir)/doc --no-split $ -o ./$@
 

Fixing broken djgpp support in make 3.81

2007-11-20 Thread Juan Manuel Guerrero
The djgpp specific support of make 3.81 is brocken.  There are two sources for
this:
1) failure of the compilation stage.
   It is not possible to compile the sources out-of-the-box because:
   - configh.dos defines HAVE_SYS_SIGLIST instead of HAVE_DECL_SYS_SIGLIST
 what is the macro name that is checked for in signame.c
   - in job.c the function child_execute_job is compiled when __MSDOS__ is
 defined.  This is wrong; the DJGPP port uses directly system() and
 spawnvpe() in start_job_command.  There is no MSDOS/DJGPP version of
 child_execute_job at all.
   These two issues had to been fixed before it was possible to compile the
   successfully the sources.
   There is also a mismatch of the function prototype of my_realloc in glob.c
   with realloc() of djgpp's libc, but this only causes a compiler warning and
   does not stop the show.  Neitherless it is woth to be fixed; see patch.

2) failure of the produced binary when used with an OS that does not use bash
as default shell.
After fixing configh.dos and inhibiting the use of child_execute_job() in job.c
I was able to produce a binary but this binary did not work as expected.
I tried to run the testsuite by typing the command: make check and I got the
following output on the screen:
  Befehl oder Dateiname nicht gefunden  (command or file not found.  Error 
message from command.com started by system() of libc)
  Befehl oder Dateiname nicht gefunden
  Befehl oder Dateiname nicht gefunden
  Befehl oder Dateiname nicht gefunden
  No command name seen. (Error message from djgpp's libc 
system() call)

  make.exe: *** [check-recursive] Error -1

The text in parenthesis have been added by me.  The string that is passed to
djgpp's libc system() that originate the above error messages is:
  failcom='exit 1'; \
  for f in x $MAKEFLAGS; do \
case $f in \
  *=* | --[!k]*);; \
  *k*) failcom='fail=yes';; \
esac; \
  done; \
  dot_seen=no; \
  target=`echo check-recursive | sed s/-recursive//`; \
  list='glob config po doc '; for subdir in $list; do \
echo Making $target in $subdir; \
if test $subdir = .; then \
  dot_seen=yes; \
  local_target=$target-am; \
else \
  local_target=$target; \
fi; \
(cd $subdir  e:/p2/make-3.81/make.exe  $local_target) \
|| eval $failcom; \
  done; \
  if test $dot_seen = no; then \
e:/p2/make-3.81/make.exe  $target-am || exit 1; \
  fi; test -z $fail

The average user will _never_ figure out why the same makefile fails so
miserably when make 3.81 is used and works perfectly when make 3.80 is used.
It took me some hours to understand what had happend.  For some reason
completly unclear to me, some one has decided not to propagate the value of the
SHELL environment variable to the child process anymore.  In the case of 
MSDOS/DJGPP
this means that the value of SHELL is deleted from the environment before
system() is called.  On _all_ non-POSIX operating systems this will have
catastrophic implications because the libc system() function will have to use
the default shell or command processor.  The default shell on non-POSIX OSs
is usualy not bash so the above shell script must fail.  After some stepping
through the code with gdb I have found that the problem can be fixed in
define_automatic_variables() in variable.c.  If compiled with DJGPP then SHELL
will always be exported.  Please note that I am not objecting the change that
have been done by the make maintainers.  There may be some good reason not to
export automatically all the envorenment variables.  Neitherless if make shall
continue supporting non-PoSIX platforms, certain precaution should be taken.
In this particular case it has been shown that it is not valid to assume that
the used OS will provide a POSIX compatible shell or command processor.
If no one takes care of things like this issue, make becomes useless on certain
platforms.

I have appended a small patch that shows the things I had to change to get a
working make binary.  That patch is not intended to be used.  It shall only
show the code lines that may need to be adjusted to solve the problems.  There
may be better ways to solve the issue, but I am not familiar enough with the
make sources to provide a better patch.  There may be also much more MSDOS or
DJGPp specific things that may be fixed.  The patch only fixes things that I am
aware.  Things that may cause trouble are drive letters, checks for absolute
patch, etc, etc etc.  The usual DOS/WINDOWS things.

I have also appended the output generated by the testsuite.  It shows that
there are some more things to fix.

I have not waiste my time trying to fix the Makefile.DOS, but now that make.texi
has been moved into /doc it needs to be adjusted accordingly.  It would be nice
if rules for dvi, ps, pdf and html could be added.  It would also be usefull
not to split the MSDOS version of make.info anymore.  The extensions .info-[0-9]
are changed to .i[0-9] to acomplish with the