File: run_configure.sh

package info (click to toggle)
cppad 2026.00.00.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,588 kB
  • sloc: cpp: 112,960; sh: 6,146; ansic: 179; python: 71; sed: 12; makefile: 10
file content (137 lines) | stat: -rwxr-xr-x 3,401 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#! /usr/bin/env bash
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-24 Bradley M. Bell
# ----------------------------------------------------------------------------
set -e -u
echo $0 $*
# ----------------------------------------------------------------------------
if [ ! -e "bin/run_configure.sh" ]
then
   echo "bin/run_configure.sh: must be executed from its parent directory"
   exit 1
fi
# -----------------------------------------------------------------------------
with_clang=''
with_verbose_make=''
cpp_standard='c++17'
with_vector=''
while [ "$#" != '0' ]
do
   if [ "$1" == '--help' ]
   then
      cat << EOF
usage: bin/run_configure.sh \\
   [--help] \\
   [--clang] \\
   [--verbose_make] \\
   [--c++<yy> ] \\
   [--<package>_vector]
The value yy is two decimal digits specifying the C++ standard year.
The value <package> must be one of: cppad, boost, eigen, std.

EOF
      exit 0
   fi
   case "$1" in

      --clang)
      with_clang='--with-clang'
      ;;

      --verbose_make)
      with_verbose_make='--with-verbose-make'
      ;;

      --c++*)
      cpp_standard=$(echo "$1" | sed -e 's|^--||')
      ;;

      --cppad_vector)
      with_vector=''
      ;;

      --boost_vector)
      with_vector='--with-boostvector'
      ;;

      --eigen_vector)
      with_vector='--with-eigenvector'
      ;;

      --std_vector)
      with_vector='--with-stdvector'
      ;;

      *)
      echo "$1 is an invalid option, try bin/run_configure.sh --help"
      exit 1

   esac
   shift
done
# -----------------------------------------------------------------------------
# bash function that echos and executes a command
echo_eval() {
   echo $*
   eval $*
}
# -----------------------------------------------------------------------------
# prefix
eval `grep '^prefix=' bin/get_optional.sh`
if [[ "$prefix" =~ ^[^/] ]]
then
   prefix="$(pwd)/$prefix"
fi
echo "prefix=$prefix"
# -----------------------------------------------------------------------------
#
# PKG_CONFIG_PATH
PKG_CONFIG_PATH="$prefix/lib64/pkgconfig:$prefix/lib/pkgconfig"
PKG_CONFIG_PATH="$prefix/share/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH
#
# cppad_cxx_flags
cppad_cxx_flags="-std=$cpp_standard -Wall -pedantic-errors -Wshadow"
cppad_cxx_flags+=" -Wfloat-conversion -Wconversion"
if [ "$(uname)" == 'Darwin' ]
then
   if which brew > /dev/null
   then
      cppad_cxx_flags+=" -I $(brew --prefix)/include"
   fi
fi
# 2DO: clang++ 14.05 is generating a lot of warnings (we should fix these)
#
# scaado_prefix
cxx_standard_year=$(echo $cpp_standard | sed -e 's|c++||')
if [ "$cxx_standard_year" -lt 17 ]
then
   scaado_prefix=''
else
   scaado_prefix="SACADO_DIR=$prefix"
fi
#
# ---------------------------------------------------------------------------
if [ ! -e build ]
then
   echo_eval mkdir build
fi
echo_eval cd build
# -----------------------------------------------------------------------------
../configure \
   --prefix=$prefix \
   $with_clang \
   $with_verbose_make \
   $with_vector \
   MAX_NUM_THREADS=32 \
   CXX_FLAGS="'$cppad_cxx_flags'" \
   ADOLC_DIR=$prefix \
   FADBAD_DIR=$prefix \
   IPOPT_DIR=$prefix \
   $scaado_prefix \
   TAPE_ADDR_TYPE=size_t \
   TAPE_ID_TYPE=size_t
# ----------------------------------------------------------------------------
echo "$0: OK"
exit 0