
The glob/Makefile as distributed won't work with Sun make, GNU
make-3.63, or BSD make. It is missing dependencies, although GNU
make-3.64 seems to manage, but of course we have to compile it first.

Further, there is a bug in getloadavg.c that prevents the "default"
Unix method to work (LDAV_DONE is defined too soon).

Customs support: GNU make 3.64 can use the ICSI version of Customs
*almost* out of the box.  Alas, there remains one small, but fatal bug in
remote-cstms.c, having to do with right assignment of uid/euid for the
exported job.  Also, I retrofitted the code from an earlier patch that
allows the -l option to implicitly control the number of jobs run
locally before resorting to exportation (since exported jobs have an
overhead that is only worth it if more than one job can run in
parallel).  -l 0 forces exportation of all jobs, so the old behavior is
still available.

Finally, I couldn't get configure --with-customs to do the right
thing.  So I patched the Makefile by hand. This will require further
hand-editing of the CUSTOMSSRC path.

On NeXT's (with 2.1 software at least) config.h contains an incorrect
#define DIRENT 1.  This should be #define SYSDIR 1.

*** glob/Makefile.in.dist	Wed Apr 21 12:19:05 1993
--- glob/Makefile.in	Wed Apr 21 18:19:34 1993
***************
*** 38,45 ****
  	$(AR) $(ARFLAGS) $@ glob.o fnmatch.o
  	$(RANLIB) $@
  
! glob.o: $(srcdir)/glob.h $(srcdir)/fnmatch.h
! fnmatch.o: $(srcdir)/fnmatch.h
  
  .c.o:
  	$(CC) $(CFLAGS) $(CPPFLAGS) -I. -I$(srcdir) -c $< $(OUTPUT_OPTION)
--- 38,45 ----
  	$(AR) $(ARFLAGS) $@ glob.o fnmatch.o
  	$(RANLIB) $@
  
! glob.o: $(srcdir)/glob.h $(srcdir)/fnmatch.h glob.c
! fnmatch.o: $(srcdir)/fnmatch.h fnmatch.c
  
  .c.o:
  	$(CC) $(CFLAGS) $(CPPFLAGS) -I. -I$(srcdir) -c $< $(OUTPUT_OPTION)
*** getloadavg.c.dist	Thu Apr 15 13:36:37 1993
--- getloadavg.c	Thu Apr 22 01:19:33 1993
***************
*** 235,241 ****
  #endif /* LOAD_AVE_TYPE */
  
  #ifdef NeXT
! #include <mach/mach.h>
  #endif /* NeXT */
  
  #ifdef sgi
--- 235,241 ----
  #endif /* LOAD_AVE_TYPE */
  
  #ifdef NeXT
! #include <mach.h>
  #endif /* NeXT */
  
  #ifdef sgi
***************
*** 513,519 ****
  #endif /* VMS */
  
  #if !defined (LDAV_DONE) && defined(LOAD_AVE_TYPE) && !defined(VMS)
- #define LDAV_DONE
    /* UNIX-specific code -- read the average from /dev/kmem.  */
  
  #define LDAV_PRIVILEGED		/* This code requires special installation.  */
--- 513,518 ----
***************
*** 600,605 ****
--- 599,605 ----
  #endif /* LOAD_AVE_TYPE and not VMS */
  
  #if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS.  */
+ #define LDAV_DONE
    if (nelem > 0)
      loadavg[elem++] = LDAV_CVT (load_ave[0]);
    if (nelem > 1)
*** remote-cstms.c.dist	Thu Feb  4 10:31:53 1993
--- remote-cstms.c	Thu Apr 22 10:39:18 1993
***************
*** 27,33 ****
  #include <sys/time.h>
  #include <netdb.h>
  
- #define __STRICT_BSD__		/* Don't make conflicting declarations.  */
  #include "customs.h"
  
  
--- 27,32 ----
***************
*** 88,93 ****
--- 87,98 ----
    if (inited < 0)
      return 0;
  
