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 | |
14 | ||
15 | AC_CONFIG_HEADER(config.h:config.in) | |
16 | ||
17 | AC_CONFIG_AUX_DIR(`cd $srcdir/..; pwd`) | |
18 | AC_CANONICAL_SYSTEM | |
19 | if test -z "$target" ; then | |
20 | AC_MSG_ERROR(Unrecognized target system type; please check config.sub.) | |
21 | fi | |
22 | if test -z "$host" ; then | |
23 | AC_MSG_ERROR(Unrecognized host system type; please check config.sub.) | |
24 | fi | |
25 | AC_ARG_PROGRAM | |
02757e59 | 26 | |
ef346f1a | 27 | # host-specific stuff: |
02757e59 | 28 | |
ef346f1a | 29 | . ${srcdir}/configure.host |
02757e59 | 30 | |
ef346f1a ILT |
31 | AC_PROG_CC |
32 | AC_SUBST(CFLAGS) | |
33 | AC_SUBST(HDEFINES) | |
34 | AC_SUBST(HOSTING_CRT0) | |
35 | AC_SUBST(HOSTING_LIBS) | |
36 | AC_SUBST(NATIVE_LIB_DIRS) | |
8ddef552 | 37 | |
ef346f1a ILT |
38 | AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h) |
39 | AC_CHECK_FUNCS(sbrk) | |
ab57b174 | 40 | |
ef346f1a | 41 | BFD_BINARY_FOPEN |
02757e59 | 42 | |
ef346f1a | 43 | # target-specific stuff: |
02757e59 | 44 | |
1c4b3cda | 45 | # Canonicalize the secondary target names. |
ef346f1a | 46 | if test -n "$enable_targets"; then |
cdf71377 | 47 | for targ in `echo $enable_targets | sed 's/,/ /g'` |
1c4b3cda | 48 | do |
ef346f1a ILT |
49 | result=`$ac_config_sub $targ 2>/dev/null` |
50 | if test -n "$result"; then | |
1c4b3cda ILT |
51 | canon_targets="$canon_targets $result" |
52 | else | |
53 | # Allow targets that config.sub doesn't recognize, like "all". | |
54 | canon_targets="$canon_targets $targ" | |
55 | fi | |
56 | done | |
57 | fi | |
58 | ||
59 | all_targets=false | |
ef346f1a ILT |
60 | EMUL= |
61 | all_emuls= | |
1c4b3cda ILT |
62 | |
63 | for targ in $target $canon_targets | |
64 | do | |
ef346f1a | 65 | if test "x$targ" = "xall"; then |
1c4b3cda ILT |
66 | all_targets=true |
67 | else | |
ef346f1a | 68 | . ${srcdir}/configure.tgt |
7f2649bb | 69 | |
ef346f1a ILT |
70 | if test "x$targ" = "x$target"; then |
71 | EMUL=${targ_emul} | |
1c4b3cda | 72 | fi |
ef346f1a ILT |
73 | |
74 | all_emuls="${all_emuls} ${targ_emul} ${targ_extra_emuls}" | |
1c4b3cda ILT |
75 | fi |
76 | done | |
77 | ||
ef346f1a | 78 | AC_SUBST(EMUL) |
1c4b3cda | 79 | |
ef346f1a | 80 | if test x${all_targets} = xfalse; then |
1c4b3cda ILT |
81 | # uniq the list. |
82 | f="" | |
ef346f1a | 83 | for i in $all_emuls ; do |
1c4b3cda | 84 | case " $f " in |
ef346f1a ILT |
85 | *" e$i.o "*) ;; |
86 | *) f="$f e$i.o" ;; | |
1c4b3cda ILT |
87 | esac |
88 | done | |
1c4b3cda | 89 | |
ef346f1a | 90 | EMULATION_OFILES="$f" |
1c4b3cda ILT |
91 | |
92 | else # all_targets is true | |
ef346f1a | 93 | EMULATION_OFILES='$(ALL_EMULATIONS)' |
1c4b3cda ILT |
94 | fi # all_targets is true |
95 | ||
ef346f1a | 96 | AC_SUBST(EMULATION_OFILES) |
8ddef552 | 97 | |
ef346f1a ILT |
98 | AC_OUTPUT(Makefile, |
99 | [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) |