-
Notifications
You must be signed in to change notification settings - Fork 7
/
configure
executable file
·185 lines (165 loc) · 5.91 KB
/
configure
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
PARAMETERS="$0 $*"
CMAKEFLAGS=
SRCDIR=$(dirname $(readlink -f $0))/
CURPATH="$PWD"
function help(){
echo ""
echo "ESDM uses the CMake (http://www.cmake.org) buildsystem instead of configure."
echo "CMake uses different options than configure, but you can use this script to "
echo "specify them in the traditional way and get the equivalent cmake command."
echo "Use the following options to change default paths."
echo
echo "Options:"
echo "--prefix=<dir> : installation prefix"
echo "--build-dir=<dir> : directory in which to build"
echo
echo "--help : print this usage information and exit"
echo "--version : print cmake version and exit"
echo "--reconfigure : run configure again with the parameters used the last time"
echo
echo "--debug : build with debug flags"
echo "--verbose : output the command but do not execute it"
echo
echo "--with-cc=<file> : path to the C compiler"
echo "--with-cxx=<file> : path to the C++ compiler"
echo "--with-mpicc=<file> : path to the MPI C compiler"
echo "--with-mpicxx=<file> : path to the MPI C++ compiler"
echo
echo "--with-glib=<path> : path prefix to the glib library"
echo "--with-jansson=<path> : path prefix to the jansson library"
echo "--with-ime-include=<dir> : path to ime_native.h"
echo "--with-ime-lib=<dir> : path to libim_client.so"
echo "--with-kdsa-include=<dir>: path to kdsa.h"
echo "--with-kdsa-lib=<dir> : path to libkdsa.so"
echo "--with-scil=<dir> : path prefix to scil library"
echo
echo "--enable-kdsa-dummy : compile the KDSA dummy backend"
echo "--enable-s3 : enable S3 backend using libs3"
echo "--enable-wos=<file> : path to WOS library"
echo "--enable-netcdf4 : compile the NetCDF interface"
}
# Some defaults
debug=""
VERBOSE=""
buildDIR="build"
function reconfigure(){
if [[ ! -e "configure.log" ]] ; then
echo "Error, didn't run configure before!" ;
exit 1
fi
$(cat configure.log)
exit $?
}
set -- `getopt -u -l "prefix:,build-dir:,help,version,reconfigure,debug,verbose,with-cc:,with-cxx:,with-mpicc:,with-mpicxx:,with-boost:,with-glib:,with-jansson:,with-ime-include:,with-ime-lib:,with-kdsa-include:,with-kdsa-lib:,with-scil:,enable-kdsa-dummy,enable-s3,enable-wos:,enable-netcdf4" -o "h" -- "$@"`
test $# -lt 1 && exit 1
while test $# -gt 0
do
echo $1 $2
case "$1" in
--prefix) prefix="$2"; shift;;
--build-dir) buildDIR="$2"; shift;;
--help) help; exit;;
--version) cmake --version; exit;;
--reconfigure) reconfigure;;
--debug) debug="YES"; ;;
--verbose) VERBOSE="YES"; ;;
--with-cc) ccbin="$2"; shift;;
--with-cxx) cxxbin="$2"; shift;;
--with-mpicc) mpicc="$2"; shift;;
--with-mpicxx) mpicxx="$2"; shift;;
--with-boost) boost="$2"; shift;;
--with-glib) glib="$2"; shift;;
--with-jansson) jansson="$2"; shift;;
--with-ime-include) ime_include="$2"; shift;;
--with-ime-lib) ime_lib="$2"; shift;;
--with-kdsa-include) kdsa_include="$2"; shift;;
--with-kdsa-lib) kdsa_lib="$2"; shift;;
--with-scil) scil_lib="$2"; shift;;
--enable-kdsa-dummy) kdsa_dummy="YES"; shift;;
--enable-s3) s3="YES"; shift;;
--enable-wos) wos="$2"; shift;;
--enable-netcdf4) netcdf4="YES"; echo "$2"; ;;
--) shift;;
*) echo "Unknown option $1"; exit 1;;
esac
shift
done
echo $PARAMETERS > configure.log
TARGET_DIR="/usr/local"
if test -n "$debug"; then
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_BUILD_TYPE:STRING=Debug"
else
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_BUILD_TYPE:STRING=Release"
fi
if test -n "$prefix"; then
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_INSTALL_PREFIX:PATH=$prefix"
TARGET_DIR="$prefix"
fi
if test -n "$ccbin"; then
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER:FILEPATH=$ccbin"
fi
if test -n "$cxxbin"; then
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_CXX_COMPILER:FILEPATH=$cxxbin"
fi
if test -n "$netcdf4"; then
CMAKEFLAGS="$CMAKEFLAGS -DINTERFACE_NETCDF4=ON"
fi
if test -n "$s3"; then
CMAKEFLAGS="$CMAKEFLAGS -DBACKEND_S3=ON"
fi
if test -n "$ime_lib"; then
CMAKEFLAGS="$CMAKEFLAGS -DBACKEND_IME=ON -DIME_LIB_DIR:FILEPATH=$ime_lib"
fi
if test -n "$ime_include"; then
CMAKEFLAGS="$CMAKEFLAGS -DBACKEND_IME=ON -DIME_INCLUDE_DIR:FILEPATH=$ime_include"
fi
if test -n "$kdsa_lib"; then
CMAKEFLAGS="$CMAKEFLAGS -DBACKEND_KDSA=ON -DKDSA_LIB_DIR:FILEPATH=$kdsa_lib"
fi
if test -n "$kdsa_include"; then
CMAKEFLAGS="$CMAKEFLAGS -DBACKEND_KDSA=ON -DKDSA_INCLUDE_DIR:FILEPATH=$kdsa_include"
fi
if test -n "$scil_lib"; then
export PKG_CONFIG_PATH="$scil_lib/lib/pkgconfig/:$PKG_CONFIG_PATH"
fi
if test -n "$kdsa_dummy"; then
CMAKEFLAGS="$CMAKEFLAGS -DBACKEND_KDSA_DUMMY=ON"
fi
if test -n "$mpicc"; then
CMAKEFLAGS="$CMAKEFLAGS -DMPI_C_COMPILER:FILEPATH=$mpicc"
fi
if test -n "$mpicxx"; then
CMAKEFLAGS="$CMAKEFLAGS -DMPI_CXX_COMPILER:FILEPATH=$mpicxx"
fi
if test -n "$wos"; then
CMAKEFLAGS="$CMAKEFLAGS -DWOS_wos_LIBRARY_RELEASE:PATH=$wos/lib/libwos_cpp.so -DWOS_C_INCLUDE_DIR:PATH=$wos/include"
fi
if test -n "$boost"; then
CMAKEFLAGS="$CMAKEFLAGS -DBOOST_boost_LIBRARY_RELEASE:PATH=$boost/lib/libboost_system.so -DBOOST_C_INCLUDE_DIR:PATH=$boost/include"
fi
if test -n "$glib"; then
export PKG_CONFIG_PATH="$glib/lib/pkgconfig/:$PKG_CONFIG_PATH"
fi
if test -n "$jansson"; then
export PKG_CONFIG_PATH="$jansson/lib/pkgconfig/:$PKG_CONFIG_PATH"
fi
echo
echo PKG_CONFIG_PATH='"'"$PKG_CONFIG_PATH"'"'
echo
COMMAND="mkdir -p $buildDIR && echo $PARAMETERS > $buildDIR/configure.log && cd $buildDIR && echo $PARAMETERS > configure.log ; rm CMakeCache.txt 2>/dev/null; cmake $CMAKEFLAGS $SRCDIR"
echo $COMMAND
if [[ "$VERBOSE" == "YES" ]] ; then
echo "Your current configure options translate to:"
echo "$COMMAND"
exit 0
else
set -x
eval "$COMMAND"
set +x
ERROR="$?"
if [[ "$ERROR" != 0 ]] ; then
echo "An error occurred during the configuration, aborting!"
exit 1
fi
fi