This is a first stab at a description of how to get akcl
to run under NeXTStep on Intel hardware. 

------------------------------------------------------------------------
Modify files (included below)
	h/NeXT.h
	h/NeXT.defs
	c/NeXTunixsave.c
	c/NeXTunixfasl.c

Run
	add-defs NeXT /Local/Lisp/kcl
	make -f Smakefile
	make
    make install

(last line is optional -- see akcl's README)

This will die with a complaint about -lc -- there are
two references in unixport/makefile (generated in the
run of make above) -- delete the -lc occurrences, and
fire up make again.

Here are the current versions of the files mentioned
above (or at least the changed portions) -- the resultant
akcl is known to work with CMN/CM/CLM but does not
include any MIDI stuff yet.

------------------------------------------------------------------------
h/NeXT.defs

#
# For NeXT Operating system 3.
#

LBINDIR=/Local/Unix/bin

OFLAG=	-O

LIBS=       -u _SNDReadSoundfile -u _SNDStartPlaying -u _SNDWait -u _SNDFree -u _SNDStop -u _SNDSetHost -u _SNDAcquire -u _snddriver_get_device_parms -u _SNDRelease -u _snddriver_set_device_parms -u _snddriver_get_volume -u _snddriver_set_volume -u _snddriver_set_ramp -u _valloc -u _mutex_try_lock -u _mutex_wait_lock -u _cthread_detach -u _port_set_allocate -u _port_set_add -u _port_set_deallocate -u _name_server_port -u _mach_error_string -u _port_allocate -u _port_deallocate -u _mig_get_reply_port -u _msg_rpc -u _msg_send -u _mig_dealloc_reply_port -u _sscanf -lsys_s -lm



LIBC= 
ODIR_DEBUG=  -g

CC=	cc -O3 -DVOL=volatile -I$(AKCLDIR)/o -fwritable-strings

# The option -seglinkedit is specified so that rld_load() can be used.
LDCC=	ld -X -seglinkedit -segprot __TEXT rwx rwx /lib/crt0.o 

# bcmp(), bcopy(), and bzero() are already included in the NeXT C library.
LIBFILES=

CFLAGS	= -c $(DEFS)  -I../h

MAIN    = ../o/main.o

INITFORM=(setq compiler::*cc* "cc -O3 -DVOL=volatile -fwritable-strings")

MPFILES=$(MPDIR)/mpi.o $(MPDIR)/libmport.a

# Use symbolic links
SYMB=-s

# the  make to use for saved_kcp the profiler.
KCP=kcp-next

------------------------------------------------------------------------
h/NeXT.h

#ifndef NeXT
#define NeXT
#endif
#include "bsd.h"
#undef SFASL
#undef HAVE_AOUT

#define PAGEWIDTH 12

/* The following value determines the running process size. */
#define BIG_HEAP_SIZE   0x2000000
#undef MAXPAGE
#define MAXPAGE (2*16384)

#undef SET_REAL_MAXPAGE
#define SET_REAL_MAXPAGE \
{ extern int mach_maplimit; sbrk(0); real_maxpage = mach_maplimit/PAGESIZE; }

#define sbrk my_sbrk

#define ADDITIONAL_FEATURES \
	ADD_FEATURE("MACH"); \
	ADD_FEATURE("NeXT"); \
	ADD_FEATURE("NEXT"); \
	ADD_FEATURE("NEXT-3.0"); \
	ADD_FEATURE("I386"); \
        ADD_FEATURE("TURBO-CLOSURE"); \
        ADD_FEATURE("TURBO-CLOSURE-ENV-SIZE")

#define CLEAR_CACHE
#define UNIXSAVE	"NeXTunixsave.c"
#define UNIXFASL	"NeXTunixfasl.c"

#define SEEK_TO_END_OFILE seek_to_end_ofile

#define	I386
#define	IEEEFLOAT

  /* we can use the system malloc without interference with
     lisp storage allocation */
#define DONT_NEED_MALLOC  

#ifdef IN_MAIN
#include <fcntl.h>
#include <sys/stat.h>
#endif
char *find_executable();

#define LITTLE_ENDIAN

/* Begin for cmpinclude */

#define HAVE_ALLOCA

#ifdef __GNUC__
#undef __BUILTIN_VA_ARG_INCR
#endif



/* End for cmpinclude */

------------------------------------------------------------------------
c/NeXTunixfasl.c

change the includes from

#include <mach.h>
#include <sys/loader.h>
#include <rld.h>

to

#include <mach/mach.h>
#include <mach-o/loader.h>
#include <mach-o/rld.h>
	

Then delete both references to asm("trap #2") --
change

    asm("trap #2");		/* clear cache */
    call_init(entry - object_start, memory, fasl_data);

to:

    call_init(entry - object_start, memory, fasl_data);

(occurs twice).


------------------------------------------------------------------------
c/NeXTunixsave.c

change the includes from:

#include <mach.h>
#include <sys/loader.h>

to:

#include <mach/mach.h>
#include <mach-o/loader.h>

and if you have an old version of akcl, make sure the
getsectbyname declaration is changed from:

extern struct section *getsectbyname(char *, char *);

to:

extern const struct section *getsectbyname(
	 const char *segname, 
	 const char *sectname);


------------------------------------------------------------------------
Please let me know if this is incomplete or inaccurate.
(bil@ccrma.stanford.edu)


(mods to akcl by Christopher Lane <lane@CAMIS.Stanford.EDU>)




------------------------------------------------------------------------
In March 1994 I completely re-wrote CLM's C unit generator
code -- it is now about 10 times faster than before, but
this speed-up was gained at some initial awkwardness for the
CLM/AKCL user.  You now need to create the libmus.a library
via the shell script libm, then in NeXT.defs change the
LIBS statement to:

LIBS=       -u _fmod -u _log10 -u _clm_full_file_reset -u _clm_file_reset -u _c_init_sine -u _c_sin_lookup -u _c_frandom -u _c_newline -u _c_fft_window -u _c_clear_block -u _c_gcd -u _c_lcm -u _c_table_lookup -u _c_table_interp  -u _c_direct_flt  -u _c_lattice_flt  -u _c_ladder_flt  -u _c_y_or_n_p  -u _c_yes_or_no_p  -u _c_fft  -u _c_convolve  -u _c_run_block  -u _c_src -u _c_spd  -u _c_fft_filter  -u _c_base_run_block -u _jv_exp -u _mmap -u _SNDReadSoundfile -u _SNDStartPlaying -u _SNDWait -u _SNDFree -u _SNDStop -u _SNDSetHost -u _SNDAcquire -u _snddriver_get_device_parms -u _SNDRelease -u _snddriver_set_device_parms -u _snddriver_get_volume -u _snddriver_set_volume -u _snddriver_set_ramp -u _valloc -u _mutex_try_lock -u _mutex_wait_lock -u _cthread_detach -u _port_set_allocate -u _port_set_add -u _port_set_deallocate -u _name_server_port -u _mach_error_string -u _port_allocate -u _port_deallocate -u _mig_get_reply_port -u _msg_rpc -u _msg_send -u _mig_dealloc_reply_port -u _sscanf -lsys_s -lm -L/dist/lisp/kcl/clm -lmus


where -L/Local/Lisp/clm should be changed to reflect the correct
pathname to the libmus.a library on your system.  After making this
change, re-run add-defs, delete akcl/unixport/saved_kcl and
akcl/unixport/raw_kcl (if they already are there, of course),
and re-run the akcl make process.
