summaryrefslogtreecommitdiffstats
path: root/cpukit/aclocal/env-rtemscpu.m4
blob: d5e27bf8b96b9bf455052c32a8278f435c440540 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
dnl $Id$

# PROJECT_ROOT .. Directory to put the temporary installed files into

# FIXME: to be revisited - featureladden, bloated 
AC_DEFUN([RTEMS_ENV_RTEMSCPU],
[
  AC_REQUIRE([RTEMS_ENABLE_MULTILIB])

  # RTEMS_TOPdir points to the top of RTEMS source tree
  # cpukit_topdir points to the top of the cpukit source tree
  cpukit_topdir="/${RTEMS_TOPdir}/"

  AS_IF([test -n "$enable_rtemsbsp"],
  [ # Per BSP
    AC_ARG_VAR([CPU_CFLAGS],[])
    AC_ARG_VAR([CFLAGS_OPTIMIZE_V],
      [CFLAGS for building the optimized variant])
    AC_ARG_VAR([CFLAGS_DEBUG_V],
      [CFLAGS for building the debugging variant])
 
    AC_MSG_CHECKING([for RTEMS_BSP])
    AC_CACHE_VAL(rtems_cv_RTEMS_BSP,[
      test -n "${RTEMS_BSP}" && rtems_cv_RTEMS_BSP="$enable_rtemsbsp"
    ])
    AS_IF([test -z "$rtems_cv_RTEMS_BSP"],[
      AC_MSG_ERROR([Missing RTEMS_BSP])
    ])
    RTEMS_BSP="$rtems_cv_RTEMS_BSP"
    AC_MSG_RESULT(${RTEMS_BSP})

    test x"${with_project_root}" = x && with_project_root=".";
    case x${with_project_root} in
    x[[\\/]]* | x?:[[\\/]]* ) # absolute dir
      PROJECT_ROOT="${with_project_root}"
      ;;
    x* ) # relative dir
      PROJECT_ROOT="\$(top_builddir)${cpukit_topdir}${with_project_root}"
      ;;
    esac

    PROJECT_ROOT="${PROJECT_ROOT}/$RTEMS_BSP"
    AC_SUBST([PROJECT_INCLUDE],["${PROJECT_ROOT}/lib/include"])
    AC_SUBST([PROJECT_LIB],["${PROJECT_ROOT}/lib"])

    includedir="\${exec_prefix}/${RTEMS_BSP}/lib/include"
    libdir="\${exec_prefix}/${RTEMS_BSP}/lib"
  ],[
    AS_IF([test x"$multilib" = x"yes"],
    [
      AS_IF([test -n "$with_multisubdir"],
        [MULTIBUILDTOP=`echo "/$with_multisubdir" | sed 's,/[[^\\/]]*,../,g'`])
      AC_SUBST(MULTIBUILDTOP)
 
      AS_IF([test -n "$with_multisubdir"],
        [MULTISUBDIR="/$with_multisubdir"])
      AC_SUBST(MULTISUBDIR)

      PROJECT_ROOT="\$(top_builddir)${cpukit_topdir}../\$(MULTIBUILDTOP)"

      AC_SUBST([PROJECT_INCLUDE],["${PROJECT_ROOT}lib/include"])
      AC_SUBST([PROJECT_LIB],["${PROJECT_ROOT}lib\$(MULTISUBDIR)"])

      includedir="\${exec_prefix}/include"
      libdir="${libdir}\$(MULTISUBDIR)"
    ],[
      PROJECT_ROOT="\$(top_builddir)${cpukit_topdir}"

      AC_SUBST([PROJECT_INCLUDE],["${PROJECT_ROOT}lib/include"])
      AC_SUBST([PROJECT_LIB],["${PROJECT_ROOT}lib\$(MULTISUBDIR)"])

      includedir="\${exec_prefix}/include"
      libdir="${libdir}\$(MULTISUBDIR)"
    ])
  ])

  AC_SUBST([project_libdir],["\$(libdir)"])
  AC_SUBST([project_includedir],["\$(includedir)"])

  AC_SUBST(PROJECT_ROOT)

  AM_CONDITIONAL([MULTILIB],[test x"$multilib" = x"yes"])
])