summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 8f30c9847a734a3accf3426b98579ca7c5f57f34 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
dnl Process this file with autoconf to produce a configure script.
dnl
dnl  $Id$

AC_PREREQ(2.13)
AC_INIT(c)
RTEMS_TOP(.)

# Abort if trying to build inside of the source tree.
if test -f VERSION; then
  rm -f config.cache config.log confdefs.h
  AC_MSG_ERROR([***]
    [Attempt to build inside of the source tree]
    [Please use a separate build directory, instead] )
fi

AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(cross,0,no)
AM_MAINTAINER_MODE

dnl These option are only in here to let --help report all supported
dnl options.
RTEMS_ENABLE_MULTIPROCESSING
RTEMS_ENABLE_POSIX
RTEMS_ENABLE_ITRON
RTEMS_ENABLE_NETWORKING
RTEMS_ENABLE_RDBG
RTEMS_ENABLE_INLINES
RTEMS_ENABLE_CXX
RTEMS_ENABLE_GCC28
RTEMS_ENABLE_LIBCDIR
RTEMS_ENABLE_TESTS  
RTEMS_ENABLE_RTEMS_DEBUG

# these tools are built for the build environment
#
build_tools="tools/build tools/update tools/cpu"

# these libraries are used for the host environment
#
host_libs=""

# these tools are built for the host environment
#
host_tools=""

# these libraries are built for the target environment, and are built after
# the host libraries and the host tools (which may be a cross compiler)
#
target_libs="c"

# these tools are built using the target libs, and are intended to run only
# in the target environment
#
target_tools=""

## All tools belong in one of the four categories, and are assigned above
## We assign ${configdirs} this way to remove all embedded newlines.  This
## is important because configure will choke if they ever get through.
## ${configdirs} is directories we build using the host tools.
## ${target_configdirs} is directories we build using the target tools.
#
configdirs="${host_libs} ${host_tools}"
AC_SUBST(configdirs)

target_configdirs="${target_libs} ${target_tools}"
AC_SUBST(target_configdirs)

# Record target_configdirs and the configure arguments in Makefile.
targargs=`echo "${ac_configure_args}" | \
        sed -e 's/--no[^ 	]*//' \
            -e 's/--cache[a-z-]*=[^ 	]*//' \
            -e 's/--ho[a-z-]*=[^ 	]*//' \
            -e 's/--bu[a-z-]*=[^ 	]*//' \
            -e 's/--ta[a-z-]*=[^ 	]*//'`;

targargs="--host=${target_alias} --build=${build} ${targargs}"
AC_SUBST(targargs)

target_subdir=${target_alias}

changequote(,)dnl
if test $target = $host; 
then
  HOST_SUBDIRS="$configdirs $target_configdirs"
  TARGET_SUBDIRS=""
else
  HOST_SUBDIRS="$configdirs"
  TARGET_SUBDIRS=`echo "$target_configdirs" | \
    sed -e "s%\([^ ]\+\)%$target_alias/\1%g"`
fi
changequote([,])dnl

if test $host = $build;
then
  HOST_SUBDIRS="$build_tools $HOST_SUBDIRS"
else
  build_configdirs="$build_tools"
fi

AC_CONFIG_SUBDIRS($HOST_SUBDIRS)
AC_SUBST(TARGET_SUBDIRS)
AC_SUBST(HOST_SUBDIRS)

AC_OUTPUT(
Makefile
tools/Makefile
make/Makefile
make/custom/Makefile
make/Templates/Makefile
make/compilers/Makefile 
doc/Makefile)

if test "$no_recursion" != yes; then

 if test $target != $host; then
  # Remove --srcdir arguments so they do not pile up.
  ac_sub_configure_args=
  ac_prev=
  for ac_arg in $targargs; do
    if test -n "$ac_prev"; then
      ac_prev=
      continue
    fi
    case "$ac_arg" in
    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
      ac_prev=srcdir ;;
    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
      ;;
    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
    esac
  done

  test -d $target_subdir || mkdir $target_subdir
  for ac_config_dir in $target_configdirs; do
    # Do not complain, so a configure script can configure whichever
    # parts of a large source tree are present.
    if test ! -d $srcdir/$ac_config_dir; then
      continue
    fi

    echo configuring in $target_subdir/$ac_config_dir

    case "$srcdir" in
    .) ;;
    *)
      if test -d $target_subdir/$ac_config_dir || mkdir $target_subdir/$ac_config_dir; then :;
      else
        AC_MSG_ERROR(can not create `pwd`/$target_subdir/$ac_config_dir)
      fi
      ;;
    esac

    ac_popdir=`pwd`
    cd $target_subdir/$ac_config_dir

