* configure.in: Substitute SHLIB_LIBS.
[platform/upstream/binutils.git] / opcodes / configure.in
1 AC_PREREQ(2.5)
2 AC_INIT(z8k-dis.c)
3 #    configure.in script for the opcodes library.
4 #    Copyright (C) 1995, 1996 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   *opcodes*) shared=true ;;
35   *) shared=false ;;
36 esac])dnl
37 AC_ARG_ENABLE(commonbfdlib,
38 [  --enable-commonbfdlib   build shared BFD/opcodes/libiberty library],
39 [case "${enableval}" in
40   yes) commonbfdlib=true ;;
41   no)  commonbfdlib=false ;;
42   *)   AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;;
43 esac])dnl
44
45 AC_CONFIG_HEADER(config.h:config.in)
46
47 AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`)
48 AC_CANONICAL_SYSTEM
49 if test -z "$target" ; then
50     AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
51 fi
52 AC_ARG_PROGRAM
53
54 # host-specific stuff:
55
56 ALLLIBS='$(TARGETLIB)'
57 PICFLAG=
58 SHLIB=unused-shlib
59 SHLINK=unused-shlink
60 if test "${shared}" = "true"; then
61   ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)'
62   PICFLAG=-fpic
63   if test "${commonbfdlib}" = "true"; then
64 changequote(,)dnl
65     SHLIB=../bfd/libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
66 changequote([,])dnl
67     SHLINK=../bfd/libbfd.so
68   else
69 changequote(,)dnl
70     SHLIB=libopcodes.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
71 changequote([,])dnl
72     SHLINK=libopcodes.so
73   fi
74 fi
75
76 AC_PROG_CC
77
78 . ${srcdir}/../bfd/configure.host
79
80 AC_SUBST(HDEFINES)
81 AC_CHECK_TOOL(AR, ar)
82 AC_CHECK_TOOL(RANLIB, ranlib, :)
83 AC_PROG_INSTALL
84
85 if test "${shared}" = "true"; then
86   if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then
87     AC_MSG_WARN([opcodes --enable-shared only supported when using gcc])
88     shared=false
89     ALLLIBS='$(TARGETLIB)'
90     PICFLAG=
91     SHLIB=unused-shlib
92   fi
93 fi
94
95 AC_SUBST(ALLLIBS)
96 AC_SUBST(PICFLAG)
97 AC_SUBST(SHLIB)
98 AC_SUBST(SHLIB_CC)
99 AC_SUBST(SHLIB_CFLAGS)
100 AC_SUBST(SHLIB_LIBS)
101 if test "${commonbfdlib}" = "true"; then
102   COMMON_SHLIB=yes
103   # Rebuild the shared library if libiberty or libbfd changes.
104   SHLIB_DEP="../libiberty/libiberty.a ../bfd/libbfd.a"
105   BFD_PICLIST=../bfd/piclist
106 else
107   COMMON_SHLIB=
108   SHLIB_DEP=
109   BFD_PICLIST=
110 fi
111 AC_SUBST(COMMON_SHLIB)
112 AC_SUBST(SHLIB_DEP)
113 AC_SUBST(BFD_PICLIST)
114 AC_SUBST(SHLINK)
115 AC_SUBST(INSTALL_SHLIB)
116
117 AC_CHECK_HEADERS(string.h strings.h stdlib.h)
118
119 # target-specific stuff:
120
121 # Canonicalize the secondary target names.
122 if test -n "$enable_targets" ; then
123     for targ in `echo $enable_targets | sed 's/,/ /g'`
124     do
125         result=`$ac_config_sub $targ 2>/dev/null`
126         if test -n "$result" ; then
127             canon_targets="$canon_targets $result"
128         else
129             # Allow targets that config.sub doesn't recognize, like "all".
130             canon_targets="$canon_targets $targ"
131         fi
132     done
133 fi
134
135 all_targets=false
136 selarchs=
137 for targ in $target $canon_targets
138 do
139     if test "x$targ" = "xall" ; then
140         all_targets=true
141     else
142         . $srcdir/../bfd/config.bfd
143         selarchs="$selarchs $targ_archs"
144     fi
145 done    
146
147 # Utility var, documents generic cgen support files.
148
149 cgen_files="cgen-opc.o cgen-asm.o cgen-dis.o"
150
151 # We don't do any links based on the target system, just makefile config.
152
153 if test x${all_targets} = xfalse ; then
154
155     # Target architecture .o files.
156     ta=
157
158     for arch in $selarchs
159     do
160         ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g`
161         archdefs="$archdefs -DARCH_$ad"
162         case "$arch" in
163         bfd_a29k_arch)          ta="$ta a29k-dis.o" ;;
164         bfd_alliant_arch)       ;;
165         bfd_alpha_arch)         ta="$ta alpha-dis.o alpha-opc.o" ;;
166 # start-sanitize-arc
167         bfd_arc_arch)           ta="$ta arc-dis.o arc-opc.o" ;;
168 # end-sanitize-arc
169         bfd_arm_arch)           ta="$ta arm-dis.o" ;;
170         bfd_convex_arch)        ;;
171         bfd_d10v_arch)          ta="$ta d10v-dis.o d10v-opc.o" ;;
172 # start-sanitize-d30v
173         bfd_d30v_arch)          ta="$ta d30v-dis.o d30v-opc.o" ;;
174 # end-sanitize-d30v
175         bfd_h8300_arch)         ta="$ta h8300-dis.o" ;;
176         bfd_h8500_arch)         ta="$ta h8500-dis.o" ;;
177         bfd_hppa_arch)          ta="$ta hppa-dis.o" ;;
178         bfd_i386_arch)          ta="$ta i386-dis.o" ;;
179         bfd_i860_arch)          ;;
180         bfd_i960_arch)          ta="$ta i960-dis.o" ;;
181         bfd_m32r_arch)          ta="$ta $cgen_files m32r-opc.o m32r-asm.o m32r-dis.o" ;;
182         bfd_m68k_arch)          ta="$ta m68k-dis.o m68k-opc.o" ;;
183         bfd_m88k_arch)          ta="$ta m88k-dis.o" ;;
184         bfd_mips_arch)          ta="$ta mips-dis.o mips-opc.o mips16-opc.o" ;;
185         bfd_mn10200_arch)       ta="$ta m10200-dis.o m10200-opc.o" ;;
186         bfd_mn10300_arch)       ta="$ta m10300-dis.o m10300-opc.o" ;;
187         bfd_ns32k_arch)         ta="$ta ns32k-dis.o" ;;
188         bfd_powerpc_arch)       ta="$ta ppc-dis.o ppc-opc.o" ;;
189         bfd_pyramid_arch)       ;;
190         bfd_romp_arch)          ;;
191         bfd_rs6000_arch)        ta="$ta ppc-dis.o ppc-opc.o" ;;
192         bfd_sh_arch)            ta="$ta sh-dis.o" ;;
193         bfd_sparc_arch)         ta="$ta sparc-dis.o sparc-opc.o" ;;
194         bfd_tahoe_arch)         ;;
195 # start-sanitize-tic80
196         bfd_tic80_arch)         ta="$ta tic80-dis.o tic80-opc.o" ;;
197 # end-sanitize-tic80
198 # start-sanitize-v850
199         bfd_v850_arch)          ta="$ta v850-opc.o v850-dis.o" ;;
200 # end-sanitize-v850
201         bfd_vax_arch)           ;;
202         bfd_w65_arch)           ta="$ta w65-dis.o" ;;
203         bfd_we32k_arch)         ;;
204         bfd_z8k_arch)           ta="$ta z8k-dis.o" ;;
205
206         "")                     ;;
207         *)              AC_MSG_ERROR(*** unknown target architecture $arch) ;;
208         esac
209     done
210
211     # Weed out duplicate .o files.
212     f=""
213     for i in $ta ; do
214         case " $f " in
215         *" $i "*) ;;
216         *) f="$f $i" ;;
217         esac
218     done
219     ta="$f"
220
221     # And duplicate -D flags.
222     f=""
223     for i in $archdefs ; do
224         case " $f " in
225         *" $i "*) ;;
226         *) f="$f $i" ;;
227         esac
228     done
229     archdefs="$f"
230
231     BFD_MACHINES="$ta"
232
233 else    # all_targets is true
234     archdefs=-DARCH_all
235     BFD_MACHINES='$(ALL_MACHINES)'
236 fi
237
238 AC_SUBST(archdefs)
239 AC_SUBST(BFD_MACHINES)
240
241 AC_OUTPUT(Makefile,
242 [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])