source: rtems/configure.in @ 5c3511e

4.104.114.84.95
Last change on this file since 5c3511e was 5c3511e, checked in by Joel Sherrill <joel.sherrill@…>, on 01/30/98 at 21:49:51

Big patch form Ralf Corsepius described in this email:

Here is the result of my nightly work to get RTEMS_ROOT=$srcdir working
with different shells and relative/absolute paths.

What I did is relatively simple in principle:
Instead of setting RTEMS_ROOT in configure.in and then let configure
substitute @RTEMS_ROOT@ inside the Makefiles, I now let each Makefile
set RTEMS_ROOT from each Makefile's @top_srcdir@ value.

The difference is subtile, but with enormous side effects:

  • If RTEMS_ROOT is set in configure, then the same single value will be propagated to all Makefiles. This breaks using relative paths, as the relative path to the root of the source tree is used inside of all subdirectory Makefiles.
  • Now each Makefile.in sets RTEMS_ROOT = @top_srcdir@. top_srcdir is computed individually by configure for each single Makefile.in, hereby receiving the correct value, no matter if relative or absolute paths are used.

To get this working, I needed to remove setting RTEMS_ROOT from
target.cfg.in, because this overrides the value of RTEMS_ROOT from each
individual Makefile.

Furthermore, I removed RTEMS_CUSTOM from the Makefiles and replaced all
"include $(RTEMS_CUSTOM)" directives with"include
$(RTEMS_ROOT)/make/custom/$(RTEMS_BSP)". Perhaps you don't like this,
but I think, to have one variable less is clearer and easier to
understand than having several variables refering to the next one.

I enclose a small patch to this mail, which

  • fixes the config.h problem (to finally clearify misunderstands)
  • removes assignment/subsitution of RTEMS_ROOT from configure.in
  • contains a workaround for the application Makefile's RTEMS_ROOT problem (reported by Eric)
  • removes some unused lines from the toplevel Makefile.in
  • removes assignment of RTEMS_ROOT from make/target.cfg.in
  • Property mode set to 100644
