#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# This file was written by Rob Savoye. (rob@cygnus.com)

# The default option list can be overridden by
# TORTURE_OPTIONS="{ { list1 } ... { listN } }"

if ![info exists TORTURE_OPTIONS] {
    # FIXME: We should test -g at least once.
    set TORTURE_OPTIONS [list \
        { -O0 } { -O1 } { -O2 } \
        { -O2 -fomit-frame-pointer -finline-functions } \
        { -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops }]
}

# These globals are used if no compiler arguments are provided.
# They are also used by the various testsuites to define the environment:
# where to find stdio.h, libc.a, etc.

global CC
if ![info exists CC] then {
    set CC [findfile $base_dir/xgcc "$base_dir/xgcc -B$base_dir/" [transform gcc
]]
}
if { [which $CC] == 0 } then {
    perror "$CC does not exist"
    exit 1
}

global CFLAGS
if ![info exists CFLAGS] then {
    set CFLAGS ""
}

global LIBS
if ![info exists LIBS] then {
    set LIBS ""
}

# It is difficult to come up with a situation where one has to use LDFLAGS
# and not LIBS (why two?).  Both are useful in makefiles, so maybe it's better
# to just continue existing practice.  However, there is still a lot of
# confusion about when to use one or the other.
global LDFLAGS
if ![info exists LDFLAGS] then {
    set LDFLAGS ""
}

proc just_compile { file } {
    global CFLAGS
    set output "$tmpdir/[file tail [file rootname $src]].o"
    
    append CFLAGS " -w -c -o $output $option"
}

proc just_link { file } {
}

proc just_execute { file } {
}

proc run_test { file } {
}
