| 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | dnl |
| 3 | dnl And be careful when changing it! If you must add tests with square |
| 4 | dnl brackets, be sure changequote invocations surround it. |
| 5 | dnl |
| 6 | dnl |
| 7 | dnl v2.5 needed for --bindir et al |
| 8 | AC_PREREQ(2.5) |
| 9 | AC_INIT(as.h) |
| 10 | |
| 11 | AC_CANONICAL_SYSTEM |
| 12 | |
| 13 | AM_INIT_AUTOMAKE(gas, 2.9.1) |
| 14 | |
| 15 | AM_PROG_LIBTOOL |
| 16 | |
| 17 | user_bfd_gas= |
| 18 | AC_ARG_ENABLE(bfd-assembler, |
| 19 | [ --enable-bfd-assembler use BFD back end for writing object files], |
| 20 | [case "${enableval}" in |
| 21 | yes) need_bfd=yes user_bfd_gas=yes ;; |
| 22 | no) user_bfd_gas=no ;; |
| 23 | *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;; |
| 24 | esac])dnl |
| 25 | AC_ARG_ENABLE(targets, |
| 26 | [ targets alternative target configurations besides the primary], |
| 27 | [case "${enableval}" in |
| 28 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') |
| 29 | ;; |
| 30 | no) enable_targets= ;; |
| 31 | *) enable_targets=$enableval ;; |
| 32 | esac])dnl |
| 33 | AC_ARG_ENABLE(commonbfdlib, |
| 34 | [ --enable-commonbfdlib build shared BFD/opcodes/libiberty library], |
| 35 | [case "${enableval}" in |
| 36 | yes) commonbfdlib=true ;; |
| 37 | no) commonbfdlib=false ;; |
| 38 | *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; |
| 39 | esac])dnl |
| 40 | |
| 41 | # Generate a header file |
| 42 | AM_CONFIG_HEADER(config.h:config.in) |
| 43 | |
| 44 | te_file=generic |
| 45 | |
| 46 | canon_targets="" |
| 47 | if test -n "$enable_targets" ; then |
| 48 | for t in `echo $enable_targets | sed 's/,/ /g'`; do |
| 49 | result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $t 2>/dev/null` |
| 50 | if test -n "$result" ; then |
| 51 | canon_targets="$canon_targets $result" |
| 52 | # else |
| 53 | # # Permit "all", etc. We don't support it yet though. |
| 54 | # canon_targets="$canon_targets $t" |
| 55 | fi |
| 56 | done |
| 57 | GAS_UNIQ(canon_targets) |
| 58 | fi |
| 59 | |
| 60 | emulations="" |
| 61 | |
| 62 | for this_target in $target $canon_targets ; do |
| 63 | |
| 64 | changequote(,)dnl |
| 65 | eval `echo $this_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/'` |
| 66 | changequote([,])dnl |
| 67 | |
| 68 | # check for architecture variants |
| 69 | arch= |
| 70 | endian= |
| 71 | case ${cpu} in |
| 72 | alpha*) cpu_type=alpha ;; |
| 73 | armeb) cpu_type=arm endian=big ;; |
| 74 | arm*) cpu_type=arm endian=little ;; |
| 75 | thumb*) cpu_type=arm endian=little ;; |
| 76 | hppa*) cpu_type=hppa ;; |
| 77 | changequote(,)dnl |
| 78 | i[456]86) cpu_type=i386 ;; |
| 79 | m680[012346]0) cpu_type=m68k ;; |
| 80 | m68008) cpu_type=m68k ;; |
| 81 | m683??) cpu_type=m68k ;; |
| 82 | changequote([,])dnl |
| 83 | m8*) cpu_type=m88k ;; |
| 84 | mips*el) cpu_type=mips endian=little ;; |
| 85 | # start-sanitize-r5900 |
| 86 | mips*5900*) cpu_type=mips endian=little ;; |
| 87 | # end-sanitize-r5900 |
| 88 | mips*) cpu_type=mips endian=big ;; |
| 89 | powerpcle*) cpu_type=ppc endian=little ;; |
| 90 | powerpc*) cpu_type=ppc endian=big ;; |
| 91 | rs6000*) cpu_type=ppc ;; |
| 92 | sparclite*) cpu_type=sparc arch=sparclite ;; |
| 93 | sparclet*) cpu_type=sparc arch=sparclet ;; |
| 94 | sparc64*) cpu_type=sparc arch=v9-64 ;; |
| 95 | sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c. |
| 96 | v850*) cpu_type=v850 ;; |
| 97 | *) cpu_type=${cpu} ;; |
| 98 | esac |
| 99 | |
| 100 | if test ${this_target} = $target ; then |
| 101 | target_cpu_type=${cpu_type} |
| 102 | if test x${endian} = xbig; then |
| 103 | AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 1) |
| 104 | elif test x${endian} = xlittle; then |
| 105 | AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 0) |
| 106 | fi |
| 107 | elif test ${target_cpu_type} != ${cpu_type} ; then |
| 108 | continue |
| 109 | fi |
| 110 | |
| 111 | generic_target=${cpu_type}-$vendor-$os |
| 112 | dev=no |
| 113 | bfd_gas=no |
| 114 | em=generic |
| 115 | |
| 116 | # assign object format |
| 117 | case ${generic_target} in |
| 118 | a29k-*-coff) fmt=coff ;; |
| 119 | a29k-amd-udi) fmt=coff ;; |
| 120 | a29k-amd-ebmon) fmt=coff ;; |
| 121 | a29k-nyu-sym1) fmt=coff ;; |
| 122 | a29k-*-vxworks*) fmt=coff ;; |
| 123 | |
| 124 | alpha*-*-*vms*) fmt=evax ;; |
| 125 | alpha*-*-netware*) fmt=ecoff ;; |
| 126 | alpha*-*-openbsd*) fmt=ecoff ;; |
| 127 | alpha*-*-osf*) fmt=ecoff ;; |
| 128 | alpha*-*-linuxecoff*) fmt=ecoff ;; |
| 129 | alpha*-*-linux-gnu*) fmt=elf em=linux ;; |
| 130 | alpha*-*-netbsd*) fmt=elf em=nbsd ;; |
| 131 | |
| 132 | arc-*-elf*) fmt=elf bfd_gas=yes ;; |
| 133 | |
| 134 | arm-*-riscix*) fmt=aout em=riscix ;; |
| 135 | arm-*-aout) fmt=aout ;; |
| 136 | arm-*-coff | thumb-*-coff) fmt=coff ;; |
| 137 | arm-*-riscix*) fmt=aout ;; |
| 138 | arm-*-pe | thumb-*-pe) fmt=coff em=pe ;; |
| 139 | |
| 140 | d10v-*-*) fmt=elf bfd_gas=yes ;; |
| 141 | # start-sanitize-d30v |
| 142 | d30v-*-*) fmt=elf bfd_gas=yes ;; |
| 143 | # end-sanitize-d30v |
| 144 | |
| 145 | hppa-*-*elf*) fmt=elf em=hppa ;; |
| 146 | hppa-*-lites*) fmt=elf em=hppa ;; |
| 147 | hppa-*-osf*) fmt=som em=hppa ;; |
| 148 | hppa-*-rtems*) fmt=elf em=hppa ;; |
| 149 | hppa-*-hpux*) fmt=som em=hppa ;; |
| 150 | hppa-*-bsd*) fmt=som em=hppa ;; |
| 151 | hppa-*-hiux*) fmt=som em=hppa ;; |
| 152 | |
| 153 | h8300-*-coff) fmt=coff ;; |
| 154 | |
| 155 | i386-ibm-aix*) fmt=coff em=i386aix ;; |
| 156 | i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;; |
| 157 | i386-*-bsd*) fmt=aout em=386bsd ;; |
| 158 | i386-*-netbsd0.8) fmt=aout em=386bsd ;; |
| 159 | i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;; |
| 160 | i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;; |
| 161 | i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;; |
| 162 | i386-*-linux*coff*) fmt=coff em=linux ;; |
| 163 | i386-*-linux-gnu*) fmt=elf em=linux ;; |
| 164 | i386-*-lynxos*) fmt=coff em=lynx ;; |
| 165 | i386-*-sysv4* | i386-*-solaris* | i386-*-elf) |
| 166 | fmt=elf ;; |
| 167 | i386-*-freebsdelf*) fmt=elf ;; |
| 168 | i386-*-freebsd*) fmt=aout em=386bsd ;; |
| 169 | i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*) |
| 170 | fmt=coff ;; |
| 171 | i386-*-sco3.2v5*) fmt=elf |
| 172 | if test ${this_target} = $target; then |
| 173 | AC_DEFINE(SCO_ELF) |
| 174 | fi |
| 175 | ;; |
| 176 | i386-*-sco3.2*) fmt=coff ;; |
| 177 | i386-*-vsta) fmt=aout ;; |
| 178 | i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*) |
| 179 | fmt=coff em=go32;; |
| 180 | i386-*-rtems*) fmt=coff ;; |
| 181 | i386-*-gnu*) fmt=elf ;; |
| 182 | i386-*-mach*) |
| 183 | fmt=aout em=mach bfd_gas=yes ;; |
| 184 | i386-*-msdos*) fmt=aout ;; |
| 185 | i386-*-moss*) fmt=elf ;; |
| 186 | i386-*-pe) fmt=coff em=pe ;; |
| 187 | i386-*-cygwin32*) fmt=coff em=pe bfd_gas=yes ;; |
| 188 | i386-*-mingw32*) fmt=coff em=pe bfd_gas=yes ;; |
| 189 | i386-*-*nt*) fmt=coff em=pe ;; |
| 190 | i960-*-bout) fmt=bout ;; |
| 191 | i960-*-coff) fmt=coff em=ic960 ;; |
| 192 | i960-*-rtems*) fmt=coff em=ic960 ;; |
| 193 | i960-*-nindy*) fmt=bout ;; |
| 194 | i960-*-vxworks4*) fmt=bout ;; |
| 195 | i960-*-vxworks5.0) fmt=bout ;; |
| 196 | i960-*-vxworks5.*) fmt=coff em=ic960 ;; |
| 197 | i960-*-vxworks*) fmt=bout ;; |
| 198 | |
| 199 | m32r-*-*) fmt=elf bfd_gas=yes ;; |
| 200 | |
| 201 | m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*) |
| 202 | fmt=aout em=sun3 ;; |
| 203 | m68k-motorola-sysv*) fmt=coff em=delta ;; |
| 204 | m68k-bull-sysv3*) fmt=coff em=dpx2 ;; |
| 205 | m68k-apollo-*) fmt=coff em=apollo ;; |
| 206 | m68k-*-sysv4*) # must be before -sysv* |
| 207 | fmt=elf em=svr4 ;; |
| 208 | m68k-*-elf*) fmt=elf ;; |
| 209 | m68k-*-coff | m68k-*-sysv* | m68k-*-rtems*) |
| 210 | fmt=coff ;; |
| 211 | m68k-*-hpux*) fmt=hp300 em=hp300 ;; |
| 212 | m68k-*-linux*aout*) fmt=aout em=linux ;; |
| 213 | m68k-*-linux-gnu*) fmt=elf em=linux ;; |
| 214 | m68k-*-lynxos*) fmt=coff em=lynx ;; |
| 215 | m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
| 216 | m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
| 217 | m68k-apple-aux*) fmt=coff em=aux ;; |
| 218 | m68k-*-psos*) fmt=elf em=psos;; |
| 219 | |
| 220 | m88k-motorola-sysv3*) fmt=coff em=delt88 ;; |
| 221 | m88k-*-coff*) fmt=coff ;; |
| 222 | |
| 223 | # don't change em like *-*-bsd does |
| 224 | mips-dec-netbsd*) fmt=elf endian=little ;; |
| 225 | mips-dec-openbsd*) fmt=elf endian=little ;; |
| 226 | mips-dec-bsd*) fmt=aout ;; |
| 227 | mips-sony-bsd*) fmt=ecoff ;; |
| 228 | mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;; |
| 229 | mips-*-ultrix*) fmt=ecoff endian=little ;; |
| 230 | mips-*-osf*) fmt=ecoff endian=little ;; |
| 231 | mips-*-ecoff*) fmt=ecoff ;; |
| 232 | mips-*-ecoff*) fmt=ecoff ;; |
| 233 | mips-*-irix6*) fmt=elf ;; |
| 234 | mips-*-irix5*) fmt=elf ;; |
| 235 | mips-*-irix*) fmt=ecoff ;; |
| 236 | mips-*-lnews*) fmt=ecoff em=lnews ;; |
| 237 | mips-*-riscos*) fmt=ecoff ;; |
| 238 | mips-*-sysv*) fmt=ecoff ;; |
| 239 | mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*) |
| 240 | fmt=elf ;; |
| 241 | mn10200-*-*) fmt=elf bfd_gas=yes ;; |
| 242 | mn10300-*-*) fmt=elf bfd_gas=yes ;; |
| 243 | ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*) |
| 244 | fmt=coff em=pe ;; |
| 245 | ppc-*-aix*) fmt=coff ;; |
| 246 | ppc-*-beos*) fmt=coff ;; |
| 247 | ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*) |
| 248 | fmt=elf ;; |
| 249 | ppc-*-linux-gnu*) fmt=elf |
| 250 | case "$endian" in |
| 251 | big) ;; |
| 252 | *) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;; |
| 253 | esac |
| 254 | ;; |
| 255 | ppc-*-solaris*) fmt=elf |
| 256 | if test ${this_target} = $target; then |
| 257 | AC_DEFINE(TARGET_SOLARIS_COMMENT) |
| 258 | fi |
| 259 | if test x${endian} = xbig; then |
| 260 | AC_MSG_ERROR(Solaris must be configured little endian) |
| 261 | fi |
| 262 | ;; |
| 263 | ppc-*-rtems*) fmt=elf ;; |
| 264 | ppc-*-macos* | ppc-*-mpw*) |
| 265 | fmt=coff em=macos ;; |
| 266 | ppc-*-netware*) fmt=elf em=ppcnw ;; |
| 267 | |
| 268 | sh-*-elf*) fmt=elf ;; |
| 269 | sh-*-coff*) fmt=coff ;; |
| 270 | sh-*-rtems*) fmt=coff ;; |
| 271 | |
| 272 | ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;; |
| 273 | ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;; |
| 274 | ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;; |
| 275 | |
| 276 | sparc-*-rtems*) fmt=aout ;; |
| 277 | sparc-*-sunos4*) fmt=aout em=sun3 ;; |
| 278 | sparc-*-aout | sparc*-*-vxworks*) |
| 279 | fmt=aout em=sparcaout ;; |
| 280 | sparc-*-coff) fmt=coff ;; |
| 281 | sparc-*-linux*aout*) fmt=aout em=linux ;; |
| 282 | sparc-*-linux-gnu*) fmt=elf em=linux ;; |
| 283 | sparc-*-lynxos*) fmt=coff em=lynx ;; |
| 284 | sparc-fujitsu-none) fmt=aout ;; |
| 285 | sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*) |
| 286 | fmt=elf ;; |
| 287 | sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
| 288 | sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;; |
| 289 | |
| 290 | tic30-*-*aout*) fmt=aout bfd_gas=yes ;; |
| 291 | tic30-*-*coff*) fmt=coff bfd_gas=yes ;; |
| 292 | # start-sanitize-tic80 |
| 293 | tic80-*-*) fmt=coff ;; |
| 294 | # end-sanitize-tic80 |
| 295 | |
| 296 | # start-sanitize-sky |
| 297 | dvp-*-*) fmt=elf bfd_gas=yes ;; |
| 298 | # end-sanitize-sky |
| 299 | |
| 300 | v850-*-*) fmt=elf bfd_gas=yes ;; |
| 301 | |
| 302 | # start-sanitize-v850e |
| 303 | v850e-*-*) fmt=elf bfd_gas=yes ;; |
| 304 | v850ea-*-*) fmt=elf bfd_gas=yes ;; |
| 305 | # end-sanitize-v850e |
| 306 | vax-*-bsd* | vax-*-ultrix*) |
| 307 | fmt=aout ;; |
| 308 | vax-*-vms) fmt=vms ;; |
| 309 | |
| 310 | z8k-*-coff | z8k-*-sim) |
| 311 | fmt=coff ;; |
| 312 | |
| 313 | w65-*-*) fmt=coff ;; |
| 314 | |
| 315 | *-*-aout | *-*-scout) |
| 316 | fmt=aout ;; |
| 317 | *-*-nindy*) |
| 318 | fmt=bout ;; |
| 319 | *-*-bsd*) |
| 320 | fmt=aout em=sun3 ;; |
| 321 | *-*-generic) fmt=generic ;; |
| 322 | *-*-xray | *-*-hms) fmt=coff ;; |
| 323 | *-*-sim) fmt=coff ;; |
| 324 | *-*-elf | *-*-sysv4* | *-*-solaris*) |
| 325 | AC_MSG_WARN(GAS support for ${generic_target} is incomplete.) |
| 326 | fmt=elf dev=yes ;; |
| 327 | *-*-vxworks) fmt=aout ;; |
| 328 | *-*-netware) fmt=elf ;; |
| 329 | esac |
| 330 | |
| 331 | case ${cpu_type}-${fmt} in |
| 332 | alpha*-*) bfd_gas=yes ;; |
| 333 | arm-*) bfd_gas=yes ;; |
| 334 | # not yet |
| 335 | # i386-aout) bfd_gas=preferred ;; |
| 336 | mips-*) bfd_gas=yes ;; |
| 337 | ns32k-*) bfd_gas=yes ;; |
| 338 | ppc-*) bfd_gas=yes ;; |
| 339 | sparc-*) bfd_gas=yes ;; |
| 340 | *-elf) bfd_gas=yes ;; |
| 341 | *-ecoff) bfd_gas=yes ;; |
| 342 | *-som) bfd_gas=yes ;; |
| 343 | *) ;; |
| 344 | esac |
| 345 | |
| 346 | # Other random stuff. |
| 347 | |
| 348 | # do we need the opcodes library? |
| 349 | case ${cpu_type} in |
| 350 | vax | i386 | tic30) |
| 351 | ;; |
| 352 | *) |
| 353 | need_opcodes=yes |
| 354 | |
| 355 | case "${enable_shared}" in |
| 356 | yes) shared_opcodes=true ;; |
| 357 | *opcodes*) shared_opcodes=true ;; |
| 358 | *) shared_opcodes=false ;; |
| 359 | esac |
| 360 | if test "${shared_opcodes}" = "true"; then |
| 361 | # A shared libopcodes must be linked against libbfd. |
| 362 | need_bfd=yes |
| 363 | fi |
| 364 | ;; |
| 365 | esac |
| 366 | |
| 367 | case ${cpu_type} in |
| 368 | m32r) |
| 369 | case ${extra_objects} in |
| 370 | *cgen.o*) ;; |
| 371 | *) extra_objects="$extra_objects cgen.o" |
| 372 | AC_DEFINE(USING_CGEN) |
| 373 | ;; |
| 374 | esac |
| 375 | ;; |
| 376 | |
| 377 | m68k) |
| 378 | case ${extra_objects} in |
| 379 | *m68k-parse.o*) ;; |
| 380 | *) extra_objects="$extra_objects m68k-parse.o" ;; |
| 381 | esac |
| 382 | ;; |
| 383 | |
| 384 | mips) |
| 385 | echo ${extra_objects} | grep -s "itbl-parse.o" |
| 386 | if test $? -ne 0 ; then |
| 387 | extra_objects="$extra_objects itbl-parse.o" |
| 388 | fi |
| 389 | |
| 390 | echo ${extra_objects} | grep -s "itbl-lex.o" |
| 391 | if test $? -ne 0 ; then |
| 392 | extra_objects="$extra_objects itbl-lex.o" |
| 393 | fi |
| 394 | |
| 395 | echo ${extra_objects} | grep -s "itbl-ops.o" |
| 396 | if test $? -ne 0 ; then |
| 397 | extra_objects="$extra_objects itbl-ops.o" |
| 398 | fi |
| 399 | ;; |
| 400 | |
| 401 | sparc) |
| 402 | if test $this_target = $target ; then |
| 403 | AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}") |
| 404 | fi |
| 405 | ;; |
| 406 | |
| 407 | *) |
| 408 | ;; |
| 409 | esac |
| 410 | |
| 411 | # See if we really can support this configuration with the emulation code. |
| 412 | |
| 413 | if test $this_target = $target ; then |
| 414 | primary_bfd_gas=$bfd_gas |
| 415 | obj_format=$fmt |
| 416 | te_file=$em |
| 417 | |
| 418 | if test $bfd_gas = no ; then |
| 419 | # Can't support other configurations this way. |
| 420 | break |
| 421 | fi |
| 422 | elif test $bfd_gas = no ; then |
| 423 | # Can't support this configuration. |
| 424 | break |
| 425 | fi |
| 426 | |
| 427 | # From target name and format, produce a list of supported emulations. |
| 428 | |
| 429 | case ${generic_target}-${fmt} in |
| 430 | mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; |
| 431 | mips-*-linux-gnu*-*) case "$endian" in |
| 432 | big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; |
| 433 | *) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;; |
| 434 | esac ;; |
| 435 | mips-*-lnews*-ecoff) ;; |
| 436 | mips-*-*-ecoff) case "$endian" in |
| 437 | big) emulation="mipsbecoff mipslecoff mipsecoff" ;; |
| 438 | *) emulation="mipslecoff mipsbecoff mipsecoff" ;; |
| 439 | esac ;; |
| 440 | mips-*-*-elf) case "$endian" in |
| 441 | big) emulation="mipsbelf mipslelf mipself" ;; |
| 442 | *) emulation="mipslelf mipsbelf mipself" ;; |
| 443 | # Uncommenting the next line will turn on support for i386 COFF |
| 444 | # in any i386 ELF configuration. This probably doesn't work |
| 445 | # correctly. |
| 446 | # i386-*-*-elf) emulation="i386coff i386elf" ;; |
| 447 | esac ;; |
| 448 | esac |
| 449 | |
| 450 | emulations="$emulations $emulation" |
| 451 | |
| 452 | done |
| 453 | |
| 454 | # Assign floating point type. Most processors with FP support |
| 455 | # IEEE FP. On those that don't support FP at all, usually IEEE |
| 456 | # is emulated. |
| 457 | case ${target_cpu} in |
| 458 | vax | tahoe ) atof=${target_cpu} ;; |
| 459 | *) atof=ieee ;; |
| 460 | esac |
| 461 | |
| 462 | case "${obj_format}" in |
| 463 | "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;; |
| 464 | esac |
| 465 | |
| 466 | dnl |
| 467 | dnl Make sure the desired support files exist. |
| 468 | dnl |
| 469 | |
| 470 | if test ! -r ${srcdir}/config/tc-${target_cpu_type}.c; then |
| 471 | AC_MSG_ERROR(GAS does not support target CPU ${target_cpu_type}) |
| 472 | fi |
| 473 | |
| 474 | if test ! -r ${srcdir}/config/obj-${obj_format}.c; then |
| 475 | AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) |
| 476 | fi |
| 477 | |
| 478 | case ${user_bfd_gas}-${primary_bfd_gas} in |
| 479 | yes-yes | no-no) |
| 480 | # We didn't override user's choice. |
| 481 | ;; |
| 482 | no-yes) |
| 483 | AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.) |
| 484 | ;; |
| 485 | no-preferred) |
| 486 | primary_bfd_gas=no |
| 487 | ;; |
| 488 | *-preferred) |
| 489 | primary_bfd_gas=yes |
| 490 | ;; |
| 491 | yes-*) |
| 492 | primary_bfd_gas=yes |
| 493 | ;; |
| 494 | -*) |
| 495 | # User specified nothing. |
| 496 | ;; |
| 497 | esac |
| 498 | |
| 499 | # Some COFF configurations want these random other flags set. |
| 500 | case ${obj_format} in |
| 501 | coff) |
| 502 | case ${target_cpu_type} in |
| 503 | i386) AC_DEFINE(I386COFF) ;; |
| 504 | m68k) AC_DEFINE(M68KCOFF) ;; |
| 505 | m88k) AC_DEFINE(M88KCOFF) ;; |
| 506 | esac |
| 507 | ;; |
| 508 | esac |
| 509 | |
| 510 | # Getting this done right is going to be a bitch. Each configuration specified |
| 511 | # with --enable-targets=... should be checked for environment, format, cpu, and |
| 512 | # bfd_gas setting. |
| 513 | # |
| 514 | # For each configuration, the necessary object file support code must be linked |
| 515 | # in. This might be only one, it might be up to four. The necessary emulation |
| 516 | # code needs to be provided, too. |
| 517 | # |
| 518 | # And then there's "--enable-targets=all".... |
| 519 | # |
| 520 | # For now, just always do it for MIPS ELF or ECOFF configurations. Sigh. |
| 521 | |
| 522 | formats="${obj_format}" |
| 523 | emfiles="" |
| 524 | EMULATIONS="" |
| 525 | GAS_UNIQ(emulations) |
| 526 | for em in . $emulations ; do |
| 527 | case $em in |
| 528 | .) continue ;; |
| 529 | mipsbelf | mipslelf) |
| 530 | fmt=elf file=mipself ;; |
| 531 | mipsbecoff | mipslecoff) |
| 532 | fmt=ecoff file=mipsecoff ;; |
| 533 | i386coff) |
| 534 | fmt=coff file=i386coff ;; |
| 535 | i386elf) |
| 536 | fmt=elf file=i386elf ;; |
| 537 | esac |
| 538 | formats="$formats $fmt" |
| 539 | emfiles="$emfiles e-$file.o" |
| 540 | EMULATIONS="$EMULATIONS &$em," |
| 541 | done |
| 542 | GAS_UNIQ(formats) |
| 543 | GAS_UNIQ(emfiles) |
| 544 | if test `set . $formats ; shift ; echo $#` -gt 1 ; then |
| 545 | for fmt in $formats ; do |
| 546 | case $fmt in |
| 547 | aout) AC_DEFINE(OBJ_MAYBE_AOUT) ;; |
| 548 | bout) AC_DEFINE(OBJ_MAYBE_BOUT) ;; |
| 549 | coff) AC_DEFINE(OBJ_MAYBE_COFF) ;; |
| 550 | ecoff) AC_DEFINE(OBJ_MAYBE_ECOFF) ;; |
| 551 | elf) AC_DEFINE(OBJ_MAYBE_ELF) ;; |
| 552 | generic) AC_DEFINE(OBJ_MAYBE_GENERIC) ;; |
| 553 | hp300) AC_DEFINE(OBJ_MAYBE_HP300) ;; |
| 554 | ieee) AC_DEFINE(OBJ_MAYBE_IEEE) ;; |
| 555 | som) AC_DEFINE(OBJ_MAYBE_SOM) ;; |
| 556 | vms) AC_DEFINE(OBJ_MAYBE_VMS) ;; |
| 557 | esac |
| 558 | extra_objects="$extra_objects obj-$fmt.o" |
| 559 | done |
| 560 | obj_format=multi |
| 561 | fi |
| 562 | if test `set . $emfiles ; shift ; echo $#` -gt 0 ; then |
| 563 | te_file=multi |
| 564 | extra_objects="$extra_objects $emfiles" |
| 565 | DEFAULT_EMULATION=`set . $emulations ; echo $2` |
| 566 | AC_DEFINE(USE_EMULATIONS) |
| 567 | fi |
| 568 | AC_SUBST(extra_objects) |
| 569 | AC_DEFINE_UNQUOTED(EMULATIONS, $EMULATIONS) |
| 570 | AC_DEFINE_UNQUOTED(DEFAULT_EMULATION, "$DEFAULT_EMULATION") |
| 571 | |
| 572 | case ${primary_bfd_gas}-${target_cpu_type}-${obj_format} in |
| 573 | yes-*-coff) need_bfd=yes ;; |
| 574 | no-*-coff) need_bfd=yes |
| 575 | AC_DEFINE(MANY_SEGMENTS) ;; |
| 576 | esac |
| 577 | |
| 578 | reject_dev_configs=yes |
| 579 | |
| 580 | case ${reject_dev_configs}-${dev} in |
| 581 | yes-yes) # Oops. |
| 582 | AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.) |
| 583 | ;; |
| 584 | esac |
| 585 | |
| 586 | AC_SUBST(target_cpu_type) |
| 587 | AC_SUBST(obj_format) |
| 588 | AC_SUBST(te_file) |
| 589 | AC_SUBST(atof) |
| 590 | dnl AC_SUBST(emulation) |
| 591 | |
| 592 | case "${primary_bfd_gas}" in |
| 593 | yes) AC_DEFINE(BFD_ASSEMBLER) |
| 594 | need_bfd=yes ;; |
| 595 | esac |
| 596 | |
| 597 | # do we need the opcodes library? |
| 598 | case "${need_opcodes}" in |
| 599 | yes) |
| 600 | OPCODES_LIB=../opcodes/libopcodes.la |
| 601 | ;; |
| 602 | esac |
| 603 | |
| 604 | case "${need_bfd}" in |
| 605 | yes) |
| 606 | BFDLIB=../bfd/libbfd.la |
| 607 | ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h" |
| 608 | ;; |
| 609 | esac |
| 610 | |
| 611 | AC_SUBST(BFDLIB) |
| 612 | AC_SUBST(OPCODES_LIB) |
| 613 | |
| 614 | AC_SUBST(ALL_OBJ_DEPS) |
| 615 | |
| 616 | AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}") |
| 617 | AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}") |
| 618 | AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}") |
| 619 | AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}") |
| 620 | AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}") |
| 621 | |
| 622 | AC_PROG_CC |
| 623 | |
| 624 | AC_PROG_YACC |
| 625 | AC_PROG_LEX |
| 626 | AC_DECL_YYTEXT |
| 627 | |
| 628 | AM_MAINTAINER_MODE |
| 629 | AM_CYGWIN32 |
| 630 | AM_EXEEXT |
| 631 | |
| 632 | AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h) |
| 633 | |
| 634 | # Put this here so that autoconf's "cross-compiling" message doesn't confuse |
| 635 | # people who are not cross-compiling but are compiling cross-assemblers. |
| 636 | AC_MSG_CHECKING(whether compiling a cross-assembler) |
| 637 | if test "${host}" = "${target}"; then |
| 638 | cross_gas=no |
| 639 | else |
| 640 | cross_gas=yes |
| 641 | AC_DEFINE(CROSS_COMPILE) |
| 642 | fi |
| 643 | AC_MSG_RESULT($cross_gas) |
| 644 | |
| 645 | dnl ansidecl.h will deal with const |
| 646 | dnl AC_CONST |
| 647 | AC_FUNC_ALLOCA |
| 648 | AC_C_INLINE |
| 649 | |
| 650 | # VMS doesn't have unlink. |
| 651 | AC_CHECK_FUNCS(unlink remove, break) |
| 652 | |
| 653 | # Some systems don't have sbrk(). |
| 654 | AC_CHECK_FUNCS(sbrk) |
| 655 | |
| 656 | # Some non-ANSI preprocessors botch requoting inside strings. That's bad |
| 657 | # enough, but on some of those systems, the assert macro relies on requoting |
| 658 | # working properly! |
| 659 | GAS_WORKING_ASSERT |
| 660 | |
| 661 | # On some systems, the system header files may not declare malloc, realloc, |
| 662 | # and free. There are places where gas needs these functions to have been |
| 663 | # declared -- such as when taking their addresses. |
| 664 | gas_test_headers=" |
| 665 | #ifdef HAVE_MEMORY_H |
| 666 | #include <memory.h> |
| 667 | #endif |
| 668 | #ifdef HAVE_STRING_H |
| 669 | #include <string.h> |
| 670 | #else |
| 671 | #ifdef HAVE_STRINGS_H |
| 672 | #include <strings.h> |
| 673 | #endif |
| 674 | #endif |
| 675 | #ifdef HAVE_STDLIB_H |
| 676 | #include <stdlib.h> |
| 677 | #endif |
| 678 | #ifdef HAVE_UNISTD_H |
| 679 | #include <unistd.h> |
| 680 | #endif |
| 681 | " |
| 682 | GAS_CHECK_DECL_NEEDED(strstr, f, char *(*f)(), $gas_test_headers) |
| 683 | GAS_CHECK_DECL_NEEDED(malloc, f, char *(*f)(), $gas_test_headers) |
| 684 | GAS_CHECK_DECL_NEEDED(free, f, void (*f)(), $gas_test_headers) |
| 685 | GAS_CHECK_DECL_NEEDED(sbrk, f, char *(*f)(), $gas_test_headers) |
| 686 | |
| 687 | # Does errno.h declare errno, or do we have to add a separate declaration |
| 688 | # for it? |
| 689 | GAS_CHECK_DECL_NEEDED(errno, f, int f, [ |
| 690 | #ifdef HAVE_ERRNO_H |
| 691 | #include <errno.h> |
| 692 | #endif |
| 693 | ]) |
| 694 | |
| 695 | dnl This must come last. |
| 696 | |
| 697 | dnl We used to make symlinks to files in the source directory, but now |
| 698 | dnl we just use the right name for .c files, and create .h files in |
| 699 | dnl the build directory which include the right .h file. Make sure |
| 700 | dnl the old symlinks don't exist, so that a reconfigure in an existing |
| 701 | dnl directory behaves reasonably. |
| 702 | |
| 703 | AC_OUTPUT(Makefile doc/Makefile .gdbinit:gdbinit.in, |
| 704 | [rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h |
| 705 | echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h |
| 706 | echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h |
| 707 | echo '#include "te-'"${te_file}"'.h"' > targ-env.h |
| 708 | echo '#include "itbl-'"${target_cpu_type}"'.h"' > itbl-cpu.h |
| 709 | case ${target_cpu_type} in |
| 710 | m32r) echo '#include "opcodes/'"${target_cpu_type}"'-opc.h"' > cgen-opc.h ;; |
| 711 | esac], |
| 712 | [target_cpu_type=${target_cpu_type} |
| 713 | obj_format=${obj_format} |
| 714 | te_file=${te_file}]) |