* configure.in: Use CYGWIN and EXEEXT autoconf macro to look for
[deliverable/binutils-gdb.git] / ld / configure.in
1 dnl Process this file with autoconf to produce a configure script
2 dnl
3 AC_PREREG(2.5)
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
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 *bfd*) shared=true ;;
20 *) shared=false ;;
21 esac])dnl
22 AC_ARG_ENABLE(64-bit-bfd,
23 [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
24 [case "${enableval}" in
25 yes) want64=true ;;
26 no) want64=false ;;
27 *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
28 esac],[want64=false])dnl
29
30 AC_CONFIG_HEADER(config.h:config.in)
31
32 AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`)
33 AC_CANONICAL_SYSTEM
34 if test -z "$target" ; then
35 AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
36 fi
37 if test -z "$host" ; then
38 AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
39 fi
40 AC_ARG_PROGRAM
41
42 # host-specific stuff:
43
44 AC_PROG_CC
45 AC_PROG_INSTALL
46 CY_CYGWIN32
47 CY_EXEEXT
48
49 . ${srcdir}/configure.host
50
51 AC_SUBST(HLDFLAGS)
52 AC_SUBST(HLDENV)
53 AC_SUBST(RPATH_ENVVAR)
54 AC_SUBST(HDEFINES)
55 AC_SUBST(HOSTING_CRT0)
56 AC_SUBST(HOSTING_LIBS)
57 AC_SUBST(NATIVE_LIB_DIRS)
58
59 # For most hosts we can use a simple definition to pick up the BFD and
60 # opcodes libraries. However, if we are building shared libraries, we
61 # need to handle some hosts specially.
62 BFDLIB='-L../bfd -lbfd'
63 case "${host}" in
64 *-*-sunos*)
65 # On SunOS, we must link against the name we are going to install,
66 # not -lbfd, since SunOS does not support SONAME.
67 if test "${shared}" = "true"; then
68 BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
69 fi
70 ;;
71 alpha*-*-osf*)
72 # On Alpha OSF/1, the native linker searches all the -L
73 # directories for any LIB.so files, and only then searches for any
74 # LIB.a files. That means that if there is an installed
75 # libbfd.so, but this build is not done with --enable-shared, the
76 # link will wind up being against the install libbfd.so rather
77 # than the newly built libbfd. To avoid this, we must explicitly
78 # link against libbfd.a when --enable-shared is not used.
79 if test "${shared}" != "true"; then
80 BFDLIB='../bfd/libbfd.a'
81 fi
82 ;;
83 esac
84 AC_SUBST(BFDLIB)
85
86 AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h)
87 AC_CHECK_FUNCS(sbrk)
88 AC_HEADER_DIRENT
89
90 BFD_BINARY_FOPEN
91
92 BFD_NEED_DECLARATION(strstr)
93 BFD_NEED_DECLARATION(free)
94 BFD_NEED_DECLARATION(sbrk)
95 BFD_NEED_DECLARATION(getenv)
96
97 # target-specific stuff:
98
99 all_targets=
100 EMUL=
101 all_emuls=
102 TDIRS=
103
104 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
105 do
106 if test "$targ_alias" = "all"; then
107 all_targets=true
108 else
109 # Canonicalize the secondary target names.
110 result=`${CONFIG_SHELL-/bin/sh} $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; 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 TDIRS="$TDIRS\\
131 tdir_$i=$result"
132 ;;
133 esac
134 done
135 fi
136 done
137
138 AC_SUBST(EMUL)
139 AC_SUBST(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 else
151 EMULATION_OFILES=$all_emuls
152 fi
153 AC_SUBST(EMULATION_OFILES)
154
155 AC_OUTPUT(Makefile,
156 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])
This page took 0.036666 seconds and 5 git commands to generate.