===========================================================================

                  GMP port to Power Macintosh and MacOS

                       Kent Boortz <kent@swox.se>

===========================================================================



This is an unsupported port of GMP to Power Macintosh and MacOS. It
will use the optimized 'mpn' assembler routines written for 32 bit
PowerPC to gain speed. The BSD MP compatible library is not built.

The output is a library

        $GMP_SOURCE_DIR/macos/libgmp.$GMP_VERSION

Not all tests pass

        We never run the 'io' test the source don't compile

        If using Apple's compilers we never run the mpz t-mul, mpf t-add
        and mpf t-sub because they don't compile with MrC 4.1



REQUIREMENTS
============

To compile into the library you need

        Apple MPW (free) or CodeWarrior MPW
	MacPerl 5 for MPW

GMP build was tested with CodeWarrior Pro 5 and MPW Shell 3.5.

For compiling with the free Apple MPW development system you need a
68K Macintosh with a 68020 or higher microprocessor, or any Power
Macintosh with at least 8 Mb of memory and MacOS 7.5 or later.

See the CodeWarrior documentation for the CodeWarrior MPW requirements.

MacPerl is free, download and install the MPW tool version from

    http://www.macperl.com

You need the "Appl" and "Tool" archive, for example

    http://www.perl.com/CPAN-local/ports/mac/Mac_Perl_520r4_appl.bin
    http://www.perl.com/CPAN-local/ports/mac/Mac_Perl_520r4_tool.bin

See the file "Install.MPW_Perl" for MPW Perl installation instructions.



APPLE MPW INSTALLATION
======================

The MPW development system can be found on February 2000 Apple developer
"tool chest" CD or be downloaded from

    http://developer.apple.com/tools/mpw-tools/

You need "StuffIt Expander" to unpack the source. You can download
"StuffIt Expander" for free from

    http://www.aladdinsys.com/expander/expander_mac_login.html

Unpack the installation instructions

    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./About_MPW_etc.sit.hqx

This result is a PDF file that can be read with the free Acrobat Reader

    http://www.adobe.com/products/acrobat/readstep.html

From the MPW development environment you need at least

    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/MPW_Shell.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Scripts.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/GetFileName.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/Make.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/MrC.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/PPCAsm.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/PPCLink.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/Interfaces&Libraries/Libraries.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/Interfaces&Libraries/RuntimeLibraries.sit.hqx
    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/Interfaces&Libraries/Interfaces/CIncludes.sit.hqx

Put these into a folder and drag the whole folder to the "StuffIt
Expander" icon to unpack them.

Move "Scripts" folder down into the "MPW_Shell Folder".

Create a folder "Tools" inside the "MPW_Shell Folder" and move "Make",
"PPCAsm", "MrC", "PPCLink" and "GetFileName" down into the "Tools"
folder.

Create a folder "Interfaces&Libraries" at the same level as the
"MPW_Shell Folder". Put Put "RuntimeLibraries", "Libraries" into
the "Interfaces&Libraries" folder. Inside the "Interfaces&Libraries" folder 
create a new folder "Interfaces" and put "CInlcudes" into it.

In summary, the manually moved files/folders should be located at

	:MPW_Shell Folder:Tools:Make
	:MPW_Shell Folder:Tools:PPCAsm
	:MPW_Shell Folder:Tools:MrC
	:MPW_Shell Folder:Tools:PPCLink
	:MPW_Shell Folder:Tools:GetFileName
	:Interfaces&Libraries:RuntimeLibraries:
	:Interfaces&Libraries:Libraries:
	:Interfaces&Libraries:Interfaces:CInlcudes:

You can see the expected file structure in

    ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./FileList.txt

Follow the rest of the installation instructions in "About MPW etc.".



CODEWARRIOR MPW INSTALLATION
============================

The CodeWarrior installer should install everything for you.

The CodeWarrior compiler search for headers in the directory
"MWCInclude" (located inside the "Interfaces" folder, inside the
"Interfaces&Libraries" folder inside the "CodeWarrior MPW" folder, if
it doesn't exist you have to create it)

Copy the content of the following folders inside the "MWCInclude" folder:

 - "CIncludes" (path: Metrowerks CodeWarrior: MacOS Support:
   Universal: Interfaces: CIncludes)

 - "Include" (path: Metrowerks CodeWarrior: MSL: MSL_C:
   MSL_Common: Include)

Copy the file "ansi_prefix.mac.h" inside the "MWCInclude" folder
(path: Metrowerks CodeWarrior: MSL: MSL_C: MSL_MacOS: Include:
ansi_prefix.mac.h)



BUILD PROCESS
=============

The "macos" folder/directory should be inside the top directory in the
GMP source tree and should contain four files

        README          This file.
        configure       Create files and directories needed.
        unix2mac        Used to convert "configure" end-of-line chars.
        Makefile.in     Source for the final "Makefile".

Double click on the "MPW Shell" icon and set the directory using the
"Directory" menu to the "$GMP_SOURCE_DIR:macos:" folder/directory.

You run "configure" in a two step process

        % perl unix2mac configure > configure.mac
        % perl configure.mac
  or    % perl configure.mac cw

If you use CodeWarrior MPW you need to add the argument "cw" to the
configure script. 

Then run "Make"

        % make
     or % make -f Makefile.cw

This will not execute the commands. It is like "make -n" on Unix, it
will display the commands to execute. You select the commands and
hit "enter" to actually execute the commands.

To test the code you execute the output from

        % Make check
     or % make check -f Makefile.cw

If there is an error the test program will complain. Note that the
test programs can contain errors so a test failure doesn't always
mean that the library is broken.

To cleanup to the state before configure you execute the output from

        % Make clean

To remove the the resulting library as well you do

        % Make distclean



PROBLEMS
========

Bug reports should be sent directly to Kent Boortz <kent@swox.se> and
*not* to "bug-gmp@gnu.org".

There may be problems if the program you use for unpacking the source
use automatic conversion of end-of-line characters.

This port may be out of sync with minor GMP releases or patches.
The MacOS build is very different from the Unix build process and
for some changes in the Unix build the build process for MacOS has
to be changed manually. Swox has no build or test machine for this
port.

The library uses stream I/O operations for some of the GMP functions
and maybe for some error messages. This means that to link this
library to form a normal Mac application you may get link problems,
i.e. a Mac normally has no console/shell to write to.

If you are unfamiliar with MPW note that the "return" key and the
"enter" key mean different things to MPW.  The first just add a line
break, the second send the line your pointer is at or the selection
you have to the MPW command interpreter.

If you mount the GMP source from a Unix netatalk server don't move or
remove files from the Unix side while MPW is running. MPW cache
information about what the file system looks like and gets very
confused or crash.

If you really need a MacOS m68k version of GMP let me know and we may
take the time to do the port.


Kent Boortz <kent@swox.se>
