source: rtems/c/src/exec/aclocal.m4 @ ea562ee9

4.104.114.84.95
Last change on this file since ea562ee9 was ea562ee9, checked in by Joel Sherrill <joel.sherrill@…>, on 08/12/99 at 18:22:17

Patch from Ralf Corsepius <corsepiu@…>:

After upgrading my linux box to the brand new SuSE 6.2 release, which is
glibc-2.1 based, I came across a bug in RTEMS - IIRC, I even warned you
about it about 1/2 a year ago, but nothing has been done since then :-.

The *.m4 macros to check for SYSV/IPC are broken for linux/glibc2.1,
because they assume that linux always defines union semun, which isn't
true anymore for glibc2.1 (the manpage for semctl states _X_OPEN
specifies it this way). Therefore I have tried to implement a more
general approach for handling SYSV for unix/posix which checks for
presence of struct semun, instead of trying to evaluate OS specific
preprocessor symbols.

This approach is a bit adventureous, because I only tested it with
linux/glibc2.1 and linux/libc5, but not under other Unix variants RTEMS
supports. I am quite confident it will work on other hosts, too, but who
knows :-.

[FYI: I think this might also is the cause of some problems with RedHat?
6.X / Mandrake linux recently reported on the rtems list -- rtems-4.0.0
can not be build for posix on any glibc2.1 based host]

Furthermore the patch below contains a couple of minor fixes and
configuration cleanups, which IMO should be applied before releasing a
new snapshot.

To apply this patch:

cd <source-tree>
patch -p1 < rtems-rc-19990709-8.diff
./autogen

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