scripts/bootstrap.sh
author Alpar Juttner <alpar@cs.elte.hu>
Sat, 26 Sep 2009 10:15:49 +0200
changeset 791 f8c468367dab
child 794 a42f46828cc1
permissions -rwxr-xr-x
Integrate bib2dox.py into the build environments (#184)
     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 
    18 if [ ! -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 #
    24 EOF
    25 fi
    26 
    27 source ~/.lemon-bootstrap
    28 if [ -f ../../../.lemon-bootstrap ]; then source ../../../.lemon-bootstrap; fi
    29 if [ -f ../../.lemon-bootstrap ]; then source ../../.lemon-bootstrap; fi
    30 if [ -f ../.lemon-bootstrap ]; then source ../.lemon-bootstrap; fi
    31 if [ -f ./.lemon-bootstrap ]; then source ./.lemon-bootstrap; fi
    32 
    33 
    34 function 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 
    44 augment_config LEMON_INSTALL_PREFIX /usr/local \
    45     "# LEMON installation prefix"
    46 
    47 augment_config COIN_OR_PREFIX /usr/local/coin-or \
    48     "# COIN-OR installation root prefix (used for CLP/CBC)"
    49 
    50 
    51 function ask() {
    52 echo -n "$1 [$2]? "
    53 read _an
    54 if [ "x$_an" == "x" ]; then
    55     ret="$2"
    56 else
    57     ret=$_an
    58 fi
    59 }
    60 
    61 function yesorno() {
    62     ret='rossz'
    63     while [ "$ret" != "y" -a "$ret" != "n" -a "$ret" != "yes" -a "$ret" != "no" ]; do
    64         ask "$1" "$2"
    65     done
    66     if [ "$ret" != "y" -a "$ret" != "yes" ]; then
    67         return 1
    68     else
    69         return 0
    70     fi
    71 }
    72 
    73 if yesorno "External build" "n"
    74 then
    75     CONFIGURE_PATH=".."
    76 else
    77     CONFIGURE_PATH="."
    78     if yesorno "Autoreconf" "y"
    79     then
    80         AUTORE=yes
    81     else
    82         AUTORE=no
    83     fi
    84 fi
    85 
    86 if yesorno "Optimize" "n" 
    87 then
    88     opt_flags=' -O2'
    89 else
    90     opt_flags=''
    91 fi
    92 
    93 if yesorno "Stop on warning" "y" 
    94 then
    95     werror_flags=' -Werror'
    96 else
    97     werror_flags=''
    98 fi
    99 
   100 cxx_flags="CXXFLAGS=-ggdb$opt_flags$werror_flags"
   101 
   102 if yesorno "Use COIN" "n"
   103 then
   104     coin_flag="--with-coin=$COIN_OR_PREFIX"
   105 else
   106     coin_flag=""
   107 fi
   108 
   109 
   110 if [ "x$AUTORE" == "xyes" ]; then
   111     autoreconf -vif;
   112 fi
   113 ${CONFIGURE_PATH}/configure --prefix=$LEMON_INSTALL_PREFIX \
   114 "$cxx_flags" \
   115 $coin_flag \
   116 $*