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