xref: /openbsd/gnu/usr.bin/binutils/ld/configure.in (revision 133306f0)
1dnl Process this file with autoconf to produce a configure script
2dnl
3AC_PREREG(2.13)
4AC_INIT(ldmain.c)
5
6AC_CANONICAL_SYSTEM
7
8AM_INIT_AUTOMAKE(ld, 2.10)
9
10AM_PROG_LIBTOOL
11
12AC_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 ;;
19esac])dnl
20AC_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) ;;
26esac],[want64=false])dnl
27
28AM_CONFIG_HEADER(config.h:config.in)
29
30if test -z "$target" ; then
31    AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
32fi
33if test -z "$host" ; then
34    AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
35fi
36
37# host-specific stuff:
38
39AC_PROG_CC
40AC_PROG_INSTALL
41
42ALL_LINGUAS=
43CY_GNU_GETTEXT
44
45AC_EXEEXT
46
47AC_PROG_YACC
48AM_PROG_LEX
49
50AM_MAINTAINER_MODE
51
52. ${srcdir}/configure.host
53
54AC_SUBST(HDEFINES)
55AC_SUBST(HOSTING_CRT0)
56AC_SUBST(HOSTING_LIBS)
57AC_SUBST(NATIVE_LIB_DIRS)
58
59AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h)
60AC_CHECK_FUNCS(sbrk)
61AC_HEADER_DIRENT
62
63BFD_BINARY_FOPEN
64
65BFD_NEED_DECLARATION(strstr)
66BFD_NEED_DECLARATION(free)
67BFD_NEED_DECLARATION(sbrk)
68BFD_NEED_DECLARATION(getenv)
69BFD_NEED_DECLARATION(environ)
70
71# When converting linker scripts into strings for use in emulation
72# files, use astring.sed if the compiler supports ANSI string
73# concatenation, or ostring.sed otherwise.  This is to support the
74# broken Microsoft MSVC compiler, which limits the length of string
75# constants, while still supporting pre-ANSI compilers which do not
76# support string concatenation.
77AC_MSG_CHECKING([whether ANSI C string concatenation works])
78AC_CACHE_VAL(ld_cv_string_concatenation,
79[AC_TRY_COMPILE(,[char *a = "a" "a";],
80  [ld_cv_string_concatenation=yes],
81  [ld_cv_string_concatenation=no])])
82AC_MSG_RESULT($ld_cv_string_concatenation)
83if test "$ld_cv_string_concatenation" = "yes"; then
84  STRINGIFY=astring.sed
85else
86  STRINGIFY=ostring.sed
87fi
88AC_SUBST(STRINGIFY)
89
90# target-specific stuff:
91
92all_targets=
93EMUL=
94all_emuls=
95all_emul_extras=
96all_libpath=
97
98dnl We need to get an arbitrary number of tdir definitions into
99dnl Makefile.  We can't do it using AC_SUBST, because autoconf does
100dnl not permit literal newlines in an AC_SUBST variables.  So we use a
101dnl file.
102rm -f tdirs
103
104for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
105do
106  if test "$targ_alias" = "all"; then
107    all_targets=true
108  else
109    # Canonicalize the secondary target names.
110    result=`$ac_config_sub $targ_alias 2>/dev/null`
111    if test -n "$result"; then
112	targ=$result
113    else
114	targ=$targ_alias
115    fi
116
117    . ${srcdir}/configure.tgt
118
119    if test "$targ" = "$target"; then
120      EMUL=$targ_emul
121    fi
122
123    for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do
124	case " $all_emuls " in
125	*" e${i}.o "*) ;;
126	*)
127	  all_emuls="$all_emuls e${i}.o"
128	  eval result=\$tdir_$i
129	  test -z "$result" && result=$targ_alias
130	  echo tdir_$i=$result >> tdirs
131	  ;;
132	esac
133    done
134
135    for i in $targ_emul $targ_extra_libpath; do
136	case " $all_libpath " in
137	*" ${i} "*) ;;
138	*)
139	  if test -z "$all_libpath"; then
140	    all_libpath=${i}
141	  else
142	    all_libpath="$all_libpath ${i}"
143	  fi
144	  ;;
145	esac
146    done
147
148    for i in $targ_extra_ofiles; do
149	case " $all_emul_extras " in
150	*" ${i} "*) ;;
151	*)
152	  all_emul_extras="$all_emul_extras ${i}"
153	  ;;
154	esac
155    done
156  fi
157done
158
159AC_SUBST(EMUL)
160
161TDIRS=tdirs
162AC_SUBST_FILE(TDIRS)
163
164dnl FIXME: We will build a 64 bit BFD for a 64 bit host or a 64 bit
165dnl target, and in those cases we should also build the 64 bit
166dnl emulations.
167if test x${all_targets} = xtrue; then
168  if test x${want64} = xtrue; then
169    EMULATION_OFILES='$(ALL_EMULATIONS) $(ALL_64_EMULATIONS)'
170  else
171    EMULATION_OFILES='$(ALL_EMULATIONS)'
172  fi
173  EMUL_EXTRA_OFILES='$(ALL_EMUL_EXTRA_OFILES)'
174else
175  EMULATION_OFILES=$all_emuls
176  EMUL_EXTRA_OFILES=$all_emul_extras
177fi
178AC_SUBST(EMULATION_OFILES)
179AC_SUBST(EMUL_EXTRA_OFILES)
180
181EMULATION_LIBPATH=$all_libpath
182AC_SUBST(EMULATION_LIBPATH)
183
184if test x${enable_static} = xno; then
185  TESTBFDLIB="--rpath ../bfd/.libs ../bfd/.libs/libbfd.so"
186else
187  TESTBFDLIB="../bfd/.libs/libbfd.a"
188fi
189AC_SUBST(TESTBFDLIB)
190
191target_vendor=${target_vendor=$host_vendor}
192case "$target_vendor" in
193  hp) EXTRA_SHLIB_EXTENSION=".sl" ;;
194  *)  EXTRA_SHLIB_EXTENSION= ;;
195esac
196if test x${EXTRA_SHLIB_EXTENSION} != x ; then
197  AC_DEFINE_UNQUOTED(EXTRA_SHLIB_EXTENSION, "$EXTRA_SHLIB_EXTENSION",
198   [Additional extension a shared object might have.])
199fi
200
201AC_OUTPUT(Makefile po/Makefile.in:po/Make-in,
202[sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])
203