source: rtems/configure.in @ b931d05a

4.104.114.84.95
Last change on this file since b931d05a was cce81a7, checked in by Joel Sherrill <joel.sherrill@…>, on 08/21/98 at 17:43:22

A patch from Ralf Corsepius <corsepiu@…>:

Here is another patch to hopefully enhance rtems' configuration.

Motivation: Try to support other c-compilers besides gcc (I tried to
build rtems under Solaris using sun's WSPro c-compiler).

Here is a couple of small patches concerning the host compiler
configuration, which fix/work-around the worst problems when using sun's
WSPro c-compiler.

Changes:

  • Replaced make/compilers/gcc.cfg with make/compilers/gcc.cfg.in, ie. gcc.cfg is generated by configure now.
  • Removed a line containing a hard-coded "gcc" from gcc.cfg (BUG-fix).
  • Add -g to host compiler flags only if configure reported -g to work
  • Add -Wall to host compiler flags only if configure reported that the host compiler is gcc (WSPro's cc chokes on -Wall).
  • Some modifications to make/Makefile.in
  • Adapted make/custom/default.cfg to the new location of gcc.cfg

BTW, gcc.cfg/gcc.cfg.in seems to be full of unused code (DEBUG-VARIANTS
etc.) which deserves to be cleaned up, IMO.

IMO, a similar patch should be applied to gcc-target-default.cfg

  • Property mode set to 100644
File size: 15.0 KB
Line 
1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl  $Id$
4
5AC_PREREQ(2.12)
6AC_INIT(README)
7
8dnl Checks for programs.
9AC_PROG_MAKE_SET
10AC_CANONICAL_SYSTEM
11AC_ARG_WITH(cross-host,[  --with-cross-host=HOST      host (cygnus)], \
12host=$withval)
13
14AC_ARG_ENABLE(gmake-print-directory, \
15[  --enable-gmake-print-directory    enable GNU Make's print directory], \
16[case "${enableval}" in
17  yes) RTEMS_USE_OWN_PDIR=no ;;
18  no) RTEMS_USE_OWN_PDIR=yes ;;
19  *)  AC_MSG_ERROR(bad value ${enableval} for gmake-print-directory option) ;;
20esac],[RTEMS_USE_OWN_PDIR=yes])
21
22AC_ARG_ENABLE(posix, \
23[  --enable-posix                   enable posix interface], \
24[case "${enableval}" in
25  yes) RTEMS_HAS_POSIX_API=yes ;;
26  no) RTEMS_HAS_POSIX_API=no ;;
27  *)  AC_MSG_ERROR(bad value ${enableval} for enable-posix option) ;;
28esac],[RTEMS_HAS_POSIX_API=yes])
29
30AC_ARG_ENABLE(networking, \
31[  --enable-networking                enable TCP/IP stack], \
32[case "${enableval}" in
33  yes) RTEMS_HAS_NETWORKING=yes ;;
34  no) RTEMS_HAS_NETWORKING=no ;;
35  *)  AC_MSG_ERROR(bad value ${enableval} for enable-networking option) ;;
36esac],[RTEMS_HAS_NETWORKING=yes])
37
38AC_ARG_ENABLE(rtems-inlines, \
39[  --enable-rtems-inlines           enable RTEMS inline functions (use macros)], \
40[case "${enableval}" in
41  yes) RTEMS_USE_MACROS=no ;;
42  no) RTEMS_USE_MACROS=yes ;;
43  *)  AC_MSG_ERROR(bad value ${enableval} for disable-rtems-inlines option) ;;
44esac],[RTEMS_USE_MACROS=no])
45
46AC_ARG_ENABLE(cxx, \
47[  --enable-cxx            enable C++ support, and build the rtems++ library], \
48[case "${enableval}" in
49  yes) RTEMS_HAS_CPLUSPLUS=yes ;;
50  no) RTEMS_HAS_CPLUSPLUS=no   ;;
51  *)  AC_MSG_ERROR(bad value ${enableval} for enable-cxx option) ;;
52esac], [RTEMS_HAS_CPLUSPLUS=no])
53
54AC_ARG_ENABLE(gcc28, \
55[  --enable-gcc28                   enable use of gcc 2.8.x features], \
56[case "${enableval}" in
57  yes) RTEMS_USE_GCC272=no ;;
58  no) RTEMS_USE_GCC272=yes ;;
59  *)  AC_MSG_ERROR(bad value ${enableval} for gcc-28 option) ;;
60esac],[RTEMS_USE_GCC272=no])
61
62AC_ARG_ENABLE(libcdir, \
63[  --enable-libcdir=directory       set the directory for the C library], \
64[ RTEMS_LIBC_DIR="${enableval}" ; \
65test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )
66
67AC_ARG_ENABLE(bare-cpu-cflags,
68[  --enable-bare-cpu-cflags          \
69         specify a particular cpu cflag (bare bsp specific)],
70[case "${enableval}" in
71  no) BARE_CPU_CFLAGS="" ;;
72  *)    BARE_CPU_CFLAGS="${enableval}" ;;
73esac],
74[BARE_CPU_CFLAGS=""])
75
76AC_ARG_ENABLE(bare-cpu-model,
77[  --enable-bare-cpu-model              \
78         specify a particular cpu model (bare bsp specific)],
79[case "${enableval}" in
80  no)   BARE_CPU_MODEL="" ;;
81  *)    BARE_CPU_MODEL="${enableval}" ;;
82esac],
83[BARE_CPU_MODEL=""])
84
85RTEMS_PREFIX=${target_cpu}-${target_vendor}
86
87dnl BEGIN configure.host.in
88
89AC_PATH_PROG(CAT,cat)
90AC_PATH_PROG(RM,rm)
91AC_PATH_PROG(CP,cp)
92AC_PATH_PROG(MV,mv)
93AC_PATH_PROG(LN,ln)
94AC_PROG_LN_S
95AC_PATH_PROG(CHMOD,chmod)
96AC_PATH_PROG(SORT,sort)
97AC_PROG_INSTALL
98
99dnl check mkdir behaviour, try to get mkdir -p -m 0755
100RTEMS_PATH_MKDIR
101RTEMS_PROG_MKDIR_M
102RTEMS_PROG_MKDIR_P
103test "$rtems_cv_prog_MKDIR_P" = "yes" && MKDIR="$MKDIR -p"
104#test "$rtems_cv_prog_MKDIR_M" = "yes" && MKDIR="$MKDIR -m 0755"
105
106AC_PATH_PROG(TOUCH,touch)
107AC_PATH_PROG(CMP,cmp)
108
109AC_PATH_PROG(SED,sed)
110AC_PATH_PROGS(M4,gm4 m4)
111
112dnl NOTE: prefer bash over ksh over sh
113AC_PATH_PROGS(KSH,bash ksh sh)
114
115if test -z "$KSH"; then
116dnl NOTE: This cannot happen -- /bin/sh must always exist
117AC_MSG_ERROR(
118[***]
119[    Cannot determine a usable shell bash/ksh/sh]
120[    Please contact your system administrator] );
121fi
122
123dnl BEGIN configure.target.in
124
125dnl echo "TARGET"
126dnl echo "    cpu    --> $target_cpu"
127dnl echo "    os     --> $target_os"
128dnl echo "    vendor --> $target_vendor"
129
130dnl canonicalize target name
131dnl NOTE: Most rtems targets do not fullfil autoconf
132dnl targets naming conventions "processor-vendor-os"
133dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
134dnl and we have to fix it for rtems ourselves
135dnl
136dnl The original plan was to do CPU-BSP-rtems or CPU-rtems to
137dnl imply all BSPs.  Eventually we would like to build a collection
138dnl of CPU model specific RTEMS libraries which in conjunction with
139dnl a BSP library would be used to link an application.
140
141RTEMS_HOST=$host_os
142
143case "${target}" in
144  # hpux unix port should go here
145  i[[3456]]86-go32-rtems*)
146        target_cpu=i386
147        rtems_bsp="go32 go32_p5"
148        skip_startfiles="yes"
149        RTEMS_HAS_POSIX_API=no
150        ;;
151  i[[3456]]86-pc-linux*)         # unix "simulator" port
152        target_cpu=unix
153        RTEMS_HOST=Linux
154        # override these settings
155        RTEMS_HAS_POSIX_API=no
156        ;;
157  i[[3456]]86-*freebsd2*) # unix "simulator" port
158        target_cpu=unix
159        RTEMS_HOST=FreeBSD
160        # override these settings
161        RTEMS_HAS_POSIX_API=no
162        ;;
163  no_cpu-*rtems*)
164        target_cpu=no_cpu
165        RTEMS_HAS_POSIX_API=no
166        ;;
167  ppc*-*rtems*)
168        target_cpu=powerpc
169        ;;
170  sparc-sun-solaris*)             # unix "simulator" port
171        target_cpu=unix
172        RTEMS_HOST=Solaris
173        # override these settings
174        RTEMS_HAS_POSIX_API=no
175        ;;
176  *)
177        RTEMS_CANONICAL_TARGET_CPU
178        ;;
179esac
180
181# Override the set of BSPs to be built.
182AC_ARG_ENABLE(rtemsbsp, \
183  [  --enable-rtemsbsp=bsp1 bsp2 ..   BSPs to include in build], \
184      rtems_bsp=$enableval \
185)
186
187# Is this a supported CPU?
188AC_MSG_CHECKING([if cpu $target_cpu is supported])
189if test -d "$srcdir/c/src/exec/score/cpu/$target_cpu"; then
190  AC_MSG_RESULT(yes)
191  makefiles="$makefiles c/src/exec/score/cpu/$target_cpu/Makefile"
192else
193  AC_MSG_ERROR(no)
194fi
195
196RTEMS_TOOL_PREFIX
197
198dnl check target cc
199RTEMS_PROG_CC
200dnl check if the compiler supports --specs
201RTEMS_GCC_SPECS
202dnl check if the target compiler may use --pipe
203RTEMS_GCC_PIPE
204
205dnl check if the compiler supports --specs if gcc28 is requested
206if test "$RTEMS_USE_GCC272" != "yes" ; then
207  if test "$rtems_cv_gcc_specs" = "no"; then
208    AC_MSG_WARN([*** disabling --enable-gcc28])
209     RTEMS_USE_GCC272=yes
210  fi
211fi
212test "$rtems_cv_gcc_pipe" = "yes" && CC_FOR_TARGET="$CC_FOR_TARGET --pipe"
213
214dnl check for g++
215if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
216  RTEMS_PROG_CXX
217  if test "$rtems_cv_prog_cc_cross" != "$rtems_cv_prog_cxx_cross"; then
218    AC_MSG_ERROR([***]
219     [Inconsistency in compiler configuration:]
220     [Target C compiler and Target C++ compiler]
221     [must both ether be cross compilers or native compilers]
222     [Hint: If building a posix bsp: LD_LIBRARY_PATH?] )
223  fi
224else
225  CXX_FOR_TARGET="no"
226fi
227
228RTEMS_CANONICALIZE_TOOLS
229
230dnl check host cc
231AC_PROG_CC
232
233RTEMS_CYGWIN32
234RTEMS_EXEEXT
235
236dnl FIXME: HACK for egcs/cygwin mixing '\\' and '/' in gcc -print-*
237case $host_os in
238*cygwin32*)     GCCSED="| sed 's%\\\\%/%g'" ;;
239*) ;;
240esac
241AC_SUBST(GCCSED)
242
243dnl FIXME: This is a kludge
244dnl Add -Wall if using gcc as host compiler
245test "$ac_cv_prog_gcc" = "yes" && CC_CFLAGS_DEFAULT=-Wall
246dnl Add -g if the host compiler accepts -g, assume -g means debugging
247test "$ac_cv_prog_cc_g" = "yes" && CC_CFLAGS_DEBUG_V=-g
248
249dnl check for host library functions
250dnl NOTE: must be called after AC_PROG_CC
251AC_CHECK_FUNCS(strerror)
252
253dnl check for SysV IPC used by simulators
254if test "$target_cpu" = "unix" ; then
255  RTEMS_SYSV_SEM
256  if test "$rtems_cv_sysv_sem" != "yes" ; then
257    AC_MSG_ERROR([System V semaphores don't work, required by simulator])
258  fi
259  RTEMS_SYSV_SHM
260  if test "$rtems_cv_sysv_shm" != "yes" ; then
261    AC_MSG_ERROR([System V shared memory doesn't work, required by simulator])
262  fi
263  RTEMS_SYSV_MSG
264  if test "$rtems_cv_sysv_msg" != "yes" ; then
265    AC_MSG_ERROR([System V messages don't work, required by simulator])
266  fi
267fi
268
269# find all the Executive Makefiles
270RTEMS_CHECK_MAKEFILE(c/src/exec/score/tools/$target_cpu)
271RTEMS_CHECK_MAKEFILE(c/src/exec/rtems)
272RTEMS_CHECK_MAKEFILE(c/src/exec/sapi)
273
274if test "$RTEMS_HAS_POSIX_API" = "yes"; then
275  RTEMS_CHECK_MAKEFILE(c/src/exec/posix)
276  makefiles="$makefiles c/src/exec/wrapup/posix/Makefile"
277fi
278
279# find all the Makefiles for the BSPs
280if test -d "$srcdir/c/src/lib/libbsp/$target_cpu"; then
281  makefiles="$makefiles c/src/lib/libbsp/$target_cpu/Makefile"
282
283  if test -z "$rtems_bsp"; then
284    AC_MSG_CHECKING([for bsps])
285    files=`ls $srcdir/c/src/lib/libbsp/$target_cpu`
286    for file in $files; do
287      case $file in
288        shared*);;
289        Makefile*);;
290        READ*);;
291        CVS*);;
292        pxfl*);;
293        go32*);;       # so the i386 port can pick up the other Makefiles
294        # Now account for BSPs with build variants
295        gen68360)      rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
296        p4000)         rtems_bsp="$rtems_bsp p4600 p4650";;
297        mvme162)       rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
298        *) rtems_bsp="$rtems_bsp $file";;
299      esac;
300    done
301
302    makefiles="$makefiles c/src/lib/libbsp/bare/Makefile"
303
304    AC_MSG_RESULT([$rtems_bsp done])
305  fi
306
307  # collect makefiles for each bsp
308  for i in $rtems_bsp; do
309    # make sure there is a make/custom file for the bsp
310    if test ! -r "$srcdir/make/custom/${i}.cfg"; then
311      AC_MSG_ERROR([no make/custom/${i}.cfg file for BSP $i])
312    fi
313 
314    # account for "aliased" bsps which share source code
315    case $i in
316      mvme162lx)    bspdir=mvme162  ;;  # mvme162 board variant
317      gen68360_040) bspdir=gen68360 ;;  # 68360 in companion mode
318      go32_p5)      bspdir=go32     ;;  # go32 on Pentium class CPU
319      p4600)        bspdir=p4000    ;;  # p4000 board with IDT 4600
320      p4650)        bspdir=p4000    ;;  # p4000 board with IDT 4650
321      *)            bspdir=$i;;
322    esac
323
324    # Is there code where there should be for this BSP?
325    # The bare bsp is a special case as it is not under the target_cpu path
326    case $i in
327      bare)
328        bspcpudir=
329        if test "X${BARE_CPU_CFLAGS}" = "X" ; then
330          AC_MSG_ERROR([--enable-bare-cpu-flags not specified for bare bsp])
331        fi
332        if test "X${BARE_CPU_MODEL}" = "X" ; then
333          AC_MSG_ERROR([--enable-bare-cpu-model not specified for bare bsp])
334        fi
335        ;;
336      *)
337        bspcpudir=$target_cpu/
338        ;;
339    esac
340     
341    if test -d "$srcdir/c/src/lib/libbsp/$bspcpudir$bspdir"; then
342      RTEMS_BSP_LIST="$RTEMS_BSP_LIST $i"
343      # make sure the Makefiles in a bsp directory are only done once
344      echo $bspdirs | grep $bspdir >/dev/null 2>&1
345      if test $? -ne 0 ; then
346        bspdirs="$bspdirs $bspdir"
347        RTEMS_CHECK_MAKEFILE(c/src/lib/libbsp/$bspcpudir$bspdir)
348        RTEMS_CHECK_MAKEFILE(c/src/lib/libbsp/${bspcpudir}shared)
349      fi
350    else
351      AC_MSG_ERROR([unable to find libbsp directory ($bspdir) for  $i])
352    fi
353  done
354fi
355
356# find all the CPU dependent library Makefiles
357RTEMS_CHECK_MAKEFILE(c/src/lib/libcpu/$target_cpu)
358
359dnl Workaround for go32
360if test "$skip_startfiles" != "yes"; then
361  RTEMS_CHECK_MAKEFILE(c/src/lib/start/$target_cpu)
362fi
363
364dnl END configure.target.in
365
366
367PROJECT_ROOT=`pwd;`
368
369# If RTEMS macros are enabled, then use them.  Otherwise, use inlines.
370if test "$RTEMS_USE_MACROS" = "yes"; then
371  inline_dir=macros
372  if test "$RTEMS_HAS_POSIX_API" = "yes"; then
373    # The problem is that there is currently no code in posix/macros :)
374    AC_MSG_ERROR(Macros are not implemented for the POSIX API)
375  fi
376else
377  inline_dir=inline
378fi
379
380# If the TCP/IP stack is enabled, then find all TCP/IP Makefiles
381AC_MSG_CHECKING([if networking is enabled? ])
382AC_MSG_RESULT($RTEMS_HAS_NETWORKING)
383if test "$RTEMS_HAS_NETWORKING" = "yes"; then
384  RTEMS_CHECK_MAKEFILE(c/src/lib/libnetworking)
385fi
386
387# If the C++ support is enabled, then include the Makefiles
388if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
389  makefiles="$makefiles c/src/lib/librtems++/Makefile"
390fi
391
392# If the tests are enabled, then find all the test suite Makefiles
393AC_MSG_CHECKING([if the test suites are enabled? ])
394tests_enabled=yes
395AC_ARG_ENABLE(tests, \
396[  --enable-tests                   enable tests], \
397  [case "${enableval}" in
398    yes) AC_MSG_RESULT(yes) ;;
399    no)  AC_MSG_RESULT(no) ; tests_enabled=no ;;
400    *)   AC_MSG_ERROR(bad value ${enableval} for tests option) ;;
401  esac],
402AC_MSG_RESULT(yes)
403)
404
405RTEMS_CHECK_MAKEFILE(c/src/tests/tools/$target_cpu)
406
407if test "$tests_enabled" = "yes"; then
408   RTEMS_CHECK_MAKEFILE(c/src/tests/libtests)
409   RTEMS_CHECK_MAKEFILE(c/src/tests/sptests)
410   RTEMS_CHECK_MAKEFILE(c/src/tests/tmtests)
411   RTEMS_CHECK_MAKEFILE(c/src/tests/mptests)
412   if test "$RTEMS_HAS_POSIX_API" = "yes"; then
413     RTEMS_CHECK_MAKEFILE(c/src/tests/psxtests)
414   fi
415fi
416
417# If the HWAPI is enabled, the find the HWAPI Makefiles
418AC_MSG_CHECKING([if the HWAPI is enabled? ])
419AC_ARG_ENABLE(hwapi, \
420[  --enable-hwapi                 enable hardware API library], \
421  [case "${enableval}" in
422    yes) AC_MSG_RESULT(yes)
423         if test -f ${srcdir}/c/src/lib/libhwapi/Makefile.in ; then
424            makefiles="$makefiles c/src/lib/libhwapi/Makefile"
425            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/analog)
426            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/discrete)
427            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/drivers)
428            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/non_volatile_memory)
429            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/serial)
430            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/support)
431            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/wrapup)
432         else
433            AC_MSG_ERROR(No source code found for the HWAPI)
434         fi
435         ;;
436    no)  AC_MSG_RESULT(no) ;;
437    *)  AC_MSG_ERROR(bad value ${enableval} for hwapi option) ;;
438  esac],
439  AC_MSG_RESULT(no)
440)
441
442AC_SUBST(rtems_cv_prog_cc_cross)
443AC_SUBST(RTEMS_BSP_LIST)
444AC_SUBST(RTEMS_HOST)
445AC_SUBST(RTEMS_LIBC_DIR)
446AC_SUBST(RTEMS_USE_OWN_PDIR)
447AC_SUBST(RTEMS_HAS_POSIX_API)
448AC_SUBST(RTEMS_HAS_NETWORKING)
449AC_SUBST(RTEMS_USE_MACROS)
450AC_SUBST(RTEMS_HAS_CPLUSPLUS)
451AC_SUBST(RTEMS_USE_GCC272)
452AC_SUBST(RTEMS_LIBC_DIR)
453AC_SUBST(BARE_CPU_CFLAGS)
454AC_SUBST(BARE_CPU_MODEL)
455AC_SUBST(PROJECT_ROOT)
456AC_SUBST(program_prefix)
457AC_SUBST(CC_CFLAGS_DEFAULT)
458AC_SUBST(CC_CFLAGS_DEBUG_V)
459
460# pick up all the Makefiles in required parts of the tree
461RTEMS_CHECK_MAKEFILE(c/build-tools)
462RTEMS_CHECK_MAKEFILE(make)
463RTEMS_CHECK_MAKEFILE(c/src/lib/libmisc)
464RTEMS_CHECK_MAKEFILE(c/src/tests/samples)
465
466AC_CONFIG_HEADER(c/build-tools/src/config.h)
467
468# try not to explicitly list a Makefile here
469AC_OUTPUT(
470Makefile
471make/host.cfg
472make/target.cfg
473make/Templates/Makefile.inc
474make/compilers/gcc.cfg
475c/Makefile
476c/src/Makefile
477c/src/exec/Makefile
478c/src/exec/score/Makefile
479c/src/exec/score/cpu/Makefile
480c/src/exec/score/headers/Makefile
481c/src/exec/score/${inline_dir}/Makefile
482c/src/exec/score/src/Makefile
483c/src/exec/score/tools/Makefile
484c/src/exec/score/tools/generic/Makefile
485c/src/exec/score/tools/generic/size_rtems
486c/src/exec/wrapup/Makefile
487c/src/exec/wrapup/rtems/Makefile
488c/src/lib/Makefile
489c/src/lib/include/Makefile
490c/src/lib/libbsp/Makefile
491c/src/lib/libbsp/shmdr/Makefile
492c/src/lib/libc/Makefile
493c/src/lib/libcpu/Makefile
494c/src/lib/start/Makefile
495c/src/lib/wrapup/Makefile
496c/src/tests/Makefile
497c/src/tests/support/Makefile
498c/src/tests/support/include/Makefile
499c/src/tests/support/stubdr/Makefile
500c/src/tests/support/wrapup/Makefile
501c/src/tests/tools/Makefile
502c/src/tests/tools/generic/Makefile
503$makefiles
504c/update-tools/Makefile)
505
506echo
507echo target architecture: $target_cpu.
508echo available BSPs: $rtems_bsp.
509echo \'make all\' will build the following BSPs: $RTEMS_BSP_LIST.
510echo other BSPs can be built with \'make RTEMS_BSP=\"bsp1 bsp2 ...\"\'
511echo
Note: See TracBrowser for help on using the repository browser.