| 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 Remember to use "dnl" in each line before the AC_INIT call... |
| 7 | dnl |
| 8 | dnl |
| 9 | AC_INIT(as.h) |
| 10 | dnl |
| 11 | bfd_gas=no |
| 12 | user_bfd_gas= |
| 13 | AC_ARG_ENABLE(bfd-assembler, |
| 14 | [ bfd-assembler use BFD back end for writing object files], |
| 15 | [case "${enableval}" in |
| 16 | yes) need_bfd=yes user_bfd_gas=yes ;; |
| 17 | no) user_bfd_gas=no ;; |
| 18 | *) AC_MSG_ERROR(bad value ${enableval} given for bfd-assembler option) ;; |
| 19 | esac])dnl |
| 20 | |
| 21 | # Generate a header file -- gets more post-processing by Makefile later. |
| 22 | AC_CONFIG_HEADER(conf) |
| 23 | |
| 24 | dnl For recursion to work right, this must be an absolute pathname. |
| 25 | AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..) |
| 26 | AC_CANONICAL_SYSTEM |
| 27 | AC_PROGRAM_TRANSFORM_NAME |
| 28 | |
| 29 | emulation=generic |
| 30 | |
| 31 | # assign cpu type |
| 32 | |
| 33 | # check for architecture variants |
| 34 | case ${target_cpu} in |
| 35 | hppa*) cpu_type=hppa ;; |
| 36 | changequote(,)dnl |
| 37 | i[45]86) cpu_type=i386 ;; |
| 38 | m680[012346]0) cpu_type=m68k ;; |
| 39 | m68008) cpu_type=m68k ;; |
| 40 | m683??) cpu_type=m68k ;; |
| 41 | changequote([,])dnl |
| 42 | m8*) cpu_type=m88k ;; |
| 43 | mips*el) cpu_type=mips endian=little;; |
| 44 | mips*) cpu_type=mips endian=big ;; |
| 45 | powerpc*) cpu_type=ppc ;; |
| 46 | rs6000*) cpu_type=ppc ;; |
| 47 | sparc64) cpu_type=sparc obj_format=elf AC_DEFINE(sparcv9) ;; |
| 48 | sparclite*) cpu_type=sparc ;; |
| 49 | *) cpu_type=${target_cpu} ;; |
| 50 | esac |
| 51 | |
| 52 | # do we need the opcodes library? |
| 53 | case ${cpu_type} in |
| 54 | alpha | vax) |
| 55 | ;; |
| 56 | *) |
| 57 | OPCODES_LIB="../opcodes/libopcodes.a" |
| 58 | ;; |
| 59 | esac |
| 60 | AC_SUBST(OPCODES_LIB) |
| 61 | |
| 62 | gas_target=${cpu_type} |
| 63 | generic_target=${cpu_type}-${target_vendor}-${target_os} |
| 64 | dev=no |
| 65 | |
| 66 | # assign object format |
| 67 | case ${generic_target} in |
| 68 | a29k-amd-udi) obj_format=coff gas_target=ebmon29k ;; |
| 69 | a29k-amd-ebmon) obj_format=coff gas_target=ebmon29k ;; |
| 70 | |
| 71 | alpha-*-netware*) obj_format=ecoff ;; |
| 72 | alpha-*-osf*) obj_format=ecoff ;; |
| 73 | |
| 74 | arm-*-riscix*) obj_format=aout bfd_gas=yes ;; |
| 75 | |
| 76 | hppa-*-*elf*) obj_format=elf emulation=hppa ;; |
| 77 | hppa-*-osf*) obj_format=som emulation=hppa ;; |
| 78 | hppa-*-hpux*) obj_format=som emulation=hppa ;; |
| 79 | hppa-*-bsd*) obj_format=som emulation=hppa ;; |
| 80 | hppa-*-hiux*) obj_format=som emulation=hppa ;; |
| 81 | |
| 82 | h8300-*-coff) obj_format=coff ;; |
| 83 | |
| 84 | i386-ibm-aix*) obj_format=coff gas_target=i386coff |
| 85 | emulation=i386aix ;; |
| 86 | i386-*-bsd*) obj_format=aout emulation=386bsd ;; |
| 87 | i386-*-netbsd0.8) obj_format=aout emulation=386bsd ;; |
| 88 | i386-*-netbsd*) obj_format=aout emulation=netbsd ;; |
| 89 | i386-*-linux*elf*) obj_format=elf emulation=linux ;; |
| 90 | i386-*-linux*coff*) obj_format=coff emulation=linux |
| 91 | gas_target=i386coff ;; |
| 92 | i386-*-linux*) obj_format=aout emulation=linux bfd_gas=preferred ;; |
| 93 | i386-*-lynxos*) obj_format=coff gas_target=i386coff |
| 94 | emulation=lynx ;; |
| 95 | i386-*-sysv4* | i386-*-solaris* | i386-*-elf) |
| 96 | obj_format=elf ;; |
| 97 | i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) |
| 98 | obj_format=coff gas_target=i386coff ;; |
| 99 | i386-*-vsta) obj_format=aout ;; |
| 100 | i386-*-go32) obj_format=coff gas_target=i386coff ;; |
| 101 | i386-*-mach* | i386-*-gnu*) |
| 102 | obj_format=aout emulation=mach bfd_gas=yes ;; |
| 103 | |
| 104 | i960-*-bout) obj_format=bout ;; |
| 105 | i960-*-coff) obj_format=coff emulation=ic960 gas_target=ic960coff ;; |
| 106 | i960-*-nindy*) obj_format=bout ;; |
| 107 | i960-*-vxworks4*) obj_format=bout ;; |
| 108 | i960-*-vxworks5.0) obj_format=bout ;; |
| 109 | i960-*-vxworks5.*) obj_format=coff emulation=ic960 gas_target=ic960coff ;; |
| 110 | i960-*-vxworks*) obj_format=bout ;; |
| 111 | |
| 112 | m68k-wrs-vxworks | m68k-ericsson-ose | m68k-*-sunos*) |
| 113 | obj_format=aout emulation=sun3 ;; |
| 114 | m68k-motorola-sysv) obj_format=coff gas_target=m68kcoff emulation=delta ;; |
| 115 | m68k-bull-sysv3*) obj_format=coff gas_target=m68kcoff emulation=dpx2 ;; |
| 116 | m68k-apollo-*) obj_format=coff gas_target=apollo emulation=apollo ;; |
| 117 | m68k-*-coff | m68k-*-sysv*) |
| 118 | obj_format=coff gas_target=m68kcoff ;; |
| 119 | m68k-*-hpux) obj_format=hp300 emulation=hp300 ;; |
| 120 | m68k-*-lynxos*) obj_format=coff gas_target=m68kcoff |
| 121 | emulation=lynx ;; |
| 122 | |
| 123 | m88k-*-coff*) obj_format=coff gas_target=m88kcoff ;; |
| 124 | |
| 125 | # don't change emulation like *-*-bsd does |
| 126 | mips-*-bsd*) bfd_gas=yes obj_format=aout gas_target=mips-lit ;; |
| 127 | mips-*-ultrix*) obj_format=ecoff gas_target=mips-lit ;; |
| 128 | mips-*-ecoff*) obj_format=ecoff |
| 129 | case "$endian" in |
| 130 | big) gas_target=mips-big ;; |
| 131 | *) gas_target=mips-lit ;; |
| 132 | esac |
| 133 | ;; |
| 134 | mips-*-ecoff*) obj_format=ecoff gas_target=mips-big ;; |
| 135 | mips-*-irix5*) obj_format=elf gas_target=mips-big ;; |
| 136 | mips-*-irix*) obj_format=ecoff gas_target=mips-big ;; |
| 137 | mips-*-riscos*) obj_format=ecoff gas_target=mips-big ;; |
| 138 | mips-*-sysv*) obj_format=ecoff gas_target=mips-big ;; |
| 139 | mips-*-elf*) obj_format=elf |
| 140 | case "$endian" in |
| 141 | big) gas_target=mips-big ;; |
| 142 | *) gas_target=mips-lit ;; |
| 143 | esac |
| 144 | ;; |
| 145 | ppc-*-aix*) obj_format=coff bfd_gas=yes ;; |
| 146 | ppc-*-elf*) obj_format=elf bfd_gas=yes ;; |
| 147 | ppc-*-netware*) obj_format=elf emulation=ppcnw ;; |
| 148 | ppc-*-sysv4*) obj_format=elf bfd_gas=yes ;; |
| 149 | |
| 150 | sh-*-coff) obj_format=coff ;; |
| 151 | |
| 152 | ns32k-pc532-mach*) obj_format=aout emulation=pc532 bfd_gas=yes ;; |
| 153 | ns32k-pc532-netbsd*) obj_format=aout emulation=netbsd532 bfd_gas=yes ;; |
| 154 | |
| 155 | sparc*-*-sunos4*) obj_format=aout emulation=sun3 bfd_gas=yes ;; |
| 156 | sparc*-*-aout | sparc*-*-vxworks) |
| 157 | obj_format=aout bfd_gas=yes ;; |
| 158 | sparc*-*-coff) obj_format=coff bfd_gas=yes ;; |
| 159 | sparc*-*-lynxos*) obj_format=coff bfd_gas=yes emulation=lynx ;; |
| 160 | sparc*-fujitsu-none) obj_format=aout bfd_gas=yes ;; |
| 161 | sparc*-*-elf | sparc*-*-solaris*) |
| 162 | obj_format=elf ;; |
| 163 | |
| 164 | vax-*-bsd* | vax-*-ultrix*) |
| 165 | obj_format=aout ;; |
| 166 | vax-*-vms) obj_format=vms ;; |
| 167 | |
| 168 | z8k-*-coff | z8k-*-sim) |
| 169 | obj_format=coff ;; |
| 170 | |
| 171 | *-*-aout | *-*-scout) |
| 172 | obj_format=aout ;; |
| 173 | *-*-nindy*) |
| 174 | obj_format=bout ;; |
| 175 | *-*-bsd*) |
| 176 | obj_format=aout emulation=sun3 ;; |
| 177 | *-*-generic) obj_format=generic ;; |
| 178 | *-*-xray | *-*-hms) obj_format=coff ;; |
| 179 | *-*-sim) obj_format=coff ;; |
| 180 | *-*-elf | *-*-sysv4* | *-*-solaris*) |
| 181 | AC_MSG_WARN(GAS support for ELF format is incomplete) |
| 182 | obj_format=elf dev=yes ;; |
| 183 | *-*-vxworks) obj_format=aout ;; |
| 184 | *-*-netware) obj_format=elf ;; |
| 185 | esac |
| 186 | |
| 187 | # Assign floating point type. Most processors with FP support |
| 188 | # IEEE FP. On those that don't support FP at all, usually IEEE |
| 189 | # is emulated. |
| 190 | case ${target_cpu} in |
| 191 | vax | tahoe ) atof=${target_cpu} ;; |
| 192 | *) atof=ieee ;; |
| 193 | esac |
| 194 | |
| 195 | case "${obj_format}" in |
| 196 | "") AC_MSG_ERROR(GAS does not know what format to use for target ${target}) ;; |
| 197 | esac |
| 198 | |
| 199 | dnl |
| 200 | dnl Make sure the desired support files exist. |
| 201 | dnl |
| 202 | |
| 203 | if test ! -r ${srcdir}/config/tc-${cpu_type}.c; then |
| 204 | AC_MSG_ERROR(GAS does not support target CPU ${cpu_type}) |
| 205 | fi |
| 206 | |
| 207 | if test ! -r ${srcdir}/config/obj-${obj_format}.c; then |
| 208 | AC_MSG_ERROR(GAS does not have support for object file format ${obj_format}) |
| 209 | fi |
| 210 | |
| 211 | # and target makefile frag |
| 212 | |
| 213 | target_frag=${srcdir}/config/${gas_target}.mt |
| 214 | AC_SUBST_FILE(target_frag) |
| 215 | |
| 216 | case ${cpu_type}-${obj_format} in |
| 217 | # not yet |
| 218 | # i386-aout) bfd_gas=preferred ;; |
| 219 | *-elf) bfd_gas=yes ;; |
| 220 | *-ecoff) bfd_gas=yes ;; |
| 221 | *-som) bfd_gas=yes ;; |
| 222 | *) ;; |
| 223 | esac |
| 224 | |
| 225 | case ${user_bfd_gas}-${bfd_gas} in |
| 226 | yes-yes | no-no) |
| 227 | # We didn't override user's choice. |
| 228 | ;; |
| 229 | no-yes) |
| 230 | AC_MSG_WARN(Use of BFD is required for ${target}; overriding config options.) |
| 231 | ;; |
| 232 | no-preferred) |
| 233 | bfd_gas=no |
| 234 | ;; |
| 235 | *-preferred) |
| 236 | bfd_gas=yes |
| 237 | ;; |
| 238 | -*) |
| 239 | # User specified nothing. |
| 240 | ;; |
| 241 | esac |
| 242 | |
| 243 | case ${bfd_gas}-${cpu_type}-${obj_format} in |
| 244 | yes-*-coff) need_bfd=yes ;; |
| 245 | no-*-coff) need_bfd=yes |
| 246 | AC_DEFINE(MANY_SEGMENTS) ;; |
| 247 | esac |
| 248 | |
| 249 | reject_dev_configs=yes |
| 250 | |
| 251 | case ${reject_dev_configs}-${dev} in |
| 252 | yes-yes) # Oops. |
| 253 | AC_MSG_ERROR(GAS does not support the ${generic_target} configuration.) |
| 254 | ;; |
| 255 | esac |
| 256 | |
| 257 | dnl Looks like the AC_MAKE_LINKS string is taken literally and put into the |
| 258 | dnl config.status file. So the necessary variables also have to be |
| 259 | dnl exported. |
| 260 | AC_SUBST(cpu_type) AC_SUBST(obj_format) AC_SUBST(emulation) AC_SUBST(atof) |
| 261 | AC_LINK_FILES(targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c, |
| 262 | config/tc-${cpu_type}.c config/tc-${cpu_type}.h \ |
| 263 | config/obj-${obj_format}.h config/obj-${obj_format}.c \ |
| 264 | config/te-${emulation}.h config/atof-${atof}.c) |
| 265 | |
| 266 | case "${bfd_gas}" in |
| 267 | yes) AC_DEFINE(BFD_ASSEMBLER) |
| 268 | need_bfd=yes ;; |
| 269 | esac |
| 270 | |
| 271 | case "${need_bfd}" in |
| 272 | yes) BFDLIB=../bfd/libbfd.a |
| 273 | ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h" |
| 274 | ;; |
| 275 | esac |
| 276 | AC_SUBST(BFDLIB) |
| 277 | AC_SUBST(ALL_OBJ_DEPS) |
| 278 | |
| 279 | case "x${host}" in |
| 280 | x${target}) ;; |
| 281 | *) AC_DEFINE(CROSS_COMPILE);; |
| 282 | esac |
| 283 | |
| 284 | AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}") |
| 285 | AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}") |
| 286 | AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}") |
| 287 | AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}") |
| 288 | AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}") |
| 289 | |
| 290 | case ${host} in |
| 291 | rs6000-*-*) |
| 292 | # The IBM compiler mis-compiles some expressions used in gas. |
| 293 | # This will tell gas to work around this lossage. |
| 294 | AC_DEFINE(IBM_COMPILER_SUX) ;; |
| 295 | i386-*-go32) |
| 296 | # Using fopen(..., "w") for a binary file breaks under DOS. |
| 297 | AC_DEFINE(WANT_FOPEN_BIN) ;; |
| 298 | esac |
| 299 | |
| 300 | AC_PROG_CC |
| 301 | AC_PROG_INSTALL |
| 302 | |
| 303 | AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h) |
| 304 | |
| 305 | dnl ansidecl.h will deal with const |
| 306 | dnl AC_CONST |
| 307 | AC_FUNC_ALLOCA |
| 308 | AC_C_INLINE |
| 309 | |
| 310 | # Some non-ANSI preprocessors botch requoting inside strings. That's bad |
| 311 | # enough, but on some of those systems, the assert macro relies on requoting |
| 312 | # working properly! |
| 313 | AC_MSG_CHECKING([for working assert macro]) |
| 314 | AC_CACHE_VAL(gas_cv_assert_ok, |
| 315 | AC_TRY_LINK([#include <assert.h> |
| 316 | #include <stdio.h>], [ |
| 317 | /* check for requoting problems */ |
| 318 | static int a, b, c, d; |
| 319 | static char *s; |
| 320 | assert (!strcmp(s, "foo bar baz quux")); |
| 321 | /* check for newline handling */ |
| 322 | assert (a == b |
| 323 | || c == d); |
| 324 | ], gas_cv_assert_ok=yes, gas_cv_assert_ok=no))dnl |
| 325 | AC_MSG_RESULT($gas_cv_assert_ok) |
| 326 | test $gas_cv_assert_ok = yes || AC_DEFINE(BROKEN_ASSERT) |
| 327 | |
| 328 | # On some systems, the system header files may not declare malloc, realloc, |
| 329 | # and free. There are places where gas needs these functions to have been |
| 330 | # declared -- such as when taking their addresses. |
| 331 | AC_MSG_CHECKING([whether a malloc declaration is required]) |
| 332 | AC_CACHE_VAL(gas_cv_malloc_decl_needed, |
| 333 | AC_TRY_LINK([ |
| 334 | #ifdef HAVE_MEMORY_H |
| 335 | #include <memory.h> |
| 336 | #endif |
| 337 | #ifdef HAVE_STRING_H |
| 338 | #include <string.h> |
| 339 | #endif |
| 340 | #ifdef HAVE_STDLIB_H |
| 341 | #include <stdlib.h> |
| 342 | #endif |
| 343 | #ifdef HAVE_UNISTD_H |
| 344 | #include <unistd.h> |
| 345 | #endif |
| 346 | ], [ |
| 347 | char *(*f) (); |
| 348 | f = (char *(*)()) malloc; |
| 349 | ], gas_cv_malloc_decl_needed=no, gas_cv_malloc_decl_needed=yes))dnl |
| 350 | AC_MSG_RESULT($gas_cv_malloc_decl_needed) |
| 351 | test $gas_cv_malloc_decl_needed = no || AC_DEFINE(NEED_MALLOC_DECLARATION) |
| 352 | |
| 353 | AC_MSG_CHECKING([whether a free declaration is required]) |
| 354 | AC_CACHE_VAL(gas_cv_free_decl_needed, |
| 355 | AC_TRY_LINK([ |
| 356 | #ifdef HAVE_MEMORY_H |
| 357 | #include <memory.h> |
| 358 | #endif |
| 359 | #ifdef HAVE_STRING_H |
| 360 | #include <string.h> |
| 361 | #endif |
| 362 | #ifdef HAVE_STDLIB_H |
| 363 | #include <stdlib.h> |
| 364 | #endif |
| 365 | #ifdef HAVE_UNISTD_H |
| 366 | #include <unistd.h> |
| 367 | #endif |
| 368 | ], [ |
| 369 | int (*f) (); |
| 370 | f = (int (*)()) free; |
| 371 | ], gas_cv_free_decl_needed=no, gas_cv_free_decl_needed=yes)) |
| 372 | AC_MSG_RESULT($gas_cv_free_decl_needed) |
| 373 | test $gas_cv_free_decl_needed = no || AC_DEFINE(NEED_FREE_DECLARATION) |
| 374 | |
| 375 | # Does errno.h declare errno, or do we have to add a separate declaration |
| 376 | # for it? |
| 377 | AC_MSG_CHECKING([whether an errno declaration is required]) |
| 378 | AC_CACHE_VAL(gas_cv_errno_decl_needed, |
| 379 | AC_TRY_LINK([ |
| 380 | #ifdef HAVE_ERRNO_H |
| 381 | #include <errno.h> |
| 382 | #endif |
| 383 | ], [ |
| 384 | int x; |
| 385 | x = errno; |
| 386 | ], gas_cv_errno_decl_needed=no, gas_cv_errno_decl_needed=yes)) |
| 387 | AC_MSG_RESULT($gas_cv_errno_decl_needed) |
| 388 | test $gas_cv_errno_decl_needed = no || AC_DEFINE(NEED_ERRNO_DECLARATION) |
| 389 | |
| 390 | AC_CONFIG_SUBDIRS(testsuite) |
| 391 | |
| 392 | dnl This must come last. |
| 393 | dnl Apparently symlinks are checked for in the directory containing |
| 394 | dnl the last Makefile. Thus the order used here... |
| 395 | AC_OUTPUT(doc/Makefile Makefile) |