]>
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 | |
7e19f60e ILT |
36 | AC_PROG_CC |
37 | ||
ef346f1a | 38 | . ${srcdir}/configure.host |
02757e59 | 39 | |
ef346f1a | 40 | AC_SUBST(CFLAGS) |
2e598345 | 41 | AC_SUBST(HLDFLAGS) |
ad43e45b | 42 | AC_SUBST(RPATH_ENVVAR) |
ef346f1a ILT |
43 | AC_SUBST(HDEFINES) |
44 | AC_SUBST(HOSTING_CRT0) | |
45 | AC_SUBST(HOSTING_LIBS) | |
46 | AC_SUBST(NATIVE_LIB_DIRS) | |
8ddef552 | 47 | |
2e598345 ILT |
48 | # For most hosts we can use a simple definition to pick up the BFD and |
49 | # opcodes libraries. However, if we are building shared libraries, we | |
50 | # need to handle some hosts specially. | |
51 | BFDLIB='-L../bfd -lbfd' | |
52 | if test "${shared}" = "true"; then | |
53 | case "${host}" in | |
54 | *-*-sunos*) | |
55 | # On SunOS, we must link against the name we are going to install, | |
56 | # not -lbfd, since SunOS does not support SONAME. | |
57 | BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`' | |
58 | ;; | |
59 | esac | |
60 | fi | |
61 | AC_SUBST(BFDLIB) | |
62 | ||
ef346f1a ILT |
63 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) |
64 | AC_CHECK_FUNCS(sbrk) | |
2e598345 | 65 | AC_HEADER_DIRENT |
ab57b174 | 66 | |
ef346f1a | 67 | BFD_BINARY_FOPEN |
02757e59 | 68 | |
2e598345 ILT |
69 | BFD_NEED_DECLARATION(free) |
70 | ||
ef346f1a | 71 | # target-specific stuff: |
02757e59 | 72 | |
95d31c3c | 73 | all_targets= |
ef346f1a ILT |
74 | EMUL= |
75 | all_emuls= | |
95d31c3c | 76 | TDIRS= |
1c4b3cda | 77 | |
95d31c3c | 78 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` |
1c4b3cda | 79 | do |
95d31c3c ILT |
80 | if test "$targ_alias" = "all"; then |
81 | all_targets=true | |
82 | else | |
83 | # Canonicalize the secondary target names. | |
84 | result=`$ac_config_sub $targ_alias 2>/dev/null` | |
85 | if test -n "$result"; then | |
86 | targ=$result | |
1c4b3cda | 87 | else |
95d31c3c ILT |
88 | targ=$targ_alias |
89 | fi | |
7f2649bb | 90 | |
95d31c3c | 91 | . ${srcdir}/configure.tgt |
ef346f1a | 92 | |
95d31c3c ILT |
93 | if test "$targ" = "$target"; then |
94 | EMUL=$targ_emul | |
1c4b3cda | 95 | fi |
1c4b3cda | 96 | |
95d31c3c ILT |
97 | for i in $targ_emul $targ_extra_emuls; do |
98 | case " $all_emuls " in | |
99 | *" e${i}.o "*) ;; | |
100 | *) | |
101 | all_emuls="$all_emuls e${i}.o" | |
102 | eval result=\$tdir_$i | |
103 | test -z "$result" && result=$targ_alias | |
104 | TDIRS="$TDIRS\\ | |
105 | tdir_$i=$result" | |
106 | ;; | |
1c4b3cda ILT |
107 | esac |
108 | done | |
95d31c3c ILT |
109 | fi |
110 | done | |
1c4b3cda | 111 | |
95d31c3c ILT |
112 | AC_SUBST(EMUL) |
113 | AC_SUBST(TDIRS) | |
1c4b3cda | 114 | |
95d31c3c ILT |
115 | if test x${all_targets} = xtrue; then |
116 | EMULATION_OFILES='$(ALL_EMULATIONS)' | |
117 | else | |
118 | EMULATION_OFILES=$all_emuls | |
119 | fi | |
ef346f1a | 120 | AC_SUBST(EMULATION_OFILES) |
8ddef552 | 121 | |
ef346f1a ILT |
122 | AC_OUTPUT(Makefile, |
123 | [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) |