-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·170 lines (153 loc) · 4.7 KB
/
configure
File metadata and controls
executable file
·170 lines (153 loc) · 4.7 KB
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
#!/bin/bash
#
# Copyright (c) 2016 HLRS, University of Stuttgart. All rights reserved.
#
# Author(s): Marius Poke <[email protected]>
#
echo "$0 $@" > config.log
define(){ IFS='\n' read -r -d '' ${1} || true; }
define HELP <<'EOF'
Script for creating Makefile
usage : $0 [options]
options: [--prefix=DIR] # Installation directory
[--with-ev=DIR] # ev installation directory
[--with-mpfr=DIR] # mpfr installation directory
[--with-gmp=DIR] # gmp installation directory
[--enable-ibv] # enable IBV network module
[--with-ibv=DIR] # IB verbs installation directory
[--with-rdmacm=DIR] # RDMA-CM installation directory
EOF
usage () {
echo -e "$HELP"
}
ErrorAndExit () {
echo "ERROR: $1"
exit 1
}
CheckDirectory () {
if [ ! -d $2 ]
then
ErrorAndExit "$1: Folder $2 not found."
fi
}
ForceAbsolutePath () {
case "$2" in
/* )
;;
*)
ErrorAndExit "Expected an absolute path for $1"
;;
esac
}
########################
# Command line parsing #
########################
PREFIX=$PWD
EVDIR=""
MPFRDIR=""
GMPDIR=""
AC_IBV=""
IBVDIR=""
RDMACMDIR=""
IBV_LIB=""
RDMACM_LIB=""
RDMACM_INC=""
DEF_AC_IBV=""
MF="Makefile"
#~ if [[ "x${HOSTNAME:0:7}" == "xeslogin" ]]; then
#~ MPICC=cc
#~ else
#~ MPICC=mpicc
#~ fi
for arg in "$@"
do
case ${arg} in
--help|-help|-h)
usage
exit 1
;;
--prefix=*)
PREFIX=`echo $arg | sed -e 's/--prefix=//'`
PREFIX=`eval echo ${PREFIX}` # tilde and variable expansion
ForceAbsolutePath "--prefix" "${PREFIX}"
;;
--with-ev=*)
EVDIR=`echo $arg | sed -e 's/--with-ev=//'`
EVDIR=`eval echo ${EVDIR}` # tilde and variable expansion
CheckDirectory "--with-ev" "${EVDIR}"
;;
--with-mpfr=*)
MPFRDIR=`echo $arg | sed -e 's/--with-mpfr=//'`
MPFRDIR=`eval echo ${MPFRDIR}` # tilde and variable expansion
CheckDirectory "--with-mpfr" "${MPFRDIR}"
;;
--with-gmp=*)
GMPDIR=`echo $arg | sed -e 's/--with-gmp=//'`
GMPDIR=`eval echo ${GMPDIR}` # tilde and variable expansion
CheckDirectory "--with-gmp" "${GMPDIR}"
;;
--enable-ibv)
AC_IBV="\$(AC_IBV)"
DEF_AC_IBV="-DAC_IBV"
;;
--with-ibv=*)
IBVDIR=`echo $arg | sed -e 's/--with-ibv=//'`
IBVDIR=`eval echo ${IBVDIR}` # tilde and variable expansion
CheckDirectory "--with-ibv" "${IBVDIR}"
;;
--with-rdmacm=*)
RDMACMDIR=`echo $arg | sed -e 's/--with-rdmacm=//'`
RDMACMDIR=`eval echo ${RDMACMDIR}` # tilde and variable expansion
CheckDirectory "--with-rdmacm" "${RDMACMDIR}"
;;
esac
done
if [[ "x$EVDIR" == "x" ]]; then
ErrorAndExit "No libev installation directory defined: --with-ev."
fi
if [[ "x$MPFRDIR" == "x" ]]; then
ErrorAndExit "No MPFR installation directory defined: --with-mpfr."
fi
if [[ "x$GMPDIR" == "x" ]]; then
ErrorAndExit "No GMP installation directory defined: --with-gmp."
fi
if [[ "x${AC_IBV}" != "x" ]]; then
# IB Verbs enabled
if [[ "x$IBVDIR" == "x" ]]; then
# no IB Verbs installation provided; look for one on the system
OUT=`/sbin/ldconfig -p | grep librdma`
if [[ "x$OUT" == "x" ]]; then
ErrorAndExit "IBV network module requires librdmacm: --with-rdmacm."
fi
OUT=`/sbin/ldconfig -p | grep libibverbs`
if [[ "x$OUT" == "x" ]]; then
ErrorAndExit "IBV network module requires libibverbs: --with-ibv."
# use own RDMA-CM
fi
IBV_LIB="-libverbs"
RDMACM_LIB="-lrdmacm"
else
# IB Verbs installation provided
if [[ "x$RDMACMDIR" == "x" ]]; then
ErrorAndExit "IBV network module requires librdmacm: --with-rdmacm."
fi
IBV_LIB="-L${IBVDIR}/lib/ -Wl,-rpath=${IBVDIR}/lib/ -libverbs"
RDMACM_LIB="-L${RDMACMDIR}/lib/ -Wl,-rpath=${RDMACMDIR}/lib/ -lrdmacm"
RDMACM_INC="-I${RDMACMDIR}/include/"
fi
fi
# Generate Makefile from Makefile.in
cp ${MF}.in ${MF}
sed -e 's,#PREFIX#,'${PREFIX}',' \
-e 's,#EV_LIB#,'${EVDIR}'/lib/libev.a,' \
-e 's,#EV_INCLUDE#,-I'${EVDIR}'/include,' \
-e 's,#MPFR_LIB#,'${MPFRDIR}'/lib/libmpfr.a,' \
-e 's,#MPFR_INCLUDE#,-I'${MPFRDIR}'/include,' \
-e 's,#GMP_LIB#,'${GMPDIR}'/lib/libgmp.a,' \
-e 's,#GMP_INCLUDE#,-I'${GMPDIR}'/include,' \
-e 's,#AC_IBV#,'${AC_IBV}',' \
-e 's,#DEF_AC_IBV#,'${DEF_AC_IBV}',' \
-e 's|#IBV_LIB#|'"${IBV_LIB}"'|g' \
-e 's|#RDMACM_LIB#|'"${RDMACM_LIB}"'|g' \
-e 's,#RDMACM_INC#,'${RDMACM_INC}',' \
${MF} > sed.out && mv sed.out ${MF} || exit 1