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