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