source: rtems/c/src/tests/aclocal.m4 @ 3cad2919

4.104.114.84.95
Last change on this file since 3cad2919 was 3a8915e, checked in by Joel Sherrill <joel.sherrill@…>, on 08/06/99 at 17:55:25

Patch rtems-rc-19990709-6-diff from Ralf Corsepius <corsepiu@…>
applied. This modified many Makefiles and custom files and makes many more
settings (network, multiprocessing, etc) gnerated by autoconf.

  • Property mode set to 100644
File size: 23.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# Do all the work for Automake.  This macro actually does too much --
89# some checks are only needed if your package does certain things.
90# But this isn't really a big deal.
91
92# serial 1
93
94dnl Usage:
95dnl AM_INIT_AUTOMAKE(package,version, [no-define])
96
97AC_DEFUN(AM_INIT_AUTOMAKE,
98[AC_REQUIRE([AC_PROG_INSTALL])
99PACKAGE=[$1]
100AC_SUBST(PACKAGE)
101VERSION=[$2]
102AC_SUBST(VERSION)
103dnl test to see if srcdir already configured
104if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
105  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
106fi
107ifelse([$3],,
108AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
109AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
110AC_REQUIRE([AM_SANITY_CHECK])
111AC_REQUIRE([AC_ARG_PROGRAM])
112dnl FIXME This is truly gross.
113missing_dir=`cd $ac_aux_dir && pwd`
114AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
115AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
116AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
117AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
118AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
119AC_REQUIRE([AC_PROG_MAKE_SET])])
120
121#
122# Check to make sure that the build environment is sane.
123#
124
125AC_DEFUN(AM_SANITY_CHECK,
126[AC_MSG_CHECKING([whether build environment is sane])
127# Just in case
128sleep 1
129echo timestamp > conftestfile
130# Do `set' in a subshell so we don't clobber the current shell's
131# arguments.  Must try -L first in case configure is actually a
132# symlink; some systems play weird games with the mod time of symlinks
133# (eg FreeBSD returns the mod time of the symlink's containing
134# directory).
135if (
136   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
137   if test "[$]*" = "X"; then
138      # -L didn't work.
139      set X `ls -t $srcdir/configure conftestfile`
140   fi
141   if test "[$]*" != "X $srcdir/configure conftestfile" \
142      && test "[$]*" != "X conftestfile $srcdir/configure"; then
143
144      # If neither matched, then we have a broken ls.  This can happen
145      # if, for instance, CONFIG_SHELL is bash and it inherits a
146      # broken ls alias from the environment.  This has actually
147      # happened.  Such a system could not be considered "sane".
148      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
149alias in your environment])
150   fi
151
152   test "[$]2" = conftestfile
153   )
154then
155   # Ok.
156   :
157else
158   AC_MSG_ERROR([newly created file is older than distributed files!
159Check your system clock])
160fi
161rm -f conftest*
162AC_MSG_RESULT(yes)])
163
164dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
165dnl The program must properly implement --version.
166AC_DEFUN(AM_MISSING_PROG,
167[AC_MSG_CHECKING(for working $2)
168# Run test in a subshell; some versions of sh will print an error if
169# an executable is not found, even if stderr is redirected.
170# Redirect stdin to placate older versions of autoconf.  Sigh.
171if ($2 --version) < /dev/null > /dev/null 2>&1; then
172   $1=$2
173   AC_MSG_RESULT(found)
174else
175   $1="$3/missing $2"
176   AC_MSG_RESULT(missing)
177fi
178AC_SUBST($1)])
179
180# Add --enable-maintainer-mode option to configure.
181# From Jim Meyering
182
183# serial 1
184
185AC_DEFUN(AM_MAINTAINER_MODE,
186[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
187  dnl maintainer-mode is disabled by default
188  AC_ARG_ENABLE(maintainer-mode,
189[  --enable-maintainer-mode enable make rules and dependencies not useful
190                          (and sometimes confusing) to the casual installer],
191      USE_MAINTAINER_MODE=$enableval,
192      USE_MAINTAINER_MODE=no)
193  AC_MSG_RESULT($USE_MAINTAINER_MODE)
194  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
195  MAINT=$MAINTAINER_MODE_TRUE
196  AC_SUBST(MAINT)dnl
197]
198)
199
200# Define a conditional.
201
202AC_DEFUN(AM_CONDITIONAL,
203[AC_SUBST($1_TRUE)
204AC_SUBST($1_FALSE)
205if $2; then
206  $1_TRUE=
207  $1_FALSE='#'
208else
209  $1_TRUE='#'
210  $1_FALSE=
211fi])
212
213dnl $Id$
214
215AC_DEFUN(RTEMS_ENABLE_MULTIPROCESSING,
216[
217AC_ARG_ENABLE(multiprocessing,
218[  --enable-multiprocessing             enable multiprocessing interface],
219[case "${enableval}" in
220  yes) RTEMS_HAS_MULTIPROCESSING=yes ;;
221  no) RTEMS_HAS_MULTIPROCESSING=no ;;
222  *)  AC_MSG_ERROR(bad value ${enableval} for enable-multiprocessing option) ;;
223esac],[RTEMS_HAS_MULTIPROCESSING=no])
224AC_SUBST(RTEMS_HAS_MULTIPROCESSING)dnl
225])
226
227dnl $Id$
228
229AC_DEFUN(RTEMS_ENABLE_POSIX,
230[
231AC_ARG_ENABLE(posix,
232[  --enable-posix                       enable posix interface],
233[case "${enableval}" in
234  yes) RTEMS_HAS_POSIX_API=yes ;;
235  no) RTEMS_HAS_POSIX_API=no ;;
236  *)  AC_MSG_ERROR(bad value ${enableval} for enable-posix option) ;;
237esac],[RTEMS_HAS_POSIX_API=yes])
238AC_SUBST(RTEMS_HAS_POSIX_API)
239
240changequote(,)dnl
241case "${target}" in
242  # hpux unix port should go here
243  i[3456]86-go32-rtems*)
244        RTEMS_HAS_POSIX_API=no
245        ;;
246  i[3456]86-pc-linux*)         # unix "simulator" port
247        RTEMS_HAS_POSIX_API=no
248        ;;
249  i[3456]86-*freebsd2*) # unix "simulator" port
250        RTEMS_HAS_POSIX_API=no
251        ;;
252  no_cpu-*rtems*)
253        RTEMS_HAS_POSIX_API=no
254        ;;
255  sparc-sun-solaris*)             # unix "simulator" port
256        RTEMS_HAS_POSIX_API=no
257        ;;
258  *)
259        ;;
260esac
261changequote([,])dnl
262AC_SUBST(RTEMS_HAS_POSIX_API)
263])
264
265dnl $Id$
266
267AC_DEFUN(RTEMS_ENABLE_NETWORKING,
268[
269AC_ARG_ENABLE(networking,
270[  --enable-networking                  enable TCP/IP stack],
271[case "${enableval}" in
272  yes) RTEMS_HAS_NETWORKING=yes ;;
273  no) RTEMS_HAS_NETWORKING=no ;;
274  *)  AC_MSG_ERROR(bad value ${enableval} for enable-networking option) ;;
275esac],[RTEMS_HAS_NETWORKING=yes])
276AC_SUBST(RTEMS_HAS_NETWORKING)dnl
277])
278
279dnl $Id$
280
281AC_DEFUN(RTEMS_ENABLE_INLINES,
282[AC_ARG_ENABLE(rtems-inlines,
283[  --enable-rtems-inlines               enable RTEMS inline functions]
284[                                       (default:enabled, disable to use macros)],
285[case "${enableval}" in
286  yes) RTEMS_USE_MACROS=no ;;
287  no) RTEMS_USE_MACROS=yes ;;
288  *)  AC_MSG_ERROR(bad value ${enableval} for disable-rtems-inlines option) ;;
289esac],[RTEMS_USE_MACROS=no])
290AC_SUBST(RTEMS_USE_MACROS)dnl
291])
292
293dnl $Id$
294
295AC_DEFUN(RTEMS_ENABLE_CXX,
296[
297AC_ARG_ENABLE(cxx,
298[  --enable-cxx                         enable C++ support,]
299[                                       and build the rtems++ library],
300[case "${enableval}" in
301  yes) RTEMS_HAS_CPLUSPLUS=yes ;;
302  no) RTEMS_HAS_CPLUSPLUS=no   ;;
303  *)  AC_MSG_ERROR(bad value ${enableval} for enable-cxx option) ;;
304esac], [RTEMS_HAS_CPLUSPLUS=no])
305])
306
307dnl $Id$
308
309AC_DEFUN(RTEMS_ENABLE_GCC28,
310[
311AC_ARG_ENABLE(gcc28,
312[  --enable-gcc28                       enable use of gcc 2.8.x features],
313[case "${enableval}" in
314  yes) RTEMS_USE_GCC272=no ;;
315  no) RTEMS_USE_GCC272=yes ;;
316  *)  AC_MSG_ERROR(bad value ${enableval} for gcc-28 option) ;;
317esac],[RTEMS_USE_GCC272=no])
318])
319
320dnl $Id$
321
322AC_DEFUN(RTEMS_ENABLE_LIBCDIR,
323[
324AC_ARG_ENABLE(libcdir,
325[  --enable-libcdir=directory           set the directory for the C library],
326[ RTEMS_LIBC_DIR="${enableval}" ; \
327test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )
328AC_SUBST(RTEMS_LIBC_DIR)dnl
329])
330
331AC_DEFUN(RTEMS_ENABLE_BARE,
332[
333AC_ARG_ENABLE(bare-cpu-cflags,
334[  --enable-bare-cpu-cflags             specify a particular cpu cflag]
335[                                       (bare bsp specific)],
336[case "${enableval}" in
337  no) BARE_CPU_CFLAGS="" ;;
338  *)    BARE_CPU_CFLAGS="${enableval}" ;;
339esac],
340[BARE_CPU_CFLAGS=""])
341
342AC_ARG_ENABLE(bare-cpu-model,
343[  --enable-bare-cpu-model              specify a particular cpu model]
344[                                       (bare bsp specific)],
345[case "${enableval}" in
346  no)   BARE_CPU_MODEL="" ;;
347  *)    BARE_CPU_MODEL="${enableval}" ;;
348esac],
349[BARE_CPU_MODEL=""])
350])
351
352
353dnl $Id$
354
355AC_DEFUN(RTEMS_ENABLE_TESTS,
356[
357# If the tests are enabled, then find all the test suite Makefiles
358AC_MSG_CHECKING([if the test suites are enabled? ])
359AC_ARG_ENABLE(tests,
360[  --enable-tests                       enable tests (default:disabled)],
361  [case "${enableval}" in
362    yes) tests_enabled=yes ;;
363    no)  tests_enabled=no ;;
364    *)   AC_MSG_ERROR(bad value ${enableval} for tests option) ;;
365  esac], [tests_enabled=no])
366AC_MSG_RESULT([$tests_enabled])
367])
368
369dnl $Id$
370
371dnl Override the set of BSPs to be built.
372dnl used by the toplevel configure script
373dnl RTEMS_ENABLE_RTEMSBSP(rtems_bsp_list)
374AC_DEFUN(RTEMS_ENABLE_RTEMSBSP,
375[
376AC_ARG_ENABLE(rtemsbsp,
377[  --enable-rtemsbsp=bsp1 bsp2 ..      BSPs to include in build],
378[case "${enableval}" in
379  yes|no) AC_MSG_ERROR([missing argument to --enable-rtemsbsp=\"bsp1 bsp2\"]);;
380  *) $1=$enableval;;
381esac],[$1=""])
382])
383
384dnl Pass a single BSP via an environment variable
385dnl used by per BSP configure scripts
386AC_DEFUN(RTEMS_ENV_RTEMSBSP,
387[dnl
388AC_MSG_CHECKING([for RTEMS_BSP])
389AC_CACHE_VAL(rtems_cv_RTEMS_BSP,
390[dnl
391  test -n "${RTEMS_BSP}" && rtems_cv_RTEMS_BSP="$RTEMS_BSP";
392])dnl
393if test -z "$rtems_cv_RTEMS_BSP"; then
394  AC_MSG_ERROR([Missing RTEMS_BSP])
395fi
396RTEMS_BSP="$rtems_cv_RTEMS_BSP"
397AC_MSG_RESULT(${RTEMS_BSP})
398AC_SUBST(RTEMS_BSP)
399])
400
401dnl $Id$
402
403dnl check if RTEMS support a cpu
404AC_DEFUN(RTEMS_CHECK_CPU,
405[dnl
406AC_REQUIRE([RTEMS_TOP])
407AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])
408# Is this a supported CPU?
409AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
410if test -d "$srcdir/$RTEMS_TOPdir/c/src/exec/score/cpu/$RTEMS_CPU"; then
411  AC_MSG_RESULT(yes)
412else
413  AC_MSG_ERROR(no)
414fi
415])dnl
416
417
418dnl $Id$
419
420AC_DEFUN(RTEMS_CANONICAL_HOST,
421[dnl
422AC_REQUIRE([AC_CANONICAL_HOST])
423RTEMS_HOST=$host_os
424changequote(,)dnl
425case "${target}" in
426  # hpux unix port should go here
427  i[3456]86-pc-linux*)         # unix "simulator" port
428        RTEMS_HOST=Linux
429        ;;
430  i[3456]86-*freebsd2*) # unix "simulator" port
431        RTEMS_HOST=FreeBSD
432        ;;
433  sparc-sun-solaris*)             # unix "simulator" port
434        RTEMS_HOST=Solaris
435        ;;
436  *)
437        ;;
438esac
439changequote([,])dnl
440AC_SUBST(RTEMS_HOST)
441])dnl
442
443dnl
444dnl $Id$
445dnl
446
447AC_DEFUN(RTEMS_PROJECT_ROOT,
448[dnl
449AC_REQUIRE([RTEMS_TOP])
450if test "$TARGET_SUBDIR" = "." ; then
451PROJECT_ROOT=$RTEMS_TOPdir/'$(top_builddir)';
452else
453PROJECT_ROOT=../$RTEMS_TOPdir/'$(top_builddir)'
454fi
455AC_SUBST(PROJECT_ROOT)
456
457RTEMS_ROOT=$RTEMS_TOPdir/'$(top_builddir)'/c/$RTEMS_BSP
458AC_SUBST(RTEMS_ROOT)
459
460INSTALL_CHANGE="\$(KSH) \$(PROJECT_ROOT)/tools/build/install-if-change"
461AC_SUBST(INSTALL_CHANGE)
462
463PACKHEX="\$(PROJECT_ROOT)/tools/build/packhex"
464AC_SUBST(PACKHEX)
465])
466
467
468dnl
469dnl $Id$
470dnl
471dnl Check for target gcc
472dnl
473dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
474dnl                             Completely reworked
475
476AC_DEFUN(RTEMS_PROG_CC,
477[
478AC_BEFORE([$0], [AC_PROG_CPP])dnl
479AC_BEFORE([$0], [AC_PROG_CC])dnl
480AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
481
482dnl Only accept gcc and cc
483dnl NOTE: This might be too restrictive for native compilation
484AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
485test -z "$CC_FOR_TARGET" \
486  && AC_MSG_ERROR([no acceptable cc found in \$PATH])
487
488dnl backup
489rtems_save_CC=$CC
490rtems_save_CFLAGS=$CFLAGS
491
492dnl temporarily set CC
493CC=$CC_FOR_TARGET
494
495AC_PROG_CC_WORKS
496AC_PROG_CC_GNU
497
498if test $ac_cv_prog_gcc = yes; then
499  GCC=yes
500dnl Check whether -g works, even if CFLAGS is set, in case the package
501dnl plays around with CFLAGS (such as to build both debugging and
502dnl normal versions of a library), tasteless as that idea is.
503  ac_test_CFLAGS="${CFLAGS+set}"
504  ac_save_CFLAGS="$CFLAGS"
505  CFLAGS=
506  AC_PROG_CC_G
507  if test "$ac_test_CFLAGS" = set; then
508    CFLAGS="$ac_save_CFLAGS"
509  elif test $ac_cv_prog_cc_g = yes; then
510    CFLAGS="-g -O2"
511  else
512    CFLAGS="-O2"
513  fi
514else
515  GCC=
516  test "${CFLAGS+set}" = set || CFLAGS="-g"
517fi
518
519rtems_cv_prog_gcc=$ac_cv_prog_gcc
520rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
521rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
522rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
523
524dnl restore initial values
525CC=$rtems_save_CC
526CFLAGS=$rtems_save_CFLAGS
527
528unset ac_cv_prog_gcc
529unset ac_cv_prog_cc_g
530unset ac_cv_prog_cc_works
531unset ac_cv_prog_cc_cross
532])
533
534AC_DEFUN(RTEMS_PROG_CC_FOR_TARGET,
535[
536dnl check target cc
537RTEMS_PROG_CC
538dnl check if the compiler supports --specs
539RTEMS_GCC_SPECS
540dnl check if the target compiler may use --pipe
541RTEMS_GCC_PIPE
542dnl check if the compiler supports --specs if gcc28 is requested
543if test "$RTEMS_USE_GCC272" != "yes" ; then
544  if test "$rtems_cv_gcc_specs" = "no"; then
545    AC_MSG_WARN([*** disabling --enable-gcc28])
546      RTEMS_USE_GCC272=yes
547  fi
548fi
549test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe"
550
551dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-*
552case $host_os in
553*cygwin*)     GCCSED="| sed 's%\\\\%/%g'" ;;
554*) ;;
555esac
556AC_SUBST(GCCSED)
557])
558
559dnl
560dnl  $Id$
561dnl
562dnl Set program_prefix
563dnl
564dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
565dnl                             Extracted from configure
566
567AC_DEFUN(RTEMS_TOOL_PREFIX,
568[AC_REQUIRE([AC_CANONICAL_TARGET])dnl
569AC_REQUIRE([AC_CANONICAL_BUILD])dnl
570
571changequote(,)dnl
572if [ "${program_prefix}" = "NONE" ] ; then
573  if [ "${target}" = "${host}" ] ; then
574    program_prefix=
575  else
576    program_prefix=${target}-
577  fi
578fi
579changequote([,])dnl
580])
581
582dnl
583dnl $Id$
584dnl
585dnl Check whether the target compiler accepts -specs
586dnl
587dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
588dnl
589
590AC_DEFUN(RTEMS_GCC_SPECS,
591[AC_REQUIRE([RTEMS_PROG_CC])
592AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
593[
594rtems_cv_gcc_specs=no
595if test "$rtems_cv_prog_gcc" = "yes"; then
596  touch confspec
597  echo 'void f(){}' >conftest.c
598  if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
599    rtems_cv_gcc_specs=yes
600  fi
601fi
602rm -f confspec conftest*
603])])
604
605dnl
606dnl $Id$
607dnl
608dnl Check whether the target compiler accepts -pipe
609dnl
610dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
611dnl
612
613AC_DEFUN(RTEMS_GCC_PIPE,
614[AC_REQUIRE([RTEMS_PROG_CC])
615AC_REQUIRE([AC_CANONICAL_HOST])
616AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
617[
618rtems_cv_gcc_pipe=no
619if test "$rtems_cv_prog_gcc" = "yes"; then
620case "$host_os" in
621  cygwin*)
622    ;;
623  *)
624    echo 'void f(){}' >conftest.c
625    if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
626      rtems_cv_gcc_pipe=yes
627    fi
628    rm -f conftest*
629    ;;
630esac
631fi
632])
633])
634
635dnl
636dnl $Id$
637dnl
638dnl Check for target g++
639dnl
640dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
641dnl                             Completely reworked
642
643AC_DEFUN(RTEMS_PROG_CXX,
644[
645AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
646AC_BEFORE([$0], [AC_PROG_CXX])dnl
647AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
648
649dnl Only accept g++ and c++
650dnl NOTE: This might be too restrictive for native compilation
651AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++)
652test -z "$CXX_FOR_TARGET" \
653  && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
654
655dnl backup
656rtems_save_CXX=$CXX
657rtems_save_CXXFLAGS=$CXXFLAGS
658
659dnl temporarily set CXX
660CXX=$CXX_FOR_TARGET
661
662AC_PROG_CXX_WORKS
663AC_PROG_CXX_GNU
664
665if test $ac_cv_prog_gxx = yes; then
666  GXX=yes
667dnl Check whether -g works, even if CXXFLAGS is set, in case the package
668dnl plays around with CXXFLAGS (such as to build both debugging and
669dnl normal versions of a library), tasteless as that idea is.
670  ac_test_CXXFLAGS="${CXXFLAGS+set}"
671  ac_save_CXXFLAGS="$CXXFLAGS"
672  CXXFLAGS=
673  AC_PROG_CXX_G
674  if test "$ac_test_CXXFLAGS" = set; then
675    CXXFLAGS="$ac_save_CXXFLAGS"
676  elif test $ac_cv_prog_cxx_g = yes; then
677    CXXFLAGS="-g -O2"
678  else
679    CXXFLAGS="-O2"
680  fi
681else
682  GXX=
683  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
684fi
685
686rtems_cv_prog_gxx=$ac_cv_prog_gxx
687rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g
688rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works
689rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross
690
691CXX=$rtems_save_CXX
692CXXFLAGS=$rtems_save_CXXFLAGS
693
694dnl restore initial values
695unset ac_cv_prog_gxx
696unset ac_cv_prog_cc_g
697unset ac_cv_prog_cxx_works
698unset ac_cv_prog_cxx_cross
699])
700
701AC_DEFUN(RTEMS_PROG_CXX_FOR_TARGET,
702[
703  RTEMS_PROG_CXX
704  if test "$rtems_cv_prog_cc_cross" != "$rtems_cv_prog_cxx_cross"; then
705    AC_MSG_ERROR([***]
706     [Inconsistency in compiler configuration:]
707     [Target C compiler and Target C++ compiler]
708     [must both either be cross compilers or native compilers]
709     [Hint: If building a posix bsp: LD_LIBRARY_PATH?] )
710  fi
711])
712
713dnl
714dnl $Id$
715dnl
716dnl Set target tools
717dnl
718dnl 98/06/23 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
719dnl             fixing cache/environment variable handling
720dnl             adding checks for cygwin/egcs '\\'-bug
721dnl             adding checks for ranlib/ar -s problem
722dnl
723dnl 98/02/12 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
724dnl
725
726AC_DEFUN(RTEMS_GCC_PRINT,
727[ case $host_os in
728  *cygwin*)
729    dnl FIXME: Hack for cygwin/egcs reporting mixed '\\' and '/'
730    dnl        Should be removed once cygwin/egcs reports '/' only
731    $1=`$CC_FOR_TARGET --print-prog-name=$2 | sed -e 's%\\\\%/%g' `
732    ;;
733  *)
734    $1=`$CC_FOR_TARGET --print-prog-name=$2`
735    ;;
736  esac
737])
738
739AC_DEFUN(RTEMS_PATH_TOOL,
740[
741AC_MSG_CHECKING([target's $2])
742AC_CACHE_VAL(ac_cv_path_$1,:)
743AC_MSG_RESULT([$ac_cv_path_$1])
744
745if test -n "$ac_cv_path_$1"; then
746  dnl retrieve the value from the cache
747  $1=$ac_cv_path_$1
748else
749  dnl the cache was not set
750  if test -z "[$]$1" ; then
751    if test "$rtems_cv_prog_gcc" = "yes"; then
752      # We are using gcc, ask it about its tool
753      # NOTE: Necessary if gcc was configured to use the target's
754      # native tools or uses prefixes for gnutools (e.g. gas instead of as)
755      RTEMS_GCC_PRINT($1,$2)
756    fi
757  else
758    # The user set an environment variable.
759    # Check whether it is an absolute path, otherwise AC_PATH_PROG
760    # will override the environment variable, which isn't what the user
761    # intends
762    AC_MSG_CHECKING([whether environment variable $1 is an absolute path])
763    case "[$]$1" in
764    /*) # valid
765      AC_MSG_RESULT("yes")
766    ;;
767    *)  # invalid for AC_PATH_PROG
768      AC_MSG_RESULT("no")
769      AC_MSG_ERROR([***]
770        [Environment variable $1 should either]
771        [be unset (preferred) or contain an absolute path])
772    ;;
773    esac
774  fi
775
776  AC_PATH_PROG($1,"$program_prefix"$2,$3)
777fi
778])
779
780AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
781[AC_REQUIRE([RTEMS_PROG_CC])dnl
782
783dnl FIXME: What shall be done if these tools are not available?
784  RTEMS_PATH_TOOL(AR_FOR_TARGET,ar,no)
785  RTEMS_PATH_TOOL(AS_FOR_TARGET,as,no)
786  RTEMS_PATH_TOOL(LD_FOR_TARGET,ld,no)
787  RTEMS_PATH_TOOL(NM_FOR_TARGET,nm,no)
788
789dnl special treatment of ranlib
790  RTEMS_PATH_TOOL(RANLIB_FOR_TARGET,ranlib,no)
791  if test "$RANLIB_FOR_TARGET" = "no"; then
792    # ranlib wasn't found; check if ar -s is available
793    RTEMS_AR_FOR_TARGET_S
794    if test $rtems_cv_AR_FOR_TARGET_S = "yes" ; then
795      dnl override RANLIB_FOR_TARGET's cache
796      ac_cv_path_RANLIB_FOR_TARGET="$AR_FOR_TARGET -s"
797      RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET
798    else
799      AC_MSG_ERROR([***]
800        [Can't figure out how to build a library index]
801        [Neither ranlib nor ar -s seem to be available] )
802    fi
803  fi
804
805dnl NOTE: These may not be available if not using gnutools
806  RTEMS_PATH_TOOL(OBJCOPY_FOR_TARGET,objcopy,no)
807  RTEMS_PATH_TOOL(SIZE_FOR_TARGET,size,no)
808  RTEMS_PATH_TOOL(STRIP_FOR_TARGET,strip,no)
809])
810
811dnl
812dnl $Id$
813dnl
814
815AC_DEFUN(RTEMS_AR_FOR_TARGET_S,
816[
817AC_CACHE_CHECK(whether $AR_FOR_TARGET -s works,
818rtems_cv_AR_FOR_TARGET_S,
819[
820cat > conftest.$ac_ext <<EOF
821int foo( int b )
822{ return b; }
823EOF
824if AC_TRY_COMMAND($CC_FOR_TARGET -o conftest.o -c conftest.$ac_ext) \
825  && AC_TRY_COMMAND($AR_FOR_TARGET -sr conftest.a conftest.o) \
826  && test -s conftest.a ; \
827then
828  rtems_cv_AR_FOR_TARGET_S="yes"
829else
830  rtems_cv_AR_FOR_TARGET_S="no"
831fi
832  rm -f conftest*
833])
834])
835
836
837dnl $Id$
838
839dnl Report all available bsps for a target,
840dnl check if a bsp-subdirectory is present for all bsps found
841dnl
842dnl RTEMS_CHECK_BSPS(bsp_list)
843AC_DEFUN(RTEMS_CHECK_BSPS,
844[
845AC_REQUIRE([RTEMS_CHECK_CPU])dnl sets RTEMS_CPU, target
846AC_REQUIRE([RTEMS_TOP])dnl sets RTEMS_TOPdir
847AC_MSG_CHECKING([for bsps])
848case "${target}" in
849changequote(,)dnl
850  i[3456]86-go32-rtems*)
851changequote([,])dnl
852    $1="go32 go32_p5"
853    ;;
854  *)
855    files=`ls $srcdir/$RTEMS_TOPdir/c/src/lib/libbsp/$RTEMS_CPU`
856    for file in $files; do
857      case $file in
858        shared*);;
859        Makefile*);;
860        READ*);;
861        CVS*);;
862        pxfl*);;
863        go32*);;       # so the i386 port can pick up the other Makefiles
864        # Now account for BSPs with build variants
865        gen68360)      rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
866        p4000)         rtems_bsp="$rtems_bsp p4600 p4650";;
867        mvme162)       rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
868        *) $1="[$]$1 $file";;
869      esac;
870    done
871    ;;
872esac
873AC_MSG_RESULT([[$]$1 .. done])
874])dnl
875
876AC_DEFUN(RTEMS_CHECK_CUSTOM_BSP,
877[dnl
878AC_MSG_CHECKING([for make/custom/[$]$1.cfg])
879if test -r "$srcdir/$RTEMS_TOPdir/make/custom/[$]$1.cfg"; then
880  AC_MSG_RESULT([yes])
881else
882  AC_MSG_ERROR([no])
883fi
884])dnl
885
886dnl
887dnl $Id$
888dnl
889
890AC_DEFUN(RTEMS_CHECK_MULTIPROCESSING,
891[dnl
892AC_REQUIRE([RTEMS_TOP])dnl
893AC_REQUIRE([RTEMS_CHECK_CPU])dnl
894AC_CACHE_CHECK([whether BSP supports multiprocessing],
895  rtems_cv_HAS_MP,
896  [dnl
897    if test -d "$srcdir/${RTEMS_TOPdir}/c/src/lib/libbsp/${RTEMS_CPU}/${$1}/shmsupp"; then
898      if test "$RTEMS_HAS_MULTIPROCESSING" = "yes"; then
899        rtems_cv_HAS_MP="yes" ;
900      else
901        rtems_cv_HAS_MP="disabled";
902      fi
903    else
904      rtems_cv_HAS_MP="no";
905    fi])
906if test "$rtems_cv_HAS_MP" = "yes"; then
907HAS_MP="yes"
908else
909HAS_MP="no"
910fi
911AC_SUBST(HAS_MP)
912])
913
914dnl $Id$
915dnl
916AC_DEFUN(RTEMS_CHECK_POSIX_API,
917[dnl
918AC_REQUIRE([RTEMS_CHECK_CPU])dnl
919AC_CACHE_CHECK([whether BSP supports libposix],
920  rtems_cv_HAS_POSIX_API,
921  [dnl
922    case "$RTEMS_CPU" in
923    unix*)
924      rtems_cv_HAS_POSIX_API="no"
925      ;;
926    *)
927      if test "${RTEMS_HAS_POSIX_API}" = "yes"; then
928        rtems_cv_HAS_POSIX_API="yes";
929      else
930        rtems_cv_HAS_POSIX_API="disabled";
931      fi
932      ;;
933    esac])
934if test "$rtems_cv_HAS_POSIX_API" = "yes"; then
935  HAS_POSIX_API="yes";
936else
937  HAS_POSIX_API="no";
938fi
939AC_SUBST(HAS_POSIX_API)dnl
940])
941
Note: See TracBrowser for help on using the repository browser.