source: rtems/c/src/librtems++/aclocal.m4 @ 4075af6f

4.104.114.84.95
Last change on this file since 4075af6f was 4075af6f, checked in by Joel Sherrill <joel.sherrill@…>, on 10/05/99 at 13:49:54

Regenerated.

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