* config/tm-linux.h: Delete file.
[deliverable/binutils-gdb.git] / gdb / configure.ac
CommitLineData
c906108c 1dnl Autoconf configure script for GDB, the GNU debugger.
0ea3f30e
DJ
2dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3dnl 2005, 2006
b6ba6518 4dnl Free Software Foundation, Inc.
c906108c
SS
5dnl
6dnl This file is part of GDB.
7dnl
8dnl This program is free software; you can redistribute it and/or modify
9dnl it under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 2 of the License, or
11dnl (at your option) any later version.
12dnl
13dnl This program is distributed in the hope that it will be useful,
14dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16dnl GNU General Public License for more details.
17dnl
18dnl You should have received a copy of the GNU General Public License
19dnl along with this program; if not, write to the Free Software
197e01b6
EZ
20dnl Foundation, Inc., 51 Franklin Street, Fifth Floor,
21dnl Boston, MA 02110-1301, USA.
c906108c
SS
22
23dnl Process this file with autoconf to produce a configure script.
24
bec39cab 25AC_PREREQ(2.59)dnl
c906108c
SS
26AC_INIT(main.c)
27AC_CONFIG_HEADER(config.h:config.in)
413ccac7 28AM_MAINTAINER_MODE
c906108c
SS
29
30AC_PROG_CC
14abd0fb 31AC_GNU_SOURCE
c906108c
SS
32AC_AIX
33AC_ISC_POSIX
34AM_PROG_CC_STDC
35
36AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
37AC_CANONICAL_SYSTEM
38
ddc9cd0f
AC
39dnl List of object files and targets accumulated by configure.
40
41CONFIG_OBS=
42CONFIG_DEPS=
43CONFIG_SRCS=
44ENABLE_CFLAGS=
45
46CONFIG_ALL=
47CONFIG_CLEAN=
48CONFIG_INSTALL=
49CONFIG_UNINSTALL=
50
20e95c23
DJ
51dnl Set up for gettext.
52ZW_GNU_GETTEXT_SISTER_DIR
ddc9cd0f
AC
53
54localedir='${datadir}/locale'
55AC_SUBST(localedir)
56
20e95c23 57if test x"$USE_NLS" = xyes; then
ddc9cd0f
AC
58 CONFIG_ALL="$CONFIG_ALL all-po"
59 CONFIG_CLEAN="$CONFIG_CLEAN clean-po"
60 CONFIG_INSTALL="$CONFIG_INSTALL install-po"
61 CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
62fi
63
64PACKAGE=gdb
65AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
66AC_SUBST(PACKAGE)
0fbb3da7 67
5b5d99cf
JB
68debugdir=${libdir}/debug
69
70AC_ARG_WITH(separate-debug-dir,
71[ --with-separate-debug-dir=path Look for global separate debug info in this path [LIBDIR/debug]],
72[debugdir="${withval}"])
73
74AC_DEFINE_DIR(DEBUGDIR, debugdir,
75 [Global directory for separate debug files. ])
76#AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"),
c906108c 77
8dcde887 78AC_CONFIG_SUBDIRS(doc testsuite)
96baa820 79
121ce6e5
DJ
80# Provide defaults for some variables set by the per-host and per-target
81# configuration.
82gdb_host_obs=posix-hdep.o
83
771b4502
UW
84if test "${target}" = "${host}"; then
85 gdb_native=yes
86else
87 gdb_native=no
88fi
89
27e9bf90 90. $srcdir/configure.host
c906108c 91
27e9bf90 92. $srcdir/configure.tgt
c906108c 93
27e9bf90
MK
94# Fetch the default architecture and default target vector from BFD.
95targ=$target; . $srcdir/../bfd/config.bfd
5c8cc331 96
27e9bf90
MK
97# We only want the first architecture, so strip off the others if
98# there is more than one.
99targ_archs=`echo $targ_archs | sed 's/ .*//'`
5c8cc331 100
27e9bf90
MK
101if test "x$targ_archs" != x; then
102 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
103 [Define to BFD's default architecture. ])
1ba607ad 104fi
27e9bf90
MK
105if test "x$targ_defvec" != x; then
106 AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
107 [Define to BFD's default target vector. ])
1ba607ad
AC
108fi
109
8bb2c122
MK
110AC_ARG_PROGRAM
111
627af7ea
MK
112# The CLI cannot be disabled yet, but may be in the future.
113
114# Enable CLI.
115AC_ARG_ENABLE(gdbcli,
116[ --disable-gdbcli disable command-line interface (CLI)],
117 [case $enableval in
118 yes)
119 ;;
120 no)
121 AC_MSG_ERROR([the command-line interface cannot be disabled yet]) ;;
122 *)
123 AC_MSG_ERROR([bad value $enableval for --enable-gdbcli]) ;;
124 esac],
125 [enable_gdbcli=yes])
126if test x"$enable_gdbcli" = xyes; then
127 if test -d $srcdir/cli; then
128 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)"
129 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)"
130 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)"
627af7ea 131 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)"
627af7ea
MK
132 fi
133fi
134
135# Enable MI.
136AC_ARG_ENABLE(gdbmi,
137[ --disable-gdbmi disable machine-interface (MI)],
138 [case $enableval in
139 yes | no)
140 ;;
141 *)
142 AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
143 esac],
144 [enable_gdbmi=yes])
145if test x"$enable_gdbmi" = xyes; then
146 if test -d $srcdir/mi; then
147 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
148 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
149 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
627af7ea 150 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
627af7ea
MK
151 fi
152fi
153
287c1a40
MK
154# Enable TUI.
155AC_ARG_ENABLE(tui,
156[ --enable-tui enable full-screen terminal user interface (TUI)],
157 [case $enableval in
158 yes | no)
159 ;;
160 *)
161 AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
c324d747 162 esac],enable_tui=yes)
287c1a40 163
8ee53726
MK
164# Enable gdbtk.
165AC_ARG_ENABLE(gdbtk,
d28f9cdf 166[ --enable-gdbtk enable gdbtk graphical user interface (GUI)],
8ee53726
MK
167 [case $enableval in
168 yes | no)
169 ;;
170 *)
171 AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
172 esac],
04ac69aa 173 [if test -d $srcdir/gdbtk -a -d $srcdir/../itcl; then
8ee53726
MK
174 enable_gdbtk=yes
175 else
176 enable_gdbtk=no
177 fi])
178# We unconditionally disable gdbtk tests on selected platforms.
179case $host_os in
180 go32* | windows*)
181 AC_MSG_WARN([gdbtk isn't supported on $host; disabling])
182 enable_gdbtk=no ;;
183esac
184
0e5d83e3
JJ
185# Libunwind support.
186AC_ARG_WITH(libunwind,
187[ --with-libunwind Use libunwind frame unwinding support],
188[case "${withval}" in
189 yes) enable_libunwind=yes ;;
190 no) enable_libunwind=no ;;
191 *) AC_MSG_ERROR(bad value ${withval} for GDB with-libunwind option) ;;
192esac],[
193 AC_CHECK_HEADERS(libunwind.h)
194 AC_CHECK_HEADERS(libunwind-ia64.h)
195 if test x"$ac_cv_header_libunwind_h" = xyes -a x"$ac_cv_header_libunwind_ia64_h" = xyes; then
196 enable_libunwind=yes;
197 fi
198])
199
200if test x"$enable_libunwind" = xyes; then
201 AC_CHECK_HEADERS(libunwind.h)
202 AC_CHECK_HEADERS(libunwind-ia64.h)
60ca704f 203 AC_DEFINE(HAVE_LIBUNWIND, 1, [Define if libunwind library is being used.])
0e5d83e3
JJ
204 CONFIG_OBS="$CONFIG_OBS libunwind-frame.o"
205 CONFIG_DEPS="$CONFIG_DEPS libunwind-frame.o"
206 CONFIG_SRCS="$CONFIG_SRCS libunwind-frame.c"
207fi
208
d28f9cdf
DJ
209# Profiling support.
210AC_ARG_ENABLE(profiling,
211[ --enable-profiling enable profiling of GDB],
212 [case $enableval in
213 yes | no)
214 ;;
215 *)
216 AC_MSG_ERROR([bad value $enableval for --enable-profile]) ;;
217 esac],
218 [enable_profiling=no])
219
d9feb4e7 220AC_CHECK_FUNCS(monstartup _mcleanup)
b0b1c2c0
MK
221AC_CACHE_CHECK([for _etext], ac_cv_var__etext,
222[AC_TRY_LINK(
223[#include <stdlib.h>
224extern char _etext;
225],
226[free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
227if test $ac_cv_var__etext = yes; then
228 AC_DEFINE(HAVE__ETEXT, 1,
229 [Define to 1 if your system has the _etext variable. ])
230fi
d28f9cdf 231if test "$enable_profiling" = yes ; then
d9feb4e7
DJ
232 if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
233 AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
234 fi
d28f9cdf
DJ
235 PROFILE_CFLAGS=-pg
236 OLD_CFLAGS="$CFLAGS"
237 CFLAGS="$CFLAGS $PROFILE_CFLAGS"
238
d9feb4e7
DJ
239 AC_CACHE_CHECK([whether $CC supports -pg], ac_cv_cc_supports_pg,
240 [AC_TRY_COMPILE([], [int x;], ac_cv_cc_supports_pg=yes,
241 ac_cv_cc_supports_pg=no)])
d28f9cdf 242
d9feb4e7
DJ
243 if test $ac_cv_cc_supports_pg = no; then
244 AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
245 fi
d28f9cdf
DJ
246
247 CFLAGS="$OLD_CFLAGS"
248fi
249
8bb2c122
MK
250# --------------------- #
251# Checks for programs. #
252# --------------------- #
253
7a292a7a 254AC_PROG_AWK
c906108c 255AC_PROG_INSTALL
8bb2c122
MK
256AC_PROG_LN_S
257AC_PROG_RANLIB
258AC_PROG_YACC
259
c906108c 260AC_CHECK_TOOL(AR, ar)
95ca63c4
CF
261AC_CHECK_TOOL(DLLTOOL, dlltool)
262AC_CHECK_TOOL(WINDRES, windres)
c906108c 263
8bb2c122 264# Needed for GNU/Hurd.
75c6e08a
MK
265AC_CHECK_TOOL(MIG, mig)
266
9a156167
MK
267# ---------------------- #
268# Checks for libraries. #
269# ---------------------- #
270
271# We might need to link with -lm; most simulators need it.
272AC_CHECK_LIB(m, main)
273
274# We need to link with -lw to get `wctype' on Solaris before Solaris
275# 2.6. Solaris 2.6 and beyond have this function in libc, and have a
276# libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
277# is known to have this problem). Therefore we avoid libw if we can.
278AC_CHECK_FUNC(wctype, [],
279 [AC_CHECK_LIB(w, wctype)])
280
c890192f
MK
281# Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
282AC_SEARCH_LIBS(gethostbyname, nsl)
283
9a156167
MK
284# Some systems (e.g. Solaris) have `socketpair' in libsocket.
285AC_SEARCH_LIBS(socketpair, socket)
286
4f0be353
MK
287# For the TUI, we need enhanced curses functionality.
288#
289# FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
290# curses library because the latter might not provide all the
291# functionality we need. However, this leads to problems on systems
292# where the linker searches /usr/local/lib, but the compiler doesn't
293# search /usr/local/include, if ncurses is installed in /usr/local. A
294# default installation of ncurses on alpha*-dec-osf* will lead to such
295# a situation.
8b9cf735 296AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])
4f0be353 297
4f0be353
MK
298# Since GDB uses Readline, we need termcap functionality. In many
299# cases this will be provided by the curses library, but some systems
300# have a seperate termcap library, or no curses library at all.
287c1a40
MK
301
302case $host_os in
303 cygwin*)
304 if test -d $srcdir/libtermcap; then
305 LIBS="../libtermcap/libtermcap.a $LIBS"
306 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
307 fi ;;
228a417c 308 go32* | *djgpp*)
287c1a40
MK
309 ac_cv_search_tgetent="none required"
310 ;;
7ef34f2c
MM
311 *mingw32*)
312 ac_cv_search_tgetent="none required"
313 CONFIG_OBS="$CONFIG_OBS win32-termcap.o"
314 ;;
287c1a40
MK
315esac
316
4f0be353
MK
317# These are the libraries checked by Readline.
318AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
287c1a40
MK
319
320if test "$ac_cv_search_tgetent" = no; then
321 AC_MSG_ERROR([no termcap library found])
322fi
323
7fa2210b
DJ
324AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"],
325 [XML_Parser p = XML_ParserCreate (0);])
326if test "$HAVE_LIBEXPAT" != yes; then
327 AC_MSG_WARN([expat is missing or unusable; some features may be disabled.])
328fi
329
5ee754fc
MK
330# ------------------------- #
331# Checks for header files. #
332# ------------------------- #
c906108c 333
9608ab8b 334AC_HEADER_DIRENT
5ee754fc 335AC_HEADER_STAT
c906108c 336AC_HEADER_STDC
5ee754fc 337AC_CHECK_HEADERS(nlist.h)
7cb9022a
MK
338AC_CHECK_HEADERS(link.h, [], [],
339[#if HAVE_SYS_TYPES_H
340# include <sys/types.h>
341#endif
342#if HAVE_NLIST_H
343# include <nlist.h>
344#endif
345])
346AC_CHECK_HEADERS(machine/reg.h)
5ee754fc 347AC_CHECK_HEADERS(poll.h sys/poll.h)
a2f23071 348AC_CHECK_HEADERS(proc_service.h thread_db.h gnu/libc-version.h)
5ee754fc
MK
349AC_CHECK_HEADERS(stddef.h)
350AC_CHECK_HEADERS(stdlib.h)
351AC_CHECK_HEADERS(stdint.h)
352AC_CHECK_HEADERS(string.h memory.h strings.h)
353AC_CHECK_HEADERS(sys/fault.h)
354AC_CHECK_HEADERS(sys/file.h)
355AC_CHECK_HEADERS(sys/filio.h)
356AC_CHECK_HEADERS(sys/ioctl.h)
357AC_CHECK_HEADERS(sys/param.h)
7cb9022a
MK
358AC_CHECK_HEADERS(sys/proc.h, [], [],
359[#if HAVE_SYS_PARAM_H
360# include <sys/param.h>
361#endif
362])
5ee754fc
MK
363AC_CHECK_HEADERS(sys/procfs.h)
364AC_CHECK_HEADERS(sys/ptrace.h ptrace.h)
365AC_CHECK_HEADERS(sys/reg.h sys/debugreg.h)
366AC_CHECK_HEADERS(sys/select.h)
367AC_CHECK_HEADERS(sys/syscall.h)
086ec9eb 368AC_CHECK_HEADERS(sys/types.h)
7cb9022a
MK
369AC_CHECK_HEADERS(sys/user.h, [], [],
370[#if HAVE_SYS_PARAM_H
371# include <sys/param.h>
372#endif
373])
5ee754fc
MK
374AC_CHECK_HEADERS(sys/wait.h wait.h)
375AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
376AC_CHECK_HEADERS(unistd.h)
377
b1d19a62 378# On Solaris 2.[789], we need to define _MSE_INT_H to avoid a clash
5ee754fc
MK
379# between <widec.h> and <wchar.h> that would cause AC_CHECK_HEADERS to
380# think that we don't have <curses.h> if we're using GCC.
381case $host_os in
b1d19a62 382 solaris2.[[789]])
5ee754fc
MK
383 if test "$GCC" = yes; then
384 AC_DEFINE(_MSE_INT_H, 1,
ba1e897e
EZ
385 [Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
386 Solaris 2.[789] when using GCC. ])
5ee754fc
MK
387 fi ;;
388esac
3b78cdbb 389AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h)
c401b55a
MK
390AC_CHECK_HEADERS(ncurses/term.h)
391AC_CHECK_HEADERS(term.h, [], [],
392[#if HAVE_CURSES_H
393# include <curses.h>
394#endif
395])
5ee754fc
MK
396
397# FIXME: kettenis/20030102: In most cases we include these
398# unconditionally, so what's the point in checking these?
399AC_CHECK_HEADERS(ctype.h time.h)
400
4e8d927d
DJ
401# Create a header we can use portably to get the standard integer types.
402GCC_HEADER_STDINT(gdb_stdint.h)
403
b9362cc7
AC
404# ------------------------- #
405# Checks for declarations. #
406# ------------------------- #
407
a3828db0
MK
408AC_CHECK_DECLS([free, malloc, realloc])
409AC_CHECK_DECLS([strerror, strstr])
194134a1 410AC_CHECK_DECLS([getopt, snprintf, vsnprintf])
b9362cc7 411
666ec76f
MK
412# ----------------------- #
413# Checks for structures. #
414# ----------------------- #
415
416AC_CHECK_MEMBERS([struct stat.st_blocks])
d3ea6809 417AC_CHECK_MEMBERS([struct stat.st_blksize])
666ec76f 418
5ee754fc
MK
419# ------------------ #
420# Checks for types. #
421# ------------------ #
c906108c 422
5ee754fc 423AC_TYPE_SIGNAL
f9f87d2c
MK
424AC_CHECK_TYPES(socklen_t, [], [],
425[#include <sys/types.h>
426#include <sys/socket.h>
427])
3be60c3d 428AC_CHECK_TYPES(uintptr_t, [], [], [#include <stdint.h>])
5ee754fc
MK
429
430# ------------------------------------- #
431# Checks for compiler characteristics. #
432# ------------------------------------- #
c906108c
SS
433
434AC_C_CONST
bce58c09 435AC_C_INLINE
c906108c 436
5ee754fc
MK
437# ------------------------------ #
438# Checks for library functions. #
439# ------------------------------ #
440
c906108c 441AC_FUNC_ALLOCA
97bf5e38 442AC_FUNC_MMAP
46711df8 443AC_FUNC_VFORK
97bf5e38 444AC_CHECK_FUNCS(canonicalize_file_name realpath)
d3ea6809 445AC_CHECK_FUNCS(getuid getgid)
97bf5e38 446AC_CHECK_FUNCS(poll)
14abd0fb 447AC_CHECK_FUNCS(pread64)
97bf5e38
MK
448AC_CHECK_FUNCS(sbrk)
449AC_CHECK_FUNCS(setpgid setpgrp)
e1ea1d75 450AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
97bf5e38 451AC_CHECK_FUNCS(socketpair)
b757528f 452AC_CHECK_FUNCS(syscall)
bcb3dc3d 453AC_CHECK_FUNCS(ttrace)
8b9cf735 454AC_CHECK_FUNCS(wborder)
97bf5e38 455
086ec9eb
MK
456# Check the return and argument types of ptrace. No canned test for
457# this, so roll our own.
458gdb_ptrace_headers='
459#if HAVE_SYS_TYPES_H
460# include <sys/types.h>
461#endif
462#if HAVE_SYS_PTRACE_H
463# include <sys/ptrace.h>
464#endif
465#if HAVE_UNISTD_H
466# include <unistd.h>
467#endif
468'
469# There is no point in checking if we don't have a prototype.
a3828db0 470AC_CHECK_DECLS(ptrace, [], [
086ec9eb
MK
471 : ${gdb_cv_func_ptrace_ret='int'}
472 : ${gdb_cv_func_ptrace_args='int,int,long,long'}
473], $gdb_ptrace_headers)
474# Check return type.
475AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
476 AC_TRY_COMPILE($gdb_ptrace_headers,
5885ab49
MK
477 [extern int ptrace ();],
478 gdb_cv_func_ptrace_ret='int',
479 gdb_cv_func_ptrace_ret='long'))
086ec9eb
MK
480AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
481 [Define as the return type of ptrace.])
482# Check argument types.
483AC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
484for gdb_arg1 in 'int' 'long'; do
485 for gdb_arg2 in 'pid_t' 'int' 'long'; do
486 for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long'; do
487 for gdb_arg4 in 'int' 'long'; do
488 AC_TRY_COMPILE($gdb_ptrace_headers, [
489extern $gdb_cv_func_ptrace_ret
490 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
491], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
492 break 4;])
493 for gdb_arg5 in 'int *' 'int' 'long'; do
494 AC_TRY_COMPILE($gdb_ptrace_headers, [
495extern $gdb_cv_func_ptrace_ret
496 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
497], [
498gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
499 break 5;])
500 done
501 done
502 done
503 done
504done
505# Provide a safe default value.
506: ${gdb_cv_func_ptrace_args='int,int,long,long'}
507])
508ac_save_IFS=$IFS; IFS=','
509set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
510IFS=$ac_save_IFS
511shift
64218d3e 512AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
086ec9eb
MK
513 [Define to the type of arg 3 for ptrace.])
514if test -n "$[5]"; then
64218d3e 515 AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
086ec9eb
MK
516 [Define to the type of arg 5 for ptrace.])
517fi
518
72473524
DJ
519dnl AC_FUNC_SETPGRP does not work when cross compiling
520dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
521if test "$cross_compiling" = no; then
522 AC_FUNC_SETPGRP
523else
524 AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
525 [AC_TRY_COMPILE([
526#include <unistd.h>
527], [
528 if (setpgrp(1,1) == -1)
529 exit (0);
530 else
531 exit (1);
532], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
533if test $ac_cv_func_setpgrp_void = yes; then
534 AC_DEFINE(SETPGRP_VOID, 1)
535fi
536fi
c906108c 537
2b2d558c
MK
538# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
539# since sigsetjmp might only be defined as a macro.
540AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp,
541[AC_TRY_COMPILE([
542#include <setjmp.h>
543], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
544gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
545if test $gdb_cv_func_sigsetjmp = yes; then
546 AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
547fi
548
06825bd1
MK
549# Assume we'll default to using the included libiberty regex.
550gdb_use_included_regex=yes
551
552# However, if the system regex is GNU regex, then default to *not*
553# using the included regex.
554AC_CACHE_CHECK(
555 [for GNU regex],
556 [gdb_cv_have_gnu_regex],
557 [AC_TRY_COMPILE(
558 [#include <gnu-versions.h>],
559 [#define REGEX_INTERFACE_VERSION 1
560#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
561# error "Version mismatch"
562#endif],
563 gdb_cv_have_gnu_regex=yes,
564 gdb_cv_have_gnu_regex=no)])
565if test $gdb_cv_have_gnu_regex = yes; then
566 gdb_use_included_regex=no
567fi
568
569AC_ARG_WITH(included-regex,
570 [ --without-included-regex don't use included regex; this is the default
571 on systems with version 2 of the GNU C library
572 (use with caution on other system)],
573 gdb_with_regex=$withval,
574 gdb_with_regex=$gdb_use_included_regex)
575if test "$gdb_with_regex" = yes; then
576 AC_DEFINE(USE_INCLUDED_REGEX, 1,
577 [Define to 1 if the regex included in libiberty should be used.])
578fi
579
5c45e068
MK
580# Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
581AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
582[#include <sys/param.h>
583#include <sys/proc.h>
584])
70f9f479 585
da7d81e3
NW
586# See if <sys/lwp.h> defines `struct lwp`.
587AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
588[AC_TRY_COMPILE([#include <sys/param.h>
589#include <sys/lwp.h>], [struct lwp l;],
590gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
591if test $gdb_cv_struct_lwp = yes; then
592 AC_DEFINE(HAVE_STRUCT_LWP, 1,
593 [Define to 1 if your system has struct lwp.])
594fi
595
78434e59
MK
596# See if <machine/reg.h> degines `struct reg'.
597AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
598[AC_TRY_COMPILE([#include <sys/types.h>
599#include <machine/reg.h>], [struct reg r;],
600gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
601if test $gdb_cv_struct_reg = yes; then
602 AC_DEFINE(HAVE_STRUCT_REG, 1,
603 [Define to 1 if your system has struct reg in <machine/reg.h>.])
604fi
605
0afdd437 606# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
7dfa765c 607# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
5c45e068
MK
608AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
609 [#include <machine/reg.h>])
7dfa765c 610
0afdd437 611# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
f60300e7
MK
612AC_MSG_CHECKING(for PTRACE_GETREGS)
613AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
614[AC_TRY_COMPILE([#include <sys/ptrace.h>],
615 [PTRACE_GETREGS;],
616 [gdb_cv_have_ptrace_getregs=yes],
617 [gdb_cv_have_ptrace_getregs=no])])
618AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
619if test $gdb_cv_have_ptrace_getregs = yes; then
60ca704f
SE
620 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
621 [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
f60300e7
MK
622fi
623
0afdd437 624# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
6ce2ac0b
MK
625AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
626AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
5c44784c 627[AC_TRY_COMPILE([#include <sys/ptrace.h>],
6ce2ac0b
MK
628 [PTRACE_GETFPXREGS;],
629 [gdb_cv_have_ptrace_getfpxregs=yes],
630 [gdb_cv_have_ptrace_getfpxregs=no])])
631AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
632if test $gdb_cv_have_ptrace_getfpxregs = yes; then
60ca704f
SE
633 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
634 [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
5c44784c
JM
635fi
636
0afdd437
MK
637# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
638AC_MSG_CHECKING(for PT_GETDBREGS)
639AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
640[AC_TRY_COMPILE([#include <sys/types.h>
641#include <sys/ptrace.h>],
642 [PT_GETDBREGS;],
643 [gdb_cv_have_pt_getdbregs=yes],
644 [gdb_cv_have_pt_getdbregs=no])])
645AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
646if test $gdb_cv_have_pt_getdbregs = yes; then
60ca704f
SE
647 AC_DEFINE(HAVE_PT_GETDBREGS, 1,
648 [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
0afdd437
MK
649fi
650
7e89e357
JT
651# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
652AC_MSG_CHECKING(for PT_GETXMMREGS)
653AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
654[AC_TRY_COMPILE([#include <sys/types.h>
655#include <sys/ptrace.h>],
656 [PT_GETXMMREGS;],
657 [gdb_cv_have_pt_getxmmregs=yes],
658 [gdb_cv_have_pt_getxmmregs=no])])
659AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
660if test $gdb_cv_have_pt_getxmmregs = yes; then
60ca704f
SE
661 AC_DEFINE(HAVE_PT_GETXMMREGS, 1,
662 [Define if sys/ptrace.h defines the PT_GETXMMREGS request.])
7e89e357
JT
663fi
664
c906108c
SS
665# If we are configured native on GNU/Linux, work around problems with
666# sys/procfs.h
c3f6f71d 667# Also detect which type of /proc is in use, such as for Unixware or Solaris.
c906108c
SS
668
669if test "${target}" = "${host}"; then
670 case "${host}" in
671 i[[3456]]86-*-linux*)
60ca704f
SE
672 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED, 2,
673 [Define on a GNU/Linux system to work around problems in sys/procfs.h.])
674 AC_DEFINE(sys_quotactl, 1,
675 [Define on a GNU/Linux system to work around problems in sys/procfs.h.])
c906108c 676 ;;
1045b512 677 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
60ca704f
SE
678 AC_DEFINE(NEW_PROC_API, 1,
679 [Define if you want to use new multi-fd /proc interface
680 (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
c3f6f71d 681 ;;
0bbc026e 682 *-*-solaris2.[[6789]] | *-*-solaris2.1[[0-9]])
60ca704f
SE
683 AC_DEFINE(NEW_PROC_API, 1,
684 [Define if you want to use new multi-fd /proc interface
685 (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
c3f6f71d 686 ;;
c960c18f
AC
687 mips-sgi-irix5*)
688 # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5.
60ca704f
SE
689 AC_DEFINE([_KMEMUSER], 1,
690 [Define to 1 so <sys/proc.h> gets a definition of anon_hdl. Works
691 around a <sys/proc.h> problem on IRIX 5.])
c960c18f 692 ;;
c906108c 693 esac
c906108c
SS
694fi
695
696if test "$ac_cv_header_sys_procfs_h" = yes; then
697 BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
698 BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
699 BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
700 BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
83d37ec8
MK
701 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
702 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
23e04971
MS
703 BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
704 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
83d37ec8
MK
705 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
706 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
596c9d4b
KB
707 BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
708 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t)
709 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t)
710 BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t)
c906108c 711
23e04971 712
d84dd0c5
MK
713 dnl Check for broken prfpregset_t type
714
715 dnl For Linux/i386, glibc 2.1.3 was released with a bogus
716 dnl prfpregset_t type (it's a typedef for the pointer to a struct
717 dnl instead of the struct itself). We detect this here, and work
a3007b6f 718 dnl around it in gdb_proc_service.h.
d84dd0c5
MK
719
720 if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
721 AC_MSG_CHECKING(whether prfpregset_t type is broken)
722 AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
723 [AC_TRY_RUN([#include <sys/procfs.h>
724 int main ()
725 {
726 if (sizeof (prfpregset_t) == sizeof (void *))
727 return 1;
728 return 0;
729 }],
730 gdb_cv_prfpregset_t_broken=no,
731 gdb_cv_prfpregset_t_broken=yes,
732 gdb_cv_prfpregset_t_broken=yes)])
733 AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
734 if test $gdb_cv_prfpregset_t_broken = yes; then
60ca704f
SE
735 AC_DEFINE(PRFPREGSET_T_BROKEN, 1,
736 [Define if the prfpregset_t type is broken.])
d84dd0c5
MK
737 fi
738 fi
739
c906108c
SS
740 dnl Check for PIOCSET ioctl entry
741
742 AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
743 AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
744 [AC_TRY_COMPILE([#include <unistd.h>
745#include <sys/types.h>
746#include <sys/procfs.h>
747], [
748 int dummy;;
749 dummy = ioctl(0, PIOCSET, &dummy);
750 ],
751 gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
752 AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
753 if test $gdb_cv_have_procfs_piocset = yes; then
60ca704f
SE
754 AC_DEFINE(HAVE_PROCFS_PIOCSET, 1,
755 [Define if ioctl argument PIOCSET is available.])
c906108c
SS
756 fi
757fi
758
d45fe813
KB
759dnl For native ports (host == target), check to see what kind of
760dnl legacy link.h support is needed. (See solib-legacy.c.)
761if test ${host} = ${target} ; then
762 dnl Check for struct link_map with l_ members which are indicative
763 dnl of SVR4-like shared libraries
764
765 AC_MSG_CHECKING(for member l_addr in struct link_map)
766 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
767 [AC_TRY_COMPILE([#include <link.h>],
768 [struct link_map lm; (void) lm.l_addr;],
769 gdb_cv_have_struct_link_map_with_l_members=yes,
770 gdb_cv_have_struct_link_map_with_l_members=no)])
771 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
772 if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
60ca704f
SE
773 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS,1,
774 [Define if <link.h> exists and defines struct link_map which has
775 members with an ``l_'' prefix. (For Solaris, SVR4, and
776 SVR4-like systems.)])
d45fe813
KB
777 fi
778
779 dnl Check for struct link_map with lm_ members which are indicative
780 dnl of SunOS-like shared libraries
781
782 AC_MSG_CHECKING(for member lm_addr in struct link_map)
783 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
784 [AC_TRY_COMPILE([#include <sys/types.h>
785#include <link.h>],
786 [struct link_map lm; (void) lm.lm_addr;],
787 gdb_cv_have_struct_link_map_with_lm_members=yes,
788 gdb_cv_have_struct_link_map_with_lm_members=no)])
789 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
790 if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
60ca704f
SE
791 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS, 1,
792 [Define if <link.h> exists and defines struct link_map which has
793 members with an ``lm_'' prefix. (For SunOS.)])
d45fe813
KB
794 fi
795
796 dnl Check for struct so_map with som_ members which are found on
797 dnl some *BSD systems.
798
799 AC_MSG_CHECKING(for member som_addr in struct so_map)
800 AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
801 [AC_TRY_COMPILE([#include <sys/types.h>
39812ceb
C
802#ifdef HAVE_NLIST_H
803#include <nlist.h>
804#endif
d45fe813
KB
805#include <link.h>],
806 [struct so_map lm; (void) lm.som_addr;],
807 gdb_cv_have_struct_so_map_with_som_members=yes,
808 gdb_cv_have_struct_so_map_with_som_members=no)])
809 AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
810 if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
60ca704f
SE
811 AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS, 1,
812 [Define if <link.h> exists and defines a struct so_map which has
813 members with an ``som_'' prefix. (Found on older *BSD systems.)])
d45fe813
KB
814 fi
815
816 dnl Check for struct link_map32 type, which allows a 64-bit Solaris
817 dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
818
819 AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
820 AC_CACHE_VAL(gdb_cv_have_struct_link_map32,
821 [AC_TRY_COMPILE([#define _SYSCALL32
822#include <sys/link.h>], [struct link_map32 l;],
823 gdb_cv_have_struct_link_map32=yes,
824 gdb_cv_have_struct_link_map32=no)])
825 AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
826 if test $gdb_cv_have_struct_link_map32 = yes; then
60ca704f
SE
827 AC_DEFINE(HAVE_STRUCT_LINK_MAP32, 1,
828 [Define if <sys/link.h> has struct link_map32])
829 AC_DEFINE(_SYSCALL32, 1,
830 [Define if <sys/link.h> has link_map32 (solaris sparc-64 target)])
d45fe813
KB
831 fi
832fi
833
bc8bcb4b
MK
834# Check if the compiler supports the `long long' type.
835
836AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
837 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
838[[extern long long foo;]],
839[[switch (foo & 2) { case 0: return 1; }]])],
840 gdb_cv_c_long_long=yes,
841 gdb_cv_c_long_long=no)])
c906108c 842if test $gdb_cv_c_long_long = yes; then
bc8bcb4b
MK
843 AC_DEFINE(CC_HAS_LONG_LONG, 1,
844 [Define to 1 if the compiler supports long long.])
c906108c
SS
845fi
846
bc8bcb4b 847# Check if the compiler and runtime support printing long longs.
c906108c 848
bc8bcb4b
MK
849AC_CACHE_CHECK([for long long support in printf],
850 gdb_cv_printf_has_long_long,
851 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
852[[char buf[32];
c906108c
SS
853 long long l = 0;
854 l = (l << 16) + 0x0123;
855 l = (l << 16) + 0x4567;
856 l = (l << 16) + 0x89ab;
857 l = (l << 16) + 0xcdef;
858 sprintf (buf, "0x%016llx", l);
bc8bcb4b
MK
859 return (strcmp ("0x0123456789abcdef", buf));]])],
860 gdb_cv_printf_has_long_long=yes,
861 gdb_cv_printf_has_long_long=no,
862 gdb_cv_printf_has_long_long=no)])
c906108c 863if test $gdb_cv_printf_has_long_long = yes; then
bc8bcb4b
MK
864 AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
865 [Define to 1 if the "%ll" format works to print long longs.])
c906108c 866fi
c906108c 867
bc8bcb4b
MK
868# Check if the compiler supports the `long double' type. We can't use
869# AC_C_LONG_DOUBLE because that one does additional checks on the
870# constants defined in <float.h> that fail on some systems,
871# e.g. FreeBSD/i386 4.7 and OpenBSD/i386 3.6.
c906108c 872
bc8bcb4b
MK
873AC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double,
874 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])],
875 gdb_cv_c_long_double=yes,
876 gdb_cv_c_long_double=no)])
877if test $gdb_cv_c_long_double = yes; then
878 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
879 [Define to 1 if the compiler supports long double.])
c906108c
SS
880fi
881
bc8bcb4b 882# Check if the compiler and runtime support printing long doubles.
c906108c 883
bc8bcb4b
MK
884AC_CACHE_CHECK([for long double support in printf],
885 gdb_cv_printf_has_long_double,
886 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
887[[char buf[16];
c906108c
SS
888 long double f = 3.141592653;
889 sprintf (buf, "%Lg", f);
bc8bcb4b
MK
890 return (strncmp ("3.14159", buf, 7));]])],
891 gdb_cv_printf_has_long_double=yes,
892 gdb_cv_printf_has_long_double=no,
893 gdb_cv_printf_has_long_double=no)])
c906108c 894if test $gdb_cv_printf_has_long_double = yes; then
bc8bcb4b
MK
895 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
896 [Define to 1 if the "%Lg" format works to print long doubles.])
c906108c 897fi
c906108c 898
bc8bcb4b 899# Check if the compiler and runtime support scanning long doubles.
c906108c 900
bc8bcb4b
MK
901AC_CACHE_CHECK([for long double support in scanf],
902 gdb_cv_scanf_has_long_double,
903 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
904[[#include <stdio.h>]],
905[[char *buf = "3.141592653";
c906108c
SS
906 long double f = 0;
907 sscanf (buf, "%Lg", &f);
bc8bcb4b
MK
908 return !(f > 3.14159 && f < 3.14160);]])],
909 gdb_cv_scanf_has_long_double=yes,
910 gdb_cv_scanf_has_long_double=no,
911 gdb_cv_scanf_has_long_double=no)])
c906108c 912if test $gdb_cv_scanf_has_long_double = yes; then
bc8bcb4b
MK
913 AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
914 [Define to 1 if the "%Lg" format works to scan long doubles.])
c906108c 915fi
c906108c 916
438013df
AO
917case ${host_os} in
918aix*)
919 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
920 SAVE_LDFLAGS=$LDFLAGS
921
922 case $GCC in
923 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
924 *) gdb_cv_bigtoc=-bbigtoc ;;
925 esac
926
927 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
928 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
ec76baa5 929 LDFLAGS="${SAVE_LDFLAGS}"
438013df
AO
930 ])
931 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
932 ;;
933esac
934
c906108c 935
d92419e5
JB
936dnl For certain native configurations, we need to check whether thread
937dnl support can be built in or not.
938dnl
939dnl Note that we only want this if we are both native (host == target),
940dnl and not doing a canadian cross build (build == host).
c906108c
SS
941
942if test ${build} = ${host} -a ${host} = ${target} ; then
943 case ${host_os} in
944 hpux*)
945 AC_MSG_CHECKING(for HPUX/OSF thread support)
946 if test -f /usr/include/dce/cma_config.h ; then
947 if test "$GCC" = "yes" ; then
948 AC_MSG_RESULT(yes)
60ca704f
SE
949 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT, 1,
950 [Define if you have HPUX threads])
3483b318 951 CONFIG_OBS="${CONFIG_OBS} hpux-thread.o"
c906108c
SS
952 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
953 else
954 AC_MSG_RESULT(no (suppressed because you are not using GCC))
955 fi
956 else
957 AC_MSG_RESULT(no)
958 fi
959 ;;
960 solaris*)
d92419e5
JB
961 # See if thread_db library is around for Solaris thread debugging.
962 # Note that we must explicitly test for version 1 of the library
963 # because version 0 (present on Solaris 2.4 or earlier) doesn't have
964 # the same API.
c906108c
SS
965 AC_MSG_CHECKING(for Solaris thread debugging library)
966 if test -f /usr/lib/libthread_db.so.1 ; then
967 AC_MSG_RESULT(yes)
60ca704f
SE
968 AC_DEFINE(HAVE_THREAD_DB_LIB, 1,
969 [Define if using Solaris thread debugging.])
3483b318 970 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
c906108c
SS
971 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
972 AC_CHECK_LIB(dl, dlopen)
973 if test "$GCC" = "yes" ; then
974 # The GNU linker requires the -export-dynamic option to make
975 # all symbols visible in the dynamic symbol table.
976 hold_ldflags=$LDFLAGS
977 AC_MSG_CHECKING(for the ld -export-dynamic flag)
978 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
979 AC_TRY_LINK(, [int i;], found=yes, found=no)
980 LDFLAGS=$hold_ldflags
981 AC_MSG_RESULT($found)
982 if test $found = yes; then
983 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
984 fi
985 fi
986 # Sun randomly tweaked the prototypes in <proc_service.h>
987 # at one point.
988 AC_MSG_CHECKING(if <proc_service.h> is old)
989 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
990 AC_TRY_COMPILE([
991 #include <proc_service.h>
992 ps_err_e ps_pdwrite
993 (struct ps_prochandle*, psaddr_t, const void*, size_t);
994 ],, gdb_cv_proc_service_is_old=no,
995 gdb_cv_proc_service_is_old=yes)
996 ])
997 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
998 if test $gdb_cv_proc_service_is_old = yes; then
60ca704f
SE
999 AC_DEFINE(PROC_SERVICE_IS_OLD, 1,
1000 [Define if <proc_service.h> on solaris uses int instead of
1001 size_t, and assorted other type changes.])
c906108c
SS
1002 fi
1003 else
1004 AC_MSG_RESULT(no)
1005 fi
1006 ;;
d92419e5
JB
1007 aix*)
1008 AC_MSG_CHECKING(for AiX thread debugging library)
1009 AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
1010 [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
1011 [#ifndef PTHDB_VERSION_3
1012 #error
1013 #endif],
1014 gdb_cv_have_aix_thread_debug=yes,
1015 gdb_cv_have_aix_thread_debug=no)])
1016 AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
1017 if test $gdb_cv_have_aix_thread_debug = yes; then
1018 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
3483b318 1019 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
d92419e5
JB
1020 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
1021 fi
1022 ;;
c906108c
SS
1023 esac
1024 AC_SUBST(CONFIG_LDFLAGS)
1025fi
1026
3f47be5c
EZ
1027dnl See if we have a thread_db header file that has TD_NOTALLOC.
1028if test "x$ac_cv_header_thread_db_h" = "xyes"; then
1029 AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
1030 gdb_cv_thread_db_h_has_td_notalloc,
1031 AC_TRY_COMPILE(
1032 [#include <thread_db.h>],
1033 [int i = TD_NOTALLOC;],
1034 gdb_cv_thread_db_h_has_td_notalloc=yes,
1035 gdb_cv_thread_db_h_has_td_notalloc=no
1036 )
1037 )
1038fi
1039if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
1040 AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
1041 [Define if <thread_db.h> has the TD_NOTALLOC error code.])
1042fi
1043
b757528f
JJ
1044dnl See if we have a sys/syscall header file that has __NR_tkill.
1045if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then
1046 AC_CACHE_CHECK([whether <sys/syscall.h> has __NR_tkill],
1047 gdb_cv_sys_syscall_h_has_tkill,
1048 AC_TRY_COMPILE(
1049 [#include <sys/syscall.h>],
1050 [int i = __NR_tkill;],
1051 gdb_cv_sys_syscall_h_has_tkill=yes,
1052 gdb_cv_sys_syscall_h_has_tkill=no
1053 )
1054 )
1055fi
1056dnl See if we can issue tkill syscall.
1057if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then
60ca704f 1058 AC_DEFINE(HAVE_TKILL_SYSCALL, 1, [Define if you support the tkill syscall.])
b757528f
JJ
1059fi
1060
c906108c 1061dnl Handle optional features that can be enabled.
fb40c209 1062
030292b7
DJ
1063AC_ARG_WITH(sysroot,
1064[ --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
1065[
1066 case ${with_sysroot} in
715d1656 1067 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
030292b7
DJ
1068 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
1069 esac
1070
1071 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
1072
1073 if test "x$exec_prefix" = xNONE; then
1074 if test "x$prefix" = xNONE; then
1075 test_prefix=/usr/local
1076 else
1077 test_prefix=$prefix
1078 fi
1079 else
1080 test_prefix=$exec_prefix
1081 fi
1082 case ${TARGET_SYSTEM_ROOT} in
715d1656
AO
1083 "${test_prefix}"|"${test_prefix}/"*|\
1084 '${exec_prefix}'|'${exec_prefix}/'*)
030292b7
DJ
1085 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
1086 TARGET_SYSTEM_ROOT_DEFINE="$t"
1087 ;;
1088 esac
1089], [
1090 TARGET_SYSTEM_ROOT=
1091 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
1092])
1093AC_SUBST(TARGET_SYSTEM_ROOT)
1094AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
1095
094a342e
MK
1096AC_ARG_ENABLE(werror,
1097 [ --enable-werror treat compile warnings as errors],
1098 [case "${enableval}" in
1099 yes | y) ERROR_ON_WARNING="yes" ;;
1100 no | n) ERROR_ON_WARNING="no" ;;
1101 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
1102 esac])
1103
1104# Enable -Werror by default when using gcc
1105if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
1106 ERROR_ON_WARNING=yes
1107fi
1108
1109WERROR_CFLAGS=""
1110if test "${ERROR_ON_WARNING}" = yes ; then
1111 WERROR_CFLAGS="-Werror"
1112fi
1113
3b851bce
AC
1114# NOTE: Don't add -Wall or -Wunused, they both include
1115# -Wunused-parameter which reports bogus warnings.
1116# NOTE: If you add to this list, remember to update
1117# gdb/doc/gdbint.texinfo.
1decb323 1118build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
a3b362c4 1119-Wformat -Wparentheses -Wpointer-arith -Wformat-nonliteral \
7be93b9e 1120-Wunused-label -Wunused-function -Wno-pointer-sign"
a3b362c4
JB
1121
1122# GCC supports -Wuninitialized only with -O or -On, n != 0.
ca231fcc 1123if test x${CFLAGS+set} = xset; then
a3b362c4
JB
1124 case "${CFLAGS}" in
1125 *"-O0"* ) ;;
1126 *"-O"* )
1127 build_warnings="${build_warnings} -Wuninitialized"
1128 ;;
1129 esac
1130else
1131 build_warnings="${build_warnings} -Wuninitialized"
1132fi
1133
d8038014 1134# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
0f0cffd2 1135# -Wunused-function -Wunused-variable -Wunused-value
93d56215 1136# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
d8038014
AC
1137# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
1138# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
1139# -Woverloaded-virtual -Winline -Werror"
c906108c
SS
1140AC_ARG_ENABLE(build-warnings,
1141[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
1decb323 1142[case "${enableval}" in
c906108c
SS
1143 yes) ;;
1144 no) build_warnings="-w";;
1145 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1146 build_warnings="${build_warnings} ${t}";;
1147 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1148 build_warnings="${t} ${build_warnings}";;
1149 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
d4f3574e
SS
1150esac
1151if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
746a987d 1152 echo "Setting compiler warning flags = $build_warnings" 6>&1
1decb323 1153fi])dnl
3b851bce
AC
1154AC_ARG_ENABLE(gdb-build-warnings,
1155[ --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used],
1156[case "${enableval}" in
1157 yes) ;;
1158 no) build_warnings="-w";;
1159 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1160 build_warnings="${build_warnings} ${t}";;
1161 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1162 build_warnings="${t} ${build_warnings}";;
1163 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1164esac
1165if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
1166 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
1167fi])dnl
104c1213 1168WARN_CFLAGS=""
c906108c
SS
1169if test "x${build_warnings}" != x -a "x$GCC" = xyes
1170then
746a987d
AC
1171 AC_MSG_CHECKING(compiler warning flags)
1172 # Separate out the -Werror flag as some files just cannot be
1173 # compiled with it enabled.
1174 for w in ${build_warnings}; do
1175 case $w in
1176 -Werr*) WERROR_CFLAGS=-Werror ;;
1177 *) # Check that GCC accepts it
4536bbc6
AC
1178 saved_CFLAGS="$CFLAGS"
1179 CFLAGS="$CFLAGS $w"
1180 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
1181 CFLAGS="$saved_CFLAGS"
746a987d
AC
1182 esac
1183 done
1184 AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
1decb323 1185fi
c906108c 1186AC_SUBST(WARN_CFLAGS)
104c1213 1187AC_SUBST(WERROR_CFLAGS)
c906108c 1188
7a292a7a
SS
1189# In the Cygwin environment, we need some additional flags.
1190AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
1191[AC_EGREP_CPP(lose, [
1192#if defined (__CYGWIN__) || defined (__CYGWIN32__)
1193lose
1194#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
1195
aff38e61
AC
1196
1197dnl Figure out which of the many generic ser-*.c files the _host_ supports.
3eb25fda 1198SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
aff38e61 1199case ${host} in
95cbc983
AC
1200 *go32* ) SER_HARDWIRE=ser-go32.o ;;
1201 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
0ea3f30e 1202 *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
aff38e61
AC
1203esac
1204AC_SUBST(SER_HARDWIRE)
1205
cd0fc7c3
SS
1206# libreadline needs libuser32.a in a cygwin environment
1207WIN32LIBS=
1208if test x$gdb_cv_os_cygwin = xyes; then
c5394b80
JM
1209 WIN32LIBS="-luser32"
1210 case "${target}" in
1211 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
1212 ;;
1213 esac
cd0fc7c3 1214fi
b4505029
MM
1215
1216# The ser-tcp.c module requires sockets.
1217case ${host} in
1218 *mingw32*)
1219 AC_DEFINE(USE_WIN32API, 1,
1220 [Define if we should use the Windows API, instead of the
1221 POSIX API. On Windows, we use the Windows API when
1222 building for MinGW, but the POSIX API when building
1223 for Cygwin.])
1224 WIN32LIBS="$WIN32LIBS -lws2_32"
1225 ;;
1226esac
cd0fc7c3 1227AC_SUBST(WIN32LIBS)
7a292a7a 1228
121ce6e5
DJ
1229# Add any host-specific objects to GDB.
1230CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
1231
3fc11d3e
JM
1232LIBGUI="../libgui/src/libgui.a"
1233GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
1234AC_SUBST(LIBGUI)
1235AC_SUBST(GUI_CFLAGS_X)
7a292a7a 1236
3fc11d3e
JM
1237WIN32LDAPP=
1238AC_SUBST(WIN32LIBS)
1239AC_SUBST(WIN32LDAPP)
1240
d91670b9
CV
1241case "${host}" in
1242*-*-cygwin*)
1243 configdir="win"
1244 ;;
1245*)
1246 configdir="unix"
1247 ;;
1248esac
3fc11d3e
JM
1249
1250GDBTKLIBS=
1251if test "${enable_gdbtk}" = "yes"; then
1252
d1c3b63a
KS
1253 # Gdbtk must have an absolute path to srcdir in order to run
1254 # properly when not installed.
1255 here=`pwd`
1256 cd ${srcdir}
1257 GDBTK_SRC_DIR=`pwd`
1258 cd $here
1259
3fc11d3e
JM
1260 CY_AC_PATH_TCLCONFIG
1261 if test -z "${no_tcl}"; then
1262 CY_AC_LOAD_TCLCONFIG
1263 CY_AC_PATH_TKCONFIG
1264
dd2504ab
JM
1265 # now look for Tcl library stuff
1266
d91670b9 1267 tcldir="../tcl/${configdir}/"
dd2504ab
JM
1268
1269 TCL_DEPS="${tcldir}${TCL_LIB_FILE}"
1270
3fc11d3e
JM
1271 # If $no_tk is nonempty, then we can't do Tk, and there is no
1272 # point to doing Tcl.
1273 if test -z "${no_tk}"; then
1274 CY_AC_LOAD_TKCONFIG
1275 CY_AC_PATH_TCLH
1276 CY_AC_PATH_TKH
1277 CY_AC_PATH_ITCLH
1278 CY_AC_PATH_ITKH
3fc11d3e 1279
dd2504ab
JM
1280
1281 # now look for Tk library stuff
1282
d91670b9 1283 tkdir="../tk/${configdir}/"
dd2504ab
JM
1284
1285 TK_DEPS="${tkdir}${TK_LIB_FILE}"
1286
3fc11d3e
JM
1287 # now look for Itcl library stuff
1288
1289 CY_AC_PATH_ITCLCONFIG
1290 if test -z "${no_itcl}"; then
b381d62d 1291 CY_AC_LOAD_ITCLCONFIG
3fc11d3e
JM
1292
1293 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
b381d62d 1294 ITCL_DEPS="${ITCL_LIB_FULL_PATH}"
3fc11d3e
JM
1295 fi
1296
1297
1298 # now look for Itk library stuff
1299 CY_AC_PATH_ITKCONFIG
1300 if test -z "${no_itcl}"; then
1301 CY_AC_LOAD_ITKCONFIG
1302
3fc11d3e 1303 ITKLIB="${ITK_BUILD_LIB_SPEC}"
b381d62d 1304 ITK_DEPS="${ITK_LIB_FULL_PATH}"
3fc11d3e
JM
1305 fi
1306
4226a5a5 1307 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
3fc11d3e
JM
1308
1309 # Include some libraries that Tcl and Tk want.
b2a1bd4f 1310 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
3fc11d3e
JM
1311 # Yes, the ordering seems wrong here. But it isn't.
1312 # TK_LIBS is the list of libraries that need to be linked
1313 # after Tcl/Tk. Note that this isn't put into LIBS. If it
1314 # were in LIBS then any link tests after this point would
1315 # try to include things like `$(LIBGUI)', which wouldn't work.
1316 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
4226a5a5
FN
1317
1318 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
1319 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
1320 CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
33f8ca73
AC
1321 CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
1322 CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
1323 CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
1324 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
3fc11d3e
JM
1325
1326 if test x$gdb_cv_os_cygwin = xyes; then
1327 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
1328 WIN32LDAPP="-Wl,--subsystem,console"
1329 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
1330 fi
1331 fi
1332 fi
ffc6a242 1333
3ace7edb 1334 AC_CONFIG_SUBDIRS(gdbtk)
3fc11d3e
JM
1335fi
1336
3fc11d3e
JM
1337AC_SUBST(X_CFLAGS)
1338AC_SUBST(X_LDFLAGS)
1339AC_SUBST(X_LIBS)
dd2504ab
JM
1340AC_SUBST(TCL_DEPS)
1341AC_SUBST(TK_DEPS)
3fc11d3e
JM
1342AC_SUBST(ITCLLIB)
1343AC_SUBST(ITCL_DEPS)
1344AC_SUBST(ITKLIB)
1345AC_SUBST(ITK_DEPS)
3fc11d3e
JM
1346AC_SUBST(GDBTKLIBS)
1347AC_SUBST(GDBTK_CFLAGS)
d1c3b63a 1348AC_SUBST(GDBTK_SRC_DIR)
8b93c638 1349
c906108c
SS
1350AC_PATH_X
1351
9cc52bde
MK
1352# Check whether we should enable the TUI, but only do so if we really
1353# can.
1354if test x"$enable_tui" = xyes; then
1355 if test -d $srcdir/tui; then
1356 if test "$ac_cv_search_waddstr" != no; then
1357 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
1358 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
1359 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
1360 CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
1361 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
1362 CONFIG_ALL="${CONFIG_ALL} all-tui"
1363 CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
1364 CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
1365 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
1366 else
1367 AC_MSG_WARN([no enhanced curses library found; disabling TUI])
1368 fi
1369 fi
1370fi
1371
7a292a7a
SS
1372# Unlike the sim directory, whether a simulator is linked is controlled by
1373# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
1374# This code just checks for a few cases where we'd like to ignore those
1375# definitions, even when they're present in the '.mt' file. These cases
1376# are when --disable-sim is specified, or if the simulator directory is
6c5cfe5b 1377# not part of the source tree.
7a292a7a
SS
1378#
1379AC_ARG_ENABLE(sim,
1380[ --enable-sim Link gdb with simulator],
1381[echo "enable_sim = $enable_sim";
1382 echo "enableval = ${enableval}";
1383 case "${enableval}" in
1384 yes) ignore_sim=false ;;
1385 no) ignore_sim=true ;;
1386 *) ignore_sim=false ;;
1387 esac],
1388[ignore_sim=false])
1389
1390if test ! -d "${srcdir}/../sim"; then
1391 ignore_sim=true
1392fi
1393
1394if test "${ignore_sim}" = "true"; then
1395 IGNORE_SIM="SIM="
1396 IGNORE_SIM_OBS="SIM_OBS="
1397else
1398 IGNORE_SIM=""
1399 IGNORE_SIM_OBS=""
60ca704f 1400 AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.])
7a292a7a
SS
1401fi
1402AC_SUBST(IGNORE_SIM)
1403AC_SUBST(IGNORE_SIM_OBS)
1404
c906108c 1405AC_SUBST(ENABLE_CFLAGS)
d28f9cdf 1406AC_SUBST(PROFILE_CFLAGS)
c906108c
SS
1407
1408AC_SUBST(CONFIG_OBS)
1409AC_SUBST(CONFIG_DEPS)
1410AC_SUBST(CONFIG_SRCS)
b3a90332
AC
1411AC_SUBST(CONFIG_ALL)
1412AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
1413AC_SUBST(CONFIG_INSTALL)
1414AC_SUBST(CONFIG_UNINSTALL)
c906108c 1415
c35f4ffc
AC
1416# List of host floatformats.
1417AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
1418AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
1419AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
1420
c906108c
SS
1421# target_subdir is used by the testsuite to find the target libraries.
1422target_subdir=
1423if test "${host}" != "${target}"; then
1424 target_subdir="${target_alias}/"
1425fi
1426AC_SUBST(target_subdir)
1427
1428frags=
771b4502 1429if test "${gdb_native}" = "yes"; then
0dad8a66
MK
1430 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
1431 if test ! -f ${host_makefile_frag}; then
1432 AC_MSG_ERROR("*** Gdb does not support native target ${host}")
1433 fi
1434 frags="$frags $host_makefile_frag"
1435else
1436 host_makefile_frag=/dev/null
c906108c 1437fi
c906108c
SS
1438
1439target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
1440if test ! -f ${target_makefile_frag}; then
0dad8a66 1441 AC_MSG_ERROR("*** Gdb does not support target ${target}")
c906108c
SS
1442fi
1443frags="$frags $target_makefile_frag"
1444
1445AC_SUBST_FILE(host_makefile_frag)
1446AC_SUBST_FILE(target_makefile_frag)
1447AC_SUBST(frags)
1448
1449changequote(,)dnl
1450hostfile=`sed -n '
1451s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1452' ${host_makefile_frag}`
1453
1454targetfile=`sed -n '
2c0fc042 1455s/DEPRECATED_TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
c906108c
SS
1456' ${target_makefile_frag}`
1457
771b4502 1458if test "${gdb_native}" = "yes"; then
a85f51e7
DJ
1459# We pick this up from the host configuration file (.mh) because we
1460# do not have a native configuration Makefile fragment.
c906108c
SS
1461nativefile=`sed -n '
1462s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1463' ${host_makefile_frag}`
c906108c
SS
1464fi
1465changequote([,])
1466
b00a8037
DJ
1467if test x"${gdb_osabi}" != x ; then
1468 AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
1469 [Define to the default OS ABI for this configuration.])
1470fi
1471
8dcde887
MK
1472# Enable multi-ice-gdb-server.
1473AC_ARG_ENABLE(multi-ice,
1474[ --enable-multi-ice build the multi-ice-gdb-server],
1475 [case $enableval in
1476 yes | no)
1477 ;;
1478 *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
1479 esac])
1480if test "x$enable_multi_ice" = xyes; then
3ace7edb 1481 AC_CONFIG_SUBDIRS(multi-ice)
96baa820
JM
1482fi
1483
a13e2c95
UW
1484# We only build gdbserver automatically in a native configuration.
1485if test "$gdb_native" = "yes"; then
8dcde887
MK
1486 AC_MSG_CHECKING(whether gdbserver is supported on this host)
1487 if test "x$build_gdbserver" = xyes; then
8dcde887 1488 AC_MSG_RESULT(yes)
3ace7edb 1489 AC_CONFIG_SUBDIRS(gdbserver)
8dcde887
MK
1490 else
1491 AC_MSG_RESULT(no)
1492 fi
a85f51e7
DJ
1493fi
1494
2c0fc042
AC
1495# If hostfile (XM_FILE) and/or targetfile (DEPRECATED_TM_FILE) and/or
1496# nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link
1497# to an empty version.
c906108c
SS
1498
1499files=
1500links=
5a2402b8 1501
c906108c 1502rm -f xm.h
5a2402b8 1503xm_h=""
c906108c 1504if test "${hostfile}" != ""; then
5a2402b8 1505 xm_h=xm.h
0f475e27
AC
1506 case "${hostfile}" in
1507 xm-*.h ) GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}" ;;
1508 * ) GDB_XM_FILE="${hostfile}"
1509 esac
5a2402b8
AC
1510 files="${files} ${GDB_XM_FILE}"
1511 links="${links} xm.h"
60ca704f 1512 AC_DEFINE_UNQUOTED(GDB_XM_FILE, "${GDB_XM_FILE}", [hostfile])
c906108c 1513fi
5a2402b8
AC
1514AC_SUBST(xm_h)
1515
c906108c 1516rm -f tm.h
5a2402b8 1517tm_h=""
c906108c 1518if test "${targetfile}" != ""; then
5a2402b8 1519 tm_h=tm.h
0f475e27 1520 case "${targetfile}" in
b8c4aece 1521 tm-*.h ) GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}" ;;
0f475e27
AC
1522 * ) GDB_TM_FILE="${targetfile}"
1523 esac
5a2402b8
AC
1524 files="${files} ${GDB_TM_FILE}"
1525 links="${links} tm.h"
60ca704f 1526 AC_DEFINE_UNQUOTED(GDB_TM_FILE, "${GDB_TM_FILE}", [targetfile])
c906108c 1527fi
5a2402b8
AC
1528AC_SUBST(tm_h)
1529
c906108c 1530rm -f nm.h
5a2402b8 1531nm_h=""
c906108c 1532if test "${nativefile}" != ""; then
5a2402b8 1533 nm_h=nm.h
0f475e27
AC
1534 case "${nativefile}" in
1535 nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
1536 * ) GDB_NM_FILE="${nativefile}"
1537 esac
5a2402b8
AC
1538 files="${files} ${GDB_NM_FILE}"
1539 links="${links} nm.h"
60ca704f 1540 AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
c906108c 1541fi
5a2402b8
AC
1542AC_SUBST(nm_h)
1543
c906108c
SS
1544AC_LINK_FILES($files, $links)
1545
1546dnl Check for exe extension set on certain hosts (e.g. Win32)
1547AC_EXEEXT
1548
234b45d4
KB
1549dnl Detect the character set used by this host.
1550
1551dnl At the moment, we just assume it's ISO-8859-1 (which is a
1552dnl superset of ASCII containing the characters needed for French,
1553dnl German, Spanish, Italian, and possibly others), but if were
1554dnl *were* to support any host character sets other than ISO-8859-1,
1555dnl here's where we'd detect it.
1556AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
1557 [Define to be a string naming the default host character set.])
1558
1559AM_ICONV
1560
ed952ac5 1561AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
c906108c
SS
1562[
1563dnl Autoconf doesn't provide a mechanism for modifying definitions
1564dnl provided by makefile fragments.
1565dnl
c906108c
SS
1566
1567changequote(,)dnl
2c0fc042 1568sed -e '/^DEPRECATED_TM_FILE[ ]*=/s,^DEPRECATED_TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
c906108c
SS
1569/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
1570/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
1571mv -f Makefile.tmp Makefile
1572changequote([,])dnl
1573
2acceee2 1574
c906108c
SS
1575case x$CONFIG_HEADERS in
1576xconfig.h:config.in)
1577echo > stamp-h ;;
1578esac
1579],
1580[
1581gdb_host_cpu=$gdb_host_cpu
1582gdb_target_cpu=$gdb_target_cpu
1583nativefile=$nativefile
1584])
1585
1586exit 0
This page took 0.521232 seconds and 4 git commands to generate.