source: rtems/c/src/librtems++/aclocal.m4 @ 4f021c0

4.104.114.84.95
Last change on this file since 4f021c0 was 473b4e5, checked in by Joel Sherrill <joel.sherrill@…>, on 10/04/99 at 13:30:15

Regenerated.

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