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