Skip to content
Snippets Groups Projects
configure 4.24 KiB
Newer Older
#######################################################################
#                                                                     #
#              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'
xleroy's avatar
xleroy committed
prompt() {
    echo "$1 [$x] ? " | tr -d '\n'
    read y
    case "$y" in
        "") ;;
      none) x="";;
         *) x="$y";;
    esac
}

usage='Usage: ./configure [options] target
xleroy's avatar
xleroy committed
  ppc-macosx       (PowerPC, MacOS X)
  ppc-linux        (PowerPC, Linux)
  arm-linux        (ARM, Linux)
xleroy's avatar
xleroy committed
  manual           (edit configuration file by hand)

Options:
  -prefix <dir>    Install in <dir>/bin and <dir>/lib/compcert
  -bindir <dir>    Install binaries in <dir>
  -libdir <dir>    Install libraries in <dir>
'

# 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;;
    *)
        if test -n "$target"; then echo "$usage" 1>&2; exit 2; fi
        target="$1";;
# Per-target configuration

case "$target" in
  powerpc-macosx|ppc-macosx)
xleroy's avatar
xleroy committed
    system="macosx"
xleroy's avatar
xleroy committed
    cprepro="gcc -arch ppc -U__GNUC__ -U__BLOCKS__ -E"
    casm="gcc -arch ppc -c"
    clinker="gcc -arch ppc"
    libmath="";;
  powerpc-linux|ppc-linux)
xleroy's avatar
xleroy committed
    system="linux"
    cc="gcc"
    cprepro="gcc -U__GNUC__ -E"
    casm="gcc -c"
    clinker="gcc"
    libmath="-lm";;
  arm-linux)
    arch="arm"
    variant="linux"
xleroy's avatar
xleroy committed
    system="linux"
    cc="gcc"
    cprepro="gcc -U__GNUC__ -E"
    casm="gcc -c"
    clinker="gcc"
    libmath="-lm";;
xleroy's avatar
xleroy committed
  manual)
    ;;
  "")
    echo "No target specified." 1>&2
    echo "$usage" 1>&2
    exit 2;;
xleroy's avatar
xleroy committed
    echo "Unknown target '$target'." 1>&2
# Generate Makefile.config

rm -f Makefile.config
cat > Makefile.config <<EOF
PREFIX=$prefix
BINDIR=$bindir
LIBDIR=$libdir
xleroy's avatar
xleroy committed
EOF

if test "$target" != "manual"; then
cat >> Makefile.config <<EOF
xleroy's avatar
xleroy committed
SYSTEM=$system
CC=$cc
CPREPRO=$cprepro
CASM=$casm
CLINKER=$clinker
LIBMATH=$libmath
xleroy's avatar
xleroy committed
else
cat >> Makefile.config <<'EOF'

# Target architecture
# ARCH=powerpc
# ARCH=arm
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=

# Target operating system and development environment
xleroy's avatar
xleroy committed
# Possible choices for PowerPC:
# SYSTEM=macosx
# SYSTEM=linux
# SYSTEM=diab
# Possible choices for ARM:
# SYSTEM=linux
xleroy's avatar
xleroy committed
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
LIBMATH=-lm

# CIL configuration target -- do not change
EOF
fi
xleroy's avatar
xleroy committed
if test "$target" = "manual"; then
cat <<EOF

Please finish the configuration by editing file ./Makefile.config

EOF

else

bindirexp=`echo "$bindir" | sed -e "s|\\\$(PREFIX)|$prefix|"`
libdirexp=`echo "$libdir" | sed -e "s|\\\$(PREFIX)|$prefix|"`

    Target architecture........... $arch
    Application binary interface.. $variant
xleroy's avatar
xleroy committed
    OS and development env........ $system
    C compiler.................... $cc
    C preprocessor................ $cprepro
    Assembler..................... $casm
    Linker........................ $clinker
    Math library.................. $libmath
xleroy's avatar
xleroy committed
    Binaries installed in......... $bindirexp
    Library files installed in.... $libdirexp

EOF
xleroy's avatar
xleroy committed
fi