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

4.104.114.84.95
Last change on this file since e1d8abb was e1d8abb, checked in by Joel Sherrill <joel.sherrill@…>, on 09/07/99 at 13:45:03

Applied patch rtems-rc-19990820-6.diff.gz from
Ralf Corsepius <corsepiu@…> which converted many
Makefile.in's to Makefile.am's. This added a lot of files.

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