forked from JulianKunkel/md-workbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·139 lines (122 loc) · 4.62 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
#!/bin/bash
PARAMETERS="$0 $*"
CMAKEFLAGS=
if [ "$(uname -s)" = 'Linux' ]; then
SRCDIR=$(dirname $(readlink -f $0))/
else
SRCDIR=$(dirname $(readlink $0))/
fi
CURPATH="$PWD"
function help(){
echo ""
echo "MD-REAL-IO 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
echo "Optional:"
echo "--build-dir=<dir> : directory in which to build"
echo "--debug : build with debug flags"
echo "--verbose : output the command but do not execute it"
echo "--reconfigure : run configure again with the parameters used the last time"
echo "--with-cc=<compiler> : path to the C compiler"
echo "--with-mpi=<dir> : path to MPI"
echo "--with-mpicc=<file> : path to mpicc"
echo "--with-mpic++=<file> : path to mpic++"
echo "--with-mpi-lib=<dir> : path to MPI libs"
echo "--with-mpi-include=<dir> : path to MPI include"
echo "--minimal : do not try to load extra plugins"
echo "--with-libpq=<dir> : path to libpq necessary for the postgres plugin"
echo "--with-mongoc=<dir> : path to mongoc library necessary for the mongodb plugin"
echo "--with-libs3=<dir> : path to libs3 library necessary for the Amazon S3 plugin"
echo
}
function reconfigure(){
if [[ ! -e "configure.log" ]] ; then
echo "Error, didn't run configure before!" ;
exit 1
fi
$(cat configure.log)
exit $?
}
function check(){
if [[ "$1" == "" ]] ; then
return
fi
where=$1
what=$2
if [[ ! -e "$where" ]] ; then
echo "Error could not find $what in $where ; directory does not exist"
exit 1
fi
export PKG_CONFIG_PATH=$where/lib/pkgconfig/:$PKG_CONFIG_PATH
#does not ship with pkg-config
pkg-config --exists $what
if [ $? != 0 ] ; then
if [[ -e $where/include && -e $where/lib ]] ; then
AI="$AI $where/include"
AL="$AL $where/lib"
else
echo "Error could not find $what in $where"
exit 1
fi
fi
}
buildDIR="build"
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_BUILD_TYPE:STRING=release"
set -- `getopt -u -l "help,version,debug,reconfigure,prefix:,with-cc:,with-mongoc:,with-mpic++:,with-mpicc:,with-mpi-lib:,with-mpi-include:,with-libs3:,plantuml-jar-dir:,with-mpi:,with-libpq:,verbose,build-dir:,minimal" -o "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) CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_BUILD_TYPE:STRING=debug" ;;
--with-cc) CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_C_COMPILER:FILEPATH=$2"; export CC=$2; shift;;
--minimal) CMAKEFLAGS="$CMAKEFLAGS -DCONFIGURE_MINIMAL:BOOL=TRUE"; PQ=1 ;;
--with-mpicc) CMAKEFLAGS="$CMAKEFLAGS -DMPI_C_COMPILER:FILEPATH=$2"; shift;;
--with-mpic++) CMAKEFLAGS="$CMAKEFLAGS -DMPI_CXX_COMPILER:FILEPATH=$2"; shift;;
--with-mpi-lib) AL="$AL $2"; CMAKEFLAGS="$CMAKEFLAGS -DMPI_C_LIBRARIES:STRING=$2 -DMPI_CXX_LIBRARIES:STRING=$2"; shift;;
--with-mpi-include) AI="$AI $2"; CMAKEFLAGS="$CMAKEFLAGS -DMPI_C_INCLUDE_PATH:STRING=$2 -DMPI_CXX_INCLUDE_PATH:STRING=$2"; shift;;
--with-mpi) check "$2" "mpi"; shift;;
--with-libpq) check "$2" "libpq"; PQ=1; shift;;
--with-mongoc) check "$2" "libmongoc-1.0"; shift;;
--with-libs3) check "$2" "libs3"; shift;;
--build-dir) buildDIR="$2"; shift;;
--verbose) VERBOSE="YES";;
-V) VERBOSE="YES";;
--) ;;
*) echo "Unknown option $1"; exit 1;;
esac
shift
done
if [[ "$PQ" == "" ]] ; then
if [[ $(pg_config --version 2>/dev/null) != "" ]] ; then
CMAKEFLAGS="$CMAKEFLAGS -DLIBPQ_LIBDIR:INTERNAL="$(pg_config --libdir)" -DLIBPQ_INCLUDE_DIRS="$(pg_config --includedir)" -DLIBPQ_LIBS:INTERNAL=pq -DLIBPQ_LIBRARIES:INTERNAL=pq -DLIBPQ_VERSION=$(pg_config --version | cut -d " " -f 2)"
fi
fi
echo $PARAMETERS > configure.log
TARGET_DIR="/usr/local"
if test -n "$prefix"; then
CMAKEFLAGS="$CMAKEFLAGS -DCMAKE_INSTALL_PREFIX:PATH=$prefix"
TARGET_DIR="$prefix"
fi
export ADDITIONAL_INC_PATH=$AI
export ADDITIONAL_LIB_PATH=$AL
# pkg-config --list-all
COMMAND="mkdir -p $buildDIR && cd $buildDIR && echo $PARAMETERS > configure.log ; rm CMakeCache.txt 2>/dev/null; cmake $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