-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure
executable file
·159 lines (144 loc) · 5.42 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
#!/bin/bash
PARAMETERS="$0 $*"
CMAKEFLAGS=
SRCDIR=$(dirname $(readlink -f $0))
CURPATH="$PWD"
function help(){
echo ""
echo "SIOX 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 "--prefix=<dir> : installation prefix"
echo "--with-boost=<dir> : path to the boost library root directory"
echo "--with-cc=<file> : path to the C compiler"
echo "--with-cxx=<file> : path to the C++ compiler"
echo "--with-glib=<dir> : path to the GLIB2 installation"
echo "--with-likwid=<dir> : path to the patched LIKWID version"
echo "--with-python=<file> : path to the Python interpreter"
echo "--with-libpq=<dir> : path to PostgreSQL's libpq"
echo "--with-libpqxx=<dir> : path to PostgreSQL's libpqxx"
echo "--with-libpq-type-dir=<dir>: path to PostgreSQL's type directory"
echo
echo "Optional:"
echo "--build-dir=<dir> : directory in which to build"
echo "--build-wrappers : build the wrappers for MPI, POSIX, etc. that is in the path"
echo "--debug : build SIOX with debug flags"
echo "--use-ninja : use the Ninja build tool instead of the old fashioned make"
echo "--verbose : output the command but do not execute it"
echo "--reconfigure : run configure again with the parameters used the last time"
echo "The following list of options is only needed if you choose to build the wrappers with cmake"
echo "--with-mpicc=<file> : path to the MPI C compiler"
echo "--with-mpicxx=<file> : path to the MPI C++ compiler"
echo
}
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 -ul "help,version,debug,reconfigure,with-boost:,with-libpq-type-dir:,with-libpqxx:,prefix:,with-cc:,with-cxx:,with-glib:,with-mpicc:,with-mpicxx:,with-libpq:,with-python:,with-likwid:,build-wrappers,use-ninja,verbose,build-dir:" hV "$@"`
test $# -lt 1 && exit 1
while test $# -gt 0
do
case "$1" in
--help) help; exit;;
--reconfigure) reconfigure;;
--version) cmake --version; exit;;
--prefix) prefix="$2"; shift;;
--debug) debug="yes"; ;;
--with-boost) boostdir="$2"; shift;;
--with-cc) ccbin="$2"; shift;;
--with-cxx) cxxbin="$2"; shift;;
--with-glib) glib="$2"; shift;;
--with-libpq) libpq="$2"; shift;;
--with-mpicc) mpicc="$2"; shift;;
--with-mpicxx) mpicxx="$2"; shift;;
--with-python) python="$2"; shift;;
--with-libpqxx) libpqxx="$2"; shift;;
--with-likwid) likwid="$2"; shift;;
--build-dir) buildDIR="$2"; shift;;
--build-wrappers) buildWrappers="YES";;
--with-libpq-type-dir)
CMAKEFLAGS="$CMAKEFLAGS -DPostgreSQL_TYPE_INCLUDE_DIR:PATH=$1"
shift;;
--use-ninja) useNinja="YES";;
--verbose) VERBOSE="YES";;
--) ;;
*) 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 "$glib"; then
CMAKEFLAGS="$CMAKEFLAGS -DGLIB_ROOT_DIR:PATH=$glib"
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 "$boostdir"; then
CMAKEFLAGS="$CMAKEFLAGS -DBOOST_ROOT:PATH=$boostdir"
CMAKEFLAGS="$CMAKEFLAGS -DBOOST_INCLUDEDIR:PATH=$boostdir/include/"
CMAKEFLAGS="$CMAKEFLAGS -DBOOST_LIBRARYDIR:PATH=$boostdir/lib/"
CMAKEFLAGS="$CMAKEFLAGS -DBoost_NO_SYSTEM_PATHS:BOOL=ON"
fi
if test -n "$python"; then
CMAKEFLAGS="$CMAKEFLAGS -DPYTHON_EXECUTABLE:FILEPATH=$python"
fi
if test -n "$likwid"; then
CMAKEFLAGS="$CMAKEFLAGS -DLIKWID_INCLUDE_DIR:PATH=\"$likwid/include\""
CMAKEFLAGS="$CMAKEFLAGS -DLIKWID_LIBRARY_DIR:PATH=\"$likwid/lib\""
fi
if test -n "$libpq"; then
CMAKEFLAGS="$CMAKEFLAGS -DPostgreSQL_TYPE_INCLUDE_DIR=$libpq/include" # this is probably a bug in some FindPostgreSQL.cmake
CMAKEFLAGS="$CMAKEFLAGS -DPostgreSQL_INCLUDE_DIR:PATH=$libpq/include"
CMAKEFLAGS="$CMAKEFLAGS -DPostgreSQL_LIBRARY_DIR:PATH=$libpq/lib"
CMAKEFLAGS="$CMAKEFLAGS -DPostgreSQL_ROOT:PATH=$libpq"
fi
if test -n "$libpqxx"; then
CMAKEFLAGS="$CMAKEFLAGS -DPQXX_INCLUDE_DIR:PATH=$libpqxx/include"
CMAKEFLAGS="$CMAKEFLAGS -DPQXX_LIBRARY_DIR:PATH=$libpqxx/lib"
fi
if test -n "$buildWrappers"; then
CMAKEFLAGS="$CMAKEFLAGS -DBUILD_WRAPPERS:BOOL=ON"
fi
NINJA=""
if [[ "$useNinja" == "YES" ]] ; then
NINJA="-GNinja"
fi
COMMAND="mkdir -p $buildDIR && cd $buildDIR && echo $PARAMETERS > configure.log ; rm CMakeCache.txt 2>/dev/null; cmake $NINJA $CMAKEFLAGS $SRCDIR"
if [[ "$VERBOSE" == "YES" ]] ; then
echo "Your current configure options translate more or less to:"
echo "$COMMAND"
exit 0
else
eval "$COMMAND"
ERROR="$?"
if [[ "$ERROR" != 0 ]] ; then
echo "An error occurred during the configuration, aborting!"
exit 1
fi
fi