changequote(, )dnl
      # A "../" for each directory in /$ac_config_dir.
      ac_dots=`echo $target_subdir/$ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
changequote([, ])dnl

    case "$srcdir" in
    .) # No --srcdir option.  We are building in place.
      ac_sub_srcdir=$srcdir ;;
    /*) # Absolute path.
      ac_sub_srcdir=$srcdir/$ac_config_dir ;;
    *) # Relative path.
      ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
    esac

    # Check for configure
    if test -f $ac_sub_srcdir/configure; then
      ac_sub_configure=$ac_sub_srcdir/configure
    else
      AC_MSG_WARN(no configuration information is in $ac_config_dir)
      ac_sub_configure=
    fi

    # The recursion is here.
    if test -n "$ac_sub_configure"; then

      # Make the cache file name correct relative to the subdirectory.
      ac_sub_cache_file=$cache_file
ifdef([AC_PROVIDE_AC_PROG_INSTALL],
      [  case "$ac_given_INSTALL" in
changequote(, )dnl
        [/$]*) INSTALL="$ac_given_INSTALL" ;;
changequote([, ])dnl
        *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
        esac
])dnl

      echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
      # The eval makes quoting arguments work.
      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure \
	$ac_sub_configure_args --srcdir=$ac_sub_srcdir \
	--with-target-subdir=$target_subdir \
	--cache-file=$ac_sub_cache_file \
	--libdir='${exec_prefix}'/$target_alias/lib
      then :
      else
        AC_MSG_ERROR($ac_sub_configure failed for $ac_config_dir)
      fi
    fi

    cd $ac_popdir
  done
 fi

 if test $build != $host; then
  # Remove --srcdir arguments so they do not pile up.
  ac_sub_configure_args=
  ac_prev=
  for ac_arg in $targargs; do
    if test -n "$ac_prev"; then
      ac_prev=
      continue
    fi
    case "$ac_arg" in
    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
      ac_prev=srcdir ;;
    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
      ;;
    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
    esac
  done

#  test -d $target_subdir || mkdir $target_subdir
  for ac_config_dir in $build_configdirs; do
    # Do not complain, so a configure script can configure whichever
    # parts of a large source tree are present.
    if test ! -d $srcdir/$ac_config_dir; then
      continue
    fi

    echo configuring in $ac_config_dir

    case "$srcdir" in
    .) ;;
    *)
      if test -d $ac_config_dir || mkdir $ac_config_dir; then :;
      else
        AC_MSG_ERROR(can not create `pwd`/$ac_config_dir)
      fi
      ;;
    esac

    ac_popdir=`pwd`
    cd $ac_config_dir

changequote(, )dnl
      # A "../" for each directory in /$ac_config_dir.
      ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'`
changequote([, ])dnl

    case "$srcdir" in
    .) # No --srcdir option.  We are building in place.
      ac_sub_srcdir=$srcdir ;;
    /*) # Absolute path.
      ac_sub_srcdir=$srcdir/$ac_config_dir ;;
    *) # Relative path.
      ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;;
    esac

    # Check for configure
    if test -f $ac_sub_srcdir/configure; then
      ac_sub_configure=$ac_sub_srcdir/configure
    else
      AC_MSG_WARN(no configuration information is in $ac_config_dir)
      ac_sub_configure=
    fi

    # The recursion is here.
    if test -n "$ac_sub_configure"; then

      # Make the cache file name correct relative to the subdirectory.
      ac_sub_cache_file=$cache_file
ifdef([AC_PROVIDE_AC_PROG_INSTALL],
      [  case "$ac_given_INSTALL" in
changequote(, )dnl
        [/$]*) INSTALL="$ac_given_INSTALL" ;;
changequote([, ])dnl
        *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
        esac
])dnl

      echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
      # The eval makes quoting arguments work.
      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure \
	$ac_sub_configure_args --srcdir=$ac_sub_srcdir \
	--cache-file=$ac_sub_cache_file \
        --build=$build --host=$build
      then :
      else
        AC_MSG_ERROR($ac_sub_configure failed for $ac_config_dir)
      fi
    fi

    cd $ac_popdir
  done
 fi
fi