1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/scripts/bootstrap.sh Tue Dec 20 18:15:14 2011 +0100
1.3 @@ -0,0 +1,157 @@
1.4 +#!/bin/bash
1.5 +#
1.6 +# This file is a part of LEMON, a generic C++ optimization library.
1.7 +#
1.8 +# Copyright (C) 2003-2009
1.9 +# Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
1.10 +# (Egervary Research Group on Combinatorial Optimization, EGRES).
1.11 +#
1.12 +# Permission to use, modify and distribute this software is granted
1.13 +# provided that this copyright notice appears in all copies. For
1.14 +# precise terms see the accompanying LICENSE file.
1.15 +#
1.16 +# This software is provided "AS IS" with no warranty of any kind,
1.17 +# express or implied, and with no claim as to its suitability for any
1.18 +# purpose.
1.19 +
1.20 +
1.21 +if [ ! -f ~/.lemon-bootstrap ]; then
1.22 + echo 'Create ~/.lemon-bootstrap'.
1.23 + cat >~/.lemon-bootstrap <<EOF
1.24 +#
1.25 +# Default settings for bootstraping the LEMON source code repository
1.26 +#
1.27 +EOF
1.28 +fi
1.29 +
1.30 +source ~/.lemon-bootstrap
1.31 +if [ -f ../../../.lemon-bootstrap ]; then source ../../../.lemon-bootstrap; fi
1.32 +if [ -f ../../.lemon-bootstrap ]; then source ../../.lemon-bootstrap; fi
1.33 +if [ -f ../.lemon-bootstrap ]; then source ../.lemon-bootstrap; fi
1.34 +if [ -f ./.lemon-bootstrap ]; then source ./.lemon-bootstrap; fi
1.35 +
1.36 +
1.37 +function augment_config() {
1.38 + if [ "x${!1}" == "x" ]; then
1.39 + eval $1=$2
1.40 + echo Add "'$1'" to '~/.lemon-bootstrap'.
1.41 + echo >>~/.lemon-bootstrap
1.42 + echo $3 >>~/.lemon-bootstrap
1.43 + echo $1=$2 >>~/.lemon-bootstrap
1.44 + fi
1.45 +}
1.46 +
1.47 +augment_config LEMON_INSTALL_PREFIX /usr/local \
1.48 + "# LEMON installation prefix"
1.49 +
1.50 +augment_config GLPK_PREFIX /usr/local/ \
1.51 + "# GLPK installation root prefix"
1.52 +
1.53 +augment_config COIN_OR_PREFIX /usr/local/coin-or \
1.54 + "# COIN-OR installation root prefix (used for CLP/CBC)"
1.55 +
1.56 +augment_config SOPLEX_PREFIX /usr/local/soplex \
1.57 + "# Soplex build prefix"
1.58 +
1.59 +
1.60 +function ask() {
1.61 +echo -n "$1 [$2]? "
1.62 +read _an
1.63 +if [ "x$_an" == "x" ]; then
1.64 + ret="$2"
1.65 +else
1.66 + ret=$_an
1.67 +fi
1.68 +}
1.69 +
1.70 +function yesorno() {
1.71 + ret='rossz'
1.72 + while [ "$ret" != "y" -a "$ret" != "n" -a "$ret" != "yes" -a "$ret" != "no" ]; do
1.73 + ask "$1" "$2"
1.74 + done
1.75 + if [ "$ret" != "y" -a "$ret" != "yes" ]; then
1.76 + return 1
1.77 + else
1.78 + return 0
1.79 + fi
1.80 +}
1.81 +
1.82 +if yesorno "External build" "n"
1.83 +then
1.84 + CONFIGURE_PATH=".."
1.85 +else
1.86 + CONFIGURE_PATH="."
1.87 + if yesorno "Autoreconf" "y"
1.88 + then
1.89 + AUTORE=yes
1.90 + else
1.91 + AUTORE=no
1.92 + fi
1.93 +fi
1.94 +
1.95 +if yesorno "Optimize" "n"
1.96 +then
1.97 + opt_flags=' -O2'
1.98 +else
1.99 + opt_flags=''
1.100 +fi
1.101 +
1.102 +if yesorno "Stop on warning" "y"
1.103 +then
1.104 + werror_flags=' -Werror'
1.105 +else
1.106 + werror_flags=''
1.107 +fi
1.108 +
1.109 +cxx_flags="CXXFLAGS=-ggdb$opt_flags$werror_flags"
1.110 +
1.111 +if yesorno "Check with valgrind" "n"
1.112 +then
1.113 + valgrind_flags=' --enable-valgrind'
1.114 +else
1.115 + valgrind_flags=''
1.116 +fi
1.117 +
1.118 +if [ -f ${GLPK_PREFIX}/include/glpk.h ]; then
1.119 + if yesorno "Use GLPK" "y"
1.120 + then
1.121 + glpk_flag="--with-glpk=$GLPK_PREFIX"
1.122 + else
1.123 + glpk_flag="--without-glpk"
1.124 + fi
1.125 +else
1.126 + glpk_flag="--without-glpk"
1.127 +fi
1.128 +
1.129 +if [ -f ${COIN_OR_PREFIX}/include/coin/config_coinutils.h ]; then
1.130 + if yesorno "Use COIN-OR (CBC/CLP)" "n"
1.131 + then
1.132 + coin_flag="--with-coin=$COIN_OR_PREFIX"
1.133 + else
1.134 + coin_flag="--without-coin"
1.135 + fi
1.136 +else
1.137 + coin_flag="--without-coin"
1.138 +fi
1.139 +
1.140 +if [ -f ${SOPLEX_PREFIX}/src/soplex.h ]; then
1.141 + if yesorno "Use Soplex" "n"
1.142 + then
1.143 + soplex_flag="--with-soplex=$SOPLEX_PREFIX"
1.144 + else
1.145 + soplex_flag="--without-soplex"
1.146 + fi
1.147 +else
1.148 + soplex_flag="--without-soplex"
1.149 +fi
1.150 +
1.151 +if [ "x$AUTORE" == "xyes" ]; then
1.152 + autoreconf -vif;
1.153 +fi
1.154 +${CONFIGURE_PATH}/configure --prefix=$LEMON_INSTALL_PREFIX \
1.155 +$valgrind_flags \
1.156 +"$cxx_flags" \
1.157 +$glpk_flag \
1.158 +$coin_flag \
1.159 +$soplex_flag \
1.160 +$*