-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·54 lines (44 loc) · 1.27 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
#!/bin/sh
prefix=/usr/local
cxx=g++
HERE="$(dirname "$(readlink -f "${0}")")"
CONF="${HERE}/val-config.in"
MAKE="${HERE}/Makefile.in"
includeflag="-I${HERE}/include"
#echo $CONF
for arg in "$@"; do
case "$arg" in
--prefix=*)
prefix=`echo $arg | sed 's/--prefix=//'`
;;
--cxx=*)
cxx=`echo $arg | sed 's/--cxx=//'`
;;
--help|-h)
echo 'usage: ./configure [options]'
echo 'options:'
echo ' --prefix=<path>: installation prefix (else prefix=/usr/local)'
echo ' --cxx=<command>: c++ compiler (else cxx=g++)'
exit 0
;;
esac
done
PRIMPATH="char primlistpath[] = \"${prefix}/share/valmath/data/primlis1.txt\";"
#PRIMPATH="char primlistpath[] = ${HERE}"
#echo $PRIMPATH
echo 'changing val_basis.cpp'
sed -i "8s#.*#${PRIMPATH}#" "${HERE}/src/val_basics.cpp"
echo 'generating makefile ...'
echo "PREFIX=$prefix" > Makefile
echo "DIRPATH = $HERE" >> Makefile
echo "CXX=$cxx" >> Makefile
echo "INCLUDEFLAG = $includeflag" >> Makefile
cat $MAKE >> Makefile
echo 'generating val-config'
mkdir -p bin
echo '#!/bin/sh' > bin/val-config
echo "" >> bin/val-config
echo "PREFIX=$prefix" >> bin/val-config
cat $CONF >> bin/val-config
chmod 755 bin/val-config
echo 'configuration complete, type make to build.'