*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / configure.in
CommitLineData
c906108c 1dnl Autoconf configure script for GDB, the GNU debugger.
9a156167 2dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
b6ba6518 3dnl Free Software Foundation, Inc.
c906108c
SS
4dnl
5dnl This file is part of GDB.
6dnl
7dnl This program is free software; you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation; either version 2 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl This program is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with this program; if not, write to the Free Software
19dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21dnl Process this file with autoconf to produce a configure script.
22
23AC_PREREQ(2.13)dnl
24AC_INIT(main.c)
25AC_CONFIG_HEADER(config.h:config.in)
413ccac7 26AM_MAINTAINER_MODE
c906108c
SS
27
28AC_PROG_CC
29AC_AIX
30AC_ISC_POSIX
31AM_PROG_CC_STDC
32
33AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
34AC_CANONICAL_SYSTEM
35
8bb2c122
MK
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.
42AC_CHECK_TOOL(RANLIB, ranlib, :)
43
0fbb3da7 44dnl Set up for gettext. PACKAGE is used when we call bindtextdomain.
c906108c
SS
45ALL_LINGUAS=
46CY_GNU_GETTEXT
0fbb3da7
TT
47AC_DEFINE(PACKAGE, "gdb", [Name of this package. ])
48
c906108c
SS
49
50dnl List of object files added by configure.
51
52CONFIG_OBS=
66b965bb 53CONFIG_LIB_OBS=
c906108c
SS
54CONFIG_DEPS=
55CONFIG_SRCS=
fb40c209
AC
56CONFIG_INITS=
57ENABLE_CFLAGS=
b3a90332
AC
58CONFIG_ALL=
59CONFIG_CLEAN=
e56ac5c3
AC
60CONFIG_INSTALL=
61CONFIG_UNINSTALL=
c906108c 62
8dcde887
MK
63AC_CONFIG_SUBDIRS(doc testsuite)
64configdirs=
96baa820 65
27e9bf90 66. $srcdir/configure.host
c906108c 67
27e9bf90 68. $srcdir/configure.tgt
c906108c 69
27e9bf90
MK
70# Fetch the default architecture and default target vector from BFD.
71targ=$target; . $srcdir/../bfd/config.bfd
5c8cc331 72
27e9bf90
MK
73# We only want the first architecture, so strip off the others if
74# there is more than one.
75targ_archs=`echo $targ_archs | sed 's/ .*//'`
5c8cc331 76
27e9bf90
MK
77if test "x$targ_archs" != x; then
78 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
79 [Define to BFD's default architecture. ])
1ba607ad 80fi
27e9bf90
MK
81if test "x$targ_defvec" != x; then
82 AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
83 [Define to BFD's default target vector. ])
1ba607ad
AC
84fi
85
8bb2c122
MK
86AC_ARG_PROGRAM
87
627af7ea
MK
88# The CLI cannot be disabled yet, but may be in the future.
89
90# Enable CLI.
91AC_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])
102if 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
114fi
115
116# Enable MI.
117AC_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])
126if 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
138fi
139
287c1a40
MK
140# Enable TUI.
141AC_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])
149if 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
162fi
163
8bb2c122
MK
164# --------------------- #
165# Checks for programs. #
166# --------------------- #
167
7a292a7a 168AC_PROG_AWK
c906108c 169AC_PROG_INSTALL
8bb2c122
MK
170AC_PROG_LN_S
171AC_PROG_RANLIB
172AC_PROG_YACC
173
c906108c 174AC_CHECK_TOOL(AR, ar)
95ca63c4
CF
175AC_CHECK_TOOL(DLLTOOL, dlltool)
176AC_CHECK_TOOL(WINDRES, windres)
c906108c 177
8bb2c122 178# Needed for GNU/Hurd.
75c6e08a
MK
179AC_CHECK_TOOL(MIG, mig)
180
9a156167
MK
181# ---------------------- #
182# Checks for libraries. #
183# ---------------------- #
184
185# We might need to link with -lm; most simulators need it.
186AC_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.
192AC_CHECK_FUNC(wctype, [],
193 [AC_CHECK_LIB(w, wctype)])
194
195# Some systems (e.g. Solaris) have `socketpair' in libsocket.
196AC_SEARCH_LIBS(socketpair, socket)
197
287c1a40
MK
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
210if test "$need_curses" = yes; then
211 AC_SEARCH_LIBS(initscr, [ncurses Hcurses curses], [],
212 [AC_MSG_ERROR([no curses library found])])
213fi
214
215case $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 ;;
230esac
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.
234AC_SEARCH_LIBS(tgetent, [termcap tinfo ncurses Hcurses curses])
235
236if test "$ac_cv_search_tgetent" = no; then
237 AC_MSG_ERROR([no termcap library found])
238fi
239
5ee754fc
MK
240# ------------------------- #
241# Checks for header files. #
242# ------------------------- #
c906108c 243
9608ab8b 244AC_HEADER_DIRENT
5ee754fc 245AC_HEADER_STAT
c906108c 246AC_HEADER_STDC
5ee754fc
MK
247AC_CHECK_HEADERS(link.h)
248AC_CHECK_HEADERS(nlist.h)
249AC_CHECK_HEADERS(poll.h sys/poll.h)
250AC_CHECK_HEADERS(proc_service.h thread_db.h)
251AC_CHECK_HEADERS(stddef.h)
252AC_CHECK_HEADERS(stdlib.h)
253AC_CHECK_HEADERS(stdint.h)
254AC_CHECK_HEADERS(string.h memory.h strings.h)
255AC_CHECK_HEADERS(sys/fault.h)
256AC_CHECK_HEADERS(sys/file.h)
257AC_CHECK_HEADERS(sys/filio.h)
258AC_CHECK_HEADERS(sys/ioctl.h)
259AC_CHECK_HEADERS(sys/param.h)
260AC_CHECK_HEADERS(sys/proc.h)
261AC_CHECK_HEADERS(sys/procfs.h)
262AC_CHECK_HEADERS(sys/ptrace.h ptrace.h)
263AC_CHECK_HEADERS(sys/reg.h sys/debugreg.h)
264AC_CHECK_HEADERS(sys/select.h)
265AC_CHECK_HEADERS(sys/syscall.h)
266AC_CHECK_HEADERS(sys/user.h)
267AC_CHECK_HEADERS(sys/wait.h wait.h)
268AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
269AC_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.
274case $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 ;;
281esac
282AC_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?
286AC_CHECK_HEADERS(ctype.h time.h)
287
288# ------------------ #
289# Checks for types. #
290# ------------------ #
c906108c 291
5ee754fc
MK
292AC_TYPE_SIGNAL
293
294# ------------------------------------- #
295# Checks for compiler characteristics. #
296# ------------------------------------- #
c906108c
SS
297
298AC_C_CONST
bce58c09 299AC_C_INLINE
c906108c 300
5ee754fc
MK
301# ------------------------------ #
302# Checks for library functions. #
303# ------------------------------ #
304
c906108c 305AC_FUNC_ALLOCA
97bf5e38 306AC_FUNC_MMAP
46711df8 307AC_FUNC_VFORK
97bf5e38
MK
308AC_CHECK_FUNCS(canonicalize_file_name realpath)
309AC_CHECK_FUNCS(poll)
310AC_CHECK_FUNCS(sbrk)
311AC_CHECK_FUNCS(setpgid setpgrp)
e1ea1d75 312AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
97bf5e38
MK
313AC_CHECK_FUNCS(socketpair)
314
72473524
DJ
315dnl AC_FUNC_SETPGRP does not work when cross compiling
316dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
317if test "$cross_compiling" = no; then
318 AC_FUNC_SETPGRP
319else
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)])
329if test $ac_cv_func_setpgrp_void = yes; then
330 AC_DEFINE(SETPGRP_VOID, 1)
331fi
332fi
c906108c 333
2b2d558c
MK
334# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
335# since sigsetjmp might only be defined as a macro.
336AC_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);],
340gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
341if test $gdb_cv_func_sigsetjmp = yes; then
342 AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
343fi
344
06825bd1
MK
345# Assume we'll default to using the included libiberty regex.
346gdb_use_included_regex=yes
347
348# However, if the system regex is GNU regex, then default to *not*
349# using the included regex.
350AC_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)])
361if test $gdb_cv_have_gnu_regex = yes; then
362 gdb_use_included_regex=no
363fi
364
365AC_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)
371if 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.])
374fi
375
0afdd437 376# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
7dfa765c 377# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
422ea4b8 378AC_CACHE_CHECK([for r_fs in struct reg], gdb_cv_struct_reg_r_fs,
7dfa765c 379[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_fs;],
422ea4b8
MK
380gdb_cv_struct_reg_r_fs=yes, gdb_cv_struct_reg_r_fs=no)])
381if test $gdb_cv_struct_reg_r_fs = yes; then
382 AC_DEFINE(HAVE_STRUCT_REG_R_FS)
7dfa765c 383fi
422ea4b8 384AC_CACHE_CHECK([for r_gs in struct reg], gdb_cv_struct_reg_r_gs,
7dfa765c 385[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_gs;],
422ea4b8
MK
386gdb_cv_struct_reg_r_gs=yes, gdb_cv_struct_reg_r_gs=no)])
387if test $gdb_cv_struct_reg_r_gs = yes; then
388 AC_DEFINE(HAVE_STRUCT_REG_R_GS)
7dfa765c
MK
389fi
390
0afdd437 391# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
f60300e7
MK
392AC_MSG_CHECKING(for PTRACE_GETREGS)
393AC_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])])
398AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
399if test $gdb_cv_have_ptrace_getregs = yes; then
400 AC_DEFINE(HAVE_PTRACE_GETREGS)
401fi
402
0afdd437 403# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
6ce2ac0b
MK
404AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
405AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
5c44784c 406[AC_TRY_COMPILE([#include <sys/ptrace.h>],
6ce2ac0b
MK
407 [PTRACE_GETFPXREGS;],
408 [gdb_cv_have_ptrace_getfpxregs=yes],
409 [gdb_cv_have_ptrace_getfpxregs=no])])
410AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
411if test $gdb_cv_have_ptrace_getfpxregs = yes; then
412 AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
5c44784c
JM
413fi
414
0afdd437
MK
415# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
416AC_MSG_CHECKING(for PT_GETDBREGS)
417AC_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])])
423AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
424if test $gdb_cv_have_pt_getdbregs = yes; then
425 AC_DEFINE(HAVE_PT_GETDBREGS)
426fi
427
7e89e357
JT
428# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
429AC_MSG_CHECKING(for PT_GETXMMREGS)
430AC_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])])
436AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
437if test $gdb_cv_have_pt_getxmmregs = yes; then
438 AC_DEFINE(HAVE_PT_GETXMMREGS)
439fi
440
0afdd437 441
c906108c
SS
442BFD_NEED_DECLARATION(malloc)
443BFD_NEED_DECLARATION(realloc)
444BFD_NEED_DECLARATION(free)
445BFD_NEED_DECLARATION(strerror)
446BFD_NEED_DECLARATION(strdup)
b83266a0 447BFD_NEED_DECLARATION(strstr)
a4db0f07 448BFD_NEED_DECLARATION(canonicalize_file_name)
c906108c
SS
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
454AC_MSG_CHECKING(for HPUX save_state structure)
455AC_EGREP_HEADER(save_state_t, machine/save_state.h,
456 gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no)
457AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes,
458 gdb_cv_hpux_sswide=no)
459if test $gdb_cv_hpux_savestate = yes
460then
461 AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1)
462fi
463if test $gdb_cv_hpux_sswide = yes
464then
465 AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1)
466fi
467AC_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
c3f6f71d 472# Also detect which type of /proc is in use, such as for Unixware or Solaris.
c906108c
SS
473
474if 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 ;;
596c9d4b
KB
480 ia64-*-aix*)
481 AC_DEFINE(NEW_PROC_API)
482 ;;
1045b512 483 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
c3f6f71d
JM
484 AC_DEFINE(NEW_PROC_API)
485 ;;
3423db82 486 *-*-solaris2.[[678]])
c3f6f71d
JM
487 AC_DEFINE(NEW_PROC_API)
488 ;;
c906108c 489 esac
c906108c
SS
490fi
491
492if 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)
83d37ec8
MK
497 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
498 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
23e04971
MS
499 BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
500 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
83d37ec8
MK
501 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
502 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
596c9d4b
KB
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)
c906108c 507
23e04971 508
d84dd0c5
MK
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
a3007b6f 514 dnl around it in gdb_proc_service.h.
d84dd0c5
MK
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
c906108c
SS
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
551fi
552
d45fe813
KB
553dnl For native ports (host == target), check to see what kind of
554dnl legacy link.h support is needed. (See solib-legacy.c.)
555if 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>
39812ceb
C
591#ifdef HAVE_NLIST_H
592#include <nlist.h>
593#endif
d45fe813
KB
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)
943c9c25 615 AC_DEFINE(_SYSCALL32)
d45fe813
KB
616 fi
617fi
618
c906108c
SS
619dnl See if compiler supports "long long" type.
620
621AC_MSG_CHECKING(for long long support in compiler)
622AC_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],
627gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
628AC_MSG_RESULT($gdb_cv_c_long_long)
629if test $gdb_cv_c_long_long = yes; then
630 AC_DEFINE(CC_HAS_LONG_LONG)
631fi
632
633dnl See if the compiler and runtime support printing long long
634
635AC_MSG_CHECKING(for long long support in printf)
636AC_CACHE_VAL(gdb_cv_printf_has_long_long,
637[AC_TRY_RUN([
638int 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}],
648gdb_cv_printf_has_long_long=yes,
649gdb_cv_printf_has_long_long=no,
650gdb_cv_printf_has_long_long=no)])
651if test $gdb_cv_printf_has_long_long = yes; then
652 AC_DEFINE(PRINTF_HAS_LONG_LONG)
653fi
654AC_MSG_RESULT($gdb_cv_printf_has_long_long)
655
656dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
657dnl because autoconf complains about cross-compilation issues. However, this
658dnl code uses the same variables as the macro for compatibility.
659
660AC_MSG_CHECKING(for long double support in compiler)
661AC_CACHE_VAL(ac_cv_c_long_double,
662[AC_TRY_COMPILE(, [long double foo;],
663ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
664AC_MSG_RESULT($ac_cv_c_long_double)
665if test $ac_cv_c_long_double = yes; then
666 AC_DEFINE(HAVE_LONG_DOUBLE)
667fi
668
669dnl See if the compiler and runtime support printing long doubles
670
671AC_MSG_CHECKING(for long double support in printf)
672AC_CACHE_VAL(gdb_cv_printf_has_long_double,
673[AC_TRY_RUN([
674int main () {
675 char buf[16];
676 long double f = 3.141592653;
677 sprintf (buf, "%Lg", f);
678 return (strncmp ("3.14159", buf, 7));
679}],
680gdb_cv_printf_has_long_double=yes,
681gdb_cv_printf_has_long_double=no,
682gdb_cv_printf_has_long_double=no)])
683if test $gdb_cv_printf_has_long_double = yes; then
684 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
685fi
686AC_MSG_RESULT($gdb_cv_printf_has_long_double)
687
688dnl See if the compiler and runtime support scanning long doubles
689
690AC_MSG_CHECKING(for long double support in scanf)
691AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
692[AC_TRY_RUN([
693int 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}],
699gdb_cv_scanf_has_long_double=yes,
700gdb_cv_scanf_has_long_double=no,
701gdb_cv_scanf_has_long_double=no)])
702if test $gdb_cv_scanf_has_long_double = yes; then
703 AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
704fi
705AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
706
438013df
AO
707case ${host_os} in
708aix*)
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 ;;
722esac
723
c906108c 724
d92419e5
JB
725dnl For certain native configurations, we need to check whether thread
726dnl support can be built in or not.
727dnl
728dnl Note that we only want this if we are both native (host == target),
729dnl and not doing a canadian cross build (build == host).
c906108c
SS
730
731if 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)
66b965bb 739 CONFIG_LIB_OBS="${CONFIG_LIB_OBS} hpux-thread.o"
c906108c
SS
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*)
d92419e5
JB
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.
c906108c
SS
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)
66b965bb 757 CONFIG_LIB_OBS="${CONFIG_LIB_OBS} sol-thread.o"
c906108c
SS
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 ;;
d92419e5
JB
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 ;;
c906108c
SS
808 esac
809 AC_SUBST(CONFIG_LDFLAGS)
810fi
811
3f47be5c
EZ
812dnl See if we have a thread_db header file that has TD_NOTALLOC.
813if 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 )
823fi
824if 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.])
827fi
828
eb784848
DJ
829dnl linux-proc.c wants to use pread64, which may require special CFLAGS
830dnl -D_BSD_SOURCE is normally assumed but we have to specify it because of
831dnl -D_XOPEN_SOURCE=500.
832if 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
844fi
845
c906108c 846dnl Handle optional features that can be enabled.
fb40c209 847
3b851bce
AC
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.
1decb323 852build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
93d56215 853-Wformat -Wparentheses -Wpointer-arith -Wuninitialized"
d8038014
AC
854# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
855# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
93d56215 856# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
d8038014
AC
857# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
858# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
859# -Woverloaded-virtual -Winline -Werror"
c906108c
SS
860AC_ARG_ENABLE(build-warnings,
861[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
1decb323 862[case "${enableval}" in
c906108c
SS
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"`;;
d4f3574e
SS
870esac
871if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
746a987d 872 echo "Setting compiler warning flags = $build_warnings" 6>&1
1decb323 873fi])dnl
3b851bce
AC
874AC_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"`;;
884esac
885if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
886 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
887fi])dnl
104c1213
JM
888WARN_CFLAGS=""
889WERROR_CFLAGS=""
c906108c
SS
890if test "x${build_warnings}" != x -a "x$GCC" = xyes
891then
746a987d
AC
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
4536bbc6
AC
899 saved_CFLAGS="$CFLAGS"
900 CFLAGS="$CFLAGS $w"
901 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
902 CFLAGS="$saved_CFLAGS"
746a987d
AC
903 esac
904 done
905 AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
1decb323 906fi
c906108c 907AC_SUBST(WARN_CFLAGS)
104c1213 908AC_SUBST(WERROR_CFLAGS)
c906108c
SS
909
910MMALLOC_CFLAGS=
911MMALLOC=
912AC_SUBST(MMALLOC_CFLAGS)
913AC_SUBST(MMALLOC)
914
915AC_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) ;;
921esac],[want_mmalloc=false])dnl
922
923if 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'
928fi
929
7a292a7a
SS
930# In the Cygwin environment, we need some additional flags.
931AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
932[AC_EGREP_CPP(lose, [
933#if defined (__CYGWIN__) || defined (__CYGWIN32__)
934lose
935#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
936
aff38e61
AC
937
938dnl Figure out which of the many generic ser-*.c files the _host_ supports.
939SER_HARDWIRE="ser-unix.o ser-pipe.o ser-tcp.o"
940case ${host} in
95cbc983
AC
941 *go32* ) SER_HARDWIRE=ser-go32.o ;;
942 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
aff38e61
AC
943esac
944AC_SUBST(SER_HARDWIRE)
945
cd0fc7c3
SS
946# libreadline needs libuser32.a in a cygwin environment
947WIN32LIBS=
948if test x$gdb_cv_os_cygwin = xyes; then
c5394b80
JM
949 WIN32LIBS="-luser32"
950 case "${target}" in
951 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
952 ;;
953 esac
cd0fc7c3
SS
954fi
955AC_SUBST(WIN32LIBS)
7a292a7a 956
3fc11d3e
JM
957LIBGUI="../libgui/src/libgui.a"
958GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
959AC_SUBST(LIBGUI)
960AC_SUBST(GUI_CFLAGS_X)
7a292a7a 961
3fc11d3e
JM
962AC_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) ;;
980esac],
981[
982# Default is on for everything but go32 and Cygwin
983case "$host" in
984 *go32* | *windows*)
985 ;;
986 *)
379d6434
AC
987 if test -d "${srcdir}/gdbtk" ; then
988 enable_gdbtk=yes
989 fi
990 ;;
991esac
3fc11d3e
JM
992])
993
994WIN32LDAPP=
995AC_SUBST(WIN32LIBS)
996AC_SUBST(WIN32LDAPP)
997
998configdir="unix"
999
1000GDBTKLIBS=
1001if test "${enable_gdbtk}" = "yes"; then
1002
d1c3b63a
KS
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
3fc11d3e
JM
1010 CY_AC_PATH_TCLCONFIG
1011 if test -z "${no_tcl}"; then
1012 CY_AC_LOAD_TCLCONFIG
1013 CY_AC_PATH_TKCONFIG
1014
dd2504ab
JM
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
3fc11d3e
JM
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
3fc11d3e 1036
dd2504ab
JM
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
3fc11d3e
JM
1051 # now look for Itcl library stuff
1052
1053 CY_AC_PATH_ITCLCONFIG
1054 if test -z "${no_itcl}"; then
b381d62d 1055 CY_AC_LOAD_ITCLCONFIG
3fc11d3e
JM
1056
1057 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
b381d62d 1058 ITCL_DEPS="${ITCL_LIB_FULL_PATH}"
3fc11d3e
JM
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
3fc11d3e 1067 ITKLIB="${ITK_BUILD_LIB_SPEC}"
b381d62d 1068 ITK_DEPS="${ITK_LIB_FULL_PATH}"
3fc11d3e
JM
1069 fi
1070
4226a5a5 1071 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
3fc11d3e
JM
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.
b2a1bd4f 1083 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
3fc11d3e
JM
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}"
4226a5a5
FN
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)"
b3a90332 1095 CONFIG_ALL="${CONFIG_ALL} \$(SUBDIR_GDBTK_ALL)"
ce844ae2 1096 CONFIG_CLEAN="${CONFIG_CLEAN} \$(SUBDIR_GDBTK_CLEAN)"
e56ac5c3
AC
1097 CONFIG_INSTALL="${CONFIG_INSTALL} \$(SUBDIR_GDBTK_INSTALL)"
1098 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} \$(SUBDIR_GDBTK_UNINSTALL)"
3fc11d3e
JM
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
ffc6a242 1107
ffc6a242 1108 configdirs="${configdirs} gdbtk"
3fc11d3e
JM
1109fi
1110
3fc11d3e
JM
1111AC_SUBST(X_CFLAGS)
1112AC_SUBST(X_LDFLAGS)
1113AC_SUBST(X_LIBS)
dd2504ab
JM
1114AC_SUBST(TCL_DEPS)
1115AC_SUBST(TK_DEPS)
3fc11d3e
JM
1116AC_SUBST(ITCLLIB)
1117AC_SUBST(ITCL_DEPS)
1118AC_SUBST(ITKLIB)
1119AC_SUBST(ITK_DEPS)
3fc11d3e
JM
1120AC_SUBST(GDBTKLIBS)
1121AC_SUBST(GDBTK_CFLAGS)
d1c3b63a 1122AC_SUBST(GDBTK_SRC_DIR)
8b93c638 1123
c906108c
SS
1124AC_PATH_X
1125
7a292a7a
SS
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
6c5cfe5b 1132# not part of the source tree.
7a292a7a
SS
1133#
1134AC_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
1145if test ! -d "${srcdir}/../sim"; then
1146 ignore_sim=true
1147fi
1148
1149if test "${ignore_sim}" = "true"; then
1150 IGNORE_SIM="SIM="
1151 IGNORE_SIM_OBS="SIM_OBS="
1152else
1153 IGNORE_SIM=""
1154 IGNORE_SIM_OBS=""
1155 AC_DEFINE(WITH_SIM)
1156fi
1157AC_SUBST(IGNORE_SIM)
1158AC_SUBST(IGNORE_SIM_OBS)
1159
c906108c
SS
1160AC_SUBST(ENABLE_CFLAGS)
1161
1162AC_SUBST(CONFIG_OBS)
66b965bb 1163AC_SUBST(CONFIG_LIB_OBS)
c906108c
SS
1164AC_SUBST(CONFIG_DEPS)
1165AC_SUBST(CONFIG_SRCS)
dfcd3bfb 1166AC_SUBST(CONFIG_INITS)
b3a90332
AC
1167AC_SUBST(CONFIG_ALL)
1168AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
1169AC_SUBST(CONFIG_INSTALL)
1170AC_SUBST(CONFIG_UNINSTALL)
c906108c
SS
1171
1172# Begin stuff to support --enable-shared
1173AC_ARG_ENABLE(shared,
1174[ --enable-shared Use shared libraries],
1175[case "${enableval}" in
1176 yes) shared=true ;;
1177 no) shared=false ;;
1178 *) shared=true ;;
1179esac])dnl
1180
1181HLDFLAGS=
1182HLDENV=
1183# If we have shared libraries, try to set rpath reasonably.
1184if 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 ;;
d332c5ac 1194 *-*-linux* | *-pc-linux-gnu*)
c906108c
SS
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
1204fi
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.
1209case "${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 ;;
1228esac
1229AC_SUBST(HLDFLAGS)
1230AC_SUBST(HLDENV)
1231# End stuff to support --enable-shared
1232
1233# target_subdir is used by the testsuite to find the target libraries.
1234target_subdir=
1235if test "${host}" != "${target}"; then
1236 target_subdir="${target_alias}/"
1237fi
1238AC_SUBST(target_subdir)
1239
1240frags=
1241host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
1242if test ! -f ${host_makefile_frag}; then
7fd60527
AC
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
c906108c
SS
1251fi
1252frags="$frags $host_makefile_frag"
1253
1254target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
1255if test ! -f ${target_makefile_frag}; then
1256AC_MSG_ERROR("*** Gdb does not support target ${target}")
1257fi
1258frags="$frags $target_makefile_frag"
1259
1260AC_SUBST_FILE(host_makefile_frag)
1261AC_SUBST_FILE(target_makefile_frag)
1262AC_SUBST(frags)
1263
1264changequote(,)dnl
1265hostfile=`sed -n '
1266s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1267' ${host_makefile_frag}`
1268
1269targetfile=`sed -n '
1270s/TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1271' ${target_makefile_frag}`
1272
6166d547
AC
1273GDB_MULTI_ARCH=`sed -n '
1274s/GDB_MULTI_ARCH[ ]*=[ ]*\([^ ]*\)[ ]*/\1/p
1275' ${target_makefile_frag}`
1276
c906108c 1277if test "${target}" = "${host}"; then
a85f51e7
DJ
1278# We pick this up from the host configuration file (.mh) because we
1279# do not have a native configuration Makefile fragment.
c906108c
SS
1280nativefile=`sed -n '
1281s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1282' ${host_makefile_frag}`
c906108c
SS
1283fi
1284changequote([,])
1285
6166d547
AC
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.
1290if 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
1296fi
1297if test x"${GDB_MULTI_ARCH}" != x ; then
1298 AC_DEFINE_UNQUOTED(GDB_MULTI_ARCH, ${GDB_MULTI_ARCH})
1299fi
6c5cfe5b 1300# Warn the user when they use an old practice
6166d547
AC
1301case "${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
6c5cfe5b 1307 AC_MSG_WARN("GDB: Ignoring TM_FILE in ${target_makefile_frag}")
5a2402b8 1308 targetfile=""
6166d547
AC
1309 fi ;;
1310 *) AC_MSG_ERROR("GDB: Unknown GDB_MULTI_ARCH value ${GDB_MULTI_ARCH}");;
1311esac
1312
8dcde887
MK
1313# Enable multi-ice-gdb-server.
1314AC_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])
1321if test "x$enable_multi_ice" = xyes; then
1322 configdirs="$configdirs multi-ice"
96baa820
JM
1323fi
1324
8dcde887
MK
1325# We only build gdbserver automatically if host and target are the same.
1326if 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
a85f51e7
DJ
1334fi
1335
8dcde887
MK
1336AC_CONFIG_SUBDIRS($configdirs)
1337SUBDIRS=$subdirs
96baa820
JM
1338AC_SUBST(SUBDIRS)
1339
c906108c 1340# If hostfile (XM_FILE) and/or targetfile (TM_FILE) and/or nativefile
5a2402b8
AC
1341# (NAT_FILE) is not set in config/*/*.m[ht] files, we link to an empty
1342# version.
c906108c
SS
1343
1344files=
1345links=
5a2402b8 1346
c906108c 1347rm -f xm.h
5a2402b8 1348xm_h=""
c906108c 1349if test "${hostfile}" != ""; then
5a2402b8
AC
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})
c906108c 1355fi
5a2402b8
AC
1356AC_SUBST(xm_h)
1357
c906108c 1358rm -f tm.h
5a2402b8 1359tm_h=""
c906108c 1360if test "${targetfile}" != ""; then
5a2402b8
AC
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})
c906108c 1366fi
5a2402b8
AC
1367AC_SUBST(tm_h)
1368
c906108c 1369rm -f nm.h
5a2402b8 1370nm_h=""
c906108c 1371if test "${nativefile}" != ""; then
5a2402b8
AC
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})
c906108c 1377fi
5a2402b8
AC
1378AC_SUBST(nm_h)
1379
c906108c
SS
1380AC_LINK_FILES($files, $links)
1381
1382dnl Check for exe extension set on certain hosts (e.g. Win32)
1383AC_EXEEXT
1384
234b45d4
KB
1385dnl Detect the character set used by this host.
1386
1387dnl At the moment, we just assume it's ISO-8859-1 (which is a
1388dnl superset of ASCII containing the characters needed for French,
1389dnl German, Spanish, Italian, and possibly others), but if were
1390dnl *were* to support any host character sets other than ISO-8859-1,
1391dnl here's where we'd detect it.
1392AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
1393 [Define to be a string naming the default host character set.])
1394
1395AM_ICONV
1396
ed952ac5 1397AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
c906108c
SS
1398[
1399dnl Autoconf doesn't provide a mechanism for modifying definitions
1400dnl provided by makefile fragments.
1401dnl
1402if test "${nativefile}" = ""; then
c4620205 1403 < Makefile \
e27da16d
JT
1404 sed -e '/^NATDEPFILES[[ ]]*=.*\\$/,/[[^\\]]$/s/^/# /' \
1405 -e '/^NATDEPFILES[[ ]]*=/s/^/# /' \
c4620205
JB
1406 | sed -e '/^\(NATDEPFILES[[ ]]*[[+]]=[[ ]]*\)/s//# \1/' \
1407 > Makefile.tem
c906108c
SS
1408mv -f Makefile.tem Makefile
1409fi
1410
1411changequote(,)dnl
1412sed -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
1415mv -f Makefile.tmp Makefile
1416changequote([,])dnl
1417
2acceee2 1418
c906108c
SS
1419case x$CONFIG_HEADERS in
1420xconfig.h:config.in)
1421echo > stamp-h ;;
1422esac
1423],
1424[
1425gdb_host_cpu=$gdb_host_cpu
1426gdb_target_cpu=$gdb_target_cpu
1427nativefile=$nativefile
1428])
1429
1430exit 0
This page took 0.287345 seconds and 4 git commands to generate.