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