Commit | Line | Data |
---|---|---|
ef346f1a ILT |
1 | dnl Process this file with autoconf to produce a configure script |
2 | dnl | |
3 | AC_PREREG(2.0) | |
4 | AC_INIT(ldmain.c) | |
5 | ||
6 | AC_ARG_ENABLE(targets, | |
7 | [ --enable-targets alternative target configurations], | |
8 | [case "${enableval}" in | |
9 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') | |
10 | ;; | |
11 | no) enable_targets= ;; | |
12 | *) enable_targets=$enableval ;; | |
13 | esac])dnl | |
2e598345 ILT |
14 | AC_ARG_ENABLE(shared, |
15 | [ --enable-shared build shared BFD library], | |
16 | [case "${enableval}" in | |
17 | yes) shared=true ;; | |
18 | no) shared=false ;; | |
19 | *) AC_MSG_ERROR([bad value ${enableval} for BFD shared option]) ;; | |
20 | esac])dnl | |
ef346f1a ILT |
21 | |
22 | AC_CONFIG_HEADER(config.h:config.in) | |
23 | ||
24 | AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`) | |
25 | AC_CANONICAL_SYSTEM | |
26 | if test -z "$target" ; then | |
27 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) | |
28 | fi | |
29 | if test -z "$host" ; then | |
30 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) | |
31 | fi | |
32 | AC_ARG_PROGRAM | |
02757e59 | 33 | |
ef346f1a | 34 | # host-specific stuff: |
02757e59 | 35 | |
ef346f1a | 36 | . ${srcdir}/configure.host |
02757e59 | 37 | |
ef346f1a ILT |
38 | AC_PROG_CC |
39 | AC_SUBST(CFLAGS) | |
2e598345 | 40 | AC_SUBST(HLDFLAGS) |
ef346f1a ILT |
41 | AC_SUBST(HDEFINES) |
42 | AC_SUBST(HOSTING_CRT0) | |
43 | AC_SUBST(HOSTING_LIBS) | |
44 | AC_SUBST(NATIVE_LIB_DIRS) | |
8ddef552 | 45 | |
2e598345 ILT |
46 | # For most hosts we can use a simple definition to pick up the BFD and |
47 | # opcodes libraries. However, if we are building shared libraries, we | |
48 | # need to handle some hosts specially. | |
49 | BFDLIB='-L../bfd -lbfd' | |
50 | if test "${shared}" = "true"; then | |
51 | case "${host}" in | |
52 | *-*-sunos*) | |
53 | # On SunOS, we must link against the name we are going to install, | |
54 | # not -lbfd, since SunOS does not support SONAME. | |
55 | BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' | |
56 | ;; | |
57 | esac | |
58 | fi | |
59 | AC_SUBST(BFDLIB) | |
60 | ||
ef346f1a ILT |
61 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) |
62 | AC_CHECK_FUNCS(sbrk) | |
2e598345 | 63 | AC_HEADER_DIRENT |
ab57b174 | 64 | |
ef346f1a | 65 | BFD_BINARY_FOPEN |
02757e59 | 66 | |
2e598345 ILT |
67 | BFD_NEED_DECLARATION(free) |
68 | ||
ef346f1a | 69 | # target-specific stuff: |
02757e59 | 70 | |
1c4b3cda | 71 | # Canonicalize the secondary target names. |
ef346f1a | 72 | if test -n "$enable_targets"; then |
cdf71377 | 73 | for targ in `echo $enable_targets | sed 's/,/ /g'` |
1c4b3cda | 74 | do |
ef346f1a ILT |
75 | result=`$ac_config_sub $targ 2>/dev/null` |
76 | if test -n "$result"; then | |
1c4b3cda ILT |
77 | canon_targets="$canon_targets $result" |
78 | else | |
79 | # Allow targets that config.sub doesn't recognize, like "all". | |
80 | canon_targets="$canon_targets $targ" | |
81 | fi | |
82 | done | |
83 | fi | |
84 | ||
85 | all_targets=false | |
ef346f1a ILT |
86 | EMUL= |
87 | all_emuls= | |
1c4b3cda ILT |
88 | |
89 | for targ in $target $canon_targets | |
90 | do | |
ef346f1a | 91 | if test "x$targ" = "xall"; then |
1c4b3cda ILT |
92 | all_targets=true |
93 | else | |
ef346f1a | 94 | . ${srcdir}/configure.tgt |
7f2649bb | 95 | |
ef346f1a ILT |
96 | if test "x$targ" = "x$target"; then |
97 | EMUL=${targ_emul} | |
1c4b3cda | 98 | fi |
ef346f1a ILT |
99 | |
100 | all_emuls="${all_emuls} ${targ_emul} ${targ_extra_emuls}" | |
1c4b3cda ILT |
101 | fi |
102 | done | |
103 | ||
ef346f1a | 104 | AC_SUBST(EMUL) |
1c4b3cda | 105 | |
ef346f1a | 106 | if test x${all_targets} = xfalse; then |
1c4b3cda ILT |
107 | # uniq the list. |
108 | f="" | |
ef346f1a | 109 | for i in $all_emuls ; do |
1c4b3cda | 110 | case " $f " in |
ef346f1a ILT |
111 | *" e$i.o "*) ;; |
112 | *) f="$f e$i.o" ;; | |
1c4b3cda ILT |
113 | esac |
114 | done | |
1c4b3cda | 115 | |
ef346f1a | 116 | EMULATION_OFILES="$f" |
1c4b3cda ILT |
117 | |
118 | else # all_targets is true | |
ef346f1a | 119 | EMULATION_OFILES='$(ALL_EMULATIONS)' |
1c4b3cda ILT |
120 | fi # all_targets is true |
121 | ||
ef346f1a | 122 | AC_SUBST(EMULATION_OFILES) |
8ddef552 | 123 | |
ef346f1a ILT |
124 | AC_OUTPUT(Makefile, |
125 | [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) |