1dnl $MirOS: src/gnu/usr.bin/binutils/opcodes/configure.in,v 1.5 2005/07/07 16:23:20 tg Exp $
2
3dnl Process this file with autoconf to produce a configure script.
4dnl
5
6AC_PREREQ(2.59)
7AC_INIT
8AC_CONFIG_SRCDIR([z8k-dis.c])
9
10AC_CANONICAL_TARGET
11AC_ISC_POSIX
12
13# We currently only use the version number for the name of any shared
14# library.  For user convenience, we always use the same version
15# number that BFD is using.
16changequote(,)dnl
17BFD_VERSION=`sed -n -e 's/^.._INIT_AUTOMAKE.*,[ 	]*\([^ 	]*\)[ 	]*).*/\1/p' < ${srcdir}/../bfd/configure.in`
18changequote([,])dnl
19
20AM_INIT_AUTOMAKE(opcodes, ${BFD_VERSION})
21
22dnl These must be called before AM_PROG_LIBTOOL, because it may want
23dnl to call AC_CHECK_PROG.
24AC_CHECK_TOOL(AR, ar)
25AC_CHECK_TOOL(RANLIB, ranlib, :)
26
27dnl Default to a non shared library.  This may be overridden by the
28dnl configure option --enable-shared.
29AM_DISABLE_SHARED
30
31AM_PROG_LIBTOOL
32
33AC_ARG_ENABLE(targets,
34[  --enable-targets        alternative target configurations],
35[case "${enableval}" in
36  yes | "") AC_MSG_ERROR([enable-targets option must specify target names or 'all'])
37            ;;
38  no)       enable_targets= ;;
39  *)        enable_targets=$enableval ;;
40esac])dnl
41AC_ARG_ENABLE(commonbfdlib,
42[  --enable-commonbfdlib   build shared BFD/opcodes library],
43[case "${enableval}" in
44  yes) commonbfdlib=true ;;
45  no)  commonbfdlib=false ;;
46  *)   AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;;
47esac])dnl
48
49AM_BINUTILS_WARNINGS
50
51AM_CONFIG_HEADER(config.h:config.in)
52
53if test -z "$target" ; then
54    AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
55fi
56
57AM_MAINTAINER_MODE
58AM_INSTALL_LIBBFD
59AC_EXEEXT
60
61# host-specific stuff:
62
63AC_PROG_CC
64
65. ${srcdir}/../bfd/configure.host
66
67BFD_CC_FOR_BUILD
68
69AC_SUBST(HDEFINES)
70AC_PROG_INSTALL
71
72AC_CHECK_HEADERS(string.h strings.h stdlib.h)
73
74AC_CHECK_DECLS(basename)
75
76cgen_maint=no
77cgendir='$(srcdir)/../cgen'
78
79AC_ARG_ENABLE(cgen-maint,
80[  --enable-cgen-maint[=dir]    build cgen generated files],
81[case "${enableval}" in
82  yes)	cgen_maint=yes ;;
83  no)	cgen_maint=no ;;
84  *)
85	# argument is cgen install directory (not implemented yet).
86	# Having a `share' directory might be more appropriate for the .scm,
87	# .cpu, etc. files.
88	cgen_maint=yes
89	cgendir=${cgen_maint}/lib/cgen
90	;;
91esac])dnl
92AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} = xyes)
93AC_SUBST(cgendir)
94
95using_cgen=no
96
97# Horrible hacks to build DLLs on Windows.
98WIN32LDFLAGS=
99WIN32LIBADD=
100case "${host}" in
101*-*-cygwin*)
102  if test "$enable_shared" = "yes"; then
103    WIN32LDFLAGS="-no-undefined"
104    WIN32LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
105  fi
106  ;;
107esac
108AC_SUBST(WIN32LDFLAGS)
109AC_SUBST(WIN32LIBADD)
110
111# target-specific stuff:
112
113# Canonicalize the secondary target names.
114if test -n "$enable_targets" ; then
115    for targ in `echo $enable_targets | sed 's/,/ /g'`
116    do
117	result=`$ac_config_sub $targ 2>/dev/null`
118	if test -n "$result" ; then
119	    canon_targets="$canon_targets $result"
120	else
121	    # Allow targets that config.sub doesn't recognize, like "all".
122	    canon_targets="$canon_targets $targ"
123	fi
124    done
125fi
126
127all_targets=false
128selarchs=
129for targ in $target $canon_targets
130do
131    if test "x$targ" = "xall" ; then
132        all_targets=true
133    else
134	. $srcdir/../bfd/config.bfd
135	selarchs="$selarchs $targ_archs"
136    fi
137done
138
139# Utility var, documents generic cgen support files.
140
141cgen_files="cgen-opc.lo cgen-asm.lo cgen-dis.lo"
142
143# We don't do any links based on the target system, just makefile config.
144
145if test x${all_targets} = xfalse ; then
146
147    # Target architecture .o files.
148    ta=
149
150    for arch in $selarchs
151    do
152	ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g`
153	archdefs="$archdefs -DARCH_$ad"
154	case "$arch" in
155	bfd_a29k_arch)		ta="$ta a29k-dis.lo" ;;
156	bfd_alliant_arch)	;;
157	bfd_alpha_arch)		ta="$ta alpha-dis.lo alpha-opc.lo" ;;
158	bfd_arc_arch)		ta="$ta arc-dis.lo arc-opc.lo arc-ext.lo" ;;
159	bfd_arm_arch)		ta="$ta arm-dis.lo" ;;
160	bfd_avr_arch)		ta="$ta avr-dis.lo" ;;
161	bfd_convex_arch)	;;
162	bfd_cris_arch)		ta="$ta cris-dis.lo cris-opc.lo" ;;
163	bfd_crx_arch)    	ta="$ta crx-dis.lo crx-opc.lo" ;;
164	bfd_d10v_arch)		ta="$ta d10v-dis.lo d10v-opc.lo" ;;
165	bfd_d30v_arch)		ta="$ta d30v-dis.lo d30v-opc.lo" ;;
166	bfd_dlx_arch)		ta="$ta dlx-dis.lo" ;;
167	bfd_fr30_arch)          ta="$ta fr30-asm.lo fr30-desc.lo fr30-dis.lo fr30-ibld.lo fr30-opc.lo" using_cgen=yes ;;
168	bfd_h8300_arch)		ta="$ta h8300-dis.lo" ;;
169	bfd_h8500_arch)		ta="$ta h8500-dis.lo" ;;
170	bfd_hppa_arch)		ta="$ta hppa-dis.lo" ;;
171	bfd_i370_arch)		ta="$ta i370-dis.lo i370-opc.lo" ;;
172	bfd_i386_arch)		ta="$ta i386-dis.lo" ;;
173	bfd_i860_arch)		ta="$ta i860-dis.lo" ;;
174	bfd_i960_arch)		ta="$ta i960-dis.lo" ;;
175	bfd_ia64_arch)		ta="$ta ia64-dis.lo ia64-opc.lo" ;;
176	bfd_ip2k_arch)		ta="$ta ip2k-asm.lo ip2k-desc.lo ip2k-dis.lo ip2k-ibld.lo ip2k-opc.lo" using_cgen=yes ;;
177        bfd_iq2000_arch)        ta="$ta iq2000-asm.lo iq2000-desc.lo iq2000-dis.lo iq2000-ibld.lo iq2000-opc.lo" using_cgen=yes ;;
178	bfd_m32r_arch)		ta="$ta m32r-asm.lo m32r-desc.lo m32r-dis.lo m32r-ibld.lo m32r-opc.lo m32r-opinst.lo" using_cgen=yes ;;
179	bfd_m68hc11_arch)	ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;;
180	bfd_m68hc12_arch)	ta="$ta m68hc11-dis.lo m68hc11-opc.lo" ;;
181	bfd_m68k_arch)		ta="$ta m68k-dis.lo m68k-opc.lo" ;;
182	bfd_m88k_arch)		ta="$ta m88k-dis.lo" ;;
183	bfd_maxq_arch)		ta="$ta maxq-dis.lo" ;;
184	bfd_mcore_arch)		ta="$ta mcore-dis.lo" ;;
185	bfd_mips_arch)		ta="$ta mips-dis.lo mips-opc.lo mips16-opc.lo" ;;
186	bfd_mmix_arch)		ta="$ta mmix-dis.lo mmix-opc.lo" ;;
187	bfd_mn10200_arch)	ta="$ta m10200-dis.lo m10200-opc.lo" ;;
188	bfd_mn10300_arch)	ta="$ta m10300-dis.lo m10300-opc.lo" ;;
189	bfd_ms1_arch)		ta="$ta ms1-asm.lo ms1-desc.lo ms1-dis.lo ms1-ibld.lo ms1-opc.lo" using_cgen=yes ;;
190	bfd_msp430_arch)	ta="$ta msp430-dis.lo" ;;
191	bfd_ns32k_arch)		ta="$ta ns32k-dis.lo" ;;
192	bfd_openrisc_arch)	ta="$ta openrisc-asm.lo openrisc-desc.lo openrisc-dis.lo openrisc-ibld.lo openrisc-opc.lo" using_cgen=yes ;;
193	bfd_or32_arch)		ta="$ta or32-dis.lo or32-opc.lo" using_cgen=yes ;;
194	bfd_pdp11_arch)		ta="$ta pdp11-dis.lo pdp11-opc.lo" ;;
195	bfd_pj_arch)	        ta="$ta pj-dis.lo pj-opc.lo" ;;
196	bfd_powerpc_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
197	bfd_powerpc_64_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
198	bfd_pyramid_arch)	;;
199	bfd_romp_arch)		;;
200	bfd_rs6000_arch)	ta="$ta ppc-dis.lo ppc-opc.lo" ;;
201	bfd_s390_arch)		ta="$ta s390-dis.lo s390-opc.lo" ;;
202	bfd_sh_arch)
203	  # We can't decide what we want just from the CPU family.
204	  # We want SH5 support unless a specific version of sh is
205	  # specified, as in sh3-elf, sh3b-linux-gnu, etc.
206	  # Include it just for ELF targets, since the SH5 bfd:s are ELF only.
207	  for t in $target $canon_targets; do
208	    case $t in
209	      all |  sh5*-* | sh64*-* | sh-*-*elf* | shl*-*-*elf* | \
210	      sh-*-linux* | shl-*-linux*)
211				ta="$ta sh64-dis.lo sh64-opc.lo"
212				archdefs="$archdefs -DINCLUDE_SHMEDIA"
213				break;;
214	    esac;
215	  done
216				ta="$ta sh-dis.lo" ;;
217	bfd_sparc_arch)		ta="$ta sparc-dis.lo sparc-opc.lo" ;;
218	bfd_tahoe_arch)		;;
219	bfd_tic30_arch)		ta="$ta tic30-dis.lo" ;;
220        bfd_tic4x_arch)         ta="$ta tic4x-dis.lo" ;;
221	bfd_tic54x_arch)	ta="$ta tic54x-dis.lo tic54x-opc.lo" ;;
222	bfd_tic80_arch)		ta="$ta tic80-dis.lo tic80-opc.lo" ;;
223	bfd_v850_arch)		ta="$ta v850-opc.lo v850-dis.lo" ;;
224	bfd_v850e_arch)		ta="$ta v850-opc.lo v850-dis.lo" ;;
225	bfd_v850ea_arch)	ta="$ta v850-opc.lo v850-dis.lo" ;;
226	bfd_vax_arch)		ta="$ta vax-dis.lo" ;;
227	bfd_w65_arch)		ta="$ta w65-dis.lo" ;;
228	bfd_we32k_arch)		;;
229	bfd_xstormy16_arch)	ta="$ta xstormy16-asm.lo xstormy16-desc.lo xstormy16-dis.lo xstormy16-ibld.lo xstormy16-opc.lo" using_cgen=yes ;;
230	bfd_xtensa_arch)	ta="$ta xtensa-dis.lo" ;;
231	bfd_z8k_arch)		ta="$ta z8k-dis.lo" ;;
232	bfd_frv_arch)           ta="$ta frv-asm.lo frv-desc.lo frv-dis.lo frv-ibld.lo frv-opc.lo" using_cgen=yes ;;
233
234	"")			;;
235	*)		AC_MSG_ERROR(*** unknown target architecture $arch) ;;
236	esac
237    done
238
239    if test $using_cgen = yes ; then
240	ta="$ta $cgen_files"
241    fi
242
243    # Weed out duplicate .o files.
244    f=""
245    for i in $ta ; do
246	case " $f " in
247	*" $i "*) ;;
248	*) f="$f $i" ;;
249	esac
250    done
251    ta="$f"
252
253    # And duplicate -D flags.
254    f=""
255    for i in $archdefs ; do
256	case " $f " in
257	*" $i "*) ;;
258	*) f="$f $i" ;;
259	esac
260    done
261    archdefs="$f"
262
263    BFD_MACHINES="$ta"
264
265else	# all_targets is true
266    archdefs=-DARCH_all
267    BFD_MACHINES='$(ALL_MACHINES)'
268fi
269
270AC_SUBST(archdefs)
271AC_SUBST(BFD_MACHINES)
272
273AC_OUTPUT(Makefile)
274