% Copyright 1996-2000 Critical Mass, Inc. All rights reserved.
% See file COPYRIGHT-CMASS for details.
%

readonly TARGET = "I386_DARWIN"
readonly GNU_PLATFORM = "i686-darwin8" % "cpu-os" string for GNU

%
% The assembler on Darwin 8.0.1 (10.4) cannot handle the rep
% prefix. cctools 698.1 can. Exactly what is the earliest
% version that can is not known. A newline or slash after
% the rep also works.
%

proc configure_assembler() is
    if defined("SYSTEM_ASM")
        return
    end
    local a = try_exec("@echo \"rep movsl\" | as -o /dev/null 2> /dev/null")
    % write("a is " & a & CR)
    if equal(a, 0)
        SYSTEM_ASM = "as"
        % write(SYSTEM_ASM & " works" & CR)
        return
    end
    % write("as does not work" & CR)
    if FileExists("/cctools-698.1/usr/bin/as")
        SYSTEM_ASM = "/cctools-698.1/usr/bin/as"
        % write("using " & SYSTEM_ASM & ", which is presumed to work" & CR)
        return
    end
    error("as does not work (does not recognize \"rep movsl\"), please upgrade to "
        & "cctools-698.1 or newer and install to /cctools-698.1")
    %
    % another good option is probably to put an assembler next to cm3cg
    %
end

include("I386.common")
include("Darwin.common")
