1#! /bin/bash -e 2# ----------------------------------------------------------------------------- 3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-20 Bradley M. Bell 4# 5# CppAD is distributed under the terms of the 6# Eclipse Public License Version 2.0. 7# 8# This Source Code may also be made available under the following 9# Secondary License when the conditions for such availability set forth 10# in the Eclipse Public License, Version 2.0 are satisfied: 11# GNU General Public License, Version 2.0 or later. 12# ----------------------------------------------------------------------------- 13# $begin get_adolc.sh$$ $newlinech #$$ 14# $dollar @$$ 15# $spell 16# tgz 17# Adolc 18# gz 19# CppAD 20# Nov 21# $$ 22# 23# $section Download and Install Adolc in Build Directory$$ 24# 25# $head Syntax$$ 26# $code bin/get_adolc.sh$$ 27# 28# $head Purpose$$ 29# If you are using Unix, this command will download and install 30# $cref/Adolc/adolc/Adolc Home Page/$$ 31# in the CppAD $code build$$ directory. 32# 33# $head Requirements$$ 34# You must first use $cref get_colpack.sh$$ to download and install 35# the ColPack coloring algorithms (used for sparse matrix derivatives). 36# 37# $head Distribution Directory$$ 38# This command must be executed in the 39# $cref/distribution directory/download/Distribution Directory/$$. 40# 41# $head Source Directory$$ 42# The Adolc source code is downloaded into the sub-directory 43# $code external/adolc.git$$ below the distribution directory. 44# 45# $head Prefix$$ 46# The $cref/prefix/get_optional.sh/prefix/$$ 47# in the file $code bin/get_optional.sh$$ is used for this install. 48# 49# $head Version$$ 50# This will install the following version of Adolc 51# $srccode%sh% 52version='e1fe476' 53# %$$ 54# This corresponds to the git master on Nov 13, 2020. 55# 56# $head Configuration$$ 57# If the file 58# $codei% 59# external/adolc-%version%.configured 60# %$$ 61# exists, the configuration will be skipped. 62# Delete this file if you want to re-run the configuration. 63# 64# $end 65# ----------------------------------------------------------------------------- 66package='adolc' 67if [ $0 != "bin/get_$package.sh" ] 68then 69 echo "bin/get_$package.sh: must be executed from its parent directory" 70 exit 1 71fi 72# ----------------------------------------------------------------------------- 73# bash function that echos and executes a command 74echo_eval() { 75 echo $* 76 eval $* 77} 78# ----------------------------------------------------------------------------- 79web_page='https://github.com/coin-or/ADOL-C.git' 80cppad_dir=`pwd` 81# ----------------------------------------------------------------------------- 82# prefix 83eval `grep '^prefix=' bin/get_optional.sh` 84if [[ "$prefix" =~ ^[^/] ]] 85then 86 prefix="$cppad_dir/$prefix" 87fi 88echo "prefix=$prefix" 89# ----------------------------------------------------------------------------- 90configured_flag="external/$package-${version}.configured" 91echo "Executing get_$package.sh" 92if [ -e "$configured_flag" ] 93then 94 echo "Skipping configuration because $configured_flag exits" 95 echo_eval cd external/$package.git/build 96 echo_eval make install 97 echo "get_$package.sh: OK" 98 exit 0 99fi 100# -------------------------------------------------------------------------- 101if [ -e /usr/lib64 ] 102then 103 libdir='lib64' 104else 105 libdir='lib' 106fi 107# ----------------------------------------------------------------------------- 108if [ ! -d external ] 109then 110 echo_eval mkdir external 111fi 112echo_eval cd external 113# ----------------------------------------------------------------------------- 114if [ ! -e "$package.git" ] 115then 116 echo_eval git clone $web_page $package.git 117fi 118echo_eval cd $package.git 119echo_eval git reset --hard 120echo_eval git checkout --quiet $version 121# ----------------------------------------------------------------------------- 122system=`uname | tr [A-Z] [a-z] | sed -e 's|\([a-z][a-z]*\).*|\1|'` 123# ----------------------------------------------------------------------------- 124if which autoconf >& /dev/null 125then 126 echo_eval autoreconf --install --force 127fi 128# ----------------------------------------------------------------------------- 129if [ ! -e build ] 130then 131 echo_eval mkdir build 132fi 133echo_eval cd build 134# ----------------------------------------------------------------------------- 135flags="--prefix=$prefix --with-colpack=$prefix --libdir=$prefix/$libdir" 136flags="$flags --enable-static --enable-shared --enable-atrig-erf" 137# 138echo_eval ../configure $flags 139echo_eval make install 140# ----------------------------------------------------------------------------- 141echo_eval touch $cppad_dir/$configured_flag 142echo "get_$package: OK" 143