tipo
[platform/upstream/binutils.git] / opcodes / configure.in
1 AC_PREREQ(2.0)
2 AC_INIT(z8k-dis.c)
3 #    configure.in script for the opcodes library.
4 #    Copyright (C) 1995 Free Software Foundation, Inc.
5 #    Written by Cygnus Support.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 AC_ARG_ENABLE(targets,
22 [  --enable-targets        alternative target configurations],
23 [case "${enableval}" in
24   yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
25             ;;
26   no)       enable_targets= ;;
27   *)        enable_targets=$enableval ;;
28 esac])dnl
29 AC_ARG_ENABLE(shared,
30 [  --enable-shared         build shared opcodes library],
31 [case "${enableval}" in
32   yes) shared=true ;;
33   no)  shared=false ;;
34   *)   AC_MSG_ERROR([bad value ${enableval} for opcodes shared option]) ;;
35 esac])dnl
36 AC_ARG_ENABLE(commonbfdlib,
37 [  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
38 [case "${enableval}" in
39   yes) commonbfdlib=true ;;
40   no)  commonbfdlib=false ;;
41   *)   AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;;
42 esac])dnl
43
44 AC_CONFIG_HEADER(config.h:config.in)
45
46 AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`)
47 AC_CANONICAL_SYSTEM
48 if test -z "$target" ; then
49     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
50 fi
51
52 # host-specific stuff:
53
54 ALLLIBS='$(TARGETLIB)'
55 PICFLAG=
56 SHLIB=
57 SHLINK=
58 if test "${shared}" = "true"; then
59   ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)'
60   PICFLAG=-fpic
61   if test "${commonbfdlib}" = "true"; then
62 changequote(,)dnl
63     SHLIB=../bfd/libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
64 changequote([,])dnl
65     SHLINK=../bfd/libbfd.so
66   else
67 changequote(,)dnl
68     SHLIB=libopcodes.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
69 changequote([,])dnl
70     SHLINK=libopcodes.so
71   fi
72 fi
73
74 . ${srcdir}/../bfd/configure.host
75
76 AC_PROG_CC
77 AC_SUBST(CFLAGS)
78 AC_SUBST(HDEFINES)
79 AC_CHECK_PROG(AR, ar, ar, :)
80 AC_PROG_RANLIB
81 AC_PROG_INSTALL
82
83 if test "${shared}" = "true"; then
84   if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then
85     AC_MSG_WARN([opcodes --enable-shared only supported when using gcc])
86     shared=false
87     PICFLAG=
88     SHLIB=
89   fi
90 fi
91
92 AC_SUBST(ALLLIBS)
93 AC_SUBST(PICFLAG)
94 AC_SUBST(SHLIB)
95 AC_SUBST(SHLIB_CC)
96 AC_SUBST(SHLIB_CFLAGS)
97 if test "${commonbfdlib}" = "true"; then
98   COMMON_SHLIB=yes
99 else
100   COMMON_SHLIB=
101 fi
102 AC_SUBST(COMMON_SHLIB)
103 AC_SUBST(SHLINK)
104
105 AC_CHECK_HEADERS(string.h strings.h)
106
107 # target-specific stuff:
108
109 # Canonicalize the secondary target names.
110 if test -n "$enable_targets" ; then
111     for targ in `echo $enable_targets | sed 's/,/ /g'`
112     do
113         result=`$ac_config_sub $targ 2>/dev/null`
114         if test -n "$result" ; then
115             canon_targets="$canon_targets $result"
116         else
117             # Allow targets that config.sub doesn't recognize, like "all".
118             canon_targets="$canon_targets $targ"
119         fi
120     done
121 fi
122
123 all_targets=false
124 selarchs=
125 for targ in $target $canon_targets
126 do
127     if test "x$targ" = "xall" ; then
128         all_targets=true
129     else
130         . $srcdir/../bfd/config.bfd
131         selarchs="$selarchs $targ_archs"
132     fi
133 done    
134
135 # We don't do any links based on the target system, just makefile config.
136
137 if test x${all_targets} = xfalse ; then
138
139     # Target architecture .o files.
140     ta=
141
142     for arch in $selarchs
143     do
144         ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g`
145         archdefs="$archdefs -DARCH_$ad"
146         case "$arch" in
147         bfd_a29k_arch)          ta="$ta a29k-dis.o" ;;
148         bfd_alliant_arch)       ;;
149         bfd_alpha_arch)         ta="$ta alpha-dis.o" ;;
150 # start-sanitize-arc
151         bfd_arc_arch)           ta="$ta arc-dis.o arc-opc.o" ;;
152 # end-sanitize-arc
153         bfd_arm_arch)           ta="$ta arm-dis.o" ;;
154         bfd_convex_arch)        ;;
155         bfd_h8300_arch)         ta="$ta h8300-dis.o" ;;
156         bfd_h8500_arch)         ta="$ta h8500-dis.o" ;;
157         bfd_hppa_arch)          ta="$ta hppa-dis.o" ;;
158         bfd_i386_arch)          ta="$ta i386-dis.o" ;;
159         bfd_i860_arch)          ;;
160         bfd_i960_arch)          ta="$ta i960-dis.o" ;;
161         bfd_m68k_arch)          ta="$ta m68k-dis.o m68k-opc.o" ;;
162         bfd_m88k_arch)          ta="$ta m88k-dis.o" ;;
163         bfd_mips_arch)          ta="$ta mips-dis.o mips-opc.o" ;;
164         bfd_ns32k_arch)         ta="$ta ns32k-dis.o" ;;
165         bfd_powerpc_arch)       ta="$ta ppc-dis.o ppc-opc.o" ;;
166         bfd_pyramid_arch)       ;;
167         bfd_romp_arch)          ;;
168         bfd_rs6000_arch)        ta="$ta ppc-dis.o ppc-opc.o" ;;
169 # start-sanitize-rce
170         bfd_rce_arch)           ta="$ta rce-dis.o" ;;
171 # end-sanitize-rce
172         bfd_sh_arch)            ta="$ta sh-dis.o" ;;
173         bfd_sparc_arch)         ta="$ta sparc-dis.o sparc-opc.o" ;;
174         bfd_tahoe_arch)         ;;
175         bfd_vax_arch)           ;;
176         bfd_w65_arch)           ta="$ta w65-dis.o" ;;
177         bfd_we32k_arch)         ;;
178         bfd_z8k_arch)           ta="$ta z8k-dis.o" ;;
179
180         "")                     ;;
181         *)              AC_MSG_ERROR(*** unknown target architecture $arch) ;;
182         esac
183     done
184
185     # Weed out duplicate .o files.
186     f=""
187     for i in $ta ; do
188         case " $f " in
189         *" $i "*) ;;
190         *) f="$f $i" ;;
191         esac
192     done
193     ta="$f"
194
195     # And duplicate -D flags.
196     f=""
197     for i in $archdefs ; do
198         case " $f " in
199         *" $i "*) ;;
200         *) f="$f $i" ;;
201         esac
202     done
203     archdefs="$f"
204
205     BFD_MACHINES="$ta"
206
207 else    # all_targets is true
208     archdefs=-DARCH_all
209     BFD_MACHINES='$(ALL_MACHINES)'
210 fi
211
212 AC_SUBST(archdefs)
213 AC_SUBST(BFD_MACHINES)
214
215 AC_OUTPUT(Makefile,
216 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])