source: rtems/c/src/lib/start/sh/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: 19.9 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
185# Add --enable-maintainer-mode option to configure.
186# From Jim Meyering
187
188# serial 1
189
190AC_DEFUN(AM_MAINTAINER_MODE,
191[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
192  dnl maintainer-mode is disabled by default
193  AC_ARG_ENABLE(maintainer-mode,
194[  --enable-maintainer-mode enable make rules and dependencies not useful
195                          (and sometimes confusing) to the casual installer],
196      USE_MAINTAINER_MODE=$enableval,
197      USE_MAINTAINER_MODE=no)
198  AC_MSG_RESULT($USE_MAINTAINER_MODE)
199  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
200  MAINT=$MAINTAINER_MODE_TRUE
201  AC_SUBST(MAINT)dnl
202]
203)
204
205# Define a conditional.
206
207AC_DEFUN(AM_CONDITIONAL,
208[AC_SUBST($1_TRUE)
209AC_SUBST($1_FALSE)
210if $2; then
211  $1_TRUE=
212  $1_FALSE='#'
213else
214  $1_TRUE='#'
215  $1_FALSE=
216fi])
217
218dnl $Id$
219
220AC_DEFUN(RTEMS_ENABLE_LIBCDIR,
221[
222AC_ARG_ENABLE(libcdir,
223[  --enable-libcdir=directory           set the directory for the C library],
224[ RTEMS_LIBC_DIR="${enableval}" ; \
225test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )
226AC_SUBST(RTEMS_LIBC_DIR)dnl
227])
228
229AC_DEFUN(RTEMS_ENABLE_BARE,
230[
231AC_ARG_ENABLE(bare-cpu-cflags,
232[  --enable-bare-cpu-cflags             specify a particular cpu cflag]
233[                                       (bare bsp specific)],
234[case "${enableval}" in
235  no) BARE_CPU_CFLAGS="" ;;
236  *)    BARE_CPU_CFLAGS="${enableval}" ;;
237esac],
238[BARE_CPU_CFLAGS=""])
239
240AC_ARG_ENABLE(bare-cpu-model,
241[  --enable-bare-cpu-model              specify a particular cpu model]
242[                                       (bare bsp specific)],
243[case "${enableval}" in
244  no)   BARE_CPU_MODEL="" ;;
245  *)    BARE_CPU_MODEL="${enableval}" ;;
246esac],
247[BARE_CPU_MODEL=""])
248])
249
250
251dnl $Id$
252
253dnl Override the set of BSPs to be built.
254dnl used by the toplevel configure script
255dnl RTEMS_ENABLE_RTEMSBSP(rtems_bsp_list)
256AC_DEFUN(RTEMS_ENABLE_RTEMSBSP,
257[
258AC_BEFORE([$0], [RTEMS_ENV_RTEMSBSP])dnl
259AC_ARG_ENABLE(rtemsbsp,
260[  --enable-rtemsbsp=bsp1 bsp2 ..      BSPs to include in build],
261[case "${enableval}" in
262  yes|no) AC_MSG_ERROR([missing argument to --enable-rtemsbsp=\"bsp1 bsp2\"]);;
263  *) $1=$enableval;;
264esac],[$1=""])
265])
266
267dnl Pass a single BSP via an environment variable
268dnl used by per BSP configure scripts
269AC_DEFUN(RTEMS_ENV_RTEMSBSP,
270[dnl
271AC_BEFORE([$0], [RTEMS_ENABLE_RTEMSBSP])dnl
272AC_BEFORE([$0], [RTEMS_PROJECT_ROOT])dnl
273AC_BEFORE([$0], [RTEMS_CHECK_CUSTOM_BSP])dnl
274AC_BEFORE([$0], [RTEMS_CHECK_MULTIPROCESSING])dnl
275AC_BEFORE([$0], [RTEMS_CHECK_POSIX_API])dnl
276
277AC_MSG_CHECKING([for RTEMS_BSP])
278AC_CACHE_VAL(rtems_cv_RTEMS_BSP,
279[dnl
280  test -n "${RTEMS_BSP}" && rtems_cv_RTEMS_BSP="$RTEMS_BSP";
281])dnl
282if test -z "$rtems_cv_RTEMS_BSP"; then
283  AC_MSG_ERROR([Missing RTEMS_BSP])
284fi
285RTEMS_BSP="$rtems_cv_RTEMS_BSP"
286AC_MSG_RESULT(${RTEMS_BSP})
287AC_SUBST(RTEMS_BSP)
288])
289
290dnl
291dnl $Id$
292dnl
293
294AC_DEFUN(RTEMS_PROJECT_ROOT,
295[dnl
296AC_REQUIRE([RTEMS_TOP])
297if test "$TARGET_SUBDIR" = "." ; then
298PROJECT_ROOT=$RTEMS_TOPdir/'$(top_builddir)';
299else
300PROJECT_ROOT=../$RTEMS_TOPdir/'$(top_builddir)'
301fi
302AC_SUBST(PROJECT_ROOT)
303
304RTEMS_ROOT=$RTEMS_TOPdir/'$(top_builddir)'/c/$RTEMS_BSP
305AC_SUBST(RTEMS_ROOT)
306
307INSTALL_CHANGE="\$(KSH) \$(PROJECT_ROOT)/tools/build/install-if-change"
308AC_SUBST(INSTALL_CHANGE)
309
310PACKHEX="\$(PROJECT_ROOT)/tools/build/packhex"
311AC_SUBST(PACKHEX)
312])
313
314
315dnl $Id$
316
317dnl Report all available bsps for a target,
318dnl check if a bsp-subdirectory is present for all bsps found
319dnl
320dnl RTEMS_CHECK_BSPS(bsp_list)
321AC_DEFUN(RTEMS_CHECK_BSPS,
322[
323AC_REQUIRE([RTEMS_CHECK_CPU])dnl sets RTEMS_CPU, target
324AC_REQUIRE([RTEMS_TOP])dnl sets RTEMS_TOPdir
325AC_MSG_CHECKING([for bsps])
326case "${target}" in
327changequote(,)dnl
328  i[3456]86-go32-rtems*)
329changequote([,])dnl
330    $1="go32 go32_p5"
331    ;;
332  *)
333    files=`ls $srcdir/$RTEMS_TOPdir/c/src/lib/libbsp/$RTEMS_CPU`
334    for file in $files; do
335      case $file in
336        shared*);;
337        Makefile*);;
338        READ*);;
339        CVS*);;
340        pxfl*);;
341        go32*);;       # so the i386 port can pick up the other Makefiles
342        # Now account for BSPs with build variants
343        gen68360)      rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
344        p4000)         rtems_bsp="$rtems_bsp p4600 p4650";;
345        mvme162)       rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
346        *) $1="[$]$1 $file";;
347      esac;
348    done
349    ;;
350esac
351AC_MSG_RESULT([[$]$1 .. done])
352])dnl
353
354AC_DEFUN(RTEMS_CHECK_CUSTOM_BSP,
355[dnl
356AC_REQUIRE([RTEMS_TOP])
357
358AC_MSG_CHECKING([for make/custom/[$]$1.cfg])
359if test -r "$srcdir/$RTEMS_TOPdir/make/custom/[$]$1.cfg"; then
360  AC_MSG_RESULT([yes])
361else
362  AC_MSG_ERROR([no])
363fi
364])dnl
365
366dnl $Id$
367
368dnl check if RTEMS support a cpu
369AC_DEFUN(RTEMS_CHECK_CPU,
370[dnl
371AC_REQUIRE([RTEMS_TOP])
372AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])
373AC_BEFORE([$0], [RTEMS_CHECK_POSIX_API])dnl
374
375# Is this a supported CPU?
376AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
377if test -d "$srcdir/$RTEMS_TOPdir/c/src/exec/score/cpu/$RTEMS_CPU"; then
378  AC_MSG_RESULT(yes)
379else
380  AC_MSG_ERROR(no)
381fi
382])dnl
383
384
385dnl $Id$
386dnl
387AC_DEFUN(RTEMS_CHECK_POSIX_API,
388[dnl
389AC_REQUIRE([RTEMS_CHECK_CPU])dnl
390AC_REQUIRE([RTEMS_ENABLE_POSIX])dnl
391
392AC_CACHE_CHECK([whether BSP supports libposix],
393  rtems_cv_HAS_POSIX_API,
394  [dnl
395    case "$RTEMS_CPU" in
396    unix*)
397      rtems_cv_HAS_POSIX_API="no"
398      ;;
399    *)
400      if test "${RTEMS_HAS_POSIX_API}" = "yes"; then
401        rtems_cv_HAS_POSIX_API="yes";
402      else
403        rtems_cv_HAS_POSIX_API="disabled";
404      fi
405      ;;
406    esac])
407if test "$rtems_cv_HAS_POSIX_API" = "yes"; then
408  HAS_POSIX_API="yes";
409else
410  HAS_POSIX_API="no";
411fi
412AC_SUBST(HAS_POSIX_API)dnl
413])
414
415dnl $Id$
416
417AC_DEFUN(RTEMS_ENABLE_POSIX,
418[
419AC_BEFORE([$0], [RTEMS_CHECK_POSIX_API])dnl
420
421AC_ARG_ENABLE(posix,
422[  --enable-posix                       enable posix interface],
423[case "${enableval}" in
424  yes) RTEMS_HAS_POSIX_API=yes ;;
425  no) RTEMS_HAS_POSIX_API=no ;;
426  *)  AC_MSG_ERROR(bad value ${enableval} for enable-posix option) ;;
427esac],[RTEMS_HAS_POSIX_API=yes])
428AC_SUBST(RTEMS_HAS_POSIX_API)
429
430changequote(,)dnl
431case "${target}" in
432  # hpux unix port should go here
433  i[3456]86-go32-rtems*)
434        RTEMS_HAS_POSIX_API=no
435        ;;
436  i[3456]86-pc-linux*)         # unix "simulator" port
437        RTEMS_HAS_POSIX_API=no
438        ;;
439  i[3456]86-*freebsd2*) # unix "simulator" port
440        RTEMS_HAS_POSIX_API=no
441        ;;
442  no_cpu-*rtems*)
443        RTEMS_HAS_POSIX_API=no
444        ;;
445  sparc-sun-solaris*)             # unix "simulator" port
446        RTEMS_HAS_POSIX_API=no
447        ;;
448  *)
449        ;;
450esac
451changequote([,])dnl
452AC_SUBST(RTEMS_HAS_POSIX_API)
453])
454
455dnl
456dnl $Id$
457dnl
458
459AC_DEFUN(RTEMS_CHECK_MULTIPROCESSING,
460[dnl
461AC_REQUIRE([RTEMS_TOP])dnl
462AC_REQUIRE([RTEMS_CHECK_CPU])dnl
463AC_REQUIRE([RTEMS_ENABLE_MULTIPROCESSING])dnl
464
465AC_CACHE_CHECK([whether BSP supports multiprocessing],
466  rtems_cv_HAS_MP,
467  [dnl
468    if test -d "$srcdir/${RTEMS_TOPdir}/c/src/lib/libbsp/${RTEMS_CPU}/${$1}/shmsupp"; then
469      if test "$RTEMS_HAS_MULTIPROCESSING" = "yes"; then
470        rtems_cv_HAS_MP="yes" ;
471      else
472        rtems_cv_HAS_MP="disabled";
473      fi
474    else
475      rtems_cv_HAS_MP="no";
476    fi])
477if test "$rtems_cv_HAS_MP" = "yes"; then
478HAS_MP="yes"
479else
480HAS_MP="no"
481fi
482AC_SUBST(HAS_MP)
483])
484
485dnl $Id$
486
487AC_DEFUN(RTEMS_ENABLE_MULTIPROCESSING,
488[
489AC_ARG_ENABLE(multiprocessing,
490[  --enable-multiprocessing             enable multiprocessing interface],
491[case "${enableval}" in
492  yes) RTEMS_HAS_MULTIPROCESSING=yes ;;
493  no) RTEMS_HAS_MULTIPROCESSING=no ;;
494  *)  AC_MSG_ERROR(bad value ${enableval} for enable-multiprocessing option) ;;
495esac],[RTEMS_HAS_MULTIPROCESSING=no])
496AC_SUBST(RTEMS_HAS_MULTIPROCESSING)dnl
497])
498
499dnl $Id$
500
501AC_DEFUN(RTEMS_CANONICAL_HOST,
502[dnl
503AC_REQUIRE([AC_CANONICAL_HOST])
504RTEMS_HOST=$host_os
505changequote(,)dnl
506case "${target}" in
507  # hpux unix port should go here
508  i[3456]86-pc-linux*)         # unix "simulator" port
509        RTEMS_HOST=Linux
510        ;;
511  i[3456]86-*freebsd2*) # unix "simulator" port
512        RTEMS_HOST=FreeBSD
513        ;;
514  sparc-sun-solaris*)             # unix "simulator" port
515        RTEMS_HOST=Solaris
516        ;;
517  *)
518        ;;
519esac
520changequote([,])dnl
521AC_SUBST(RTEMS_HOST)
522])dnl
523
524dnl
525dnl $Id$
526dnl
527dnl Check for target gcc
528dnl
529dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
530dnl                             Completely reworked
531
532AC_DEFUN(RTEMS_PROG_CC,
533[
534AC_BEFORE([$0], [AC_PROG_CPP])dnl
535AC_BEFORE([$0], [AC_PROG_CC])dnl
536AC_BEFORE([$0], [RTEMS_CANONICALIZE_TOOLS])dnl
537AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
538
539dnl Only accept gcc and cc
540dnl NOTE: This might be too restrictive for native compilation
541AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
542test -z "$CC_FOR_TARGET" \
543  && AC_MSG_ERROR([no acceptable cc found in \$PATH])
544
545dnl backup
546rtems_save_CC=$CC
547rtems_save_CFLAGS=$CFLAGS
548
549dnl temporarily set CC
550CC=$CC_FOR_TARGET
551
552AC_PROG_CC_WORKS
553AC_PROG_CC_GNU
554
555if test $ac_cv_prog_gcc = yes; then
556  GCC=yes
557dnl Check whether -g works, even if CFLAGS is set, in case the package
558dnl plays around with CFLAGS (such as to build both debugging and
559dnl normal versions of a library), tasteless as that idea is.
560  ac_test_CFLAGS="${CFLAGS+set}"
561  ac_save_CFLAGS="$CFLAGS"
562  CFLAGS=
563  AC_PROG_CC_G
564  if test "$ac_test_CFLAGS" = set; then
565    CFLAGS="$ac_save_CFLAGS"
566  elif test $ac_cv_prog_cc_g = yes; then
567    CFLAGS="-g -O2"
568  else
569    CFLAGS="-O2"
570  fi
571else
572  GCC=
573  test "${CFLAGS+set}" = set || CFLAGS="-g"
574fi
575
576rtems_cv_prog_gcc=$ac_cv_prog_gcc
577rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
578rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
579rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
580
581dnl restore initial values
582CC=$rtems_save_CC
583CFLAGS=$rtems_save_CFLAGS
584
585unset ac_cv_prog_gcc
586unset ac_cv_prog_cc_g
587unset ac_cv_prog_cc_works
588unset ac_cv_prog_cc_cross
589])
590
591AC_DEFUN(RTEMS_PROG_CC_FOR_TARGET,
592[
593dnl check target cc
594RTEMS_PROG_CC
595dnl check if the compiler supports --specs
596RTEMS_GCC_SPECS
597dnl check if the target compiler may use --pipe
598RTEMS_GCC_PIPE
599dnl check if the compiler supports --specs if gcc28 is requested
600if test "$RTEMS_USE_GCC272" != "yes" ; then
601  if test "$rtems_cv_gcc_specs" = "no"; then
602    AC_MSG_WARN([*** disabling --enable-gcc28])
603      RTEMS_USE_GCC272=yes
604  fi
605fi
606test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe"
607
608dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-*
609case $host_os in
610*cygwin*)     GCCSED="| sed 's%\\\\%/%g'" ;;
611*) ;;
612esac
613AC_SUBST(GCCSED)
614])
615
616dnl
617dnl $Id$
618dnl
619dnl Set target tools
620dnl
621dnl 98/06/23 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
622dnl             fixing cache/environment variable handling
623dnl             adding checks for cygwin/egcs '\\'-bug
624dnl             adding checks for ranlib/ar -s problem
625dnl
626dnl 98/02/12 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
627dnl
628
629AC_DEFUN(RTEMS_GCC_PRINT,
630[ case $host_os in
631  *cygwin*)
632    dnl FIXME: Hack for cygwin/egcs reporting mixed '\\' and '/'
633    dnl        Should be removed once cygwin/egcs reports '/' only
634    $1=`$CC_FOR_TARGET --print-prog-name=$2 | sed -e 's%\\\\%/%g' `
635    ;;
636  *)
637    $1=`$CC_FOR_TARGET --print-prog-name=$2`
638    ;;
639  esac
640])
641
642AC_DEFUN(RTEMS_PATH_TOOL,
643[
644AC_MSG_CHECKING([target's $2])
645AC_CACHE_VAL(ac_cv_path_$1,:)
646AC_MSG_RESULT([$ac_cv_path_$1])
647
648if test -n "$ac_cv_path_$1"; then
649  dnl retrieve the value from the cache
650  $1=$ac_cv_path_$1
651else
652  dnl the cache was not set
653  if test -z "[$]$1" ; then
654    if test "$rtems_cv_prog_gcc" = "yes"; then
655      # We are using gcc, ask it about its tool
656      # NOTE: Necessary if gcc was configured to use the target's
657      # native tools or uses prefixes for gnutools (e.g. gas instead of as)
658      RTEMS_GCC_PRINT($1,$2)
659    fi
660  else
661    # The user set an environment variable.
662    # Check whether it is an absolute path, otherwise AC_PATH_PROG
663    # will override the environment variable, which isn't what the user
664    # intends
665    AC_MSG_CHECKING([whether environment variable $1 is an absolute path])
666    case "[$]$1" in
667    /*) # valid
668      AC_MSG_RESULT("yes")
669    ;;
670    *)  # invalid for AC_PATH_PROG
671      AC_MSG_RESULT("no")
672      AC_MSG_ERROR([***]
673        [Environment variable $1 should either]
674        [be unset (preferred) or contain an absolute path])
675    ;;
676    esac
677  fi
678
679  AC_PATH_PROG($1,"$program_prefix"$2,$3)
680fi
681])
682
683AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
684[AC_REQUIRE([RTEMS_PROG_CC])dnl
685
686dnl FIXME: What shall be done if these tools are not available?
687  RTEMS_PATH_TOOL(AR_FOR_TARGET,ar,no)
688  RTEMS_PATH_TOOL(AS_FOR_TARGET,as,no)
689  RTEMS_PATH_TOOL(LD_FOR_TARGET,ld,no)
690  RTEMS_PATH_TOOL(NM_FOR_TARGET,nm,no)
691
692dnl special treatment of ranlib
693  RTEMS_PATH_TOOL(RANLIB_FOR_TARGET,ranlib,no)
694  if test "$RANLIB_FOR_TARGET" = "no"; then
695    # ranlib wasn't found; check if ar -s is available
696    RTEMS_AR_FOR_TARGET_S
697    if test $rtems_cv_AR_FOR_TARGET_S = "yes" ; then
698      dnl override RANLIB_FOR_TARGET's cache
699      ac_cv_path_RANLIB_FOR_TARGET="$AR_FOR_TARGET -s"
700      RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET
701    else
702      AC_MSG_ERROR([***]
703        [Can't figure out how to build a library index]
704        [Neither ranlib nor ar -s seem to be available] )
705    fi
706  fi
707
708dnl NOTE: These may not be available if not using gnutools
709  RTEMS_PATH_TOOL(OBJCOPY_FOR_TARGET,objcopy,no)
710  RTEMS_PATH_TOOL(SIZE_FOR_TARGET,size,no)
711  RTEMS_PATH_TOOL(STRIP_FOR_TARGET,strip,no)
712])
713
714dnl
715dnl $Id$
716dnl
717
718AC_DEFUN(RTEMS_AR_FOR_TARGET_S,
719[
720AC_CACHE_CHECK(whether $AR_FOR_TARGET -s works,
721rtems_cv_AR_FOR_TARGET_S,
722[
723cat > conftest.$ac_ext <<EOF
724int foo( int b )
725{ return b; }
726EOF
727if AC_TRY_COMMAND($CC_FOR_TARGET -o conftest.o -c conftest.$ac_ext) \
728  && AC_TRY_COMMAND($AR_FOR_TARGET -sr conftest.a conftest.o) \
729  && test -s conftest.a ; \
730then
731  rtems_cv_AR_FOR_TARGET_S="yes"
732else
733  rtems_cv_AR_FOR_TARGET_S="no"
734fi
735  rm -f conftest*
736])
737])
738
739
740dnl
741dnl  $Id$
742dnl
743dnl Set program_prefix
744dnl
745dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
746dnl                             Extracted from configure
747
748AC_DEFUN(RTEMS_TOOL_PREFIX,
749[AC_REQUIRE([AC_CANONICAL_TARGET])dnl
750AC_REQUIRE([AC_CANONICAL_BUILD])dnl
751
752changequote(,)dnl
753if [ "${program_prefix}" = "NONE" ] ; then
754  if [ "${target}" = "${host}" ] ; then
755    program_prefix=
756  else
757    program_prefix=${target}-
758  fi
759fi
760changequote([,])dnl
761])
762
763dnl
764dnl $Id$
765dnl
766dnl Check whether the target compiler accepts -specs
767dnl
768
769AC_DEFUN(RTEMS_GCC_SPECS,
770[AC_REQUIRE([RTEMS_PROG_CC])
771AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
772[
773rtems_cv_gcc_specs=no
774if test "$rtems_cv_prog_gcc" = "yes"; then
775  touch confspec
776  echo 'void f(){}' >conftest.c
777  if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
778    rtems_cv_gcc_specs=yes
779  fi
780fi
781rm -f confspec conftest*
782])])
783
784dnl
785dnl $Id$
786dnl
787dnl Check whether the target compiler accepts -pipe
788dnl
789dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
790dnl
791
792AC_DEFUN(RTEMS_GCC_PIPE,
793[AC_REQUIRE([RTEMS_PROG_CC])
794AC_REQUIRE([AC_CANONICAL_HOST])
795AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
796[
797rtems_cv_gcc_pipe=no
798if test "$rtems_cv_prog_gcc" = "yes"; then
799case "$host_os" in
800  cygwin*)
801    ;;
802  *)
803    echo 'void f(){}' >conftest.c
804    if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
805      rtems_cv_gcc_pipe=yes
806    fi
807    rm -f conftest*
808    ;;
809esac
810fi
811])
812])
813
Note: See TracBrowser for help on using the repository browser.