Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | dnl Process this file with autoconf to produce a configure script |
2 | dnl | |
3 | AC_PREREG(2.13) | |
4 | AC_INIT(ldmain.c) | |
5 | ||
6 | AC_CANONICAL_SYSTEM | |
7 | ||
8 | AM_INIT_AUTOMAKE(ld, 2.9.4) | |
9 | ||
10 | AM_PROG_LIBTOOL | |
11 | ||
12 | AC_ARG_ENABLE(targets, | |
13 | [ --enable-targets alternative target configurations], | |
14 | [case "${enableval}" in | |
15 | yes | "") AC_ERROR(enable-targets option must specify target names or 'all') | |
16 | ;; | |
17 | no) enable_targets= ;; | |
18 | *) enable_targets=$enableval ;; | |
19 | esac])dnl | |
20 | AC_ARG_ENABLE(64-bit-bfd, | |
21 | [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], | |
22 | [case "${enableval}" in | |
23 | yes) want64=true ;; | |
24 | no) want64=false ;; | |
25 | *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; | |
26 | esac],[want64=false])dnl | |
27 | ||
28 | AM_CONFIG_HEADER(config.h:config.in) | |
29 | ||
30 | if test -z "$target" ; then | |
31 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) | |
32 | fi | |
33 | if test -z "$host" ; then | |
34 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) | |
35 | fi | |
36 | ||
37 | # host-specific stuff: | |
38 | ||
39 | AC_PROG_CC | |
40 | AC_PROG_INSTALL | |
41 | ||
42 | ALL_LINGUAS= | |
43 | CY_GNU_GETTEXT | |
44 | ||
45 | AC_EXEEXT | |
46 | ||
47 | AC_PROG_YACC | |
48 | AM_PROG_LEX | |
49 | ||
50 | AM_MAINTAINER_MODE | |
51 | ||
52 | . ${srcdir}/configure.host | |
53 | ||
54 | AC_SUBST(HDEFINES) | |
55 | AC_SUBST(HOSTING_CRT0) | |
56 | AC_SUBST(HOSTING_LIBS) | |
57 | AC_SUBST(NATIVE_LIB_DIRS) | |
58 | ||
59 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) | |
60 | AC_CHECK_FUNCS(sbrk) | |
61 | AC_HEADER_DIRENT | |
62 | ||
63 | BFD_BINARY_FOPEN | |
64 | ||
65 | BFD_NEED_DECLARATION(strstr) | |
66 | BFD_NEED_DECLARATION(free) | |
67 | BFD_NEED_DECLARATION(sbrk) | |
68 | BFD_NEED_DECLARATION(getenv) | |
69 | BFD_NEED_DECLARATION(environ) | |
70 | ||
71 | # target-specific stuff: | |
72 | ||
73 | all_targets= | |
74 | EMUL= | |
75 | all_emuls= | |
76 | all_emul_extras= | |
77 | ||
78 | dnl We need to get an arbitrary number of tdir definitions into | |
79 | dnl Makefile. We can't do it using AC_SUBST, because autoconf does | |
80 | dnl not permit literal newlines in an AC_SUBST variables. So we use a | |
81 | dnl file. | |
82 | rm -f tdirs | |
83 | ||
84 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` | |
85 | do | |
86 | if test "$targ_alias" = "all"; then | |
87 | all_targets=true | |
88 | else | |
89 | # Canonicalize the secondary target names. | |
90 | result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ_alias 2>/dev/null` | |
91 | if test -n "$result"; then | |
92 | targ=$result | |
93 | else | |
94 | targ=$targ_alias | |
95 | fi | |
96 | ||
97 | . ${srcdir}/configure.tgt | |
98 | ||
99 | if test "$targ" = "$target"; then | |
100 | EMUL=$targ_emul | |
101 | fi | |
102 | ||
3336653a | 103 | for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do |
252b5132 RH |
104 | case " $all_emuls " in |
105 | *" e${i}.o "*) ;; | |
106 | *) | |
107 | all_emuls="$all_emuls e${i}.o" | |
108 | eval result=\$tdir_$i | |
109 | test -z "$result" && result=$targ_alias | |
110 | echo tdir_$i=$result >> tdirs | |
111 | ;; | |
112 | esac | |
113 | done | |
114 | ||
3336653a RH |
115 | all_libpath=$targ_emul |
116 | for i in $targ_extra_libpath; do | |
117 | case " $all_libpath " in | |
118 | *" ${i} "*) ;; | |
119 | *) | |
120 | all_libpath="$all_libpath ${i}" | |
121 | ;; | |
122 | esac | |
123 | done | |
124 | ||
252b5132 RH |
125 | for i in $targ_extra_ofiles; do |
126 | case " $all_emul_extras " in | |
127 | *" ${i} "*) ;; | |
128 | *) | |
129 | all_emul_extras="$all_emul_extras ${i}" | |
130 | ;; | |
131 | esac | |
132 | done | |
133 | fi | |
134 | done | |
135 | ||
136 | AC_SUBST(EMUL) | |
137 | ||
138 | TDIRS=tdirs | |
139 | AC_SUBST_FILE(TDIRS) | |
140 | ||
141 | dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit | |
142 | dnl target, and in those cases we should also build the 64 bit | |
143 | dnl emulations. | |
144 | if test x${all_targets} = xtrue; then | |
145 | if test x${want64} = xtrue; then | |
146 | EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)' | |
147 | else | |
148 | EMULATION_OFILES='$(ALL_EMULATIONS)' | |
149 | fi | |
150 | EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)' | |
151 | else | |
152 | EMULATION_OFILES=$all_emuls | |
153 | EMUL_EXTRA_OFILES=$all_emul_extras | |
154 | fi | |
155 | AC_SUBST(EMULATION_OFILES) | |
156 | AC_SUBST(EMUL_EXTRA_OFILES) | |
157 | ||
3336653a RH |
158 | EMULATION_LIBPATH=$all_libpath |
159 | AC_SUBST(EMULATION_LIBPATH) | |
160 | ||
252b5132 RH |
161 | if test x${enable_static} = xno; then |
162 | TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so" | |
163 | else | |
164 | TESTBFDLIB="../bfd/.libs/libbfd.a" | |
165 | fi | |
166 | AC_SUBST(TESTBFDLIB) | |
167 | ||
168 | AC_OUTPUT(Makefile po/Makefile.in:po/Make-in, | |
169 | [sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile]) |