-
Notifications
You must be signed in to change notification settings - Fork 125
/
autogen.sh
executable file
·133 lines (118 loc) · 3.84 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
#!/usr/bin/env sh
#
# SpanDSP - a series of DSP components for telephony
#
# autogen script
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 2.1,
# as published by the Free Software Foundation.
#
# 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 General Public License 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., 675 Mass Ave, Cambridge, MA 02139, USA.
UNAME=`uname`
if [ "x$UNAME" = "xFreeBSD" ]; then
echo ""
echo ""
echo "******************************************"
echo "*** NOTICE ***"
echo "******************************************"
echo " "
echo "FreeBSD is buggy. Please use this "
echo "workaround if you want to bootstrap "
echo "on FreeBSD. "
echo " "
echo "cd /usr/local/share/aclocal19 "
echo "ln -s ../aclocal/libtool15.m4 . "
echo "ln -s ../aclocal/ltdl15.m4 . "
echo " "
echo "******************************************"
echo ""
fi
debug ()
{
# Outputs debug statments if DEBUG var is set
if [ ! -z "$DEBUG" ]; then
echo "DEBUG: $1"
fi
}
version_compare()
{
# Checks a command is found and the version is high enough
PROGRAM=$1
MAJOR=$2
MINOR=$3
MICRO=$4
test -z "$MAJOR" && MAJOR=0
test -z "$MINOR" && MINOR=0
test -z "$MICRO" && MICRO=0
debug "Checking $PROGRAM >= $MAJOR.$MINOR.$MICRO"
WHICH_PATH=`whereis which | cut -f2 -d' '`
COMMAND=`$WHICH_PATH $PROGRAM`
if [ -z $COMMAND ]; then
echo "$PROGRAM-$MAJOR.$MINOR.$MICRO is required and was not found."
return 1
else
debug "Found $COMMAND"
fi
INS_VER=`$COMMAND --version | head -1 | sed 's/[^0-9]*//' | cut -d' ' -f1`
INS_MAJOR=`echo $INS_VER | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
INS_MINOR=`echo $INS_VER | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
INS_MICRO=`echo $INS_VER | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
test -z "$INS_MAJOR" && INS_MAJOR=0
test -z "$INS_MINOR" && INS_MINOR=0
test -z "$INS_MICRO" && INS_MICRO=0
debug "Installed version: $INS_VER"
if [ "$INS_MAJOR" -gt "$MAJOR" ]; then
debug "MAJOR: $INS_MAJOR > $MAJOR"
return 0
elif [ "$INS_MAJOR" -eq "$MAJOR" ]; then
debug "MAJOR: $INS_MAJOR = $MAJOR"
if [ "$INS_MINOR" -gt "$MINOR" ]; then
debug "MINOR: $INS_MINOR > $MINOR"
return 0
elif [ "$INS_MINOR" -eq "$MINOR" ]; then
if [ "$INS_MICRO" -ge "$MICRO" ]; then
debug "MICRO: $INS_MICRO >= $MICRO"
return 0
else
debug "MICRO: $INS_MICRO < $MICRO"
fi
else
debug "MINOR: $INS_MINOR < $MINOR"
fi
else
debug "MAJOR: $INS_MAJOR < $MAJOR"
fi
echo "You have the wrong version of $PROGRAM. The minimum required version is $MAJOR.$MINOR.$MICRO"
echo " and the version installed is $INS_MAJOR.$INS_MINOR.$INS_MICRO ($COMMAND)."
return 1
}
# Check for required version and die if unhappy
mkdir config
if [ "x$UNAME" = "xDarwin" ]; then
version_compare glibtoolize 1 5 16 || exit 1
version_compare automake 1 9 5 || exit 1
version_compare autoconf 2 59 || exit 1
elif [ "x$UNAME" = "xFreeBSD" ]; then
version_compare libtoolize 1 5 16 || exit 1
version_compare automake19 1 9 5 || exit 1
version_compare autoconf259 2 59 || exit 1
else
version_compare libtoolize 1 5 16 || exit 1
version_compare automake 1 9 5 || exit 1
version_compare autoconf 2 59 || exit 1
fi
autoreconf -fi
#chmod ug+x debian/rules
if [ "x$UNAME" = "xNetBSD" ]; then
echo ""
echo "Please remember to run gmake instead of make on NetBSD"
echo ""
fi