1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/scripts/bootstrap.sh Wed Sep 30 08:41:06 2009 +0200
1.3 @@ -0,0 +1,116 @@
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 COIN_OR_PREFIX /usr/local/coin-or \
1.51 + "# COIN-OR installation root prefix (used for CLP/CBC)"
1.52 +
1.53 +
1.54 +function ask() {
1.55 +echo -n "$1 [$2]? "
1.56 +read _an
1.57 +if [ "x$_an" == "x" ]; then
1.58 + ret="$2"
1.59 +else
1.60 + ret=$_an
1.61 +fi
1.62 +}
1.63 +
1.64 +function yesorno() {
1.65 + ret='rossz'
1.66 + while [ "$ret" != "y" -a "$ret" != "n" -a "$ret" != "yes" -a "$ret" != "no" ]; do
1.67 + ask "$1" "$2"
1.68 + done
1.69 + if [ "$ret" != "y" -a "$ret" != "yes" ]; then
1.70 + return 1
1.71 + else
1.72 + return 0
1.73 + fi
1.74 +}
1.75 +
1.76 +if yesorno "External build" "n"
1.77 +then
1.78 + CONFIGURE_PATH=".."
1.79 +else
1.80 + CONFIGURE_PATH="."
1.81 + if yesorno "Autoreconf" "y"
1.82 + then
1.83 + AUTORE=yes
1.84 + else
1.85 + AUTORE=no
1.86 + fi
1.87 +fi
1.88 +
1.89 +if yesorno "Optimize" "n"
1.90 +then
1.91 + opt_flags=' -O2'
1.92 +else
1.93 + opt_flags=''
1.94 +fi
1.95 +
1.96 +if yesorno "Stop on warning" "y"
1.97 +then
1.98 + werror_flags=' -Werror'
1.99 +else
1.100 + werror_flags=''
1.101 +fi
1.102 +
1.103 +cxx_flags="CXXFLAGS=-ggdb$opt_flags$werror_flags"
1.104 +
1.105 +if yesorno "Use COIN" "n"
1.106 +then
1.107 + coin_flag="--with-coin=$COIN_OR_PREFIX"
1.108 +else
1.109 + coin_flag=""
1.110 +fi
1.111 +
1.112 +
1.113 +if [ "x$AUTORE" == "xyes" ]; then
1.114 + autoreconf -vif;
1.115 +fi
1.116 +${CONFIGURE_PATH}/configure --prefix=$LEMON_INSTALL_PREFIX \
1.117 +"$cxx_flags" \
1.118 +$coin_flag \
1.119 +$*