summaryrefslogtreecommitdiffstats
path: root/aclocal.m4
blob: e8f71d16ad626ad6aa734faa6279041d3d5f4af4 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
dnl some macros for rtems host configuration checks
dnl
dnl Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de), 97/11/09
dnl

dnl macro to detect mkdir
AC_DEFUN(RTEMS_PATH_MKDIR,
[AC_PATH_PROG(MKDIR,mkdir)
])

dnl macro to check for mkdir -p
AC_DEFUN(RTEMS_PROG_MKDIR_P,
[
AC_REQUIRE([RTEMS_PATH_MKDIR])
AC_MSG_CHECKING([for working $MKDIR -p])
AC_CACHE_VAL(rtems_cv_prog_mkdir_p,
[rm -rf conftestdata
if $MKDIR -p conftestdata 2>/dev/null ;then
rtems_cv_prog_MKDIR_P="yes"
else
rtems_cv_prog_MKDIR_P="no"
fi])dnl
rm -rf conftestdata
AC_MSG_RESULT($rtems_cv_prog_MKDIR_P)
])

dnl macro to check for mkdir -m 0755
AC_DEFUN(RTEMS_PROG_MKDIR_M,
[
AC_REQUIRE([RTEMS_PATH_MKDIR])
AC_MSG_CHECKING([for working $MKDIR -m 0755])
AC_CACHE_VAL(rtems_cv_prog_MKDIR_P,
[rm -rf conftestdata
if $MKDIR -m 0775 conftestdata 2>/dev/null; then
rtems_cv_prog_MKDIR_M="yes"
else
rtems_cv_prog_MKDIR_M="no"
fi])dnl
rm -rf conftestdata
AC_MSG_RESULT($rtems_cv_prog_MKDIR_M)
])

dnl RTEMS_CHECK_MAKEFILE_T(path)
dnl Private macro of RTEMS_CHECK_MAKEFILE
AC_DEFUN(RTEMS_CHECK_MAKEFILE_T,
[ test -f $srcdir/$1/Makefile.in && \
    makefiles="$makefiles $1/Makefile"
])

dnl RTEMS_CHECK_MAKEFILE_R(path,temp,callback)
dnl Private macro of RTEMS_CHECK_MAKEFILE
dnl $1 path prefix
dnl $2 temporary variable
dnl $3 callback
AC_DEFUN(RTEMS_CHECK_MAKEFILE_R,
[ RTEMS_CHECK_MAKEFILE_T($1)
  $2list=`ls $srcdir/$1`
  for $2 in $$2list; do
    if test -d "$srcdir/$1/$$2"; then
      $3
    fi
  done
])

dnl RTEMS_CHECK_MAKEFILE(path)
dnl Check for Makefile.in's within the directory starting
dnl at path and append an entry for Makefile to global variable 
dnl "makefiles" (from configure.in) for each Makefile.in found
dnl 
dnl NOTE: This function should be called recursivly, but m4-macro
dnl expansion doesn't allow recursive macros. Therefore this
dnl macro is expanded into a nonrecursive macro, limited to
dnl a descrete directory depth, that should be sufficent.
dnl 
AC_DEFUN(RTEMS_CHECK_MAKEFILE,
[ AC_MSG_CHECKING(for Makefiles in $1)
  if test -d $srcdir/$1; then
    RTEMS_CHECK_MAKEFILE_R($1,item,
      RTEMS_CHECK_MAKEFILE_R($1/$item,item0,
        RTEMS_CHECK_MAKEFILE_T($1/$item/$item0)
      )
    )
    AC_MSG_RESULT(done)
  else
    AC_MSG_RESULT(no)
  fi
])

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 

AC_DEFUN(RTEMS_CANONICAL_TARGET_CPU,
[AC_MSG_CHECKING(rtems target cpu)
changequote(<<, >>)dnl
target_cpu=`echo $target | /usr/bin/sed 's%^\([^-]*\)-\(.*\)$%\1%'`
changequote([, ])dnl
AC_MSG_RESULT($target_cpu)
])