forked from FLAME-HPC/libmboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autogen.sh
executable file
·133 lines (111 loc) · 3.27 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
#!/bin/bash
# $Id$
#
# Copyright (c) 2008 STFC Rutherford Appleton Laboratory
# Author: Lee-Shawn Chin
# Date : June 2008
LOGFILE="autogen.log"
AUTOMAKE_MINVER="1.8.0"
AUTOCONF_MINVER="2.59"
echo -e "$0 begins " `date` "\n" > $LOGFILE
function complainAndQuit() {
echo "FAILED"
echo "+ see $LOGFILE for details"
exit 1
}
function checkMinVersion() {
# Usage: compareVersion MIN_VERSION CURRENT_VERSION
# returns 0 if CURRENT_VERSION >= MIN_VERSION
# returns 1 otherwise
#
# *_VERSION should be in the following format: x.y.z
#
# We can't use expr as a decimal or string compare would be wrong
# e.g. Version 1.8 < version 1.10.1
#
#
minver=$1
curver=$2
for i in 1 2 3; do
min=`echo $minver | cut -d'.' -f$i`
cur=`echo $curver | cut -d'.' -f$i`
# cast them to integers (" " becomes 0)
let min="min + 0"
let cur="cur + 0"
if [ $cur -lt $min ]; then
return 1
elif [ $cur -gt $min ]; then
return 0
fi
done
# if we reach this point, they are both equal
return 0
}
# check automake version
ver=`automake --version 2>/dev/null | sed -e '1s/[^0-9]*//' -e q`
checkMinVersion "$AUTOMAKE_MINVER" "$ver"
if test $? -ne 0; then
echo "ERROR: automake (version >= $AUTOMAKE_MINVER) is required" >&2
exit 1
fi
# check autoconf version
ver=`autoconf --version 2>/dev/null | sed -e '1s/[^0-9]*//' -e q`
checkMinVersion "$AUTOCONF_MINVER" "$ver"
if test $? -ne 0; then
echo "ERROR: autoconf (version >= $AUTOCONF_MINVER) is required" >&2
exit 1
fi
# check for autoheader
ver=`autoheader --version 2>/dev/null | sed -e '1s/[^0-9]*//' -e q`
if test x$ver = x; then
echo "ERROR: autoheader is required." >&2
echo " Plese install autoheader and try again." >&2
exit 1
fi
# check for aclocal
ver=`aclocal --version 2>/dev/null | sed -e '1s/[^0-9]*//' -e q`
if test x$ver = x; then
echo "ERROR: aclocal is required." >&2
echo " Plese install aclocal and try again." >&2
exit 1
fi
# check for libtoolize
ver=`libtoolize --version 2>/dev/null | sed -e '1s/[^0-9]*//' -e q`
if test "x$ver" == "x"; then
echo "ERROR: libtoolize is required." >&2
echo " Plese install libtoolize and try again." >&2
exit 1
fi
# pre-create README file so automake doesn't complain
touch README
echo -n "Running libtoolize ... "
echo "(libtoolize)" >> $LOGFILE
libtoolize --copy --force >> $LOGFILE 2>> $LOGFILE
if test ! $? = 0; then complainAndQuit; fi
echo "DONE"
echo -n "Running aclocal ... "
echo "(aclocal)" >> $LOGFILE
aclocal -I m4 >> $LOGFILE 2>> $LOGFILE
if test ! $? = 0; then complainAndQuit; fi
echo "DONE"
echo -n "Running autoheader ... "
echo "(autoheader)" >> $LOGFILE
autoheader >> $LOGFILE 2>> $LOGFILE
if test ! $? = 0; then complainAndQuit; fi
echo "DONE"
echo -n "Running automake ... "
echo "(automake)" >> $LOGFILE
automake --add-missing >> $LOGFILE 2>> $LOGFILE
if test ! $? = 0; then complainAndQuit; fi
echo "DONE"
echo -n "Running autoconf ... "
echo "(autoconf)" >> $LOGFILE
autoconf >> $LOGFILE 2>> $LOGFILE
if test ! $? = 0; then complainAndQuit; fi
echo "DONE"
echo -n "Overwriting 'COPYING' file ... "
echo "(overwritng COPYING)" >> $LOGFILE
(rm COPYING; touch COPYING) >> $LOGFILE 2>> $LOGFILE
if test ! $? = 0; then complainAndQuit; fi
echo "DONE"
echo -e "\n\n$0 ends " `date` "\n" >> $LOGFILE