#!/bin/sh
#######################################################################
# #
# The Compcert verified compiler #
# #
# Xavier Leroy, INRIA Paris-Rocquencourt #
# #
# Copyright Institut National de Recherche en Informatique et en #
# Automatique. All rights reserved. This file is distributed #
# under the terms of the INRIA Non-Commercial License Agreement. #
# #
#######################################################################
prefix=/usr/local
bindir='$(PREFIX)/bin'
libdir='$(PREFIX)/lib/compcert'
toolprefix=''
target=''
usage='Usage: ./configure [options] target
Supported targets:
ppc-macosx (PowerPC, MacOS X)
ppc-linux (PowerPC, Linux)
ppc-eabi (PowerPC, EABI with GNU/Unix tools)
ppc-eabi-diab (PowerPC, EABI with Diab tools)
arm-linux (ARM, Linux EABI)
ia32-linux (x86 32 bits, Linux)
ia32-bsd (x86 32 bits, BSD)
ia32-macosx (x86 32 bits, MacOS X)
ia32-cygwin (x86 32 bits, Cygwin environment under Windows)
manual (edit configuration file by hand)
Options:
-prefix
Install in /bin and /lib/compcert
-bindir Install binaries in
-libdir Install libraries in
-toolprefix Prefix names of tools ("gcc", etc) with
'
# Parse command-line arguments
while : ; do
case "$1" in
"") break;;
-prefix|--prefix)
prefix="$2"; shift;;
-bindir|--bindir)
bindir="$2"; shift;;
-libdir|--libdir)
libdir="$2"; shift;;
-toolprefix|--toolprefix)
toolprefix="$2"; shift;;
*)
if test -n "$target"; then echo "$usage" 1>&2; exit 2; fi
target="$1";;
esac
shift
done
# Per-target configuration
case "$target" in
powerpc-macosx|ppc-macosx)
arch="powerpc"
variant="macosx"
system="macosx"
cc="${toolprefix}gcc -arch ppc"
cprepro="${toolprefix}gcc -arch ppc -U__GNUC__ -U__BLOCKS__ -E"
casm="${toolprefix}gcc -arch ppc -c"
clinker="${toolprefix}gcc -arch ppc"
libmath=""
need_stdlib_wrapper="true";;
powerpc-linux|ppc-linux|powerpc-eabi|ppc-eabi)
arch="powerpc"
variant="eabi"
system="linux"
cc="${toolprefix}gcc"
cprepro="${toolprefix}gcc -U__GNUC__ -E"
casm="${toolprefix}gcc -c"
clinker="${toolprefix}gcc"
libmath="-lm"
need_stdlib_wrapper="false";;
powerpc-eabi-diab|ppc-eabi-diab)
arch="powerpc"
variant="eabi"
system="diab"
cc="${toolprefix}dcc"
cprepro="${toolprefix}dcc -E"
casm="${toolprefix}das"
clinker="${toolprefix}dcc"
libmath="-lm"
need_stdlib_wrapper="false";;
arm-linux)
arch="arm"
variant="linux"
system="linux"
cc="${toolprefix}gcc"
cprepro="${toolprefix}gcc -U__GNUC__ '-D__REDIRECT(name,proto,alias)=name proto' '-D__REDIRECT_NTH(name,proto,alias)=name proto' -E"
casm="${toolprefix}gcc -c"
clinker="${toolprefix}gcc"
libmath="-lm"
need_stdlib_wrapper="false";;
ia32-linux)
arch="ia32"
variant="standard"
system="linux"
cc="${toolprefix}gcc -m32"
cprepro="${toolprefix}gcc -m32 -U__GNUC__ -E"
casm="${toolprefix}gcc -m32 -c"
clinker="${toolprefix}gcc -m32"
libmath="-lm"
need_stdlib_wrapper="false";;
ia32-bsd)
arch="ia32"
variant="standard"
system="bsd"
cc="${toolprefix}gcc -m32"
cprepro="${toolprefix}gcc -m32 -U__GNUC__ -E"
casm="${toolprefix}gcc -m32 -c"
clinker="${toolprefix}gcc -m32"
libmath="-lm"
need_stdlib_wrapper="false";;
ia32-macosx)
arch="ia32"
variant="standard"
system="macosx"
cc="${toolprefix}gcc -arch i386"
cprepro="${toolprefix}gcc -arch i386 -U__GNUC__ -U__BLOCKS__ -E"
casm="${toolprefix}gcc -arch i386 -c"
clinker="${toolprefix}gcc -arch i386"
libmath=""
need_stdlib_wrapper="true";;
ia32-cygwin)
arch="ia32"
variant="standard"
system="cygwin"
cc="${toolprefix}gcc -m32"
cprepro="${toolprefix}gcc -m32 -U__GNUC__ -E"
casm="${toolprefix}gcc -m32 -c"
clinker="${toolprefix}gcc -m32"
libmath="-lm"
need_stdlib_wrapper="false";;
manual)
;;
"")
echo "No target specified." 1>&2
echo "$usage" 1>&2
exit 2;;
*)
echo "Unknown target '$target'." 1>&2
echo "$usage" 1>&2
exit 2;;
esac
# Generate Makefile.config
rm -f Makefile.config
cat > Makefile.config <> Makefile.config <> Makefile.config <<'EOF'
# Target architecture
# ARCH=powerpc
# ARCH=arm
# ARCH=ia32
ARCH=
# Target ABI
# VARIANT=macosx # for PowerPC / MacOS X
# VARIANT=eabi # for PowerPC / Linux and other SVR4 or EABI platforms
# VARIANT=linux # for ARM
# VARIANT=standard # for IA32
VARIANT=
# Target operating system and development environment
# Possible choices for PowerPC:
# SYSTEM=macosx
# SYSTEM=linux
# SYSTEM=diab
# Possible choices for ARM:
# SYSTEM=linux
# Possible choices for IA32:
# SYSTEM=linux
# SYSTEM=bsd
# SYSTEM=macosx
# SYSTEM=cygwin
SYSTEM=
# C compiler for compiling library files
CC=gcc
# Preprocessor for .c files
CPREPRO=gcc -U__GNUC__ -E
# Assembler for assembling .s files
CASM=gcc -c
# Linker
CLINKER=gcc
# Math library. Set to empty under MacOS X
LIBMATH=-lm
# Do we need the thin wrapper around standard library and standard includes
# defined in directory runtime/ ?
# NEED_STDLIB_WRAPPER=true # for MacOS X
# NEED_STDLIB_WRAPPER=false # for other systems
NEED_STDLIB_WRAPPER=
EOF
fi
# Summarize configuration
if test "$target" = "manual"; then
cat <