summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 095ffa790ccc3edaab306de7d3377e86c38041a7 (plain) (blame)
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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.12)
AC_INIT(README)

dnl Checks for programs.
AC_PROG_MAKE_SET
AC_CANONICAL_SYSTEM
AC_ARG_WITH(cross-host,[  --with-cross-host=HOST      host (cygnus)], \
host=$withval)

AC_ARG_ENABLE(gmake-print-directory, \
[  --enable-gmake-print-directory    enable GNU Make's print directory], \
[case "${enableval}" in
  yes) RTEMS_USE_OWN_PDIR=no ;;
  no) RTEMS_USE_OWN_PDIR=yes ;;
  *)  AC_MSG_ERROR(bad value ${enableval} for gmake-print-directory option) ;;
esac],[RTEMS_USE_OWN_PDIR=yes])

AC_ARG_ENABLE(posix, \
[  --disable-posix 	     	    disable posix interface], \
[case "${enableval}" in 
  yes) RTEMS_HAS_POSIX_API=yes ;;
  no) RTEMS_HAS_POSIX_API=no ;;
  *)  AC_MSG_ERROR(bad value ${enableval} for disable-posix option) ;;
esac],[RTEMS_HAS_POSIX_API=yes])

AC_ARG_ENABLE(ka9q, \
[  --disable-ka9q                disable KA9Q TCP/IP stack], \
[case "${enableval}" in
  yes) RTEMS_HAS_KA9Q=yes ;;
  no) RTEMS_HAS_KA9Q=no ;;
  *)  AC_MSG_ERROR(bad value ${enableval} for disable-ka9q option) ;;
esac],[RTEMS_HAS_KA9Q=yes])

AC_ARG_ENABLE(rtems-inlines, \
[  --disable-rtems-inlines 	    disable RTEMS inline functions (use macros)], \
[case "${enableval}" in 
  yes) RTEMS_USE_MACROS=yes ;;
  no) RTEMS_USE_MACROS=no ;;
  *)  AC_MSG_ERROR(bad value ${enableval} for disable-rtems-inlines option) ;;
esac],[RTEMS_USE_MACROS=no])

AC_ARG_ENABLE(cpp, \
[  --enable-cpp            enable C++ support, and build the rtems++ library], \
[case "${enableval}" in 
  yes) RTEMS_HAS_CPLUSPLUS=yes ;;
  no) RTEMS_HAS_CPLUSPLUS=no   ;;
  *)  AC_MSG_ERROR(bad value ${enableval} for enable-cpp option) ;;
esac], [RTEMS_HAS_CPLUSPLUS=no])

AC_ARG_ENABLE(gcc28, \
[  --enable-gcc28		    enable use of gcc 2.8.x features], \
[case "${enableval}" in 
  yes) RTEMS_USE_GCC272=no ;;
  no) RTEMS_USE_GCC272=yes ;;
  *)  AC_MSG_ERROR(bad value ${enableval} for gcc-28 option) ;;
esac],[RTEMS_USE_GCC272=yes])

