| 1 | # Configure fragment invoked in the common section for subdirs |
| 2 | # wanting multilib support. |
| 3 | # |
| 4 | # The common section was chosen because xiberty clobbers $srcdir in the |
| 5 | # common section of its configure.in. |
| 6 | # |
| 7 | # The intent is to keep as much of this in one place as possible (and out |
| 8 | # of each subdirectory, eg: newlib, libio, etc.) until the right way to do |
| 9 | # this (ha ha) is decided upon. |
| 10 | # |
| 11 | # This is where a target selects what multilib directories to build. |
| 12 | # It is advisable to support a few --enable/--disable options to let the |
| 13 | # user select which libraries s/he really wants. |
| 14 | # |
| 15 | # FIXME: Multilib is currently disabled by default for everything other than |
| 16 | # newlib. It is up to each target to turn on multilib support for the other |
| 17 | # libraries as desired. |
| 18 | # |
| 19 | # FIXME: It would be better if we could use the --print-multi-lib switch to |
| 20 | # gcc to get the list of directories to build, but at this point the compiler |
| 21 | # has not been built. |
| 22 | |
| 23 | # Only do this if --enable-multilib. |
| 24 | # And only if at the top level, not a multilib subdirectory. |
| 25 | |
| 26 | if [ "${enable_multilib}" = yes -a -z "${with_multisubdir}" ]; then |
| 27 | |
| 28 | # Doing this in the common section means ${target} isn't set yet, so compute |
| 29 | # a copy here. This is a bit kludgey, but again the current (short term) goal |
| 30 | # is to be as unobtrusive (sp?) to the rest of the sources as possible. |
| 31 | |
| 32 | if result=`${config_shell} ${configsub} ${target_alias}` ; then |
| 33 | true |
| 34 | else |
| 35 | echo "Unrecognized target system name ${target_alias}." 1>&2 |
| 36 | exit 1 |
| 37 | fi |
| 38 | target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` |
| 39 | target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` |
| 40 | target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` |
| 41 | target=${target_cpu}-${target_vendor}-${target_os} |
| 42 | |
| 43 | # FIXME: Perhaps we can do something like the following instead. |
| 44 | # Fetch from gcc the multilib directories to use if we can. |
| 45 | # if [ -f ${srcdir}/../gcc/genmultilib -a -f ../gcc/Makefile ]; then |
| 46 | # options=`grep "^MULTILIB_OPTIONS" ../gcc/Makefile | sed -e 's/^.*=//'` |
| 47 | # multidirs=`${srcdir}/../gcc/genmultilib "$options" | \ |
| 48 | # sed -e 's/^#define.*//' -e 's/^[.].*//' -e 's/".*//' -e 's/ .*//'` |
| 49 | # else |
| 50 | # multidirs="" |
| 51 | # fi |
| 52 | |
| 53 | case "${target}" in |
| 54 | # start-sanitize-arc |
| 55 | arc-sbp-elf*) |
| 56 | if [ x$enable_biendian = xyes ] |
| 57 | then |
| 58 | multidirs="be host graphics audio be/host be/graphics be/audio" |
| 59 | else |
| 60 | multidirs="host graphics audio" |
| 61 | fi |
| 62 | ;; |
| 63 | arc-*-*) |
| 64 | multidirs="be" |
| 65 | ;; |
| 66 | # end-sanitize-arc |
| 67 | hppa*-*-*) |
| 68 | multidirs="soft-float" |
| 69 | ;; |
| 70 | m68*-*-*) |
| 71 | multidirs="m68000 m68020 m68881 msoft-float m68000/m68881 m68000/msoft-float m68020/m68881 m68020/msoft-float" |
| 72 | ;; |
| 73 | i960-*-*) |
| 74 | multidirs=float |
| 75 | ;; |
| 76 | sparclite-*-* | sparclitefrw*-*-*) |
| 77 | multidirs="mfpu msoft-float mflat mno-flat mfpu/mflat mfpu/mno-flat msoft-float/mflat msoft-float/mno-flat" |
| 78 | ;; |
| 79 | sparc-*-* | sparcfrw*-*-*) |
| 80 | multidirs="soft v8 soft/v8" |
| 81 | ;; |
| 82 | z8k-*-coff) |
| 83 | multidirs="z8001 std z8001/std" |
| 84 | ;; |
| 85 | h8300-*-*) |
| 86 | multidirs=h8300h |
| 87 | ;; |
| 88 | h8500-*-*) |
| 89 | multidirs="mbig msmall mcompact mmedium" |
| 90 | ;; |
| 91 | sh-*-*) |
| 92 | multidirs="ml" |
| 93 | ;; |
| 94 | mips*-*-*) |
| 95 | # Note that not all of these will be built for a particular |
| 96 | # target; what is build depends upon the output gcc |
| 97 | # --print-multi-lib. We configure them all, to make our life |
| 98 | # simpler here. If somebody cares about configuration |
| 99 | # efficiency, they will need to switch off on the various |
| 100 | # targets to configure just the directories needed for that |
| 101 | # target. |
| 102 | # |
| 103 | # In the long run, it would be better to configure based on |
| 104 | # the output of gcc --print-multi-lib, but, to do that, we |
| 105 | # would have to build gcc before configuring newlib. |
| 106 | # |
| 107 | # Default to including the single-float directories. |
| 108 | if [ x$enable_single_float = x ]; then |
| 109 | enable_single_float=yes |
| 110 | fi |
| 111 | if [ x$enable_single_float = xyes ]; then |
| 112 | multidirs="soft-float single el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 single/el single/eb single/mips1 single/mips3 single/el/mips1 single/el/mips3 single/eb/mips1 single/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3" |
| 113 | else |
| 114 | multidirs="soft-float el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3" |
| 115 | fi |
| 116 | if [ x$enable_biendian = xno ] |
| 117 | then |
| 118 | old_multidirs="${multidirs}" |
| 119 | multidirs="" |
| 120 | for x in ${old_multidirs}; do |
| 121 | case "$x" in |
| 122 | *endian* ) : ;; |
| 123 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 124 | esac |
| 125 | done |
| 126 | fi |
| 127 | if [ x$enable_softfloat = xno ] |
| 128 | then |
| 129 | old_multidirs="${multidirs}" |
| 130 | multidirs="" |
| 131 | for x in ${old_multidirs}; do |
| 132 | case "$x" in |
| 133 | *soft-float* ) : ;; |
| 134 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 135 | esac |
| 136 | done |
| 137 | fi |
| 138 | if [ x$enable_relocatable = xno ] |
| 139 | then |
| 140 | old_multidirs="${multidirs}" |
| 141 | multidirs="" |
| 142 | for x in ${old_multidirs}; do |
| 143 | case "$x" in |
| 144 | *relocatable* ) : ;; |
| 145 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 146 | esac |
| 147 | done |
| 148 | fi |
| 149 | if [ x$enable_sysv = xno ] |
| 150 | then |
| 151 | old_multidirs="${multidirs}" |
| 152 | multidirs="" |
| 153 | for x in ${old_multidirs}; do |
| 154 | case "$x" in |
| 155 | *sysv* ) : ;; |
| 156 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 157 | esac |
| 158 | done |
| 159 | fi |
| 160 | ;; |
| 161 | powerpc-*-eabiaix*) |
| 162 | multidirs="soft-float relocatable little-endian call-sysv little-endian/call-sysv relocatable/little-endian relocatable/call-sysv relocatable/little-endian/call-sysv soft-float/relocatable soft-float/little-endian soft-float/call-sysv soft-float/little-endian/call-sysv soft-float/relocatable/little-endian soft-float/relocatable/call-sysv soft-float/relocatable/little-endian/call-sysv" |
| 163 | if [ x$enable_biendian = xno ] |
| 164 | then |
| 165 | old_multidirs="${multidirs}" |
| 166 | multidirs="" |
| 167 | for x in ${old_multidirs}; do |
| 168 | case "$x" in |
| 169 | *endian* ) : ;; |
| 170 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 171 | esac |
| 172 | done |
| 173 | fi |
| 174 | if [ x$enable_softfloat = xno ] |
| 175 | then |
| 176 | old_multidirs="${multidirs}" |
| 177 | multidirs="" |
| 178 | for x in ${old_multidirs}; do |
| 179 | case "$x" in |
| 180 | *soft-float* ) : ;; |
| 181 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 182 | esac |
| 183 | done |
| 184 | fi |
| 185 | if [ x$enable_relocatable = xno ] |
| 186 | then |
| 187 | old_multidirs="${multidirs}" |
| 188 | multidirs="" |
| 189 | for x in ${old_multidirs}; do |
| 190 | case "$x" in |
| 191 | *relocatable* ) : ;; |
| 192 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 193 | esac |
| 194 | done |
| 195 | fi |
| 196 | if [ x$enable_sysv = xno ] |
| 197 | then |
| 198 | old_multidirs="${multidirs}" |
| 199 | multidirs="" |
| 200 | for x in ${old_multidirs}; do |
| 201 | case "$x" in |
| 202 | *sysv* ) : ;; |
| 203 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 204 | esac |
| 205 | done |
| 206 | fi |
| 207 | ;; |
| 208 | powerpc*-*-eabisim*) |
| 209 | multidirs="little-endian big-endian mrelocatable little-endian/mrelocatable big-endian/mrelocatable" |
| 210 | if [ x$enable_biendian = xno ] |
| 211 | then |
| 212 | old_multidirs="${multidirs}" |
| 213 | multidirs="" |
| 214 | for x in ${old_multidirs}; do |
| 215 | case "$x" in |
| 216 | *endian* ) : ;; |
| 217 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 218 | esac |
| 219 | done |
| 220 | fi |
| 221 | if [ x$enable_relocatable = xno ] |
| 222 | then |
| 223 | old_multidirs="${multidirs}" |
| 224 | multidirs="" |
| 225 | for x in ${old_multidirs}; do |
| 226 | case "$x" in |
| 227 | *relocatable* ) : ;; |
| 228 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 229 | esac |
| 230 | done |
| 231 | fi |
| 232 | ;; |
| 233 | powerpc-*-eabi* | powerpc-*-elf* | powerpc-*-sysv4*) |
| 234 | multidirs="soft-float relocatable little-endian call-aix little-endian/call-aix relocatable/little-endian relocatable/call-aix relocatable/little-endian/call-aix soft-float/relocatable soft-float/little-endian soft-float/call-aix soft-float/little-endian/call-aix soft-float/relocatable/little-endian soft-float/relocatable/call-aix soft-float/relocatable/little-endian/call-aix" |
| 235 | if [ x$enable_biendian = xno ] |
| 236 | then |
| 237 | old_multidirs="${multidirs}" |
| 238 | multidirs="" |
| 239 | for x in ${old_multidirs}; do |
| 240 | case "$x" in |
| 241 | *endian* ) : ;; |
| 242 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 243 | esac |
| 244 | done |
| 245 | fi |
| 246 | if [ x$enable_softfloat = xno ] |
| 247 | then |
| 248 | old_multidirs="${multidirs}" |
| 249 | multidirs="" |
| 250 | for x in ${old_multidirs}; do |
| 251 | case "$x" in |
| 252 | *soft-float* ) : ;; |
| 253 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 254 | esac |
| 255 | done |
| 256 | fi |
| 257 | if [ x$enable_relocatable = xno ] |
| 258 | then |
| 259 | old_multidirs="${multidirs}" |
| 260 | multidirs="" |
| 261 | for x in ${old_multidirs}; do |
| 262 | case "$x" in |
| 263 | *relocatable* ) : ;; |
| 264 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 265 | esac |
| 266 | done |
| 267 | fi |
| 268 | if [ x$enable_aix = xno ] |
| 269 | then |
| 270 | old_multidirs="${multidirs}" |
| 271 | multidirs="" |
| 272 | for x in ${old_multidirs}; do |
| 273 | case "$x" in |
| 274 | *aix* ) : ;; |
| 275 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 276 | esac |
| 277 | done |
| 278 | fi |
| 279 | ;; |
| 280 | powerpcle-*-eabi* | powerpcle-*-elf* | powerpcle-*-sysv4*) |
| 281 | multidirs="soft-float relocatable big-endian call-aix big-endian/call-aix relocatable/big-endian relocatable/call-aix relocatable/big-endian/call-aix soft-float/relocatable soft-float/big-endian soft-float/call-aix soft-float/big-endian/call-aix soft-float/relocatable/big-endian soft-float/relocatable/call-aix soft-float/relocatable/big-endian/call-aix" |
| 282 | if [ x$enable_biendian = xno ] |
| 283 | then |
| 284 | old_multidirs="${multidirs}" |
| 285 | multidirs="" |
| 286 | for x in ${old_multidirs}; do |
| 287 | case "$x" in |
| 288 | *endian* ) : ;; |
| 289 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 290 | esac |
| 291 | done |
| 292 | fi |
| 293 | if [ x$enable_softfloat = xno ] |
| 294 | then |
| 295 | old_multidirs="${multidirs}" |
| 296 | multidirs="" |
| 297 | for x in ${old_multidirs}; do |
| 298 | case "$x" in |
| 299 | *soft-float* ) : ;; |
| 300 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 301 | esac |
| 302 | done |
| 303 | fi |
| 304 | if [ x$enable_relocatable = xno ] |
| 305 | then |
| 306 | old_multidirs="${multidirs}" |
| 307 | multidirs="" |
| 308 | for x in ${old_multidirs}; do |
| 309 | case "$x" in |
| 310 | *relocatable* ) : ;; |
| 311 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 312 | esac |
| 313 | done |
| 314 | fi |
| 315 | if [ x$enable_aix = xno ] |
| 316 | then |
| 317 | old_multidirs="${multidirs}" |
| 318 | multidirs="" |
| 319 | for x in ${old_multidirs}; do |
| 320 | case "$x" in |
| 321 | *aix* ) : ;; |
| 322 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
| 323 | esac |
| 324 | done |
| 325 | fi |
| 326 | ;; |
| 327 | *) |
| 328 | multidirs= |
| 329 | ;; |
| 330 | esac |
| 331 | |
| 332 | # We must freshly configure each subdirectory. This bit of code is |
| 333 | # actually partially stolen from the main configure script. FIXME. |
| 334 | |
| 335 | if [ -n "${multidirs}" ] && [ -z "${norecursion}" ]; then |
| 336 | for dir in ${multidirs}; do |
| 337 | |
| 338 | if [ -d ${dir} ]; then true; else mkdir ${dir}; fi |
| 339 | |
| 340 | dotdot=../`echo ${dir} | sed -e 's|[^/]||g' -e 's|/|../|g'` |
| 341 | |
| 342 | case ${srcdir} in |
| 343 | ".") |
| 344 | echo Building symlink tree in `pwd`/${dir} |
| 345 | rm -f tmpconfig |
| 346 | cat >tmpconfig <<\EOF |
| 347 | #!/bin/sh |
| 348 | for f in `ls -a $1`; do |
| 349 | if [ -d $1$f ]; then |
| 350 | found= |
| 351 | for i in $2; do |
| 352 | if [ "$f" = "$i" ]; then |
| 353 | found=yes |
| 354 | fi |
| 355 | done |
| 356 | if [ -z "${found}" ]; then |
| 357 | if [ -d $f ]; then true; else mkdir $f; fi |
| 358 | (cd $f; ../$0 ../$1$f/ "$2") |
| 359 | fi |
| 360 | else |
| 361 | rm -f $f |
| 362 | ln -s $1$f . |
| 363 | fi |
| 364 | done |
| 365 | EOF |
| 366 | chmod +x tmpconfig |
| 367 | (cd ${dir}; |
| 368 | ${dotdot}tmpconfig ${dotdot} ". .. CVS tmpconfig ${multidirs}") |
| 369 | rm -f tmpconfig |
| 370 | srcdiroption= |
| 371 | ;; |
| 372 | *) |
| 373 | case "${srcdir}" in |
| 374 | /*) # absolute path |
| 375 | newsrcdir=${srcdir}/${configdir} |
| 376 | ;; |
| 377 | *) # otherwise relative |
| 378 | newsrcdir=${dotdot}${srcdir}/${configdir} |
| 379 | ;; |
| 380 | esac |
| 381 | srcdiroption="-srcdir=${newsrcdir}" |
| 382 | ;; |
| 383 | esac |
| 384 | |
| 385 | case "${progname}" in |
| 386 | /*) recprog=${progname} ;; |
| 387 | *) recprog=${dotdot}${progname} ;; |
| 388 | esac |
| 389 | |
| 390 | POPDIR=${PWD=`pwd`} |
| 391 | cd ${dir} |
| 392 | if eval ${config_shell} ${recprog} ${verbose} \ |
| 393 | --with-multisubdir=${dir} \ |
| 394 | ${buildopt} --host=${host_alias} --target=${target_alias} \ |
| 395 | ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \ |
| 396 | ${srcdiroption} ${program_prefixoption} ${program_suffixoption} \ |
| 397 | ${program_transform_nameoption} ${site_option} ${withoptions} \ |
| 398 | ${withoutoptions} ${enableoptions} ${disableoptions} \ |
| 399 | ${cache_file_option} ${removing} ${other_options} ${redirect} ; then |
| 400 | true |
| 401 | else |
| 402 | exit 1 |
| 403 | fi |
| 404 | |
| 405 | cd ${POPDIR} |
| 406 | |
| 407 | done |
| 408 | fi |
| 409 | |
| 410 | fi # ${enable_multilib = yes -a -z ${with_multisubdir} |