COIN-OR::LEMON - Graph Library

source: lemon-main/scripts/bootstrap.sh @ 985:eb12ad2789fc

Last change on this file since 985:eb12ad2789fc was 850:e77b621e6e7e, checked in by Alpar Juttner <alpar@…>, 15 years ago

Configurable glpk prefix in ./scripts/bootstrap.sh and ...
unneeded solver backends are explicitely switched off with --without-*

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