-
Notifications
You must be signed in to change notification settings - Fork 14
/
autogen.sh
executable file
·204 lines (177 loc) · 5.21 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/sh
#
# @file autogen
# @brief script for setingup build environment
# @date $Date: 2007-01-06 18:08:52 $
# @author Noriaki Ando <[email protected]>
#
# Copyright (C) 2003-2006
# Noriaki Ando
# Intelligent Systems Research Institute,
# National Institute of
# Advanced Industrial Science and Technology (AIST), Japan
# All rights reserved.
#
# $Id: autogen 2033 2011-01-19 15:43:25Z n-ando $
#
#
# autogen [--clean] [--prepare]
#
# --clean : delete all automatically generated file
# --prepare: copy necessary files to build
#
prefix="/usr/local/bin/"
am_ver="19"
am_ver2="-1.9"
ac_ver="259"
ac_ver2="-2.59"
lt_ver="15"
lt_ver2="-1.5"
am_autogen="aclocal.m4 config.guess config.sub missing install-sh"
#lt_autogen="ltmain.sh"
other_gen="autom4te.cache configure libtool.m4 *.log configure.scan config.status libtool depcomp configure.lineno"
#------------------------------------------------------------
# find_cmd(): find command by "which"
#
# @param $1 file names
# @return ${cmd_path} full path of the command
find_cmd()
{
for cmd in $1 ; do
cmd_path=`which ${cmd} 2> /dev/null`
if [ "x$cmd_path" != "x" ] ; then
break
fi
done
if [ "x$cmd_path" = "x" ] ; then
echo "commands were not found: $1"
exit
fi
}
#------------------------------------------------------------
# find_file(): find file by given path list and given file names
#
# @param $1 path list
# @param $2 file name list
# @return ${file_path} full path of the found file
find_file()
{
for path in $1 ; do
for cmd in $2 ; do
if [ -f ${path}/${cmd} ] ; then
file_path=${path}/${cmd}
echo "file was found: ${file_path}"
return
fi
done
done
if [ "x$file_path" = "x" ] ; then
echo "file was not found."
exit
fi
}
delete_autogen_files()
{
# Delete automatically generated files
rm -rf ${am_autogen} ${lt_autogen} ${other_gen}
}
find_autotools()
{
echo "------------------------------------------------------------"
echo " Searching Autotools"
echo "------------------------------------------------------------"
#============================================================
# find autoconf family commands
# autoconf
find_cmd "autoconf${ac_ver} autoconf${ac_ver2} autoconf"
ac_cmd=${cmd_path}
# autoheader
find_cmd "autoheader${ac_ver} autoheader${ac_ver2} autoheader"
ah_cmd=${cmd_path}
# autom4te
find_cmd "autom4te${ac_ver} autom4te${ac_ver2} autom4te"
am4_cmd=${cmd_path}
# autoreconf
find_cmd "autoreconf${ac_ver} autoreconf${ac_ver2} autoreconf"
ar_cmd=${cmd_path}
# autoupdate
find_cmd "autoupdate${ac_ver} autoupdate${ac_ver2} autoupdate autoupdates"
aup_cmd=${cmd_path}
#============================================================
# find automake
find_cmd "automake${am_ver} automake${am_ver2} automake"
am_cmd=${cmd_path}
# aclocal
find_cmd "aclocal${am_ver} aclocal${am_ver2} aclocal"
al_cmd=${cmd_path}
#============================================================
# find libtool
find_cmd "libtool${lt_ver} libtool${lt_ver2} libtool"
lt_cmd=${cmd_path}
# libtoolize
find_cmd "libtoolize${lt_ver} libtoolize${lt_ver2} libtoolize glibtoolize"
ltz_cmd=${cmd_path}
echo "autoconf was found in ${ac_cmd}."
echo "autoheader was found in ${ah_cmd}."
echo "autom4te was found in ${am4_cmd}."
echo "autoreconf was found in ${ar_cmd}."
echo "autoupdate was found in ${aup_cmd}."
echo "automake was found in ${am_cmd}."
echo "aclocal was found in ${al_cmd}."
echo "libtool was found in ${lt_cmd}."
echo "libtoolize was found in ${ltz_cmd}."
echo ""
export AUTOCONF=${ac_cmd}
export AUTOHEADER=${ah_cmd}
export AUTOM4TE=${am4_cmd}
export AUTORECONF=${ar_cmd}
export AUTOUPDATE=${aup_cmd}
export AUTOMAKE=${am_cmd}
export ACLOCAL=${al_cmd}
export LIBTOOL=${lt_cmd}
export LIBTOOLIZE=${ltz_cmd}
echo ""
}
do_prepare()
{
echo "------------------------------------------------------------"
echo " Searching libtool.m4"
echo "------------------------------------------------------------"
find_file "/usr/local/share/aclocal /usr/local/share/aclocal${ac_ver}
/usr/local/share/aclocal${ac_ver2}
/opt/local/share/aclocal
/usr/share/aclocal /usr/share/aclocal${ac_ver}
/usr/share/aclocal${ac_ver2}" \
"libtool.m4 libtool${lt_ver}.m4 libtool${lt_ver2}.m4
libtool${ac_ver}.m4 libtool${ac_ver2}.m4"
libtool_m4=${file_path}
echo ""
echo " Copying libtool.m4 from ${libtool_m4}"
cp -f ${libtool_m4} libtool.m4
cp -f ${libtool_m4} src/lib/coil/libtool.m4
echo ""
}
do_autoreconf()
{
echo "------------------------------------------------------------"
echo " Doing autoreconf"
echo "------------------------------------------------------------"
${ar_cmd} --install --force -v
echo "done"
echo ""
}
if [ "x$1" = "x--clean" ]; then
delete_autogen_files
exit
fi
if [ "x$1" = "x--prepare" ]; then
do_prepare
exit
fi
echo ""
echo "Setting up environment to generate configure script."
echo ""
find_autotools
delete_autogen_files
do_prepare
do_autoreconf