source: rtems/cpukit/configure.ac @ c3330a8

4.104.114.84.95
Last change on this file since c3330a8 was c3330a8, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/07 at 22:46:45

2007-05-17 Joel Sherrill <joel.sherrill@…>

  • ChangeLog?, configure.ac, libcsupport/src/times.c, libmisc/cpuuse/cpuuse.c, libmisc/stackchk/check.c, rtems/include/rtems/rtems/ratemon.h, rtems/src/ratemongetstatus.c, rtems/src/ratemonperiod.c, rtems/src/ratemonreportstatistics.c, rtems/src/ratemonresetall.c, rtems/src/ratemontimeout.c, score/Makefile.am, score/include/rtems/score/thread.h, score/include/rtems/score/timespec.h, score/src/threaddispatch.c, score/src/threadinitialize.c, score/src/threadtickletimeslice.c, score/src/timespecdivide.c: Add nanoseconds granularity to the rate monotonic period statistics and CPU usage statistics. This capability is enabled by default although may be conditionally disabled by the user. It could be too much overhead on small targets but it does not appear to be bad in early testing. Its impact on code size has not been evaluated either. It is possible that both forms of statistics gathering could be disabled with further tweaking of the conditional compilation.
  • score/src/timespecdividebyinteger.c: New file.
  • Property mode set to 100644
