-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
358 lines (316 loc) · 9.67 KB
/
configure.in
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
dnl ###################################################################
dnl
dnl Copyright (C) 1999-2010, Karlsruhe University
dnl Copyright (C) 2008-2009, Volkmar Uhlig, IBM Corporation
dnl
dnl File path: configure.in
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions
dnl are met:
dnl 1. Redistributions of source code must retain the above copyright
dnl notice, this list of conditions and the following disclaimer.
dnl 2. Redistributions in binary form must reproduce the above copyright
dnl notice, this list of conditions and the following disclaimer in the
dnl documentation and/or other materials provided with the distribution.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
dnl ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
dnl IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
dnl ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
dnl DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
dnl OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
dnl HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
dnl LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
dnl OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
dnl SUCH DAMAGE.
dnl
dnl $Id: configure.in,v 1.66 2006/11/24 15:47:20 ud3 Exp $
dnl
dnl ###################################################################
dnl Process this file with autoconf to produce a configure script.
AC_INIT(Pistachio, [0.4])
AC_CONFIG_SRCDIR([serv/sigma0/sigma0.cc])
if test "x$host_alias" != x; then
# We do not necessarily need crt0 and friends when cross-compiling.
LDFLAGS="-nostdlib $LDFLAGS"
HOST=$host_alias
else
HOST=`(uname -m) 2>/dev/null || echo unknown`
fi
# Append /l4 to the libdir default
case ${libdir} in
\${exec_prefix}/lib)
libdir='${exec_prefix}/lib/l4'
;;
esac
# Append /l4 to the libexecdir default
case ${libexecdir} in
\${exec_prefix}/libexec)
libexecdir='${exec_prefix}/libexec/l4'
;;
esac
# Determine hardware architecture to build for.
case $HOST in
ia32|x86|i386*|i486*|i586*|i686*)
ARCH=ia32
KERNEL=x86-kernel
;;
powerpc64*|ppc64*)
ARCH=powerpc64
KERNEL=$ARCH-kernel
;;
powerpc*)
ARCH=powerpc
KERNEL=$ARCH-kernel
;;
amd64*)
ARCH=amd64
KERNEL=x86-kernel
LIBGCCFLAGS=-m64
;;
*)
AC_MSG_ERROR([Unknown hardware architecture: $HOST.
Please specify hardware architecture using --host=ARCH.])
;;
esac
# Try guessing the correct name of the C compiler and friends. If
# compiling for build machine, let autoconf do the job instead.
CROSSCC=
if test "x$CC" = x -a "x$host_alias" != x; then
if test "x$gcc_prefix" = x; then
case $ARCH in
ia32)
gcc_prefix=i386
;;
amd64)
gcc_prefix=x86_64
host_alias=amd64
;;
*)
gcc_prefix=$ARCH
;;
esac
fi
AC_CHECK_PROGS(CROSSCC,
[$host_alias-gcc $gcc_prefix-elf-gcc $gcc_prefix-unknown-elf-gcc \
$gcc_prefix-linux-gcc $gcc_prefix-unknown-linux-gcc \
$gcc_prefix-unknown-linux-gnu-gcc $gcc_prefix-pc-linux-gnu-gcc])
fi
if test "x$CROSSCC" != x; then
CC=$CROSSCC
fi
dnl Autoheader stuff.
AC_CONFIG_HEADERS([config.h])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_PROG_AWK
dnl Configure parameters
AC_ARG_WITH([comport],
[AC_HELP_STRING([--with-comport=PORT],
[comport to user for serial I/O [[0]]])],
[CONFIG_COMPORT=`echo $withval | sed 's/yes/0/'`], [CONFIG_COMPORT=0])
if test "x$CONFIG_COMPORT" != xno; then
AC_DEFINE_UNQUOTED([CONFIG_COMPORT], [$CONFIG_COMPORT],
[Define to the appropriate I/O comport (0-3).])
fi
AC_ARG_WITH([comspeed],
[AC_HELP_STRING([--with-comspeed=SPEED],
[select speed for comport [[115200]]])],
[COMSPEED=$withval], [COMSPEED=115200])
if test "x$CONFIG_COMPORT" != xno; then
AC_DEFINE_UNQUOTED([CONFIG_COMSPEED], [$COMSPEED],
[Baud rate for comport (typically 115200, 57600, or 38400).])
fi
AC_ARG_WITH([kickstart-linkbase],
[AC_HELP_STRING([--with-kickstart-linkbase=BASE],
[link-base for kickstart [[architecture-dependent]]])],
[KICKSTART_LINKBASE=$withval], [KICKSTART_LINKBASE=no])
AC_ARG_WITH([s0-linkbase],
[AC_HELP_STRING([--with-s0-linkbase=BASE],
[link-base for sigma0 [[architecture-dependent]]])],
[SIGMA0_LINKBASE=$withval], [SIGMA0_LINKBASE=no])
AC_ARG_WITH([roottask-linkbase],
[AC_HELP_STRING([--with-roottask-linkbase=BASE],
[link-base for root task [[architecture-dependent]]])],
[ROOTTASK_LINKBASE=$withval], [ROOTTASK_LINKBASE=no])
AC_ARG_WITH([kerneldir],
[AC_HELP_STRING([--with-kerneldir=DIR],
[build directory of kernel [[guess]]])],
[kerneldir=$withval], [kerneldir=no])
dnl Find prefix to use for gcc/binutils programs.
TOOLPREFIX=`echo $CC | sed 's,gcc[[^/]]*$,,'`
AC_SUBST([TOOLPREFIX])
dnl Find location of libgcc.a
AC_MSG_CHECKING([location of libgcc.a])
LIBGCC=`$CC $LIBGCCFLAGS -print-libgcc-file-name`
LIBGCCDIR=`echo $LIBGCC | sed 's,/[[^/]]*$,,'`
AC_MSG_RESULT([$LIBGCCDIR])
dnl Find location of stdarg.h include file
AC_MSG_CHECKING([location of stdarg.h])
testdir=`echo $LIBGCC | sed 's,/[[^/]]*$,/include,'`
if test -f "$testdir/stdarg.h"; then
STDARGDIR=$testdir
else
testdir=`echo $LIBGCC | sed 's,/lib/[[^/]]*$,/include,'`
STDARGDIR="\$(top_builddir)"
rm -f "stdarg.h"
if test -f "$testdir/stdarg.h"; then
# If stdarg.h is self contained, use it. Copy file to avoid using
# standard system include
grep -q '#include' "$testdir/stdarg.h" || cp "$testdir/stdarg.h" .
fi
if test ! -f "stdarg.h"; then
STDARGDIR="\$(top_srcdir)/../contrib/include"
fi
fi
if test "x$STDARGDIR" != x; then
AC_MSG_RESULT([$STDARGDIR])
else
AC_MSG_ERROR([stdarg.h not found])
fi
dnl Guess build directory of kernel
AC_MSG_CHECKING([kernel build directory])
case $kerneldir in
yes|no)
my_builddir=`pwd`
my_srcdir=`(cd $srcdir && pwd)`
my_confname=`echo $my_builddir | sed s,.*/,,`
# Relative to build directory
if test -f $my_builddir/../kernel/$KERNEL; then
kerneldir='$(top_builddir)'/../kernel
elif test -f $my_builddir/../kernel-$ARCH/$KERNEL; then
kerneldir='$(top_builddir)'/../kernel-$ARCH
elif test -f $my_builddir/../pistachio-kernel/$KERNEL; then
kerneldir='$(top_builddir)'/../pistachio-kernel
elif test -f $my_builddir/../pistachio-$KERNEL/$KERNEL; then
kerneldir='$(top_builddir)'/../pistachio-$KERNEL
elif test -f $my_builddir/../pistachio-kernel-$ARCH/$KERNEL; then
kerneldir='$(top_builddir)'/../pistachio-kernel-$ARCH
elif test -f $my_builddir/../pistachio-$ARCH/$KERNEL; then
kerneldir='$(top_builddir)'/../pistachio-$ARCH
elif test -f $my_builddir/../build-kernel/$KERNEL; then
kerneldir='$(top_builddir)'/../build-kernel
elif test -f $my_builddir/../build-kernel-$ARCH/$KERNEL; then
kerneldir='$(top_builddir)'/../build-kernel-$ARCH
elif test -f $my_builddir/../build-$KERNEL/$KERNEL; then
kerneldir='$(top_builddir)'/../build-$KERNEL
elif test -f $my_builddir/../build-$ARCH/$KERNEL; then
kerneldir='$(top_builddir)'/../build-$ARCH
# Relative to source directory
elif test -f $my_srcdir/../kernel/$my_confname/$KERNEL; then
kerneldir='$(top_srcdir)'/../kernel/$my_confname
elif test -f $my_srcdir/../kernel/$ARCH/$KERNEL; then
kerneldir='$(top_srcdir)'/../kernel/$ARCH
# Default
else
kerneldir='$(top_builddir)'
fi
;;
esac
AC_MSG_RESULT([$kerneldir])
dnl Set compiler/linker flags.
CPPFLAGS="-I\$(top_srcdir)/include -I\$(top_builddir) -I$STDARGDIR $CPPFLAGS"
case $LDFLAGS in
*-nostdlib*)
;;
*)
LDFLAGS="-nostdlib $LDFLAGS"
;;
esac
LDFLAGS="-N -L\$(top_builddir)/lib -L$LIBGCCDIR $LDFLAGS"
CFLAGS="-nostdinc $CFLAGS"
CXXFLAGS="-fno-exceptions $CXXFLAGS"
CC_VERSION=`echo __GNUC__ | $CC -E - | grep -v "\#"`
CC_SUBVERSION=`echo __GNUC_MINOR__ | $CC -E - | grep -v "\#"`
if test "$CC_VERSION" = "4" -a "$CC_SUBVERSION" -ge "1"; then
CFLAGS="-fno-stack-protector $CFLAGS"
fi
dnl Architecture dependent settings.
case $ARCH in
ia32)
default_kickstart_linkbase=00800000
default_sigma0_linkbase=00020000
default_roottask_linkbase=00400000
;;
powerpc)
default_kickstart_linkbase=00400000
default_sigma0_linkbase=00500000
default_roottask_linkbase=00600000
;;
powerpc64)
default_sigma0_linkbase=00100000
default_roottask_linkbase=00300000
;;
amd64)
default_kickstart_linkbase=00100000
default_sigma0_linkbase=00f00000
default_roottask_linkbase=01000000
;;
esac
dnl Platform dependent settings.
case $HOST in
amd64*)
PLAT=amd64-pc99
CFLAGS="$CFLAGS -m64 -mno-red-zone"
LDFLAGS="$LDFLAGS -melf_x86_64"
AC_SUBST([PLAT])
;;
powerpc)
CFLAGS="$CFLAGS -msoft-float -mno-regnames -meabi -msdata=none -mno-toc"
;;
powerpc64*)
CFLAGS="$CFLAGS -msoft-float -mminimal-toc"
;;
esac
case $KICKSTART_LINKBASE in
yes|no)
KICKSTART_LINKBASE=$default_kickstart_linkbase
;;
esac
case $SIGMA0_LINKBASE in
yes|no)
SIGMA0_LINKBASE=$default_sigma0_linkbase
;;
esac
case $ROOTTASK_LINKBASE in
yes|no)
ROOTTASK_LINKBASE=$default_roottask_linkbase
;;
esac
AC_SUBST([CXXFLAGS])
AC_SUBST([ARCH])
AC_SUBST([KERNEL])
AC_SUBST([KICKSTART_LINKBASE])
AC_SUBST([SIGMA0_LINKBASE])
AC_SUBST([ROOTTASK_LINKBASE])
AC_SUBST([kerneldir])
dnl Modified files.
AC_CONFIG_FILES([
config.mk
Makefile
lib/Makefile
lib/l4/Makefile
lib/io/Makefile
serv/Makefile
serv/sigma0/Makefile
apps/Makefile
apps/bench/Makefile
apps/bench/pingpong/Makefile
apps/grabmem/Makefile
apps/l4test/Makefile
apps/ebbapp/Makefile
util/Makefile
util/kickstart/Makefile
util/grubdisk/Makefile
util/piggybacker/Makefile
util/piggybacker/ofppc/Makefile
util/piggybacker/ofppc64/Makefile
contrib/Makefile
contrib/elf-loader/Makefile
])
AC_OUTPUT