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