* configure.in: Remove all use of the SUBDIRS variable; add
[platform/upstream/binutils.git] / gdb / configure.in
1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 dnl Free Software Foundation, Inc.
4 dnl
5 dnl This file is part of GDB.
6 dnl 
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2 of the License, or
10 dnl (at your option) any later version.
11 dnl 
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 dnl GNU General Public License for more details.
16 dnl 
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21 dnl Process this file with autoconf to produce a configure script.
22
23 AC_PREREQ(2.13)dnl
24 AC_INIT(main.c)
25 AC_CONFIG_HEADER(config.h:config.in)
26 AM_MAINTAINER_MODE
27
28 AC_PROG_CC
29 AC_AIX
30 AC_ISC_POSIX
31 AM_PROG_CC_STDC
32
33 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
34 AC_CANONICAL_SYSTEM
35
36 # FIXME: kettenis/20030102: The AC_PROG_RANLIB from Autoconf 2.13
37 # doesn't support cross-compilation, but the one from Autoconf 2.5x
38 # does.  Override RANLIB here (i.e. before running AC_PROG_RANLIB) to
39 # deal with the lossage.  Note that CY_GNU_GETTEXT currently calls
40 # AC_PROG_RANLIB.  This can be removed when we switch to # Autoconf
41 # 2.5x.
42 AC_CHECK_TOOL(RANLIB, ranlib, :)
43
44 dnl Set up for gettext.  PACKAGE is used when we call bindtextdomain.
45 ALL_LINGUAS=
46 CY_GNU_GETTEXT
47 AC_DEFINE(PACKAGE, "gdb", [Name of this package. ])
48
49
50 dnl List of object files added by configure.
51
52 CONFIG_OBS=
53 CONFIG_LIB_OBS=
54 CONFIG_DEPS=
55 CONFIG_SRCS=
56 CONFIG_INITS=
57 ENABLE_CFLAGS=
58 CONFIG_ALL=
59 CONFIG_CLEAN=
60 CONFIG_INSTALL=
61 CONFIG_UNINSTALL=
62
63 AC_CONFIG_SUBDIRS(doc testsuite)
64 configdirs=
65
66 . $srcdir/configure.host
67
68 . $srcdir/configure.tgt
69
70 # Fetch the default architecture and default target vector from BFD.
71 targ=$target; . $srcdir/../bfd/config.bfd
72
73 # We only want the first architecture, so strip off the others if
74 # there is more than one.
75 targ_archs=`echo $targ_archs | sed 's/ .*//'`
76
77 if test "x$targ_archs" != x; then
78   AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
79     [Define to BFD's default architecture. ])
80 fi
81 if test "x$targ_defvec" != x; then
82   AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
83     [Define to BFD's default target vector. ])
84 fi
85
86 AC_ARG_PROGRAM
87
88 # The CLI cannot be disabled yet, but may be in the future.
89
90 # Enable CLI.
91 AC_ARG_ENABLE(gdbcli,
92 [  --disable-gdbcli        disable command-line interface (CLI)],
93   [case $enableval in
94     yes)
95       ;;
96     no)
97       AC_MSG_ERROR([the command-line interface cannot be disabled yet]) ;;
98     *)
99       AC_MSG_ERROR([bad value $enableval for --enable-gdbcli]) ;;
100   esac],
101   [enable_gdbcli=yes])
102 if test x"$enable_gdbcli" = xyes; then
103   if test -d $srcdir/cli; then
104     CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)"
105     CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)"
106     CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)"
107     CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_CLI_INITS)"
108     ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)"
109     CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_CLI_ALL)"
110     CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_CLI_CLEAN)"
111     CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_CLI_INSTALL)"
112     CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_CLI_UNINSTALL)"
113   fi
114 fi
115
116 # Enable MI.
117 AC_ARG_ENABLE(gdbmi,
118 [  --disable-gdbmi         disable machine-interface (MI)],
119   [case $enableval in
120     yes | no)
121       ;;
122     *)
123       AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
124   esac],
125   [enable_gdbmi=yes])
126 if test x"$enable_gdbmi" = xyes; then
127   if test -d $srcdir/mi; then
128     CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
129     CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
130     CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
131     CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_MI_INITS)"
132     ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
133     CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_MI_ALL)"
134     CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_MI_CLEAN)"
135     CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_MI_INSTALL)"
136     CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_MI_UNINSTALL)"
137   fi
138 fi
139
140 # Enable TUI.
141 AC_ARG_ENABLE(tui,
142 [  --enable-tui            enable full-screen terminal user interface (TUI)],
143   [case $enableval in
144     yes | no)
145       ;;
146     *)
147       AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
148   esac])
149 if test x"$enable_tui" = xyes; then
150   if test -d $srcdir/tui; then
151     CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
152     CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
153     CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
154     CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
155     ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
156     CONFIG_ALL="$CONFIG_ALL \$(SUBDIR_TUI_ALL)"
157     CONFIG_CLEAN="$CONFIG_CLEAN \$(SUBDIR_TUI_CLEAN)"
158     CONFIG_INSTALL="$CONFIG_INSTALL \$(SUBDIR_TUI_INSTALL)"
159     CONFIG_UNINSTALL="$CONFIG_UNINSTALL \$(SUBDIR_TUI_UNINSTALL)"
160     need_curses=yes
161   fi
162 fi
163
164 # --------------------- #
165 # Checks for programs.  #
166 # --------------------- #
167
168 AC_PROG_AWK
169 AC_PROG_INSTALL
170 AC_PROG_LN_S
171 AC_PROG_RANLIB
172 AC_PROG_YACC
173
174 AC_CHECK_TOOL(AR, ar)
175 AC_CHECK_TOOL(DLLTOOL, dlltool)
176 AC_CHECK_TOOL(WINDRES, windres)
177
178 # Needed for GNU/Hurd.
179 AC_CHECK_TOOL(MIG, mig)
180
181 # ---------------------- #
182 # Checks for libraries.  #
183 # ---------------------- #
184
185 # We might need to link with -lm; most simulators need it.
186 AC_CHECK_LIB(m, main)
187
188 # We need to link with -lw to get `wctype' on Solaris before Solaris
189 # 2.6.  Solaris 2.6 and beyond have this function in libc, and have a
190 # libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
191 # is known to have this problem).  Therefore we avoid libw if we can.
192 AC_CHECK_FUNC(wctype, [],
193   [AC_CHECK_LIB(w, wctype)])
194
195 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
196 AC_SEARCH_LIBS(socketpair, socket)
197
198 # Since GDB uses Readline, we need termcap functionality, so we need
199 # to find a library that provides that.  When GDB is configured with
200 # --enable-tui, we need full curses functionality.
201 #
202 # FIXME: kettenis/20030102: We seem to prefer HP curses (Hcurses) over
203 # Xcurses on HP-UX; see the `-D__HP_CURSES' in the relevant host
204 # Makefile fragments.  That's why we need to have `Hcurses' before
205 # `curses'.  I don't see why we should use HP curses if a more
206 # standard curses is available, except that according to HP's
207 # documentation one needs to compile `-D_XOPEN_SOURCE_EXTENDED' on
208 # HP-UX 10.10 and 10.20.
209
210 if test "$need_curses" = yes; then
211   AC_SEARCH_LIBS(initscr, [ncurses Hcurses curses], [],
212     [AC_MSG_ERROR([no curses library found])])
213 fi
214
215 case $host_os in
216   cygwin*)
217     if test -d $srcdir/libtermcap; then
218       LIBS="../libtermcap/libtermcap.a $LIBS"
219       ac_cv_search_tgetent="../libtermcap/libtermcap.a"
220     fi ;;
221   go32*)
222     # ??? Is this really true?
223     ac_cv_search_tgetent="none required"
224     ;;
225   aix*)
226     # Readline prefers curses over termcap on AIX.
227     # ??? Why?
228     AC_SEARCH_LIBS(tgetent, [tinfo ncurses curses termcap])
229     ;;
230 esac
231
232 # Note: We used to check for libtermlib and libterminfo too, but
233 # Readline doesn't, so I think we're safe with leaving them out.
234 AC_SEARCH_LIBS(tgetent, [termcap tinfo ncurses Hcurses curses])
235
236 if test "$ac_cv_search_tgetent" = no; then
237   AC_MSG_ERROR([no termcap library found])
238 fi
239
240 # ------------------------- #
241 # Checks for header files.  #
242 # ------------------------- #
243
244 AC_HEADER_DIRENT
245 AC_HEADER_STAT
246 AC_HEADER_STDC
247 AC_CHECK_HEADERS(link.h)
248 AC_CHECK_HEADERS(nlist.h)
249 AC_CHECK_HEADERS(poll.h sys/poll.h)
250 AC_CHECK_HEADERS(proc_service.h thread_db.h)
251 AC_CHECK_HEADERS(stddef.h)
252 AC_CHECK_HEADERS(stdlib.h)
253 AC_CHECK_HEADERS(stdint.h)
254 AC_CHECK_HEADERS(string.h memory.h strings.h)
255 AC_CHECK_HEADERS(sys/fault.h)
256 AC_CHECK_HEADERS(sys/file.h)
257 AC_CHECK_HEADERS(sys/filio.h)
258 AC_CHECK_HEADERS(sys/ioctl.h)
259 AC_CHECK_HEADERS(sys/param.h)
260 AC_CHECK_HEADERS(sys/proc.h)
261 AC_CHECK_HEADERS(sys/procfs.h)
262 AC_CHECK_HEADERS(sys/ptrace.h ptrace.h)
263 AC_CHECK_HEADERS(sys/reg.h sys/debugreg.h)
264 AC_CHECK_HEADERS(sys/select.h)
265 AC_CHECK_HEADERS(sys/syscall.h)
266 AC_CHECK_HEADERS(sys/user.h)
267 AC_CHECK_HEADERS(sys/wait.h wait.h)
268 AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
269 AC_CHECK_HEADERS(unistd.h)
270
271 # On Solaris 2.[78], we need to define _MSE_INT_H to avoid a clash
272 # between <widec.h> and <wchar.h> that would cause AC_CHECK_HEADERS to
273 # think that we don't have <curses.h> if we're using GCC.
274 case $host_os in
275   solaris2.[[78]])
276     if test "$GCC" = yes; then
277       AC_DEFINE(_MSE_INT_H, 1,
278         [[Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
279    Solaris 2.[78] when using GCC. ]])
280     fi ;;
281 esac
282 AC_CHECK_HEADERS(curses.h ncurses.h term.h)
283
284 # FIXME: kettenis/20030102: In most cases we include these
285 # unconditionally, so what's the point in checking these?
286 AC_CHECK_HEADERS(ctype.h time.h)
287
288 # ------------------ #
289 # Checks for types.  #
290 # ------------------ #
291
292 AC_TYPE_SIGNAL
293
294 # ------------------------------------- #
295 # Checks for compiler characteristics.  #
296 # ------------------------------------- #
297
298 AC_C_CONST
299 AC_C_INLINE
300
301 # ------------------------------ #
302 # Checks for library functions.  #
303 # ------------------------------ #
304
305 AC_FUNC_ALLOCA
306 AC_FUNC_MMAP
307 AC_FUNC_VFORK
308 AC_CHECK_FUNCS(canonicalize_file_name realpath)
309 AC_CHECK_FUNCS(poll)
310 AC_CHECK_FUNCS(sbrk)
311 AC_CHECK_FUNCS(setpgid setpgrp)
312 AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
313 AC_CHECK_FUNCS(socketpair)
314
315 dnl AC_FUNC_SETPGRP does not work when cross compiling
316 dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
317 if test "$cross_compiling" = no; then
318   AC_FUNC_SETPGRP
319 else
320   AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
321     [AC_TRY_COMPILE([
322 #include <unistd.h>
323 ], [
324   if (setpgrp(1,1) == -1)
325     exit (0);
326   else
327     exit (1);
328 ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
329 if test $ac_cv_func_setpgrp_void = yes; then
330   AC_DEFINE(SETPGRP_VOID, 1)
331 fi
332 fi
333
334 # Check if sigsetjmp is available.  Using AC_CHECK_FUNCS won't do
335 # since sigsetjmp might only be defined as a macro.
336 AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp,
337 [AC_TRY_COMPILE([
338 #include <setjmp.h>
339 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
340 gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
341 if test $gdb_cv_func_sigsetjmp = yes; then
342   AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
343 fi
344
345 # Assume we'll default to using the included libiberty regex.
346 gdb_use_included_regex=yes
347
348 # However, if the system regex is GNU regex, then default to *not*
349 # using the included regex.
350 AC_CACHE_CHECK(
351   [for GNU regex],
352   [gdb_cv_have_gnu_regex],
353   [AC_TRY_COMPILE(
354     [#include <gnu-versions.h>],
355     [#define REGEX_INTERFACE_VERSION 1
356 #if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
357 # error "Version mismatch"
358 #endif],
359     gdb_cv_have_gnu_regex=yes,
360     gdb_cv_have_gnu_regex=no)])
361 if test $gdb_cv_have_gnu_regex = yes; then
362   gdb_use_included_regex=no
363 fi
364
365 AC_ARG_WITH(included-regex,
366   [  --without-included-regex don't use included regex; this is the default
367                           on systems with version 2 of the GNU C library
368                           (use with caution on other system)],
369   gdb_with_regex=$withval,
370   gdb_with_regex=$gdb_use_included_regex)
371 if test "$gdb_with_regex" = yes; then
372   AC_DEFINE(USE_INCLUDED_REGEX, 1,
373     [Define to 1 if the regex included in libiberty should be used.])
374 fi
375
376 # See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
377 # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
378 AC_CACHE_CHECK([for r_fs in struct reg], gdb_cv_struct_reg_r_fs,
379 [AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_fs;],
380 gdb_cv_struct_reg_r_fs=yes, gdb_cv_struct_reg_r_fs=no)])
381 if test $gdb_cv_struct_reg_r_fs = yes; then
382   AC_DEFINE(HAVE_STRUCT_REG_R_FS)
383 fi
384 AC_CACHE_CHECK([for r_gs in struct reg], gdb_cv_struct_reg_r_gs,
385 [AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_gs;],
386 gdb_cv_struct_reg_r_gs=yes, gdb_cv_struct_reg_r_gs=no)])
387 if test $gdb_cv_struct_reg_r_gs = yes; then
388   AC_DEFINE(HAVE_STRUCT_REG_R_GS)
389 fi
390
391 # See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
392 AC_MSG_CHECKING(for PTRACE_GETREGS)
393 AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
394 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
395                 [PTRACE_GETREGS;],
396                 [gdb_cv_have_ptrace_getregs=yes],
397                 [gdb_cv_have_ptrace_getregs=no])])
398 AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
399 if test $gdb_cv_have_ptrace_getregs = yes; then
400   AC_DEFINE(HAVE_PTRACE_GETREGS)
401 fi
402
403 # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
404 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
405 AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
406 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
407                 [PTRACE_GETFPXREGS;],
408                 [gdb_cv_have_ptrace_getfpxregs=yes],
409                 [gdb_cv_have_ptrace_getfpxregs=no])])
410 AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
411 if test $gdb_cv_have_ptrace_getfpxregs = yes; then
412   AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
413 fi
414
415 # See if <sys/ptrace.h> provides the PT_GETDBREGS request.
416 AC_MSG_CHECKING(for PT_GETDBREGS)
417 AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
418 [AC_TRY_COMPILE([#include <sys/types.h>
419 #include <sys/ptrace.h>],
420                 [PT_GETDBREGS;],
421                 [gdb_cv_have_pt_getdbregs=yes],
422                 [gdb_cv_have_pt_getdbregs=no])])
423 AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
424 if test $gdb_cv_have_pt_getdbregs = yes; then
425   AC_DEFINE(HAVE_PT_GETDBREGS)
426 fi
427
428 # See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
429 AC_MSG_CHECKING(for PT_GETXMMREGS)
430 AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
431 [AC_TRY_COMPILE([#include <sys/types.h>
432 #include <sys/ptrace.h>],
433                 [PT_GETXMMREGS;],
434                 [gdb_cv_have_pt_getxmmregs=yes],
435                 [gdb_cv_have_pt_getxmmregs=no])])
436 AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
437 if test $gdb_cv_have_pt_getxmmregs = yes; then
438   AC_DEFINE(HAVE_PT_GETXMMREGS)
439 fi
440
441
442 BFD_NEED_DECLARATION(malloc)
443 BFD_NEED_DECLARATION(realloc)
444 BFD_NEED_DECLARATION(free)
445 BFD_NEED_DECLARATION(strerror)
446 BFD_NEED_DECLARATION(strdup)
447 BFD_NEED_DECLARATION(strstr)
448 BFD_NEED_DECLARATION(canonicalize_file_name)
449
450 # The following save_state_t checkery is only necessary for HPUX 
451 # versions earlier than 10.20.  When those fade from memory, this 
452 # could be expunged. --jsm 1999-03-22
453
454 AC_MSG_CHECKING(for HPUX save_state structure)
455 AC_EGREP_HEADER(save_state_t, machine/save_state.h, 
456                 gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no)
457 AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes,
458                 gdb_cv_hpux_sswide=no)
459 if test $gdb_cv_hpux_savestate = yes
460 then
461   AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1)
462 fi
463 if test $gdb_cv_hpux_sswide = yes
464 then
465   AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1)
466 fi
467 AC_MSG_RESULT($gdb_cv_hpux_sswide)
468
469
470 # If we are configured native on GNU/Linux, work around problems with
471 # sys/procfs.h
472 # Also detect which type of /proc is in use, such as for Unixware or Solaris.
473
474 if test "${target}" = "${host}"; then
475   case "${host}" in
476   i[[3456]]86-*-linux*)
477         AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2)
478         AC_DEFINE(sys_quotactl)
479         ;;
480   ia64-*-aix*)
481       AC_DEFINE(NEW_PROC_API)
482       ;;
483   *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
484       AC_DEFINE(NEW_PROC_API)
485       ;;
486   *-*-solaris2.[[678]])
487       AC_DEFINE(NEW_PROC_API)
488       ;;
489   esac
490 fi
491
492 if test "$ac_cv_header_sys_procfs_h" = yes; then
493   BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
494   BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
495   BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
496   BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
497   BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
498   BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
499   BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
500   BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
501   BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
502   BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
503   BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
504   BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t)
505   BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t)
506   BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t)
507
508
509   dnl Check for broken prfpregset_t type
510
511   dnl For Linux/i386, glibc 2.1.3 was released with a bogus
512   dnl prfpregset_t type (it's a typedef for the pointer to a struct
513   dnl instead of the struct itself).  We detect this here, and work
514   dnl around it in gdb_proc_service.h.
515
516   if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
517     AC_MSG_CHECKING(whether prfpregset_t type is broken)
518     AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
519       [AC_TRY_RUN([#include <sys/procfs.h>
520        int main ()
521        {
522          if (sizeof (prfpregset_t) == sizeof (void *))
523            return 1;
524          return 0;
525        }],
526        gdb_cv_prfpregset_t_broken=no,
527        gdb_cv_prfpregset_t_broken=yes,
528        gdb_cv_prfpregset_t_broken=yes)])
529     AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
530     if test $gdb_cv_prfpregset_t_broken = yes; then
531       AC_DEFINE(PRFPREGSET_T_BROKEN)
532     fi
533   fi
534
535   dnl Check for PIOCSET ioctl entry 
536
537   AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
538   AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
539   [AC_TRY_COMPILE([#include <unistd.h>
540 #include <sys/types.h>
541 #include <sys/procfs.h>
542 ], [
543     int dummy;;
544     dummy = ioctl(0, PIOCSET, &dummy);
545   ],
546   gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
547   AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
548   if test $gdb_cv_have_procfs_piocset = yes; then
549     AC_DEFINE(HAVE_PROCFS_PIOCSET)
550   fi
551 fi
552
553 dnl For native ports (host == target), check to see what kind of
554 dnl legacy link.h support is needed.  (See solib-legacy.c.)
555 if test ${host} = ${target} ; then
556   dnl Check for struct link_map with l_ members which are indicative
557   dnl of SVR4-like shared libraries
558
559   AC_MSG_CHECKING(for member l_addr in struct link_map)
560   AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
561     [AC_TRY_COMPILE([#include <link.h>],
562                     [struct link_map lm; (void) lm.l_addr;],
563                     gdb_cv_have_struct_link_map_with_l_members=yes,
564                     gdb_cv_have_struct_link_map_with_l_members=no)])
565   AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
566   if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
567     AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS)
568   fi
569
570   dnl Check for struct link_map with lm_ members which are indicative
571   dnl of SunOS-like shared libraries
572
573   AC_MSG_CHECKING(for member lm_addr in struct link_map)
574   AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
575     [AC_TRY_COMPILE([#include <sys/types.h>
576 #include <link.h>],
577                     [struct link_map lm; (void) lm.lm_addr;],
578                     gdb_cv_have_struct_link_map_with_lm_members=yes,
579                     gdb_cv_have_struct_link_map_with_lm_members=no)])
580   AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
581   if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
582     AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS)
583   fi
584
585   dnl Check for struct so_map with som_ members which are found on 
586   dnl some *BSD systems.
587
588   AC_MSG_CHECKING(for member som_addr in struct so_map)
589   AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
590     [AC_TRY_COMPILE([#include <sys/types.h>
591 #ifdef HAVE_NLIST_H
592 #include <nlist.h>
593 #endif
594 #include <link.h>],
595                     [struct so_map lm; (void) lm.som_addr;],
596                     gdb_cv_have_struct_so_map_with_som_members=yes,
597                     gdb_cv_have_struct_so_map_with_som_members=no)])
598   AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
599   if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
600     AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS)
601   fi
602
603   dnl Check for struct link_map32 type, which allows a 64-bit Solaris
604   dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
605
606   AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
607   AC_CACHE_VAL(gdb_cv_have_struct_link_map32, 
608     [AC_TRY_COMPILE([#define _SYSCALL32
609 #include <sys/link.h>], [struct link_map32 l;],
610      gdb_cv_have_struct_link_map32=yes,
611      gdb_cv_have_struct_link_map32=no)])
612   AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
613   if test $gdb_cv_have_struct_link_map32 = yes; then
614     AC_DEFINE(HAVE_STRUCT_LINK_MAP32)
615     AC_DEFINE(_SYSCALL32)
616   fi
617 fi
618
619 dnl See if compiler supports "long long" type.
620
621 AC_MSG_CHECKING(for long long support in compiler)
622 AC_CACHE_VAL(gdb_cv_c_long_long,
623 [AC_TRY_COMPILE(, [
624   extern long long foo;
625   switch (foo & 2) { case 0: return 1; }
626 ],
627 gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
628 AC_MSG_RESULT($gdb_cv_c_long_long)
629 if test $gdb_cv_c_long_long = yes; then
630   AC_DEFINE(CC_HAS_LONG_LONG)
631 fi
632
633 dnl See if the compiler and runtime support printing long long
634
635 AC_MSG_CHECKING(for long long support in printf)
636 AC_CACHE_VAL(gdb_cv_printf_has_long_long,
637 [AC_TRY_RUN([
638 int main () {
639   char buf[32];
640   long long l = 0;
641   l = (l << 16) + 0x0123;
642   l = (l << 16) + 0x4567;
643   l = (l << 16) + 0x89ab;
644   l = (l << 16) + 0xcdef;
645   sprintf (buf, "0x%016llx", l);
646   return (strcmp ("0x0123456789abcdef", buf));
647 }],
648 gdb_cv_printf_has_long_long=yes,
649 gdb_cv_printf_has_long_long=no,
650 gdb_cv_printf_has_long_long=no)])
651 if test $gdb_cv_printf_has_long_long = yes; then
652   AC_DEFINE(PRINTF_HAS_LONG_LONG)
653 fi
654 AC_MSG_RESULT($gdb_cv_printf_has_long_long)
655
656 dnl See if compiler supports "long double" type.  Can't use AC_C_LONG_DOUBLE
657 dnl because autoconf complains about cross-compilation issues.  However, this
658 dnl code uses the same variables as the macro for compatibility.
659
660 AC_MSG_CHECKING(for long double support in compiler)
661 AC_CACHE_VAL(ac_cv_c_long_double,
662 [AC_TRY_COMPILE(, [long double foo;],
663 ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
664 AC_MSG_RESULT($ac_cv_c_long_double)
665 if test $ac_cv_c_long_double = yes; then
666   AC_DEFINE(HAVE_LONG_DOUBLE)
667 fi
668
669 dnl See if the compiler and runtime support printing long doubles
670
671 AC_MSG_CHECKING(for long double support in printf)
672 AC_CACHE_VAL(gdb_cv_printf_has_long_double,
673 [AC_TRY_RUN([
674 int main () {
675   char buf[16];
676   long double f = 3.141592653;
677   sprintf (buf, "%Lg", f);
678   return (strncmp ("3.14159", buf, 7));
679 }],
680 gdb_cv_printf_has_long_double=yes,
681 gdb_cv_printf_has_long_double=no,
682 gdb_cv_printf_has_long_double=no)])
683 if test $gdb_cv_printf_has_long_double = yes; then
684   AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
685 fi
686 AC_MSG_RESULT($gdb_cv_printf_has_long_double)
687
688 dnl See if the compiler and runtime support scanning long doubles
689
690 AC_MSG_CHECKING(for long double support in scanf)
691 AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
692 [AC_TRY_RUN([
693 int main () {
694   char *buf = "3.141592653";
695   long double f = 0;
696   sscanf (buf, "%Lg", &f);
697   return !(f > 3.14159 && f < 3.14160);
698 }],
699 gdb_cv_scanf_has_long_double=yes,
700 gdb_cv_scanf_has_long_double=no,
701 gdb_cv_scanf_has_long_double=no)])
702 if test $gdb_cv_scanf_has_long_double = yes; then
703   AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
704 fi
705 AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
706
707 case ${host_os} in
708 aix*)
709   AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
710     SAVE_LDFLAGS=$LDFLAGS
711
712     case $GCC in
713     yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
714     *) gdb_cv_bigtoc=-bbigtoc ;;
715     esac
716
717     LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
718     AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
719   ])
720   CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
721   ;;
722 esac
723
724
725 dnl For certain native configurations, we need to check whether thread
726 dnl support can be built in or not.
727 dnl
728 dnl Note that we only want this if we are both native (host == target),
729 dnl and not doing a canadian cross build (build == host).
730
731 if test ${build} = ${host} -a ${host} = ${target} ; then
732    case ${host_os} in
733    hpux*)
734       AC_MSG_CHECKING(for HPUX/OSF thread support)
735       if test -f /usr/include/dce/cma_config.h ; then
736          if test "$GCC" = "yes" ; then
737             AC_MSG_RESULT(yes)
738             AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
739             CONFIG_LIB_OBS="${CONFIG_LIB_OBS} hpux-thread.o"
740             CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
741          else
742             AC_MSG_RESULT(no (suppressed because you are not using GCC))
743          fi
744       else
745          AC_MSG_RESULT(no)
746       fi
747       ;;
748    solaris*)
749       # See if thread_db library is around for Solaris thread debugging.
750       # Note that we must explicitly test for version 1 of the library
751       # because version 0 (present on Solaris 2.4 or earlier) doesn't have
752       # the same API.
753       AC_MSG_CHECKING(for Solaris thread debugging library)
754       if test -f /usr/lib/libthread_db.so.1 ; then
755          AC_MSG_RESULT(yes)
756          AC_DEFINE(HAVE_THREAD_DB_LIB)
757          CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o"
758          CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
759          AC_CHECK_LIB(dl, dlopen)
760          if test "$GCC" = "yes" ; then
761             # The GNU linker requires the -export-dynamic option to make
762             # all symbols visible in the dynamic symbol table.
763             hold_ldflags=$LDFLAGS
764             AC_MSG_CHECKING(for the ld -export-dynamic flag)
765             LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
766             AC_TRY_LINK(, [int i;], found=yes, found=no)
767             LDFLAGS=$hold_ldflags
768             AC_MSG_RESULT($found)
769             if test $found = yes; then
770                CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
771             fi
772          fi
773          # Sun randomly tweaked the prototypes in <proc_service.h>
774          # at one point.
775          AC_MSG_CHECKING(if <proc_service.h> is old)
776          AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
777             AC_TRY_COMPILE([
778                 #include <proc_service.h>
779                 ps_err_e ps_pdwrite
780                     (struct ps_prochandle*, psaddr_t, const void*, size_t);
781             ],, gdb_cv_proc_service_is_old=no,
782                 gdb_cv_proc_service_is_old=yes)
783          ])
784          AC_MSG_RESULT($gdb_cv_proc_service_is_old)
785          if test $gdb_cv_proc_service_is_old = yes; then
786             AC_DEFINE(PROC_SERVICE_IS_OLD)
787          fi
788       else
789          AC_MSG_RESULT(no)
790       fi
791       ;;
792    aix*)
793       AC_MSG_CHECKING(for AiX thread debugging library)
794       AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
795                    [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
796                                    [#ifndef PTHDB_VERSION_3
797                                     #error
798                                     #endif],
799                                    gdb_cv_have_aix_thread_debug=yes,
800                                    gdb_cv_have_aix_thread_debug=no)])
801       AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
802       if test $gdb_cv_have_aix_thread_debug = yes; then
803          CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
804          CONFIG_LIB_OBS="${CONFIG_LIB_OBS} aix-thread.o"
805          CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
806       fi
807       ;;
808    esac
809    AC_SUBST(CONFIG_LDFLAGS)
810 fi
811
812 dnl See if we have a thread_db header file that has TD_NOTALLOC.
813 if test "x$ac_cv_header_thread_db_h" = "xyes"; then
814    AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
815                   gdb_cv_thread_db_h_has_td_notalloc,
816      AC_TRY_COMPILE(
817        [#include <thread_db.h>],
818        [int i = TD_NOTALLOC;],
819        gdb_cv_thread_db_h_has_td_notalloc=yes,
820        gdb_cv_thread_db_h_has_td_notalloc=no
821      )
822    )
823 fi
824 if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
825   AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
826             [Define if <thread_db.h> has the TD_NOTALLOC error code.])
827 fi
828
829 dnl linux-proc.c wants to use pread64, which may require special CFLAGS
830 dnl -D_BSD_SOURCE is normally assumed but we have to specify it because of
831 dnl -D_XOPEN_SOURCE=500.
832 if test $host = $target; then
833   case $target in
834     *-linux*)
835       save_CFLAGS=$CFLAGS
836       CFLAGS="$CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE"
837       AC_TRY_LINK([#include <unistd.h>],
838                   [pread64 (0, NULL, 0, 0);],
839                   [ENABLE_CFLAGS="$ENABLE_CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE"
840                    AC_DEFINE(HAVE_PREAD64)], [])
841       CFLAGS=$save_CFLAGS
842       ;;
843   esac
844 fi
845
846 dnl Handle optional features that can be enabled.
847
848 # NOTE: Don't add -Wall or -Wunused, they both include
849 # -Wunused-parameter which reports bogus warnings.
850 # NOTE: If you add to this list, remember to update
851 # gdb/doc/gdbint.texinfo.
852 build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
853 -Wformat -Wparentheses -Wpointer-arith -Wuninitialized"
854 # Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
855 # -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
856 # -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
857 # -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
858 # -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
859 # -Woverloaded-virtual -Winline -Werror"
860 AC_ARG_ENABLE(build-warnings,
861 [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
862 [case "${enableval}" in
863   yes)  ;;
864   no)   build_warnings="-w";;
865   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
866         build_warnings="${build_warnings} ${t}";;
867   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
868         build_warnings="${t} ${build_warnings}";;
869   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
870 esac
871 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
872   echo "Setting compiler warning flags = $build_warnings" 6>&1
873 fi])dnl
874 AC_ARG_ENABLE(gdb-build-warnings,
875 [  --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used],
876 [case "${enableval}" in
877   yes)  ;;
878   no)   build_warnings="-w";;
879   ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
880         build_warnings="${build_warnings} ${t}";;
881   *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
882         build_warnings="${t} ${build_warnings}";;
883   *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
884 esac
885 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
886   echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
887 fi])dnl
888 WARN_CFLAGS=""
889 WERROR_CFLAGS=""
890 if test "x${build_warnings}" != x -a "x$GCC" = xyes
891 then
892     AC_MSG_CHECKING(compiler warning flags)
893     # Separate out the -Werror flag as some files just cannot be
894     # compiled with it enabled.
895     for w in ${build_warnings}; do
896         case $w in
897         -Werr*) WERROR_CFLAGS=-Werror ;;
898         *) # Check that GCC accepts it
899             saved_CFLAGS="$CFLAGS"
900             CFLAGS="$CFLAGS $w"
901             AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
902             CFLAGS="$saved_CFLAGS"
903         esac
904     done
905     AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
906 fi
907 AC_SUBST(WARN_CFLAGS)
908 AC_SUBST(WERROR_CFLAGS)
909
910 MMALLOC_CFLAGS=
911 MMALLOC=
912 AC_SUBST(MMALLOC_CFLAGS)
913 AC_SUBST(MMALLOC)
914
915 AC_ARG_WITH(mmalloc,
916 [  --with-mmalloc          Use memory mapped malloc package],
917 [case "${withval}" in
918   yes)  want_mmalloc=true ;;
919   no)   want_mmalloc=false;;
920   *)    AC_MSG_ERROR(bad value ${withval} for GDB with-mmalloc option) ;;
921 esac],[want_mmalloc=false])dnl
922
923 if test x$want_mmalloc = xtrue; then
924    AC_DEFINE(USE_MMALLOC)
925    AC_DEFINE(MMCHECK_FORCE)
926    MMALLOC_CFLAGS="-I$srcdir/../mmalloc"
927    MMALLOC='../mmalloc/libmmalloc.a'
928 fi
929
930 # In the Cygwin environment, we need some additional flags.
931 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
932 [AC_EGREP_CPP(lose, [
933 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
934 lose
935 #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
936
937
938 dnl Figure out which of the many generic ser-*.c files the _host_ supports.
939 SER_HARDWIRE="ser-unix.o ser-pipe.o ser-tcp.o"
940 case ${host} in
941   *go32* ) SER_HARDWIRE=ser-go32.o ;;
942   *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
943 esac
944 AC_SUBST(SER_HARDWIRE)
945
946 # libreadline needs libuser32.a in a cygwin environment
947 WIN32LIBS=
948 if test x$gdb_cv_os_cygwin = xyes; then
949     WIN32LIBS="-luser32"
950     case "${target}" in
951         *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
952         ;;
953     esac
954 fi
955 AC_SUBST(WIN32LIBS)
956
957 LIBGUI="../libgui/src/libgui.a"
958 GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
959 AC_SUBST(LIBGUI)
960 AC_SUBST(GUI_CFLAGS_X)
961
962 AC_ARG_ENABLE(gdbtk,
963 [  --enable-gdbtk          Enable GDBTK GUI front end],
964 [case "${enableval}" in
965     yes)
966         case "$host" in
967         *go32*)
968             AC_MSG_WARN([GDB does not support GDBtk on host ${host}.  GDBtk will be disabled.])
969             enable_gdbtk=no ;;
970         *windows*)
971             AC_MSG_WARN([GDB does not support GDBtk on host ${host}.  GDBtk will be disabled.])
972             enable_gdbtk=no ;;
973         *)
974             enable_gdbtk=yes ;;
975         esac ;;
976     no)
977         enable_gdbtk=no  ;;
978     *)
979         AC_MSG_ERROR(bad value ${enableval} given for gdbtk option) ;;
980 esac],
981 [
982 # Default is on for everything but go32 and Cygwin
983 case "$host" in
984     *go32* | *windows*)
985         ;;
986     *)
987         if test -d "${srcdir}/gdbtk" ; then
988             enable_gdbtk=yes
989         fi
990         ;;
991 esac
992 ])
993
994 WIN32LDAPP=
995 AC_SUBST(WIN32LIBS)
996 AC_SUBST(WIN32LDAPP)
997
998 configdir="unix"
999
1000 GDBTKLIBS=
1001 if test "${enable_gdbtk}" = "yes"; then
1002
1003     # Gdbtk must have an absolute path to srcdir in order to run
1004     # properly when not installed.
1005     here=`pwd`
1006     cd ${srcdir}
1007     GDBTK_SRC_DIR=`pwd`
1008     cd $here
1009
1010     CY_AC_PATH_TCLCONFIG
1011     if test -z "${no_tcl}"; then
1012         CY_AC_LOAD_TCLCONFIG
1013         CY_AC_PATH_TKCONFIG
1014
1015         # now look for Tcl library stuff
1016
1017         case "${host}" in
1018         *-*-cygwin*)
1019             tcldir=../tcl/win/
1020             ;;
1021         *)
1022             tcldir=../tcl/unix/
1023             ;;
1024         esac
1025
1026         TCL_DEPS="${tcldir}${TCL_LIB_FILE}"
1027
1028         # If $no_tk is nonempty, then we can't do Tk, and there is no
1029         # point to doing Tcl.
1030         if test -z "${no_tk}"; then
1031            CY_AC_LOAD_TKCONFIG
1032            CY_AC_PATH_TCLH
1033            CY_AC_PATH_TKH
1034            CY_AC_PATH_ITCLH
1035            CY_AC_PATH_ITKH
1036
1037
1038            # now look for Tk library stuff
1039
1040            case "${host}" in
1041            *-*-cygwin*)
1042                tkdir=../tk/win/
1043                ;;
1044            *)
1045                tkdir=../tk/unix/
1046                ;;
1047            esac
1048
1049            TK_DEPS="${tkdir}${TK_LIB_FILE}"
1050
1051            # now look for Itcl library stuff
1052
1053            CY_AC_PATH_ITCLCONFIG
1054            if test -z "${no_itcl}"; then
1055              CY_AC_LOAD_ITCLCONFIG 
1056
1057              ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
1058              ITCL_DEPS="${ITCL_LIB_FULL_PATH}"
1059            fi
1060
1061            
1062            # now look for Itk library stuff
1063            CY_AC_PATH_ITKCONFIG
1064            if test -z "${no_itcl}"; then
1065              CY_AC_LOAD_ITKCONFIG
1066
1067              ITKLIB="${ITK_BUILD_LIB_SPEC}"
1068              ITK_DEPS="${ITK_LIB_FULL_PATH}"
1069            fi
1070
1071            ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
1072            # Tcl/Tk 8.1 require -fwritable strings.  I don't
1073            # know whether 8.2 will or not, but I bet it will.
1074            # I don't have to worry about 7.x since we don't support it.
1075            GDBTK_CFLAGS=""
1076            if test "$GCC" = "yes"; then
1077                if test "$TCL_VERSION" != "8.0" ; then
1078                    GDBTK_CFLAGS="-fwritable-strings"
1079                fi
1080            fi
1081
1082            # Include some libraries that Tcl and Tk want.
1083            TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
1084            # Yes, the ordering seems wrong here.  But it isn't.
1085            # TK_LIBS is the list of libraries that need to be linked
1086            # after Tcl/Tk.  Note that this isn't put into LIBS.  If it
1087            # were in LIBS then any link tests after this point would
1088            # try to include things like `$(LIBGUI)', which wouldn't work.
1089            GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
1090
1091            CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
1092            CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
1093            CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
1094            CONFIG_INITS="${CONFIG_INITS} \$(SUBDIR_GDBTK_INITS)"
1095            CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)"
1096            CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_GDBTK_CLEAN)"
1097            CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)"
1098            CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)"
1099
1100            if test x$gdb_cv_os_cygwin = xyes; then
1101               WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
1102               WIN32LDAPP="-Wl,--subsystem,console"
1103               CONFIG_OBS="${CONFIG_OBS} gdbres.o"
1104            fi
1105         fi
1106     fi
1107
1108     configdirs="${configdirs} gdbtk"
1109 fi
1110
1111 AC_SUBST(X_CFLAGS)
1112 AC_SUBST(X_LDFLAGS)
1113 AC_SUBST(X_LIBS)
1114 AC_SUBST(TCL_DEPS)
1115 AC_SUBST(TK_DEPS)
1116 AC_SUBST(ITCLLIB)
1117 AC_SUBST(ITCL_DEPS)
1118 AC_SUBST(ITKLIB)
1119 AC_SUBST(ITK_DEPS)
1120 AC_SUBST(GDBTKLIBS)
1121 AC_SUBST(GDBTK_CFLAGS)
1122 AC_SUBST(GDBTK_SRC_DIR)
1123
1124 AC_PATH_X
1125
1126  
1127 # Unlike the sim directory, whether a simulator is linked is controlled by 
1128 # presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.  
1129 # This code just checks for a few cases where we'd like to ignore those
1130 # definitions, even when they're present in the '.mt' file.  These cases
1131 # are when --disable-sim is specified, or if the simulator directory is
1132 # not part of the source tree.
1133 #
1134 AC_ARG_ENABLE(sim,
1135 [  --enable-sim            Link gdb with simulator],
1136 [echo "enable_sim = $enable_sim";
1137  echo "enableval = ${enableval}";
1138  case "${enableval}" in
1139   yes) ignore_sim=false ;;
1140   no)  ignore_sim=true ;;
1141   *)   ignore_sim=false ;;
1142  esac],
1143 [ignore_sim=false])
1144
1145 if test ! -d "${srcdir}/../sim"; then
1146   ignore_sim=true
1147 fi
1148
1149 if test "${ignore_sim}" = "true"; then
1150     IGNORE_SIM="SIM="
1151     IGNORE_SIM_OBS="SIM_OBS="
1152 else
1153     IGNORE_SIM=""
1154     IGNORE_SIM_OBS=""
1155     AC_DEFINE(WITH_SIM)
1156 fi
1157 AC_SUBST(IGNORE_SIM)
1158 AC_SUBST(IGNORE_SIM_OBS)
1159
1160 AC_SUBST(ENABLE_CFLAGS)
1161
1162 AC_SUBST(CONFIG_OBS)
1163 AC_SUBST(CONFIG_LIB_OBS)
1164 AC_SUBST(CONFIG_DEPS)
1165 AC_SUBST(CONFIG_SRCS)
1166 AC_SUBST(CONFIG_INITS)
1167 AC_SUBST(CONFIG_ALL)
1168 AC_SUBST(CONFIG_CLEAN)
1169 AC_SUBST(CONFIG_INSTALL)
1170 AC_SUBST(CONFIG_UNINSTALL)
1171
1172 # Begin stuff to support --enable-shared
1173 AC_ARG_ENABLE(shared,
1174 [  --enable-shared         Use shared libraries],
1175 [case "${enableval}" in
1176   yes) shared=true ;;
1177   no)  shared=false ;;
1178   *) shared=true ;;
1179 esac])dnl
1180
1181 HLDFLAGS=
1182 HLDENV=
1183 # If we have shared libraries, try to set rpath reasonably.
1184 if test "${shared}" = "true"; then
1185   case "${host}" in
1186   *-*-hpux*)
1187     HLDFLAGS='-Wl,+s,+b,$(libdir)'
1188     ;;
1189   *-*-irix5* | *-*-irix6*)
1190     HLDFLAGS='-Wl,-rpath,$(libdir)'
1191     ;;
1192   *-*-linux*aout*)
1193     ;;
1194   *-*-linux* | *-pc-linux-gnu*)
1195     HLDFLAGS='-Wl,-rpath,$(libdir)'
1196     ;;
1197   *-*-solaris*)
1198     HLDFLAGS='-R $(libdir)'
1199     ;;
1200   *-*-sysv4*)
1201     HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;'
1202     ;;
1203   esac
1204 fi
1205
1206 # On SunOS, if the linker supports the -rpath option, use it to
1207 # prevent ../bfd and ../opcodes from being included in the run time
1208 # search path.
1209 case "${host}" in
1210   *-*-sunos*)
1211     echo 'main () { }' > conftest.c
1212     ${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
1213     if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
1214       :
1215     elif grep 'No such file' conftest.t >/dev/null 2>&1; then
1216       :
1217     elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
1218       :
1219     elif grep 'some text already loaded' conftest.t >/dev/null 2>&1; then
1220       :
1221     elif test "${shared}" = "true"; then
1222       HLDFLAGS='-Wl,-rpath=$(libdir)'
1223     else
1224       HLDFLAGS='-Wl,-rpath='
1225     fi
1226     rm -f conftest.t conftest.c conftest
1227     ;;
1228 esac
1229 AC_SUBST(HLDFLAGS)
1230 AC_SUBST(HLDENV)
1231 # End stuff to support --enable-shared
1232
1233 # target_subdir is used by the testsuite to find the target libraries.
1234 target_subdir=
1235 if test "${host}" != "${target}"; then
1236     target_subdir="${target_alias}/"
1237 fi
1238 AC_SUBST(target_subdir)
1239
1240 frags=
1241 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
1242 if test ! -f ${host_makefile_frag}; then
1243     # When building a native debuger the .mh file containing things
1244     # like NATDEPFILES is needed.  Cross debuggers don't need .mh
1245     # since it no longer contains anything useful.
1246     if test "${target}" = "${host}"; then
1247         AC_MSG_ERROR("*** Gdb does not support native target ${host}")
1248     else
1249         host_makefile_frag=/dev/null
1250     fi
1251 fi
1252 frags="$frags $host_makefile_frag"
1253
1254 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
1255 if test ! -f ${target_makefile_frag}; then
1256 AC_MSG_ERROR("*** Gdb does not support target ${target}")
1257 fi
1258 frags="$frags $target_makefile_frag"
1259
1260 AC_SUBST_FILE(host_makefile_frag)
1261 AC_SUBST_FILE(target_makefile_frag)
1262 AC_SUBST(frags)
1263
1264 changequote(,)dnl
1265 hostfile=`sed -n '
1266 s/XM_FILE[      ]*=[    ]*\([^  ]*\)/\1/p
1267 ' ${host_makefile_frag}`
1268
1269 targetfile=`sed -n '
1270 s/TM_FILE[      ]*=[    ]*\([^  ]*\)/\1/p
1271 ' ${target_makefile_frag}`
1272
1273 GDB_MULTI_ARCH=`sed -n '
1274 s/GDB_MULTI_ARCH[       ]*=[    ]*\([^  ]*\)[   ]*/\1/p
1275 ' ${target_makefile_frag}`
1276
1277 if test "${target}" = "${host}"; then
1278 # We pick this up from the host configuration file (.mh) because we
1279 # do not have a native configuration Makefile fragment.
1280 nativefile=`sed -n '
1281 s/NAT_FILE[     ]*=[    ]*\([^  ]*\)/\1/p
1282 ' ${host_makefile_frag}`
1283 fi
1284 changequote([,])
1285
1286 # New targets should just set gdb_multi_arch=yes in configure.tgt.
1287 # Old targets being converted can either do that or set GDB_MULTI_ARCH
1288 # in the target specific makefile frag.  Eventually gdb_multi_arch=yes
1289 # will be the default.
1290 if test x"${GDB_MULTI_ARCH}" = x ; then
1291     case "${gdb_multi_arch}" in
1292     yes ) GDB_MULTI_ARCH=GDB_MULTI_ARCH_PURE ;;
1293     no ) GDB_MULTI_ARCH=0 ;;
1294     0|1|2 ) GDB_MULTI_ARCH=${gdb_multi_arch} ;;
1295     esac
1296 fi
1297 if test x"${GDB_MULTI_ARCH}" != x ; then
1298     AC_DEFINE_UNQUOTED(GDB_MULTI_ARCH, ${GDB_MULTI_ARCH})
1299 fi
1300 # Warn the user when they use an old practice
1301 case "${GDB_MULTI_ARCH}" in
1302     "" ) ;;
1303     0 | GDB_MULTI_ARCH_PARTIAL | 1 | GDB_MULTI_ARCH_TM | 2 )
1304         AC_MSG_WARN("GDB: Target is not pure multi-arch") ;;
1305     GDB_MULTI_ARCH_PURE )
1306         if test x"${targetfile}" != x ; then
1307             AC_MSG_WARN("GDB: Ignoring TM_FILE in ${target_makefile_frag}")
1308             targetfile=""
1309         fi ;;
1310     *)  AC_MSG_ERROR("GDB: Unknown GDB_MULTI_ARCH value ${GDB_MULTI_ARCH}");;
1311 esac
1312
1313 # Enable multi-ice-gdb-server.
1314 AC_ARG_ENABLE(multi-ice,
1315 [  --enable-multi-ice      build the multi-ice-gdb-server],
1316   [case $enableval in
1317     yes | no)
1318       ;;
1319     *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
1320   esac])
1321 if test "x$enable_multi_ice" = xyes; then
1322   configdirs="$configdirs multi-ice"
1323 fi
1324
1325 # We only build gdbserver automatically if host and target are the same.
1326 if test "x$target" = "x$host"; then
1327   AC_MSG_CHECKING(whether gdbserver is supported on this host)
1328   if test "x$build_gdbserver" = xyes; then
1329     configdirs="$configdirs gdbserver"
1330     AC_MSG_RESULT(yes)
1331   else
1332     AC_MSG_RESULT(no)
1333   fi
1334 fi
1335
1336 AC_CONFIG_SUBDIRS($configdirs)
1337 SUBDIRS=$subdirs
1338 AC_SUBST(SUBDIRS)
1339
1340 # If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
1341 # (NAT_FILE) is not set in config/*/*.m[ht] files, we link to an empty
1342 # version.
1343
1344 files=
1345 links=
1346
1347 rm -f xm.h
1348 xm_h=""
1349 if test "${hostfile}" != ""; then
1350     xm_h=xm.h
1351     GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}"
1352     files="${files} ${GDB_XM_FILE}"
1353     links="${links} xm.h"
1354     AC_DEFINE_UNQUOTED(GDB_XM_FILE, ${GDB_XM_FILE})
1355 fi
1356 AC_SUBST(xm_h)
1357
1358 rm -f tm.h
1359 tm_h=""
1360 if test "${targetfile}" != ""; then
1361     tm_h=tm.h
1362     GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}"
1363     files="${files} ${GDB_TM_FILE}"
1364     links="${links} tm.h"
1365     AC_DEFINE_UNQUOTED(GDB_TM_FILE, ${GDB_TM_FILE})
1366 fi
1367 AC_SUBST(tm_h)
1368
1369 rm -f nm.h
1370 nm_h=""
1371 if test "${nativefile}" != ""; then
1372     nm_h=nm.h
1373     GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}"
1374     files="${files} ${GDB_NM_FILE}"
1375     links="${links} nm.h"
1376     AC_DEFINE_UNQUOTED(GDB_NM_FILE, ${GDB_NM_FILE})
1377 fi
1378 AC_SUBST(nm_h)
1379
1380 AC_LINK_FILES($files, $links)
1381
1382 dnl Check for exe extension set on certain hosts (e.g. Win32)
1383 AC_EXEEXT
1384
1385 dnl  Detect the character set used by this host.
1386
1387 dnl  At the moment, we just assume it's ISO-8859-1 (which is a
1388 dnl  superset of ASCII containing the characters needed for French,
1389 dnl  German, Spanish, Italian, and possibly others), but if were
1390 dnl  *were* to support any host character sets other than ISO-8859-1,
1391 dnl  here's where we'd detect it.
1392 AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
1393           [Define to be a string naming the default host character set.])
1394
1395 AM_ICONV
1396
1397 AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
1398 [
1399 dnl Autoconf doesn't provide a mechanism for modifying definitions 
1400 dnl provided by makefile fragments.
1401 dnl
1402 if test "${nativefile}" = ""; then
1403         < Makefile \
1404         sed -e '/^NATDEPFILES[[         ]]*=.*\\$/,/[[^\\]]$/s/^/# /' \
1405             -e '/^NATDEPFILES[[         ]]*=/s/^/# /' \
1406         | sed -e '/^\(NATDEPFILES[[     ]]*[[+]]=[[     ]]*\)/s//# \1/' \
1407         > Makefile.tem
1408 mv -f Makefile.tem Makefile
1409 fi
1410
1411 changequote(,)dnl
1412 sed -e '/^TM_FILE[      ]*=/s,^TM_FILE[         ]*=[    ]*,&config/'"${gdb_target_cpu}"'/,
1413 /^XM_FILE[      ]*=/s,^XM_FILE[         ]*=[    ]*,&config/'"${gdb_host_cpu}"'/,
1414 /^NAT_FILE[     ]*=/s,^NAT_FILE[        ]*=[    ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
1415 mv -f Makefile.tmp Makefile
1416 changequote([,])dnl
1417
1418
1419 case x$CONFIG_HEADERS in
1420 xconfig.h:config.in)
1421 echo > stamp-h ;;
1422 esac
1423 ],
1424 [
1425 gdb_host_cpu=$gdb_host_cpu
1426 gdb_target_cpu=$gdb_target_cpu
1427 nativefile=$nativefile
1428 ])
1429
1430 exit 0