summaryrefslogtreecommitdiff
path: root/toolchain/dependencies/dependencies.sh
blob: 427440bf060d8ea9f3dba9e9ce3ccdf29a65b2b7 (plain)
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
#!/bin/sh

set -e
#set -x

echo ""
echo "Checking build system dependencies:"

#############################################################
#
# check build system 'sed'
#
#############################################################
if test -x /usr/bin/sed ; then
	SED="/usr/bin/sed"
else
	if test -x /bin/sed ; then
		SED="/bin/sed"
	else
		SED="sed"
	fi
fi
echo "HELLO" > .sedtest
$SED -i -e "s/HELLO/GOODBYE/" .sedtest >/dev/null 2>&1
if test $? != 0 ; then
	echo "sed works:			    No, using buildroot version instead"
else
	echo "sed works:			    Ok"
fi
XSED=$HOST_SED_DIR/bin/sed

#############################################################
#
# check build system 'make'
#
#############################################################
MAKE=$(which make)
if [ -z "$MAKE" ] ; then
	echo "make installed:		    FALSE"
	echo -e "\n\nYou must install 'make' on your build machine\n";
	exit 1;
fi;
MAKE_VERSION=$($MAKE --version 2>&1 | head -n1 | $XSED -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g')
if [ -z "$MAKE_VERSION" ] ; then
	echo "make installed:		    FALSE"
	echo -e "\n\nYou must install 'make' on your build machine\n";
	exit 1;
fi;
MAKE_MAJOR=$(echo $MAKE_VERSION | $XSED -e "s/\..*//g")
MAKE_MINOR=$(echo $MAKE_VERSION | $XSED -e "s/^$MAKE_MAJOR\.//g" -e "s/\..*//g" -e "s/[a-zA-Z].*//g")
if [ $MAKE_MAJOR -lt 3 -o $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 8 ] ; then
	echo "You have make '$MAKE_VERSION' installed.  GNU make >=3.80 is required"
	exit 1;
fi;
echo "GNU make version '$MAKE_VERSION':	    Ok"



#############################################################
#
# check build system 'gcc'
#
#############################################################
COMPILER=$(which gcc)
if [ -z "$COMPILER" ] ; then
	COMPILER=$(which cc)
	if [ -z "$COMPILER" ] ; then
		echo "gcc installed:		    FALSE"
		echo -e "\n\nYou must install 'gcc' on your build machine\n";
		exit 1;
	fi;
fi;
COMPILER_VERSION=$($COMPILER --version 2>&1 | head -n1 | $XSED -e 's/^.* \([0-9\.]\)/\1/g' -e "s/[-\ ].*//g")
if [ -z "$COMPILER_VERSION" ] ; then
	echo "gcc installed:		    FALSE"
	echo -e "\n\nYou must install 'gcc' on your build machine\n";
	exit 1;
fi;
COMPILER_MAJOR=$(echo $COMPILER_VERSION | $XSED -e "s/\..*//g")
COMPILER_MINOR=$(echo $COMPILER_VERSION | $XSED -e "s/^$COMPILER_MAJOR\.//g" -e "s/\..*//g")
if [ $COMPILER_MAJOR -lt 3 -o $COMPILER_MAJOR -eq 2 -a $COMPILER_MINOR -lt 95 ] ; then
	echo "You have gcc '$COMPILER_VERSION' installed.  gcc >= 2.95 is required"
	exit 1;
fi;
echo "gcc version '$COMPILER_VERSION':		    Ok"




#############################################################
#
# check build system 'which'
#
#############################################################
if ! which which > /dev/null ; then
	echo "which installed:		    FALSE"
	echo -e "\n\nYou must install 'which' on your build machine\n";
	exit 1;
fi;
echo "which installed:		    Ok"


#############################################################
#
# check build system 'bison'
#
#############################################################
if ! which bison > /dev/null ; then
	echo "bison installed:		    FALSE"
	echo -e "\n\nYou must install 'bison' on your build machine\n";
	exit 1;
fi;
echo "bison installed:		    Ok"


#############################################################
#
# check build system 'flex'
#
#############################################################
if ! which flex > /dev/null ; then
	echo "flex installed:		    FALSE"
	echo -e "\n\nYou must install 'flex' on your build machine\n";
	exit 1;
fi;
echo "flex installed:			    Ok"


#############################################################
#
# check build system 'gettext'
#
#############################################################
if ! which msgfmt > /dev/null ; then \
	echo "gettext installed:		    FALSE"
	echo -e "\n\nYou must install 'gettext' on your build machine\n"; \
	exit 1; \
fi;
echo "gettext installed:		    Ok"





#############################################################
#
# All done
#
#############################################################
echo "Build system dependencies:	    Ok"
echo ""