source: rtems/c/src/lib/aclocal.m4 @ f42fb02

4.104.114.84.95
Last change on this file since f42fb02 was 1896a650, checked in by Joel Sherrill <joel.sherrill@…>, on 07/30/99 at 17:52:50

Patch from Ralf Corsepius <corsepiu@…>:

The main topic is replacing the hard-coded values for HAS_MP and
HAS_RDBG in custom/*.cfg with per-bsp configuration-time autoconf checks
(This is the patch I had mentioned before earlier this week).

CHANGES

  • HAS_MP removed from custom/*.cfg, replaced with configuration time autoconf check
  • HAS_RDBG removed from custom/*.cfg, replaced with configuration-time autoconf check
  • NEW: c/src/make/bsp.cfg.in, takes configuration-time checked per-bsp values (i.e. HAS_MP, HAS_RDBG), gets installed as $(prefix)/<bsp>/make/bsp.cfg
  • NEW: default.cfg includes bsp.cfg - this change is backward compatible.
  • IMPORT_SRC: apply VPATH instead for ts_386ex/i386ex subdirectory Makefile.ins
  • HACK: a bug in acpolish mis-handles addtions to makefile variables which are enclosed in gmake conditionals: c/src/lib/libbsp/m68k/ods68302/start302/Makefile.in
  • Apply inline_dir, HAS_MP and HAS_RDBG for avoiding configuration of unneeded subdirectories in various configure.in files.
  • Several minor changes in Makefile.ins and configure.ins, wrt. to the order of including *.cfg and defining Makefile variables

APPLYING THE PATCH:

patch -p1 < rtems-rc-19990709-4.diff
./autogen

  • Property mode set to 100644
File size: 25.1 KB
Line 
1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl $Id$
14
15dnl
16dnl RTEMS_TOP($1)
17dnl
18dnl $1 .. relative path from this configure.in to the toplevel configure.in
19dnl
20AC_DEFUN(RTEMS_TOP,
21[dnl
22AC_ARG_WITH(target-subdir,
23[  --with-target-subdir=DIR],
24TARGET_SUBDIR="$withval",
25TARGET_SUBDIR=".")
26
27RTEMS_TOPdir="$1";
28AC_SUBST(RTEMS_TOPdir)
29
30dnl Determine RTEMS Version string from the VERSION file
31dnl Hopefully, Joel never changes its format ;-
32AC_MSG_CHECKING([for RTEMS Version])
33if test -r "${srcdir}/${RTEMS_TOPdir}/VERSION"; then
34changequote(,)dnl
35RTEMS_VERSION=`grep Version ${srcdir}/${RTEMS_TOPdir}/VERSION | \
36sed -e 's%RTEMS[        ]*Version[      ]*\(.*\)[       ]*%\1%g'`
37changequote([,])dnl
38else
39AC_MSG_ERROR(Unable to find ${RTEMS_TOPdir}/VERSION)
40fi
41if test -z "$RTEMS_VERSION"; then
42AC_MSG_ERROR(Unable to determine version)
43fi
44AC_MSG_RESULT($RTEMS_VERSION)
45])dnl
46
47dnl
48dnl $Id$
49dnl
50
51dnl canonicalize target cpu
52dnl NOTE: Most rtems targets do not fullfil autoconf's
53dnl target naming conventions "processor-vendor-os"
54dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
55dnl and we have to fix it for rtems ourselves
56
57AC_DEFUN(RTEMS_CANONICAL_TARGET_CPU,
58[
59AC_CANONICAL_SYSTEM
60AC_MSG_CHECKING(rtems target cpu)
61changequote(,)dnl
62case "${target}" in
63  # hpux unix port should go here
64  i[3456]86-go32-rtems*)
65        RTEMS_CPU=i386
66        ;;
67  i[3456]86-pc-linux*)          # unix "simulator" port
68        RTEMS_CPU=unix
69        ;;
70  i[3456]86-*freebsd2*)         # unix "simulator" port
71        RTEMS_CPU=unix
72        ;;
73  no_cpu-*rtems*)
74        RTEMS_CPU=no_cpu
75        ;;
76  sparc-sun-solaris*)           # unix "simulator" port
77        RTEMS_CPU=unix
78        ;;
79  *)
80        RTEMS_CPU=`echo $target | sed 's%^\([^-]*\)-\(.*\)$%\1%'`
81        ;;
82esac
83changequote([,])dnl
84AC_SUBST(RTEMS_CPU)
85AC_MSG_RESULT($RTEMS_CPU)
86])
87
88# Add --enable-maintainer-mode option to configure.
89# From Jim Meyering
90
91# serial 1
92
93AC_DEFUN(AM_MAINTAINER_MODE,
94[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
95  dnl maintainer-mode is disabled by default
96  AC_ARG_ENABLE(maintainer-mode,
97[  --enable-maintainer-mode enable make rules and dependencies not useful
98                          (and sometimes confusing) to the casual installer],
99      USE_MAINTAINER_MODE=$enableval,
100      USE_MAINTAINER_MODE=no)
101  AC_MSG_RESULT($USE_MAINTAINER_MODE)
102  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
103  MAINT=$MAINTAINER_MODE_TRUE
104  AC_SUBST(MAINT)dnl
105]
106)
107
108# Define a conditional.
109
110AC_DEFUN(AM_CONDITIONAL,
111[AC_SUBST($1_TRUE)
112AC_SUBST($1_FALSE)
113if $2; then
114  $1_TRUE=
115  $1_FALSE='#'
116else
117  $1_TRUE='#'
118  $1_FALSE=
119fi])
120
121dnl $Id$
122
123AC_DEFUN(RTEMS_ENABLE_MULTIPROCESSING,
124[
125AC_ARG_ENABLE(multiprocessing,
126[  --enable-multiprocessing             enable multiprocessing interface],
127[case "${enableval}" in
128  yes) RTEMS_HAS_MULTIPROCESSING=yes ;;
129  no) RTEMS_HAS_MULTIPROCESSING=no ;;
130  *)  AC_MSG_ERROR(bad value ${enableval} for enable-multiprocessing option) ;;
131esac],[RTEMS_HAS_MULTIPROCESSING=no])
132AC_SUBST(RTEMS_HAS_MULTIPROCESSING)dnl
133])
134
135dnl $Id$
136
137AC_DEFUN(RTEMS_ENABLE_POSIX,
138[
139AC_ARG_ENABLE(posix,
140[  --enable-posix                       enable posix interface],
141[case "${enableval}" in
142  yes) RTEMS_HAS_POSIX_API=yes ;;
143  no) RTEMS_HAS_POSIX_API=no ;;
144  *)  AC_MSG_ERROR(bad value ${enableval} for enable-posix option) ;;
145esac],[RTEMS_HAS_POSIX_API=yes])
146AC_SUBST(RTEMS_HAS_POSIX_API)
147
148changequote(,)dnl
149case "${target}" in
150  # hpux unix port should go here
151  i[3456]86-go32-rtems*)
152        RTEMS_HAS_POSIX_API=no
153        ;;
154  i[3456]86-pc-linux*)         # unix "simulator" port
155        RTEMS_HAS_POSIX_API=no
156        ;;
157  i[3456]86-*freebsd2*) # unix "simulator" port
158        RTEMS_HAS_POSIX_API=no
159        ;;
160  no_cpu-*rtems*)
161        RTEMS_HAS_POSIX_API=no
162        ;;
163  sparc-sun-solaris*)             # unix "simulator" port
164        RTEMS_HAS_POSIX_API=no
165        ;;
166  *)
167        ;;
168esac
169changequote([,])dnl
170AC_SUBST(RTEMS_HAS_POSIX_API)
171])
172
173dnl $Id$
174
175AC_DEFUN(RTEMS_ENABLE_NETWORKING,
176[
177AC_ARG_ENABLE(networking,
178[  --enable-networking                  enable TCP/IP stack],
179[case "${enableval}" in
180  yes) RTEMS_HAS_NETWORKING=yes ;;
181  no) RTEMS_HAS_NETWORKING=no ;;
182  *)  AC_MSG_ERROR(bad value ${enableval} for enable-networking option) ;;
183esac],[RTEMS_HAS_NETWORKING=yes])
184AC_SUBST(RTEMS_HAS_NETWORKING)dnl
185])
186
187dnl $Id$
188
189AC_DEFUN(RTEMS_ENABLE_RDBG,
190[
191AC_ARG_ENABLE(rdbg,
192[  --enable-rdbg                        enable remote debugger],
193[case "${enableval}" in
194  yes) RTEMS_HAS_RDBG=yes ;;
195  no) RTEMS_HAS_RDBG=no ;;
196  *)  AC_MSG_ERROR(bad value ${enableval} for enable-rdbg option) ;;
197esac],[RTEMS_HAS_RDBG=no])
198AC_SUBST(RTEMS_HAS_RDBG)dnl
199])
200
201dnl $Id$
202
203AC_DEFUN(RTEMS_ENABLE_INLINES,
204[AC_ARG_ENABLE(rtems-inlines,
205[  --enable-rtems-inlines               enable RTEMS inline functions]
206[                                       (default:enabled, disable to use macros)],
207[case "${enableval}" in
208  yes) RTEMS_USE_MACROS=no ;;
209  no) RTEMS_USE_MACROS=yes ;;
210  *)  AC_MSG_ERROR(bad value ${enableval} for disable-rtems-inlines option) ;;
211esac],[RTEMS_USE_MACROS=no])
212AC_SUBST(RTEMS_USE_MACROS)dnl
213])
214
215dnl $Id$
216
217AC_DEFUN(RTEMS_ENABLE_CXX,
218[
219AC_ARG_ENABLE(cxx,
220[  --enable-cxx                         enable C++ support,]
221[                                       and build the rtems++ library],
222[case "${enableval}" in
223  yes) RTEMS_HAS_CPLUSPLUS=yes ;;
224  no) RTEMS_HAS_CPLUSPLUS=no   ;;
225  *)  AC_MSG_ERROR(bad value ${enableval} for enable-cxx option) ;;
226esac], [RTEMS_HAS_CPLUSPLUS=no])
227])
228
229dnl $Id$
230
231AC_DEFUN(RTEMS_ENABLE_GCC28,
232[
233AC_ARG_ENABLE(gcc28,
234[  --enable-gcc28                       enable use of gcc 2.8.x features],
235[case "${enableval}" in
236  yes) RTEMS_USE_GCC272=no ;;
237  no) RTEMS_USE_GCC272=yes ;;
238  *)  AC_MSG_ERROR(bad value ${enableval} for gcc-28 option) ;;
239esac],[RTEMS_USE_GCC272=no])
240])
241
242dnl $Id$
243
244AC_DEFUN(RTEMS_ENABLE_LIBCDIR,
245[
246AC_ARG_ENABLE(libcdir,
247[  --enable-libcdir=directory           set the directory for the C library],
248[ RTEMS_LIBC_DIR="${enableval}" ; \
249test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )
250AC_SUBST(RTEMS_LIBC_DIR)dnl
251])
252
253AC_DEFUN(RTEMS_ENABLE_BARE,
254[
255AC_ARG_ENABLE(bare-cpu-cflags,
256[  --enable-bare-cpu-cflags             specify a particular cpu cflag]
257[                                       (bare bsp specific)],
258[case "${enableval}" in
259  no) BARE_CPU_CFLAGS="" ;;
260  *)    BARE_CPU_CFLAGS="${enableval}" ;;
261esac],
262[BARE_CPU_CFLAGS=""])
263
264AC_ARG_ENABLE(bare-cpu-model,
265[  --enable-bare-cpu-model              specify a particular cpu model]
266[                                       (bare bsp specific)],
267[case "${enableval}" in
268  no)   BARE_CPU_MODEL="" ;;
269  *)    BARE_CPU_MODEL="${enableval}" ;;
270esac],
271[BARE_CPU_MODEL=""])
272])
273
274
275dnl $Id$
276dnl
277dnl FIXME: this needs to be reworked
278
279AC_DEFUN(RTEMS_ENABLE_HWAPI,
280[dnl
281AC_ARG_ENABLE(hwapi, \
282[  --enable-hwapi                       enable hardware API library],
283[case "${enableval}" in
284    yes) RTEMS_HAS_HWAPI=yes ;;
285    no)  RTEMS_HAS_HWAPI=no ;;
286    *)  AC_MSG_ERROR(bad value ${enableval} for hwapi option) ;;
287  esac],[RTEMS_HAS_HWAPI=no])
288AC_SUBST(RTEMS_HAS_HWAPI)dnl
289])dnl
290
291dnl $Id$
292
293dnl Override the set of BSPs to be built.
294dnl used by the toplevel configure script
295dnl RTEMS_ENABLE_RTEMSBSP(rtems_bsp_list)
296AC_DEFUN(RTEMS_ENABLE_RTEMSBSP,
297[
298AC_ARG_ENABLE(rtemsbsp,
299[  --enable-rtemsbsp=bsp1 bsp2 ..      BSPs to include in build],
300[case "${enableval}" in
301  yes|no) AC_MSG_ERROR([missing argument to --enable-rtemsbsp=\"bsp1 bsp2\"]);;
302  *) $1=$enableval;;
303esac],[$1=""])
304])
305
306dnl Pass a single BSP via an environment variable
307dnl used by per BSP configure scripts
308AC_DEFUN(RTEMS_ENV_RTEMSBSP,
309[dnl
310AC_MSG_CHECKING([for RTEMS_BSP])
311AC_CACHE_VAL(rtems_cv_RTEMS_BSP,
312[dnl
313  test -n "${RTEMS_BSP}" && rtems_cv_RTEMS_BSP="$RTEMS_BSP";
314])dnl
315if test -z "$rtems_cv_RTEMS_BSP"; then
316  AC_MSG_ERROR([Missing RTEMS_BSP])
317fi
318RTEMS_BSP="$rtems_cv_RTEMS_BSP"
319AC_MSG_RESULT(${RTEMS_BSP})
320AC_SUBST(RTEMS_BSP)
321])
322
323dnl $Id$
324
325dnl check if RTEMS support a cpu
326AC_DEFUN(RTEMS_CHECK_CPU,
327[dnl
328AC_REQUIRE([RTEMS_TOP])
329AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])
330# Is this a supported CPU?
331AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
332if test -d "$srcdir/$RTEMS_TOPdir/c/src/exec/score/cpu/$RTEMS_CPU"; then
333  AC_MSG_RESULT(yes)
334else
335  AC_MSG_ERROR(no)
336fi
337])dnl
338
339
340dnl $Id$
341
342AC_DEFUN(RTEMS_CANONICAL_HOST,
343[dnl
344AC_REQUIRE([AC_CANONICAL_HOST])
345RTEMS_HOST=$host_os
346changequote(,)dnl
347case "${target}" in
348  # hpux unix port should go here
349  i[3456]86-pc-linux*)         # unix "simulator" port
350        RTEMS_HOST=Linux
351        ;;
352  i[3456]86-*freebsd2*) # unix "simulator" port
353        RTEMS_HOST=FreeBSD
354        ;;
355  sparc-sun-solaris*)             # unix "simulator" port
356        RTEMS_HOST=Solaris
357        ;;
358  *)
359        ;;
360esac
361changequote([,])dnl
362AC_SUBST(RTEMS_HOST)
363])dnl
364
365dnl
366dnl $Id$
367dnl
368
369AC_DEFUN(RTEMS_PROJECT_ROOT,
370[dnl
371AC_REQUIRE([RTEMS_TOP])
372if test "$TARGET_SUBDIR" = "." ; then
373PROJECT_ROOT=$RTEMS_TOPdir/'$(top_builddir)';
374else
375PROJECT_ROOT=../$RTEMS_TOPdir/'$(top_builddir)'
376fi
377AC_SUBST(PROJECT_ROOT)
378
379RTEMS_ROOT=$RTEMS_TOPdir/'$(top_builddir)'/c/$RTEMS_BSP
380AC_SUBST(RTEMS_ROOT)
381
382INSTALL_CHANGE="\$(KSH) \$(PROJECT_ROOT)/tools/build/install-if-change"
383AC_SUBST(INSTALL_CHANGE)
384
385PACKHEX="\$(PROJECT_ROOT)/tools/build/packhex"
386AC_SUBST(PACKHEX)
387])
388
389
390dnl
391dnl $Id$
392dnl
393dnl Check for target gcc
394dnl
395dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
396dnl                             Completely reworked
397
398AC_DEFUN(RTEMS_PROG_CC,
399[
400AC_BEFORE([$0], [AC_PROG_CPP])dnl
401AC_BEFORE([$0], [AC_PROG_CC])dnl
402AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
403
404dnl Only accept gcc and cc
405dnl NOTE: This might be too restrictive for native compilation
406AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
407test -z "$CC_FOR_TARGET" \
408  && AC_MSG_ERROR([no acceptable cc found in \$PATH])
409
410dnl backup
411rtems_save_CC=$CC
412rtems_save_CFLAGS=$CFLAGS
413
414dnl temporarily set CC
415CC=$CC_FOR_TARGET
416
417AC_PROG_CC_WORKS
418AC_PROG_CC_GNU
419
420if test $ac_cv_prog_gcc = yes; then
421  GCC=yes
422dnl Check whether -g works, even if CFLAGS is set, in case the package
423dnl plays around with CFLAGS (such as to build both debugging and
424dnl normal versions of a library), tasteless as that idea is.
425  ac_test_CFLAGS="${CFLAGS+set}"
426  ac_save_CFLAGS="$CFLAGS"
427  CFLAGS=
428  AC_PROG_CC_G
429  if test "$ac_test_CFLAGS" = set; then
430    CFLAGS="$ac_save_CFLAGS"
431  elif test $ac_cv_prog_cc_g = yes; then
432    CFLAGS="-g -O2"
433  else
434    CFLAGS="-O2"
435  fi
436else
437  GCC=
438  test "${CFLAGS+set}" = set || CFLAGS="-g"
439fi
440
441rtems_cv_prog_gcc=$ac_cv_prog_gcc
442rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
443rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
444rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
445
446dnl restore initial values
447CC=$rtems_save_CC
448CFLAGS=$rtems_save_CFLAGS
449
450unset ac_cv_prog_gcc
451unset ac_cv_prog_cc_g
452unset ac_cv_prog_cc_works
453unset ac_cv_prog_cc_cross
454])
455
456AC_DEFUN(RTEMS_PROG_CC_FOR_TARGET,
457[
458dnl check target cc
459RTEMS_PROG_CC
460dnl check if the compiler supports --specs
461RTEMS_GCC_SPECS
462dnl check if the target compiler may use --pipe
463RTEMS_GCC_PIPE
464dnl check if the compiler supports --specs if gcc28 is requested
465if test "$RTEMS_USE_GCC272" != "yes" ; then
466  if test "$rtems_cv_gcc_specs" = "no"; then
467    AC_MSG_WARN([*** disabling --enable-gcc28])
468      RTEMS_USE_GCC272=yes
469  fi
470fi
471test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe"
472
473dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-*
474case $host_os in
475*cygwin*)     GCCSED="| sed 's%\\\\%/%g'" ;;
476*) ;;
477esac
478AC_SUBST(GCCSED)
479])
480
481dnl
482dnl  $Id$
483dnl
484dnl Set program_prefix
485dnl
486dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
487dnl                             Extracted from configure
488
489AC_DEFUN(RTEMS_TOOL_PREFIX,
490[AC_REQUIRE([AC_CANONICAL_TARGET])dnl
491AC_REQUIRE([AC_CANONICAL_BUILD])dnl
492
493changequote(,)dnl
494if [ "${program_prefix}" = "NONE" ] ; then
495  if [ "${target}" = "${host}" ] ; then
496    program_prefix=
497  else
498    program_prefix=${target}-
499  fi
500fi
501changequote([,])dnl
502])
503
504dnl
505dnl $Id$
506dnl
507dnl Check whether the target compiler accepts -specs
508dnl
509dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
510dnl
511
512AC_DEFUN(RTEMS_GCC_SPECS,
513[AC_REQUIRE([RTEMS_PROG_CC])
514AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
515[
516rtems_cv_gcc_specs=no
517if test "$rtems_cv_prog_gcc" = "yes"; then
518  touch confspec
519  echo 'void f(){}' >conftest.c
520  if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
521    rtems_cv_gcc_specs=yes
522  fi
523fi
524rm -f confspec conftest*
525])])
526
527dnl
528dnl $Id$
529dnl
530dnl Check whether the target compiler accepts -pipe
531dnl
532dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
533dnl
534
535AC_DEFUN(RTEMS_GCC_PIPE,
536[AC_REQUIRE([RTEMS_PROG_CC])
537AC_REQUIRE([AC_CANONICAL_HOST])
538AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
539[
540rtems_cv_gcc_pipe=no
541if test "$rtems_cv_prog_gcc" = "yes"; then
542case "$host_os" in
543  cygwin*)
544    ;;
545  *)
546    echo 'void f(){}' >conftest.c
547    if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
548      rtems_cv_gcc_pipe=yes
549    fi
550    rm -f conftest*
551    ;;
552esac
553fi
554])
555])
556
557dnl
558dnl $Id$
559dnl
560dnl Check for target g++
561dnl
562dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
563dnl                             Completely reworked
564
565AC_DEFUN(RTEMS_PROG_CXX,
566[
567AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
568AC_BEFORE([$0], [AC_PROG_CXX])dnl
569AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
570
571dnl Only accept g++ and c++
572dnl NOTE: This might be too restrictive for native compilation
573AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++)
574test -z "$CXX_FOR_TARGET" \
575  && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
576
577dnl backup
578rtems_save_CXX=$CXX
579rtems_save_CXXFLAGS=$CXXFLAGS
580
581dnl temporarily set CXX
582CXX=$CXX_FOR_TARGET
583
584AC_PROG_CXX_WORKS
585AC_PROG_CXX_GNU
586
587if test $ac_cv_prog_gxx = yes; then
588  GXX=yes
589dnl Check whether -g works, even if CXXFLAGS is set, in case the package
590dnl plays around with CXXFLAGS (such as to build both debugging and
591dnl normal versions of a library), tasteless as that idea is.
592  ac_test_CXXFLAGS="${CXXFLAGS+set}"
593  ac_save_CXXFLAGS="$CXXFLAGS"
594  CXXFLAGS=
595  AC_PROG_CXX_G
596  if test "$ac_test_CXXFLAGS" = set; then
597    CXXFLAGS="$ac_save_CXXFLAGS"
598  elif test $ac_cv_prog_cxx_g = yes; then
599    CXXFLAGS="-g -O2"
600  else
601    CXXFLAGS="-O2"
602  fi
603else
604  GXX=
605  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
606fi
607
608rtems_cv_prog_gxx=$ac_cv_prog_gxx
609rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g
610rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works
611rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross
612
613CXX=$rtems_save_CXX
614CXXFLAGS=$rtems_save_CXXFLAGS
615
616dnl restore initial values
617unset ac_cv_prog_gxx
618unset ac_cv_prog_cc_g
619unset ac_cv_prog_cxx_works
620unset ac_cv_prog_cxx_cross
621])
622
623AC_DEFUN(RTEMS_PROG_CXX_FOR_TARGET,
624[
625  RTEMS_PROG_CXX
626  if test "$rtems_cv_prog_cc_cross" != "$rtems_cv_prog_cxx_cross"; then
627    AC_MSG_ERROR([***]
628     [Inconsistency in compiler configuration:]
629     [Target C compiler and Target C++ compiler]
630     [must both either be cross compilers or native compilers]
631     [Hint: If building a posix bsp: LD_LIBRARY_PATH?] )
632  fi
633])
634
635dnl
636dnl $Id$
637dnl
638dnl Set target tools
639dnl
640dnl 98/06/23 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
641dnl             fixing cache/environment variable handling
642dnl             adding checks for cygwin/egcs '\\'-bug
643dnl             adding checks for ranlib/ar -s problem
644dnl
645dnl 98/02/12 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
646dnl
647
648AC_DEFUN(RTEMS_GCC_PRINT,
649[ case $host_os in
650  *cygwin*)
651    dnl FIXME: Hack for cygwin/egcs reporting mixed '\\' and '/'
652    dnl        Should be removed once cygwin/egcs reports '/' only
653    $1=`$CC_FOR_TARGET --print-prog-name=$2 | sed -e 's%\\\\%/%g' `
654    ;;
655  *)
656    $1=`$CC_FOR_TARGET --print-prog-name=$2`
657    ;;
658  esac
659])
660
661AC_DEFUN(RTEMS_PATH_TOOL,
662[
663AC_MSG_CHECKING([target's $2])
664AC_CACHE_VAL(ac_cv_path_$1,:)
665AC_MSG_RESULT([$ac_cv_path_$1])
666
667if test -n "$ac_cv_path_$1"; then
668  dnl retrieve the value from the cache
669  $1=$ac_cv_path_$1
670else
671  dnl the cache was not set
672  if test -z "[$]$1" ; then
673    if test "$rtems_cv_prog_gcc" = "yes"; then
674      # We are using gcc, ask it about its tool
675      # NOTE: Necessary if gcc was configured to use the target's
676      # native tools or uses prefixes for gnutools (e.g. gas instead of as)
677      RTEMS_GCC_PRINT($1,$2)
678    fi
679  else
680    # The user set an environment variable.
681    # Check whether it is an absolute path, otherwise AC_PATH_PROG
682    # will override the environment variable, which isn't what the user
683    # intends
684    AC_MSG_CHECKING([whether environment variable $1 is an absolute path])
685    case "[$]$1" in
686    /*) # valid
687      AC_MSG_RESULT("yes")
688    ;;
689    *)  # invalid for AC_PATH_PROG
690      AC_MSG_RESULT("no")
691      AC_MSG_ERROR([***]
692        [Environment variable $1 should either]
693        [be unset (preferred) or contain an absolute path])
694    ;;
695    esac
696  fi
697
698  AC_PATH_PROG($1,"$program_prefix"$2,$3)
699fi
700])
701
702AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
703[AC_REQUIRE([RTEMS_PROG_CC])dnl
704
705dnl FIXME: What shall be done if these tools are not available?
706  RTEMS_PATH_TOOL(AR_FOR_TARGET,ar,no)
707  RTEMS_PATH_TOOL(AS_FOR_TARGET,as,no)
708  RTEMS_PATH_TOOL(LD_FOR_TARGET,ld,no)
709  RTEMS_PATH_TOOL(NM_FOR_TARGET,nm,no)
710
711dnl special treatment of ranlib
712  RTEMS_PATH_TOOL(RANLIB_FOR_TARGET,ranlib,no)
713  if test "$RANLIB_FOR_TARGET" = "no"; then
714    # ranlib wasn't found; check if ar -s is available
715    RTEMS_AR_FOR_TARGET_S
716    if test $rtems_cv_AR_FOR_TARGET_S = "yes" ; then
717      dnl override RANLIB_FOR_TARGET's cache
718      ac_cv_path_RANLIB_FOR_TARGET="$AR_FOR_TARGET -s"
719      RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET
720    else
721      AC_MSG_ERROR([***]
722        [Can't figure out how to build a library index]
723        [Neither ranlib nor ar -s seem to be available] )
724    fi
725  fi
726
727dnl NOTE: These may not be available if not using gnutools
728  RTEMS_PATH_TOOL(OBJCOPY_FOR_TARGET,objcopy,no)
729  RTEMS_PATH_TOOL(SIZE_FOR_TARGET,size,no)
730  RTEMS_PATH_TOOL(STRIP_FOR_TARGET,strip,no)
731])
732
733dnl
734dnl $Id$
735dnl
736
737AC_DEFUN(RTEMS_AR_FOR_TARGET_S,
738[
739AC_CACHE_CHECK(whether $AR_FOR_TARGET -s works,
740rtems_cv_AR_FOR_TARGET_S,
741[
742cat > conftest.$ac_ext <<EOF
743int foo( int b )
744{ return b; }
745EOF
746if AC_TRY_COMMAND($CC_FOR_TARGET -o conftest.o -c conftest.$ac_ext) \
747  && AC_TRY_COMMAND($AR_FOR_TARGET -sr conftest.a conftest.o) \
748  && test -s conftest.a ; \
749then
750  rtems_cv_AR_FOR_TARGET_S="yes"
751else
752  rtems_cv_AR_FOR_TARGET_S="no"
753fi
754  rm -f conftest*
755])
756])
757
758
759dnl
760dnl  $Id$
761dnl
762
763dnl check for i386 gas supporting 16 bit mode
764dnl     - binutils 2.9.1.0.7 and higher
765
766AC_DEFUN(RTEMS_I386_GAS_CODE16,
767[ if test "${target_cpu}" = "i386"; then
768    AC_CACHE_CHECK([for 16 bit mode assembler support],
769      rtems_cv_prog_gas_code16,
770      [cat > conftest.s << EOF
771         .code16
772         data32
773         addr32
774         lgdt 0
775EOF
776      if AC_TRY_COMMAND($AS_FOR_TARGET -o conftest.o conftest.s); then
777        rtems_cv_prog_gas_code16=yes
778      else
779        rtems_cv_prog_gas_code16=no
780      fi])
781    RTEMS_GAS_CODE16="$rtems_cv_prog_gas_code16"
782  fi
783  AC_SUBST(RTEMS_GAS_CODE16)
784])
785
786
787dnl
788dnl $Id$
789dnl
790dnl Check for System V IPC calls used by Unix simulators
791dnl
792dnl 98/07/17 Dario Alcocer     alcocer@netcom.com
793dnl          Ralf Corsepius    corsepiu@faw.uni-ulm.de
794dnl
795dnl Note: $host_os should probably *not* ever be used here to
796dnl determine if host supports System V IPC calls, since some
797dnl (e.g. FreeBSD 2.x) are configured by default to include only
798dnl a subset of the System V IPC calls.  Therefore, to make sure
799dnl all of the required calls are found, test for each call explicitly.
800dnl
801dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally
802dnl modify any existing key sets.  See the man pages for semget, shmget,
803dnl msgget, semctl, shmctl and msgctl for details.
804
805AC_DEFUN(RTEMS_SYSV_SEM,
806[AC_REQUIRE([AC_PROG_CC])
807AC_REQUIRE([RTEMS_CANONICAL_HOST])
808AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores,
809rtems_cv_sysv_sem,
810[
811AC_TRY_RUN([
812#include <sys/types.h>
813#include <sys/ipc.h>
814#include <sys/sem.h>
815int main () {
816#if !defined(sun)
817  union semun arg ;
818#else
819  union semun {
820    int val;
821    struct semid_ds *buf;
822    ushort *array;
823  } arg;
824#endif
825  int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
826  if (id == -1)
827    exit(1);
828  arg.val = 0; /* avoid implicit type cast to union */
829  if (semctl(id, 0, IPC_RMID, arg) == -1)
830    exit(1);
831  exit(0);
832}
833],
834rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :)
835])
836])
837
838AC_DEFUN(RTEMS_SYSV_SHM,
839[AC_REQUIRE([AC_PROG_CC])
840AC_REQUIRE([RTEMS_CANONICAL_HOST])
841AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory,
842rtems_cv_sysv_shm,
843[
844AC_TRY_RUN([
845#include <sys/types.h>
846#include <sys/ipc.h>
847#include <sys/shm.h>
848int main () {
849  int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
850  if (id == -1)
851    exit(1);
852  if (shmctl(id, IPC_RMID, 0) == -1)
853    exit(1);
854  exit(0);
855}
856],
857rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :)
858])
859])
860
861AC_DEFUN(RTEMS_SYSV_MSG,
862[AC_REQUIRE([AC_PROG_CC])
863AC_REQUIRE([RTEMS_CANONICAL_HOST])
864AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages,
865rtems_cv_sysv_msg,
866[
867AC_TRY_RUN([
868#include <sys/types.h>
869#include <sys/ipc.h>
870#include <sys/msg.h>
871int main () {
872  int id=msgget(IPC_PRIVATE,IPC_CREAT|0400);
873  if (id == -1)
874    exit(1);
875  if (msgctl(id, IPC_RMID, 0) == -1)
876    exit(1);
877  exit(0);
878}
879],
880rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :)
881])
882])
883
884AC_DEFUN(RTEMS_CHECK_SYSV_UNIX,
885[AC_REQUIRE([RTEMS_CANONICAL_HOST])
886if test "$RTEMS_CPU" = "unix" ; then
887  RTEMS_SYSV_SEM
888  if test "$rtems_cv_sysv_sem" != "yes" ; then
889    AC_MSG_ERROR([System V semaphores don't work, required by simulator])
890  fi
891  RTEMS_SYSV_SHM
892  if test "$rtems_cv_sysv_shm" != "yes" ; then
893    AC_MSG_ERROR([System V shared memory doesn't work, required by simulator])
894  fi
895  RTEMS_SYSV_MSG
896  if test "$rtems_cv_sysv_msg" != "yes" ; then
897    AC_MSG_ERROR([System V messages don't work, required by simulator])
898  fi
899fi
900])
901
902dnl $Id$
903
904dnl Report all available bsps for a target,
905dnl check if a bsp-subdirectory is present for all bsps found
906dnl
907dnl RTEMS_CHECK_BSPS(bsp_list)
908AC_DEFUN(RTEMS_CHECK_BSPS,
909[
910AC_REQUIRE([RTEMS_CHECK_CPU])dnl sets RTEMS_CPU, target
911AC_REQUIRE([RTEMS_TOP])dnl sets RTEMS_TOPdir
912AC_MSG_CHECKING([for bsps])
913case "${target}" in
914changequote(,)dnl
915  i[3456]86-go32-rtems*)
916changequote([,])dnl
917    $1="go32 go32_p5"
918    ;;
919  *)
920    files=`ls $srcdir/$RTEMS_TOPdir/c/src/lib/libbsp/$RTEMS_CPU`
921    for file in $files; do
922      case $file in
923        shared*);;
924        Makefile*);;
925        READ*);;
926        CVS*);;
927        pxfl*);;
928        go32*);;       # so the i386 port can pick up the other Makefiles
929        # Now account for BSPs with build variants
930        gen68360)      rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
931        p4000)         rtems_bsp="$rtems_bsp p4600 p4650";;
932        mvme162)       rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
933        *) $1="[$]$1 $file";;
934      esac;
935    done
936    ;;
937esac
938AC_MSG_RESULT([[$]$1 .. done])
939])dnl
940
941AC_DEFUN(RTEMS_CHECK_CUSTOM_BSP,
942[dnl
943AC_MSG_CHECKING([for make/custom/[$]$1.cfg])
944if test -r "$srcdir/$RTEMS_TOPdir/make/custom/[$]$1.cfg"; then
945  AC_MSG_RESULT([yes])
946else
947  AC_MSG_ERROR([no])
948fi
949])dnl
950
951dnl $Id$
952
953AC_DEFUN(RTEMS_CHECK_MULTIPROCESSING,
954[dnl
955AC_REQUIRE([RTEMS_TOP])dnl
956AC_REQUIRE([RTEMS_CHECK_CPU])dnl
957AC_CACHE_CHECK([whether BSP supports multiprocessing],
958  rtems_cv_HAS_MP,
959  [dnl
960    if test -d "$srcdir/${RTEMS_TOPdir}/c/src/lib/libbsp/${RTEMS_CPU}/${$1}/shmsupp"; then
961      if test "$RTEMS_HAS_MULTIPROCESSING" = "yes"; then
962        rtems_cv_HAS_MP="yes" ;
963      else
964        rtems_cv_HAS_MP="disabled";
965      fi
966    else
967      rtems_cv_HAS_MP="no";
968    fi
969  ])
970if test "$rtems_cv_HAS_MP" = "yes"; then
971HAS_MP="yes"
972else
973HAS_MP="no"
974fi
975AC_SUBST(HAS_MP)
976])
977
978dnl
979dnl  $Id$
980dnl
981
982dnl RTEMS_BSP_ALIAS(BSP_ALIAS,BSP_RETURNED)
983dnl convert a bsp alias $1 into its bsp directory $2
984AC_DEFUN(RTEMS_BSP_ALIAS,
985[
986    # account for "aliased" bsps which share source code
987    case $1 in
988      mvme162lx)    $2=mvme162  ;;  # mvme162 board variant
989      gen68360_040) $2=gen68360 ;;  # 68360 in companion mode
990      go32_p5)      $2=go32     ;;  # go32 on Pentium class CPU
991      p4600)        $2=p4000    ;;  # p4000 board with IDT 4600
992      p4650)        $2=p4000    ;;  # p4000 board with IDT 4650
993      *)            $2=$1;;
994    esac
995])
996
997dnl
998dnl $Id$
999dnl
1000
1001dnl RTEMS_CHECK_MAKEFILE(path)
1002dnl Search for Makefile.in's within the directory starting
1003dnl at path and append an entry for Makefile to global variable
1004dnl "makefiles" (from configure.in) for each Makefile.in found
1005dnl
1006AC_DEFUN(RTEMS_CHECK_MAKEFILE,
1007[RTEMS_CHECK_FILES_IN($1,Makefile,makefiles)
1008])
1009
1010dnl
1011dnl $Id$
1012dnl
1013
1014dnl RTEMS_CHECK_FILES_IN(path,file,var)
1015dnl path .. path relative to srcdir, where to start searching for files
1016dnl file .. name of the files to search for
1017dnl var  .. shell variable to append files found
1018
1019AC_DEFUN(RTEMS_CHECK_FILES_IN,
1020[
1021AC_MSG_CHECKING(for $2.in in $1)
1022if test -d $srcdir/$1; then
1023  rtems_av_save_dir=`pwd`;
1024  cd $srcdir;
1025  rtems_av_tmp=`find $1 -name "$2.in" -print | sed "s/$2\.in/%/" | sort | sed "s/%/$2/"`
1026  $3="$$3 $rtems_av_tmp";
1027  cd $rtems_av_save_dir;
1028  AC_MSG_RESULT(done)
1029else
1030  AC_MSG_RESULT(no)
1031fi
1032])
1033
1034
1035AC_DEFUN(RTEMS_CHECK_RDBG,
1036[dnl
1037AC_REQUIRE([RTEMS_TOP])dnl
1038AC_REQUIRE([RTEMS_CHECK_CPU])dnl
1039AC_CACHE_CHECK([whether BSP supports librdbg],
1040  rtems_cv_HAS_RDBG,
1041  [
1042    if test -d "$srcdir/${RTEMS_TOPdir}/c/src/lib/librdbg/${RTEMS_CPU}/${$1}"; then
1043      rtems_cv_HAS_RDBG="yes" ;
1044    else
1045      rtems_cv_HAS_RDBG="no";
1046    fi
1047  ])
1048HAS_RDBG="$rtems_cv_HAS_RDBG"
1049AC_SUBST(HAS_RDBG)
1050])
1051
Note: See TracBrowser for help on using the repository browser.