-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathautogen.sh
executable file
·99 lines (83 loc) · 2.4 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
#!/bin/sh
#
# Execute this script to generate a configure script
#
# This file is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.
#
plugin=milonga
# check for needed tools (cannot put this into an m4 macro
# because we do not even know if we have m4 available)
for i in git m4 autoconf xargs; do
if [ -z "`which $i`" ]; then
echo "error: $i not installed"
exit 1
fi
done
echo -n "autogen: cleaning... "
./autoclean.sh
echo "ok"
echo -n "autogen: updating wasora, "
if [ -e ../wasora/.git ]; then
WASORA_REPO=../wasora/.git
else
WASORA_REPO=https://github.com/seamplex/wasora.git
fi
if [ ! -e wasora ]; then
echo -n "cloning... ";
git clone ${WASORA_REPO} || exit 1
else
echo -n "pulling... "
cd wasora; git checkout -q master; git pull || exit 1; cd ..
fi
echo "ok"
if [ -e sha_wasora ]; then
echo -n "autogen: checking out... "
cd wasora; git checkout -q master; git checkout -q `cat ../sha_wasora`; cd ..
echo "ok"
fi
echo -n "autogen: bootstrapping... "
m4 wasora/m4/bootstrap.m4 - << EOF | sh -s $1 || exit 1
plugin=${plugin}
WASORA_CHECK_VCS
PLUGIN_VERSION_VCS
WASORA_README_INSTALL
EOF
echo "ok"
echo -n "autogen: building makefile.am... "
am="src/Makefile.am"
echo -n "building $am... "
cat << EOF > $am
include \$(SLEPC_DIR)/lib/slepc/conf/slepc_variables
EOF
# this variable is set by petsc somewhere and we need it empty to make install
# apparently undefine DESTDIR is supported by GNU Make >= 3.82
makever=`make -v | head -n1 | cut -d' ' -f3`
makemajor=`echo $makever | cut -d. -f1`
makeminor=`echo $makever | cut -d. -f2`
if [ $makemajor -ge 4 -o $makeminor -ge 82 ]; then
echo unexport DESTDIR >> $am
fi
cat << EOF >> $am
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = \$(ACLOCAL_FLAGS)
bin_PROGRAMS = ${plugin}
${plugin}_CFLAGS = -I../wasora/src \$(SLEPC_CC_INCLUDES) \$(PETSC_CC_INCLUDES) \$(CC_INCLUDES) \$(all_includes) -DHARDCODEDPLUGIN
${plugin}_LDADD = \$(STANDALONELIBS) \$(SLEPC_LIB) \$(all_libraries)
${plugin}_LDFLAGS = -rdynamic
${plugin}_SOURCES = \\
EOF
cd src
find . -maxdepth 2 \( -name "*.c" -o -name "*.h" \) | xargs echo -n >> ../$am
echo "\\" >> ../$am
find ../wasora/src -maxdepth 2 \( -name "*.c" -o -name "*.h" \) | xargs echo >> ../$am
cd ..
cat << EOF >> $am
version.\$(OBJEXT): version.h
version.h: Makefile
./version.sh
EOF
echo "ok"
echo -n "autogen: autoreconfiguring... "
autoreconf -i
echo "ok"