[8166684] | 1 | #### THIS IS NOT gcc's config-ml.in #### |
---|
| 2 | |
---|
| 3 | # 2002-07-06 Imported from from gcc-3.1 |
---|
| 4 | |
---|
[05f5bf2] | 5 | # Configure fragment invoked in the post-target section for subdirs |
---|
| 6 | # wanting multilib support. |
---|
| 7 | # |
---|
| 8 | # It is advisable to support a few --enable/--disable options to let the |
---|
| 9 | # user select which libraries s/he really wants. |
---|
| 10 | # |
---|
| 11 | # Subdirectories wishing to use multilib should put the following lines |
---|
| 12 | # in the "post-target" section of configure.in. |
---|
| 13 | # |
---|
| 14 | # if [ "${srcdir}" = "." ] ; then |
---|
| 15 | # if [ "${with_target_subdir}" != "." ] ; then |
---|
| 16 | # . ${with_multisrctop}../../config-ml.in |
---|
| 17 | # else |
---|
| 18 | # . ${with_multisrctop}../config-ml.in |
---|
| 19 | # fi |
---|
| 20 | # else |
---|
| 21 | # . ${srcdir}/../config-ml.in |
---|
| 22 | # fi |
---|
| 23 | # |
---|
| 24 | # |
---|
| 25 | # Things are complicated because 6 separate cases must be handled: |
---|
| 26 | # 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6. |
---|
| 27 | # |
---|
| 28 | # srcdir=. is special. It must handle make programs that don't handle VPATH. |
---|
| 29 | # To implement this, a symlink tree is built for each library and for each |
---|
| 30 | # multilib subdir. |
---|
| 31 | # |
---|
| 32 | # The build tree is layed out as |
---|
| 33 | # |
---|
| 34 | # ./ |
---|
| 35 | # newlib |
---|
| 36 | # m68020/ |
---|
| 37 | # newlib |
---|
| 38 | # m68881/ |
---|
| 39 | # newlib |
---|
| 40 | # |
---|
| 41 | # The nice feature about this arrangement is that inter-library references |
---|
| 42 | # in the build tree work without having to care where you are. Note that |
---|
| 43 | # inter-library references also work in the source tree because symlink trees |
---|
| 44 | # are built when srcdir=. |
---|
| 45 | # |
---|
| 46 | # Unfortunately, trying to access the libraries in the build tree requires |
---|
| 47 | # the user to manually choose which library to use as GCC won't be able to |
---|
| 48 | # find the right one. This is viewed as the lesser of two evils. |
---|
| 49 | # |
---|
| 50 | # Configure variables: |
---|
| 51 | # ${with_target_subdir} = "." for native, or ${target_alias} for cross. |
---|
| 52 | # Set by top level Makefile. |
---|
| 53 | # ${with_multisrctop} = how many levels of multilibs there are in the source |
---|
| 54 | # tree. It exists to handle the case of configuring in the source tree: |
---|
| 55 | # ${srcdir} is not constant. |
---|
| 56 | # ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881). |
---|
| 57 | # |
---|
| 58 | # Makefile variables: |
---|
| 59 | # MULTISRCTOP = number of multilib levels in source tree (+1 if cross) |
---|
| 60 | # (FIXME: note that this is different than ${with_multisrctop}. Check out.). |
---|
| 61 | # MULTIBUILDTOP = number of multilib levels in build tree |
---|
| 62 | # MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...) |
---|
| 63 | # (only defined in each library's main Makefile). |
---|
| 64 | # MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000) |
---|
| 65 | # (only defined in each multilib subdir). |
---|
| 66 | |
---|
| 67 | # FIXME: Multilib is currently disabled by default for everything other than |
---|
| 68 | # newlib. It is up to each target to turn on multilib support for the other |
---|
| 69 | # libraries as desired. |
---|
| 70 | |
---|
| 71 | # We have to handle being invoked by both Cygnus configure and Autoconf. |
---|
| 72 | # |
---|
| 73 | # Cygnus configure incoming variables: |
---|
| 74 | # srcdir, subdir, host, arguments |
---|
| 75 | # |
---|
| 76 | # Autoconf incoming variables: |
---|
| 77 | # srcdir, host, ac_configure_args |
---|
| 78 | # |
---|
| 79 | # We *could* figure srcdir and host out, but we'd have to do work that |
---|
| 80 | # our caller has already done to figure them out and requiring these two |
---|
| 81 | # seems reasonable. |
---|
| 82 | # Note that `host' in this case is GCC's `target'. Target libraries are |
---|
| 83 | # configured for a particular host. |
---|
| 84 | |
---|
| 85 | if [ -n "${ac_configure_args}" ]; then |
---|
| 86 | Makefile=${ac_file-Makefile} |
---|
| 87 | ml_config_shell=${CONFIG_SHELL-/bin/sh} |
---|
| 88 | ml_arguments="${ac_configure_args}" |
---|
| 89 | ml_realsrcdir=${srcdir} |
---|
| 90 | else |
---|
| 91 | Makefile=${Makefile-Makefile} |
---|
| 92 | ml_config_shell=${config_shell-/bin/sh} |
---|
| 93 | ml_arguments="${arguments}" |
---|
| 94 | if [ -n "${subdir}" -a "${subdir}" != "." ] ; then |
---|
| 95 | ml_realsrcdir=${srcdir}/${subdir} |
---|
| 96 | else |
---|
| 97 | ml_realsrcdir=${srcdir} |
---|
| 98 | fi |
---|
| 99 | fi |
---|
| 100 | |
---|
| 101 | # Scan all the arguments and set all the ones we need. |
---|
| 102 | |
---|
| 103 | ml_verbose=--verbose |
---|
| 104 | for option in ${ml_arguments} |
---|
| 105 | do |
---|
| 106 | case $option in |
---|
| 107 | --*) ;; |
---|
| 108 | -*) option=-$option ;; |
---|
| 109 | esac |
---|
| 110 | |
---|
| 111 | case $option in |
---|
| 112 | --*=*) |
---|
| 113 | optarg=`echo $option | sed -e 's/^[^=]*=//'` |
---|
| 114 | ;; |
---|
| 115 | esac |
---|
| 116 | |
---|
| 117 | case $option in |
---|
| 118 | --disable-*) |
---|
| 119 | enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` |
---|
| 120 | eval $enableopt=no |
---|
| 121 | ;; |
---|
| 122 | --enable-*) |
---|
| 123 | case "$option" in |
---|
| 124 | *=*) ;; |
---|
| 125 | *) optarg=yes ;; |
---|
| 126 | esac |
---|
| 127 | enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` |
---|
| 128 | eval $enableopt="$optarg" |
---|
| 129 | ;; |
---|
| 130 | --norecursion | --no*) |
---|
| 131 | ml_norecursion=yes |
---|
| 132 | ;; |
---|
| 133 | --silent | --sil* | --quiet | --q*) |
---|
| 134 | ml_verbose=--silent |
---|
| 135 | ;; |
---|
| 136 | --verbose | --v | --verb*) |
---|
| 137 | ml_verbose=--verbose |
---|
| 138 | ;; |
---|
| 139 | --with-*) |
---|
| 140 | case "$option" in |
---|
| 141 | *=*) ;; |
---|
| 142 | *) optarg=yes ;; |
---|
| 143 | esac |
---|
| 144 | withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` |
---|
| 145 | eval $withopt="$optarg" |
---|
| 146 | ;; |
---|
| 147 | --without-*) |
---|
| 148 | withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` |
---|
| 149 | eval $withopt=no |
---|
| 150 | ;; |
---|
| 151 | esac |
---|
| 152 | done |
---|
| 153 | |
---|
| 154 | # Only do this if --enable-multilib. |
---|
| 155 | if [ "${enable_multilib}" = yes ]; then |
---|
| 156 | |
---|
| 157 | # Compute whether this is the library's top level directory |
---|
| 158 | # (ie: not a multilib subdirectory, and not a subdirectory like newlib/src). |
---|
| 159 | # ${with_multisubdir} tells us we're in the right branch, but we could be |
---|
| 160 | # in a subdir of that. |
---|
| 161 | # ??? The previous version could void this test by separating the process into |
---|
| 162 | # two files: one that only the library's toplevel configure.in ran (to |
---|
| 163 | # configure the multilib subdirs), and another that all configure.in's ran to |
---|
| 164 | # update the Makefile. It seemed reasonable to collapse all multilib support |
---|
| 165 | # into one file, but it does leave us with having to perform this test. |
---|
| 166 | ml_toplevel_p=no |
---|
| 167 | if [ -z "${with_multisubdir}" ]; then |
---|
| 168 | if [ "${srcdir}" = "." ]; then |
---|
| 169 | # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. |
---|
| 170 | # ${with_target_subdir} = "." for native, otherwise target alias. |
---|
| 171 | if [ "${with_target_subdir}" = "." ]; then |
---|
| 172 | if [ -f ${ml_realsrcdir}/../config-ml.in ]; then |
---|
| 173 | ml_toplevel_p=yes |
---|
| 174 | fi |
---|
| 175 | else |
---|
| 176 | if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then |
---|
| 177 | ml_toplevel_p=yes |
---|
| 178 | fi |
---|
| 179 | fi |
---|
| 180 | else |
---|
| 181 | # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. |
---|
| 182 | if [ -f ${ml_realsrcdir}/../config-ml.in ]; then |
---|
| 183 | ml_toplevel_p=yes |
---|
| 184 | fi |
---|
| 185 | fi |
---|
| 186 | fi |
---|
| 187 | |
---|
| 188 | # If this is the library's top level directory, set multidirs to the |
---|
| 189 | # multilib subdirs to support. This lives at the top because we need |
---|
| 190 | # `multidirs' set right away. |
---|
| 191 | |
---|
| 192 | if [ "${ml_toplevel_p}" = yes ]; then |
---|
| 193 | |
---|
| 194 | multidirs= |
---|
| 195 | for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do |
---|
| 196 | dir=`echo $i | sed -e 's/;.*$//'` |
---|
| 197 | if [ "${dir}" = "." ]; then |
---|
| 198 | true |
---|
| 199 | else |
---|
| 200 | if [ -z "${multidirs}" ]; then |
---|
| 201 | multidirs="${dir}" |
---|
| 202 | else |
---|
| 203 | multidirs="${multidirs} ${dir}" |
---|
| 204 | fi |
---|
| 205 | fi |
---|
| 206 | done |
---|
| 207 | |
---|
| 208 | # Target libraries are configured for the host they run on, so we check |
---|
| 209 | # $host here, not $target. |
---|
| 210 | |
---|
[8166684] | 211 | # BEGIN - RTEMS specific |
---|
| 212 | # |
---|
| 213 | # Prune multilib variants RTEMS does not support |
---|
[05f5bf2] | 214 | case "${host}" in |
---|
[8166684] | 215 | arm-*-rtems*) |
---|
[05f5bf2] | 216 | old_multidirs=${multidirs} |
---|
| 217 | multidirs="" |
---|
| 218 | for x in ${old_multidirs}; do |
---|
| 219 | case "${x}" in |
---|
[8166684] | 220 | *thumb*) : ;; |
---|
[05f5bf2] | 221 | *) multidirs="${multidirs} ${x}" ;; |
---|
| 222 | esac |
---|
| 223 | done |
---|
| 224 | ;; |
---|
[8166684] | 225 | |
---|
| 226 | sh-*-rtems*) |
---|
[05f5bf2] | 227 | old_multidirs=${multidirs} |
---|
| 228 | multidirs="" |
---|
| 229 | for x in ${old_multidirs}; do |
---|
| 230 | case "${x}" in |
---|
[8166684] | 231 | *m3e*) : ;; |
---|
| 232 | *m4-single*) : ;; |
---|
| 233 | m4*) : ;; |
---|
[05f5bf2] | 234 | *) multidirs="${multidirs} ${x}" ;; |
---|
| 235 | esac |
---|
| 236 | done |
---|
| 237 | ;; |
---|
[8166684] | 238 | esac |
---|
| 239 | # END - RTEMS specific |
---|
| 240 | |
---|
| 241 | case "${host}" in |
---|
[05f5bf2] | 242 | mips*-*-*) |
---|
| 243 | case " $multidirs " in |
---|
| 244 | *" mabi=64 "*) |
---|
| 245 | # We will not be able to create libraries with -mabi=64 if |
---|
| 246 | # we cannot even link a trivial program. It usually |
---|
| 247 | # indicates the 64bit libraries are missing. |
---|
| 248 | if echo 'main() {}' > conftest.c && |
---|
| 249 | ${CC-gcc} -mabi=64 conftest.c -o conftest; then |
---|
| 250 | : |
---|
| 251 | else |
---|
| 252 | echo Could not link program with -mabi=64, disabling it. |
---|
| 253 | old_multidirs="${multidirs}" |
---|
| 254 | multidirs="" |
---|
| 255 | for x in ${old_multidirs}; do |
---|
| 256 | case "$x" in |
---|
| 257 | *mabi=64* ) : ;; |
---|
| 258 | *) multidirs="${multidirs} ${x}" ;; |
---|
| 259 | esac |
---|
| 260 | done |
---|
| 261 | fi |
---|
| 262 | rm -f conftest.c conftest |
---|
| 263 | ;; |
---|
| 264 | esac |
---|
| 265 | ;; |
---|
| 266 | sparc*-*-*) |
---|
| 267 | case " $multidirs " in |
---|
| 268 | *" m64 "*) |
---|
| 269 | # We will not be able to create libraries with -m64 if |
---|
| 270 | # we cannot even link a trivial program. It usually |
---|
| 271 | # indicates the 64bit libraries are missing. |
---|
| 272 | if echo 'main() {}' > conftest.c && |
---|
| 273 | ${CC-gcc} -m64 conftest.c -o conftest; then |
---|
| 274 | : |
---|
| 275 | else |
---|
| 276 | echo Could not link program with -m64, disabling it. |
---|
| 277 | old_multidirs="${multidirs}" |
---|
| 278 | multidirs="" |
---|
| 279 | for x in ${old_multidirs}; do |
---|
| 280 | case "$x" in |
---|
| 281 | *m64* ) : ;; |
---|
| 282 | *) multidirs="${multidirs} ${x}" ;; |
---|
| 283 | esac |
---|
| 284 | done |
---|
| 285 | fi |
---|
| 286 | rm -f conftest.c conftest |
---|
| 287 | ;; |
---|
| 288 | esac |
---|
| 289 | ;; |
---|
| 290 | esac |
---|
| 291 | |
---|
| 292 | # Remove extraneous blanks from multidirs. |
---|
| 293 | # Tests like `if [ -n "$multidirs" ]' require it. |
---|
| 294 | multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'` |
---|
| 295 | |
---|
| 296 | # Add code to library's top level makefile to handle building the multilib |
---|
| 297 | # subdirs. |
---|
| 298 | |
---|
| 299 | cat > Multi.tem <<\EOF |
---|
| 300 | |
---|
| 301 | # FIXME: There should be an @-sign in front of the `if'. |
---|
| 302 | # Leave out until this is tested a bit more. |
---|
| 303 | multi-do: |
---|
| 304 | if [ -z "$(MULTIDIRS)" ]; then \ |
---|
| 305 | true; \ |
---|
| 306 | else \ |
---|
| 307 | rootpre=`pwd`/; export rootpre; \ |
---|
| 308 | srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ |
---|
| 309 | lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ |
---|
| 310 | compiler="$(CC)"; \ |
---|
| 311 | for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \ |
---|
| 312 | dir=`echo $$i | sed -e 's/;.*$$//'`; \ |
---|
| 313 | if [ "$${dir}" = "." ]; then \ |
---|
| 314 | true; \ |
---|
| 315 | else \ |
---|
| 316 | if [ -d ../$${dir}/$${lib} ]; then \ |
---|
| 317 | flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ |
---|
| 318 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ |
---|
| 319 | CFLAGS="$(CFLAGS) $${flags}" \ |
---|
| 320 | prefix="$(prefix)" \ |
---|
| 321 | exec_prefix="$(exec_prefix)" \ |
---|
[8166684] | 322 | ASFLAGS="$(ASFLAGS) $${flags}" \ |
---|
[05f5bf2] | 323 | GCJFLAGS="$(GCJFLAGS) $${flags}" \ |
---|
| 324 | CXXFLAGS="$(CXXFLAGS) $${flags}" \ |
---|
| 325 | LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ |
---|
| 326 | LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ |
---|
| 327 | LDFLAGS="$(LDFLAGS) $${flags}" \ |
---|
| 328 | $(DO)); then \ |
---|
| 329 | true; \ |
---|
| 330 | else \ |
---|
| 331 | exit 1; \ |
---|
| 332 | fi; \ |
---|
| 333 | else true; \ |
---|
| 334 | fi; \ |
---|
| 335 | fi; \ |
---|
| 336 | done; \ |
---|
| 337 | fi |
---|
| 338 | |
---|
| 339 | # FIXME: There should be an @-sign in front of the `if'. |
---|
| 340 | # Leave out until this is tested a bit more. |
---|
| 341 | multi-clean: |
---|
| 342 | if [ -z "$(MULTIDIRS)" ]; then \ |
---|
| 343 | true; \ |
---|
| 344 | else \ |
---|
| 345 | lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ |
---|
| 346 | for dir in Makefile $(MULTIDIRS); do \ |
---|
| 347 | if [ -f ../$${dir}/$${lib}/Makefile ]; then \ |
---|
| 348 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \ |
---|
| 349 | then true; \ |
---|
| 350 | else exit 1; \ |
---|
| 351 | fi; \ |
---|
| 352 | else true; \ |
---|
| 353 | fi; \ |
---|
| 354 | done; \ |
---|
| 355 | fi |
---|
| 356 | EOF |
---|
| 357 | |
---|
| 358 | cat ${Makefile} Multi.tem > Makefile.tem |
---|
| 359 | rm -f ${Makefile} Multi.tem |
---|
| 360 | mv Makefile.tem ${Makefile} |
---|
| 361 | |
---|
| 362 | fi # ${ml_toplevel_p} = yes |
---|
| 363 | |
---|
| 364 | if [ "${ml_verbose}" = --verbose ]; then |
---|
| 365 | echo "Adding multilib support to Makefile in ${ml_realsrcdir}" |
---|
| 366 | if [ "${ml_toplevel_p}" = yes ]; then |
---|
| 367 | echo "multidirs=${multidirs}" |
---|
| 368 | fi |
---|
| 369 | echo "with_multisubdir=${with_multisubdir}" |
---|
| 370 | fi |
---|
| 371 | |
---|
| 372 | if [ "${srcdir}" = "." ]; then |
---|
| 373 | if [ "${with_target_subdir}" != "." ]; then |
---|
| 374 | ml_srcdotdot="../" |
---|
| 375 | else |
---|
| 376 | ml_srcdotdot="" |
---|
| 377 | fi |
---|
| 378 | else |
---|
| 379 | ml_srcdotdot="" |
---|
| 380 | fi |
---|
| 381 | |
---|
| 382 | if [ -z "${with_multisubdir}" ]; then |
---|
| 383 | ml_subdir= |
---|
| 384 | ml_builddotdot= |
---|
| 385 | : # ml_srcdotdot= # already set |
---|
| 386 | else |
---|
| 387 | ml_subdir="/${with_multisubdir}" |
---|
| 388 | # The '[^/][^/]*' appears that way to work around a SunOS sed bug. |
---|
| 389 | ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/ |
---|
| 390 | if [ "$srcdir" = "." ]; then |
---|
| 391 | ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot} |
---|
| 392 | else |
---|
| 393 | : # ml_srcdotdot= # already set |
---|
| 394 | fi |
---|
| 395 | fi |
---|
| 396 | |
---|
| 397 | if [ "${ml_toplevel_p}" = yes ]; then |
---|
| 398 | ml_do='$(MAKE)' |
---|
| 399 | ml_clean='$(MAKE)' |
---|
| 400 | else |
---|
| 401 | ml_do=true |
---|
| 402 | ml_clean=true |
---|
| 403 | fi |
---|
| 404 | |
---|
| 405 | # TOP is used by newlib and should not be used elsewhere for this purpose. |
---|
| 406 | # MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty |
---|
| 407 | # when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s. |
---|
| 408 | # FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can |
---|
| 409 | # delete TOP. Newlib may wish to continue to use TOP for its own purposes |
---|
| 410 | # of course. |
---|
| 411 | # MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile) |
---|
| 412 | # and lists the subdirectories to recurse into. |
---|
| 413 | # MULTISUBDIR is non-empty in each cpu subdirectory's Makefile |
---|
| 414 | # (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with |
---|
| 415 | # a leading '/'. |
---|
| 416 | # MULTIDO is used for targets like all, install, and check where |
---|
| 417 | # $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed. |
---|
| 418 | # MULTICLEAN is used for the *clean targets. |
---|
| 419 | # |
---|
| 420 | # ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are |
---|
| 421 | # currently kept separate because we don't want the *clean targets to require |
---|
| 422 | # the existence of the compiler (which MULTIDO currently requires) and |
---|
| 423 | # therefore we'd have to record the directory options as well as names |
---|
| 424 | # (currently we just record the names and use --print-multi-lib to get the |
---|
| 425 | # options). |
---|
| 426 | |
---|
| 427 | sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \ |
---|
| 428 | -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \ |
---|
| 429 | -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \ |
---|
| 430 | -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \ |
---|
| 431 | -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \ |
---|
| 432 | -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \ |
---|
| 433 | -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \ |
---|
| 434 | ${Makefile} > Makefile.tem |
---|
| 435 | rm -f ${Makefile} |
---|
| 436 | mv Makefile.tem ${Makefile} |
---|
| 437 | |
---|
| 438 | # If this is the library's top level, configure each multilib subdir. |
---|
| 439 | # This is done at the end because this is the loop that runs configure |
---|
| 440 | # in each multilib subdir and it seemed reasonable to finish updating the |
---|
| 441 | # Makefile before going on to configure the subdirs. |
---|
| 442 | |
---|
| 443 | if [ "${ml_toplevel_p}" = yes ]; then |
---|
| 444 | |
---|
| 445 | # We must freshly configure each subdirectory. This bit of code is |
---|
| 446 | # actually partially stolen from the main configure script. FIXME. |
---|
| 447 | |
---|
| 448 | if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then |
---|
| 449 | |
---|
| 450 | if [ "${ml_verbose}" = --verbose ]; then |
---|
| 451 | echo "Running configure in multilib subdirs ${multidirs}" |
---|
| 452 | echo "pwd: `pwd`" |
---|
| 453 | fi |
---|
| 454 | |
---|
| 455 | ml_origdir=`pwd` |
---|
| 456 | ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'` |
---|
| 457 | # cd to top-level-build-dir/${with_target_subdir} |
---|
| 458 | cd .. |
---|
| 459 | |
---|
| 460 | for ml_dir in ${multidirs}; do |
---|
| 461 | |
---|
| 462 | if [ "${ml_verbose}" = --verbose ]; then |
---|
| 463 | echo "Running configure in multilib subdir ${ml_dir}" |
---|
| 464 | echo "pwd: `pwd`" |
---|
| 465 | fi |
---|
| 466 | |
---|
| 467 | if [ -d ${ml_dir} ]; then true; else |
---|
| 468 | # ``mkdir -p ${ml_dir}'' See also mkinstalldirs. |
---|
| 469 | pathcomp="" |
---|
| 470 | for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do |
---|
| 471 | pathcomp="$pathcomp$d" |
---|
| 472 | case "$pathcomp" in |
---|
| 473 | -* ) pathcomp=./$pathcomp ;; |
---|
| 474 | esac |
---|
| 475 | if test ! -d "$pathcomp"; then |
---|
| 476 | echo "mkdir $pathcomp" 1>&2 |
---|
| 477 | mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? |
---|
| 478 | fi |
---|
| 479 | if test ! -d "$pathcomp"; then |
---|
| 480 | exit $lasterr |
---|
| 481 | fi |
---|
| 482 | pathcomp="$pathcomp/" |
---|
| 483 | done |
---|
| 484 | fi |
---|
| 485 | if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi |
---|
| 486 | |
---|
| 487 | # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../ |
---|
| 488 | dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'` |
---|
| 489 | |
---|
| 490 | case ${srcdir} in |
---|
| 491 | ".") |
---|
| 492 | echo Building symlink tree in `pwd`/${ml_dir}/${ml_libdir} |
---|
| 493 | if [ "${with_target_subdir}" != "." ]; then |
---|
| 494 | ml_unsubdir="../" |
---|
| 495 | else |
---|
| 496 | ml_unsubdir="" |
---|
| 497 | fi |
---|
| 498 | (cd ${ml_dir}/${ml_libdir}; |
---|
| 499 | ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "") |
---|
| 500 | if [ -f ${ml_dir}/${ml_libdir}/Makefile ]; then |
---|
| 501 | if [ x"${MAKE}" = x ]; then |
---|
| 502 | (cd ${ml_dir}/${ml_libdir}; make distclean) |
---|
| 503 | else |
---|
| 504 | (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean) |
---|
| 505 | fi |
---|
| 506 | fi |
---|
| 507 | ml_newsrcdir="." |
---|
| 508 | ml_srcdiroption= |
---|
| 509 | multisrctop=${dotdot} |
---|
| 510 | ;; |
---|
| 511 | *) |
---|
| 512 | case "${srcdir}" in |
---|
| 513 | /* | [A-Za-z]:[\\/]* ) # absolute path |
---|
| 514 | ml_newsrcdir=${srcdir} |
---|
| 515 | ;; |
---|
| 516 | *) # otherwise relative |
---|
| 517 | ml_newsrcdir=${dotdot}${srcdir} |
---|
| 518 | ;; |
---|
| 519 | esac |
---|
| 520 | ml_srcdiroption="-srcdir=${ml_newsrcdir}" |
---|
| 521 | multisrctop= |
---|
| 522 | ;; |
---|
| 523 | esac |
---|
| 524 | |
---|
| 525 | case "${progname}" in |
---|
| 526 | /* | [A-Za-z]:[\\/]* ) ml_recprog=${progname} ;; |
---|
| 527 | *) ml_recprog=${dotdot}${progname} ;; |
---|
| 528 | esac |
---|
| 529 | |
---|
| 530 | # FIXME: POPDIR=${PWD=`pwd`} doesn't work here. |
---|
| 531 | ML_POPDIR=`pwd` |
---|
| 532 | cd ${ml_dir}/${ml_libdir} |
---|
| 533 | |
---|
| 534 | if [ -f ${ml_newsrcdir}/configure ]; then |
---|
[8166684] | 535 | ml_recprog="${ml_newsrcdir}/configure" |
---|
[05f5bf2] | 536 | fi |
---|
| 537 | |
---|
| 538 | # find compiler flag corresponding to ${ml_dir} |
---|
| 539 | for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do |
---|
| 540 | dir=`echo $i | sed -e 's/;.*$//'` |
---|
| 541 | if [ "${dir}" = "${ml_dir}" ]; then |
---|
| 542 | flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'` |
---|
| 543 | break |
---|
| 544 | fi |
---|
| 545 | done |
---|
| 546 | ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" GCJ="${GCJ_}$flags"' |
---|
| 547 | |
---|
| 548 | if [ "${with_target_subdir}" = "." ]; then |
---|
| 549 | CC_=$CC' ' |
---|
| 550 | CXX_=$CXX' ' |
---|
| 551 | GCJ_=$GCJ' ' |
---|
| 552 | else |
---|
| 553 | # Create a regular expression that matches any string as long |
---|
| 554 | # as ML_POPDIR. |
---|
| 555 | popdir_rx=`echo ${ML_POPDIR} | sed 's,.,.,g'` |
---|
| 556 | CC_= |
---|
| 557 | for arg in ${CC}; do |
---|
| 558 | case $arg in |
---|
| 559 | -[BIL]"${ML_POPDIR}"/*) |
---|
| 560 | CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;; |
---|
| 561 | "${ML_POPDIR}"/*) |
---|
| 562 | CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; |
---|
| 563 | *) |
---|
| 564 | CC_="${CC_}${arg} " ;; |
---|
| 565 | esac |
---|
| 566 | done |
---|
| 567 | |
---|
| 568 | CXX_= |
---|
| 569 | for arg in ${CXX}; do |
---|
| 570 | case $arg in |
---|
| 571 | -[BIL]"${ML_POPDIR}"/*) |
---|
| 572 | CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; |
---|
| 573 | "${ML_POPDIR}"/*) |
---|
| 574 | CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; |
---|
| 575 | *) |
---|
| 576 | CXX_="${CXX_}${arg} " ;; |
---|
| 577 | esac |
---|
| 578 | done |
---|
| 579 | |
---|
| 580 | GCJ_= |
---|
| 581 | for arg in ${GCJ}; do |
---|
| 582 | case $arg in |
---|
| 583 | -[BIL]"${ML_POPDIR}"/*) |
---|
| 584 | GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; |
---|
| 585 | "${ML_POPDIR}"/*) |
---|
| 586 | GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; |
---|
| 587 | *) |
---|
| 588 | GCJ_="${GCJ_}${arg} " ;; |
---|
| 589 | esac |
---|
| 590 | done |
---|
| 591 | |
---|
| 592 | if test "x${LD_LIBRARY_PATH+set}" = xset; then |
---|
| 593 | LD_LIBRARY_PATH_= |
---|
| 594 | for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do |
---|
| 595 | case "$arg" in |
---|
| 596 | "${ML_POPDIR}"/*) |
---|
| 597 | arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` |
---|
| 598 | ;; |
---|
| 599 | esac |
---|
| 600 | if test "x$LD_LIBRARY_PATH_" != x; then |
---|
| 601 | LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg |
---|
| 602 | else |
---|
| 603 | LD_LIBRARY_PATH_=$arg |
---|
| 604 | fi |
---|
| 605 | done |
---|
| 606 | ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_" |
---|
| 607 | fi |
---|
| 608 | |
---|
| 609 | if test "x${SHLIB_PATH+set}" = xset; then |
---|
| 610 | SHLIB_PATH_= |
---|
| 611 | for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do |
---|
| 612 | case "$arg" in |
---|
| 613 | "${ML_POPDIR}"/*) |
---|
| 614 | arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` |
---|
| 615 | ;; |
---|
| 616 | esac |
---|
| 617 | if test "x$SHLIB_PATH_" != x; then |
---|
| 618 | SHLIB_PATH_=$SHLIB_PATH_:$arg |
---|
| 619 | else |
---|
| 620 | SHLIB_PATH_=$arg |
---|
| 621 | fi |
---|
| 622 | done |
---|
| 623 | ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_" |
---|
| 624 | fi |
---|
| 625 | fi |
---|
| 626 | |
---|
| 627 | if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \ |
---|
| 628 | --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \ |
---|
[8166684] | 629 | --with-multibuildtop=${ml_builddotdot} \ |
---|
[05f5bf2] | 630 | ${ml_arguments} ${ml_srcdiroption} ; then |
---|
| 631 | true |
---|
| 632 | else |
---|
| 633 | exit 1 |
---|
| 634 | fi |
---|
| 635 | |
---|
| 636 | cd ${ML_POPDIR} |
---|
| 637 | |
---|
| 638 | done |
---|
| 639 | |
---|
| 640 | cd ${ml_origdir} |
---|
| 641 | fi |
---|
| 642 | |
---|
| 643 | fi # ${ml_toplevel_p} = yes |
---|
| 644 | fi # ${enable_multilib} = yes |
---|