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