+   /* the first job should run locally, or, if the -l flag is given, we use
+      that as clue as to how many local jobs should be scheduled locally */
+   if (max_load_average < 0 && job_slots_used == 0
+       || job_slots_used < max_load_average)
+      return 0;
+ 
    status = Customs_Host (EXPORT_SAME, &permit);
    if (status != RPC_SUCCESS)
      {
***************
*** 151,158 ****
    /* Modify the waybill as if the remote child had done `child_access ()'.  */
    {
      WayBill *wb = (WayBill *) waybill;
!     wb->euid = wb->ruid;
!     wb->rgid = wb->rgid;
    }
  
    /* Send the request to the server, timing out in 20 seconds.  */
--- 156,163 ----
    /* Modify the waybill as if the remote child had done `child_access ()'.  */
    {
      WayBill *wb = (WayBill *) waybill;
!     wb->ruid = wb->euid;
!     wb->rgid = wb->egid;
    }
  
    /* Send the request to the server, timing out in 20 seconds.  */
*** Makefile.dist	Wed Apr 21 18:26:50 1993
--- Makefile	Wed Apr 21 20:44:13 1993
***************
*** 41,47 ****
  
  # Which flavor of remote job execution support to use.
  # The code is found in `remote-$(REMOTE).c'.
! REMOTE = stub
  
  # If you are using the GNU C library, or have the GNU getopt functions in
  # your C library, you can comment these out.
--- 41,47 ----
  
  # Which flavor of remote job execution support to use.
  # The code is found in `remote-$(REMOTE).c'.
! REMOTE = cstms
  
  # If you are using the GNU C library, or have the GNU getopt functions in
  # your C library, you can comment these out.
***************
*** 69,74 ****
--- 69,85 ----
  # Any extra object files your system needs.
  extras =  getloadavg.o
  
+ CUSTOMSSRC = /usr/local/src/icsi/pmake/customs
+ CFLAGS += -I$(CUSTOMSSRC) \
+          -I$(CUSTOMSSRC)/../lib/include \
+          -I$(CUSTOMSSRC)/../lib/lst
+   
+   # Any extra object files your system needs.
+ LOADLIBES += $(CUSTOMSSRC)/customslib.o \
+ 	  $(CUSTOMSSRC)/rpc.o $(CUSTOMSSRC)/xlog.o \
+ 	  $(CUSTOMSSRC)/../lib/sprite/libsprite.a \
+ 	  $(CUSTOMSSRC)/../lib/lst/liblst.a
+ 
  # Common prefix for machine-independent installed files.
  prefix = /usr/local
  # Common prefix for machine-dependent installed files.
***************
*** 93,101 ****
  # The value should be either `true' or `false'.
  # On many systems, the getloadavg function (used to implement the `-l'
  # switch) will not work unless make is installed setgid kmem.
! install_setgid = true
  # Install make setgid to this group so it can read /dev/kmem.
  group = kmem
  
  # Program to install `make'.
  INSTALL_PROGRAM = $(INSTALL)
--- 104,115 ----
  # The value should be either `true' or `false'.
  # On many systems, the getloadavg function (used to implement the `-l'
  # switch) will not work unless make is installed setgid kmem.
! install_setgid = false
  # Install make setgid to this group so it can read /dev/kmem.
  group = kmem
+ install_setuid = true
+ # Install make setgid to this group so it can read /dev/kmem.
+ user = root
  
  # Program to install `make'.
  INSTALL_PROGRAM = $(INSTALL)
***************
*** 163,169 ****
  #MAKE = make
  
  glob/libglob.a: force
! 	cd glob; $(MAKE) CC='$(CC)' CFLAGS='$(CFLAGS) -I..' \
  			 CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H' \
  			 libglob.a
  force:
--- 177,183 ----
  #MAKE = make
  
  glob/libglob.a: force
! 	cd glob; $(MAKE) CC='$(CC)' CFLAGS='-I.. $(CFLAGS)' \
  			 CPPFLAGS='$(CPPFLAGS) -DHAVE_CONFIG_H' \
  			 libglob.a
  force:
***************
*** 181,186 ****
--- 195,203 ----
  $(bindir)/$(instname): make
  	$(INSTALL_PROGRAM) make $@.new
  # These are necessary for load-average checking to work on most Unix machines.
+ 	if $(install_setuid); then \
+ 	  chown $(user) $@.new && chmod u+s $@.new; \
+ 	else true; fi
  	if $(install_setgid); then \
  	  chgrp $(group) $@.new && chmod g+s $@.new; \
  	else true; fi
***************
*** 250,257 ****
  ar.o : ar.c make.h file.h 
  arscan.o : arscan.c make.h config.h 
  signame.o : signame.c config.h signame.h 
! remote-cstms.o : remote-cstms.c make.h config.h commands.h job.h pmake/customs/customs.h \
!   pmake/customs/config.h pmake/customs/../unix/config.h pmake/customs/rpc.h pmake/lib/include/sprite.h 
  getopt.o : getopt.c config.h getopt.h 
  getopt1.o : getopt1.c config.h getopt.h 
  getloadavg.o : getloadavg.c config.h 
--- 267,274 ----
  ar.o : ar.c make.h file.h 
  arscan.o : arscan.c make.h config.h 
  signame.o : signame.c config.h signame.h 
! remote-cstms.o : remote-cstms.c make.h config.h commands.h job.h $(CUSTOMSSRC)/customs.h \
!   $(CUSTOMSSRC)/config.h $(CUSTOMSSRC)/../unix/config.h $(CUSTOMSSRC)/rpc.h $(CUSTOMSSRC)/../lib/include/sprite.h 
  getopt.o : getopt.c config.h getopt.h 
  getopt1.o : getopt1.c config.h getopt.h 
  getloadavg.o : getloadavg.c config.h 
