-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·147 lines (124 loc) · 3.21 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
#!/bin/sh
SOURCE_DIR=$(dirname $(readlink -f $0))
# Default to Intel compilers
CC="icc"
CXX="icpc"
FC="ifort"
CCFLAGS="-vec-report0"
CXXFLAGS="-vec-report0"
FCFLAGS="-align sequence -vec-report0"
CC_DEBUG_FLAGS=""
CXX_DEBUG_FLAGS=""
FC_DEBUG_FLAGS=""
prefix=$PWD
test_bigendian=FALSE
gtest_dir=""
help=FALSE
verbose=FALSE
shared="OFF"
python="OFF"
fortran="OFF"
ac_prev=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
case $ac_option in
--with-gnu)
CC="gcc"
CXX="g++"
FC="gfortran"
CCFLAGS=""
CXXFLAGS=""
FCFLAGS=""
;;
--with-intel)
CC="icc"
CXX="icpc"
FC="ifort"
CCFLAGS="-vec-report0"
CXXFLAGS="-vec-report0"
FCFLAGS="-align sequence -vec-report0"
;;
--debug | -debug)
CC_DEBUG_FLAGS="-O0 -g"
CXX_DEBUG_FLAGS="-O0 -g"
FC_DEBUG_FLAGS="-O0 -g"
;;
--test-bigendian)
test_bigendian=TRUE ;;
--build-unittests)
build_unittests=TRUE ;;
-h | -help | --help)
help=TRUE ;;
-prefix | --prefix)
ac_prev=prefix ;;
-prefix=* | --prefix=*)
prefix=$ac_optarg ;;
-gtest-dir | --gtest-dir)
ac_prev=gtest_dir ;;
-gtest-dir=* | --gtest-dir=*)
gtest_dir=$ac_optarg ;;
-v | -verbose | --verbose)
verbose=TRUE ;;
--enable-shared)
shared="ON" ;;
--enable-python)
python="ON" ;;
--enable-fortran)
fortran="ON" ;;
-*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
esac
done
# Be sure to have absolute path
case $prefix in
[\\/$]* | ?:[\\/]* | NONE | '' ) ;;
*) { echo "$as_me: error: expected an absolute directory name for --prefix: $prefix" >&2
{ (exit 1); exit 1; }; };;
esac
if [ "xTRUE" = "x$help" ]; then
echo "Usage: ./configure"
echo " [--with-gnu] Use GNU compilers"
echo " [--with-intel] Use Intel compilers (default)"
echo " [--with-pg] Use Portland Group compilers"
echo " [--prefix=\$INSTALL_PATH]"
echo " [--test-bigendian] Run tests with big endian swapping"
echo " [--gtest-dir=\$GTEST_PATH] Build unit tests with Google Test"
echo " [--enable-shared] Build shared library (.so)"
echo " [--enable-python] Build python bindings"
echo " [--enable-fortran] Build fortran bindings"
echo " [--debug]"
echo " [-v | --verbose]"
echo " [-h | --help]"
exit
fi
if [ "xTRUE" = "x$test_bigendian" ]; then
case $FC in
gfortran) FCFLAGS="$FCFLAGS -fconvert=big-endian" ;;
pgf90) FCFLAGS="$FCFLAGS -byteswapio" ;;
ifort) FCFLAGS="$FCFLAGS -convert big_endian" ;;
esac
fi
cmake \
-DENABLE_SHARED_LIBRARY="$shared" \
-DENABLE_PYTHON="$python" \
-DENABLE_FORTRAN="$fortran" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL="$verbose" \
-DCMAKE_C_COMPILER:FILEPATH="$CC" \
-DCMAKE_C_FLAGS:STRING="$CCFLAGS $CC_DEBUG_FLAGS" \
-DCMAKE_CXX_COMPILER:FILEPATH="$CXX" \
-DCMAKE_CXX_FLAGS:STRING="$CXXFLAGS $CXX_DEBUG_FLAGS" \
-DCMAKE_Fortran_COMPILER:FILEPATH="$FC" \
-DCMAKE_Fortran_FLAGS:STRING="$FCFLAGS $FC_DEBUG_FLAGS" \
-DCMAKE_INSTALL_PREFIX:PATH="$prefix" \
-DGTEST_DIR:PATH="$gtest_dir" \
-DTEST_BIGENDIAN:BOOL="$test_bigendian" \
$SOURCE_DIR