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