-
Notifications
You must be signed in to change notification settings - Fork 13
/
extract_gmm++
executable file
·323 lines (296 loc) · 10.5 KB
/
extract_gmm++
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# -*- perl -*-
# Copyright (C) 1999-2020 Yves Renard
#
# This file is a part of GetFEM++
#
# GetFEM++ is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version along with the GCC Runtime Library
# Exception either version 3.1 or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License and GCC Runtime Library Exception for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
eval 'exec perl -S $0 "$@"'
if 0;
$getfem_root = ".";
$MAJOR_VERSION = "5";
$MINOR_VERSION = "4";
$PATCH_VERSION = "2";
# $DATE_VERSION = -`date +%Y%m%d`;
# $DATE_VERSION = ".0";
$gmm_files = "";
$gmm_files_bis = "";
open F, "(cd $getfem_root/src/gmm && ls gmm*.h) |", or die;
while (<F>) { chomp $_; $gmm_files = "$gmm_files gmm/$_"; $gmm_files_bis = "$gmm_files_bis\\\n gmm/$_"; }
$test_files = "make_gmm_test.pl";
$test_files_bis = "\\\n make_gmm_test.pl";
open F, "(cd $getfem_root/tests && ls gmm_torture*.cc) |", or die;
while (<F>) { chomp $_; $test_files = "$test_files $_"; $test_files_bis = "$test_files_bis\\\n $_"; }
print "gmm_files = $gmm_files\n";
print "test_files = $test_files\n";
$root = `pwd`; chomp $root; $root = "$root/gmm++_standalone";
`/bin/rm -fr $root`;
`mkdir $root`;
`mkdir $root/tests`;
`mkdir $root/include`;
`mkdir $root/include/gmm`;
print `(cd $getfem_root/src && cp $gmm_files $root/include/gmm)`;
print `(cd $getfem_root/tests && cp $test_files $root/tests)`;
print `cp $getfem_root/gmm-config.in $root`;
print `cp $getfem_root/COPYING $root`;
print `cp $getfem_root/config.sub $root`;
print `cp $getfem_root/config.guess $root`;
print `cp $getfem_root/ltmain.sh $root`;
print `touch $root/ChangeLog`;
print `touch $root/NEWS`;
print `cp $getfem_root/README $root`;
print `cp $getfem_root/aclocal.m4 $root`;
print `cp $getfem_root/install-sh $root`;
print `cp -r $getfem_root/m4 $root`;
open(F, ">$root/AUTHORS") or die "Open file impossible : $!\n";
print F <<""
Authors of GMM++\n
Yves RENARD. Initial project. All the project.\n
Julien POMMIER. All the project.\n
;
close(F);
open(F, ">$root/autogen.sh") or die "Open file impossible : $!\n";
print F <<""
#!/bin/bash
function die {
echo "ERROR: $1";
exit 1
}
aclocal -I ./m4 || die "aclocal failed";
libtoolize -f || glibtoolize -f || die "libtoolize failed";
autoheader || die "autoheader failed";
autoreconf
autoconf || die "autoconf failed";
#pas de ./ devant les noms des makefiles !!!
automake -a --gnu `find . -name Makefile.am | sed -e 's@\./\(.*\)\.am@\1@g'` || die "automake failed";
;
close(F);
open(F, ">$root/tests/dummy.cc") or die "Open file impossible : $!\n";
print F <<""
#include <iostream>\n
int main(void) { return 0; }
;
close(F);
open(F, ">$root/include/Makefile.am") or die "Open file impossible : $!\n";
print F <<""
nobase_include_HEADERS=$gmm_files_bis gmm/gmm_arch_config.h
;
close(F);
open(F, ">$root/tests/Makefile.am") or die "Open file impossible : $!\n";
print F <<""
\ncheck_PROGRAMS = dummy \n
dummy_SOURCES = dummy.cc \n
INCLUDES = -I\$(top_srcdir)/include -I../include\n
LDADD = -lm \@SUPLDFLAGS\@\n
TESTS = make_gmm_test.pl\n
EXTRA_DIST=$test_files_bis
\n\nCLEANFILES = toto.mat ii_files/* auto_gmm* \n
LOG_COMPILER = perl\n
;
close(F);
open(F, ">$root/Makefile.am") or die "Open file impossible : $!\n";
print F <<""
\nACLOCAL_AMFLAGS = -I m4\n
SUBDIRS = include tests\n
EXTRA_DIST = \\
m4/ax_check_cxx_flag.m4 m4/ax_prefix_config_h.m4\n
CLEANFILES = so_locations\n
;
close(F);
open(F, ">$root/configure.ac") or die "Open file impossible : $!\n";
print F <<""
dnl Process this file with autoconf to produce a configure script.
dnl ------------------------------------------------------------------------
dnl initialisation
dnl ------------------------------------------------------------------------\n
dnl ./configure: sh internal 2K buffer overflow on HP-UX 9.xx
dnl thus, updating cache ./config.cache avoided.
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl\n
AC_INIT(gmm, $MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(config.h)
AX_PREFIX_CONFIG_H(src/gmm/gmm_arch_config.h,GMM)
AC_PREREQ(2.61)
AC_ARG_PROGRAM\n
PACKAGE="gmm"
MAJOR_VERSION="$MAJOR_VERSION"
MINOR_VERSION="$MINOR_VERSION"
PATCH_VERSION="$PATCH_VERSION"
AC_DEFINE_UNQUOTED([MAJOR_VERSION],$MAJOR_VERSION,[Major version number])
AC_DEFINE_UNQUOTED([MINOR_VERSION],$MINOR_VERSION,[Minor version number])
AC_DEFINE_UNQUOTED([PATCH_VERSION],$PATCH_VERSION,[Patch version number])
dnl VERSION=\$MAJOR_VERSION.\$MINOR_VERSION$DATE_VERSION
VERSION=\$MAJOR_VERSION.\$MINOR_VERSION
echo "configuring \$PACKAGE \$VERSION..."\n
dnl ------------------------------------------------------------------------
dnl init automake
dnl ------------------------------------------------------------------------\n
AM_INIT_AUTOMAKE([1.11 parallel-tests])\n
dnl -----------------------------------------------
dnl test du c++
dnl -----------------------------------------------\n
USER_CXXFLAGS="\$CXXFLAGS"
AC_PROG_CXX(cxx KCC CC cc++ xlC aCC g++ c++ icc)
AC_PROG_CXXCPP
CXXFLAGS="\${USER_CXXFLAGS}"
SUPLDFLAGS=""\n
AC_LANG_CPLUSPLUS\n
if test "x\$prefix" = "xNONE"; then
GFPREFIX=/usr/local;
else
GFPREFIX="\$prefix";
fi;\n
dnl AC_CXX_FULL_SPECIALIZATION_SYNTAX (c)Luc Maisonobe v 1.1.1.1 (2001/07/26)
dnl with some modification to test partial specialization
AC_CACHE_CHECK(whether the compiler recognizes the partial specialization syntax,
ac_cv_cxx_partial_specialization_syntax,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
template<class T> class A { public : int f () const { return 1; } };
template<class T> class A<T*> { public: int f () const { return 0; } };],[
A<float*> a; return a.f();],
ac_cv_cxx_partial_specialization_syntax=yes, ac_cv_cxx_partial_specialization_s
yntax=no)
AC_LANG_RESTORE
])
if test "\$ac_cv_cxx_partial_specialization_syntax" != yes; then
echo "Your compiler (\$CXX) does not support partial template specialization, trash it"
exit 1;
fi\n
AC_CANONICAL_HOST\n
echo "you are compiling gmm on a \$host"\n
case \$CXX in
cxx)
echo "Using Compaq cxx compiler"
echo "WARNING : Control that you have at least Compaq C++ V6.3"
here=`pwd`
cd \$srcdir
dnl il faut utiliser -tweak au lieu des repositories ...
CXXFLAGS="\$CXXFLAGS -tweak -std strict_ansi -fast -Wl,-S -nopure_cname"
dnl CXXFLAGS="\$CXXFLAGS -ptr `pwd`/cxx_repository -std strict_ansi -O3"
cd \$here
;;
CC)
case \$host in
*irix*)
echo "Using MIPSPRO CC on IRIX (LD is set to CC)"
LD=CC
dnl CXXFLAGS="\$CXXFLAGS -LANG:std -O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed -TARG:platform=ip25"
CXXFLAGS="\$CXXFLAGS -LANG:std -O3 "
dnl CXXFLAGS="\$CXXFLAGS -LANG:std -O3 -ansiW "
SUPLDFLAGS="-lCio"
;;
*sun*)
echo "Using SUN C++ WorkShop Compiler"
CXXFLAGS="\$CXXFLAGS +w2 -O3"
;;
esac
;;
aCC)
echo "Using HP ANSI C++ Compiler aCC"
CXXFLAGS="\$CXXFLAGS -AA -fast"
;;
g++* | c++)
GCCVER=`\$CXX --version | head -1 | cut -d ' ' -f3`
echo "Using the GNU g++ compiler \$GCCVER"
case \$GCCVER in
2.95*)
WSHADOW=""
;;
*)
WSHADOW="-Wshadow"
;;
esac
CXXFLAGS="\$CXXFLAGS -ftemplate-depth-40 -pedantic -O3 -Wall -W \$WSHADOW -Wpointer-arith -Wcast-qual -Wwrite-strings -Wconversion -Wredundant-decls -Wno-long-long"
;;
icc | icpc)
echo "Using INTEL icc"
dnl -tpp6 is for pentiumII and more
dnl -Xc is for ansi conformance
CXXFLAGS="\$CXXFLAGS -O3 -tpp6"
;;
*)
echo "Using a unknown compiler"
CXXFLAGS="\$CXXFLAGS -O3"
;;
esac\n
AC_SUBST(SUPLDFLAGS)\n
dnl ---------------------------OPENMP------------------------------
useopenmp=0
AC_ARG_ENABLE(openmp,
[AS_HELP_STRING([--enable-openmp],[enable the multithreaded version of GMM++])],
[ case \$enableval in
yes | "") useopenmp=YES ;;
no) useopenmp=NO ;;
*) AC_MSG_ERROR([bad value \${enableval} for --enable-openmp]) ;;
esac],
[useopenmp=NO]
)
if test x\$useopenmp = xYES; then
AC_OPENMP
if test "x\$ac_cv_prog_cxx_openmp" != "xunsupported" && test "x\$ac_cv_prog_cxx_openmp" != "x"; then
AC_SUBST(AM_CXXFLAGS,"\$OPENMP_CXXFLAGS")
CPPFLAGS="\$CPPFLAGS -DGMM_HAVE_OPENMP"
else
AC_MSG_ERROR([OpenMP support not found. Use --enable-openmp=no flag to compile GMM++ without OpenMP]);
fi
fi;
dnl ---------------------------END OF OPENMP-----------------------
dnl ------------------------------------------------------------------------
dnl init libtools for shared libraries
dnl ------------------------------------------------------------------------\n
dnl AC_DISABLE_FAST_INSTALL\n
AM_ENABLE_STATIC\n
dnl AM_PROG_LIBTOOL
AM_PROG_LIBTOOL
AC_SUBST([LIBTOOL_DEPS])\n
AC_CHECK_HEADERS(sys/times.h)\n
BUILDER=`whoami`
AC_SUBST(BUILDER)
BUILDDATE=`date +%D,%H:%M:%S`
AC_SUBST(BUILDDATE)
CONFIGURE_ARGS=\$ac_configure_args
AC_SUBST(CONFIGURE_ARGS)
LIBTOOL_VERSION_INFO="-version-info \${MAJOR_VERSION}:\${MINOR_VERSION}:0"
AC_SUBST(LIBTOOL_VERSION_INFO)\n
dnl AC_CHECK_PROGS(RANLIB, ranlib)\n
dnl -----------------------------------------------
dnl sorties
dnl -----------------------------------------------
AC_CONFIG_FILES(\\
Makefile \\
tests/Makefile \\
include/Makefile gmm-config)
AC_OUTPUT
chmod a+x gmm-config
chmod a+x gmm-config
;
close(F);
print `(cd $root && chmod a+x autogen.sh && ./autogen.sh)`;
print `(cd $root && ./configure)`;
open(F, ">$root/include/gmm/gmm_arch_config.h") or die "Open file impossible : $!\n";
print F <<""
# ifndef _SRC_GMM_GMM_ARCH_CONFIG_H
#define _SRC_GMM_GMM_ARCH_CONFIG_H 1
// enable the following line for OpenMP support
// #define GMM_HAVE_OPENMP
//
/* once: _SRC_GMM_GMM_ARCH_CONFIG_H */
#endif
;
close(F);
print `(cd $root && make dist)`;
print `(mv -f $root/gmm-*.tar.gz $getfem_root)`;
`/bin/rm -fr $root`;