-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
374 lines (327 loc) · 12.1 KB
/
configure.ac
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#
# Copyright (C) 2013, 2014, 2015 Linaro, Inc
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# 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 General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
dnl
dnl This script configures the build machine to have what it needs to
dnl build and test a GNU toolchain.
dnl
AC_PREREQ(2.59c)
AC_INIT(abe, 2.0dev)
AC_CONFIG_SRCDIR([abe.sh])
dnl AC_CONFIG_HEADERS([config.h])
dnl AC_CONFIG_MACRO_DIR([macros])
dnl --------------------------------------------------------
dnl Figure out development tool stuff
dnl --------------------------------------------------------
missing=
optional=
AC_PROG_CC
AC_PROG_CXX
if test x"${CC}" = x -a x"${CXX}" = x; then
AC_MSG_ERROR([You need 'gcc' and 'g++' to fully run abe!])
missing="${missing} gcc"
fi
AC_PROG_INSTALL
dnl AC_CANONICAL_BUILD
dnl AC_CANONICAL_HOST
dnl Get and store often used information on this build machine
CPUS="`nproc --all`"
AC_SUBST(CPUS)
LIBC="`getconf GNU_LIBC_VERSION`"
AC_SUBST(LIBC)
KERNEL="`uname -r`"
AC_SUBST(KERNEL)
BUILDHOST="`${srcdir}/config.guess`"
BUILD_ARCH="`uname -m`"
if test x"`uname -s`" = "xDarwin"; then
BUILD_ARCH="`uname -p`"
fi
AC_SUBST(BUILD_ARCH)
AC_SUBST(BUILDHOST)
HOSTNAME="`uname -n`"
AC_SUBST(HOSTNAME)
DISTRIBUTION="`lsb_release -sc`"
AC_SUBST(DISTRIBUTION)
AC_PATH_PROG(WGET, wget)
AC_SUBST(WGET)
if test x"${WGET}" = x; then
AC_MSG_WARN([You need 'wget' to fully run abe!])
missing="${missing} wget"
fi
dnl AC_PATH_PROG(GITBZR, git-bzr)
AC_PATH_PROG(BASH, bash)
AC_SUBST(BASH)
if test x"${BASH}" = x; then
AC_MSG_WARN([You need Bash to run configure properly!])
missing="${missing} bash"
fi
AC_PATH_PROG(FLEX, flex)
if test x"${FLEX}" = x; then
AC_MSG_WARN([You need 'flex' to run configure GCC properly!])
missing="${missing} flex"
fi
AC_PATH_PROG(BISON, bison)
if test x"${BISON}" = x; then
AC_MSG_WARN([You need 'bison' to run configure GCC properly!])
missing="${missing} bison"
fi
AC_PATH_PROG(AUTOGEN, autogen)
if test x"${AUTOGEN}" = x; then
AC_MSG_WARN([You need 'autogen' to run configure for GCC properly!])
missing="${missing} autogen"
fi
dnl Building GDB requires ncurses and termcap
#AC_CHECK_LIB(ncurses, doupdate)
#if test x${ac_cv_lib_ncurses_doupdate} != x"yes"; then
# AC_MSG_WARN([You need 'libncurses' to run configure for GDB properly!])
# missing="${missing} libncurses5-dev"
#fi
AC_CHECK_LIB(z, gzread)
# Figure out which packaging system is in use. Since it's possible to
# install both on a system.
deb="`grep -ic 'ubuntu\|debian' /etc/issue`"
dnl Look for packages that do not have executables, so we are forced
dnl to ask the packaging system if they are installed. This is more
dnl reliable and portble than using pkg-config.
#packages="git-svn bzr-fastimport svn-all-fast-exp libncurses5-dev texinfo"
packages="texinfo gawk"
### Debian packages ###
if test ${deb} -ge 1; then
# add Ubuntu specific packages
packages="${packages} libncurses5-dev python3-dev zlib1g-dev"
for i in ${packages}; do
AC_MSG_CHECKING([if $i is installed])
#exists=`dpkg --get-selections | grep -c "^$i\[[:space:]\]*install"`
exists="`dpkg -l $i | tail -1| cut -d ' ' -f 1`"
if test x"${exists}" != x'ii'; then
AC_MSG_RESULT([no, install $i])
missing="${missing} $i"
else
AC_MSG_RESULT([yes])
fi
done
### RPM Packages ###
else
if which rpm > /dev/null; then
packages="${packages} ncurses-devel python3-devel zlib-devel"
for i in ${packages}; do
AC_MSG_CHECKING([if $i is installed])
# RPM based systems might install via meta-packages but the rpm database
# can't be searched on meta-package name, so strip off any trailing
# information when searching the rpm database.
exists="`rpm -q -a ${i//.*/}| grep -c -E \"${i//.*/}\"`"
if test ${exists:-0} -eq 0; then
AC_MSG_RESULT([no, install $i])
missing="${missing} $i"
else
AC_MSG_RESULT([yes])
fi
done
### Arch Packages ###
else
if which pacman > /dev/null; then
packages="${packages} zlib"
for i in ${packages}; do
AC_MSG_CHECKING([if $i is installed])
exists="`pacman -Qs ${i} | wc -l`"
if test ${exists} -eq 0; then
AC_MSG_RESULT([no, install $i])
missing="${missing} $i"
else
AC_MSG_RESULT([yes])
fi
done
### Unknown Packages ###
else
AC_MSG_WARN([Unknown package management system])
fi # Arch
fi # RPM
fi # Debian
dnl FIXME: Look for git-svn and git-bzr, bzr-fastimport svn-all-fast-export
dnl Get build date for helping us debugging
BUILDDATE="`date +%Y%m%d`"
AC_SUBST(BUILDDATE)
dnl The top of the abe tree
AC_ARG_WITH(toplevel,
AC_HELP_STRING([--with-toplevel], []),
ABE_TOP=${withval},
ABE_TOP="${PWD}")
AC_SUBST(ABE_TOP)
if test ! -d ${ABE_TOP}; then
AC_MSG_WARN([${ABE_TOP} does not exist so creating directory!])
mkdir -p ${ABE_TOP}
fi
AC_ARG_WITH(sources-conf,
AC_HELP_STRING([--with-sources-conf], []),
SOURCES_CONF=${withval},
SOURCES_CONF="${srcdir}/config/sources.conf"
dir="`dirname ${SOURCES_CONF}`"
base="`cd ${dir} && pwd`"
conf="`basename ${SOURCES_CONF}`"
SOURCES_CONF="${base}/${conf}")
AC_SUBST(SOURCES_CONF)
ABE_PATH=$(readlink -f ${srcdir})
AC_SUBST(ABE_PATH)
dnl The local directory where snapshots are stored
AC_ARG_WITH(local-snapshots,
AC_HELP_STRING([--with-local-snapshots], [Where downloaded tarballs are stored]),
LOCAL_SNAPSHOTS=${withval},
LOCAL_SNAPSHOTS="${ABE_TOP}/snapshots")
AC_SUBST(LOCAL_SNAPSHOTS)
if test ! -d ${LOCAL_SNAPSHOTS}; then
AC_MSG_WARN(${LOCAL_SNAPSHOTS} does not exist so creating directory!)
mkdir -p ${LOCAL_SNAPSHOTS}
fi
dnl The local directory where reference git repos are stored
AC_ARG_WITH(git-reference-dir,
AC_HELP_STRING([--with-git-reference-dir], [Where reference git repos are stored, see git-clone --reference]),
GIT_REFERENCE_DIR=${withval},
GIT_REFERENCE_DIR="")
AC_SUBST(GIT_REFERENCE_DIR)
dnl The top directory for make install, also where all the components we build live
AC_ARG_WITH(local-builds,
AC_HELP_STRING([--with-local-builds], []),
LOCAL_BUILDS=${withval},
LOCAL_BUILDS="${ABE_TOP}/builds",
LOCAL_BUILDS="${ABE_TOP}/builds")
AC_SUBST(LOCAL_BUILDS)
if test ! -d ${LOCAL_BUILDS}; then
AC_MSG_WARN(${LOCAL_BUILDS} does not exist so creating directory!)
mkdir -p ${LOCAL_BUILDS}
fi
dnl A URL to the remote directory where snapshots are stored
AC_ARG_WITH(remote-snapshots,
AC_HELP_STRING([--with-remote-snapshots], []),
REMOTE_SNAPSHOTS="${withval}")
AC_SUBST(REMOTE_SNAPSHOTS)
dnl Display the default paths so the user does not need to look in the host.conf file.
echo ""
AC_MSG_NOTICE([Downloaded snapshots will be stored in: ${LOCAL_SNAPSHOTS}])
AC_MSG_NOTICE([My builds will be installed in: ${LOCAL_BUILDS}])
AC_MSG_NOTICE([Remote snapshots will be fetched from: ${REMOTE_SNAPSHOTS}])
echo ""
AC_ARG_WITH(languages,
AC_HELP_STRING([--with-languages], [List of languages for the compiler]),
WITH_LANGUAGES=${withval},
WITH_LANGUAGES='abe_default')
AC_SUBST(WITH_LANGUAGES)
dnl if you have SSH access to the remote machine
AC_ARG_ENABLE(ssh, AC_HELP_STRING([--enable-ssh], [If you have SSH access to remote build host]),
[case "${enableval}" in
yes) ENABLE_SSH=yes ;;
no) ENABLE_SSH=no ;;
*) AC_MSG_WARN([bad value ${enableval} for enable-ssh option]) ;;
esac], ENABLE_SSH=no)
AC_SUBST(ENABLE_SSH)
dnl if you want to run all tests by default
AC_ARG_ENABLE(alltests, AC_HELP_STRING([--enable-alltests], [If you want to run all tests by default]),
[case "${enableval}" in
yes) ENABLE_ALLTESTS=yes ;;
no) ENABLE_ALLTESTS=no ;;
*) AC_MSG_WARN([bad value ${enableval} for enable-alltests option]) ;;
esac], ENABLE_ALLTESTS=no)
AC_SUBST(ENABLE_ALLTESTS)
dnl if you want to install by default
AC_ARG_ENABLE(install, AC_HELP_STRING([--enable-install], [If you want to install by default]),
[case "${enableval}" in
yes) ENABLE_INSTALL=yes ;;
no) ENABLE_INSTALL=no ;;
*) AC_MSG_WARN([bad value ${enableval} for enable-install option]) ;;
esac], ENABLE_INSTALL=yes)
AC_SUBST(ENABLE_INSTALL)
dnl if you want to disable the building of the package documents.
AC_ARG_ENABLE(make-docs, AC_HELP_STRING([--enable-make-docs], [If you want to enable making package documentation]),
[case "${enableval}" in
yes) ENABLE_MAKE_DOCS=yes ;;
no) ENABLE_MAKE_DOCS=no ;;
*) AC_MSG_WARN([bad value ${enableval} for enable-make-docs option]) ;;
esac], ENABLE_MAKE_DOCS=yes)
AC_SUBST(ENABLE_MAKE_DOCS)
dnl Obsolete option, preserved for compatibility
AC_ARG_ENABLE(schroot-test, AC_HELP_STRING([--enable-schroot-test], [Obsolete option, preserved for compatibility]),
[case "${enableval}" in
yes) ENABLE_SCHROOT_TEST=yes ;;
no) ENABLE_SCHROOT_TEST=no ;;
*) AC_MSG_WARN([bad value ${enableval} for enable-schroot-test option]) ;;
esac], ENABLE_SCHROOT_TEST=no)
AC_SUBST(ENABLE_SCHROOT_TEST)
dnl if you want to update sources by default
AC_ARG_ENABLE(source-update, AC_HELP_STRING([--enable-source-update], [If you want to update sources by default]),
[case "${enableval}" in
yes) ENABLE_SOURCE_UPDATE=yes ;;
no) ENABLE_SOURCE_UPDATE=no ;;
*) AC_MSG_WARN([bad value ${enableval} for enable-source-update option]) ;;
esac], ENABLE_SOURCE_UPDATE=yes)
AC_SUBST(ENABLE_SOURCE_UPDATE)
dnl if you want to update sources by default
AC_ARG_ENABLE(parallel, AC_HELP_STRING([--enable-parallel], [If you want to build with make -j<number of CPUs> by default]),
[case "${enableval}" in
yes) ENABLE_PARALLEL=yes ;;
no) ENABLE_PARALLEL=no ;;
*) AC_MSG_WARN([bad value ${enableval} for enable-parallel option]) ;;
esac], ENABLE_PARALLEL=yes)
AC_SUBST(ENABLE_PARALLEL)
dnl AC_ARG_WITH(snapshots,
dnl AC_HELP_STRING([--with-snapshots], []),
dnl snapshots=${withval},
dnl snapshots='abe')
dnl Since the configure script is actually checked in, a developer
dnl does not need to have the GNU Autotools installed. However,
dnl installing these is a good idea anyway.
dnl AC_MSG_NOTICE([These are needed by everything to rebuild configure scripts and Makefiles])
AC_CHECK_PROGS(AUTOCONF,autoconf)
AC_CHECK_PROGS(AUTOMAKE,automake)
AC_CHECK_PROGS(LIBTOOL,libtool)
if test x"${AUTOCONF}" = x -o x"${AUTOMAKE}" = x -o x"${LIBTOOL}" = x; then
AC_MSG_WARN([You should install autoconf, automake, and libtool])
fi
dnl DejaGnu is used for testing
AC_PATH_PROG(DEJAGNU,runtest)
if test x"${DEJAGNU}" = x; then
AC_MSG_WARN([You should install dejagnu so you can run tests])
missing="${missing} dejagnu"
fi
AC_PATH_PROG(MAKEINFO,makeinfo)
# Texinfo 5.0 can't process the gcc texinfo files until they are fixed,
# so we have to disable it for Ubuntu 14.04 "trusty".
#if test "`uname -v | grep -c Ubuntu`" -gt 0; then
# texversion="`dpkg-query -W -f='\${Version}' texinfo | cut -d '.' -f 1`"
# if test "${texversion}" -gt 4; then
dnl MAKEINFO="echo"
# AC_MSG_WARN([On Ubuntu Trusty systems, you may need to upgrade to have a working version of makeinfo])
# fi
#fi
AC_SUBST(MAKEINFO)
AC_PATH_PROG(NEWWORKDIR,git-new-workdir)
if test x"${NEWWORKDIR}" = x; then
AC_MSG_WARN([You need to install git-new-workdir to use GIT!])
AC_MSG_NOTICE([copy /usr/share/doc/git/contrib/workdir/git-new-workdir to /usr/local/bin and then make it executable])
missing="${missing} git-new-workdir"
fi
AC_SUBST(NEWWORKDIR)
# A symbolic link needs to be made in this directory
#if test -w /opt/linaro -eq 0; then
# AC_MSG_WARN([/opt/linaro is not writable!])
#fi
AC_OUTPUT(host.conf Makefile)
if test x"${missing}" != x; then
AC_MSG_ERROR([You need to install these packages: ${missing}])
fi
# Local Variables:
# c-basic-offset: 2
# tab-width: 2
# indent-tabs-mode: nil
# End: