source: rtems/c/src/lib/aclocal.m4 @ e1929ce

4.104.114.84.95
Last change on this file since e1929ce was 3a8915e, checked in by Joel Sherrill <joel.sherrill@…>, on 08/06/99 at 17:55:25

Patch rtems-rc-19990709-6-diff from Ralf Corsepius <corsepiu@…>
applied. This modified many Makefiles and custom files and makes many more
settings (network, multiprocessing, etc) gnerated by autoconf.

  • Property mode set to 100644
File size: 24.7 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
88# Add --enable-maintainer-mode option to configure.
89# From Jim Meyering
90
91# serial 1
92
93AC_DEFUN(AM_MAINTAINER_MODE,
94[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
95  dnl maintainer-mode is disabled by default
96  AC_ARG_ENABLE(maintainer-mode,
97[  --enable-maintainer-mode enable make rules and dependencies not useful
98                          (and sometimes confusing) to the casual installer],
99      USE_MAINTAINER_MODE=$enableval,
100      USE_MAINTAINER_MODE=no)
101  AC_MSG_RESULT($USE_MAINTAINER_MODE)
102  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
103  MAINT=$MAINTAINER_MODE_TRUE
104  AC_SUBST(MAINT)dnl
105]
106)
107
108# Define a conditional.
109
110AC_DEFUN(AM_CONDITIONAL,
111[AC_SUBST($1_TRUE)
112AC_SUBST($1_FALSE)
113if $2; then
114  $1_TRUE=
115  $1_FALSE='#'
116else
117  $1_TRUE='#'
118  $1_FALSE=
119fi])
120
121dnl $Id$
122
123AC_DEFUN(RTEMS_ENABLE_MULTIPROCESSING,
124[
125AC_ARG_ENABLE(multiprocessing,
126[  --enable-multiprocessing             enable multiprocessing interface],
127[case "${enableval}" in
128  yes) RTEMS_HAS_MULTIPROCESSING=yes ;;
129  no) RTEMS_HAS_MULTIPROCESSING=no ;;
130  *)  AC_MSG_ERROR(bad value ${enableval} for enable-multiprocessing option) ;;
131esac],[RTEMS_HAS_MULTIPROCESSING=no])
132AC_SUBST(RTEMS_HAS_MULTIPROCESSING)dnl
133])
134
135dnl $Id$
136
137AC_DEFUN(RTEMS_ENABLE_NETWORKING,
138[
139AC_ARG_ENABLE(networking,
140[  --enable-networking                  enable TCP/IP stack],
141[case "${enableval}" in
142  yes) RTEMS_HAS_NETWORKING=yes ;;
143  no) RTEMS_HAS_NETWORKING=no ;;
144  *)  AC_MSG_ERROR(bad value ${enableval} for enable-networking option) ;;
145esac],[RTEMS_HAS_NETWORKING=yes])
146AC_SUBST(RTEMS_HAS_NETWORKING)dnl
147])
148
149dnl $Id$
150
151AC_DEFUN(RTEMS_ENABLE_RDBG,
152[
153AC_ARG_ENABLE(rdbg,
154[  --enable-rdbg                        enable remote debugger],
155[case "${enableval}" in
156  yes) RTEMS_HAS_RDBG=yes ;;
157  no) RTEMS_HAS_RDBG=no ;;
158  *)  AC_MSG_ERROR(bad value ${enableval} for enable-rdbg option) ;;
159esac],[RTEMS_HAS_RDBG=no])
160AC_SUBST(RTEMS_HAS_RDBG)dnl
161])
162
163dnl $Id$
164
165AC_DEFUN(RTEMS_ENABLE_CXX,
166[
167AC_ARG_ENABLE(cxx,
168[  --enable-cxx                         enable C++ support,]
169[                                       and build the rtems++ library],
170[case "${enableval}" in
171  yes) RTEMS_HAS_CPLUSPLUS=yes ;;
172  no) RTEMS_HAS_CPLUSPLUS=no   ;;
173  *)  AC_MSG_ERROR(bad value ${enableval} for enable-cxx option) ;;
174esac], [RTEMS_HAS_CPLUSPLUS=no])
175])
176
177dnl $Id$
178
179AC_DEFUN(RTEMS_ENABLE_GCC28,
180[
181AC_ARG_ENABLE(gcc28,
182[  --enable-gcc28                       enable use of gcc 2.8.x features],
183[case "${enableval}" in
184  yes) RTEMS_USE_GCC272=no ;;
185  no) RTEMS_USE_GCC272=yes ;;
186  *)  AC_MSG_ERROR(bad value ${enableval} for gcc-28 option) ;;
187esac],[RTEMS_USE_GCC272=no])
188])
189
190dnl $Id$
191
192AC_DEFUN(RTEMS_ENABLE_LIBCDIR,
193[
194AC_ARG_ENABLE(libcdir,
195[  --enable-libcdir=directory           set the directory for the C library],
196[ RTEMS_LIBC_DIR="${enableval}" ; \
197test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )
198AC_SUBST(RTEMS_LIBC_DIR)dnl
199])
200
201AC_DEFUN(RTEMS_ENABLE_BARE,
202[
203AC_ARG_ENABLE(bare-cpu-cflags,
204[  --enable-bare-cpu-cflags             specify a particular cpu cflag]
205[                                       (bare bsp specific)],
206[case "${enableval}" in
207  no) BARE_CPU_CFLAGS="" ;;
208  *)    BARE_CPU_CFLAGS="${enableval}" ;;
209esac],
210[BARE_CPU_CFLAGS=""])
211
212AC_ARG_ENABLE(bare-cpu-model,
213[  --enable-bare-cpu-model              specify a particular cpu model]
214[                                       (bare bsp specific)],
215[case "${enableval}" in
216  no)   BARE_CPU_MODEL="" ;;
217  *)    BARE_CPU_MODEL="${enableval}" ;;
218esac],
219[BARE_CPU_MODEL=""])
220])
221
222
223dnl $Id$
224dnl
225dnl FIXME: this needs to be reworked
226
227AC_DEFUN(RTEMS_ENABLE_HWAPI,
228[dnl
229AC_ARG_ENABLE(hwapi, \
230[  --enable-hwapi                       enable hardware API library],
231[case "${enableval}" in
232    yes) RTEMS_HAS_HWAPI=yes ;;
233    no)  RTEMS_HAS_HWAPI=no ;;
234    *)  AC_MSG_ERROR(bad value ${enableval} for hwapi option) ;;
235  esac],[RTEMS_HAS_HWAPI=no])
236AC_SUBST(RTEMS_HAS_HWAPI)dnl
237])dnl
238
239dnl $Id$
240
241dnl Override the set of BSPs to be built.
242dnl used by the toplevel configure script
243dnl RTEMS_ENABLE_RTEMSBSP(rtems_bsp_list)
244AC_DEFUN(RTEMS_ENABLE_RTEMSBSP,
245[
246AC_ARG_ENABLE(rtemsbsp,
247[  --enable-rtemsbsp=bsp1 bsp2 ..      BSPs to include in build],
248[case "${enableval}" in
249  yes|no) AC_MSG_ERROR([missing argument to --enable-rtemsbsp=\"bsp1 bsp2\"]);;
250  *) $1=$enableval;;
251esac],[$1=""])
252])
253
254dnl Pass a single BSP via an environment variable
255dnl used by per BSP configure scripts
256AC_DEFUN(RTEMS_ENV_RTEMSBSP,
257[dnl
258AC_MSG_CHECKING([for RTEMS_BSP])
259AC_CACHE_VAL(rtems_cv_RTEMS_BSP,
260[dnl
261  test -n "${RTEMS_BSP}" && rtems_cv_RTEMS_BSP="$RTEMS_BSP";
262])dnl
263if test -z "$rtems_cv_RTEMS_BSP"; then
264  AC_MSG_ERROR([Missing RTEMS_BSP])
265fi
266RTEMS_BSP="$rtems_cv_RTEMS_BSP"
267AC_MSG_RESULT(${RTEMS_BSP})
268AC_SUBST(RTEMS_BSP)
269])
270
271dnl $Id$
272
273dnl check if RTEMS support a cpu
274AC_DEFUN(RTEMS_CHECK_CPU,
275[dnl
276AC_REQUIRE([RTEMS_TOP])
277AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])
278# Is this a supported CPU?
279AC_MSG_CHECKING([if cpu $RTEMS_CPU is supported])
280if test -d "$srcdir/$RTEMS_TOPdir/c/src/exec/score/cpu/$RTEMS_CPU"; then
281  AC_MSG_RESULT(yes)
282else
283  AC_MSG_ERROR(no)
284fi
285])dnl
286
287
288dnl $Id$
289
290AC_DEFUN(RTEMS_CANONICAL_HOST,
291[dnl
292AC_REQUIRE([AC_CANONICAL_HOST])
293RTEMS_HOST=$host_os
294changequote(,)dnl
295case "${target}" in
296  # hpux unix port should go here
297  i[3456]86-pc-linux*)         # unix "simulator" port
298        RTEMS_HOST=Linux
299        ;;
300  i[3456]86-*freebsd2*) # unix "simulator" port
301        RTEMS_HOST=FreeBSD
302        ;;
303  sparc-sun-solaris*)             # unix "simulator" port
304        RTEMS_HOST=Solaris
305        ;;
306  *)
307        ;;
308esac
309changequote([,])dnl
310AC_SUBST(RTEMS_HOST)
311])dnl
312
313dnl
314dnl $Id$
315dnl
316
317AC_DEFUN(RTEMS_PROJECT_ROOT,
318[dnl
319AC_REQUIRE([RTEMS_TOP])
320if test "$TARGET_SUBDIR" = "." ; then
321PROJECT_ROOT=$RTEMS_TOPdir/'$(top_builddir)';
322else
323PROJECT_ROOT=../$RTEMS_TOPdir/'$(top_builddir)'
324fi
325AC_SUBST(PROJECT_ROOT)
326
327RTEMS_ROOT=$RTEMS_TOPdir/'$(top_builddir)'/c/$RTEMS_BSP
328AC_SUBST(RTEMS_ROOT)
329
330INSTALL_CHANGE="\$(KSH) \$(PROJECT_ROOT)/tools/build/install-if-change"
331AC_SUBST(INSTALL_CHANGE)
332
333PACKHEX="\$(PROJECT_ROOT)/tools/build/packhex"
334AC_SUBST(PACKHEX)
335])
336
337
338dnl
339dnl $Id$
340dnl
341dnl Check for target gcc
342dnl
343dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
344dnl                             Completely reworked
345
346AC_DEFUN(RTEMS_PROG_CC,
347[
348AC_BEFORE([$0], [AC_PROG_CPP])dnl
349AC_BEFORE([$0], [AC_PROG_CC])dnl
350AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
351
352dnl Only accept gcc and cc
353dnl NOTE: This might be too restrictive for native compilation
354AC_PATH_PROGS(CC_FOR_TARGET, "$program_prefix"gcc "$program_prefix"cc )
355test -z "$CC_FOR_TARGET" \
356  && AC_MSG_ERROR([no acceptable cc found in \$PATH])
357
358dnl backup
359rtems_save_CC=$CC
360rtems_save_CFLAGS=$CFLAGS
361
362dnl temporarily set CC
363CC=$CC_FOR_TARGET
364
365AC_PROG_CC_WORKS
366AC_PROG_CC_GNU
367
368if test $ac_cv_prog_gcc = yes; then
369  GCC=yes
370dnl Check whether -g works, even if CFLAGS is set, in case the package
371dnl plays around with CFLAGS (such as to build both debugging and
372dnl normal versions of a library), tasteless as that idea is.
373  ac_test_CFLAGS="${CFLAGS+set}"
374  ac_save_CFLAGS="$CFLAGS"
375  CFLAGS=
376  AC_PROG_CC_G
377  if test "$ac_test_CFLAGS" = set; then
378    CFLAGS="$ac_save_CFLAGS"
379  elif test $ac_cv_prog_cc_g = yes; then
380    CFLAGS="-g -O2"
381  else
382    CFLAGS="-O2"
383  fi
384else
385  GCC=
386  test "${CFLAGS+set}" = set || CFLAGS="-g"
387fi
388
389rtems_cv_prog_gcc=$ac_cv_prog_gcc
390rtems_cv_prog_cc_g=$ac_cv_prog_cc_g
391rtems_cv_prog_cc_works=$ac_cv_prog_cc_works
392rtems_cv_prog_cc_cross=$ac_cv_prog_cc_cross
393
394dnl restore initial values
395CC=$rtems_save_CC
396CFLAGS=$rtems_save_CFLAGS
397
398unset ac_cv_prog_gcc
399unset ac_cv_prog_cc_g
400unset ac_cv_prog_cc_works
401unset ac_cv_prog_cc_cross
402])
403
404AC_DEFUN(RTEMS_PROG_CC_FOR_TARGET,
405[
406dnl check target cc
407RTEMS_PROG_CC
408dnl check if the compiler supports --specs
409RTEMS_GCC_SPECS
410dnl check if the target compiler may use --pipe
411RTEMS_GCC_PIPE
412dnl check if the compiler supports --specs if gcc28 is requested
413if test "$RTEMS_USE_GCC272" != "yes" ; then
414  if test "$rtems_cv_gcc_specs" = "no"; then
415    AC_MSG_WARN([*** disabling --enable-gcc28])
416      RTEMS_USE_GCC272=yes
417  fi
418fi
419test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe"
420
421dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-*
422case $host_os in
423*cygwin*)     GCCSED="| sed 's%\\\\%/%g'" ;;
424*) ;;
425esac
426AC_SUBST(GCCSED)
427])
428
429dnl
430dnl  $Id$
431dnl
432dnl Set program_prefix
433dnl
434dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
435dnl                             Extracted from configure
436
437AC_DEFUN(RTEMS_TOOL_PREFIX,
438[AC_REQUIRE([AC_CANONICAL_TARGET])dnl
439AC_REQUIRE([AC_CANONICAL_BUILD])dnl
440
441changequote(,)dnl
442if [ "${program_prefix}" = "NONE" ] ; then
443  if [ "${target}" = "${host}" ] ; then
444    program_prefix=
445  else
446    program_prefix=${target}-
447  fi
448fi
449changequote([,])dnl
450])
451
452dnl
453dnl $Id$
454dnl
455dnl Check whether the target compiler accepts -specs
456dnl
457dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
458dnl
459
460AC_DEFUN(RTEMS_GCC_SPECS,
461[AC_REQUIRE([RTEMS_PROG_CC])
462AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts -specs,rtems_cv_gcc_specs,
463[
464rtems_cv_gcc_specs=no
465if test "$rtems_cv_prog_gcc" = "yes"; then
466  touch confspec
467  echo 'void f(){}' >conftest.c
468  if test -z "`${CC_FOR_TARGET} -specs confspec -c conftest.c 2>&1`";then
469    rtems_cv_gcc_specs=yes
470  fi
471fi
472rm -f confspec conftest*
473])])
474
475dnl
476dnl $Id$
477dnl
478dnl Check whether the target compiler accepts -pipe
479dnl
480dnl 98/02/11 Ralf Corsepius     corsepiu@faw.uni-ulm.de
481dnl
482
483AC_DEFUN(RTEMS_GCC_PIPE,
484[AC_REQUIRE([RTEMS_PROG_CC])
485AC_REQUIRE([AC_CANONICAL_HOST])
486AC_CACHE_CHECK(whether $CC_FOR_TARGET accepts --pipe,rtems_cv_gcc_pipe,
487[
488rtems_cv_gcc_pipe=no
489if test "$rtems_cv_prog_gcc" = "yes"; then
490case "$host_os" in
491  cygwin*)
492    ;;
493  *)
494    echo 'void f(){}' >conftest.c
495    if test -z "`${CC_FOR_TARGET} --pipe -c conftest.c 2>&1`";then
496      rtems_cv_gcc_pipe=yes
497    fi
498    rm -f conftest*
499    ;;
500esac
501fi
502])
503])
504
505dnl
506dnl $Id$
507dnl
508dnl Check for target g++
509dnl
510dnl 98/05/20 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
511dnl                             Completely reworked
512
513AC_DEFUN(RTEMS_PROG_CXX,
514[
515AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
516AC_BEFORE([$0], [AC_PROG_CXX])dnl
517AC_REQUIRE([RTEMS_TOOL_PREFIX])dnl
518
519dnl Only accept g++ and c++
520dnl NOTE: This might be too restrictive for native compilation
521AC_PATH_PROGS(CXX_FOR_TARGET, "$program_prefix"g++ "$program_prefix"c++)
522test -z "$CXX_FOR_TARGET" \
523  && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
524
525dnl backup
526rtems_save_CXX=$CXX
527rtems_save_CXXFLAGS=$CXXFLAGS
528
529dnl temporarily set CXX
530CXX=$CXX_FOR_TARGET
531
532AC_PROG_CXX_WORKS
533AC_PROG_CXX_GNU
534
535if test $ac_cv_prog_gxx = yes; then
536  GXX=yes
537dnl Check whether -g works, even if CXXFLAGS is set, in case the package
538dnl plays around with CXXFLAGS (such as to build both debugging and
539dnl normal versions of a library), tasteless as that idea is.
540  ac_test_CXXFLAGS="${CXXFLAGS+set}"
541  ac_save_CXXFLAGS="$CXXFLAGS"
542  CXXFLAGS=
543  AC_PROG_CXX_G
544  if test "$ac_test_CXXFLAGS" = set; then
545    CXXFLAGS="$ac_save_CXXFLAGS"
546  elif test $ac_cv_prog_cxx_g = yes; then
547    CXXFLAGS="-g -O2"
548  else
549    CXXFLAGS="-O2"
550  fi
551else
552  GXX=
553  test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
554fi
555
556rtems_cv_prog_gxx=$ac_cv_prog_gxx
557rtems_cv_prog_cxx_g=$ac_cv_prog_cxx_g
558rtems_cv_prog_cxx_works=$ac_cv_prog_cxx_works
559rtems_cv_prog_cxx_cross=$ac_cv_prog_cxx_cross
560
561CXX=$rtems_save_CXX
562CXXFLAGS=$rtems_save_CXXFLAGS
563
564dnl restore initial values
565unset ac_cv_prog_gxx
566unset ac_cv_prog_cc_g
567unset ac_cv_prog_cxx_works
568unset ac_cv_prog_cxx_cross
569])
570
571AC_DEFUN(RTEMS_PROG_CXX_FOR_TARGET,
572[
573  RTEMS_PROG_CXX
574  if test "$rtems_cv_prog_cc_cross" != "$rtems_cv_prog_cxx_cross"; then
575    AC_MSG_ERROR([***]
576     [Inconsistency in compiler configuration:]
577     [Target C compiler and Target C++ compiler]
578     [must both either be cross compilers or native compilers]
579     [Hint: If building a posix bsp: LD_LIBRARY_PATH?] )
580  fi
581])
582
583dnl
584dnl $Id$
585dnl
586dnl Set target tools
587dnl
588dnl 98/06/23 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
589dnl             fixing cache/environment variable handling
590dnl             adding checks for cygwin/egcs '\\'-bug
591dnl             adding checks for ranlib/ar -s problem
592dnl
593dnl 98/02/12 Ralf Corsepius     (corsepiu@faw.uni-ulm.de)
594dnl
595
596AC_DEFUN(RTEMS_GCC_PRINT,
597[ case $host_os in
598  *cygwin*)
599    dnl FIXME: Hack for cygwin/egcs reporting mixed '\\' and '/'
600    dnl        Should be removed once cygwin/egcs reports '/' only
601    $1=`$CC_FOR_TARGET --print-prog-name=$2 | sed -e 's%\\\\%/%g' `
602    ;;
603  *)
604    $1=`$CC_FOR_TARGET --print-prog-name=$2`
605    ;;
606  esac
607])
608
609AC_DEFUN(RTEMS_PATH_TOOL,
610[
611AC_MSG_CHECKING([target's $2])
612AC_CACHE_VAL(ac_cv_path_$1,:)
613AC_MSG_RESULT([$ac_cv_path_$1])
614
615if test -n "$ac_cv_path_$1"; then
616  dnl retrieve the value from the cache
617  $1=$ac_cv_path_$1
618else
619  dnl the cache was not set
620  if test -z "[$]$1" ; then
621    if test "$rtems_cv_prog_gcc" = "yes"; then
622      # We are using gcc, ask it about its tool
623      # NOTE: Necessary if gcc was configured to use the target's
624      # native tools or uses prefixes for gnutools (e.g. gas instead of as)
625      RTEMS_GCC_PRINT($1,$2)
626    fi
627  else
628    # The user set an environment variable.
629    # Check whether it is an absolute path, otherwise AC_PATH_PROG
630    # will override the environment variable, which isn't what the user
631    # intends
632    AC_MSG_CHECKING([whether environment variable $1 is an absolute path])
633    case "[$]$1" in
634    /*) # valid
635      AC_MSG_RESULT("yes")
636    ;;
637    *)  # invalid for AC_PATH_PROG
638      AC_MSG_RESULT("no")
639      AC_MSG_ERROR([***]
640        [Environment variable $1 should either]
641        [be unset (preferred) or contain an absolute path])
642    ;;
643    esac
644  fi
645
646  AC_PATH_PROG($1,"$program_prefix"$2,$3)
647fi
648])
649
650AC_DEFUN(RTEMS_CANONICALIZE_TOOLS,
651[AC_REQUIRE([RTEMS_PROG_CC])dnl
652
653dnl FIXME: What shall be done if these tools are not available?
654  RTEMS_PATH_TOOL(AR_FOR_TARGET,ar,no)
655  RTEMS_PATH_TOOL(AS_FOR_TARGET,as,no)
656  RTEMS_PATH_TOOL(LD_FOR_TARGET,ld,no)
657  RTEMS_PATH_TOOL(NM_FOR_TARGET,nm,no)
658
659dnl special treatment of ranlib
660  RTEMS_PATH_TOOL(RANLIB_FOR_TARGET,ranlib,no)
661  if test "$RANLIB_FOR_TARGET" = "no"; then
662    # ranlib wasn't found; check if ar -s is available
663    RTEMS_AR_FOR_TARGET_S
664    if test $rtems_cv_AR_FOR_TARGET_S = "yes" ; then
665      dnl override RANLIB_FOR_TARGET's cache
666      ac_cv_path_RANLIB_FOR_TARGET="$AR_FOR_TARGET -s"
667      RANLIB_FOR_TARGET=$ac_cv_path_RANLIB_FOR_TARGET
668    else
669      AC_MSG_ERROR([***]
670        [Can't figure out how to build a library index]
671        [Neither ranlib nor ar -s seem to be available] )
672    fi
673  fi
674
675dnl NOTE: These may not be available if not using gnutools
676  RTEMS_PATH_TOOL(OBJCOPY_FOR_TARGET,objcopy,no)
677  RTEMS_PATH_TOOL(SIZE_FOR_TARGET,size,no)
678  RTEMS_PATH_TOOL(STRIP_FOR_TARGET,strip,no)
679])
680
681dnl
682dnl $Id$
683dnl
684
685AC_DEFUN(RTEMS_AR_FOR_TARGET_S,
686[
687AC_CACHE_CHECK(whether $AR_FOR_TARGET -s works,
688rtems_cv_AR_FOR_TARGET_S,
689[
690cat > conftest.$ac_ext <<EOF
691int foo( int b )
692{ return b; }
693EOF
694if AC_TRY_COMMAND($CC_FOR_TARGET -o conftest.o -c conftest.$ac_ext) \
695  && AC_TRY_COMMAND($AR_FOR_TARGET -sr conftest.a conftest.o) \
696  && test -s conftest.a ; \
697then
698  rtems_cv_AR_FOR_TARGET_S="yes"
699else
700  rtems_cv_AR_FOR_TARGET_S="no"
701fi
702  rm -f conftest*
703])
704])
705
706
707dnl
708dnl  $Id$
709dnl
710
711dnl check for i386 gas supporting 16 bit mode
712dnl     - binutils 2.9.1.0.7 and higher
713
714AC_DEFUN(RTEMS_I386_GAS_CODE16,
715[ if test "${target_cpu}" = "i386"; then
716    AC_CACHE_CHECK([for 16 bit mode assembler support],
717      rtems_cv_prog_gas_code16,
718      [cat > conftest.s << EOF
719         .code16
720         data32
721         addr32
722         lgdt 0
723EOF
724      if AC_TRY_COMMAND($AS_FOR_TARGET -o conftest.o conftest.s); then
725        rtems_cv_prog_gas_code16=yes
726      else
727        rtems_cv_prog_gas_code16=no
728      fi])
729    RTEMS_GAS_CODE16="$rtems_cv_prog_gas_code16"
730  fi
731  AC_SUBST(RTEMS_GAS_CODE16)
732])
733
734
735dnl
736dnl $Id$
737dnl
738dnl Check for System V IPC calls used by Unix simulators
739dnl
740dnl 98/07/17 Dario Alcocer     alcocer@netcom.com
741dnl          Ralf Corsepius    corsepiu@faw.uni-ulm.de
742dnl
743dnl Note: $host_os should probably *not* ever be used here to
744dnl determine if host supports System V IPC calls, since some
745dnl (e.g. FreeBSD 2.x) are configured by default to include only
746dnl a subset of the System V IPC calls.  Therefore, to make sure
747dnl all of the required calls are found, test for each call explicitly.
748dnl
749dnl All of the calls use IPC_PRIVATE, so tests will not unintentionally
750dnl modify any existing key sets.  See the man pages for semget, shmget,
751dnl msgget, semctl, shmctl and msgctl for details.
752
753AC_DEFUN(RTEMS_SYSV_SEM,
754[AC_REQUIRE([AC_PROG_CC])
755AC_REQUIRE([RTEMS_CANONICAL_HOST])
756AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores,
757rtems_cv_sysv_sem,
758[
759AC_TRY_RUN([
760#include <sys/types.h>
761#include <sys/ipc.h>
762#include <sys/sem.h>
763int main () {
764#if !defined(sun)
765  union semun arg ;
766#else
767  union semun {
768    int val;
769    struct semid_ds *buf;
770    ushort *array;
771  } arg;
772#endif
773  int id=semget(IPC_PRIVATE,1,IPC_CREAT|0400);
774  if (id == -1)
775    exit(1);
776  arg.val = 0; /* avoid implicit type cast to union */
777  if (semctl(id, 0, IPC_RMID, arg) == -1)
778    exit(1);
779  exit(0);
780}
781],
782rtems_cv_sysv_sem="yes", rtems_cv_sysv_sem="no", :)
783])
784])
785
786AC_DEFUN(RTEMS_SYSV_SHM,
787[AC_REQUIRE([AC_PROG_CC])
788AC_REQUIRE([RTEMS_CANONICAL_HOST])
789AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory,
790rtems_cv_sysv_shm,
791[
792AC_TRY_RUN([
793#include <sys/types.h>
794#include <sys/ipc.h>
795#include <sys/shm.h>
796int main () {
797  int id=shmget(IPC_PRIVATE,1,IPC_CREAT|0400);
798  if (id == -1)
799    exit(1);
800  if (shmctl(id, IPC_RMID, 0) == -1)
801    exit(1);
802  exit(0);
803}
804],
805rtems_cv_sysv_shm="yes", rtems_cv_sysv_shm="no", :)
806])
807])
808
809AC_DEFUN(RTEMS_SYSV_MSG,
810[AC_REQUIRE([AC_PROG_CC])
811AC_REQUIRE([RTEMS_CANONICAL_HOST])
812AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages,
813rtems_cv_sysv_msg,
814[
815AC_TRY_RUN([
816#include <sys/types.h>
817#include <sys/ipc.h>
818#include <sys/msg.h>
819int main () {
820  int id=msgget(IPC_PRIVATE,IPC_CREAT|0400);
821  if (id == -1)
822    exit(1);
823  if (msgctl(id, IPC_RMID, 0) == -1)
824    exit(1);
825  exit(0);
826}
827],
828rtems_cv_sysv_msg="yes", rtems_cv_sysv_msg="no", :)
829])
830])
831
832AC_DEFUN(RTEMS_CHECK_SYSV_UNIX,
833[AC_REQUIRE([RTEMS_CANONICAL_HOST])
834if test "$RTEMS_CPU" = "unix" ; then
835  RTEMS_SYSV_SEM
836  if test "$rtems_cv_sysv_sem" != "yes" ; then
837    AC_MSG_ERROR([System V semaphores don't work, required by simulator])
838  fi
839  RTEMS_SYSV_SHM
840  if test "$rtems_cv_sysv_shm" != "yes" ; then
841    AC_MSG_ERROR([System V shared memory doesn't work, required by simulator])
842  fi
843  RTEMS_SYSV_MSG
844  if test "$rtems_cv_sysv_msg" != "yes" ; then
845    AC_MSG_ERROR([System V messages don't work, required by simulator])
846  fi
847fi
848])
849
850dnl $Id$
851
852dnl Report all available bsps for a target,
853dnl check if a bsp-subdirectory is present for all bsps found
854dnl
855dnl RTEMS_CHECK_BSPS(bsp_list)
856AC_DEFUN(RTEMS_CHECK_BSPS,
857[
858AC_REQUIRE([RTEMS_CHECK_CPU])dnl sets RTEMS_CPU, target
859AC_REQUIRE([RTEMS_TOP])dnl sets RTEMS_TOPdir
860AC_MSG_CHECKING([for bsps])
861case "${target}" in
862changequote(,)dnl
863  i[3456]86-go32-rtems*)
864changequote([,])dnl
865    $1="go32 go32_p5"
866    ;;
867  *)
868    files=`ls $srcdir/$RTEMS_TOPdir/c/src/lib/libbsp/$RTEMS_CPU`
869    for file in $files; do
870      case $file in
871        shared*);;
872        Makefile*);;
873        READ*);;
874        CVS*);;
875        pxfl*);;
876        go32*);;       # so the i386 port can pick up the other Makefiles
877        # Now account for BSPs with build variants
878        gen68360)      rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
879        p4000)         rtems_bsp="$rtems_bsp p4600 p4650";;
880        mvme162)       rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
881        *) $1="[$]$1 $file";;
882      esac;
883    done
884    ;;
885esac
886AC_MSG_RESULT([[$]$1 .. done])
887])dnl
888
889AC_DEFUN(RTEMS_CHECK_CUSTOM_BSP,
890[dnl
891AC_MSG_CHECKING([for make/custom/[$]$1.cfg])
892if test -r "$srcdir/$RTEMS_TOPdir/make/custom/[$]$1.cfg"; then
893  AC_MSG_RESULT([yes])
894else
895  AC_MSG_ERROR([no])
896fi
897])dnl
898
899dnl
900dnl $Id$
901dnl
902
903AC_DEFUN(RTEMS_CHECK_MULTIPROCESSING,
904[dnl
905AC_REQUIRE([RTEMS_TOP])dnl
906AC_REQUIRE([RTEMS_CHECK_CPU])dnl
907AC_CACHE_CHECK([whether BSP supports multiprocessing],
908  rtems_cv_HAS_MP,
909  [dnl
910    if test -d "$srcdir/${RTEMS_TOPdir}/c/src/lib/libbsp/${RTEMS_CPU}/${$1}/shmsupp"; then
911      if test "$RTEMS_HAS_MULTIPROCESSING" = "yes"; then
912        rtems_cv_HAS_MP="yes" ;
913      else
914        rtems_cv_HAS_MP="disabled";
915      fi
916    else
917      rtems_cv_HAS_MP="no";
918    fi])
919if test "$rtems_cv_HAS_MP" = "yes"; then
920HAS_MP="yes"
921else
922HAS_MP="no"
923fi
924AC_SUBST(HAS_MP)
925])
926
927dnl $Id$
928dnl
929AC_DEFUN(RTEMS_CHECK_CXX,
930[dnl
931AC_REQUIRE([RTEMS_CHECK_CPU])dnl
932AC_REQUIRE([RTEMS_PROG_CXX_FOR_TARGET])dnl
933AC_CACHE_VAL(rtems_cv_HAS_CPLUSPLUS,
934  [dnl
935    if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
936      if test -n "$CXX_FOR_TARGET"; then
937        rtems_cv_HAS_CPLUSPLUS="yes";
938      else
939        rtems_cv_HAS_CPLUSPLUS="no";
940      fi
941    else
942      rtems_cv_HAS_CPLUSPLUS="no";
943    fi
944  ])dnl
945HAS_CPLUSPLUS="$rtems_cv_HAS_CPLUSPLUS";
946AC_SUBST(HAS_CPLUSPLUS)dnl
947])
948
949dnl $Id$
950dnl
951AC_DEFUN(RTEMS_CHECK_NETWORKING,
952[dnl
953AC_REQUIRE([RTEMS_CHECK_CPU])dnl
954AC_CACHE_VAL(rtems_cv_HAS_NETWORKING,
955  [dnl
956    if test "$RTEMS_HAS_NETWORKING" = "yes"; then
957      rtems_cv_HAS_NETWORKING="yes";
958    else
959      rtems_cv_HAS_NETWORKING="no";
960    fi
961  ])dnl
962HAS_NETWORKING="$rtems_cv_HAS_NETWORKING";
963AC_SUBST(HAS_NETWORKING)dnl
964])
965
966dnl
967dnl  $Id$
968dnl
969
970dnl RTEMS_BSP_ALIAS(BSP_ALIAS,BSP_RETURNED)
971dnl convert a bsp alias $1 into its bsp directory $2
972AC_DEFUN(RTEMS_BSP_ALIAS,
973[
974    # account for "aliased" bsps which share source code
975    case $1 in
976      mvme162lx)    $2=mvme162  ;;  # mvme162 board variant
977      gen68360_040) $2=gen68360 ;;  # 68360 in companion mode
978      go32_p5)      $2=go32     ;;  # go32 on Pentium class CPU
979      p4600)        $2=p4000    ;;  # p4000 board with IDT 4600
980      p4650)        $2=p4000    ;;  # p4000 board with IDT 4650
981      *)            $2=$1;;
982    esac
983])
984
985dnl
986dnl $Id$
987dnl
988
989dnl RTEMS_CHECK_MAKEFILE(path)
990dnl Search for Makefile.in's within the directory starting
991dnl at path and append an entry for Makefile to global variable
992dnl "makefiles" (from configure.in) for each Makefile.in found
993dnl
994AC_DEFUN(RTEMS_CHECK_MAKEFILE,
995[RTEMS_CHECK_FILES_IN($1,Makefile,makefiles)
996])
997
998dnl
999dnl $Id$
1000dnl
1001
1002dnl RTEMS_CHECK_FILES_IN(path,file,var)
1003dnl path .. path relative to srcdir, where to start searching for files
1004dnl file .. name of the files to search for
1005dnl var  .. shell variable to append files found
1006
1007AC_DEFUN(RTEMS_CHECK_FILES_IN,
1008[
1009AC_MSG_CHECKING(for $2.in in $1)
1010if test -d $srcdir/$1; then
1011  rtems_av_save_dir=`pwd`;
1012  cd $srcdir;
1013  rtems_av_tmp=`find $1 -name "$2.in" -print | sed "s/$2\.in/%/" | sort | sed "s/%/$2/"`
1014  $3="$$3 $rtems_av_tmp";
1015  cd $rtems_av_save_dir;
1016  AC_MSG_RESULT(done)
1017else
1018  AC_MSG_RESULT(no)
1019fi
1020])
1021
1022
1023dnl $Id$
1024dnl
1025AC_DEFUN(RTEMS_CHECK_RDBG,
1026[dnl
1027AC_REQUIRE([RTEMS_TOP])dnl
1028AC_REQUIRE([RTEMS_CHECK_CPU])dnl
1029AC_CACHE_CHECK([whether BSP supports librdbg],
1030  rtems_cv_HAS_RDBG,
1031  [
1032    if test -d "$srcdir/${RTEMS_TOPdir}/c/src/lib/librdbg/${RTEMS_CPU}/${$1}"; then
1033      rtems_cv_HAS_RDBG="yes" ;
1034    else
1035      rtems_cv_HAS_RDBG="no";
1036    fi
1037  ])
1038HAS_RDBG="$rtems_cv_HAS_RDBG"
1039AC_SUBST(HAS_RDBG)
1040])
1041
Note: See TracBrowser for help on using the repository browser.