AC_ARG_ENABLE(libcdir, \
[  --enable-libcdir=directory	    set the directory for the C library], \
[ RTEMS_LIBC_DIR="${enableval}" ; \
test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )

RTEMS_PREFIX=${target_cpu}-${target_vendor}

dnl BEGIN configure.host.in

AC_PATH_PROG(CAT,cat)
AC_PATH_PROG(RM,rm)
AC_PATH_PROG(CP,cp)
AC_PATH_PROG(MV,mv)
AC_PATH_PROG(LN,ln)
AC_PROG_LN_S
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(SORT,sort)

dnl check mkdir behaviour, try to get mkdir -p -m 0755
RTEMS_PATH_MKDIR
RTEMS_PROG_MKDIR_M
RTEMS_PROG_MKDIR_P
test "$rtems_cv_prog_MKDIR_P" = "yes" && MKDIR="$MKDIR -p"
test "$rtems_cv_prog_MKDIR_M" = "yes" && MKDIR="$MKDIR -m 0755"

AC_PATH_PROG(TOUCH,touch)
AC_PATH_PROG(CMP,cmp)

AC_PATH_PROG(SED,sed)
AC_PATH_PROGS(M4,gm4 m4)

dnl NOTE: prefer bash over ksh over sh
AC_PATH_PROGS(KSH,bash ksh sh)

if test -z "$KSH"; then
dnl NOTE: This cannot happen -- /bin/sh must always exist
AC_MSG_ERROR(
[***]
[    Cannot determine a usable shell bash/ksh/sh]
[    Please contact your system administrator] );
fi

dnl END configure.host.in

dnl BEGIN configure.target.in

dnl echo "TARGET"
dnl echo "    cpu    --> $target_cpu"
dnl echo "    os     --> $target_os"
dnl echo "    vendor --> $target_vendor"

dnl canonicalize target name
dnl NOTE: Most rtems targets do not fullfil autoconf 
dnl targets naming conventions "processor-vendor-os"
dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
dnl and we have to fix it for rtems ourselves 
dnl 
dnl The original plan was to do CPU-BSP-rtems or CPU-rtems to
dnl imply all BSPs.  Eventually we would like to build a collection
dnl of CPU model specific RTEMS libraries which in conjunction with
dnl a BSP library would be used to link an application.

case "${target}" in
  # hpux unix port should go here
  hppa1.1-rtems*)
	target_cpu=hppa1_1
	;;
  i[[3456]]86-go32-rtems*)
	target_cpu=i386
	rtems_bsp="go32 go32_p5"
       	skip_startfiles="yes"
	RTEMS_HAS_POSIX_API=no
	;;
  i[[3456]]86-rtems*)
	target_cpu=i386
	;;
  i[[3456]]86-pc-linux*)         # unix "simulator" port
	target_cpu=unix
	RTEMS_HAS_POSIX_API=no
	;;
  no_cpu-rtems*)
        target_cpu=no_cpu
	RTEMS_HAS_POSIX_API=no
	;;
  powerpc-rtems*|ppc-rtems*)
	target_cpu=ppc
	;;
  sparc-sun-solaris*)             # unix "simulator" port
	target_cpu=unix
	RTEMS_HAS_POSIX_API=no
	;;
  *) 
	RTEMS_CANONICAL_TARGET_CPU
	;;
esac

# Is this a supported CPU?
AC_MSG_CHECKING([if cpu $target_cpu is supported])
if test -d "$srcdir/c/src/exec/score/cpu/$target_cpu"; then
  AC_MSG_RESULT(yes)
  makefiles="$makefiles c/src/exec/score/cpu/$target_cpu/Makefile"
else
  AC_MSG_ERROR(no)
fi

# find all the Executive Makefiles
RTEMS_CHECK_MAKEFILE(c/src/exec/rtems)
RTEMS_CHECK_MAKEFILE(c/src/exec/posix)
RTEMS_CHECK_MAKEFILE(c/src/exec/sapi)
RTEMS_CHECK_MAKEFILE(c/src/exec/wrapup)

# find all the Makefiles for the BSPs
if test -d "$srcdir/c/src/lib/libbsp/$target_cpu"; then
  makefiles="$makefiles c/src/lib/libbsp/$target_cpu/Makefile"

  if test -z "$rtems_bsp"; then
    AC_MSG_CHECKING([for bsps])
    files=`ls $srcdir/c/src/lib/libbsp/$target_cpu`
    for file in $files; do
      case $file in
        shared*);;
        Makefile*);;
        READ*);;
        CVS*);;
        go32*);;   # so the i386 port can pick up the other Makefiles
        *) rtems_bsp="$rtems_bsp $file";;
      esac;
    done
    AC_MSG_RESULT([$rtems_bsp])
  fi

  # collect makefiles for each bsp
  for i in $rtems_bsp; do
    RTEMS_CHECK_MAKEFILE(c/src/lib/libbsp/$target_cpu/$i)
  done
fi

# find all the CPU dependent library Makefiles
RTEMS_CHECK_MAKEFILE(c/src/lib/libcpu/$target_cpu)

dnl Workaround for go32
if test "$skip_startfiles" != "yes"; then
  RTEMS_CHECK_MAKEFILE(c/src/lib/start/$target_cpu)
fi

dnl END configure.target.in


#
#  Target configurations are listed in alphabetical order.  
#  The BSPs for a target configuration are also listed in alphabetical order.
#

dnl NOTE: host_os is automatically set by autoconf

if [[ "${program_prefix}" = "NONE" ]] ; then
  if [[ "${target}" = "${host}" ]] ; then
    program_prefix=
  else
    program_prefix=${target}-
  fi
fi

dnl AC_PROG_CC
dnl AC_PROG_CXX

