forked from Imagelibrary/rtems
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
410 lines
12 KiB
Plaintext
410 lines
12 KiB
Plaintext
dnl Process this file with autoconf to produce a configure script.
|
|
dnl
|
|
dnl $Id$
|
|
|
|
AC_PREREQ(2.12)
|
|
AC_INIT(README)
|
|
|
|
dnl Checks for programs.
|
|
AC_PROG_MAKE_SET
|
|
AC_CANONICAL_SYSTEM
|
|
AC_ARG_WITH(cross-host,[ --with-cross-host=HOST host (cygnus)], \
|
|
host=$withval)
|
|
|
|
AC_ARG_ENABLE(gmake-print-directory, \
|
|
[ --enable-gmake-print-directory enable GNU Make's print directory], \
|
|
[case "${enableval}" in
|
|
yes) RTEMS_USE_OWN_PDIR=no ;;
|
|
no) RTEMS_USE_OWN_PDIR=yes ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for gmake-print-directory option) ;;
|
|
esac],[RTEMS_USE_OWN_PDIR=yes])
|
|
|
|
AC_ARG_ENABLE(posix, \
|
|
[ --enable-posix enable posix interface], \
|
|
[case "${enableval}" in
|
|
yes) RTEMS_HAS_POSIX_API=yes ;;
|
|
no) RTEMS_HAS_POSIX_API=no ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for enable-posix option) ;;
|
|
esac],[RTEMS_HAS_POSIX_API=yes])
|
|
|
|
AC_ARG_ENABLE(ka9q, \
|
|
[ --enable-ka9q enable KA9Q TCP/IP stack], \
|
|
[case "${enableval}" in
|
|
yes) RTEMS_HAS_KA9Q=yes ;;
|
|
no) RTEMS_HAS_KA9Q=no ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for enable-ka9q option) ;;
|
|
esac],[RTEMS_HAS_KA9Q=yes])
|
|
|
|
AC_ARG_ENABLE(rtems-inlines, \
|
|
[ --enable-rtems-inlines enable RTEMS inline functions (use macros)], \
|
|
[case "${enableval}" in
|
|
yes) RTEMS_USE_MACROS=no ;;
|
|
no) RTEMS_USE_MACROS=yes ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for disable-rtems-inlines option) ;;
|
|
esac],[RTEMS_USE_MACROS=no])
|
|
|
|
AC_ARG_ENABLE(cpp, \
|
|
[ --enable-cpp enable C++ support, and build the rtems++ library], \
|
|
[case "${enableval}" in
|
|
yes) RTEMS_HAS_CPLUSPLUS=yes ;;
|
|
no) RTEMS_HAS_CPLUSPLUS=no ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for enable-cpp option) ;;
|
|
esac], [RTEMS_HAS_CPLUSPLUS=no])
|
|
|
|
AC_ARG_ENABLE(gcc28, \
|
|
[ --enable-gcc28 enable use of gcc 2.8.x features], \
|
|
[case "${enableval}" in
|
|
yes) RTEMS_USE_GCC272=no ;;
|
|
no) RTEMS_USE_GCC272=yes ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for gcc-28 option) ;;
|
|
esac],[RTEMS_USE_GCC272=no])
|
|
|
|
AC_ARG_ENABLE(libcdir, \
|
|
[ --enable-libcdir=directory set the directory for the C library], \
|
|
[ RTEMS_LIBC_DIR="${enableval}" ; \
|
|
test -d ${enableval} || AC_MSG_ERROR("$enableval is not a directory" ) ] )
|
|
|
|
RTEMS_PREFIX=${target_cpu}-${target_vendor}
|
|
|
|
dnl BEGIN configure.host.in
|
|
|
|
AC_PATH_PROG(CAT,cat)
|
|
AC_PATH_PROG(RM,rm)
|
|
AC_PATH_PROG(CP,cp)
|
|
AC_PATH_PROG(MV,mv)
|
|
AC_PATH_PROG(LN,ln)
|
|
AC_PROG_LN_S
|
|
AC_PATH_PROG(CHMOD,chmod)
|
|
AC_PATH_PROG(SORT,sort)
|
|
AC_CHECK_FUNCS(strerror)
|
|
|
|
dnl check mkdir behaviour, try to get mkdir -p -m 0755
|
|
RTEMS_PATH_MKDIR
|
|
RTEMS_PROG_MKDIR_M
|
|
RTEMS_PROG_MKDIR_P
|
|
test "$rtems_cv_prog_MKDIR_P" = "yes" && MKDIR="$MKDIR -p"
|
|
test "$rtems_cv_prog_MKDIR_M" = "yes" && MKDIR="$MKDIR -m 0755"
|
|
|
|
AC_PATH_PROG(TOUCH,touch)
|
|
AC_PATH_PROG(CMP,cmp)
|
|
|
|
AC_PATH_PROG(SED,sed)
|
|
AC_PATH_PROGS(M4,gm4 m4)
|
|
|
|
dnl NOTE: prefer bash over ksh over sh
|
|
AC_PATH_PROGS(KSH,bash ksh sh)
|
|
|
|
if test -z "$KSH"; then
|
|
dnl NOTE: This cannot happen -- /bin/sh must always exist
|
|
AC_MSG_ERROR(
|
|
[***]
|
|
[ Cannot determine a usable shell bash/ksh/sh]
|
|
[ Please contact your system administrator] );
|
|
fi
|
|
|
|
dnl END configure.host.in
|
|
|
|
dnl BEGIN configure.target.in
|
|
|
|
dnl echo "TARGET"
|
|
dnl echo " cpu --> $target_cpu"
|
|
dnl echo " os --> $target_os"
|
|
dnl echo " vendor --> $target_vendor"
|
|
|
|
dnl canonicalize target name
|
|
dnl NOTE: Most rtems targets do not fullfil autoconf
|
|
dnl targets naming conventions "processor-vendor-os"
|
|
dnl Therefore autoconf's AC_CANONICAL_TARGET will fail for them
|
|
dnl and we have to fix it for rtems ourselves
|
|
dnl
|
|
dnl The original plan was to do CPU-BSP-rtems or CPU-rtems to
|
|
dnl imply all BSPs. Eventually we would like to build a collection
|
|
dnl of CPU model specific RTEMS libraries which in conjunction with
|
|
dnl a BSP library would be used to link an application.
|
|
|
|
RTEMS_HOST=$host_os
|
|
|
|
case "${target}" in
|
|
# hpux unix port should go here
|
|
hppa1.1-rtems*)
|
|
target_cpu=hppa1_1
|
|
;;
|
|
i[[3456]]86-go32-rtems*)
|
|
target_cpu=i386
|
|
rtems_bsp="go32 go32_p5"
|
|
skip_startfiles="yes"
|
|
RTEMS_HAS_POSIX_API=no
|
|
;;
|
|
i[[3456]]86-rtems*)
|
|
target_cpu=i386
|
|
;;
|
|
i[[3456]]86-pc-linux*) # unix "simulator" port
|
|
target_cpu=unix
|
|
RTEMS_HAS_POSIX_API=no
|
|
RTEMS_HOST=Linux
|
|
;;
|
|
no_cpu-rtems*)
|
|
target_cpu=no_cpu
|
|
RTEMS_HAS_POSIX_API=no
|
|
;;
|
|
powerpc-*tems*)
|
|
target_cpu=ppc
|
|
;;
|
|
sparc-sun-solaris*) # unix "simulator" port
|
|
target_cpu=unix
|
|
RTEMS_HAS_POSIX_API=no
|
|
RTEMS_HOST=Solaris
|
|
;;
|
|
*)
|
|
RTEMS_CANONICAL_TARGET_CPU
|
|
;;
|
|
esac
|
|
|
|
# Override the set of BSPs to be built.
|
|
AC_ARG_ENABLE(rtemsbsp, \
|
|
[ --enable-rtemsbsp=bsp1 bsp2 .. BSPs to include in build], \
|
|
rtems_bsp=$enableval \
|
|
)
|
|
|
|
# Is this a supported CPU?
|
|
AC_MSG_CHECKING([if cpu $target_cpu is supported])
|
|
if test -d "$srcdir/c/src/exec/score/cpu/$target_cpu"; then
|
|
AC_MSG_RESULT(yes)
|
|
makefiles="$makefiles c/src/exec/score/cpu/$target_cpu/Makefile"
|
|
else
|
|
AC_MSG_ERROR(no)
|
|
fi
|
|
|
|
# find all the Executive Makefiles
|
|
RTEMS_CHECK_MAKEFILE(c/src/exec/score/tools/$target_cpu)
|
|
RTEMS_CHECK_MAKEFILE(c/src/exec/rtems)
|
|
RTEMS_CHECK_MAKEFILE(c/src/exec/sapi)
|
|
|
|
if test "$RTEMS_HAS_POSIX_API" = "yes"; then
|
|
RTEMS_CHECK_MAKEFILE(c/src/exec/posix)
|
|
makefiles="$makefiles c/src/exec/wrapup/posix/Makefile"
|
|
fi
|
|
|
|
# find all the Makefiles for the BSPs
|
|
if test -d "$srcdir/c/src/lib/libbsp/$target_cpu"; then
|
|
makefiles="$makefiles c/src/lib/libbsp/$target_cpu/Makefile"
|
|
|
|
if test -z "$rtems_bsp"; then
|
|
AC_MSG_CHECKING([for bsps])
|
|
files=`ls $srcdir/c/src/lib/libbsp/$target_cpu`
|
|
for file in $files; do
|
|
case $file in
|
|
shared*);;
|
|
Makefile*);;
|
|
READ*);;
|
|
CVS*);;
|
|
pxfl*);;
|
|
go32*);; # so the i386 port can pick up the other Makefiles
|
|
# Now account for BSPs with build variants
|
|
gen68360) rtems_bsp="$rtems_bsp gen68360 gen68360_040";;
|
|
p4000) rtems_bsp="$rtems_bsp p4600 p4650";;
|
|
mvme162) rtems_bsp="$rtems_bsp mvme162 mvme162lx";;
|
|
*) rtems_bsp="$rtems_bsp $file";;
|
|
esac;
|
|
done
|
|
|
|
AC_MSG_RESULT([$rtems_bsp done])
|
|
fi
|
|
|
|
# collect makefiles for each bsp
|
|
for i in $rtems_bsp; do
|
|
# make sure there is a make/custom file for the bsp
|
|
if test ! -r "$srcdir/make/custom/${i}.cfg"; then
|
|
AC_MSG_ERROR([no make/custom/${i}.cfg file for BSP $i])
|
|
fi
|
|
|
|
# account for "aliased" bsps which share source code
|
|
case $i in
|
|
mvme162lx) bspdir=mvme162 ;; # mvme162 board variant
|
|
gen68360_040) bspdir=gen68360 ;; # 68360 in companion mode
|
|
go32_p5) bspdir=go32 ;; # go32 on Pentium class CPU
|
|
p4600) bspdir=p4000 ;; # p4000 board with IDT 4600
|
|
p4650) bspdir=p4000 ;; # p4000 board with IDT 4650
|
|
*) bspdir=$i;;
|
|
esac
|
|
|
|
# Is there code where there should be for this BSP?
|
|
if test -d "$srcdir/c/src/lib/libbsp/$target_cpu/$bspdir"; then
|
|
RTEMS_BSP_LIST="$RTEMS_BSP_LIST $i"
|
|
# make sure the Makefiles in a bsp directory are only done once
|
|
echo $bspdirs | grep $bspdir >/dev/null 2>&1
|
|
if test $? -ne 0 ; then
|
|
bspdirs="$bspdirs $bspdir"
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libbsp/$target_cpu/$bspdir)
|
|
fi
|
|
else
|
|
AC_MSG_ERROR([unable to find libbsp directory ($bspdir) for $i])
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# find all the CPU dependent library Makefiles
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libcpu/$target_cpu)
|
|
|
|
dnl Workaround for go32
|
|
if test "$skip_startfiles" != "yes"; then
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/start/$target_cpu)
|
|
fi
|
|
|
|
dnl END configure.target.in
|
|
|
|
|
|
#
|
|
# Target configurations are listed in alphabetical order.
|
|
# The BSPs for a target configuration are also listed in alphabetical order.
|
|
#
|
|
|
|
dnl NOTE: host_os is automatically set by autoconf
|
|
|
|
if [[ "${program_prefix}" = "NONE" ]] ; then
|
|
if [[ "${target}" = "${host}" ]] ; then
|
|
program_prefix=
|
|
else
|
|
program_prefix=${target}-
|
|
fi
|
|
fi
|
|
|
|
PROJECT_ROOT=`pwd;`
|
|
|
|
# If RTEMS macros are enabled, then use them. Otherwise, use inlines.
|
|
if test "$RTEMS_USE_MACROS" = "yes"; then
|
|
inline_dir=macros
|
|
if test "$RTEMS_HAS_POSIX_API" = "yes"; then
|
|
# The problem is that there is currently no code in posix/macros :)
|
|
AC_MSG_ERROR(Macros are not implemented for the POSIX API)
|
|
fi
|
|
else
|
|
inline_dir=inline
|
|
fi
|
|
|
|
# If the KA9Q TCP/IP stack is enabled, then find all KA9Q Makefiles
|
|
if test "$RTEMS_HAS_KA9Q" = "yes"; then
|
|
makefiles="$makefiles c/src/lib/libka9q/Makefile"
|
|
fi
|
|
|
|
# If the C++ support is enabled, then include the Makefiles
|
|
if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
|
|
makefiles="$makefiles c/src/lib/librtems++/Makefile"
|
|
fi
|
|
|
|
# If the tests are enabled, then find all the test suite Makefiles
|
|
AC_MSG_CHECKING([Are the test suites enabled? ])
|
|
tests_enabled=yes
|
|
AC_ARG_ENABLE(tests, \
|
|
[ --enable-tests enable tests], \
|
|
[case "${enableval}" in
|
|
yes) AC_MSG_RESULT(yes) ;;
|
|
no) AC_MSG_RESULT(no) ; tests_enabled=no ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for tests option) ;;
|
|
esac],
|
|
AC_MSG_RESULT(yes)
|
|
)
|
|
|
|
if test "$tests_enabled" = "yes"; then
|
|
RTEMS_CHECK_MAKEFILE(c/src/tests/tools/$target_cpu)
|
|
RTEMS_CHECK_MAKEFILE(c/src/tests/libtests)
|
|
RTEMS_CHECK_MAKEFILE(c/src/tests/sptests)
|
|
RTEMS_CHECK_MAKEFILE(c/src/tests/tmtests)
|
|
RTEMS_CHECK_MAKEFILE(c/src/tests/mptests)
|
|
if test "$RTEMS_HAS_POSIX" = "yes"; then
|
|
RTEMS_CHECK_MAKEFILE(c/src/tests/psxtests)
|
|
fi
|
|
fi
|
|
|
|
# If the HWAPI is enabled, the find the HWAPI Makefiles
|
|
AC_MSG_CHECKING([Is the HWAPI enabled? ])
|
|
AC_ARG_ENABLE(hwapi, \
|
|
[ --enable-hwapi enable hardware API library], \
|
|
[case "${enableval}" in
|
|
yes) AC_MSG_RESULT(yes)
|
|
if test -f ${srcdir}/c/src/lib/libhwapi/Makefile.in ; then
|
|
makefiles="$makefiles c/src/lib/libhwapi/Makefile"
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/analog)
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/discrete)
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/drivers)
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/non_volatile_memory)
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/serial)
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/support)
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libhwapi/wrapup)
|
|
else
|
|
AC_MSG_ERROR(No source code found for the HWAPI)
|
|
fi
|
|
;;
|
|
no) AC_MSG_RESULT(no) ;;
|
|
*) AC_MSG_ERROR(bad value ${enableval} for hwapi option) ;;
|
|
esac],
|
|
AC_MSG_RESULT(no)
|
|
)
|
|
|
|
AC_SUBST(RTEMS_BSP_LIST)
|
|
AC_SUBST(RTEMS_HOST)
|
|
AC_SUBST(RTEMS_LIBC_DIR)
|
|
AC_SUBST(RTEMS_USE_OWN_PDIR)
|
|
AC_SUBST(RTEMS_HAS_POSIX_API)
|
|
AC_SUBST(RTEMS_HAS_KA9Q)
|
|
AC_SUBST(RTEMS_USE_MACROS)
|
|
AC_SUBST(RTEMS_HAS_CPLUSPLUS)
|
|
AC_SUBST(RTEMS_USE_GCC272)
|
|
AC_SUBST(RTEMS_LIBC_DIR)
|
|
AC_SUBST(PROJECT_ROOT)
|
|
AC_SUBST(program_prefix)
|
|
|
|
# pick up all the Makefiles in required parts of the tree
|
|
RTEMS_CHECK_MAKEFILE(c/build-tools)
|
|
RTEMS_CHECK_MAKEFILE(make)
|
|
RTEMS_CHECK_MAKEFILE(c/src/lib/libmisc)
|
|
RTEMS_CHECK_MAKEFILE(c/src/tests/samples)
|
|
|
|
AC_CONFIG_HEADER(c/build-tools/src/config.h)
|
|
|
|
AC_CONFIG_HEADER(c/build-tools/src/config.h)
|
|
|
|
# try not to explicitly list a Makefile here
|
|
AC_OUTPUT(
|
|
Makefile
|
|
c/Makefile
|
|
c/src/Makefile
|
|
c/src/exec/Makefile
|
|
c/src/exec/score/Makefile
|
|
c/src/exec/score/cpu/Makefile
|
|
c/src/exec/score/headers/Makefile
|
|
c/src/exec/score/${inline_dir}/Makefile
|
|
c/src/exec/score/src/Makefile
|
|
c/src/exec/score/tools/Makefile
|
|
c/src/exec/score/tools/generic/Makefile
|
|
c/src/exec/score/tools/generic/size_rtems
|
|
c/src/exec/wrapup/Makefile
|
|
c/src/exec/wrapup/rtems/Makefile
|
|
c/src/lib/Makefile
|
|
c/src/lib/include/Makefile
|
|
c/src/lib/libbsp/Makefile
|
|
c/src/lib/libbsp/shmdr/Makefile
|
|
c/src/lib/libc/Makefile
|
|
c/src/lib/libcpu/Makefile
|
|
c/src/lib/start/Makefile
|
|
c/src/lib/wrapup/Makefile
|
|
c/src/tests/Makefile
|
|
c/src/tests/support/Makefile
|
|
c/src/tests/support/include/Makefile
|
|
c/src/tests/support/stubdr/Makefile
|
|
c/src/tests/support/wrapup/Makefile
|
|
c/src/tests/tools/Makefile
|
|
c/src/tests/tools/generic/Makefile
|
|
$makefiles
|
|
make/host.cfg
|
|
make/target.cfg
|
|
make/Templates/Makefile.inc
|
|
c/update-tools/Makefile)
|
|
|
|
echo
|
|
echo target architecture: $target_cpu.
|
|
echo available BSPs: $rtems_bsp.
|
|
echo \'make all\' will build the following BSPs: $RTEMS_BSP_LIST.
|
|
echo other BSPs can be built with \'make RTEMS_BSP=\"bsp1 bsp2 ...\"\'
|
|
echo
|