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