forked from pmodels/oshmpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autogen.sh
executable file
·237 lines (197 loc) · 8.92 KB
/
autogen.sh
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#! /usr/bin/env bash
#
# (C) 2018 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
##########################################
## Generic Utility Functions
##########################################
ROOTDIR=$(pwd)
echo_n() {
# "echo_n" isn't portable, must portably implement with printf
printf "%s" "$*"
}
check_autotools_version()
{
tool=$1
req_ver=$2
curr_ver=$($tool --version | head -1 | cut -f4 -d' ' | xargs echo -n)
if [ "$curr_ver" != "$req_ver" ]; then
echo ""
echo "$tool version mismatch ($req_ver) required"
exit 1
fi
}
insert_file_by_key() {
key=$1
file=$2
origfile=$3
awk -v f=$file "//; /$key/{while(getline<f){print}};" $origfile >tmp
mv tmp $origfile
}
# checking submodules
check_submodule_presence() {
if test ! -f "$ROOTDIR/$1/configure.ac"; then
echo "Submodule $1 is not checked out"
exit 1
fi
}
##########################################
## Autotools Version Check
##########################################
echo_n "Checking for autoconf version..."
check_autotools_version autoconf 2.69
echo "done"
echo_n "Checking for automake version..."
check_autotools_version automake 1.15
echo "done"
echo_n "Checking for libtool version..."
check_autotools_version libtool 2.4.6
echo "done"
echo ""
##########################################
## Automatically generate typed/sized APIs
##########################################
echo "Generating initial header file ./include/shmem.h.in"
cp ./include/shmem.h.in.tpl ./include/shmem.h.in
echo "Initial header file ./include/shmem.h.in generated"
echo ""
echo "Generating RMA APIs header file..."
./maint/build_typed_api.pl --typefile ./maint/rma_typedef.txt \
--tplfile ./include/shmem_rma_typed.h.tpl --outfile ./include/shmem_rma_typed.h
insert_file_by_key "SHMEM_RMA_TYPED_H start" ./include/shmem_rma_typed.h include/shmem.h.in
echo "-- replaced SHMEM_RMA_TYPED_H in include/shmem.h.in"
./maint/build_sized_api.pl --sizefile ./maint/rma_sizedef.txt \
--tplfile ./include/shmem_rma_sized.h.tpl --outfile ./include/shmem_rma_sized.h
insert_file_by_key "SHMEM_RMA_SIZED_H start" ./include/shmem_rma_sized.h include/shmem.h.in
echo "-- inserted SHMEM_RMA_SIZED_H in include/shmem.h.in"
echo ""
echo "Generating AMO typed APIs header file..."
./maint/build_typed_api.pl --typefile ./maint/amo_std_typedef.txt \
--tplfile ./include/shmem_amo_std_typed.h.tpl --outfile ./include/shmem_amo_std_typed.h
insert_file_by_key "SHMEM_AMO_STD_TYPED_H start" ./include/shmem_amo_std_typed.h include/shmem.h.in
echo "-- inserted SHMEM_AMO_STD_TYPED_H in include/shmem.h.in"
./maint/build_typed_api.pl --typefile ./maint/amo_ext_typedef.txt \
--tplfile ./include/shmem_amo_ext_typed.h.tpl --outfile ./include/shmem_amo_ext_typed.h
insert_file_by_key "SHMEM_AMO_EXT_TYPED_H start" ./include/shmem_amo_ext_typed.h include/shmem.h.in
echo "-- inserted SHMEM_AMO_EXT_TYPED_H in include/shmem.h.in"
./maint/build_typed_api.pl --typefile ./maint/amo_bitws_typedef.txt \
--tplfile ./include/shmem_amo_bitws_typed.h.tpl --outfile ./include/shmem_amo_bitws_typed.h
insert_file_by_key "SHMEM_AMO_BITWS_TYPED_H start" ./include/shmem_amo_bitws_typed.h include/shmem.h.in
echo "-- inserted SHMEM_AMO_BITWS_TYPED_H in include/shmem.h.in"
echo ""
echo "Generating Collective reduction typed APIs header file..."
./maint/build_typed_api.pl --typefile ./maint/reduce_maxmin_typedef.txt \
--tplfile ./include/shmem_reduce_minmax_typed.h.tpl --outfile ./include/shmem_reduce_minmax_typed.h
insert_file_by_key "SHMEM_REDUCE_MINMAX_TYPED_H start" ./include/shmem_reduce_minmax_typed.h include/shmem.h.in
echo "-- inserted SHMEM_REDUCE_MINMAX_TYPED_H in include/shmem.h.in"
./maint/build_typed_api.pl --typefile ./maint/reduce_sumprod_typedef.txt \
--tplfile ./include/shmem_reduce_sumprod_typed.h.tpl --outfile ./include/shmem_reduce_sumprod_typed.h
insert_file_by_key "SHMEM_REDUCE_SUMPROD_TYPED_H start" ./include/shmem_reduce_sumprod_typed.h include/shmem.h.in
echo "-- inserted SHMEM_REDUCE_SUMPROD_TYPED_H in include/shmem.h.in"
./maint/build_typed_api.pl --typefile ./maint/reduce_bitws_typedef.txt \
--tplfile ./include/shmem_reduce_bitws_typed.h.tpl --outfile ./include/shmem_reduce_bitws_typed.h
insert_file_by_key "SHMEM_REDUCE_BITWS_TYPED_H start" ./include/shmem_reduce_bitws_typed.h include/shmem.h.in
echo "-- inserted SHMEM_REDUCE_BITWS_TYPED_H in include/shmem.h.in"
echo ""
echo "Generating Point-To-Point synchronization typed APIs header file..."
./maint/build_typed_api.pl --typefile ./maint/p2p_typedef.txt \
--tplfile ./include/shmem_p2p_typed.h.tpl --outfile ./include/shmem_p2p_typed.h
insert_file_by_key "SHMEM_P2P_TYPED_H start" ./include/shmem_p2p_typed.h include/shmem.h.in
echo "-- inserted SHMEM_P2P_TYPED_H in include/shmem.h.in"
echo ""
# clean up header file after all template replacement
./maint/code-cleanup.sh ./include/shmem.h.in
echo "Header file ./include/shmem.h.in format cleaned"
echo ""
echo "Generating RMA APIs source files..."
./maint/build_typed_api.pl --typefile ./maint/rma_typedef.txt \
--tplfile ./src/shmem/rma_typed.c.tpl --outfile ./src/shmem/rma_typed.c
echo "-- ./src/shmem/rma_typed.c done"
./maint/code-cleanup.sh ./src/shmem/rma_typed.c
echo "-- ./src/shmem/rma_typed.c format cleaned"
./maint/build_sized_api.pl --sizefile ./maint/rma_sizedef.txt \
--tplfile ./src/shmem/rma_sized.c.tpl --outfile ./src/shmem/rma_sized.c
echo "-- ./src/shmem/rma_sized.c done"
./maint/code-cleanup.sh ./src/shmem/rma_sized.c
echo "-- ./src/shmem/rma_sized.c format cleaned"
echo ""
echo "Generating AMO sized APIs source files..."
./maint/build_typed_api.pl --typefile ./maint/amo_std_typedef.txt \
--tplfile ./src/shmem/amo_std_typed.c.tpl --outfile ./src/shmem/amo_std_typed.c
echo "-- ./src/shmem/amo_std_typed.c done"
./maint/code-cleanup.sh ./src/shmem/amo_std_typed.c
echo "-- ./src/shmem/amo_std_typed.c format cleaned"
./maint/build_typed_api.pl --typefile ./maint/amo_ext_typedef.txt \
--tplfile ./src/shmem/amo_ext_typed.c.tpl --outfile ./src/shmem/amo_ext_typed.c
echo "-- ./src/shmem/amo_ext_typed.c done"
./maint/code-cleanup.sh ./src/shmem/amo_ext_typed.c
echo "-- ./src/shmem/amo_ext_typed.c format cleaned"
./maint/build_typed_api.pl --typefile ./maint/amo_bitws_typedef.txt \
--tplfile ./src/shmem/amo_bitws_typed.c.tpl --outfile ./src/shmem/amo_bitws_typed.c
echo "-- ./src/shmem/amo_bitws_typed.c done"
./maint/code-cleanup.sh ./src/shmem/amo_bitws_typed.c
echo "-- ./src/shmem/amo_bitws_typed.c format cleaned"
echo ""
echo "Generating Collective reduction typed APIs source files..."
./maint/build_typed_api.pl --typefile ./maint/reduce_maxmin_typedef.txt \
--tplfile ./src/shmem/reduce_minmax_typed.c.tpl --outfile ./src/shmem/reduce_minmax_typed.c
echo "-- ./src/shmem/reduce_minmax_typed.c done"
./maint/code-cleanup.sh ./src/shmem/reduce_minmax_typed.c
echo "-- ./src/shmem/reduce_minmax_typed.c format cleaned"
./maint/build_typed_api.pl --typefile ./maint/reduce_sumprod_typedef.txt \
--tplfile ./src/shmem/reduce_sumprod_typed.c.tpl --outfile ./src/shmem/reduce_sumprod_typed.c
echo "-- ./src/shmem/reduce_sumprod_typed.c done"
./maint/code-cleanup.sh ./src/shmem/reduce_sumprod_typed.c
echo "-- ./src/shmem/reduce_sumprod_typed.c format cleaned"
./maint/build_typed_api.pl --typefile ./maint/reduce_bitws_typedef.txt \
--tplfile ./src/shmem/reduce_bitws_typed.c.tpl --outfile ./src/shmem/reduce_bitws_typed.c
echo "-- ./src/shmem/reduce_bitws_typed.c done"
./maint/code-cleanup.sh ./src/shmem/reduce_bitws_typed.c
echo "-- ./src/shmem/reduce_bitws_typed.c format cleaned"
echo ""
echo "Generating Point-To-Point synchronization typed APIs source files..."
./maint/build_typed_api.pl --typefile ./maint/p2p_typedef.txt \
--tplfile ./src/shmem/p2p_typed.c.tpl --outfile ./src/shmem/p2p_typed.c
echo "-- ./src/shmem/p2p_typed.c done"
./maint/code-cleanup.sh ./src/shmem/p2p_typed.c
echo "-- ./src/shmem/p2p_typed.c format cleaned"
echo ""
##########################################
## Others
##########################################
subdirs=tests
# workaround empty include directory which is required when generate configure
for subdir in $subdirs ; do
if [ ! -d $subdir/include ]; then
mkdir -p $subdir/include
fi
done
# copy confdb
echo ""
for subdir in $subdirs ; do
subconfdb_dir=$subdir/confdb
echo_n "Syncronizing confdb -> $subconfdb_dir... "
if [ -x $subconfdb_dir ] ; then
rm -rf "$subconfdb_dir"
fi
cp -pPR confdb "$subconfdb_dir"
echo "done"
done
# autogen for submodules
extdirs="src/openpa"
for extdir in $extdirs ; do
echo ""
echo "=== Running third-party initialization in $extdir ==="
check_submodule_presence $extdir
if [ -d "$extdir" -o -L "$extdir" ] ; then
(cd $extdir && ./autogen.sh) || exit 1
echo "done"
fi
done
# generate configures
for subdir in . $subdirs ; do
echo ""
echo "=== Generating configure in $subdir ==="
(cd $subdir && autoreconf -vif) || exit 1
echo "done"
done