RTEMS_BSP=$rtems_bsp
RTEMS_HOST=$host_os
RTEMS_ROOT=`cd $srcdir/c; pwd`
PROJECT_ROOT=`pwd;`

# For now always generate the KA9Q TCP/IP Makefiles
makefiles="$makefiles c/src/lib/libka9q/Makefile"

# For now always generate the C++ Makefiles
makefiles="$makefiles c/src/lib/librtems++/Makefile"

# If the tests are enabled, then find all the test suite Makefiles
AC_MSG_CHECKING([Are the test suites enabled? ])
AC_ARG_ENABLE(tests, \
[  --disable-tests 	     	    disable tests], \
   AC_MSG_ERROR(no), \
   AC_MSG_RESULT(yes) \
     RTEMS_CHECK_MAKEFILE(c/src/tests/tools/$target_cpu) \
     RTEMS_CHECK_MAKEFILE(c/src/tests/libtests) \
     RTEMS_CHECK_MAKEFILE(c/src/tests/sptests) \
     RTEMS_CHECK_MAKEFILE(c/src/tests/tmtests) \
     RTEMS_CHECK_MAKEFILE(c/src/tests/mptests) \
     RTEMS_CHECK_MAKEFILE(c/src/tests/psxtests) \
)

# If the HWAPI is enabled, the find the HWAPI Makefiles
AC_MSG_CHECKING([Is the HWAPI enabled? ])
AC_ARG_ENABLE(hwapi, \
  [  --enable-hwapi		    enable hardware API library], \
      AC_MSG_RESULT(yes) \
        RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi), \
      AC_MSG_ERROR(no) \
)

AC_ARG_ENABLE(rtemsbsp, \
  [  --enable-rtemsbsp=bsp1 bsp2 ..   BSPs to include in build], \
      RTEMS_BSP=$enableval \
)

AC_SUBST(RTEMS_BSP)
AC_SUBST(RTEMS_HOST)
AC_SUBST(RTEMS_LIBC_DIR)
AC_SUBST(RTEMS_ROOT)
AC_SUBST(RTEMS_USE_OWN_PDIR)
AC_SUBST(RTEMS_HAS_POSIX_API)
AC_SUBST(RTEMS_HAS_KA9Q)
AC_SUBST(RTEMS_USE_MACROS)
AC_SUBST(RTEMS_HAS_CPLUSPLUS)
AC_SUBST(RTEMS_USE_GCC272)
AC_SUBST(RTEMS_LIBC_DIR)
AC_SUBST(PROJECT_ROOT)
AC_SUBST(program_prefix)

# pick up all the Makefiles in required parts of the tree
RTEMS_CHECK_MAKEFILE(c/build-tools)
RTEMS_CHECK_MAKEFILE(c/make)
RTEMS_CHECK_MAKEFILE(c/src/lib/libmisc)
RTEMS_CHECK_MAKEFILE(c/src/tests/samples)

# try not to explicitly list a Makefile here 
AC_OUTPUT( 
Makefile
c/Makefile
c/src/Makefile
c/src/exec/Makefile
c/src/exec/score/Makefile
c/src/exec/score/cpu/Makefile
c/src/exec/score/headers/Makefile
c/src/exec/score/inline/Makefile
c/src/exec/score/src/Makefile
c/src/exec/score/tools/Makefile
c/src/exec/score/tools/generic/Makefile
c/src/lib/Makefile
c/src/lib/include/Makefile
c/src/lib/libbsp/Makefile
c/src/lib/libbsp/shmdr/Makefile
c/src/lib/libc/Makefile
c/src/lib/libcpu/Makefile
c/src/lib/start/Makefile
c/src/lib/wrapup/Makefile
c/src/tests/Makefile
c/src/tests/support/Makefile
c/src/tests/support/include/Makefile
c/src/tests/support/stubdr/Makefile
c/src/tests/support/wrapup/Makefile
c/src/tests/tools/Makefile
c/src/tests/tools/generic/Makefile
$makefiles
c/make/host.cfg
c/make/Templates/Makefile.inc
c/update-tools/Makefile)

echo
echo target architecture: $target_cpu.
echo available BSPs: $rtems_bsp.
echo \'make all\' will build the following BSPs: $RTEMS_BSP.
echo other BSPs can be built with \'make RTEMSBSP=\"bsp1 bsp2 ...\"\' 
echo