author | Peter Kovacs <kpeter@inf.elte.hu> |
Fri, 02 Oct 2009 17:03:43 +0200 | |
changeset 745 | 68792fb2870f |
child 747 | a42f46828cc1 |
permissions | -rwxr-xr-x |
alpar@732 | 1 |
#!/bin/bash |
alpar@732 | 2 |
# |
alpar@732 | 3 |
# This file is a part of LEMON, a generic C++ optimization library. |
alpar@732 | 4 |
# |
alpar@732 | 5 |
# Copyright (C) 2003-2009 |
alpar@732 | 6 |
# Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
alpar@732 | 7 |
# (Egervary Research Group on Combinatorial Optimization, EGRES). |
alpar@732 | 8 |
# |
alpar@732 | 9 |
# Permission to use, modify and distribute this software is granted |
alpar@732 | 10 |
# provided that this copyright notice appears in all copies. For |
alpar@732 | 11 |
# precise terms see the accompanying LICENSE file. |
alpar@732 | 12 |
# |
alpar@732 | 13 |
# This software is provided "AS IS" with no warranty of any kind, |
alpar@732 | 14 |
# express or implied, and with no claim as to its suitability for any |
alpar@732 | 15 |
# purpose. |
alpar@732 | 16 |
|
alpar@732 | 17 |
|
alpar@732 | 18 |
if [ ! -f ~/.lemon-bootstrap ]; then |
alpar@732 | 19 |
echo 'Create ~/.lemon-bootstrap'. |
alpar@732 | 20 |
cat >~/.lemon-bootstrap <<EOF |
alpar@732 | 21 |
# |
alpar@732 | 22 |
# Default settings for bootstraping the LEMON source code repository |
alpar@732 | 23 |
# |
alpar@732 | 24 |
EOF |
alpar@732 | 25 |
fi |
alpar@732 | 26 |
|
alpar@732 | 27 |
source ~/.lemon-bootstrap |
alpar@732 | 28 |
if [ -f ../../../.lemon-bootstrap ]; then source ../../../.lemon-bootstrap; fi |
alpar@732 | 29 |
if [ -f ../../.lemon-bootstrap ]; then source ../../.lemon-bootstrap; fi |
alpar@732 | 30 |
if [ -f ../.lemon-bootstrap ]; then source ../.lemon-bootstrap; fi |
alpar@732 | 31 |
if [ -f ./.lemon-bootstrap ]; then source ./.lemon-bootstrap; fi |
alpar@732 | 32 |
|
alpar@732 | 33 |
|
alpar@732 | 34 |
function augment_config() { |
alpar@732 | 35 |
if [ "x${!1}" == "x" ]; then |
alpar@732 | 36 |
eval $1=$2 |
alpar@732 | 37 |
echo Add "'$1'" to '~/.lemon-bootstrap'. |
alpar@732 | 38 |
echo >>~/.lemon-bootstrap |
alpar@732 | 39 |
echo $3 >>~/.lemon-bootstrap |
alpar@732 | 40 |
echo $1=$2 >>~/.lemon-bootstrap |
alpar@732 | 41 |
fi |
alpar@732 | 42 |
} |
alpar@732 | 43 |
|
alpar@732 | 44 |
augment_config LEMON_INSTALL_PREFIX /usr/local \ |
alpar@732 | 45 |
"# LEMON installation prefix" |
alpar@732 | 46 |
|
alpar@732 | 47 |
augment_config COIN_OR_PREFIX /usr/local/coin-or \ |
alpar@732 | 48 |
"# COIN-OR installation root prefix (used for CLP/CBC)" |
alpar@732 | 49 |
|
alpar@732 | 50 |
|
alpar@732 | 51 |
function ask() { |
alpar@732 | 52 |
echo -n "$1 [$2]? " |
alpar@732 | 53 |
read _an |
alpar@732 | 54 |
if [ "x$_an" == "x" ]; then |
alpar@732 | 55 |
ret="$2" |
alpar@732 | 56 |
else |
alpar@732 | 57 |
ret=$_an |
alpar@732 | 58 |
fi |
alpar@732 | 59 |
} |
alpar@732 | 60 |
|
alpar@732 | 61 |
function yesorno() { |
alpar@732 | 62 |
ret='rossz' |
alpar@732 | 63 |
while [ "$ret" != "y" -a "$ret" != "n" -a "$ret" != "yes" -a "$ret" != "no" ]; do |
alpar@732 | 64 |
ask "$1" "$2" |
alpar@732 | 65 |
done |
alpar@732 | 66 |
if [ "$ret" != "y" -a "$ret" != "yes" ]; then |
alpar@732 | 67 |
return 1 |
alpar@732 | 68 |
else |
alpar@732 | 69 |
return 0 |
alpar@732 | 70 |
fi |
alpar@732 | 71 |
} |
alpar@732 | 72 |
|
alpar@732 | 73 |
if yesorno "External build" "n" |
alpar@732 | 74 |
then |
alpar@732 | 75 |
CONFIGURE_PATH=".." |
alpar@732 | 76 |
else |
alpar@732 | 77 |
CONFIGURE_PATH="." |
alpar@732 | 78 |
if yesorno "Autoreconf" "y" |
alpar@732 | 79 |
then |
alpar@732 | 80 |
AUTORE=yes |
alpar@732 | 81 |
else |
alpar@732 | 82 |
AUTORE=no |
alpar@732 | 83 |
fi |
alpar@732 | 84 |
fi |
alpar@732 | 85 |
|
alpar@732 | 86 |
if yesorno "Optimize" "n" |
alpar@732 | 87 |
then |
alpar@732 | 88 |
opt_flags=' -O2' |
alpar@732 | 89 |
else |
alpar@732 | 90 |
opt_flags='' |
alpar@732 | 91 |
fi |
alpar@732 | 92 |
|
alpar@732 | 93 |
if yesorno "Stop on warning" "y" |
alpar@732 | 94 |
then |
alpar@732 | 95 |
werror_flags=' -Werror' |
alpar@732 | 96 |
else |
alpar@732 | 97 |
werror_flags='' |
alpar@732 | 98 |
fi |
alpar@732 | 99 |
|
alpar@732 | 100 |
cxx_flags="CXXFLAGS=-ggdb$opt_flags$werror_flags" |
alpar@732 | 101 |
|
alpar@732 | 102 |
if yesorno "Use COIN" "n" |
alpar@732 | 103 |
then |
alpar@732 | 104 |
coin_flag="--with-coin=$COIN_OR_PREFIX" |
alpar@732 | 105 |
else |
alpar@732 | 106 |
coin_flag="" |
alpar@732 | 107 |
fi |
alpar@732 | 108 |
|
alpar@732 | 109 |
|
alpar@732 | 110 |
if [ "x$AUTORE" == "xyes" ]; then |
alpar@732 | 111 |
autoreconf -vif; |
alpar@732 | 112 |
fi |
alpar@732 | 113 |
${CONFIGURE_PATH}/configure --prefix=$LEMON_INSTALL_PREFIX \ |
alpar@732 | 114 |
"$cxx_flags" \ |
alpar@732 | 115 |
$coin_flag \ |
alpar@732 | 116 |
$* |