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