* valprint.c (print_longest): Test for CC_HAS_LONG_LONG as well as
[platform/upstream/binutils.git] / gdb / configure.in
1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright 1995, 1996 Free Software Foundation, Inc.
3 dnl
4 dnl This file is part of GDB.
5 dnl 
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2 of the License, or
9 dnl (at your option) any later version.
10 dnl 
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 dnl GNU General Public License for more details.
15 dnl 
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 dnl Process this file with autoconf to produce a configure script.
21
22 AC_PREREQ(2.5)dnl
23 AC_INIT(main.c)
24 AC_CONFIG_HEADER(config.h:config.in)
25
26 AC_PROG_CC
27 AC_AIX
28 AC_MINIX
29 AC_ISC_POSIX
30
31 AC_PROG_INSTALL
32 AC_CHECK_TOOL(AR, ar)
33 AC_CHECK_TOOL(RANLIB, ranlib, :)
34 AC_PROG_YACC
35 AC_PROG_AWK
36
37 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
38 AC_CANONICAL_SYSTEM
39 AC_ARG_PROGRAM
40
41 AC_HEADER_STDC
42 AC_CHECK_HEADERS(limits.h memory.h string.h strings.h unistd.h termios.h termio.h sgtty.h stddef.h stdlib.h sys/procfs.h link.h endian.h)
43 AC_HEADER_STAT
44
45 AC_C_CONST
46
47 AC_CHECK_FUNCS(setpgid sbrk)
48
49 AC_MSG_CHECKING([for gregset_t type])
50 AC_CACHE_VAL(gdb_cv_have_gregset_t,
51 [AC_TRY_LINK([#include <sys/procfs.h>],[gregset_t *gregsetp = 0],
52 gdb_cv_have_gregset_t=yes, gdb_cv_have_gregset_t=no)])
53 AC_MSG_RESULT($gdb_cv_have_gregset_t)
54 if test $gdb_cv_have_gregset_t = yes; then
55   AC_DEFINE(HAVE_GREGSET_T)
56 fi
57
58 AC_MSG_CHECKING([for fpregset_t type])
59 AC_CACHE_VAL(gdb_cv_have_fpregset_t,
60 [AC_TRY_LINK([#include <sys/procfs.h>],[fpregset_t *fpregsetp = 0],
61 gdb_cv_have_fpregset_t=yes, gdb_cv_have_fpregset_t=no)])
62 AC_MSG_RESULT($gdb_cv_have_fpregset_t)
63 if test $gdb_cv_have_fpregset_t = yes; then
64   AC_DEFINE(HAVE_FPREGSET_T)
65 fi
66
67 dnl See if compiler supports "long long" type.
68
69 AC_MSG_CHECKING(for long long support in compiler)
70 AC_CACHE_VAL(gdb_cv_c_long_long,
71 [AC_TRY_COMPILE(, [
72   extern long long foo;
73   switch (foo & 2) { case 0: return 1; }
74 ],
75 gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
76 AC_MSG_RESULT($gdb_cv_c_long_long)
77 if test $gdb_cv_c_long_long = yes; then
78   AC_DEFINE(CC_HAS_LONG_LONG)
79 fi
80
81 dnl See if the compiler and runtime support printing long long
82
83 AC_MSG_CHECKING(for long long support in printf)
84 AC_CACHE_VAL(gdb_cv_printf_has_long_long,
85 [AC_TRY_RUN([
86 int main () {
87   char buf[16];
88   long long l = 0x12345;
89   sprintf (buf, "%llx", l);
90   return (strcmp ("12345", buf));
91 }],
92 gdb_cv_printf_has_long_long=yes,
93 gdb_cv_printf_has_long_long=no,
94 gdb_cv_printf_has_long_long=no)])
95 if test $gdb_cv_printf_has_long_long = yes; then
96   AC_DEFINE(PRINTF_HAS_LONG_LONG)
97 fi
98 AC_MSG_RESULT($gdb_cv_printf_has_long_long)
99
100 dnl See if compiler supports "long double" type.  Can't use AC_C_LONG_DOUBLE
101 dnl because autoconf complains about cross-compilation issues.  However, this
102 dnl code uses the same variables as the macro for compatibility.
103
104 AC_MSG_CHECKING(for long double support in compiler)
105 AC_CACHE_VAL(ac_cv_c_long_double,
106 [AC_TRY_COMPILE(, [long double foo;],
107 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
108 AC_MSG_RESULT($ac_cv_c_long_double)
109 if test $ac_cv_c_long_double = yes; then
110   AC_DEFINE(HAVE_LONG_DOUBLE)
111 fi
112
113 dnl See if the compiler and runtime support printing long doubles
114
115 AC_MSG_CHECKING(for long double support in printf)
116 AC_CACHE_VAL(gdb_cv_printf_has_long_double,
117 [AC_TRY_RUN([
118 int main () {
119   char buf[16];
120   long double f = 3.141592653;
121   sprintf (buf, "%Lg", f);
122   return (strncmp ("3.14159", buf, 7));
123 }],
124 gdb_cv_printf_has_long_double=yes,
125 gdb_cv_printf_has_long_double=no,
126 gdb_cv_printf_has_long_double=no)])
127 if test $gdb_cv_printf_has_long_double = yes; then
128   AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
129 fi
130 AC_MSG_RESULT($gdb_cv_printf_has_long_double)
131
132 AC_FUNC_MMAP
133
134 BFD_NEED_DECLARATION(malloc)
135 BFD_NEED_DECLARATION(realloc)
136 BFD_NEED_DECLARATION(free)
137
138 dnl See if thread_db library is around for Solaris thread debugging.  Note that
139 dnl we must explicitly test for version 1 of the library because version 0
140 dnl (present on Solaris 2.4 or earlier) doesn't have the same API.
141
142 dnl Note that we only want this if we are both native (host == target), and
143 dnl not doing a canadian cross build (build == host).
144
145 if test ${build} = ${host} -a ${host} = ${target} ; then
146         AC_MSG_CHECKING(for Solaris thread debugging library)
147         if test -f /usr/lib/libthread_db.so.1 ; then
148                 AC_MSG_RESULT(yes)
149                 THREAD_DB_OBS=sol-thread.o
150                 AC_DEFINE(HAVE_THREAD_DB_LIB)
151                 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Xlinker -export-dynamic"
152         else
153                 AC_MSG_RESULT(no)
154         fi
155         AC_SUBST(THREAD_DB_OBS)
156         AC_SUBST(CONFIG_LDFLAGS)
157 fi
158
159 dnl Handle optional features that can be enabled.
160 ENABLE_CFLAGS=
161 ENABLE_CLIBS=
162 ENABLE_OBS=
163
164 AC_ARG_ENABLE(netrom,
165 [  --enable-netrom ],
166 [case "${enableval}" in
167 yes)    enable_netrom=yes ;;
168 no)     enable_netrom=no ;;
169 *)      AC_MSG_ERROR(bad value ${enableval} given for netrom option) ;;
170 esac])
171
172 if test "${enable_netrom}" = "yes"; then
173         ENABLE_OBS="${ENABLE_OBS} remote-nrom.o" 
174 fi
175
176 # start-sanitize-gm
177 ENABLE_GM=
178
179 AC_ARG_ENABLE(gm,
180 [  --enable-gm ],
181 [case "${enableval}" in
182 yes)    ENABLE_OBS="${ENABLE_OBS} gmagic.o"
183         ENABLE_CFLAGS=-DGENERAL_MAGIC
184         ;;
185 no)     ;;
186 *)      AC_MSG_ERROR(bad value ${enableval} given for gm option) ;;
187 esac])
188
189 # end-sanitize-gm
190
191 AC_ARG_ENABLE(sim-powerpc,
192 [  --enable-sim-powerpc ],
193 [case "${enableval}" in
194 yes)    powerpc_sim=yes ;;
195 no)     powerpc_sim=no ;;
196 *)      AC_MSG_ERROR(bad value ${enableval} given for sim-powerpc option) ;;
197 esac],[if test x"$GCC" != x""; then powerpc_sim=yes; else powerpc_sim=no; fi])
198
199 # start-sanitize-gdbtk
200 ENABLE_GDBTK=
201
202 AC_ARG_ENABLE(gdbtk,
203 [  --enable-gdbtk ],
204 [case "${enableval}" in
205     yes)
206         case "$host" in
207         *go32*)
208             AC_MSG_WARN([GDB does not support GDBtk on host ${host}.  GDBtk will be disabled.])
209             enable_gdbtk=no ;;
210         *cygwin32*)
211             AC_MSG_WARN([GDB does not support GDBtk on host ${host}.  GDBtk will be disabled.])
212             enable_gdbtk=no ;;
213         *)
214             enable_gdbtk=yes ;;
215         esac ;;
216     no)
217         enable_gdbtk=no  ;;
218     *)
219         AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
220 esac],
221 [
222 # Default is on for everything but go32 and cygwin32
223 case "$host" in
224     *go32*)
225         ;;
226     *cygwin32*)
227         ;;
228     *)
229         enable_gdbtk=yes ;;
230     esac
231 ])
232
233 if test "${enable_gdbtk}" = "yes"; then
234
235     CY_AC_PATH_TCLCONFIG
236     CY_AC_LOAD_TCLCONFIG
237     CY_AC_PATH_TKCONFIG
238
239     # If $no_tk is nonempty, then we can't do Tk, and there is no
240     # point to doing Tcl.
241     if test -z "${no_tk}"; then
242        CY_AC_LOAD_TKCONFIG
243        CY_AC_PATH_TCLH
244        CY_AC_PATH_TKH
245
246        # Include some libraries that Tcl and Tk want.
247        LIBS="$LIBS $TK_LIBS"
248
249        ENABLE_GDBTK=1
250
251        TCL_LIBS='$(TCL) $(TK) $(X11_LDFLAGS) $(X11_LIBS)'
252        ENABLE_CLIBS="${ENABLE_CLIBS} ${TCL_LIBS}"
253        ENABLE_OBS="${ENABLE_OBS} gdbtk.o"
254     fi
255 fi
256
257 AC_SUBST(ENABLE_GDBTK)
258 AC_SUBST(X_CFLAGS)
259 AC_SUBST(X_LDFLAGS)
260 AC_SUBST(X_LIBS)
261 # end-sanitize-gdbtk
262
263 AC_SUBST(ENABLE_CFLAGS)
264 AC_SUBST(ENABLE_CLIBS)
265 AC_SUBST(ENABLE_OBS)
266
267 # target_subdir is used by the testsuite to find the target libraries.
268 target_subdir=
269 if test "${host}" != "${target}"; then
270     target_subdir="${target_alias}/"
271 fi
272 AC_SUBST(target_subdir)
273
274 configdirs="doc testsuite"
275
276 dnl
277 changequote(,)dnl
278
279 # Map host cpu into the config cpu subdirectory name.
280 # The default is $host_cpu.
281
282 case "${host_cpu}" in
283
284 c[12])                  gdb_host_cpu=convex ;;
285 hppa*)                  gdb_host_cpu=pa ;;
286 i[3456]86)              gdb_host_cpu=i386 ;;
287 m68*)                   gdb_host_cpu=m68k ;;
288 m88*)                   gdb_host_cpu=m88k ;;
289 np1)                    gdb_host_cpu=gould ;;
290 pyramid)                gdb_host_cpu=pyr ;;
291 powerpc*)               gdb_host_cpu=powerpc ;;
292 sparc64)                gdb_host_cpu=sparc ;;
293 *)                      gdb_host_cpu=$host_cpu ;;
294
295 esac
296
297 # map host info into gdb names.
298
299 case "${host}" in
300
301 a29k-*-*)               gdb_host=ultra3 ;;
302
303 alpha-*-osf1*)          gdb_host=alpha-osf1 ;;
304 alpha-*-osf2*)          gdb_host=alpha-osf2 ;;
305 alpha-*-osf[3456789]*)  gdb_host=alpha-osf3 ;;
306 alpha-*-linux*)         gdb_host=alpha-linux ;;
307
308 arm-*-*)                gdb_host=arm ;;
309
310 c[12]-*-*)              gdb_host=convex ;;
311
312 hppa*-*-bsd*)           gdb_host=hppabsd ;;
313 hppa*-*-hiux*)          gdb_host=hppahpux ;;
314 hppa*-*-hpux*)          gdb_host=hppahpux ;;
315 hppa*-*-osf*)           gdb_host=hppaosf ;;
316
317 i[3456]86-ncr-*)        gdb_host=ncr3000 ;;
318 i[3456]86-sequent-bsd*) gdb_host=symmetry ;;  # dynix
319 i[3456]86-sequent-sysv4*) gdb_host=ptx4 ;;
320 i[3456]86-sequent-sysv*) gdb_host=ptx ;;
321 i[3456]86-*-aix*)       gdb_host=i386aix ;;
322 i[3456]86-*-bsd*)       gdb_host=i386bsd ;;
323 i[3456]86-*-dgux*)      gdb_host=i386dgux ;;
324 i[3456]86-*-freebsd*)   gdb_host=fbsd ;;
325 i[3456]86-*-netbsd*)    gdb_host=nbsd ;;
326 i[3456]86-*-go32*)      gdb_host=go32 ;;
327 i[3456]86-*-linux*)     gdb_host=linux ;;
328 i[3456]86-*-lynxos*)    gdb_host=i386lynx ;;
329 i[3456]86-*-mach3*)     gdb_host=i386m3 ;;
330 i[3456]86-*-mach*)      gdb_host=i386mach ;;
331 i[3456]86-*-gnu*)       gdb_host=i386gnu ;;
332 i[3456]86-*-osf1mk*)    gdb_host=osf1mk ;;
333 i[3456]86-*-sco3.2v5*)  gdb_host=i386sco5 ;;
334 i[3456]86-*-sco3.2v4*)  gdb_host=i386sco4 ;;
335 i[3456]86-*-sco*)       gdb_host=i386sco ;;
336 i[3456]86-*-solaris*)   gdb_host=i386sol2 ;;
337 i[3456]86-*-sunos*)     gdb_host=sun386 ;;
338 i[3456]86-*-sysv3.2*)   gdb_host=i386v32 ;;
339 i[3456]86-*-sysv32*)    gdb_host=i386v32 ;;
340 i[3456]86-*-sysv4*)     gdb_host=i386v4 ;;
341 i[3456]86-*-unixware)   gdb_host=i386v4 ;;
342 i[3456]86-*-sysv*)      gdb_host=i386v ;;
343 i[3456]86-*-isc*)       gdb_host=i386v32 ;;
344 i[3456]86-*-os9k)       gdb_host=i386os9k ;;
345 i[3456]86-*-cygwin32)   gdb_host=cygwin32 ;;
346 m680[01]0-sun-sunos3*)  gdb_host=sun2os3 ;;
347 m680[01]0-sun-sunos4*)  gdb_host=sun2os4 ;;
348 m68030-sony-*)          gdb_host=news1000 ;;
349
350 m68*-altos-*)           gdb_host=altos ;;
351 m68*-apollo*-sysv*)     gdb_host=apollo68v ;;
352 m68*-apollo*-bsd*)      gdb_host=apollo68b ;;
353 m68*-att-*)             gdb_host=3b1 ;;
354 m68*-bull*-sysv*)       gdb_host=dpx2 ;;
355 m68*-hp-bsd*)           gdb_host=hp300bsd ;;
356 m68*-hp-hpux*)          gdb_host=hp300hpux ;;
357 m68*-isi-*)             gdb_host=isi ;;
358 m68*-*-lynxos*)         gdb_host=m68klynx ;;
359 m68*-*-netbsd*)         gdb_host=nbsd ;;
360 m68*-*-sysv4*)          gdb_host=m68kv4 ;;
361 m68*-motorola-*)        gdb_host=delta68 ;;
362 m68*-sony-*)            gdb_host=news ;;
363 m68*-sun-sunos3*)       gdb_host=sun3os3 ;;
364 m68*-sun-sunos4*)       gdb_host=sun3os4 ;;
365 m68*-sun-*)             gdb_host=sun3os4 ;;
366
367 m88*-harris-cxux*)      gdb_host=cxux ;;
368 m88*-motorola-sysv4*)   gdb_host=delta88v4 ;;
369 m88*-motorola-sysv*)    gdb_host=delta88 ;;
370 m88*-*-mach3*)          gdb_host=mach3 ;;
371 m88*-*-*)               gdb_host=m88k ;;
372
373 mips-dec-mach3*)        gdb_host=mach3 ;;
374 mips-dec-*)             gdb_host=decstation ;;
375 mips-little-*)          gdb_host=littlemips ;;
376 mips-sgi-irix3*)        gdb_host=irix3 ;;
377 mips-sgi-irix4*)        gdb_host=irix4 ;;
378 mips-sgi-irix5*)        gdb_host=irix5 ;;
379 mips-sony-*)            gdb_host=news-mips ;;
380 mips-*-mach3*)          gdb_host=mach3 ;;
381 mips-*-sysv4*)          gdb_host=mipsv4 ;;
382 mips-*-sysv*)           gdb_host=riscos ;;
383 mips-*-riscos*)         gdb_host=riscos ;;
384
385 none-*-*)               gdb_host=none ;;
386
387 np1-*-*)                gdb_host=np1 ;;
388
389 ns32k-*-mach3*)         gdb_host=mach3 ;;
390 ns32k-*-netbsd*)        gdb_host=nbsd ;;
391 ns32k-umax-*)           gdb_host=umax ;;
392 ns32k-utek-sysv*)       gdb_host=merlin ;;
393
394 powerpc-*-aix*)         gdb_host=aix ;;
395 powerpcle-*-cygwin32)   gdb_host=cygwin32 ;;
396 powerpcle-*-solaris*)   gdb_host=solaris ;;
397 powerpc-*-linux*)       gdb_host=linux ;;
398 pn-*-*)                 gdb_host=pn ;;
399
400 pyramid-*-*)            gdb_host=pyramid ;;
401
402 romp-*-*)               gdb_host=rtbsd ;;
403
404 rs6000-*-lynxos*)       gdb_host=rs6000lynx ;;
405 rs6000-*-aix4*)         gdb_host=aix4 ;;
406 rs6000-*-*)             gdb_host=rs6000 ;;
407
408 sparc-*-lynxos*)        gdb_host=sparclynx ;;
409 sparc-*-netbsd*)        gdb_host=nbsd ;;
410 sparc-*-solaris2*)      gdb_host=sun4sol2 ;;
411 sparc-*-sunos4*)        gdb_host=sun4os4 ;;
412 sparc-*-sunos5*)        gdb_host=sun4sol2 ;;
413 sparc-*-*)              gdb_host=sun4os4 ;;
414 sparc64-*-*)            gdb_host=sun4sol2 ;;
415
416 tahoe-*-*)              gdb_host=tahoe ;;
417
418 vax-*-bsd*)             gdb_host=vaxbsd ;;
419 vax-*-ultrix2*)         gdb_host=vaxult2 ;;
420 vax-*-ultrix*)          gdb_host=vaxult ;;
421
422 w65-*-*)                gdb_host=w65 ;;
423
424 esac
425
426
427 # Map target cpu into the config cpu subdirectory name.
428 # The default is $target_cpu.
429
430 case "${target_cpu}" in
431
432 alpha)                  gdb_target_cpu=alpha ;;
433 c[12])                  gdb_target_cpu=convex ;;
434 hppa*)                  gdb_target_cpu=pa ;;
435 i[3456]86)              gdb_target_cpu=i386 ;;
436 m68*)                   gdb_target_cpu=m68k ;;
437 m88*)                   gdb_target_cpu=m88k ;;
438 mips*)                  gdb_target_cpu=mips ;;
439 np1)                    gdb_target_cpu=gould ;;
440 powerpc*)               gdb_target_cpu=powerpc ;;
441 pn)                     gdb_target_cpu=gould ;;
442 pyramid)                gdb_target_cpu=pyr ;;
443 sparc*)                 gdb_target_cpu=sparc ;;
444 *)                      gdb_target_cpu=$target_cpu ;;
445
446 esac
447
448 # map target info into gdb names.
449
450 case "${target}" in
451
452 a29k-*-aout*)           gdb_target=a29k ;;
453 a29k-*-coff*)           gdb_target=a29k ;;
454 a29k-*-elf*)            gdb_target=a29k ;;
455 a29k-*-ebmon*)          gdb_target=a29k ;;
456 a29k-*-kern*)           gdb_target=a29k-kern ;;
457 a29k-*-none*)           gdb_target=a29k ;;
458 a29k-*-sym1*)           gdb_target=ultra3 ;;
459 a29k-*-udi*)            gdb_target=a29k-udi ;;
460 a29k-*-vxworks*)        gdb_target=vx29k ;;
461
462 alpha-*-osf*)           gdb_target=alpha-osf1 ;;
463 alpha-*-linux*)         gdb_target=alpha-linux ;;
464
465 # start-sanitize-arc
466 arc-*-*)                gdb_target=arc ;;
467 # end-sanitize-arc
468
469 arm-*-*)                gdb_target=arm ;;
470
471 c1-*-*)                 gdb_target=convex ;;
472 c2-*-*)                 gdb_target=convex ;;
473
474 h8300-*-*)              gdb_target=h8300 ;;
475 h8500-*-*)              gdb_target=h8500 ;;
476
477 sh-*-*)                 gdb_target=sh ;;
478
479 hppa*-*-bsd*)           gdb_target=hppabsd ;;
480 hppa*-*-pro*)           gdb_target=hppapro ;;
481 hppa*-*-hpux*)          gdb_target=hppahpux ;;
482 hppa*-*-hiux*)          gdb_target=hppahpux ;;
483 hppa*-*-osf*)           gdb_target=hppaosf ;;
484
485 i[3456]86-sequent-bsd*) gdb_target=symmetry ;;
486 i[3456]86-sequent-sysv4*) gdb_target=ptx4 ;;
487 i[3456]86-sequent-sysv*) gdb_target=ptx ;;
488 i[3456]86-ncr-*)        gdb_target=ncr3000 ;;
489 i[3456]86-*-aout*)      gdb_target=i386aout ;;
490 i[3456]86-*-coff*)      gdb_target=i386v ;;
491 i[3456]86-*-elf*)       gdb_target=i386v ;;
492 i[3456]86-*-aix*)       gdb_target=i386aix ;;
493 i[3456]86-*-bsd*)       gdb_target=i386bsd ;;
494 i[3456]86-*-freebsd*)   gdb_target=fbsd ;;
495 i[3456]86-*-netbsd*)    gdb_target=nbsd ;;
496 i[3456]86-*-os9k)       gdb_target=i386os9k ;;
497 i[3456]86-*-go32*)      gdb_target=i386aout ;;
498 i[3456]86-*-lynxos*)    gdb_target=i386lynx
499                 configdirs="${configdirs} gdbserver" ;;
500 i[3456]86-*-solaris*)   gdb_target=i386sol2 ;;
501 i[3456]86-*-sunos*)     gdb_target=sun386 ;;
502 i[3456]86-*-sysv4*)     gdb_target=i386v4 ;;
503 i[3456]86-*-sco*)       gdb_target=i386v ;;
504 i[3456]86-*-sysv*)      gdb_target=i386v ;;
505 i[3456]86-*-linux*)     gdb_target=linux
506                 configdirs="${configdirs} gdbserver" ;;
507 i[3456]86-*-isc*)       gdb_target=i386v ;;
508 i[3456]86-*-mach3*)     gdb_target=i386m3 ;;
509 i[3456]86-*-mach*)      gdb_target=i386mach ;;
510 i[3456]86-*-gnu*)       gdb_target=i386gnu ;;
511 i[3456]86-*-netware*)   gdb_target=i386nw
512                 configdirs="${configdirs} nlm" ;;
513 i[3456]86-*-osf1mk*)    gdb_target=i386mk ;;
514 i[3456]86-*-cygwin32)   gdb_target=cygwin32  ;;
515 i960-*-bout*)           gdb_target=vxworks960 ;;
516 i960-nindy-coff*)       gdb_target=nindy960 ;;
517 i960-*-coff*)           gdb_target=mon960 ;;
518 i960-nindy-elf*)        gdb_target=nindy960 ;;
519 i960-*-elf*)            gdb_target=mon960 ;;
520
521 i960-*-nindy*)          gdb_target=nindy960 ;;
522 i960-*-vxworks*)        gdb_target=vxworks960 ;;
523
524 m68000-*-sunos3*)       gdb_target=sun2os3 ;;
525 m68000-*-sunos4*)       gdb_target=sun2os4 ;;
526
527 m68*-apollo*-bsd*)      gdb_target=apollo68b ;;
528 m68*-bull-sysv*)        gdb_target=dpx2 ;;
529 m68*-hp-bsd*)           gdb_target=hp300bsd ;;
530 m68*-hp-hpux*)          gdb_target=hp300hpux ;;
531 m68*-altos-*)           gdb_target=altos ;;
532 m68*-att-*)             gdb_target=3b1 ;;
533 m68*-cisco*-*)          gdb_target=cisco ;;
534 m68*-ericsson-*)        gdb_target=es1800 ;;
535 m68*-isi-*)             gdb_target=isi ;;
536 m68*-motorola-*)        gdb_target=delta68 ;;
537 m68*-netx-*)            gdb_target=vxworks68 ;;
538 m68*-sony-*)            gdb_target=news ;;
539 m68*-tandem-*)          gdb_target=st2000 ;;
540 m68*-rom68k-*)          gdb_target=monitor ;;
541 m68*-*bug-*)            gdb_target=monitor ;;
542 m68*-monitor-*)         gdb_target=monitor ;;
543 m68*-est-*)             gdb_target=monitor ;;
544 m68*-*-aout*)           gdb_target=monitor ;;
545 m68*-*-coff*)           gdb_target=monitor ;;
546 m68*-*-elf*)            gdb_target=monitor ;;
547 m68*-*-lynxos*)         gdb_target=m68klynx
548                 configdirs="${configdirs} gdbserver" ;;
549 m68*-*-netbsd*)         gdb_target=nbsd ;;
550 m68*-*-os68k*)          gdb_target=os68k ;;
551 m68*-*-sunos3*)         gdb_target=sun3os3 ;;
552 m68*-*-sunos4*)         gdb_target=sun3os4 ;;
553 m68*-*-sysv4*)          gdb_target=m68kv4 ;;
554 m68*-*-vxworks*)        gdb_target=vxworks68 ;;
555
556 m88*-harris-cxux*)      gdb_target=cxux ;;
557 m88*-motorola-sysv4*)   gdb_target=delta88v4 ;;
558 m88*-*-mach3*)          gdb_target=mach3 ;;
559 m88*-motorola-*)        gdb_target=delta88 ;;
560 m88*-*-*)               gdb_target=m88k ;;
561
562 mips64*-big-*)          gdb_target=bigmips64 ;;
563 mips*-big-*)            gdb_target=bigmips ;;
564 mips*-dec-mach3*)       gdb_target=mach3 ;;
565 mips*-dec-*)            gdb_target=decstation ;;
566 mips64*el-*-ecoff*)     gdb_target=embedl64 ;;
567 mips64*-*-ecoff*)       gdb_target=embed64 ;;
568 mips64*vr4300*el-*-elf*)        gdb_target=vr4300el ;;
569 mips64*vr4300*-*-elf*)  gdb_target=vr4300 ;;
570 mips64*vr4100*el-*-elf*)        gdb_target=vr4300el ;;
571 mips64*vr4100*-*-elf*)  gdb_target=vr4300 ;;
572 mips64*el-*-elf*)       gdb_target=embedl64 ;;
573 mips64*-*-elf*)         gdb_target=embed64 ;;
574 mips*el-*-ecoff*)       gdb_target=embedl ;;
575 mips*-*-ecoff*)         gdb_target=embed ;;
576 # start-sanitize-gm
577 mips*-*-magic*)         gdb_target=embed ;;
578 # end-sanitize-gm
579 mips*el-*-elf*)         gdb_target=embedl ;;
580 mips*-*-elf*)           gdb_target=embed ;;
581 mips*-little-*)         gdb_target=littlemips ;;
582 mips*-sgi-irix5*)       gdb_target=irix5 ;;
583 mips*-sgi-*)            gdb_target=irix3 ;;
584 mips*-sony-*)           gdb_target=bigmips ;;
585 mips*-*-mach3*)         gdb_target=mach3 ;;
586 mips*-*-sysv4*)         gdb_target=mipsv4 ;;
587 mips*-*-sysv*)          gdb_target=bigmips ;;
588 mips*-*-riscos*)        gdb_target=bigmips ;;
589 mips*-*-vxworks*)       gdb_target=vxmips ;;
590
591 none-*-*)               gdb_target=none ;;
592
593 np1-*-*)                gdb_target=np1 ;;
594
595 ns32k-*-mach3*)         gdb_target=mach3 ;;
596 ns32k-*-netbsd*)        gdb_target=nbsd ;;
597 ns32k-utek-sysv*)       gdb_target=merlin ;;
598 ns32k-utek-*)           gdb_target=umax ;;
599
600 pn-*-*)                 gdb_target=pn ;;
601 powerpc-*-macos*)       gdb_target=macos ;;
602 powerpc-*-netware*)     gdb_target=ppc-nw
603                         configdirs="${configdirs} nlm" ;;
604
605 powerpc-*-aix4*)        gdb_target=aix4 ;;
606 powerpc-*-aix*)         gdb_target=aix ;;
607 powerpcle-*-cygwin32)   gdb_target=cygwin32 ;;
608 powerpcle-*-solaris*)   gdb_target=solaris ;;
609 powerpc-*-eabi* | powerpc-*-linux* | powerpc-*-sysv* | powerpc-*-elf*)
610                         if test x"$powerpc_sim" = x"yes"; then
611                           gdb_target=ppc-sim
612                         else
613                           gdb_target=ppc-eabi
614                         fi ;;
615 powerpcle-*-eabi* | powerpcle-*-sysv* | powerpcle-*-elf*)
616                         if test x"$powerpc_sim" = x"yes"; then
617                           gdb_target=ppcle-sim
618                         else
619                           gdb_target=ppcle-eabi
620                         fi ;;
621
622 pyramid-*-*)            gdb_target=pyramid ;;
623
624 rs6000-*-lynxos*)       gdb_target=rs6000lynx ;;
625 rs6000-*-aix4*)         gdb_target=aix4 ;;
626 rs6000-*-*)             gdb_target=rs6000 ;;
627
628 sparc-*-aout*)          gdb_target=sparc-em ;;
629 sparc-*-coff*)          gdb_target=sparc-em ;;
630 sparc-*-elf*)           gdb_target=sparc-em ;;
631 sparc-*-lynxos*)        gdb_target=sparclynx
632                 configdirs="${configdirs} gdbserver" ;;
633 sparc-*-netbsd*)        gdb_target=nbsd ;;
634 sparc-*-solaris2*)      gdb_target=sun4sol2 ;;
635 sparc-*-sunos4*)        gdb_target=sun4os4 ;;
636 sparc-*-sunos5*)        gdb_target=sun4sol2 ;;
637 sparc-*-vxworks*)       gdb_target=vxsparc ;;
638 sparc-*-*)              gdb_target=sun4os4 ;;
639 sparclet-*-*)           gdb_target=sparclet;;
640 sparclite*-*-*)         gdb_target=sparclite ;;
641 # It's not clear what the right solution for "v8plus" systems is yet.
642 # For now, stick with sparc-sun-solaris2 since that's what config.guess
643 # should return.  Work is still needed to get gdb to print the 64 bit
644 # regs (some of which are usable in v8plus) so sp64sol.mt hasn't been
645 # deleted though presumably it should be eventually.
646 #sparc64-*-solaris2*)   gdb_target=sp64sol2 ;;
647 sparc64-*-*)            gdb_target=sp64 ;;
648
649 tahoe-*-*)              gdb_target=tahoe ;;
650
651 vax-*-*)                gdb_target=vax ;;
652
653 w65-*-*)                gdb_target=w65 ;;
654
655 z8k-*-coff*)            gdb_target=z8k ;;
656
657 esac
658
659 dnl
660 changequote([,])dnl
661
662 frags=
663 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
664 if test ! -f ${host_makefile_frag}; then
665 AC_MSG_ERROR("*** Gdb does not support host ${host}")
666 fi
667 frags="$frags $host_makefile_frag"
668
669 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
670 if test ! -f ${target_makefile_frag}; then
671 AC_MSG_ERROR("*** Gdb does not support target ${target}")
672 fi
673 frags="$frags $target_makefile_frag"
674
675 AC_SUBST_FILE(host_makefile_frag)
676 AC_SUBST_FILE(target_makefile_frag)
677 AC_SUBST(frags)
678
679 changequote(,)dnl
680 hostfile=`sed -n '
681 s/XM_FILE[      ]*=[    ]*\([^  ]*\)/\1/p
682 ' ${host_makefile_frag}`
683
684 targetfile=`sed -n '
685 s/TM_FILE[      ]*=[    ]*\([^  ]*\)/\1/p
686 ' ${target_makefile_frag}`
687
688 # these really aren't orthogonal true/false values of the same condition,
689 # but shells are slow enough that I like to reuse the test conditions
690 # whenever possible
691 if test "${target}" = "${host}"; then
692 nativefile=`sed -n '
693 s/NAT_FILE[     ]*=[    ]*\([^  ]*\)/\1/p
694 ' ${host_makefile_frag}`
695 else
696 # GDBserver is only useful in a "native" enviroment
697 configdirs=`echo $configdirs | sed 's/gdbserver//'`
698 fi
699 changequote([,])
700
701 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
702 # (NAT_FILE) is not set in config/*/*.m[ht] files, we don't make the
703 # corresponding links.  But we have to remove the xm.h files and tm.h
704 # files anyway, e.g. when switching from "configure host" to
705 # "configure none".
706
707 files=
708 links=
709 rm -f xm.h
710 if test "${hostfile}" != ""; then
711 files="${files} config/${gdb_host_cpu}/${hostfile}"
712 links="${links} xm.h"
713 fi
714 rm -f tm.h
715 if test "${targetfile}" != ""; then
716 files="${files} config/${gdb_target_cpu}/${targetfile}"
717 links="${links} tm.h"
718 fi
719 rm -f nm.h
720 if test "${nativefile}" != ""; then
721 files="${files} config/${gdb_host_cpu}/${nativefile}"
722 links="${links} nm.h"
723 else
724 # A cross-only configuration.
725 files="${files} config/nm-empty.h"
726 links="${links} nm.h"
727 fi
728 # start-sanitize-gdbtk
729
730 # Make it possible to use the GUI without doing a full install
731 if test "${enable_gdbtk}" = "yes" -a ! -f gdbtk.tcl ; then
732 files="${files} gdbtk.tcl"
733 links="${links} gdbtk.tcl"
734 fi
735 # end-sanitize-gdbtk
736
737 AC_LINK_FILES($files, $links)
738
739 AC_CONFIG_SUBDIRS($configdirs)
740 AC_OUTPUT(Makefile, 
741 [
742 dnl Autoconf doesn't provide a mechanism for modifying definitions 
743 dnl provided by makefile fragments.
744 dnl
745 if test "${nativefile}" = ""; then
746 sed -e '/^NATDEPFILES= /s//# NATDEPFILES= /' \
747         < Makefile > Makefile.tem
748 mv -f Makefile.tem Makefile
749 fi
750
751 changequote(,)dnl
752 sed -e '/^TM_FILE[      ]*=/s,^TM_FILE[         ]*=[    ]*,&config/'"${gdb_target_cpu}"'/,
753 /^XM_FILE[      ]*=/s,^XM_FILE[         ]*=[    ]*,&config/'"${gdb_host_cpu}"'/,
754 /^NAT_FILE[     ]*=/s,^NAT_FILE[        ]*=[    ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
755 mv -f Makefile.tmp Makefile
756 changequote([,])dnl
757
758 case ${srcdir} in
759 .)
760 ;;
761 *)
762 grep "source ${srcdir}/.gdbinit" .gdbinit >/dev/null 2>/dev/null || \
763 echo "source ${srcdir}/.gdbinit" >> .gdbinit
764 esac
765
766 case x$CONFIG_HEADERS in
767 xconfig.h:config.in)
768 echo > stamp-h ;;
769 esac
770 ],
771 [
772 gdb_host_cpu=$gdb_host_cpu
773 gdb_target_cpu=$gdb_target_cpu
774 nativefile=$nativefile
775 ])
776
777 exit 0
778