forked from joobog/io-probing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·129 lines (113 loc) · 4.02 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
#!/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-md-workbench=<dir> : path to MD-Workbench dir"
echo "--with-mpi-include=<dir> : path to MPI include"
echo "--minimal : do not try to load extra plugins"
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-mpic++:,with-mpicc:,with-mpi-lib:,with-mpi-include:,plantuml-jar-dir:,with-mpi:,with-md-workbench:,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" ;;
--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-md-workbench) AI="$AI $2"; CMAKEFLAGS="$CMAKEFLAGS -DMDWB_DIR:STRING=$2"; shift;;
--build-dir) buildDIR="$2"; shift;;
--verbose) VERBOSE="YES";;
-V) VERBOSE="YES";;
--) ;;
*) echo "Unknown option $1"; exit 1;;
esac
shift
done
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