Commit | Line | Data |
---|---|---|
c906108c | 1 | dnl Autoconf configure script for GDB, the GNU debugger. |
0ea3f30e | 2 | dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
6c7a06a3 | 3 | dnl 2005, 2006, 2007, 2008, 2009 |
b6ba6518 | 4 | dnl Free Software Foundation, Inc. |
c906108c SS |
5 | dnl |
6 | dnl This file is part of GDB. | |
7 | dnl | |
8 | dnl This program is free software; you can redistribute it and/or modify | |
9 | dnl it under the terms of the GNU General Public License as published by | |
5a0e3bd0 | 10 | dnl the Free Software Foundation; either version 3 of the License, or |
c906108c | 11 | dnl (at your option) any later version. |
5a0e3bd0 | 12 | dnl |
c906108c SS |
13 | dnl This program is distributed in the hope that it will be useful, |
14 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | dnl GNU General Public License for more details. | |
5a0e3bd0 | 17 | dnl |
c906108c | 18 | dnl You should have received a copy of the GNU General Public License |
5a0e3bd0 | 19 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c SS |
20 | |
21 | dnl Process this file with autoconf to produce a configure script. | |
22 | ||
bec39cab | 23 | AC_PREREQ(2.59)dnl |
c906108c SS |
24 | AC_INIT(main.c) |
25 | AC_CONFIG_HEADER(config.h:config.in) | |
413ccac7 | 26 | AM_MAINTAINER_MODE |
c906108c SS |
27 | |
28 | AC_PROG_CC | |
14abd0fb | 29 | AC_GNU_SOURCE |
c906108c SS |
30 | AC_AIX |
31 | AC_ISC_POSIX | |
e28b3332 | 32 | gl_EARLY |
c906108c SS |
33 | AM_PROG_CC_STDC |
34 | ||
e28b3332 | 35 | AC_CONFIG_AUX_DIR(..) |
c906108c SS |
36 | AC_CANONICAL_SYSTEM |
37 | ||
a417dc56 RW |
38 | # Dependency checking. |
39 | ZW_CREATE_DEPDIR | |
40 | ZW_PROG_COMPILER_DEPENDENCIES([CC]) | |
41 | ||
42 | # Check for the 'make' the user wants to use. | |
43 | AC_CHECK_PROGS(MAKE, make) | |
44 | MAKE_IS_GNU= | |
45 | case "`$MAKE --version 2>&1 | sed 1q`" in | |
46 | *GNU*) | |
47 | MAKE_IS_GNU=yes | |
48 | ;; | |
49 | esac | |
50 | AM_CONDITIONAL(GMAKE, test "$MAKE_IS_GNU" = yes) | |
51 | AC_PROG_MAKE_SET | |
52 | ||
ddc9cd0f AC |
53 | dnl List of object files and targets accumulated by configure. |
54 | ||
55 | CONFIG_OBS= | |
56 | CONFIG_DEPS= | |
57 | CONFIG_SRCS= | |
58 | ENABLE_CFLAGS= | |
59 | ||
60 | CONFIG_ALL= | |
61 | CONFIG_CLEAN= | |
62 | CONFIG_INSTALL= | |
63 | CONFIG_UNINSTALL= | |
64 | ||
20e95c23 DJ |
65 | dnl Set up for gettext. |
66 | ZW_GNU_GETTEXT_SISTER_DIR | |
ddc9cd0f AC |
67 | |
68 | localedir='${datadir}/locale' | |
69 | AC_SUBST(localedir) | |
70 | ||
20e95c23 | 71 | if 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" | |
76 | fi | |
77 | ||
e28b3332 DJ |
78 | gl_INIT |
79 | ||
d5af19ba DJ |
80 | # For Makefile dependencies. |
81 | GNULIB_STDINT_H= | |
82 | if test x"$STDINT_H" != x; then | |
83 | GNULIB_STDINT_H=gnulib/$STDINT_H | |
84 | fi | |
85 | AC_SUBST(GNULIB_STDINT_H) | |
86 | ||
ddc9cd0f AC |
87 | PACKAGE=gdb |
88 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ]) | |
89 | AC_SUBST(PACKAGE) | |
0fbb3da7 | 90 | |
e28b3332 DJ |
91 | # GDB does not use automake, but gnulib does. This line lets us |
92 | # generate its Makefile.in. | |
93 | AM_INIT_AUTOMAKE(gdb, UNUSED-VERSION, [no-define]) | |
94 | ||
5b5d99cf JB |
95 | debugdir=${libdir}/debug |
96 | ||
97 | AC_ARG_WITH(separate-debug-dir, | |
98 | [ --with-separate-debug-dir=path Look for global separate debug info in this path [LIBDIR/debug]], | |
99 | [debugdir="${withval}"]) | |
100 | ||
101 | AC_DEFINE_DIR(DEBUGDIR, debugdir, | |
102 | [Global directory for separate debug files. ]) | |
103 | #AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"), | |
c906108c | 104 | |
aa28a74e DJ |
105 | if 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 | |
111 | else | |
112 | test_prefix=$exec_prefix | |
113 | fi | |
114 | case ${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 | ;; | |
119 | esac | |
120 | ||
29b0e8a2 JM |
121 | AC_ARG_WITH(relocated-sources, |
122 | AC_HELP_STRING([--with-relocated-sources=PATH], [Automatically relocate this path for source files]), | |
123 | [reloc_srcdir="${withval}" | |
124 | AC_DEFINE_DIR(RELOC_SRCDIR, reloc_srcdir, | |
125 | [Relocated directory for source files. ]) | |
126 | ]) | |
127 | ||
8dcde887 | 128 | AC_CONFIG_SUBDIRS(doc testsuite) |
96baa820 | 129 | |
d0c678e6 UW |
130 | # Check whether to support alternative target configurations |
131 | AC_ARG_ENABLE(targets, | |
132 | [ --enable-targets alternative target configurations], | |
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 ;; | |
138 | esac]) | |
139 | ||
c0993dbe UW |
140 | # Check whether to enable 64-bit support on 32-bit hosts |
141 | AC_ARG_ENABLE(64-bit-bfd, | |
142 | [ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)], | |
143 | [case "${enableval}" in | |
144 | yes) want64=true ;; | |
145 | no) want64=false ;; | |
146 | *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;; | |
147 | esac],[want64=false])dnl | |
148 | ||
121ce6e5 DJ |
149 | # Provide defaults for some variables set by the per-host and per-target |
150 | # configuration. | |
151 | gdb_host_obs=posix-hdep.o | |
152 | ||
771b4502 UW |
153 | if test "${target}" = "${host}"; then |
154 | gdb_native=yes | |
155 | else | |
156 | gdb_native=no | |
157 | fi | |
158 | ||
27e9bf90 | 159 | . $srcdir/configure.host |
c906108c | 160 | |
d0c678e6 UW |
161 | # Accumulate some settings from configure.tgt over all enabled targets |
162 | ||
163 | TARGET_OBS= | |
164 | all_targets= | |
165 | ||
166 | for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` | |
167 | do | |
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 |
196 | done | |
197 | ||
198 | if 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 |
220 | fi |
221 | ||
222 | AC_SUBST(TARGET_OBS) | |
223 | ||
224 | # For other settings, only the main target counts. | |
225 | gdb_sim= | |
226 | gdb_osabi= | |
227 | build_gdbserver= | |
228 | targ=$target; . ${srcdir}/configure.tgt | |
c906108c | 229 | |
27e9bf90 MK |
230 | # Fetch the default architecture and default target vector from BFD. |
231 | targ=$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. | |
235 | targ_archs=`echo $targ_archs | sed 's/ .*//'` | |
5c8cc331 | 236 | |
27e9bf90 MK |
237 | if test "x$targ_archs" != x; then |
238 | AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs, | |
239 | [Define to BFD's default architecture. ]) | |
1ba607ad | 240 | fi |
27e9bf90 MK |
241 | if 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 |
244 | fi |
245 | ||
627af7ea MK |
246 | # The CLI cannot be disabled yet, but may be in the future. |
247 | ||
248 | # Enable CLI. | |
249 | AC_ARG_ENABLE(gdbcli, | |
250 | [ --disable-gdbcli disable command-line interface (CLI)], | |
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]) | |
260 | if 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 |
267 | fi | |
268 | ||
269 | # Enable MI. | |
270 | AC_ARG_ENABLE(gdbmi, | |
271 | [ --disable-gdbmi disable machine-interface (MI)], | |
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]) | |
279 | if 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 |
286 | fi | |
287 | ||
287c1a40 MK |
288 | # Enable TUI. |
289 | AC_ARG_ENABLE(tui, | |
290 | [ --enable-tui enable full-screen terminal user interface (TUI)], | |
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. |
299 | AC_ARG_ENABLE(gdbtk, | |
d28f9cdf | 300 | [ --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. | |
313 | case $host_os in | |
314 | go32* | windows*) | |
315 | AC_MSG_WARN([gdbtk isn't supported on $host; disabling]) | |
316 | enable_gdbtk=no ;; | |
317 | esac | |
318 | ||
0e5d83e3 JJ |
319 | # Libunwind support. |
320 | AC_ARG_WITH(libunwind, | |
321 | [ --with-libunwind Use libunwind frame unwinding support], | |
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) ;; | |
326 | esac],[ | |
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 | ||
333 | if 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" | |
339 | fi | |
340 | ||
cb01cfba JB |
341 | opt_curses=no |
342 | AC_ARG_WITH(curses, AC_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval) | |
343 | ||
76a39ba7 | 344 | prefer_curses=no |
cb01cfba | 345 | if test "$opt_curses" = "yes"; then |
76a39ba7 | 346 | prefer_curses=yes |
cb01cfba JB |
347 | fi |
348 | ||
d28f9cdf DJ |
349 | # Profiling support. |
350 | AC_ARG_ENABLE(profiling, | |
351 | [ --enable-profiling enable profiling of GDB], | |
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 | 360 | AC_CHECK_FUNCS(monstartup _mcleanup) |
b0b1c2c0 MK |
361 | AC_CACHE_CHECK([for _etext], ac_cv_var__etext, |
362 | [AC_TRY_LINK( | |
363 | [#include <stdlib.h> | |
364 | extern char _etext; | |
365 | ], | |
366 | [free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)]) | |
367 | if test $ac_cv_var__etext = yes; then | |
368 | AC_DEFINE(HAVE__ETEXT, 1, | |
369 | [Define to 1 if your system has the _etext variable. ]) | |
370 | fi | |
01fe12f6 JB |
371 | AC_CACHE_CHECK([for etext], ac_cv_var_etext, |
372 | [AC_TRY_LINK( | |
373 | [#include <stdlib.h> | |
374 | extern char etext; | |
375 | ], | |
376 | [free (&etext);], ac_cv_var_etext=yes, ac_cv_var_etext=no)]) | |
377 | if test $ac_cv_var_etext = yes; then | |
378 | AC_DEFINE(HAVE_ETEXT, 1, | |
379 | [Define to 1 if your system has the etext variable. ]) | |
380 | fi | |
d28f9cdf | 381 | if 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" | |
398 | fi | |
399 | ||
c16158bc JM |
400 | ACX_PKGVERSION([GDB]) |
401 | ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/]) | |
402 | AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description]) | |
403 | AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address]) | |
404 | ||
8bb2c122 MK |
405 | # --------------------- # |
406 | # Checks for programs. # | |
407 | # --------------------- # | |
408 | ||
7a292a7a | 409 | AC_PROG_AWK |
c906108c | 410 | AC_PROG_INSTALL |
8bb2c122 MK |
411 | AC_PROG_LN_S |
412 | AC_PROG_RANLIB | |
413 | AC_PROG_YACC | |
414 | ||
c906108c | 415 | AC_CHECK_TOOL(AR, ar) |
95ca63c4 CF |
416 | AC_CHECK_TOOL(DLLTOOL, dlltool) |
417 | AC_CHECK_TOOL(WINDRES, windres) | |
c906108c | 418 | |
8bb2c122 | 419 | # Needed for GNU/Hurd. |
75c6e08a MK |
420 | AC_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. | |
427 | AC_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. | |
433 | AC_CHECK_FUNC(wctype, [], | |
434 | [AC_CHECK_LIB(w, wctype)]) | |
435 | ||
c890192f MK |
436 | # Some systems (e.g. Solaris) have `gethostbyname' in libnsl. |
437 | AC_SEARCH_LIBS(gethostbyname, nsl) | |
438 | ||
9a156167 MK |
439 | # Some systems (e.g. Solaris) have `socketpair' in libsocket. |
440 | AC_SEARCH_LIBS(socketpair, socket) | |
441 | ||
233a11ab CS |
442 | # Link in zlib if we can. This allows us to read compressed debug sections. |
443 | AC_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). |
446 | AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl]) | |
447 | ||
6c7a06a3 TT |
448 | AM_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 | ||
466 | case $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 | ;; | |
475 | esac | |
476 | ||
cb01cfba | 477 | # For the TUI, we need enhanced curses functionality. |
bd8a8e1b | 478 | if test x"$enable_tui" != xno; then |
cb01cfba JB |
479 | prefer_curses=yes |
480 | fi | |
481 | ||
482 | curses_found=no | |
483 | if 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 | |
496 | fi | |
497 | ||
77f120bf JB |
498 | # Check whether we should enable the TUI, but only do so if we really |
499 | # can. | |
500 | if 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 | |
519 | fi | |
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 | |
525 | case $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 |
538 | esac |
539 | ||
4f0be353 MK |
540 | # These are the libraries checked by Readline. |
541 | AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses]) | |
287c1a40 MK |
542 | |
543 | if test "$ac_cv_search_tgetent" = no; then | |
544 | AC_MSG_ERROR([no termcap library found]) | |
545 | fi | |
546 | ||
6a30b0a5 AS |
547 | AC_ARG_WITH([system-readline], |
548 | [AS_HELP_STRING([--with-system-readline], | |
549 | [use installed readline library])]) | |
550 | ||
551 | if test "$with_system_readline" = yes; then | |
552 | READLINE=-lreadline | |
553 | READLINE_DEPS= | |
554 | READLINE_CFLAGS= | |
555 | else | |
556 | READLINE='$(READLINE_DIR)/libreadline.a' | |
557 | READLINE_DEPS='$(READLINE)' | |
558 | READLINE_CFLAGS='-I$(READLINE_SRC)/..' | |
559 | fi | |
560 | AC_SUBST(READLINE) | |
561 | AC_SUBST(READLINE_DEPS) | |
562 | AC_SUBST(READLINE_CFLAGS) | |
563 | ||
5c39566f DJ |
564 | AC_ARG_WITH(expat, |
565 | AS_HELP_STRING([--with-expat], [include expat support (auto/yes/no)]), | |
566 | [], [with_expat=auto]) | |
567 | AC_MSG_CHECKING([whether to use expat]) | |
568 | AC_MSG_RESULT([$with_expat]) | |
569 | ||
570 | if test "${with_expat}" = no; then | |
571 | AC_MSG_WARN([expat support disabled; some features may be unavailable.]) | |
572 | HAVE_LIBEXPAT=no | |
ca4ca11e | 573 | else |
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 |
588 | fi |
589 | ||
d57a3c85 TJB |
590 | dnl Utility to simplify finding libpython. |
591 | AC_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 | ||
609 | AC_ARG_WITH(python, | |
610 | AS_HELP_STRING([--with-python], [include python support (auto/yes/no/<path>)]), | |
611 | [], [with_python=auto]) | |
612 | AC_MSG_CHECKING([whether to use python]) | |
613 | AC_MSG_RESULT([$with_python]) | |
614 | ||
615 | if test "${with_python}" = no; then | |
616 | AC_MSG_WARN([python support disabled; some features may be unavailable.]) | |
617 | have_libpython=no | |
618 | else | |
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 | |
672 | fi | |
673 | ||
674 | if 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 | |
701 | else | |
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 |
706 | fi |
707 | AC_SUBST(PYTHON_CFLAGS) | |
708 | ||
5ee754fc MK |
709 | # ------------------------- # |
710 | # Checks for header files. # | |
711 | # ------------------------- # | |
c906108c | 712 | |
9608ab8b | 713 | AC_HEADER_DIRENT |
5ee754fc | 714 | AC_HEADER_STAT |
c906108c | 715 | AC_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? | |
719 | AC_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 |
727 | AC_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 |
735 | AC_CHECK_HEADERS(sys/proc.h, [], [], |
736 | [#if HAVE_SYS_PARAM_H | |
737 | # include <sys/param.h> | |
738 | #endif | |
739 | ]) | |
7cb9022a MK |
740 | AC_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. | |
749 | case $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 ;; |
756 | esac | |
a9322a30 | 757 | AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h ncurses/term.h) |
c401b55a MK |
758 | AC_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 |
768 | AC_CHECK_DECLS([free, malloc, realloc, strerror, strstr, getopt, |
769 | snprintf, vsnprintf]) | |
a8111142 | 770 | AM_LC_MESSAGES |
b9362cc7 | 771 | |
666ec76f MK |
772 | # ----------------------- # |
773 | # Checks for structures. # | |
774 | # ----------------------- # | |
775 | ||
a9322a30 | 776 | AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize]) |
666ec76f | 777 | |
5ee754fc MK |
778 | # ------------------ # |
779 | # Checks for types. # | |
780 | # ------------------ # | |
c906108c | 781 | |
5ee754fc | 782 | AC_TYPE_SIGNAL |
f9f87d2c MK |
783 | AC_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 | |
792 | AC_C_CONST | |
bce58c09 | 793 | AC_C_INLINE |
9b913628 | 794 | AC_C_BIGENDIAN |
c906108c | 795 | |
5ee754fc MK |
796 | # ------------------------------ # |
797 | # Checks for library functions. # | |
798 | # ------------------------------ # | |
799 | ||
c906108c | 800 | AC_FUNC_ALLOCA |
97bf5e38 | 801 | AC_FUNC_MMAP |
46711df8 | 802 | AC_FUNC_VFORK |
a9322a30 TT |
803 | AC_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 | 807 | AM_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. | |
811 | gdb_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 | 823 | AC_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 |
829 | AC_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 |
837 | AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret, |
838 | [Define as the return type of ptrace.]) | |
839 | # Check argument types. | |
840 | AC_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 |
844 | for 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, [ | |
849 | extern $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, [ | |
855 | extern $gdb_cv_func_ptrace_ret | |
856 | ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5); | |
857 | ], [ | |
858 | gdb_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 | |
864 | done | |
865 | # Provide a safe default value. | |
866 | : ${gdb_cv_func_ptrace_args='int,int,long,long'} | |
064ef605 | 867 | ])]) |
086ec9eb MK |
868 | ac_save_IFS=$IFS; IFS=',' |
869 | set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'` | |
870 | IFS=$ac_save_IFS | |
871 | shift | |
64218d3e | 872 | AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3], |
086ec9eb MK |
873 | [Define to the type of arg 3 for ptrace.]) |
874 | if 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.]) |
877 | fi | |
878 | ||
72473524 DJ |
879 | dnl AC_FUNC_SETPGRP does not work when cross compiling |
880 | dnl Instead, assume we will have a prototype for setpgrp if cross compiling. | |
881 | if test "$cross_compiling" = no; then | |
882 | AC_FUNC_SETPGRP | |
883 | else | |
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)]) | |
893 | if test $ac_cv_func_setpgrp_void = yes; then | |
894 | AC_DEFINE(SETPGRP_VOID, 1) | |
895 | fi | |
896 | fi | |
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. | |
900 | AC_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);], | |
904 | gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)]) | |
905 | if test $gdb_cv_func_sigsetjmp = yes; then | |
906 | AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ]) | |
907 | fi | |
908 | ||
06825bd1 MK |
909 | # Assume we'll default to using the included libiberty regex. |
910 | gdb_use_included_regex=yes | |
911 | ||
912 | # However, if the system regex is GNU regex, then default to *not* | |
913 | # using the included regex. | |
914 | AC_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)]) | |
925 | if test $gdb_cv_have_gnu_regex = yes; then | |
926 | gdb_use_included_regex=no | |
927 | fi | |
928 | ||
929 | AC_ARG_WITH(included-regex, | |
930 | [ --without-included-regex don't use included regex; this is the default | |
931 | on systems with version 2 of the GNU C library | |
932 | (use with caution on other system)], | |
933 | gdb_with_regex=$withval, | |
934 | gdb_with_regex=$gdb_use_included_regex) | |
935 | if test "$gdb_with_regex" = yes; then | |
936 | AC_DEFINE(USE_INCLUDED_REGEX, 1, | |
937 | [Define to 1 if the regex included in libiberty should be used.]) | |
938 | fi | |
939 | ||
5c45e068 MK |
940 | # Check if <sys/proc.h> defines `struct thread' with a td_pcb member. |
941 | AC_CHECK_MEMBERS([struct thread.td_pcb], [], [], | |
942 | [#include <sys/param.h> | |
943 | #include <sys/proc.h> | |
944 | ]) | |
70f9f479 | 945 | |
da7d81e3 NW |
946 | # See if <sys/lwp.h> defines `struct lwp`. |
947 | AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp, | |
948 | [AC_TRY_COMPILE([#include <sys/param.h> | |
949 | #include <sys/lwp.h>], [struct lwp l;], | |
950 | gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)]) | |
951 | if test $gdb_cv_struct_lwp = yes; then | |
952 | AC_DEFINE(HAVE_STRUCT_LWP, 1, | |
953 | [Define to 1 if your system has struct lwp.]) | |
954 | fi | |
955 | ||
78434e59 MK |
956 | # See if <machine/reg.h> degines `struct reg'. |
957 | AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg, | |
958 | [AC_TRY_COMPILE([#include <sys/types.h> | |
959 | #include <machine/reg.h>], [struct reg r;], | |
960 | gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)]) | |
961 | if test $gdb_cv_struct_reg = yes; then | |
962 | AC_DEFINE(HAVE_STRUCT_REG, 1, | |
963 | [Define to 1 if your system has struct reg in <machine/reg.h>.]) | |
964 | fi | |
965 | ||
0afdd437 | 966 | # See if <machine/reg.h> supports the %fs and %gs i386 segment registers. |
7dfa765c | 967 | # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'. |
5c45e068 MK |
968 | AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [], |
969 | [#include <machine/reg.h>]) | |
7dfa765c | 970 | |
0afdd437 | 971 | # See if <sys/ptrace.h> provides the PTRACE_GETREGS request. |
f60300e7 MK |
972 | AC_MSG_CHECKING(for PTRACE_GETREGS) |
973 | AC_CACHE_VAL(gdb_cv_have_ptrace_getregs, | |
974 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], | |
975 | [PTRACE_GETREGS;], | |
976 | [gdb_cv_have_ptrace_getregs=yes], | |
977 | [gdb_cv_have_ptrace_getregs=no])]) | |
978 | AC_MSG_RESULT($gdb_cv_have_ptrace_getregs) | |
979 | if test $gdb_cv_have_ptrace_getregs = yes; then | |
60ca704f SE |
980 | AC_DEFINE(HAVE_PTRACE_GETREGS, 1, |
981 | [Define if sys/ptrace.h defines the PTRACE_GETREGS request.]) | |
f60300e7 MK |
982 | fi |
983 | ||
0afdd437 | 984 | # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request. |
6ce2ac0b MK |
985 | AC_MSG_CHECKING(for PTRACE_GETFPXREGS) |
986 | AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs, | |
5c44784c | 987 | [AC_TRY_COMPILE([#include <sys/ptrace.h>], |
6ce2ac0b MK |
988 | [PTRACE_GETFPXREGS;], |
989 | [gdb_cv_have_ptrace_getfpxregs=yes], | |
990 | [gdb_cv_have_ptrace_getfpxregs=no])]) | |
991 | AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs) | |
992 | if test $gdb_cv_have_ptrace_getfpxregs = yes; then | |
60ca704f SE |
993 | AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1, |
994 | [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.]) | |
5c44784c JM |
995 | fi |
996 | ||
0afdd437 MK |
997 | # See if <sys/ptrace.h> provides the PT_GETDBREGS request. |
998 | AC_MSG_CHECKING(for PT_GETDBREGS) | |
999 | AC_CACHE_VAL(gdb_cv_have_pt_getdbregs, | |
1000 | [AC_TRY_COMPILE([#include <sys/types.h> | |
1001 | #include <sys/ptrace.h>], | |
1002 | [PT_GETDBREGS;], | |
1003 | [gdb_cv_have_pt_getdbregs=yes], | |
1004 | [gdb_cv_have_pt_getdbregs=no])]) | |
1005 | AC_MSG_RESULT($gdb_cv_have_pt_getdbregs) | |
1006 | if test $gdb_cv_have_pt_getdbregs = yes; then | |
60ca704f SE |
1007 | AC_DEFINE(HAVE_PT_GETDBREGS, 1, |
1008 | [Define if sys/ptrace.h defines the PT_GETDBREGS request.]) | |
0afdd437 MK |
1009 | fi |
1010 | ||
7e89e357 JT |
1011 | # See if <sys/ptrace.h> provides the PT_GETXMMREGS request. |
1012 | AC_MSG_CHECKING(for PT_GETXMMREGS) | |
1013 | AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs, | |
1014 | [AC_TRY_COMPILE([#include <sys/types.h> | |
1015 | #include <sys/ptrace.h>], | |
1016 | [PT_GETXMMREGS;], | |
1017 | [gdb_cv_have_pt_getxmmregs=yes], | |
1018 | [gdb_cv_have_pt_getxmmregs=no])]) | |
1019 | AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs) | |
1020 | if test $gdb_cv_have_pt_getxmmregs = yes; then | |
60ca704f SE |
1021 | AC_DEFINE(HAVE_PT_GETXMMREGS, 1, |
1022 | [Define if sys/ptrace.h defines the PT_GETXMMREGS request.]) | |
7e89e357 JT |
1023 | fi |
1024 | ||
eb368090 | 1025 | # Detect which type of /proc is in use, such as for Unixware or Solaris. |
c906108c SS |
1026 | |
1027 | if test "${target}" = "${host}"; then | |
1028 | case "${host}" in | |
1045b512 | 1029 | *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* ) |
60ca704f SE |
1030 | AC_DEFINE(NEW_PROC_API, 1, |
1031 | [Define if you want to use new multi-fd /proc interface | |
1032 | (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).]) | |
c3f6f71d | 1033 | ;; |
c162e8c9 | 1034 | *-*-solaris2.[[6789]] | *-*-solaris2.1[[0-9]]*) |
60ca704f SE |
1035 | AC_DEFINE(NEW_PROC_API, 1, |
1036 | [Define if you want to use new multi-fd /proc interface | |
1037 | (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).]) | |
c3f6f71d | 1038 | ;; |
c960c18f AC |
1039 | mips-sgi-irix5*) |
1040 | # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5. | |
60ca704f SE |
1041 | AC_DEFINE([_KMEMUSER], 1, |
1042 | [Define to 1 so <sys/proc.h> gets a definition of anon_hdl. Works | |
1043 | around a <sys/proc.h> problem on IRIX 5.]) | |
c960c18f | 1044 | ;; |
c906108c | 1045 | esac |
c906108c SS |
1046 | fi |
1047 | ||
1048 | if test "$ac_cv_header_sys_procfs_h" = yes; then | |
1049 | BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t) | |
1050 | BFD_HAVE_SYS_PROCFS_TYPE(prrun_t) | |
1051 | BFD_HAVE_SYS_PROCFS_TYPE(gregset_t) | |
1052 | BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t) | |
83d37ec8 MK |
1053 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t) |
1054 | BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t) | |
23e04971 MS |
1055 | BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t) |
1056 | BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t) | |
83d37ec8 MK |
1057 | BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t) |
1058 | BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t) | |
596c9d4b KB |
1059 | BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t) |
1060 | BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t) | |
1061 | BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t) | |
1062 | BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t) | |
c906108c | 1063 | |
23e04971 | 1064 | |
d84dd0c5 MK |
1065 | dnl Check for broken prfpregset_t type |
1066 | ||
1067 | dnl For Linux/i386, glibc 2.1.3 was released with a bogus | |
1068 | dnl prfpregset_t type (it's a typedef for the pointer to a struct | |
1069 | dnl instead of the struct itself). We detect this here, and work | |
a3007b6f | 1070 | dnl around it in gdb_proc_service.h. |
d84dd0c5 MK |
1071 | |
1072 | if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then | |
1073 | AC_MSG_CHECKING(whether prfpregset_t type is broken) | |
1074 | AC_CACHE_VAL(gdb_cv_prfpregset_t_broken, | |
1075 | [AC_TRY_RUN([#include <sys/procfs.h> | |
1076 | int main () | |
1077 | { | |
1078 | if (sizeof (prfpregset_t) == sizeof (void *)) | |
1079 | return 1; | |
1080 | return 0; | |
1081 | }], | |
1082 | gdb_cv_prfpregset_t_broken=no, | |
1083 | gdb_cv_prfpregset_t_broken=yes, | |
1084 | gdb_cv_prfpregset_t_broken=yes)]) | |
1085 | AC_MSG_RESULT($gdb_cv_prfpregset_t_broken) | |
1086 | if test $gdb_cv_prfpregset_t_broken = yes; then | |
60ca704f SE |
1087 | AC_DEFINE(PRFPREGSET_T_BROKEN, 1, |
1088 | [Define if the prfpregset_t type is broken.]) | |
d84dd0c5 MK |
1089 | fi |
1090 | fi | |
1091 | ||
c906108c SS |
1092 | dnl Check for PIOCSET ioctl entry |
1093 | ||
1094 | AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h) | |
1095 | AC_CACHE_VAL(gdb_cv_have_procfs_piocset, | |
1096 | [AC_TRY_COMPILE([#include <unistd.h> | |
1097 | #include <sys/types.h> | |
1098 | #include <sys/procfs.h> | |
1099 | ], [ | |
1100 | int dummy;; | |
1101 | dummy = ioctl(0, PIOCSET, &dummy); | |
1102 | ], | |
1103 | gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)]) | |
1104 | AC_MSG_RESULT($gdb_cv_have_procfs_piocset) | |
1105 | if test $gdb_cv_have_procfs_piocset = yes; then | |
60ca704f SE |
1106 | AC_DEFINE(HAVE_PROCFS_PIOCSET, 1, |
1107 | [Define if ioctl argument PIOCSET is available.]) | |
c906108c SS |
1108 | fi |
1109 | fi | |
1110 | ||
d45fe813 KB |
1111 | dnl For native ports (host == target), check to see what kind of |
1112 | dnl legacy link.h support is needed. (See solib-legacy.c.) | |
1113 | if test ${host} = ${target} ; then | |
1114 | dnl Check for struct link_map with l_ members which are indicative | |
1115 | dnl of SVR4-like shared libraries | |
1116 | ||
1117 | AC_MSG_CHECKING(for member l_addr in struct link_map) | |
1118 | AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members, | |
1119 | [AC_TRY_COMPILE([#include <link.h>], | |
1120 | [struct link_map lm; (void) lm.l_addr;], | |
1121 | gdb_cv_have_struct_link_map_with_l_members=yes, | |
1122 | gdb_cv_have_struct_link_map_with_l_members=no)]) | |
1123 | AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members) | |
1124 | if test $gdb_cv_have_struct_link_map_with_l_members = yes; then | |
60ca704f SE |
1125 | AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS,1, |
1126 | [Define if <link.h> exists and defines struct link_map which has | |
1127 | members with an ``l_'' prefix. (For Solaris, SVR4, and | |
1128 | SVR4-like systems.)]) | |
d45fe813 KB |
1129 | fi |
1130 | ||
1131 | dnl Check for struct link_map with lm_ members which are indicative | |
1132 | dnl of SunOS-like shared libraries | |
1133 | ||
1134 | AC_MSG_CHECKING(for member lm_addr in struct link_map) | |
1135 | AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members, | |
1136 | [AC_TRY_COMPILE([#include <sys/types.h> | |
1137 | #include <link.h>], | |
1138 | [struct link_map lm; (void) lm.lm_addr;], | |
1139 | gdb_cv_have_struct_link_map_with_lm_members=yes, | |
1140 | gdb_cv_have_struct_link_map_with_lm_members=no)]) | |
1141 | AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members) | |
1142 | if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then | |
60ca704f SE |
1143 | AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS, 1, |
1144 | [Define if <link.h> exists and defines struct link_map which has | |
1145 | members with an ``lm_'' prefix. (For SunOS.)]) | |
d45fe813 KB |
1146 | fi |
1147 | ||
1148 | dnl Check for struct so_map with som_ members which are found on | |
1149 | dnl some *BSD systems. | |
1150 | ||
1151 | AC_MSG_CHECKING(for member som_addr in struct so_map) | |
1152 | AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members, | |
1153 | [AC_TRY_COMPILE([#include <sys/types.h> | |
39812ceb C |
1154 | #ifdef HAVE_NLIST_H |
1155 | #include <nlist.h> | |
1156 | #endif | |
d45fe813 KB |
1157 | #include <link.h>], |
1158 | [struct so_map lm; (void) lm.som_addr;], | |
1159 | gdb_cv_have_struct_so_map_with_som_members=yes, | |
1160 | gdb_cv_have_struct_so_map_with_som_members=no)]) | |
1161 | AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members) | |
1162 | if test $gdb_cv_have_struct_so_map_with_som_members = yes; then | |
60ca704f SE |
1163 | AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS, 1, |
1164 | [Define if <link.h> exists and defines a struct so_map which has | |
1165 | members with an ``som_'' prefix. (Found on older *BSD systems.)]) | |
d45fe813 KB |
1166 | fi |
1167 | ||
1168 | dnl Check for struct link_map32 type, which allows a 64-bit Solaris | |
1169 | dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries. | |
1170 | ||
1171 | AC_MSG_CHECKING(for struct link_map32 in sys/link.h) | |
1172 | AC_CACHE_VAL(gdb_cv_have_struct_link_map32, | |
1173 | [AC_TRY_COMPILE([#define _SYSCALL32 | |
1174 | #include <sys/link.h>], [struct link_map32 l;], | |
1175 | gdb_cv_have_struct_link_map32=yes, | |
1176 | gdb_cv_have_struct_link_map32=no)]) | |
1177 | AC_MSG_RESULT($gdb_cv_have_struct_link_map32) | |
1178 | if test $gdb_cv_have_struct_link_map32 = yes; then | |
60ca704f SE |
1179 | AC_DEFINE(HAVE_STRUCT_LINK_MAP32, 1, |
1180 | [Define if <sys/link.h> has struct link_map32]) | |
1181 | AC_DEFINE(_SYSCALL32, 1, | |
1182 | [Define if <sys/link.h> has link_map32 (solaris sparc-64 target)]) | |
d45fe813 KB |
1183 | fi |
1184 | fi | |
1185 | ||
bc8bcb4b MK |
1186 | # Check if the compiler supports the `long long' type. |
1187 | ||
1188 | AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long, | |
1189 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | |
1190 | [[extern long long foo;]], | |
1191 | [[switch (foo & 2) { case 0: return 1; }]])], | |
1192 | gdb_cv_c_long_long=yes, | |
1193 | gdb_cv_c_long_long=no)]) | |
c906108c | 1194 | if test $gdb_cv_c_long_long = yes; then |
bc8bcb4b MK |
1195 | AC_DEFINE(CC_HAS_LONG_LONG, 1, |
1196 | [Define to 1 if the compiler supports long long.]) | |
c906108c SS |
1197 | fi |
1198 | ||
bc8bcb4b | 1199 | # Check if the compiler and runtime support printing long longs. |
c906108c | 1200 | |
bc8bcb4b MK |
1201 | AC_CACHE_CHECK([for long long support in printf], |
1202 | gdb_cv_printf_has_long_long, | |
1203 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], | |
1204 | [[char buf[32]; | |
c906108c SS |
1205 | long long l = 0; |
1206 | l = (l << 16) + 0x0123; | |
1207 | l = (l << 16) + 0x4567; | |
1208 | l = (l << 16) + 0x89ab; | |
1209 | l = (l << 16) + 0xcdef; | |
1210 | sprintf (buf, "0x%016llx", l); | |
bc8bcb4b MK |
1211 | return (strcmp ("0x0123456789abcdef", buf));]])], |
1212 | gdb_cv_printf_has_long_long=yes, | |
1213 | gdb_cv_printf_has_long_long=no, | |
1214 | gdb_cv_printf_has_long_long=no)]) | |
c906108c | 1215 | if test $gdb_cv_printf_has_long_long = yes; then |
bc8bcb4b MK |
1216 | AC_DEFINE(PRINTF_HAS_LONG_LONG, 1, |
1217 | [Define to 1 if the "%ll" format works to print long longs.]) | |
c906108c | 1218 | fi |
c906108c | 1219 | |
1a619819 LM |
1220 | # Check if the compiler and runtime support printing decfloats. |
1221 | ||
1222 | AC_CACHE_CHECK([for decfloat support in printf], | |
1223 | gdb_cv_printf_has_decfloat, | |
1224 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], | |
1225 | [[char buf[64]; | |
1226 | _Decimal32 d32 = 1.2345df; | |
1227 | _Decimal64 d64 = 1.2345dd; | |
1228 | _Decimal128 d128 = 1.2345dl; | |
1229 | sprintf (buf, "Decimal32: %H\nDecimal64: %D\nDecimal128: %DD", d32, d64, d128); | |
1230 | return (strcmp ("Decimal32: 1.2345\nDecimal64: 1.2345\nDecimal128: 1.2345", buf));]])], | |
1231 | gdb_cv_printf_has_decfloat=yes, | |
1232 | gdb_cv_printf_has_decfloat=no, | |
1233 | gdb_cv_printf_has_decfloat=no)]) | |
1234 | if test $gdb_cv_printf_has_decfloat = yes; then | |
1235 | AC_DEFINE(PRINTF_HAS_DECFLOAT, 1, | |
1236 | [Define to 1 if the "%H, %D and %DD" formats work to print decfloats.]) | |
1237 | fi | |
1238 | ||
bc8bcb4b MK |
1239 | # Check if the compiler supports the `long double' type. We can't use |
1240 | # AC_C_LONG_DOUBLE because that one does additional checks on the | |
1241 | # constants defined in <float.h> that fail on some systems, | |
1242 | # e.g. FreeBSD/i386 4.7 and OpenBSD/i386 3.6. | |
c906108c | 1243 | |
bc8bcb4b MK |
1244 | AC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double, |
1245 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])], | |
1246 | gdb_cv_c_long_double=yes, | |
1247 | gdb_cv_c_long_double=no)]) | |
1248 | if test $gdb_cv_c_long_double = yes; then | |
1249 | AC_DEFINE(HAVE_LONG_DOUBLE, 1, | |
1250 | [Define to 1 if the compiler supports long double.]) | |
c906108c SS |
1251 | fi |
1252 | ||
bc8bcb4b | 1253 | # Check if the compiler and runtime support printing long doubles. |
c906108c | 1254 | |
bc8bcb4b MK |
1255 | AC_CACHE_CHECK([for long double support in printf], |
1256 | gdb_cv_printf_has_long_double, | |
1257 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], | |
1258 | [[char buf[16]; | |
c906108c SS |
1259 | long double f = 3.141592653; |
1260 | sprintf (buf, "%Lg", f); | |
bc8bcb4b MK |
1261 | return (strncmp ("3.14159", buf, 7));]])], |
1262 | gdb_cv_printf_has_long_double=yes, | |
1263 | gdb_cv_printf_has_long_double=no, | |
1264 | gdb_cv_printf_has_long_double=no)]) | |
c906108c | 1265 | if test $gdb_cv_printf_has_long_double = yes; then |
bc8bcb4b MK |
1266 | AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1, |
1267 | [Define to 1 if the "%Lg" format works to print long doubles.]) | |
c906108c | 1268 | fi |
c906108c | 1269 | |
bc8bcb4b | 1270 | # Check if the compiler and runtime support scanning long doubles. |
c906108c | 1271 | |
bc8bcb4b MK |
1272 | AC_CACHE_CHECK([for long double support in scanf], |
1273 | gdb_cv_scanf_has_long_double, | |
1274 | [AC_RUN_IFELSE([AC_LANG_PROGRAM( | |
1275 | [[#include <stdio.h>]], | |
1276 | [[char *buf = "3.141592653"; | |
c906108c SS |
1277 | long double f = 0; |
1278 | sscanf (buf, "%Lg", &f); | |
bc8bcb4b MK |
1279 | return !(f > 3.14159 && f < 3.14160);]])], |
1280 | gdb_cv_scanf_has_long_double=yes, | |
1281 | gdb_cv_scanf_has_long_double=no, | |
1282 | gdb_cv_scanf_has_long_double=no)]) | |
c906108c | 1283 | if test $gdb_cv_scanf_has_long_double = yes; then |
bc8bcb4b MK |
1284 | AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1, |
1285 | [Define to 1 if the "%Lg" format works to scan long doubles.]) | |
c906108c | 1286 | fi |
c906108c | 1287 | |
438013df AO |
1288 | case ${host_os} in |
1289 | aix*) | |
1290 | AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [ | |
1291 | SAVE_LDFLAGS=$LDFLAGS | |
1292 | ||
1293 | case $GCC in | |
1294 | yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;; | |
1295 | *) gdb_cv_bigtoc=-bbigtoc ;; | |
1296 | esac | |
1297 | ||
1298 | LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc | |
1299 | AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=]) | |
ec76baa5 | 1300 | LDFLAGS="${SAVE_LDFLAGS}" |
438013df AO |
1301 | ]) |
1302 | CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}" | |
1303 | ;; | |
1304 | esac | |
1305 | ||
c906108c | 1306 | |
d92419e5 JB |
1307 | dnl For certain native configurations, we need to check whether thread |
1308 | dnl support can be built in or not. | |
1309 | dnl | |
1310 | dnl Note that we only want this if we are both native (host == target), | |
1311 | dnl and not doing a canadian cross build (build == host). | |
c906108c SS |
1312 | |
1313 | if test ${build} = ${host} -a ${host} = ${target} ; then | |
1314 | case ${host_os} in | |
1315 | hpux*) | |
1316 | AC_MSG_CHECKING(for HPUX/OSF thread support) | |
1317 | if test -f /usr/include/dce/cma_config.h ; then | |
1318 | if test "$GCC" = "yes" ; then | |
1319 | AC_MSG_RESULT(yes) | |
60ca704f SE |
1320 | AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT, 1, |
1321 | [Define if you have HPUX threads]) | |
3483b318 | 1322 | CONFIG_OBS="${CONFIG_OBS} hpux-thread.o" |
c906108c SS |
1323 | CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c" |
1324 | else | |
1325 | AC_MSG_RESULT(no (suppressed because you are not using GCC)) | |
1326 | fi | |
1327 | else | |
1328 | AC_MSG_RESULT(no) | |
1329 | fi | |
1330 | ;; | |
1331 | solaris*) | |
d92419e5 JB |
1332 | # See if thread_db library is around for Solaris thread debugging. |
1333 | # Note that we must explicitly test for version 1 of the library | |
1334 | # because version 0 (present on Solaris 2.4 or earlier) doesn't have | |
1335 | # the same API. | |
c906108c SS |
1336 | AC_MSG_CHECKING(for Solaris thread debugging library) |
1337 | if test -f /usr/lib/libthread_db.so.1 ; then | |
1338 | AC_MSG_RESULT(yes) | |
60ca704f SE |
1339 | AC_DEFINE(HAVE_THREAD_DB_LIB, 1, |
1340 | [Define if using Solaris thread debugging.]) | |
3483b318 | 1341 | CONFIG_OBS="${CONFIG_OBS} sol-thread.o" |
c906108c SS |
1342 | CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c" |
1343 | AC_CHECK_LIB(dl, dlopen) | |
1344 | if test "$GCC" = "yes" ; then | |
1345 | # The GNU linker requires the -export-dynamic option to make | |
1346 | # all symbols visible in the dynamic symbol table. | |
1347 | hold_ldflags=$LDFLAGS | |
1348 | AC_MSG_CHECKING(for the ld -export-dynamic flag) | |
1349 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" | |
1350 | AC_TRY_LINK(, [int i;], found=yes, found=no) | |
1351 | LDFLAGS=$hold_ldflags | |
1352 | AC_MSG_RESULT($found) | |
1353 | if test $found = yes; then | |
1354 | CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic" | |
1355 | fi | |
1356 | fi | |
1357 | # Sun randomly tweaked the prototypes in <proc_service.h> | |
1358 | # at one point. | |
1359 | AC_MSG_CHECKING(if <proc_service.h> is old) | |
1360 | AC_CACHE_VAL(gdb_cv_proc_service_is_old,[ | |
1361 | AC_TRY_COMPILE([ | |
1362 | #include <proc_service.h> | |
1363 | ps_err_e ps_pdwrite | |
1364 | (struct ps_prochandle*, psaddr_t, const void*, size_t); | |
1365 | ],, gdb_cv_proc_service_is_old=no, | |
1366 | gdb_cv_proc_service_is_old=yes) | |
1367 | ]) | |
1368 | AC_MSG_RESULT($gdb_cv_proc_service_is_old) | |
1369 | if test $gdb_cv_proc_service_is_old = yes; then | |
60ca704f SE |
1370 | AC_DEFINE(PROC_SERVICE_IS_OLD, 1, |
1371 | [Define if <proc_service.h> on solaris uses int instead of | |
1372 | size_t, and assorted other type changes.]) | |
c906108c SS |
1373 | fi |
1374 | else | |
1375 | AC_MSG_RESULT(no) | |
1376 | fi | |
1377 | ;; | |
d92419e5 JB |
1378 | aix*) |
1379 | AC_MSG_CHECKING(for AiX thread debugging library) | |
1380 | AC_CACHE_VAL(gdb_cv_have_aix_thread_debug, | |
1381 | [AC_TRY_COMPILE([#include <sys/pthdebug.h>], | |
1382 | [#ifndef PTHDB_VERSION_3 | |
1383 | #error | |
1384 | #endif], | |
1385 | gdb_cv_have_aix_thread_debug=yes, | |
1386 | gdb_cv_have_aix_thread_debug=no)]) | |
1387 | AC_MSG_RESULT($gdb_cv_have_aix_thread_debug) | |
1388 | if test $gdb_cv_have_aix_thread_debug = yes; then | |
1389 | CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c" | |
3483b318 | 1390 | CONFIG_OBS="${CONFIG_OBS} aix-thread.o" |
d92419e5 JB |
1391 | CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug" |
1392 | fi | |
1393 | ;; | |
c906108c SS |
1394 | esac |
1395 | AC_SUBST(CONFIG_LDFLAGS) | |
1396 | fi | |
1397 | ||
59f80f10 DJ |
1398 | dnl See if we have a thread_db header file that has TD_NOTALLOC and |
1399 | dnl other error codes. | |
3f47be5c EZ |
1400 | if test "x$ac_cv_header_thread_db_h" = "xyes"; then |
1401 | AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC], | |
1402 | gdb_cv_thread_db_h_has_td_notalloc, | |
1403 | AC_TRY_COMPILE( | |
1404 | [#include <thread_db.h>], | |
1405 | [int i = TD_NOTALLOC;], | |
1406 | gdb_cv_thread_db_h_has_td_notalloc=yes, | |
1407 | gdb_cv_thread_db_h_has_td_notalloc=no | |
1408 | ) | |
1409 | ) | |
59f80f10 DJ |
1410 | AC_CACHE_CHECK([whether <thread_db.h> has TD_VERSION], |
1411 | gdb_cv_thread_db_h_has_td_version, | |
1412 | AC_TRY_COMPILE( | |
1413 | [#include <thread_db.h>], | |
1414 | [int i = TD_VERSION;], | |
1415 | gdb_cv_thread_db_h_has_td_version=yes, | |
1416 | gdb_cv_thread_db_h_has_td_version=no | |
1417 | ) | |
1418 | ) | |
1419 | AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTLS], | |
1420 | gdb_cv_thread_db_h_has_td_notls, | |
1421 | AC_TRY_COMPILE( | |
1422 | [#include <thread_db.h>], | |
1423 | [int i = TD_NOTLS;], | |
1424 | gdb_cv_thread_db_h_has_td_notls=yes, | |
1425 | gdb_cv_thread_db_h_has_td_notls=no | |
1426 | ) | |
1427 | ) | |
3f47be5c EZ |
1428 | fi |
1429 | if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then | |
1430 | AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1, | |
1431 | [Define if <thread_db.h> has the TD_NOTALLOC error code.]) | |
1432 | fi | |
59f80f10 DJ |
1433 | if test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then |
1434 | AC_DEFINE(THREAD_DB_HAS_TD_VERSION, 1, | |
1435 | [Define if <thread_db.h> has the TD_VERSION error code.]) | |
1436 | fi | |
1437 | if test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then | |
1438 | AC_DEFINE(THREAD_DB_HAS_TD_NOTLS, 1, | |
1439 | [Define if <thread_db.h> has the TD_NOTLS error code.]) | |
1440 | fi | |
3f47be5c | 1441 | |
b757528f JJ |
1442 | dnl See if we have a sys/syscall header file that has __NR_tkill. |
1443 | if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then | |
1444 | AC_CACHE_CHECK([whether <sys/syscall.h> has __NR_tkill], | |
1445 | gdb_cv_sys_syscall_h_has_tkill, | |
1446 | AC_TRY_COMPILE( | |
1447 | [#include <sys/syscall.h>], | |
1448 | [int i = __NR_tkill;], | |
1449 | gdb_cv_sys_syscall_h_has_tkill=yes, | |
1450 | gdb_cv_sys_syscall_h_has_tkill=no | |
1451 | ) | |
1452 | ) | |
1453 | fi | |
1454 | dnl See if we can issue tkill syscall. | |
1455 | if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then | |
60ca704f | 1456 | AC_DEFINE(HAVE_TKILL_SYSCALL, 1, [Define if you support the tkill syscall.]) |
b757528f JJ |
1457 | fi |
1458 | ||
10568435 JK |
1459 | dnl Check if we can disable the virtual address space randomization. |
1460 | dnl The functionality of setarch -R. | |
1461 | AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>]) | |
1462 | define([PERSONALITY_TEST], [AC_LANG_PROGRAM([#include <sys/personality.h>], [ | |
1463 | # if !HAVE_DECL_ADDR_NO_RANDOMIZE | |
1464 | # define ADDR_NO_RANDOMIZE 0x0040000 | |
1465 | # endif | |
1466 | /* Test the flag could be set and stays set. */ | |
1467 | personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE); | |
1468 | if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE)) | |
1469 | return 1])]) | |
1470 | AC_RUN_IFELSE([PERSONALITY_TEST], | |
1471 | [have_personality=true], | |
1472 | [have_personality=false], | |
1473 | [AC_LINK_IFELSE([PERSONALITY_TEST], | |
1474 | [have_personality=true], | |
1475 | [have_personality=false])]) | |
1476 | if $have_personality | |
1477 | then | |
1478 | AC_DEFINE([HAVE_PERSONALITY], 1, | |
1479 | [Define if you support the personality syscall.]) | |
1480 | fi | |
1481 | ||
c906108c | 1482 | dnl Handle optional features that can be enabled. |
fb40c209 | 1483 | |
030292b7 DJ |
1484 | AC_ARG_WITH(sysroot, |
1485 | [ --with-sysroot[=DIR] Search for usr/lib et al within DIR.], | |
1486 | [ | |
1487 | case ${with_sysroot} in | |
715d1656 | 1488 | yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;; |
030292b7 DJ |
1489 | *) TARGET_SYSTEM_ROOT=$with_sysroot ;; |
1490 | esac | |
1491 | ||
1492 | TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' | |
1493 | ||
07abfebf RS |
1494 | if test "x$prefix" = xNONE; then |
1495 | test_prefix=/usr/local | |
1496 | else | |
1497 | test_prefix=$prefix | |
1498 | fi | |
aa28a74e | 1499 | if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then |
07abfebf | 1500 | test_exec_prefix=$test_prefix |
030292b7 | 1501 | else |
07abfebf | 1502 | test_exec_prefix=$exec_prefix |
030292b7 DJ |
1503 | fi |
1504 | case ${TARGET_SYSTEM_ROOT} in | |
715d1656 | 1505 | "${test_prefix}"|"${test_prefix}/"*|\ |
07abfebf RS |
1506 | "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ |
1507 | '${prefix}'|'${prefix}/'*|\ | |
715d1656 | 1508 | '${exec_prefix}'|'${exec_prefix}/'*) |
030292b7 DJ |
1509 | t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" |
1510 | TARGET_SYSTEM_ROOT_DEFINE="$t" | |
1511 | ;; | |
1512 | esac | |
1513 | ], [ | |
1514 | TARGET_SYSTEM_ROOT= | |
1515 | TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"' | |
1516 | ]) | |
1517 | AC_SUBST(TARGET_SYSTEM_ROOT) | |
1518 | AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) | |
1519 | ||
16e7150e JG |
1520 | system_gdbinit= |
1521 | AC_ARG_WITH(system-gdbinit, | |
1522 | [ --with-system-gdbinit=file Automatically load a system-wide gdbinit file], | |
1523 | [system_gdbinit=${withval}]) | |
1524 | ||
1525 | AC_DEFINE_DIR(SYSTEM_GDBINIT, system_gdbinit, | |
1526 | [System-wide gdbinit file.]) | |
1527 | ||
1528 | if test "x$prefix" = xNONE; then | |
1529 | test_prefix=$ac_default_prefix | |
1530 | else | |
1531 | test_prefix=$prefix | |
1532 | fi | |
1533 | if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then | |
1534 | test_exec_prefix=$test_prefix | |
1535 | else | |
1536 | test_exec_prefix=$exec_prefix | |
1537 | fi | |
1538 | case ${system_gdbinit} in | |
1539 | "${test_prefix}"|"${test_prefix}/"*|\ | |
1540 | "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ | |
1541 | '${prefix}'|'${prefix}/'*|\ | |
1542 | '${exec_prefix}'|'${exec_prefix}/'*) | |
1543 | AC_DEFINE(SYSTEM_GDBINIT_RELOCATABLE, 1, | |
1544 | [Define if the system-wide gdbinit file should be relocated when GDB is moved.]) | |
1545 | ;; | |
1546 | esac | |
1547 | ||
094a342e MK |
1548 | AC_ARG_ENABLE(werror, |
1549 | [ --enable-werror treat compile warnings as errors], | |
1550 | [case "${enableval}" in | |
1551 | yes | y) ERROR_ON_WARNING="yes" ;; | |
1552 | no | n) ERROR_ON_WARNING="no" ;; | |
1553 | *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; | |
1554 | esac]) | |
1555 | ||
1556 | # Enable -Werror by default when using gcc | |
1557 | if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then | |
1558 | ERROR_ON_WARNING=yes | |
1559 | fi | |
1560 | ||
1561 | WERROR_CFLAGS="" | |
1562 | if test "${ERROR_ON_WARNING}" = yes ; then | |
1563 | WERROR_CFLAGS="-Werror" | |
1564 | fi | |
1565 | ||
aa79a185 DJ |
1566 | # The entries after -Wno-pointer-sign are disabled warnings which may |
1567 | # be enabled in the future, which can not currently be used to build | |
1568 | # GDB. | |
1569 | # NOTE: If you change this list, remember to update | |
3b851bce | 1570 | # gdb/doc/gdbint.texinfo. |
aa79a185 DJ |
1571 | build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \ |
1572 | -Wformat-nonliteral -Wno-pointer-sign \ | |
58b38ee2 | 1573 | -Wno-unused -Wno-switch -Wno-char-subscripts" |
a3b362c4 | 1574 | |
3526781e DJ |
1575 | # Enable -Wno-format by default when using gcc on mingw since many |
1576 | # GCC versions complain about %I64. | |
1577 | case "${host}" in | |
1578 | *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;; | |
1579 | esac | |
1580 | ||
c906108c SS |
1581 | AC_ARG_ENABLE(build-warnings, |
1582 | [ --enable-build-warnings Enable build-time compiler warnings if gcc is used], | |
1decb323 | 1583 | [case "${enableval}" in |
c906108c SS |
1584 | yes) ;; |
1585 | no) build_warnings="-w";; | |
1586 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
1587 | build_warnings="${build_warnings} ${t}";; | |
1588 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
1589 | build_warnings="${t} ${build_warnings}";; | |
1590 | *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
d4f3574e SS |
1591 | esac |
1592 | if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | |
746a987d | 1593 | echo "Setting compiler warning flags = $build_warnings" 6>&1 |
1decb323 | 1594 | fi])dnl |
3b851bce AC |
1595 | AC_ARG_ENABLE(gdb-build-warnings, |
1596 | [ --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used], | |
1597 | [case "${enableval}" in | |
1598 | yes) ;; | |
1599 | no) build_warnings="-w";; | |
1600 | ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
1601 | build_warnings="${build_warnings} ${t}";; | |
1602 | *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` | |
1603 | build_warnings="${t} ${build_warnings}";; | |
1604 | *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; | |
1605 | esac | |
1606 | if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then | |
1607 | echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1 | |
1608 | fi])dnl | |
104c1213 | 1609 | WARN_CFLAGS="" |
c906108c SS |
1610 | if test "x${build_warnings}" != x -a "x$GCC" = xyes |
1611 | then | |
746a987d AC |
1612 | AC_MSG_CHECKING(compiler warning flags) |
1613 | # Separate out the -Werror flag as some files just cannot be | |
1614 | # compiled with it enabled. | |
1615 | for w in ${build_warnings}; do | |
1616 | case $w in | |
1617 | -Werr*) WERROR_CFLAGS=-Werror ;; | |
1618 | *) # Check that GCC accepts it | |
4536bbc6 AC |
1619 | saved_CFLAGS="$CFLAGS" |
1620 | CFLAGS="$CFLAGS $w" | |
1621 | AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",) | |
1622 | CFLAGS="$saved_CFLAGS" | |
746a987d AC |
1623 | esac |
1624 | done | |
aa79a185 | 1625 | AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS}) |
1decb323 | 1626 | fi |
c906108c | 1627 | AC_SUBST(WARN_CFLAGS) |
104c1213 | 1628 | AC_SUBST(WERROR_CFLAGS) |
c906108c | 1629 | |
7a292a7a SS |
1630 | # In the Cygwin environment, we need some additional flags. |
1631 | AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin, | |
1632 | [AC_EGREP_CPP(lose, [ | |
1633 | #if defined (__CYGWIN__) || defined (__CYGWIN32__) | |
1634 | lose | |
1635 | #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])]) | |
1636 | ||
aff38e61 AC |
1637 | |
1638 | dnl Figure out which of the many generic ser-*.c files the _host_ supports. | |
3eb25fda | 1639 | SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o" |
aff38e61 | 1640 | case ${host} in |
95cbc983 AC |
1641 | *go32* ) SER_HARDWIRE=ser-go32.o ;; |
1642 | *djgpp* ) SER_HARDWIRE=ser-go32.o ;; | |
0ea3f30e | 1643 | *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;; |
aff38e61 AC |
1644 | esac |
1645 | AC_SUBST(SER_HARDWIRE) | |
1646 | ||
cd0fc7c3 SS |
1647 | # libreadline needs libuser32.a in a cygwin environment |
1648 | WIN32LIBS= | |
1649 | if test x$gdb_cv_os_cygwin = xyes; then | |
c5394b80 JM |
1650 | WIN32LIBS="-luser32" |
1651 | case "${target}" in | |
1652 | *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp" | |
1653 | ;; | |
1654 | esac | |
cd0fc7c3 | 1655 | fi |
b4505029 MM |
1656 | |
1657 | # The ser-tcp.c module requires sockets. | |
1658 | case ${host} in | |
1659 | *mingw32*) | |
1660 | AC_DEFINE(USE_WIN32API, 1, | |
1661 | [Define if we should use the Windows API, instead of the | |
1662 | POSIX API. On Windows, we use the Windows API when | |
1663 | building for MinGW, but the POSIX API when building | |
1664 | for Cygwin.]) | |
1665 | WIN32LIBS="$WIN32LIBS -lws2_32" | |
1666 | ;; | |
1667 | esac | |
cd0fc7c3 | 1668 | AC_SUBST(WIN32LIBS) |
7a292a7a | 1669 | |
31d99776 DJ |
1670 | # Add ELF support to GDB, but only if BFD includes ELF support. |
1671 | OLD_CFLAGS=$CFLAGS | |
1672 | OLD_LDFLAGS=$LDFLAGS | |
1673 | OLD_LIBS=$LIBS | |
cab58a69 | 1674 | CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd" |
31d99776 | 1675 | LDFLAGS="$LDFLAGS -L../bfd -L../libiberty" |
7b3200f9 | 1676 | intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'` |
0f72fb1c | 1677 | LIBS="-lbfd -liberty $intl $LIBS" |
31d99776 DJ |
1678 | AC_CACHE_CHECK([for ELF support in BFD], gdb_cv_var_elf, |
1679 | [AC_TRY_LINK( | |
1680 | [#include <stdlib.h> | |
1681 | #include "bfd.h" | |
1682 | #include "elf-bfd.h" | |
1683 | ], | |
1684 | [bfd *abfd = NULL; bfd_get_elf_phdr_upper_bound (abfd); ], | |
1685 | gdb_cv_var_elf=yes, gdb_cv_var_elf=no)]) | |
1686 | if test $gdb_cv_var_elf = yes; then | |
1687 | CONFIG_OBS="$CONFIG_OBS elfread.o" | |
1688 | AC_DEFINE(HAVE_ELF, 1, | |
1689 | [Define if ELF support should be included.]) | |
1690 | fi | |
1691 | CFLAGS=$OLD_CFLAGS | |
1692 | LDFLAGS=$OLD_LDFLAGS | |
1693 | LIBS=$OLD_LIBS | |
1694 | ||
121ce6e5 DJ |
1695 | # Add any host-specific objects to GDB. |
1696 | CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}" | |
1697 | ||
3fc11d3e JM |
1698 | LIBGUI="../libgui/src/libgui.a" |
1699 | GUI_CFLAGS_X="-I${srcdir}/../libgui/src" | |
1700 | AC_SUBST(LIBGUI) | |
1701 | AC_SUBST(GUI_CFLAGS_X) | |
7a292a7a | 1702 | |
3fc11d3e JM |
1703 | WIN32LDAPP= |
1704 | AC_SUBST(WIN32LIBS) | |
1705 | AC_SUBST(WIN32LDAPP) | |
1706 | ||
d91670b9 | 1707 | case "${host}" in |
686a5eed | 1708 | *-*-cygwin* | *-*-mingw* ) |
d91670b9 CV |
1709 | configdir="win" |
1710 | ;; | |
1711 | *) | |
1712 | configdir="unix" | |
1713 | ;; | |
1714 | esac | |
3fc11d3e JM |
1715 | |
1716 | GDBTKLIBS= | |
1717 | if test "${enable_gdbtk}" = "yes"; then | |
1718 | ||
d1c3b63a KS |
1719 | # Gdbtk must have an absolute path to srcdir in order to run |
1720 | # properly when not installed. | |
1721 | here=`pwd` | |
1722 | cd ${srcdir} | |
1723 | GDBTK_SRC_DIR=`pwd` | |
1724 | cd $here | |
1725 | ||
5062cc19 | 1726 | SC_PATH_TCLCONFIG |
85541719 DE |
1727 | |
1728 | # If $no_tk is nonempty, then we can't do Tk, and there is no | |
1729 | # point to doing Tcl. | |
1730 | SC_PATH_TKCONFIG | |
1731 | ||
1732 | if test -z "${no_tcl}" -a -z "${no_tk}"; then | |
5062cc19 KS |
1733 | SC_LOAD_TCLCONFIG |
1734 | ||
1735 | # Check for in-tree tcl | |
1736 | here=`pwd` | |
1737 | cd ${srcdir}/.. | |
1738 | topdir=`pwd` | |
1739 | cd ${here} | |
1740 | ||
1741 | intree="no" | |
1742 | if test "${TCL_SRC_DIR}" = "${topdir}/tcl"; then | |
1743 | intree="yes" | |
1744 | fi | |
1745 | ||
1746 | # Find Tcl private headers | |
1747 | if test x"${intree}" = xno; then | |
1748 | CY_AC_TCL_PRIVATE_HEADERS | |
1749 | TCL_INCLUDE="${TCL_INCLUDE_SPEC} ${TCL_PRIVATE_INCLUDE}" | |
1750 | TCL_LIBRARY="${TCL_LIB_SPEC}" | |
1751 | TCL_DEPS="" | |
1752 | else | |
1753 | # If building tcl in the same src tree, private headers | |
1754 | # are not needed, but we need to be sure to use the right | |
1755 | # headers library | |
1756 | TCL_INCLUDE="-I${TCL_SRC_DIR}/generic" | |
1757 | TCL_LIBRARY="${TCL_BUILD_LIB_SPEC}" | |
1758 | TCL_DEPS="../tcl/${configdir}${TCL_LIB_FILE}" | |
1759 | fi | |
1760 | AC_SUBST(TCL_INCLUDE) | |
1761 | AC_SUBST(TCL_LIBRARY) | |
1762 | AC_SUBST(TCL_DEPS) | |
dd2504ab | 1763 | |
85541719 DE |
1764 | SC_LOAD_TKCONFIG |
1765 | ||
1766 | # Check for in-tree Tk | |
1767 | intree="no" | |
1768 | if test "${TK_SRC_DIR}" = "${topdir}/tk"; then | |
1769 | intree="yes" | |
1770 | fi | |
1771 | ||
1772 | # Find Tk private headers | |
1773 | if test x"${intree}" = xno; then | |
1774 | CY_AC_TK_PRIVATE_HEADERS | |
1775 | TK_INCLUDE="${TK_INCLUDE_SPEC} ${TK_PRIVATE_INCLUDE}" | |
1776 | TK_LIBRARY=${TK_LIB_SPEC} | |
1777 | TK_DEPS="" | |
1778 | else | |
1779 | TK_INCLUDE="-I${TK_SRC_DIR}/generic" | |
1780 | TK_LIBRARY="${TK_BUILD_LIB_SPEC}" | |
1781 | TK_DEPS="../tk/${configdir}/${TK_LIB_FILE}" | |
1782 | fi | |
1783 | AC_SUBST(TK_INCLUDE) | |
1784 | AC_SUBST(TK_LIBRARY) | |
1785 | AC_SUBST(TK_DEPS) | |
1786 | AC_SUBST(TK_XINCLUDES) | |
1787 | ||
1788 | ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)" | |
1789 | ||
1790 | # Include some libraries that Tcl and Tk want. | |
1791 | TCL_LIBS='$(LIBGUI) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)' | |
1792 | # Yes, the ordering seems wrong here. But it isn't. | |
1793 | # TK_LIBS is the list of libraries that need to be linked | |
1794 | # after Tcl/Tk. Note that this isn't put into LIBS. If it | |
1795 | # were in LIBS then any link tests after this point would | |
1796 | # try to include things like `$(LIBGUI)', which wouldn't work. | |
1797 | GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}" | |
1798 | ||
1799 | CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)" | |
1800 | CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)" | |
1801 | CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)" | |
1802 | CONFIG_ALL="${CONFIG_ALL} all-gdbtk" | |
1803 | CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk" | |
1804 | CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk" | |
1805 | CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk" | |
1806 | ||
1807 | if test x$gdb_cv_os_cygwin = xyes; then | |
1808 | WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32" | |
1809 | WIN32LDAPP="-Wl,--subsystem,console" | |
1810 | CONFIG_OBS="${CONFIG_OBS} gdbres.o" | |
3fc11d3e | 1811 | fi |
ffc6a242 | 1812 | |
85541719 DE |
1813 | AC_CONFIG_SUBDIRS(gdbtk) |
1814 | fi | |
3fc11d3e JM |
1815 | fi |
1816 | ||
3fc11d3e JM |
1817 | AC_SUBST(X_CFLAGS) |
1818 | AC_SUBST(X_LDFLAGS) | |
1819 | AC_SUBST(X_LIBS) | |
3fc11d3e JM |
1820 | AC_SUBST(GDBTKLIBS) |
1821 | AC_SUBST(GDBTK_CFLAGS) | |
d1c3b63a | 1822 | AC_SUBST(GDBTK_SRC_DIR) |
8b93c638 | 1823 | |
c906108c SS |
1824 | AC_PATH_X |
1825 | ||
7a292a7a | 1826 | # Unlike the sim directory, whether a simulator is linked is controlled by |
9b624dbe | 1827 | # presence of a gdb_sim definition in the target configure.tgt entry. |
7a292a7a SS |
1828 | # This code just checks for a few cases where we'd like to ignore those |
1829 | # definitions, even when they're present in the '.mt' file. These cases | |
1830 | # are when --disable-sim is specified, or if the simulator directory is | |
6c5cfe5b | 1831 | # not part of the source tree. |
7a292a7a SS |
1832 | # |
1833 | AC_ARG_ENABLE(sim, | |
1834 | [ --enable-sim Link gdb with simulator], | |
1835 | [echo "enable_sim = $enable_sim"; | |
1836 | echo "enableval = ${enableval}"; | |
1837 | case "${enableval}" in | |
1838 | yes) ignore_sim=false ;; | |
1839 | no) ignore_sim=true ;; | |
1840 | *) ignore_sim=false ;; | |
1841 | esac], | |
1842 | [ignore_sim=false]) | |
1843 | ||
1844 | if test ! -d "${srcdir}/../sim"; then | |
1845 | ignore_sim=true | |
1846 | fi | |
1847 | ||
9b624dbe UW |
1848 | SIM= |
1849 | SIM_OBS= | |
1850 | if test "${ignore_sim}" = "false"; then | |
1851 | if test x"${gdb_sim}" != x ; then | |
1852 | SIM="${gdb_sim}" | |
1853 | SIM_OBS="remote-sim.o" | |
60ca704f | 1854 | AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.]) |
9b624dbe | 1855 | fi |
7a292a7a | 1856 | fi |
9b624dbe UW |
1857 | AC_SUBST(SIM) |
1858 | AC_SUBST(SIM_OBS) | |
7a292a7a | 1859 | |
c906108c | 1860 | AC_SUBST(ENABLE_CFLAGS) |
d28f9cdf | 1861 | AC_SUBST(PROFILE_CFLAGS) |
c906108c SS |
1862 | |
1863 | AC_SUBST(CONFIG_OBS) | |
1864 | AC_SUBST(CONFIG_DEPS) | |
1865 | AC_SUBST(CONFIG_SRCS) | |
b3a90332 AC |
1866 | AC_SUBST(CONFIG_ALL) |
1867 | AC_SUBST(CONFIG_CLEAN) | |
e56ac5c3 AC |
1868 | AC_SUBST(CONFIG_INSTALL) |
1869 | AC_SUBST(CONFIG_UNINSTALL) | |
c906108c | 1870 | |
c35f4ffc AC |
1871 | # List of host floatformats. |
1872 | AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat]) | |
1873 | AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat]) | |
1874 | AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat]) | |
1875 | ||
c906108c SS |
1876 | # target_subdir is used by the testsuite to find the target libraries. |
1877 | target_subdir= | |
1878 | if test "${host}" != "${target}"; then | |
1879 | target_subdir="${target_alias}/" | |
1880 | fi | |
1881 | AC_SUBST(target_subdir) | |
1882 | ||
1883 | frags= | |
771b4502 | 1884 | if test "${gdb_native}" = "yes"; then |
0dad8a66 MK |
1885 | host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh |
1886 | if test ! -f ${host_makefile_frag}; then | |
1887 | AC_MSG_ERROR("*** Gdb does not support native target ${host}") | |
1888 | fi | |
1889 | frags="$frags $host_makefile_frag" | |
1890 | else | |
1891 | host_makefile_frag=/dev/null | |
c906108c | 1892 | fi |
c906108c | 1893 | |
c906108c | 1894 | AC_SUBST_FILE(host_makefile_frag) |
c906108c SS |
1895 | AC_SUBST(frags) |
1896 | ||
1897 | changequote(,)dnl | |
771b4502 | 1898 | if test "${gdb_native}" = "yes"; then |
a85f51e7 DJ |
1899 | # We pick this up from the host configuration file (.mh) because we |
1900 | # do not have a native configuration Makefile fragment. | |
c906108c SS |
1901 | nativefile=`sed -n ' |
1902 | s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p | |
1903 | ' ${host_makefile_frag}` | |
c906108c SS |
1904 | fi |
1905 | changequote([,]) | |
1906 | ||
b00a8037 DJ |
1907 | if test x"${gdb_osabi}" != x ; then |
1908 | AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi, | |
1909 | [Define to the default OS ABI for this configuration.]) | |
1910 | fi | |
1911 | ||
8dcde887 MK |
1912 | # Enable multi-ice-gdb-server. |
1913 | AC_ARG_ENABLE(multi-ice, | |
1914 | [ --enable-multi-ice build the multi-ice-gdb-server], | |
1915 | [case $enableval in | |
1916 | yes | no) | |
1917 | ;; | |
1918 | *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;; | |
1919 | esac]) | |
1920 | if test "x$enable_multi_ice" = xyes; then | |
3ace7edb | 1921 | AC_CONFIG_SUBDIRS(multi-ice) |
96baa820 JM |
1922 | fi |
1923 | ||
a13e2c95 UW |
1924 | # We only build gdbserver automatically in a native configuration. |
1925 | if test "$gdb_native" = "yes"; then | |
8dcde887 MK |
1926 | AC_MSG_CHECKING(whether gdbserver is supported on this host) |
1927 | if test "x$build_gdbserver" = xyes; then | |
8dcde887 | 1928 | AC_MSG_RESULT(yes) |
3ace7edb | 1929 | AC_CONFIG_SUBDIRS(gdbserver) |
8dcde887 MK |
1930 | else |
1931 | AC_MSG_RESULT(no) | |
1932 | fi | |
a85f51e7 DJ |
1933 | fi |
1934 | ||
db985757 | 1935 | # If nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link |
2c0fc042 | 1936 | # to an empty version. |
c906108c SS |
1937 | |
1938 | files= | |
1939 | links= | |
5a2402b8 | 1940 | |
c906108c | 1941 | rm -f nm.h |
5a2402b8 | 1942 | nm_h="" |
c906108c | 1943 | if test "${nativefile}" != ""; then |
5a2402b8 | 1944 | nm_h=nm.h |
0f475e27 AC |
1945 | case "${nativefile}" in |
1946 | nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;; | |
1947 | * ) GDB_NM_FILE="${nativefile}" | |
1948 | esac | |
5a2402b8 AC |
1949 | files="${files} ${GDB_NM_FILE}" |
1950 | links="${links} nm.h" | |
60ca704f | 1951 | AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile]) |
c906108c | 1952 | fi |
5a2402b8 AC |
1953 | AC_SUBST(nm_h) |
1954 | ||
c906108c SS |
1955 | AC_LINK_FILES($files, $links) |
1956 | ||
1957 | dnl Check for exe extension set on certain hosts (e.g. Win32) | |
1958 | AC_EXEEXT | |
1959 | ||
234b45d4 | 1960 | dnl Detect the character set used by this host. |
6c7a06a3 TT |
1961 | dnl At the moment, we just assume it's UTF-8. |
1962 | AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8", | |
234b45d4 KB |
1963 | [Define to be a string naming the default host character set.]) |
1964 | ||
89a34d1b JM |
1965 | dnl Required by html, pdf, install-pdf and install-html |
1966 | AC_SUBST(datarootdir) | |
1967 | AC_SUBST(docdir) | |
1968 | AC_SUBST(htmldir) | |
1969 | AC_SUBST(pdfdir) | |
1970 | ||
e28b3332 | 1971 | AC_OUTPUT(Makefile .gdbinit:gdbinit.in gnulib/Makefile, |
c906108c SS |
1972 | [ |
1973 | dnl Autoconf doesn't provide a mechanism for modifying definitions | |
1974 | dnl provided by makefile fragments. | |
1975 | dnl | |
c906108c SS |
1976 | |
1977 | changequote(,)dnl | |
db985757 | 1978 | sed -e '/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp |
c906108c SS |
1979 | mv -f Makefile.tmp Makefile |
1980 | changequote([,])dnl | |
1981 | ||
2acceee2 | 1982 | |
c906108c SS |
1983 | case x$CONFIG_HEADERS in |
1984 | xconfig.h:config.in) | |
1985 | echo > stamp-h ;; | |
1986 | esac | |
1987 | ], | |
1988 | [ | |
1989 | gdb_host_cpu=$gdb_host_cpu | |
c906108c SS |
1990 | nativefile=$nativefile |
1991 | ]) | |
1992 | ||
1993 | exit 0 |