#! /bin/sh
#---------------------------------------------------------------------------#
# Copyright (C) 2005-2006 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
#
# Mercury.config
#
# Configuration file for the Melbourne Mercury Compiler.
#
# This is a custom configuration file written specifically for 
# the Windows installer.
#
# Environment variables: MERCURY_STDLIB_DIR, MERCURY_C_COMPILER,
# MERCURY_DEFAULT_GRADE, MERCURY_DEFAULT_OPT_LEVEL,
# MERCURY_JAVA_COMPILER, MERCURY_JAVA_INTERPRETER.

# These settings won't override settings in the environment.
MERCURY_STDLIB_DIR=$(MERCURY_CONFIG_DIR)
MERCURY_DEFAULT_OPT_LEVEL=-O2
MERCURY_DEFAULT_GRADE=asm_fast.gc
MERCURY_C_COMPILER=gcc
MERCURY_MATH_LIB=
MERCURY_JAVA_COMPILER=/c/MinGW/bin/gcj -C
MERCURY_JAVA_INTERPRETER=/c/WINDOWS/system32/java
# $(MATH_LIB) needs to be defined because it may
# be used by the substitution for SHARED_LIBS.
MATH_LIB=$(MERCURY_MATH_LIB)

# This needed for Java classpath.
INSTALL_JAVA_LIBRARY_DIR=$(MERCURY_STDLIB_DIR)/lib/java

# If you change these, you will also need to change the files indicated in
# scripts/c2init.in.
RT_LIB_NAME=mer_rt
STD_LIB_NAME=mer_std

DEFAULT_MERCURY_LINKAGE=static

# The default optimization level should be after
# all the options that describe the machine configuration.
DEFAULT_MCFLAGS=\
		 \
		 \
		--cc "$(MERCURY_C_COMPILER)" \
		--java-compiler "$(MERCURY_JAVA_COMPILER)" \
		--java-interpreter "$(MERCURY_JAVA_INTERPRETER)" \
		--grade "$(MERCURY_DEFAULT_GRADE)" \
		--cflags-for-ansi "-ansi" \
		--cflags-for-optimization "-O2 -fomit-frame-pointer -fno-strict-aliasing" \
		--cflags-for-warnings "-Wall -Wwrite-strings -Wshadow -Wno-unused -Wno-uninitialized -Wstrict-prototypes" \
		--cflags-for-threads "-DGC_WIN32_THREADS -DMR_THREAD_SAFE" \
		--cflags-for-debug "-g" \
		--cflags-for-regs "-fno-builtin -fno-omit-frame-pointer" \
		--cflags-for-gotos "-fno-defer-pop -fno-function-cse -fno-gcse" \
		--cflags-for-pic "" \
		--cflags " -B %MERCURY_CONFIG_DIR%/../../libexec/gcc/mingw32/3.4.2 -I %MERCURY_CONFIG_DIR%/../../include -I %MERCURY_CONFIG_DIR%/../gcc/mingw32/3.4.2/include -B %MERCURY_CONFIG_DIR%/../../bin -B %MERCURY_CONFIG_DIR%/../../lib -B %MERCURY_CONFIG_DIR%/../gcc/mingw32/3.4.2" \
		--ld-flags " -B %MERCURY_CONFIG_DIR%/../../libexec/gcc/mingw32/3.4.2 -I %MERCURY_CONFIG_DIR%/../../include -I %MERCURY_CONFIG_DIR%/../gcc/mingw32/3.4.2/include -B %MERCURY_CONFIG_DIR%/../../bin -B %MERCURY_CONFIG_DIR%/../../lib -B %MERCURY_CONFIG_DIR%/../gcc/mingw32/3.4.2" \
		--c-flag-to-name-object-file "-o " \
		--object-file-extension ".o" \
		--pic-object-file-extension ".o" \
		--link-with-pic-object-file-extension ".o" \
		--executable-file-extension ".exe" \
		--shared-library-extension ".a" \
		--library-extension ".a" \
		--create-archive-command "ar" \
		--create-archive-command-output-flag "" \
		--create-archive-command-flags "cr" \
		--ranlib-command "ranlib" \
		--link-executable-command "$(MERCURY_C_COMPILER)" \
		--link-shared-lib-command "$(MERCURY_C_COMPILER) -shared" \
		--trace-libs "  " \
		--thread-libs "" \
		--shared-libs "`gcc -print-libgcc-file-name` $(MATH_LIB) -lc" \
		--math-lib "" \
		--readline-libs "" \
		--linker-opt-separator "" \
		--linker-thread-flags "" \
		--shlib-linker-thread-flags "" \
		--linker-trace-flags "" \
		--shlib-linker-trace-flags "" \
		--linker-static-flags "-static" \
		--linker-strip-flag "-s" \
		--linker-debug-flags "-g" \
		--shlib-linker-debug-flags "-g" \
		--linker-link-lib-flag "-l" \
		--linker-link-lib-suffix "" \
		--shlib-linker-link-lib-flag "-l" \
		--shlib-linker-link-lib-suffix "" \
		--linker-path-flag "-L" \
		--linker-rpath-flag "-Wl,-rpath," \
		--linker-rpath-separator " -Wl,-rpath," \
		--shlib-linker-rpath-flag "-Wl,-rpath," \
		--shlib-linker-rpath-separator " -Wl,-rpath," \
		 \
		--shlib-linker-install-name-flag "-install_name " \
		--linker-allow-undefined-flag "" \
		--linker-error-undefined-flag "" \
		--fullarch "i686-pc-mingw32" \
		--install-prefix "@INSTALL_PREFIX@" \
		--num-real-r-regs "1" \
		--num-real-r-temps "0" \
		--conf-low-tag-bits "2" \
		--bits-per-word "32" \
		--bytes-per-word "4" \
		--dotnet-library-version "1.0.2411.0" \
		 \
		--no-unboxed-float \
		 \
		$(MERCURY_DEFAULT_OPT_LEVEL) \
		--no-use-symlinks \
		 --libgrade asm_fast.gc 