File size: 9.3 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id$
4
5AC_PREREQ(2.61)
6AC_INIT([rtems-cpukit],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
7AC_CONFIG_SRCDIR([score])
8RTEMS_TOP([..],[])
9
10RTEMS_CANONICAL_TARGET_CPU
11
12AM_INIT_AUTOMAKE([no-define nostdinc subdir-objects foreign 1.10])
13AM_MAINTAINER_MODE
14
15RTEMS_ENABLE_MULTILIB
16RTEMS_ENABLE_MULTIPROCESSING
17RTEMS_ENABLE_POSIX
18RTEMS_ENABLE_ITRON
19RTEMS_ENABLE_RTEMS_DEBUG
20RTEMS_ENABLE_NETWORKING
21
22RTEMS_ENV_RTEMSCPU
23RTEMS_CHECK_RTEMS_DEBUG
24
25# Is this a supported CPU?
26AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
27if test -d "$srcdir/score/cpu/$RTEMS_CPU"; then
28  AC_MSG_RESULT(yes)
29else
30  AC_MSG_ERROR(no)
31fi
32
33RTEMS_PROG_CC_FOR_TARGET([-fasm])
34RTEMS_PROG_CCAS
35RTEMS_CANONICALIZE_TOOLS
36AM_PROG_CC_C_O
37AC_PROG_RANLIB
38
39RTEMS_CHECK_NEWLIB
40
41# HACK: We should use a feature-based configuration.
42AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
43# HACK: silently accept --enable-unixlib
44  test -n "${enable_unixlib}" || enable_unixlib="yes"
45])
46
47# BSD-isms, used throughout the sources
48# Not really used by this configure script
49# FIXME: They should be eliminated if possible.
50AC_CHECK_FUNCS([strsep strcasecmp snprintf])
51AC_CHECK_FUNCS([bcopy bcmp])
52AC_CHECK_FUNCS([isascii fileno])
53
54## Check if the installed toolchain has these headers
55AC_CHECK_HEADER([tar.h])
56
57## BSD-ism, should not be used in RTEMS,
58## nevertheless it still is.
59AC_CHECK_HEADER([sys/errno.h],[],
60  [AC_MSG_ERROR([Missing required header sys/errno.h])])
61
62## if libc provides stdint.h, use it.
63AS_IF([test x"${ac_cv_header_stdint_h}" = xyes],
64[RTEMS_USES_STDINT_H=yes],
65[RTEMS_USES_STDINT_H=no])
66
67## error out if libc doesn't at least provide inttypes.h
68AS_IF([test x"${ac_cv_header_inttypes_h}" != xyes],
69[AC_MSG_ERROR([Required header inttypes.h not found])])
70
71AC_CHECK_TYPES([ uint8_t,  int8_t])
72AC_CHECK_TYPES([uint16_t, int16_t])
73AC_CHECK_TYPES([uint32_t, int32_t])
74AC_CHECK_TYPES([uint64_t, int64_t])
75AC_CHECK_TYPES([uintmax_t, intmax_t])
76AC_CHECK_TYPES([uintptr_t, intptr_t])
77
78AC_CACHE_CHECK([if PRIxPTR works],
79[rtems_cv_PRIxPTR],[
80  AS_IF([test x"$GCC" = xyes],[
81    save_CFLAGS=$CFLAGS
82    CFLAGS=-Werror])
83
84  AC_COMPILE_IFELSE([
85    AC_LANG_PROGRAM([
86      #include <inttypes.h>
87      #include <stdio.h>
88    ],[
89      void *ptr;
90      printf("%" PRIxPTR "\n", (intptr_t) ptr);
91    ])],
92    [rtems_cv_PRIxPTR=yes],
93    [rtems_cv_PRIxPTR=no])
94
95  AS_IF([test x"$GCC" = xyes],[
96    CFLAGS=$save_CFLAGS])
97])
98
99# These are conditionally defined by the toolchain
100# FIXME: we should either conditionally compile those parts in
101# RTEMS depending on them, or abort - For now, simply check.
102AC_CHECK_HEADER([pthread.h],[
103  AC_CHECK_TYPES([pthread_rwlock_t])
104  AC_CHECK_TYPES([pthread_barrier_t])
105  AC_CHECK_TYPES([pthread_spinlock_t])
106])
107
108RTEMS_CHECK_MULTIPROCESSING
109RTEMS_CHECK_POSIX_API
110RTEMS_CHECK_ITRON_API
111RTEMS_CHECK_NETWORKING
112
113AS_IF([test x"${RTEMS_USE_NEWLIB}" = xyes],
114[RTEMS_USES_TAR_H=yes],
115[RTEMS_USES_TAR_H=$ac_cv_header_tar_h])
116
117AS_IF([test x"${RTEMS_CPU}" = x"unix"],[
118## FIXME: This check is doubtful
119AS_IF([test "$HAS_MP" = "yes"],
120  [RTEMS_CHECK_SYSV_UNIX])
121
122## The code fragment below had been used in tools/cpu/unix/gensize.c.
123## FIXME:
124## * The pad very likely is not necessary.
125AC_CHECK_SIZEOF([CPU_CONTEXT],[],[
126#include <stdio.h>
127#include <setjmp.h>
128
129typedef struct {
130  jmp_buf     regs;
131  int         isr_level;
132  int         pad[4]; /* just in case */
133} CPU_CONTEXT;
134])
135])
136
137rtems_major=`echo _RTEMS_VERSION | sed "s/\..*//"`
138rtems_minor=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/\..*//"`
139rtems_revision=`echo _RTEMS_VERSION | sed "s/[[0-9]][[0-9]]*\.//;s/[[0-9]][[0-9]]*\.//;s/\..*//"`
140
141cat >>cpuopts.tmp <<\_ACEOF
142/**
143 * @file rtems/score/cpuopts.h
144 */
145/* target cpu dependent options file */
146/* automatically generated -- DO NOT EDIT!! */
147#ifndef _RTEMS_SCORE_CPUOPTS_H
148#define _RTEMS_SCORE_CPUOPTS_H
149_ACEOF
150
151RTEMS_CPUOPT([RTEMS_DEBUG],
152  [test x"${enable_rtems_debug}" = x"yes"],
153  [1],
154  [if RTEMS_DEBUG is enabled])
155
156RTEMS_CPUOPT([RTEMS_ITRON_API],
157  [test x"$rtems_cv_HAS_ITRON_API" = x"yes"],
158  [1],
159  [if itron api is supported])
160
161RTEMS_CPUOPT([RTEMS_MULTIPROCESSING],
162  [test x"$enable_multiprocessing" = xyes],
163  [1],
164  [if multiprocessing is enabled])
165
166RTEMS_CPUOPT([RTEMS_NEWLIB],
167  [test x"$RTEMS_USE_NEWLIB" = xyes],
168  [1],
169  [if using newlib])
170
171RTEMS_CPUOPT([RTEMS_POSIX_API],
172  [test x"$rtems_cv_HAS_POSIX_API" = xyes],
173  [1],
174  [if posix api is supported])
175
176RTEMS_CPUOPT([RTEMS_NETWORKING],
177  [test x"$rtems_cv_HAS_NETWORKING" = xyes],
178  [1],
179  [if networking is enabled])
180
181RTEMS_CPUOPT([RTEMS_UNIX],
182  [test x"$RTEMS_CPU" = xunix],
183  [1],
184  [to indicate RTEMS unix])
185
186RTEMS_CPUOPT([RTEMS_UNIXLIB],
187  [test x"${enable_unixlib}" = xyes],
188  [1],
189  [to indicate RTEMS using RTEMS's unixlib])
190
191RTEMS_CPUOPT([RTEMS_USES_STDINT_H],
192  [test x"${RTEMS_USES_STDINT_H}" = x"yes"],
193  [1],
194  [if RTEMS uses stdint.h])
195
196RTEMS_CPUOPT([RTEMS_USES_TAR_H],
197  [test x"${RTEMS_USES_TAR_H}" = x"yes"],
198  [1],
199  [if RTEMS uses tar.h])
200
201RTEMS_CPUOPT([RTEMS_VERSION],
202  [true],
203  ["]_RTEMS_VERSION["],
204  [RTEMS version string])
205
206RTEMS_CPUOPT([SIZEOF_CPU_CONTEXT],
207  [test x"$RTEMS_CPU" = x"unix"],
208  [$ac_cv_sizeof_CPU_CONTEXT],
209  [The size of a 'CPU_CONTEXT', as computed by sizeof])
210
211RTEMS_CPUOPT([__RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__],
212  [test x"${USE_TICKS_FOR_CPU_USAGE_STATISTICS}" = x"1"],
213  [1],
214  [disable nanosecond granularity for cpu usage statistics]
215)
216
217RTEMS_CPUOPT([__RTEMS_USE_TICKS_RATE_MONOTONIC_STATISTICS__],
218  [test x"${USE_TICKS_FOR_RATE_MONOTONIC_STATISTICS}" = x"1"],
219  [1],
220  [disable nanosecond granularity for period statistics]
221)
222
223RTEMS_CPUOPT([__RTEMS_MAJOR__],
224  [true],
225  [$rtems_major],
226  [major version portion of an RTEMS release])
227
228RTEMS_CPUOPT([__RTEMS_MINOR__],
229  [true],
230  [$rtems_minor],
231  [minor version portion of an RTEMS release])
232
233RTEMS_CPUOPT([__RTEMS_REVISION__],
234  [true],
235  [$rtems_revision],
236  [revision version portion of an RTEMS release])
237
238cat >>cpuopts.tmp <<\_ACEOF
239
240#endif /* _RTEMS_SCORE_CPUOPTS_H */
241_ACEOF
242
243AS_MKDIR_P(score/include/rtems/score)
244AS_IF([test -f score/include/rtems/score/cpuopts.h],
245[
246  AS_IF([cmp -s score/include/rtems/score/cpuopts.h cpuopts.tmp 2>/dev/null],
247  [
248    AC_MSG_NOTICE([score/include/rtems/score/cpuopts.h is unchanged])
249    rm -f cpuopts.tmp
250  ],[
251    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
252    rm -f score/include/rtems/score/cpuopts.h
253    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
254  ])
255],[
256    AC_MSG_NOTICE([creating score/include/rtems/score/cpuopts.h])
257    rm -f score/include/rtems/score/cpuopts.h
258    mv cpuopts.tmp score/include/rtems/score/cpuopts.h
259])
260
261AC_ENABLE_MULTILIB([Makefile],[..])
262
263# libmisc/shell/* wants to assign file descriptors to stdio file descriptors.
264AC_MSG_CHECKING([for assignable stdio])
265AC_COMPILE_IFELSE(
266  [AC_LANG_PROGRAM(
267    [#include <stdio.h>],
268    [stdin = fopen("/tmp", "r")])],
269  [HAVE_ASSIGNABLE_STDIO=yes],
270  [HAVE_ASSIGNABLE_STDIO=no])
271AC_MSG_RESULT([$HAVE_ASSIGNABLE_STDIO])
272
273# libmisc/serdbg exploits weak symbols
274RTEMS_CHECK_GCC_WEAK
275
276AC_CHECK_HEADERS([sys/cdefs.h],[NEED_SYS_CDEFS_H=no],[NEED_SYS_CDEFS_H=yes])
277AC_CHECK_HEADERS([sys/queue.h],[NEED_SYS_QUEUE_H=no],[NEED_SYS_QUEUE_H=yes])
278
279# FIXME: These checks are only in here to provide
280# configuration-time diagnostics and are not really used.
281AC_CHECK_DECLS([_POSIX_LOGIN_NAME_MAX],,,[#include <limits.h>])
282AC_CHECK_DECLS([CHAR_BIT],,,[#include <limits.h>])
283
284## BSD-ism, excluded from POSIX, but available on most platforms
285AC_CHECK_DECLS([sbrk],,,[#include <unistd.h>])
286
287## Check if libc provides BSD's strlcpy/strlcat
288AC_CHECK_FUNCS(strlcpy strlcat)
289
290
291# ... far too many conditionals ...
292AM_CONDITIONAL(LIBRPC,[test x"$rtems_cv_HAS_NETWORKING" = x"yes"])
293AM_CONDITIONAL(UNIX,[test x"${RTEMS_CPU}" = x"unix"])
294AM_CONDITIONAL(NEWLIB,test x"$RTEMS_USE_NEWLIB" = x"yes")
295
296AM_CONDITIONAL(HAS_MP,test x"$enable_multiprocessing" = x"yes" )
297
298AM_CONDITIONAL(HAS_PTHREADS,test x"$rtems_cv_HAS_POSIX_API" = x"yes")
299AM_CONDITIONAL(LIBPOSIX,test x"${RTEMS_CPU}" != x"unix")
300AM_CONDITIONAL(LIBITRON,test x"$rtems_cv_HAS_ITRON_API" = x"yes")
301AM_CONDITIONAL(LIBNETWORKING,test x"$rtems_cv_HAS_NETWORKING" = x"yes")
302
303AM_CONDITIONAL([NEED_SYS_CDEFS_H],[test x"$NEED_SYS_CDEFS_H" = x"yes"])
304AM_CONDITIONAL([NEED_SYS_QUEUE_H],[test x"$NEED_SYS_QUEUE_H" = x"yes"])
305
306AM_CONDITIONAL([LIBSHELL],[test x"$HAVE_ASSIGNABLE_STDIO" = x"yes"])
307AM_CONDITIONAL([LIBSERDBG],[test x"$rtems_cv_cc_attribute_weak" = x"yes"])
308
309AM_CONDITIONAL([LIBDOSFS],[dnl
310test x"${RTEMS_CPU}" != x"unix" \
311&& test x"$ac_cv_type_uint8_t" = xyes \
312&& test x"$ac_cv_type_uint16_t" = xyes])
313
314AC_CONFIG_HEADER(config.h)
315
316RTEMS_AMPOLISH3
317
318# Explicitly list all Makefiles here
319AC_CONFIG_FILES([
320Makefile
321rtems/Makefile
322sapi/Makefile
323score/Makefile
324score/cpu/Makefile
325score/cpu/arm/Makefile
326score/cpu/bfin/Makefile
327score/cpu/avr/Makefile
328score/cpu/c4x/Makefile
329score/cpu/h8300/Makefile
330score/cpu/i386/Makefile
331score/cpu/m68k/Makefile
332score/cpu/mips/Makefile
333score/cpu/nios2/Makefile
334score/cpu/powerpc/Makefile
335score/cpu/sh/Makefile
336score/cpu/sparc/Makefile
337score/cpu/unix/Makefile
338score/cpu/no_cpu/Makefile
339posix/Makefile
340itron/Makefile
341libblock/Makefile
342libfs/Makefile
343libcsupport/Makefile
344libnetworking/Makefile
345librpc/Makefile
346libmisc/Makefile
347libi2c/Makefile
348zlib/Makefile
349httpd/Makefile
350ftpd/Makefile
351telnetd/Makefile
352pppd/Makefile
353wrapup/Makefile])
354
355AC_CONFIG_COMMANDS([preinstall-stamp],
356[test -z "$with_multisubdir" && ${MAKE} preinstall-stamp],
357[MAKE=${MAKE}
358with_multisubdir="$with_multisubdir"])
359
360AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.