File size: 11.9 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(ka9q, \
31[  --enable-ka9q                enable KA9Q TCP/IP stack], \
32[case "${enableval}" in
33  yes) RTEMS_HAS_KA9Q=yes ;;
34  no) RTEMS_HAS_KA9Q=no ;;
35  *)  AC_MSG_ERROR(bad value ${enableval} for enable-ka9q option) ;;
36esac],[RTEMS_HAS_KA9Q=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(cpp, \
47[  --enable-cpp            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-cpp 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
67RTEMS_PREFIX=${target_cpu}-${target_vendor}
68
69dnl BEGIN configure.host.in
70
71AC_PATH_PROG(CAT,cat)
72AC_PATH_PROG(RM,rm)
73AC_PATH_PROG(CP,cp)
74AC_PATH_PROG(MV,mv)
75AC_PATH_PROG(LN,ln)
76AC_PROG_LN_S
77AC_PATH_PROG(CHMOD,chmod)
78AC_PATH_PROG(SORT,sort)
79AC_CHECK_FUNCS(strerror)
80
81dnl check mkdir behaviour, try to get mkdir -p -m 0755
82RTEMS_PATH_MKDIR
83RTEMS_PROG_MKDIR_M
84RTEMS_PROG_MKDIR_P
85test "$rtems_cv_prog_MKDIR_P" = "yes" && MKDIR="$MKDIR -p"
86test "$rtems_cv_prog_MKDIR_M" = "yes" && MKDIR="$MKDIR -m 0755"
87
88AC_PATH_PROG(TOUCH,touch)
89AC_PATH_PROG(CMP,cmp)
90
91AC_PATH_PROG(SED,sed)
92AC_PATH_PROGS(M4,gm4 m4)
93
94dnl NOTE: prefer bash over ksh over sh
95AC_PATH_PROGS(KSH,bash ksh sh)
96
97if test -z "$KSH"; then
98dnl NOTE: This cannot happen -- /bin/sh must always exist
99AC_MSG_ERROR(
100[***]
101[    Cannot determine a usable shell bash/ksh/sh]
102[    Please contact your system administrator] );
103fi
104
105dnl END configure.host.in
106
107dnl BEGIN configure.target.in
108
109dnl echo "TARGET"
110dnl echo "    cpu    --> $target_cpu"
111dnl echo "    os     --> $target_os"
112dnl echo "    vendor --> $target_vendor"
113
114dnl canonicalize target name
115dnl NOTE: Most rtems targets do not fullfil autoconf
116dnl targets naming conventions "processor-vendor-os"
117dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
118dnl and we have to fix it for rtems ourselves
119dnl
120dnl The original plan was to do CPU-BSP-rtems or CPU-rtems to
121dnl imply all BSPs.  Eventually we would like to build a collection
122dnl of CPU model specific RTEMS libraries which in conjunction with
123dnl a BSP library would be used to link an application.
124
125RTEMS_HOST=$host_os
126
127case "${target}" in
128  # hpux unix port should go here
129  hppa1.1-rtems*)
130        target_cpu=hppa1_1
131        ;;
132  i[[3456]]86-go32-rtems*)
133        target_cpu=i386
134        rtems_bsp="go32 go32_p5"
135        skip_startfiles="yes"
136        RTEMS_HAS_POSIX_API=no
137        ;;
138  i[[3456]]86-rtems*)
139        target_cpu=i386
140        ;;
141  i[[3456]]86-pc-linux*)         # unix "simulator" port
142        target_cpu=unix
143        RTEMS_HAS_POSIX_API=no
144        RTEMS_HOST=Linux
145        ;;
146  no_cpu-rtems*)
147        target_cpu=no_cpu
148        RTEMS_HAS_POSIX_API=no
149        ;;
150  powerpc-*tems*)
151        target_cpu=ppc
152        ;;
153  sparc-sun-solaris*)             # unix "simulator" port
154        target_cpu=unix
155        RTEMS_HAS_POSIX_API=no
156        RTEMS_HOST=Solaris
157        ;;
158  *)
159        RTEMS_CANONICAL_TARGET_CPU
160        ;;
161esac
162
163# Override the set of BSPs to be built.
164AC_ARG_ENABLE(rtemsbsp, \
165  [  --enable-rtemsbsp=bsp1 bsp2 ..   BSPs to include in build], \
166      rtems_bsp=$enableval \
167)
168
169# Is this a supported CPU?
170AC_MSG_CHECKING([if cpu $target_cpu is supported])
171if test -d "$srcdir/c/src/exec/score/cpu/$target_cpu"; then
172  AC_MSG_RESULT(yes)
173  makefiles="$makefiles c/src/exec/score/cpu/$target_cpu/Makefile"
174else
175  AC_MSG_ERROR(no)
176fi
177
178# find all the Executive Makefiles
179RTEMS_CHECK_MAKEFILE(c/src/exec/score/tools/$target_cpu)
180RTEMS_CHECK_MAKEFILE(c/src/exec/rtems)
181RTEMS_CHECK_MAKEFILE(c/src/exec/sapi)
182
183if test "$RTEMS_HAS_POSIX_API" = "yes"; then
184  RTEMS_CHECK_MAKEFILE(c/src/exec/posix)
185  makefiles="$makefiles c/src/exec/wrapup/posix/Makefile"
186fi
187
188# find all the Makefiles for the BSPs
189if test -d "$srcdir/c/src/lib/libbsp/$target_cpu"; then
190  makefiles="$makefiles c/src/lib/libbsp/$target_cpu/Makefile"
191
192  if test -z "$rtems_bsp"; then
193    AC_MSG_CHECKING([for bsps])
194    files=`ls $srcdir/c/src/lib/libbsp/$target_cpu`
195    for file in $files; do
196      case $file in
197        shared*);;
198        Makefile*);;
199        READ*);;
200        CVS*);;
201        pxfl*);;
202        go32*);;       # so the i386 port can pick up the other Makefiles
203        # Now account for BSPs with build variants
204        gen68360)      rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
205        p4000)         rtems_bsp="$rtems_bsp p4600 p4650";;
206        mvme162)       rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
207        *) rtems_bsp="$rtems_bsp $file";;
208      esac;
209    done
210
211    AC_MSG_RESULT([$rtems_bsp done])
212  fi
213
214  # collect makefiles for each bsp
215  for i in $rtems_bsp; do
216    # make sure there is a make/custom file for the bsp
217    if test ! -r "$srcdir/make/custom/${i}.cfg"; then
218      AC_MSG_ERROR([no make/custom/${i}.cfg file for BSP $i])
219    fi
220 
221    # account for "aliased" bsps which share source code
222    case $i in
223      mvme162lx)    bspdir=mvme162  ;;  # mvme162 board variant
224      gen68360_040) bspdir=gen68360 ;;  # 68360 in companion mode
225      go32_p5)      bspdir=go32     ;;  # go32 on Pentium class CPU
226      p4600)        bspdir=p4000    ;;  # p4000 board with IDT 4600
227      p4650)        bspdir=p4000    ;;  # p4000 board with IDT 4650
228      *)            bspdir=$i;;
229    esac
230
231    # Is there code where there should be for this BSP?
232    if test -d "$srcdir/c/src/lib/libbsp/$target_cpu/$bspdir"; then
233      RTEMS_BSP_LIST="$RTEMS_BSP_LIST $i"
234      # make sure the Makefiles in a bsp directory are only done once
235      echo $bspdirs | grep $bspdir >/dev/null 2>&1
236      if test $? -ne 0 ; then
237        bspdirs="$bspdirs $bspdir"
238        RTEMS_CHECK_MAKEFILE(c/src/lib/libbsp/$target_cpu/$bspdir)
239      fi
240    else
241      AC_MSG_ERROR([unable to find libbsp directory ($bspdir) for  $i])
242    fi
243  done
244fi
245
246# find all the CPU dependent library Makefiles
247RTEMS_CHECK_MAKEFILE(c/src/lib/libcpu/$target_cpu)
248
249dnl Workaround for go32
250if test "$skip_startfiles" != "yes"; then
251  RTEMS_CHECK_MAKEFILE(c/src/lib/start/$target_cpu)
252fi
253
254dnl END configure.target.in
255
256
257#
258#  Target configurations are listed in alphabetical order. 
259#  The BSPs for a target configuration are also listed in alphabetical order.
260#
261
262dnl NOTE: host_os is automatically set by autoconf
263
264if [[ "${program_prefix}" = "NONE" ]] ; then
265  if [[ "${target}" = "${host}" ]] ; then
266    program_prefix=
267  else
268    program_prefix=${target}-
269  fi
270fi
271
272PROJECT_ROOT=`pwd;`
273
274# If RTEMS macros are enabled, then use them.  Otherwise, use inlines.
275if test "$RTEMS_USE_MACROS" = "yes"; then
276  inline_dir=macros
277  if test "$RTEMS_HAS_POSIX_API" = "yes"; then
278    # The problem is that there is currently no code in posix/macros :)
279    AC_MSG_ERROR(Macros are not implemented for the POSIX API)
280  fi
281else
282  inline_dir=inline
283fi
284
285# If the KA9Q TCP/IP stack is enabled, then find all KA9Q Makefiles
286if test "$RTEMS_HAS_KA9Q" = "yes"; then
287  makefiles="$makefiles c/src/lib/libka9q/Makefile"
288fi
289
290# If the C++ support is enabled, then include the Makefiles
291if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
292  makefiles="$makefiles c/src/lib/librtems++/Makefile"
293fi
294
295# If the tests are enabled, then find all the test suite Makefiles
296AC_MSG_CHECKING([Are the test suites enabled? ])
297tests_enabled=yes
298AC_ARG_ENABLE(tests, \
299[  --enable-tests                   enable tests], \
300  [case "${enableval}" in
301    yes) AC_MSG_RESULT(yes) ;;
302    no)  AC_MSG_RESULT(no) ; tests_enabled=no ;;
303    *)   AC_MSG_ERROR(bad value ${enableval} for tests option) ;;
304  esac],
305AC_MSG_RESULT(yes)
306)
307
308if test "$tests_enabled" = "yes"; then
309   RTEMS_CHECK_MAKEFILE(c/src/tests/tools/$target_cpu)
310   RTEMS_CHECK_MAKEFILE(c/src/tests/libtests)
311   RTEMS_CHECK_MAKEFILE(c/src/tests/sptests)
312   RTEMS_CHECK_MAKEFILE(c/src/tests/tmtests)
313   RTEMS_CHECK_MAKEFILE(c/src/tests/mptests)
314   if test "$RTEMS_HAS_POSIX" = "yes"; then
315     RTEMS_CHECK_MAKEFILE(c/src/tests/psxtests)
316   fi
317fi
318
319# If the HWAPI is enabled, the find the HWAPI Makefiles
320AC_MSG_CHECKING([Is the HWAPI enabled? ])
321AC_ARG_ENABLE(hwapi, \
322[  --enable-hwapi                 enable hardware API library], \
323  [case "${enableval}" in
324    yes) AC_MSG_RESULT(yes)
325         if test -f ${srcdir}/c/src/lib/libhwapi/Makefile.in ; then
326            makefiles="$makefiles c/src/lib/libhwapi/Makefile"
327            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/analog)
328            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/discrete)
329            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/drivers)
330            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/non_volatile_memory)
331            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/serial)
332            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/support)
333            RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/wrapup)
334         else
335            AC_MSG_ERROR(No source code found for the HWAPI)
336         fi
337         ;;
338    no)  AC_MSG_RESULT(no) ;;
339    *)  AC_MSG_ERROR(bad value ${enableval} for hwapi option) ;;
340  esac],
341  AC_MSG_RESULT(no)
342)
343
344AC_SUBST(RTEMS_BSP_LIST)
345AC_SUBST(RTEMS_HOST)
346AC_SUBST(RTEMS_LIBC_DIR)
347AC_SUBST(RTEMS_USE_OWN_PDIR)
348AC_SUBST(RTEMS_HAS_POSIX_API)
349AC_SUBST(RTEMS_HAS_KA9Q)
350AC_SUBST(RTEMS_USE_MACROS)
351AC_SUBST(RTEMS_HAS_CPLUSPLUS)
352AC_SUBST(RTEMS_USE_GCC272)
353AC_SUBST(RTEMS_LIBC_DIR)
354AC_SUBST(PROJECT_ROOT)
355AC_SUBST(program_prefix)
356
357# pick up all the Makefiles in required parts of the tree
358RTEMS_CHECK_MAKEFILE(c/build-tools)
359RTEMS_CHECK_MAKEFILE(make)
360RTEMS_CHECK_MAKEFILE(c/src/lib/libmisc)
361RTEMS_CHECK_MAKEFILE(c/src/tests/samples)
362
363AC_CONFIG_HEADER(c/build-tools/src/config.h)
364
365AC_CONFIG_HEADER(c/build-tools/src/config.h)
366
367# try not to explicitly list a Makefile here
368AC_OUTPUT(
369Makefile
370c/Makefile
371c/src/Makefile
372c/src/exec/Makefile
373c/src/exec/score/Makefile
374c/src/exec/score/cpu/Makefile
375c/src/exec/score/headers/Makefile
376c/src/exec/score/${inline_dir}/Makefile
377c/src/exec/score/src/Makefile
378c/src/exec/score/tools/Makefile
379c/src/exec/score/tools/generic/Makefile
380c/src/exec/score/tools/generic/size_rtems
381c/src/exec/wrapup/Makefile
382c/src/exec/wrapup/rtems/Makefile
383c/src/lib/Makefile
384c/src/lib/include/Makefile
385c/src/lib/libbsp/Makefile
386c/src/lib/libbsp/shmdr/Makefile
387c/src/lib/libc/Makefile
388c/src/lib/libcpu/Makefile
389c/src/lib/start/Makefile
390c/src/lib/wrapup/Makefile
391c/src/tests/Makefile
392c/src/tests/support/Makefile
393c/src/tests/support/include/Makefile
394c/src/tests/support/stubdr/Makefile
395c/src/tests/support/wrapup/Makefile
396c/src/tests/tools/Makefile
397c/src/tests/tools/generic/Makefile
398$makefiles
399make/host.cfg
400make/target.cfg
401make/Templates/Makefile.inc
402c/update-tools/Makefile)
403
404echo
405echo target architecture: $target_cpu.
406echo available BSPs: $rtems_bsp.
407echo \'make all\' will build the following BSPs: $RTEMS_BSP_LIST.
408echo other BSPs can be built with \'make RTEMS_BSP=\"bsp1 bsp2 ...\"\'
409echo
Note: See TracBrowser for help on using the repository browser.