author | Peter Kovacs <kpeter@inf.elte.hu> |
Sun, 09 Jan 2011 00:57:12 +0100 | |
changeset 1203 | 07682e24c4e8 |
parent 841 | 313d58f9e544 |
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@923 | 47 |
augment_config GLPK_PREFIX /usr/local/ \ |
alpar@923 | 48 |
"# GLPK installation root prefix" |
alpar@923 | 49 |
|
alpar@779 | 50 |
augment_config COIN_OR_PREFIX /usr/local/coin-or \ |
alpar@779 | 51 |
"# COIN-OR installation root prefix (used for CLP/CBC)" |
alpar@779 | 52 |
|
alpar@794 | 53 |
augment_config SOPLEX_PREFIX /usr/local/soplex \ |
alpar@794 | 54 |
"# Soplex build prefix" |
alpar@794 | 55 |
|
alpar@779 | 56 |
|
alpar@779 | 57 |
function ask() { |
alpar@779 | 58 |
echo -n "$1 [$2]? " |
alpar@779 | 59 |
read _an |
alpar@779 | 60 |
if [ "x$_an" == "x" ]; then |
alpar@779 | 61 |
ret="$2" |
alpar@779 | 62 |
else |
alpar@779 | 63 |
ret=$_an |
alpar@779 | 64 |
fi |
alpar@779 | 65 |
} |
alpar@779 | 66 |
|
alpar@779 | 67 |
function yesorno() { |
alpar@779 | 68 |
ret='rossz' |
alpar@779 | 69 |
while [ "$ret" != "y" -a "$ret" != "n" -a "$ret" != "yes" -a "$ret" != "no" ]; do |
alpar@779 | 70 |
ask "$1" "$2" |
alpar@779 | 71 |
done |
alpar@779 | 72 |
if [ "$ret" != "y" -a "$ret" != "yes" ]; then |
alpar@779 | 73 |
return 1 |
alpar@779 | 74 |
else |
alpar@779 | 75 |
return 0 |
alpar@779 | 76 |
fi |
alpar@779 | 77 |
} |
alpar@779 | 78 |
|
alpar@779 | 79 |
if yesorno "External build" "n" |
alpar@779 | 80 |
then |
alpar@779 | 81 |
CONFIGURE_PATH=".." |
alpar@779 | 82 |
else |
alpar@779 | 83 |
CONFIGURE_PATH="." |
alpar@779 | 84 |
if yesorno "Autoreconf" "y" |
alpar@779 | 85 |
then |
alpar@779 | 86 |
AUTORE=yes |
alpar@779 | 87 |
else |
alpar@779 | 88 |
AUTORE=no |
alpar@779 | 89 |
fi |
alpar@779 | 90 |
fi |
alpar@779 | 91 |
|
alpar@779 | 92 |
if yesorno "Optimize" "n" |
alpar@779 | 93 |
then |
alpar@779 | 94 |
opt_flags=' -O2' |
alpar@779 | 95 |
else |
alpar@779 | 96 |
opt_flags='' |
alpar@779 | 97 |
fi |
alpar@779 | 98 |
|
alpar@779 | 99 |
if yesorno "Stop on warning" "y" |
alpar@779 | 100 |
then |
alpar@779 | 101 |
werror_flags=' -Werror' |
alpar@779 | 102 |
else |
alpar@779 | 103 |
werror_flags='' |
alpar@779 | 104 |
fi |
alpar@779 | 105 |
|
alpar@779 | 106 |
cxx_flags="CXXFLAGS=-ggdb$opt_flags$werror_flags" |
alpar@779 | 107 |
|
alpar@841 | 108 |
if yesorno "Check with valgrind" "n" |
alpar@841 | 109 |
then |
alpar@841 | 110 |
valgrind_flags=' --enable-valgrind' |
alpar@841 | 111 |
else |
alpar@841 | 112 |
valgrind_flags='' |
alpar@841 | 113 |
fi |
alpar@841 | 114 |
|
alpar@923 | 115 |
if [ -f ${GLPK_PREFIX}/include/glpk.h ]; then |
alpar@923 | 116 |
if yesorno "Use GLPK" "y" |
alpar@923 | 117 |
then |
alpar@923 | 118 |
glpk_flag="--with-glpk=$GLPK_PREFIX" |
alpar@923 | 119 |
else |
alpar@923 | 120 |
glpk_flag="--without-glpk" |
alpar@923 | 121 |
fi |
alpar@923 | 122 |
else |
alpar@923 | 123 |
glpk_flag="--without-glpk" |
alpar@923 | 124 |
fi |
alpar@923 | 125 |
|
alpar@794 | 126 |
if [ -f ${COIN_OR_PREFIX}/include/coin/config_coinutils.h ]; then |
alpar@794 | 127 |
if yesorno "Use COIN-OR (CBC/CLP)" "n" |
alpar@794 | 128 |
then |
alpar@794 | 129 |
coin_flag="--with-coin=$COIN_OR_PREFIX" |
alpar@794 | 130 |
else |
alpar@923 | 131 |
coin_flag="--without-coin" |
alpar@794 | 132 |
fi |
alpar@779 | 133 |
else |
alpar@923 | 134 |
coin_flag="--without-coin" |
alpar@779 | 135 |
fi |
alpar@779 | 136 |
|
alpar@794 | 137 |
if [ -f ${SOPLEX_PREFIX}/src/soplex.h ]; then |
alpar@794 | 138 |
if yesorno "Use Soplex" "n" |
alpar@794 | 139 |
then |
alpar@794 | 140 |
soplex_flag="--with-soplex=$SOPLEX_PREFIX" |
alpar@794 | 141 |
else |
alpar@923 | 142 |
soplex_flag="--without-soplex" |
alpar@794 | 143 |
fi |
alpar@794 | 144 |
else |
alpar@923 | 145 |
soplex_flag="--without-soplex" |
alpar@794 | 146 |
fi |
alpar@779 | 147 |
|
alpar@779 | 148 |
if [ "x$AUTORE" == "xyes" ]; then |
alpar@779 | 149 |
autoreconf -vif; |
alpar@779 | 150 |
fi |
alpar@779 | 151 |
${CONFIGURE_PATH}/configure --prefix=$LEMON_INSTALL_PREFIX \ |
alpar@841 | 152 |
$valgrind_flags \ |
alpar@779 | 153 |
"$cxx_flags" \ |
alpar@923 | 154 |
$glpk_flag \ |
alpar@779 | 155 |
$coin_flag \ |
alpar@794 | 156 |
$soplex_flag \ |
alpar@779 | 157 |
$* |